diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index e772a1c..428898f 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -27,3 +27,25 @@ jobs: - run: npm ci - run: npm run build --if-present - run: npm test + +on: + push: + tags: + - 'v*.*.*' + +jobs: + publish: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 12 + - run: npm install + - run: npm test + - uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} + - run: npm publish --access public diff --git a/dist/wms-capabilities.js b/dist/wms-capabilities.js deleted file mode 100644 index 56c841b..0000000 --- a/dist/wms-capabilities.js +++ /dev/null @@ -1,1140 +0,0 @@ - -/** - * wms-capabilities @0.4.1 - * @description WMS service Capabilities > JSON, based on openlayers - * @license BSD-2-Clause - * @preserve - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.WMSCapabilities = factory()); -}(this, function () { 'use strict'; - - /** - * Returns true if the specified value is not undefined. - * - * @param {?} val Variable to test. - * @return {Boolean} Whether variable is defined. - */ - function isDef (val) { return val !== void 0; } - - /** - * Adds a key-value pair to the object/map/hash if it doesn't exist yet. - * - * @param {Object.} obj The object to which to add the key-value pair. - * @param {String} key The key to add. - * @param {V} value The value to add if the key wasn't present. - * @return {V} The value of the entry at the end of the function. - * @template K,V - */ - function setIfUndefined (obj, key, value) { return key in obj ? obj[key] : (obj[key] = value); } - - /** - * @enum {Number} - */ - var NODE_TYPES = { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 - }; - - var XMLParser = function XMLParser (DOMParser) { - /** - * @type {DOMParser} - */ - this._parser = new DOMParser(); - }; - /** - * @param{String} xmlstring - * @return {Document} - */ - XMLParser.prototype.toDocument = function toDocument (xmlstring) { - return this._parser.parseFromString(xmlstring, 'application/xml'); - }; - - /** - * Recursively grab all text content of child nodes into a single string. - * @param {Node} node Node. - * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line - * breaks. - * @return {string} All text content. - * @api - */ - XMLParser.prototype.getAllTextContent = function getAllTextContent$1 (node, normalizeWhitespace) { - return getAllTextContent(node, normalizeWhitespace, []).join(''); - }; - - - /** - * Recursively grab all text content of child nodes into a single string. - * @param {Node} node Node. - * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line - * breaks. - * @return {string} All text content. - * @api - */ - function getAllTextContent (node, normalizeWhitespace) { - return getAllTextContentInternal(node, normalizeWhitespace, []).join(''); - } - - - /** - * @param {Node} node Node. - * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line - * breaks. - * @param {Array.} accumulator Accumulator. - * @private - * @return {Array.} Accumulator. - */ - function getAllTextContentInternal (node, normalizeWhitespace, accumulator) { - if (node.nodeType === NODE_TYPES.CDATA_SECTION || - node.nodeType === NODE_TYPES.TEXT) { - if (normalizeWhitespace) { - // FIXME understand why goog.dom.getTextContent_ uses String here - accumulator.push(String(node.nodeValue).replace(/(\r\n|\r|\n)/g, '')); - } else { - accumulator.push(node.nodeValue); - } - } else { - var n; - for (n = node.firstChild; n; n = n.nextSibling) { - getAllTextContentInternal(n, normalizeWhitespace, accumulator); - } - } - return accumulator; - } - - /** - * @param {Object.>} parsersNS - * Parsers by namespace. - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @param {*=} bind The object to use as `this`. - */ - function parseNode (parsersNS, node, objectStack, bind) { - for (var n = firstElementChild(node); n; n = nextElementSibling(n)) { - var namespaceURI = n.namespaceURI || null; - var parsers = parsersNS[namespaceURI]; - if (isDef(parsers)) { - var parser = parsers[n.localName]; - if (isDef(parser)) { - parser.call(bind, n, objectStack); - } - } - } - } - - /** - * Mostly for node.js - * @param {Node} node - * @return {Node} - */ - function firstElementChild (node) { - var firstElementChild = node.firstElementChild || node.firstChild; - while (firstElementChild && firstElementChild.nodeType !== NODE_TYPES.ELEMENT) { - firstElementChild = firstElementChild.nextSibling; - } - return firstElementChild; - } - - /** - * Mostly for node.js - * @param {Node} node - * @return {Node} - */ - function nextElementSibling (node) { - var nextSibling = node.nextElementSibling || node.nextSibling; - while (nextSibling && nextSibling.nodeType !== NODE_TYPES.ELEMENT) { - nextSibling = nextSibling.nextSibling; - } - return nextSibling; - } - - /** - * @param {Array.} namespaceURIs Namespace URIs. - * @param {Object.} parsers Parsers. - * @param {Object.>=} opt_parsersNS - * ParsersNS. - * @return {Object.>} Parsers NS. - */ - function makeParsersNS (namespaceURIs, parsers, opt_parsersNS) { - return /** @type {Object.>} */ ( - makeStructureNS(namespaceURIs, parsers, opt_parsersNS)); - } - - /** - * Creates a namespaced structure, using the same values for each namespace. - * This can be used as a starting point for versioned parsers, when only a few - * values are version specific. - * @param {Array.} namespaceURIs Namespace URIs. - * @param {T} structure Structure. - * @param {Object.=} opt_structureNS Namespaced structure to add to. - * @return {Object.} Namespaced structure. - * @template T - */ - function makeStructureNS (namespaceURIs, structure, opt_structureNS) { - /** - * @type {Object.} - */ - var structureNS = isDef(opt_structureNS) ? opt_structureNS : {}; - var i, ii; - for (i = 0, ii = namespaceURIs.length; i < ii; ++i) { - structureNS[namespaceURIs[i]] = structure; - } - return structureNS; - } - - - /** - * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. - * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {Function} Parser. - * @template T - */ - function makeArrayPusher (valueReader, opt_this) { - return ( - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - */ - function(node, objectStack) { - var value = valueReader.call(isDef(opt_this) ? opt_this : this, - node, objectStack); - if (isDef(value)) { - var array = objectStack[objectStack.length - 1]; - array.push(value); - } - }); - } - - /** - * @param {Object} object Object. - * @param {Object.>} parsersNS Parsers by namespace. - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @param {*=} bind The object to use as `this`. - * @return {Object|undefined} Object. - */ - function pushParseAndPop (object, parsersNS, node, objectStack, bind) { - objectStack.push(object); - parseNode(parsersNS, node, objectStack, bind); - return objectStack.pop(); - } - - - /** - * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. - * @param {string=} opt_property Property. - * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {XMLParser.Parser} Parser. - * @template T - */ - function makeObjectPropertySetter (valueReader, opt_property, opt_this) { - return ( - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - */ - function(node, objectStack) { - var value = valueReader.call(isDef(opt_this) ? opt_this : this, - node, objectStack); - if (isDef(value)) { - var object = /** @type {Object} */ (objectStack[objectStack.length - 1]); - var property = isDef(opt_property) ? opt_property : node.localName; - object[property] = value; - } - }); - } - - - /** - * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. - * @param {string=} opt_property Property. - * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {Function} Parser. - * @template T - */ - function makeObjectPropertyPusher (valueReader, opt_property, opt_this) { - return ( - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - */ - function(node, objectStack) { - var value = valueReader.call(isDef(opt_this) ? opt_this : this, - node, objectStack); - - if (isDef(value)) { - var object = /** @type {Object} */ (objectStack[objectStack.length - 1]); - var property = isDef(opt_property) ? opt_property : node.localName; - var array = setIfUndefined(object, property, []); - array.push(value); - } - }); - } - - /** - * Make sure we trim BOM and NBSP - * @type {RegExp} - */ - var TRIM_RE = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; - - /** - * @param {String} str - * @return {String} - */ - function trim (str) { - return str.replace(TRIM_RE, ''); - } - - /** - * @param {string} string String. - * @return {boolean|undefined} Boolean. - */ - function readBooleanString (string) { - var m = /^\s*(true|1)|(false|0)\s*$/.exec(string); - if (m) { - return isDef(m[1]) || false; - } else { - return undefined; - } - } - - - /** - * @param {Node} node Node. - * @return {number|undefined} Decimal. - */ - function readDecimal (node) { - return readDecimalString(getAllTextContent(node, false)); - } - - - /** - * @param {string} string String. - * @return {number|undefined} Decimal. - */ - function readDecimalString (string) { - // FIXME check spec - var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(string); - if (m) { - return parseFloat(m[1]); - } else { - return undefined; - } - } - - - /** - * @param {Node} node Node. - * @return {number|undefined} Non negative integer. - */ - function readNonNegativeInteger (node) { - return readNonNegativeIntegerString(getAllTextContent(node, false)); - } - - - /** - * @param {string} string String. - * @return {number|undefined} Non negative integer. - */ - function readNonNegativeIntegerString (string) { - var m = /^\s*(\d+)\s*$/.exec(string); - if (m) { - return parseInt(m[1], 10); - } else { - return undefined; - } - } - - - /** - * @param {Node} node Node. - * @return {string|undefined} String. - */ - function readString (node) { - return trim(getAllTextContent(node, false)); - } - - /** - * @const - * @type {string} - */ - var NAMESPACE_URI$1 = 'http://www.w3.org/1999/xlink'; - - /** - * @param {Node} node Node. - * @return {Boolean|undefined} Boolean. - */ - function readHref (node) { - return node.getAttributeNS(NAMESPACE_URI$1, 'href'); - } - - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Attribution object. - */ - function readAttribution(node, objectStack) { - return pushParseAndPop({}, ATTRIBUTION_PARSERS, node, objectStack); - } - - - /** - * @private - * @param {Node} node Node. - * @return {ol.Extent} Bounding box object. - */ - function readBoundingBoxExtent (node) { - return [ - readDecimalString(node.getAttribute('minx')), - readDecimalString(node.getAttribute('miny')), - readDecimalString(node.getAttribute('maxx')), - readDecimalString(node.getAttribute('maxy')) - ]; - } - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object} Bounding box object. - */ - function readBoundingBox (node, objectStack) { - var extent = readBoundingBoxExtent(node); - var resolutions = [ - readDecimalString(node.getAttribute('resx')), - readDecimalString(node.getAttribute('resy')) - ]; - - return { - 'crs': node.getAttribute('CRS') || node.getAttribute('SRS'), - extent: extent, res: resolutions - }; - } - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.Extent|undefined} Bounding box object. - */ - function readLatLonBoundingBox (node, objectStack) { - var extent = readBoundingBoxExtent(node); - - if (!isDef(extent[0]) || !isDef(extent[1]) || - !isDef(extent[2]) || !isDef(extent[3])) { - return undefined; - } - - return extent; - } - - - /** - * @privat - * @param {Node} node Node - * @param {Arra.} objectStack Object stack - * @return {Object} - */ - function readScaleHint (node, objectStack) { - var min = parseFloat(node.getAttribute('min')); - var max = parseFloat(node.getAttribute('max')); - - return { min: min, max: max }; - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {ol.Extent|undefined} Bounding box object. - */ - function readEXGeographicBoundingBox (node, objectStack) { - var geographicBoundingBox = pushParseAndPop({}, - EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS, - node, objectStack); - if (!isDef(geographicBoundingBox)) { return undefined; } - - var westBoundLongitude = /** @type {number|undefined} */ - (geographicBoundingBox['westBoundLongitude']); - var southBoundLatitude = /** @type {number|undefined} */ - (geographicBoundingBox['southBoundLatitude']); - var eastBoundLongitude = /** @type {number|undefined} */ - (geographicBoundingBox['eastBoundLongitude']); - var northBoundLatitude = /** @type {number|undefined} */ - (geographicBoundingBox['northBoundLatitude']); - - if (!isDef(westBoundLongitude) || !isDef(southBoundLatitude) || - !isDef(eastBoundLongitude) || !isDef(northBoundLatitude)) { - return undefined; - } - - return [ - westBoundLongitude, southBoundLatitude, - eastBoundLongitude, northBoundLatitude - ]; - } - - - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Capability object. - */ - function readCapability (node, objectStack) { - return pushParseAndPop({}, CAPABILITY_PARSERS, node, objectStack); - } - - - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Service object. - */ - function readService (node, objectStack) { - return pushParseAndPop({}, SERVICE_PARSERS, node, objectStack); - } - - - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Contact information object. - */ - function readContactInformation (node, objectStack) { - return pushParseAndPop({}, CONTACT_INFORMATION_PARSERS, - node, objectStack); - } - - - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Contact person object. - */ - function readContactPersonPrimary (node, objectStack) { - return pushParseAndPop({}, CONTACT_PERSON_PARSERS, - node, objectStack); - } - - - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Contact address object. - */ - function readContactAddress (node, objectStack) { - return pushParseAndPop({}, CONTACT_ADDRESS_PARSERS, - node, objectStack); - } - - - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Array.|undefined} Format array. - */ - function readException (node, objectStack) { - return pushParseAndPop( - [], EXCEPTION_PARSERS, node, objectStack); - } - - - /** - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @private - * @return {Object|undefined} Layer object. - */ - function readCapabilityLayer (node, objectStack) { - var queryable = readBooleanString(node.getAttribute('queryable')); - return pushParseAndPop({ - queryable: isDef(queryable) ? queryable : false }, - LAYER_PARSERS, node, objectStack); - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Layer object. - */ - function readLayer (node, objectStack) { - var parentLayerObject = /** @type {Object.} */ - (objectStack[objectStack.length - 1]); - - var layerObject = /** @type {Object.} */ - (pushParseAndPop({}, LAYER_PARSERS, - node, objectStack)); - - if (!isDef(layerObject)) { return undefined; } - - var queryable = readBooleanString(node.getAttribute('queryable')); - if (!isDef(queryable)) { - queryable = parentLayerObject['queryable']; - } - layerObject['queryable'] = isDef(queryable) ? queryable : false; - - var cascaded = readNonNegativeIntegerString(node.getAttribute('cascaded')); - if (!isDef(cascaded)) { - cascaded = parentLayerObject['cascaded']; - } - layerObject['cascaded'] = cascaded; - - var opaque = readBooleanString(node.getAttribute('opaque')); - if (!isDef(opaque)) { - opaque = parentLayerObject['opaque']; - } - layerObject['opaque'] = isDef(opaque) ? opaque : false; - - var noSubsets = readBooleanString(node.getAttribute('noSubsets')); - if (!isDef(noSubsets)) { - noSubsets = parentLayerObject['noSubsets']; - } - layerObject['noSubsets'] = isDef(noSubsets) ? noSubsets : false; - - var fixedWidth = readDecimalString(node.getAttribute('fixedWidth')); - if (!isDef(fixedWidth)) { - fixedWidth = parentLayerObject['fixedWidth']; - } - layerObject['fixedWidth'] = fixedWidth; - - var fixedHeight = readDecimalString(node.getAttribute('fixedHeight')); - if (!isDef(fixedHeight)) { - fixedHeight = parentLayerObject['fixedHeight']; - } - layerObject['fixedHeight'] = fixedHeight; - - // See 7.2.4.8 - var addKeys = ['Style', 'CRS', 'AuthorityURL']; - for (var i = 0, len = addKeys.length; i < len; i++) { - var key = addKeys[i]; - var parentValue = parentLayerObject[key]; - if (isDef(parentValue)) { - var childValue = setIfUndefined(layerObject, key, []); - childValue = childValue.concat(parentValue); - layerObject[key] = childValue; - } - } - - var replaceKeys = ['EX_GeographicBoundingBox', 'BoundingBox', 'Dimension', - 'Attribution', 'MinScaleDenominator', 'MaxScaleDenominator' - ]; - for (var i$1 = 0, len$1 = replaceKeys.length; i$1 < len$1; i$1++) { - var key$1 = replaceKeys[i$1]; - var childValue$1 = layerObject[key$1]; - if (!isDef(childValue$1)) { - var parentValue$1 = parentLayerObject[key$1]; - layerObject[key$1] = parentValue$1; - } - } - - return layerObject; - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object} Dimension object. - */ - function readDimension (node, objectStack) { - return { - 'name': node.getAttribute('name'), - 'units': node.getAttribute('units'), - 'unitSymbol': node.getAttribute('unitSymbol'), - 'default': node.getAttribute('default'), - 'multipleValues': readBooleanString(node.getAttribute('multipleValues')), - 'nearestValue': readBooleanString(node.getAttribute('nearestValue')), - 'current': readBooleanString(node.getAttribute('current')), - 'values': readString(node) - }; - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Online resource object. - */ - function readFormatOnlineresource (node, objectStack) { - return pushParseAndPop({}, FORMAT_ONLINERESOURCE_PARSERS, - node, objectStack); - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Request object. - */ - function readRequest (node, objectStack) { - return pushParseAndPop({}, REQUEST_PARSERS, node, objectStack); - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} DCP type object. - */ - function readDCPType (node, objectStack) { - return pushParseAndPop({}, DCPTYPE_PARSERS, node, objectStack); - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} HTTP object. - */ - function readHTTP (node, objectStack) { - return pushParseAndPop({}, HTTP_PARSERS, node, objectStack); - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Operation type object. - */ - function readOperationType (node, objectStack) { - return pushParseAndPop({}, OPERATIONTYPE_PARSERS, node, objectStack); - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Online resource object. - */ - function readSizedFormatOnlineresource (node, objectStack) { - var formatOnlineresource = readFormatOnlineresource(node, objectStack); - if (isDef(formatOnlineresource)) { - var size = [ - readNonNegativeIntegerString(node.getAttribute('width')), - readNonNegativeIntegerString(node.getAttribute('height')) - ]; - formatOnlineresource['size'] = size; - return formatOnlineresource; - } - return undefined; - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Authority URL object. - */ - function readAuthorityURL (node, objectStack) { - var authorityObject = readFormatOnlineresource(node, objectStack); - if (isDef(authorityObject)) { - authorityObject['name'] = node.getAttribute('name'); - return authorityObject; - } - return undefined; - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Metadata URL object. - */ - function readMetadataURL (node, objectStack) { - var metadataObject = readFormatOnlineresource(node, objectStack); - if (isDef(metadataObject)) { - metadataObject['type'] = node.getAttribute('type'); - return metadataObject; - } - return undefined; - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Object|undefined} Style object. - */ - function readStyle (node, objectStack) { - return pushParseAndPop({}, STYLE_PARSERS, node, objectStack); - } - - - /** - * @private - * @param {Node} node Node. - * @param {Array.<*>} objectStack Object stack. - * @return {Array.|undefined} Keyword list. - */ - function readKeywordList (node, objectStack) { - return pushParseAndPop( - [], KEYWORDLIST_PARSERS, node, objectStack); - } - - - /** - * @const - * @type {Array.} - */ - var NAMESPACE_URIS = [ - null, - 'http://www.opengis.net/wms' - ]; - - /** - * @const - * @type {Object.>} - * @private - */ - var PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Service': makeObjectPropertySetter(readService), - 'Capability': makeObjectPropertySetter(readCapability) - }); - - /** - * @const - * @type {Object.>} - * @private - */ - var CAPABILITY_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Request': makeObjectPropertySetter(readRequest), - 'Exception': makeObjectPropertySetter(readException), - 'Layer': makeObjectPropertySetter(readCapabilityLayer) - }); - - /** - * @const - * @type {Object.>} - * @private - */ - var SERVICE_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Name': makeObjectPropertySetter(readString), - 'Title': makeObjectPropertySetter(readString), - 'Abstract': makeObjectPropertySetter(readString), - 'KeywordList': makeObjectPropertySetter(readKeywordList), - 'OnlineResource': makeObjectPropertySetter(readHref), - 'ContactInformation': makeObjectPropertySetter(readContactInformation), - 'Fees': makeObjectPropertySetter(readString), - 'AccessConstraints': makeObjectPropertySetter(readString), - 'LayerLimit': makeObjectPropertySetter(readNonNegativeInteger), - 'MaxWidth': makeObjectPropertySetter(readNonNegativeInteger), - 'MaxHeight': makeObjectPropertySetter(readNonNegativeInteger) - }); - - /** - * @const - * @type {Object.>} - * @private - */ - var CONTACT_INFORMATION_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'ContactPersonPrimary': makeObjectPropertySetter(readContactPersonPrimary), - 'ContactPosition': makeObjectPropertySetter(readString), - 'ContactAddress': makeObjectPropertySetter(readContactAddress), - 'ContactVoiceTelephone': makeObjectPropertySetter(readString), - 'ContactFacsimileTelephone': makeObjectPropertySetter(readString), - 'ContactElectronicMailAddress': makeObjectPropertySetter(readString) - }); - - /** - * @const - * @type {Object.>} - * @private - */ - var CONTACT_PERSON_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'ContactPerson': makeObjectPropertySetter(readString), - 'ContactOrganization': makeObjectPropertySetter(readString) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var CONTACT_ADDRESS_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'AddressType': makeObjectPropertySetter(readString), - 'Address': makeObjectPropertySetter(readString), - 'City': makeObjectPropertySetter(readString), - 'StateOrProvince': makeObjectPropertySetter(readString), - 'PostCode': makeObjectPropertySetter(readString), - 'Country': makeObjectPropertySetter(readString) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var EXCEPTION_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Format': makeArrayPusher(readString) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var LAYER_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Name': makeObjectPropertySetter(readString), - 'Title': makeObjectPropertySetter(readString), - 'Abstract': makeObjectPropertySetter(readString), - 'KeywordList': makeObjectPropertySetter(readKeywordList), - 'CRS': makeObjectPropertyPusher(readString), - 'SRS': makeObjectPropertyPusher(readString), - 'EX_GeographicBoundingBox': makeObjectPropertySetter(readEXGeographicBoundingBox), - 'LatLonBoundingBox': makeObjectPropertySetter(readLatLonBoundingBox), - 'BoundingBox': makeObjectPropertyPusher(readBoundingBox), - 'Dimension': makeObjectPropertyPusher(readDimension), - 'Attribution': makeObjectPropertySetter(readAttribution), - 'AuthorityURL': makeObjectPropertyPusher(readAuthorityURL), - 'Identifier': makeObjectPropertyPusher(readString), - 'MetadataURL': makeObjectPropertyPusher(readMetadataURL), - 'DataURL': makeObjectPropertyPusher(readFormatOnlineresource), - 'FeatureListURL': makeObjectPropertyPusher(readFormatOnlineresource), - 'Style': makeObjectPropertyPusher(readStyle), - 'MinScaleDenominator': makeObjectPropertySetter(readDecimal), - 'MaxScaleDenominator': makeObjectPropertySetter(readDecimal), - 'ScaleHint': makeObjectPropertySetter(readScaleHint), - 'Layer': makeObjectPropertyPusher(readLayer) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var ATTRIBUTION_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Title': makeObjectPropertySetter(readString), - 'OnlineResource': makeObjectPropertySetter(readHref), - 'LogoURL': makeObjectPropertySetter(readSizedFormatOnlineresource) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS = - makeParsersNS(NAMESPACE_URIS, { - 'westBoundLongitude': makeObjectPropertySetter(readDecimal), - 'eastBoundLongitude': makeObjectPropertySetter(readDecimal), - 'southBoundLatitude': makeObjectPropertySetter(readDecimal), - 'northBoundLatitude': makeObjectPropertySetter(readDecimal) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var REQUEST_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'GetCapabilities': makeObjectPropertySetter( - readOperationType), - 'GetMap': makeObjectPropertySetter( - readOperationType), - 'GetFeatureInfo': makeObjectPropertySetter( - readOperationType) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var OPERATIONTYPE_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Format': makeObjectPropertyPusher(readString), - 'DCPType': makeObjectPropertyPusher( - readDCPType) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var DCPTYPE_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'HTTP': makeObjectPropertySetter( - readHTTP) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var HTTP_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Get': makeObjectPropertySetter( - readFormatOnlineresource), - 'Post': makeObjectPropertySetter( - readFormatOnlineresource) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var STYLE_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Name': makeObjectPropertySetter(readString), - 'Title': makeObjectPropertySetter(readString), - 'Abstract': makeObjectPropertySetter(readString), - 'LegendURL': makeObjectPropertyPusher(readSizedFormatOnlineresource), - 'StyleSheetURL': makeObjectPropertySetter(readFormatOnlineresource), - 'StyleURL': makeObjectPropertySetter(readFormatOnlineresource) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var FORMAT_ONLINERESOURCE_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Format': makeObjectPropertySetter(readString), - 'OnlineResource': makeObjectPropertySetter(readHref) - }); - - - /** - * @const - * @type {Object.>} - * @private - */ - var KEYWORDLIST_PARSERS = makeParsersNS( - NAMESPACE_URIS, { - 'Keyword': makeArrayPusher(readString) - }); - - var WMS = function WMS(xmlString, DOMParser) { - if (!DOMParser && typeof window !== 'undefined') { - DOMParser = window.DOMParser; - } - - /** - * @type {String} - */ - this.version = undefined; - - /** - * @type {XMLParser} - */ - this._parser = new XMLParser(DOMParser); - - /** - * @type {String=} - */ - this._data = xmlString; - }; - - - /** - * @param {String} xmlString - * @return {WMS} - */ - WMS.prototype.data = function data (xmlString) { - this._data = xmlString; - return this; - }; - - /** - * @param{String=} xmlString - * @return {Object} - */ - WMS.prototype.toJSON = function toJSON (xmlString) { - xmlString = xmlString || this._data; - return this.parse(xmlString); - }; - - /** - * @return {String} xml - */ - WMS.prototype.parse = function parse (xmlString) { - return this._readFromDocument(this._parser.toDocument(xmlString)); - }; - - /** - * @param{Document} doc - * @return {Object} - */ - WMS.prototype._readFromDocument = function _readFromDocument (doc) { - for (var node = doc.firstChild; node; node = node.nextSibling) { - if (node.nodeType == NODE_TYPES.ELEMENT) { - return this.readFromNode(node); - } - } - return null; - }; - - /** - * @param{DOMNode} node - * @return {Object} - */ - WMS.prototype.readFromNode = function readFromNode (node) { - this.version = node.getAttribute('version'); - var wmsCapabilityObject = pushParseAndPop({ - 'version': this.version - }, PARSERS, node, []); - - return wmsCapabilityObject || null; - }; - - return WMS; - -})); -//# sourceMappingURL=wms-capabilities.js.map diff --git a/dist/wms-capabilities.js.map b/dist/wms-capabilities.js.map deleted file mode 100644 index fd33782..0000000 --- a/dist/wms-capabilities.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wms-capabilities.js","sources":["../src/utils/isdef.js","../src/utils/setifundefined.js","../src/node_types.js","../src/xml_parser.js","../src/utils/string.js","../src/xsd.js","../src/xlink.js","../src/parsers.js","../src/index.js"],"sourcesContent":["/**\n * Returns true if the specified value is not undefined.\n *\n * @param {?} val Variable to test.\n * @return {Boolean} Whether variable is defined.\n */\nexport default (val) => val !== void 0;\n\n","/**\n * Adds a key-value pair to the object/map/hash if it doesn't exist yet.\n *\n * @param {Object.} obj The object to which to add the key-value pair.\n * @param {String} key The key to add.\n * @param {V} value The value to add if the key wasn't present.\n * @return {V} The value of the entry at the end of the function.\n * @template K,V\n */\nexport default (obj, key, value) => key in obj ? obj[key] : (obj[key] = value);\n","/**\n * @enum {Number}\n */\nconst NODE_TYPES = {\n ELEMENT: 1,\n ATTRIBUTE: 2,\n TEXT: 3,\n CDATA_SECTION: 4,\n ENTITY_REFERENCE: 5,\n ENTITY: 6,\n PROCESSING_INSTRUCTION: 7,\n COMMENT: 8,\n DOCUMENT: 9,\n DOCUMENT_TYPE: 10,\n DOCUMENT_FRAGMENT: 11,\n NOTATION: 12\n};\n\nexport default NODE_TYPES;\n","import isDef from './utils/isdef';\nimport setIfUndefined from'./utils/setifundefined';\nimport nodeTypes from './node_types';\n\nexport default class XMLParser {\n /**\n * XML DOM parser\n * @constructor\n * @param {DOMParser} DOMParser\n */\n constructor (DOMParser) {\n /**\n * @type {DOMParser}\n */\n this._parser = new DOMParser();\n };\n\n /**\n * @param {String} xmlstring\n * @return {Document}\n */\n toDocument (xmlstring) {\n return this._parser.parseFromString(xmlstring, 'application/xml');\n }\n\n /**\n * Recursively grab all text content of child nodes into a single string.\n * @param {Node} node Node.\n * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line\n * breaks.\n * @return {string} All text content.\n * @api\n */\n getAllTextContent (node, normalizeWhitespace) {\n return getAllTextContent(node, normalizeWhitespace, []).join('');\n }\n}\n\n\n/**\n* Recursively grab all text content of child nodes into a single string.\n* @param {Node} node Node.\n* @param {boolean} normalizeWhitespace Normalize whitespace: remove all line\n* breaks.\n* @return {string} All text content.\n* @api\n*/\nexport function getAllTextContent (node, normalizeWhitespace) {\n return getAllTextContentInternal(node, normalizeWhitespace, []).join('');\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line\n * breaks.\n * @param {Array.} accumulator Accumulator.\n * @private\n * @return {Array.} Accumulator.\n */\nexport function getAllTextContentInternal (node, normalizeWhitespace, accumulator) {\n if (node.nodeType === nodeTypes.CDATA_SECTION ||\n node.nodeType === nodeTypes.TEXT) {\n if (normalizeWhitespace) {\n // FIXME understand why goog.dom.getTextContent_ uses String here\n accumulator.push(String(node.nodeValue).replace(/(\\r\\n|\\r|\\n)/g, ''));\n } else {\n accumulator.push(node.nodeValue);\n }\n } else {\n var n;\n for (n = node.firstChild; n; n = n.nextSibling) {\n getAllTextContentInternal(n, normalizeWhitespace, accumulator);\n }\n }\n return accumulator;\n}\n\n/**\n * @param {Object.>} parsersNS\n * Parsers by namespace.\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @param {*=} bind The object to use as `this`.\n */\nexport function parseNode (parsersNS, node, objectStack, bind) {\n for (var n = firstElementChild(node); n; n = nextElementSibling(n)) {\n var namespaceURI = n.namespaceURI || null;\n var parsers = parsersNS[namespaceURI];\n if (isDef(parsers)) {\n var parser = parsers[n.localName];\n if (isDef(parser)) {\n parser.call(bind, n, objectStack);\n }\n }\n }\n}\n\n/**\n * Mostly for node.js\n * @param {Node} node\n * @return {Node}\n */\nexport function firstElementChild (node) {\n let firstElementChild = node.firstElementChild || node.firstChild;\n while (firstElementChild && firstElementChild.nodeType !== nodeTypes.ELEMENT) {\n firstElementChild = firstElementChild.nextSibling;\n }\n return firstElementChild;\n}\n\n/**\n * Mostly for node.js\n * @param {Node} node\n * @return {Node}\n */\nfunction nextElementSibling (node) {\n let nextSibling = node.nextElementSibling || node.nextSibling;\n while (nextSibling && nextSibling.nodeType !== nodeTypes.ELEMENT) {\n nextSibling = nextSibling.nextSibling;\n }\n return nextSibling;\n}\n\n/**\n * @param {Array.} namespaceURIs Namespace URIs.\n * @param {Object.} parsers Parsers.\n * @param {Object.>=} opt_parsersNS\n * ParsersNS.\n * @return {Object.>} Parsers NS.\n */\nexport function makeParsersNS (namespaceURIs, parsers, opt_parsersNS) {\n return /** @type {Object.>} */ (\n makeStructureNS(namespaceURIs, parsers, opt_parsersNS));\n}\n\n/**\n * Creates a namespaced structure, using the same values for each namespace.\n * This can be used as a starting point for versioned parsers, when only a few\n * values are version specific.\n * @param {Array.} namespaceURIs Namespace URIs.\n * @param {T} structure Structure.\n * @param {Object.=} opt_structureNS Namespaced structure to add to.\n * @return {Object.} Namespaced structure.\n * @template T\n */\nexport function makeStructureNS (namespaceURIs, structure, opt_structureNS) {\n /**\n * @type {Object.}\n */\n var structureNS = isDef(opt_structureNS) ? opt_structureNS : {};\n var i, ii;\n for (i = 0, ii = namespaceURIs.length; i < ii; ++i) {\n structureNS[namespaceURIs[i]] = structure;\n }\n return structureNS;\n}\n\n\n/**\n * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.\n * @param {T=} opt_this The object to use as `this` in `valueReader`.\n * @return {Function} Parser.\n * @template T\n */\nexport function makeArrayPusher (valueReader, opt_this) {\n return (\n /**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n */\n function(node, objectStack) {\n var value = valueReader.call(isDef(opt_this) ? opt_this : this,\n node, objectStack);\n if (isDef(value)) {\n var array = objectStack[objectStack.length - 1];\n array.push(value);\n }\n });\n}\n\n/**\n * @param {Object} object Object.\n * @param {Object.>} parsersNS Parsers by namespace.\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @param {*=} bind The object to use as `this`.\n * @return {Object|undefined} Object.\n */\nexport function pushParseAndPop (object, parsersNS, node, objectStack, bind) {\n objectStack.push(object);\n parseNode(parsersNS, node, objectStack, bind);\n return objectStack.pop();\n}\n\n\n/**\n * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.\n * @param {string=} opt_property Property.\n * @param {T=} opt_this The object to use as `this` in `valueReader`.\n * @return {XMLParser.Parser} Parser.\n * @template T\n */\nexport function makeObjectPropertySetter (valueReader, opt_property, opt_this) {\n return (\n /**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n */\n function(node, objectStack) {\n let value = valueReader.call(isDef(opt_this) ? opt_this : this,\n node, objectStack);\n if (isDef(value)) {\n var object = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n var property = isDef(opt_property) ? opt_property : node.localName;\n object[property] = value;\n }\n });\n}\n\n\n/**\n * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.\n * @param {string=} opt_property Property.\n * @param {T=} opt_this The object to use as `this` in `valueReader`.\n * @return {Function} Parser.\n * @template T\n */\nexport function makeObjectPropertyPusher (valueReader, opt_property, opt_this) {\n return (\n /**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n */\n function(node, objectStack) {\n var value = valueReader.call(isDef(opt_this) ? opt_this : this,\n node, objectStack);\n\n if (isDef(value)) {\n var object = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n var property = isDef(opt_property) ? opt_property : node.localName;\n var array = setIfUndefined(object, property, []);\n array.push(value);\n }\n });\n }\n","import isDef from './isdef';\n\n/**\n * Make sure we trim BOM and NBSP\n * @type {RegExp}\n */\nconst TRIM_RE = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;\n\n/**\n * Repeats a string n times.\n * @param {String} string The string to repeat.\n * @param {Number} length The number of times to repeat.\n * @return {String} A string containing {@code length} repetitions of\n * {@code string}.\n */\nfunction repeat(string, length) {\n return new Array(length + 1).join(string);\n}\n\n/**\n * @param {String} str\n * @return {String}\n */\nexport function trim (str) {\n return str.replace(TRIM_RE, '');\n}\n\n/**\n * Pads number to given length and optionally rounds it to a given precision.\n * For example:\n *
padNumber(1.25, 2, 3) -> '01.250'\n * padNumber(1.25, 2) -> '01.25'\n * padNumber(1.25, 2, 1) -> '01.3'\n * padNumber(1.25, 0) -> '1.25'
\n *\n * @param {Number} num The number to pad.\n * @param {Number} length The desired length.\n * @param {Number=} opt_precision The desired precision.\n * @return {String} {@code num} as a string with the given options.\n */\nexport function padNumber (num, length, opt_precision) {\n var s = isDef(opt_precision) ? num.toFixed(opt_precision) : String(num);\n var index = s.indexOf('.');\n if (index == -1) {\n index = s.length;\n }\n return repeat('0', Math.max(0, length - index)) + s;\n}\n","import isDef from './utils/isdef';\nimport { padNumber, trim } from './utils/string';\nimport XMLParser, { getAllTextContent } from './xml_parser';\n\n/**\n * @const\n * @type {string}\n */\nexport const NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema';\n\n/**\n * @param {Node} node Node.\n * @return {boolean|undefined} Boolean.\n */\nexport function readBoolean (node) {\n const s = getAllTextContent(node, false);\n return readBooleanString(s);\n}\n\n/**\n * @param {string} string String.\n * @return {boolean|undefined} Boolean.\n */\nexport function readBooleanString (string) {\n const m = /^\\s*(true|1)|(false|0)\\s*$/.exec(string);\n if (m) {\n return isDef(m[1]) || false;\n } else {\n return undefined;\n }\n}\n\n\n/**\n * @param {Node} node Node.\n * @return {number|undefined} DateTime in seconds.\n */\nexport function readDateTime (node) {\n const s = getAllTextContent(node, false);\n const re = /^\\s*(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(Z|(?:([+\\-])(\\d{2})(?::(\\d{2}))?))\\s*$/;\n const m = re.exec(s);\n if (m) {\n const year = parseInt(m[1], 10);\n const month = parseInt(m[2], 10) - 1;\n const day = parseInt(m[3], 10);\n const hour = parseInt(m[4], 10);\n const minute = parseInt(m[5], 10);\n const second = parseInt(m[6], 10);\n let dateTime = Date.UTC(year, month, day, hour, minute, second) / 1000;\n if (m[7] != 'Z') {\n const sign = m[8] == '-' ? -1 : 1;\n dateTime += sign * 60 * parseInt(m[9], 10);\n if (isDef(m[10])) {\n dateTime += sign * 60 * 60 * parseInt(m[10], 10);\n }\n }\n return dateTime;\n } else {\n return undefined;\n }\n}\n\n\n/**\n * @param {Node} node Node.\n * @return {number|undefined} Decimal.\n */\nexport function readDecimal (node) {\n return readDecimalString(getAllTextContent(node, false));\n}\n\n\n/**\n * @param {string} string String.\n * @return {number|undefined} Decimal.\n */\nexport function readDecimalString (string) {\n // FIXME check spec\n const m = /^\\s*([+\\-]?\\d*\\.?\\d+(?:e[+\\-]?\\d+)?)\\s*$/i.exec(string);\n if (m) {\n return parseFloat(m[1]);\n } else {\n return undefined;\n }\n}\n\n\n/**\n * @param {Node} node Node.\n * @return {number|undefined} Non negative integer.\n */\nexport function readNonNegativeInteger (node) {\n return readNonNegativeIntegerString(getAllTextContent(node, false));\n}\n\n\n/**\n * @param {string} string String.\n * @return {number|undefined} Non negative integer.\n */\nexport function readNonNegativeIntegerString (string) {\n const m = /^\\s*(\\d+)\\s*$/.exec(string);\n if (m) {\n return parseInt(m[1], 10);\n } else {\n return undefined;\n }\n}\n\n\n/**\n * @param {Node} node Node.\n * @return {string|undefined} String.\n */\nexport function readString (node) {\n return trim(getAllTextContent(node, false));\n}\n\n\n/**\n * @param {Node} node Node to append a TextNode with the boolean to.\n * @param {boolean} bool Boolean.\n */\nexport function writeBooleanTextNode (node, bool) {\n writeStringTextNode(node, (bool) ? '1' : '0');\n}\n\n\n/**\n * @param {Node} node Node to append a TextNode with the dateTime to.\n * @param {number} dateTime DateTime in seconds.\n */\nexport function writeDateTimeTextNode (node, dateTime) {\n const date = new Date(dateTime * 1000);\n const string = date.getUTCFullYear() + '-' +\n padNumber(date.getUTCMonth() + 1, 2) + '-' +\n padNumber(date.getUTCDate(), 2) + 'T' +\n padNumber(date.getUTCHours(), 2) + ':' +\n padNumber(date.getUTCMinutes(), 2) + ':' +\n padNumber(date.getUTCSeconds(), 2) + 'Z';\n node.appendChild(XMLParser.DOCUMENT.createTextNode(string));\n};\n\n\n/**\n * @param {Node} node Node to append a TextNode with the decimal to.\n * @param {number} decimal Decimal.\n */\nexport function writeDecimalTextNode (node, decimal) {\n const string = decimal.toPrecision();\n node.appendChild(XMLParser.DOCUMENT.createTextNode(string));\n}\n\n\n/**\n * @param {Node} node Node to append a TextNode with the decimal to.\n * @param {number} nonNegativeInteger Non negative integer.\n */\nexport function writeNonNegativeIntegerTextNode (node, nonNegativeInteger) {\n const string = nonNegativeInteger.toString();\n node.appendChild(XMLParser.DOCUMENT.createTextNode(string));\n}\n\n\n/**\n * @param {Node} node Node to append a TextNode with the string to.\n * @param {string} string String.\n */\nexport function writeStringTextNode (node, string) {\n node.appendChild(XMLParser.DOCUMENT.createTextNode(string));\n}\n","/**\n * @const\n * @type {string}\n */\nconst NAMESPACE_URI = 'http://www.w3.org/1999/xlink';\n\n/**\n * @param {Node} node Node.\n * @return {Boolean|undefined} Boolean.\n */\nexport function readHref (node) {\n return node.getAttributeNS(NAMESPACE_URI, 'href');\n}\n","import XMLParser, { \n makeObjectPropertySetter,\n makeObjectPropertyPusher,\n makeParsersNS,\n pushParseAndPop,\n makeArrayPusher\n} from './xml_parser';\nimport { \n readString,\n readDecimalString,\n readBooleanString,\n readNonNegativeIntegerString,\n readNonNegativeInteger,\n readDecimal\n} from './xsd';\nimport { readHref } from './xlink';\nimport setIfUndefined from './utils/setifundefined';\nimport isDef from './utils/isdef';\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Attribution object.\n */\nfunction readAttribution(node, objectStack) {\n return pushParseAndPop({}, ATTRIBUTION_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @return {ol.Extent} Bounding box object.\n */\nfunction readBoundingBoxExtent (node) {\n return [\n readDecimalString(node.getAttribute('minx')),\n readDecimalString(node.getAttribute('miny')),\n readDecimalString(node.getAttribute('maxx')),\n readDecimalString(node.getAttribute('maxy'))\n ];\n}\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object} Bounding box object.\n */\nfunction readBoundingBox (node, objectStack) {\n const extent = readBoundingBoxExtent(node);\n const resolutions = [\n readDecimalString(node.getAttribute('resx')),\n readDecimalString(node.getAttribute('resy'))\n ];\n\n return {\n 'crs': node.getAttribute('CRS') || node.getAttribute('SRS'),\n extent, res: resolutions\n };\n}\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {ol.Extent|undefined} Bounding box object.\n */\nfunction readLatLonBoundingBox (node, objectStack) {\n const extent = readBoundingBoxExtent(node);\n\n if (!isDef(extent[0]) || !isDef(extent[1]) ||\n !isDef(extent[2]) || !isDef(extent[3])) {\n return undefined;\n }\n\n return extent;\n}\n\n\n/**\n * @privat\n * @param {Node} node Node\n * @param {Arra.} objectStack Object stack\n * @return {Object}\n */\nfunction readScaleHint (node, objectStack) {\n const min = parseFloat(node.getAttribute('min'));\n const max = parseFloat(node.getAttribute('max'));\n\n return { min, max };\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {ol.Extent|undefined} Bounding box object.\n */\nfunction readEXGeographicBoundingBox (node, objectStack) {\n const geographicBoundingBox = pushParseAndPop({},\n EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS,\n node, objectStack);\n if (!isDef(geographicBoundingBox)) return undefined;\n\n const westBoundLongitude = /** @type {number|undefined} */\n (geographicBoundingBox['westBoundLongitude']);\n const southBoundLatitude = /** @type {number|undefined} */\n (geographicBoundingBox['southBoundLatitude']);\n const eastBoundLongitude = /** @type {number|undefined} */\n (geographicBoundingBox['eastBoundLongitude']);\n const northBoundLatitude = /** @type {number|undefined} */\n (geographicBoundingBox['northBoundLatitude']);\n\n if (!isDef(westBoundLongitude) || !isDef(southBoundLatitude) ||\n !isDef(eastBoundLongitude) || !isDef(northBoundLatitude)) {\n return undefined;\n }\n\n return [\n westBoundLongitude, southBoundLatitude,\n eastBoundLongitude, northBoundLatitude\n ];\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Capability object.\n */\nfunction readCapability (node, objectStack) {\n return pushParseAndPop({}, CAPABILITY_PARSERS, node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Service object.\n */\nfunction readService (node, objectStack) {\n return pushParseAndPop({}, SERVICE_PARSERS, node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Contact information object.\n */\nfunction readContactInformation (node, objectStack) {\n return pushParseAndPop({}, CONTACT_INFORMATION_PARSERS,\n node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Contact person object.\n */\nfunction readContactPersonPrimary (node, objectStack) {\n return pushParseAndPop({}, CONTACT_PERSON_PARSERS,\n node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Contact address object.\n */\nfunction readContactAddress (node, objectStack) {\n return pushParseAndPop({}, CONTACT_ADDRESS_PARSERS,\n node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Array.|undefined} Format array.\n */\nfunction readException (node, objectStack) {\n return pushParseAndPop(\n [], EXCEPTION_PARSERS, node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Layer object.\n */\nfunction readCapabilityLayer (node, objectStack) {\n const queryable = readBooleanString(node.getAttribute('queryable')); \n return pushParseAndPop({\n queryable: isDef(queryable) ? queryable : false }, \n LAYER_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Layer object.\n */\nfunction readLayer (node, objectStack) {\n var parentLayerObject = /** @type {Object.} */\n (objectStack[objectStack.length - 1]);\n\n const layerObject = /** @type {Object.} */\n (pushParseAndPop({}, LAYER_PARSERS,\n node, objectStack));\n\n if (!isDef(layerObject)) return undefined;\n\n let queryable = readBooleanString(node.getAttribute('queryable'));\n if (!isDef(queryable)) {\n queryable = parentLayerObject['queryable'];\n }\n layerObject['queryable'] = isDef(queryable) ? queryable : false;\n\n let cascaded = readNonNegativeIntegerString(node.getAttribute('cascaded'));\n if (!isDef(cascaded)) {\n cascaded = parentLayerObject['cascaded'];\n }\n layerObject['cascaded'] = cascaded;\n\n let opaque = readBooleanString(node.getAttribute('opaque'));\n if (!isDef(opaque)) {\n opaque = parentLayerObject['opaque'];\n }\n layerObject['opaque'] = isDef(opaque) ? opaque : false;\n\n let noSubsets = readBooleanString(node.getAttribute('noSubsets'));\n if (!isDef(noSubsets)) {\n noSubsets = parentLayerObject['noSubsets'];\n }\n layerObject['noSubsets'] = isDef(noSubsets) ? noSubsets : false;\n\n let fixedWidth = readDecimalString(node.getAttribute('fixedWidth'));\n if (!isDef(fixedWidth)) {\n fixedWidth = parentLayerObject['fixedWidth'];\n }\n layerObject['fixedWidth'] = fixedWidth;\n\n let fixedHeight = readDecimalString(node.getAttribute('fixedHeight'));\n if (!isDef(fixedHeight)) {\n fixedHeight = parentLayerObject['fixedHeight'];\n }\n layerObject['fixedHeight'] = fixedHeight;\n\n // See 7.2.4.8\n const addKeys = ['Style', 'CRS', 'AuthorityURL'];\n for (let i = 0, len = addKeys.length; i < len; i++) {\n const key = addKeys[i];\n const parentValue = parentLayerObject[key];\n if (isDef(parentValue)) {\n let childValue = setIfUndefined(layerObject, key, []);\n childValue = childValue.concat(parentValue);\n layerObject[key] = childValue;\n }\n }\n\n const replaceKeys = ['EX_GeographicBoundingBox', 'BoundingBox', 'Dimension',\n 'Attribution', 'MinScaleDenominator', 'MaxScaleDenominator'\n ];\n for (let i = 0, len = replaceKeys.length; i < len; i++) {\n const key = replaceKeys[i];\n const childValue = layerObject[key];\n if (!isDef(childValue)) {\n const parentValue = parentLayerObject[key];\n layerObject[key] = parentValue;\n }\n }\n\n return layerObject;\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object} Dimension object.\n */\nfunction readDimension (node, objectStack) {\n return {\n 'name': node.getAttribute('name'),\n 'units': node.getAttribute('units'),\n 'unitSymbol': node.getAttribute('unitSymbol'),\n 'default': node.getAttribute('default'),\n 'multipleValues': readBooleanString(node.getAttribute('multipleValues')),\n 'nearestValue': readBooleanString(node.getAttribute('nearestValue')),\n 'current': readBooleanString(node.getAttribute('current')),\n 'values': readString(node)\n };\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Online resource object.\n */\nfunction readFormatOnlineresource (node, objectStack) {\n return pushParseAndPop({}, FORMAT_ONLINERESOURCE_PARSERS,\n node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Request object.\n */\nfunction readRequest (node, objectStack) {\n return pushParseAndPop({}, REQUEST_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} DCP type object.\n */\nfunction readDCPType (node, objectStack) {\n return pushParseAndPop({}, DCPTYPE_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} HTTP object.\n */\nfunction readHTTP (node, objectStack) {\n return pushParseAndPop({}, HTTP_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Operation type object.\n */\nfunction readOperationType (node, objectStack) {\n return pushParseAndPop({}, OPERATIONTYPE_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Online resource object.\n */\nfunction readSizedFormatOnlineresource (node, objectStack) {\n var formatOnlineresource = readFormatOnlineresource(node, objectStack);\n if (isDef(formatOnlineresource)) {\n const size = [\n readNonNegativeIntegerString(node.getAttribute('width')),\n readNonNegativeIntegerString(node.getAttribute('height'))\n ];\n formatOnlineresource['size'] = size;\n return formatOnlineresource;\n }\n return undefined;\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Authority URL object.\n */\nfunction readAuthorityURL (node, objectStack) {\n var authorityObject = readFormatOnlineresource(node, objectStack);\n if (isDef(authorityObject)) {\n authorityObject['name'] = node.getAttribute('name');\n return authorityObject;\n }\n return undefined;\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Metadata URL object.\n */\nfunction readMetadataURL (node, objectStack) {\n var metadataObject = readFormatOnlineresource(node, objectStack);\n if (isDef(metadataObject)) {\n metadataObject['type'] = node.getAttribute('type');\n return metadataObject;\n }\n return undefined;\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Style object.\n */\nfunction readStyle (node, objectStack) {\n return pushParseAndPop({}, STYLE_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Array.|undefined} Keyword list.\n */\nfunction readKeywordList (node, objectStack) {\n return pushParseAndPop(\n [], KEYWORDLIST_PARSERS, node, objectStack);\n}\n\n\n/**\n * @const\n * @type {Array.}\n */\nconst NAMESPACE_URIS = [\n null,\n 'http://www.opengis.net/wms'\n];\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nexport const PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Service': makeObjectPropertySetter(readService),\n 'Capability': makeObjectPropertySetter(readCapability)\n });\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst CAPABILITY_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Request': makeObjectPropertySetter(readRequest),\n 'Exception': makeObjectPropertySetter(readException),\n 'Layer': makeObjectPropertySetter(readCapabilityLayer)\n });\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst SERVICE_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Name': makeObjectPropertySetter(readString),\n 'Title': makeObjectPropertySetter(readString),\n 'Abstract': makeObjectPropertySetter(readString),\n 'KeywordList': makeObjectPropertySetter(readKeywordList),\n 'OnlineResource': makeObjectPropertySetter(readHref),\n 'ContactInformation': makeObjectPropertySetter(readContactInformation),\n 'Fees': makeObjectPropertySetter(readString),\n 'AccessConstraints': makeObjectPropertySetter(readString),\n 'LayerLimit': makeObjectPropertySetter(readNonNegativeInteger),\n 'MaxWidth': makeObjectPropertySetter(readNonNegativeInteger),\n 'MaxHeight': makeObjectPropertySetter(readNonNegativeInteger)\n });\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst CONTACT_INFORMATION_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'ContactPersonPrimary': makeObjectPropertySetter(readContactPersonPrimary),\n 'ContactPosition': makeObjectPropertySetter(readString),\n 'ContactAddress': makeObjectPropertySetter(readContactAddress),\n 'ContactVoiceTelephone': makeObjectPropertySetter(readString),\n 'ContactFacsimileTelephone': makeObjectPropertySetter(readString),\n 'ContactElectronicMailAddress': makeObjectPropertySetter(readString)\n });\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst CONTACT_PERSON_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'ContactPerson': makeObjectPropertySetter(readString),\n 'ContactOrganization': makeObjectPropertySetter(readString)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst CONTACT_ADDRESS_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'AddressType': makeObjectPropertySetter(readString),\n 'Address': makeObjectPropertySetter(readString),\n 'City': makeObjectPropertySetter(readString),\n 'StateOrProvince': makeObjectPropertySetter(readString),\n 'PostCode': makeObjectPropertySetter(readString),\n 'Country': makeObjectPropertySetter(readString)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst EXCEPTION_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Format': makeArrayPusher(readString)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst LAYER_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Name': makeObjectPropertySetter(readString),\n 'Title': makeObjectPropertySetter(readString),\n 'Abstract': makeObjectPropertySetter(readString),\n 'KeywordList': makeObjectPropertySetter(readKeywordList),\n 'CRS': makeObjectPropertyPusher(readString),\n 'SRS': makeObjectPropertyPusher(readString),\n 'EX_GeographicBoundingBox': makeObjectPropertySetter(readEXGeographicBoundingBox),\n 'LatLonBoundingBox': makeObjectPropertySetter(readLatLonBoundingBox),\n 'BoundingBox': makeObjectPropertyPusher(readBoundingBox),\n 'Dimension': makeObjectPropertyPusher(readDimension),\n 'Attribution': makeObjectPropertySetter(readAttribution),\n 'AuthorityURL': makeObjectPropertyPusher(readAuthorityURL),\n 'Identifier': makeObjectPropertyPusher(readString),\n 'MetadataURL': makeObjectPropertyPusher(readMetadataURL),\n 'DataURL': makeObjectPropertyPusher(readFormatOnlineresource),\n 'FeatureListURL': makeObjectPropertyPusher(readFormatOnlineresource),\n 'Style': makeObjectPropertyPusher(readStyle),\n 'MinScaleDenominator': makeObjectPropertySetter(readDecimal),\n 'MaxScaleDenominator': makeObjectPropertySetter(readDecimal),\n 'ScaleHint': makeObjectPropertySetter(readScaleHint),\n 'Layer': makeObjectPropertyPusher(readLayer)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst ATTRIBUTION_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Title': makeObjectPropertySetter(readString),\n 'OnlineResource': makeObjectPropertySetter(readHref),\n 'LogoURL': makeObjectPropertySetter(readSizedFormatOnlineresource)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS =\n makeParsersNS(NAMESPACE_URIS, {\n 'westBoundLongitude': makeObjectPropertySetter(readDecimal),\n 'eastBoundLongitude': makeObjectPropertySetter(readDecimal),\n 'southBoundLatitude': makeObjectPropertySetter(readDecimal),\n 'northBoundLatitude': makeObjectPropertySetter(readDecimal)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst REQUEST_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'GetCapabilities': makeObjectPropertySetter(\n readOperationType),\n 'GetMap': makeObjectPropertySetter(\n readOperationType),\n 'GetFeatureInfo': makeObjectPropertySetter(\n readOperationType)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst OPERATIONTYPE_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Format': makeObjectPropertyPusher(readString),\n 'DCPType': makeObjectPropertyPusher(\n readDCPType)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst DCPTYPE_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'HTTP': makeObjectPropertySetter(\n readHTTP)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst HTTP_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Get': makeObjectPropertySetter(\n readFormatOnlineresource),\n 'Post': makeObjectPropertySetter(\n readFormatOnlineresource)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst STYLE_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Name': makeObjectPropertySetter(readString),\n 'Title': makeObjectPropertySetter(readString),\n 'Abstract': makeObjectPropertySetter(readString),\n 'LegendURL': makeObjectPropertyPusher(readSizedFormatOnlineresource),\n 'StyleSheetURL': makeObjectPropertySetter(readFormatOnlineresource),\n 'StyleURL': makeObjectPropertySetter(readFormatOnlineresource)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst FORMAT_ONLINERESOURCE_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Format': makeObjectPropertySetter(readString),\n 'OnlineResource': makeObjectPropertySetter(readHref)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst KEYWORDLIST_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Keyword': makeArrayPusher(readString)\n });\n","import XMLParser, { pushParseAndPop } from './xml_parser';\nimport nodeTypes from './node_types';\nimport { PARSERS } from './parsers';\n\nexport default class WMS {\n /**\n * WMS Capabilities parser\n *\n * @param {String=} xmlString\n * @constructor\n */\n constructor(xmlString, DOMParser) {\n if (!DOMParser && typeof window !== 'undefined') {\n DOMParser = window.DOMParser;\n }\n\n /**\n * @type {String}\n */\n this.version = undefined;\n\n /**\n * @type {XMLParser}\n */\n this._parser = new XMLParser(DOMParser);\n\n /**\n * @type {String=}\n */\n this._data = xmlString;\n }\n\n\n /**\n * @param {String} xmlString\n * @return {WMS}\n */\n data (xmlString) {\n this._data = xmlString;\n return this;\n }\n\n /**\n * @param {String=} xmlString\n * @return {Object}\n */\n toJSON (xmlString) {\n xmlString = xmlString || this._data;\n return this.parse(xmlString);\n }\n\n /**\n * @return {String} xml\n */\n parse (xmlString) {\n return this._readFromDocument(this._parser.toDocument(xmlString));\n }\n\n /**\n * @param {Document} doc\n * @return {Object}\n */\n _readFromDocument (doc) {\n for (let node = doc.firstChild; node; node = node.nextSibling) {\n if (node.nodeType == nodeTypes.ELEMENT) {\n return this.readFromNode(node);\n }\n }\n return null;\n }\n\n /**\n * @param {DOMNode} node\n * @return {Object}\n */\n readFromNode (node) {\n this.version = node.getAttribute('version');\n const wmsCapabilityObject = pushParseAndPop({\n 'version': this.version\n }, PARSERS, node, []);\n\n return wmsCapabilityObject || null;\n }\n}\n "],"names":["const","nodeTypes","let","NAMESPACE_URI","i","len","key","childValue","parentValue"],"mappings":";;;;;;;;;;;;;;EAAA;;;;;;AAMA,kBAAgB,GAAG,EAAE,SAAG,GAAG,KAAK,KAAK,IAAC;;ECNtC;;;;;;;;;AASA,2BAAgB,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAG,GAAG,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,IAAC;;ECT9E;;;EAGAA,IAAM,UAAU,GAAG;IACjB,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,CAAC;IACP,aAAa,EAAE,CAAC;IAChB,gBAAgB,EAAE,CAAC;IACnB,MAAM,EAAE,CAAC;IACT,sBAAsB,EAAE,CAAC;IACzB,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;IACX,aAAa,EAAE,EAAE;IACjB,iBAAiB,EAAE,EAAE;IACrB,QAAQ,EAAE,EAAE;GACb,CAAC;;ECZa,IAAM,SAAS,GAM5B,kBAAW,EAAE,SAAS,EAAE;;;;IAItB,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,EAAE,CAAC;EACjC,EAAC;EAEH;;;;EAIA,oBAAE,UAAU,wBAAE,SAAS,EAAE;IACvB,OAAS,I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CAAC;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;EAC/B,EAAC;;EAEH;;;EAGA,cAAE,KAAK,mBAAE,SAAS,EAAE;IAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;EACpE,EAAC;;EAEH;;;;EAIA,cAAE,iBAAiB,+BAAE,GAAG,EAAE;IACtB,KAAKE,IAAI,IAAI,GAAG,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE;MAC/D,IAAM,IAAI,CAAC,QAAQ,IAAID,UAAS,CAAC,OAAO,EAAE;QACtC,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;OAChC;KACF;IACH,OAAS,IAAI,CAAC;EACd,EAAC;;EAEH;;;;EAIA,cAAE,YAAY,0BAAE,IAAI,EAAE;IACpB,IAAM,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC5CD,IAAM,mBAAmB,GAAG,eAAe,CAAC;MAC1C,SAAS,EAAE,IAAI,CAAC,OAAO;KACxB,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;;IAEtB,OAAO,mBAAmB,IAAI,IAAI,CAAC;EACrC,CAAC;;;;;;;;"} \ No newline at end of file diff --git a/dist/wms-capabilities.min.js b/dist/wms-capabilities.min.js deleted file mode 100644 index 9d15f9d..0000000 --- a/dist/wms-capabilities.min.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - BSD-2-Clause - @preserve -*/ -'use strict';(function(f,m){"object"===typeof exports&&"undefined"!==typeof module?module.exports=m():"function"===typeof define&&define.amd?define(m):(f=f||self,f.WMSCapabilities=m())})(this,function(){function f(a){return void 0!==a}function m(a,c,b){if(a.nodeType===u.CDATA_SECTION||a.nodeType===u.TEXT)c?b.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g,"")):b.push(a.nodeValue);else for(a=a.firstChild;a;a=a.nextSibling)m(a,c,b);return b}function F(a){for(a=a.nextElementSibling||a.nextSibling;a&& -a.nodeType!==u.ELEMENT;)a=a.nextSibling;return a}function h(a,c,b){b=f(b)?b:{};var d;var n=0;for(d=a.length;n} accumulator Accumulator.\n * @private\n * @return {Array.} Accumulator.\n */\nexport function getAllTextContentInternal (node, normalizeWhitespace, accumulator) {\n if (node.nodeType === nodeTypes.CDATA_SECTION ||\n node.nodeType === nodeTypes.TEXT) {\n if (normalizeWhitespace) {\n // FIXME understand why goog.dom.getTextContent_ uses String here\n accumulator.push(String(node.nodeValue).replace(/(\\r\\n|\\r|\\n)/g, ''));\n } else {\n accumulator.push(node.nodeValue);\n }\n } else {\n var n;\n for (n = node.firstChild; n; n = n.nextSibling) {\n getAllTextContentInternal(n, normalizeWhitespace, accumulator);\n }\n }\n return accumulator;\n}\n\n/**\n * @param {Object.>} parsersNS\n * Parsers by namespace.\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @param {*=} bind The object to use as `this`.\n */\nexport function parseNode (parsersNS, node, objectStack, bind) {\n for (var n = firstElementChild(node); n; n = nextElementSibling(n)) {\n var namespaceURI = n.namespaceURI || null;\n var parsers = parsersNS[namespaceURI];\n if (isDef(parsers)) {\n var parser = parsers[n.localName];\n if (isDef(parser)) {\n parser.call(bind, n, objectStack);\n }\n }\n }\n}\n\n/**\n * Mostly for node.js\n * @param {Node} node\n * @return {Node}\n */\nexport function firstElementChild (node) {\n let firstElementChild = node.firstElementChild || node.firstChild;\n while (firstElementChild && firstElementChild.nodeType !== nodeTypes.ELEMENT) {\n firstElementChild = firstElementChild.nextSibling;\n }\n return firstElementChild;\n}\n\n/**\n * Mostly for node.js\n * @param {Node} node\n * @return {Node}\n */\nfunction nextElementSibling (node) {\n let nextSibling = node.nextElementSibling || node.nextSibling;\n while (nextSibling && nextSibling.nodeType !== nodeTypes.ELEMENT) {\n nextSibling = nextSibling.nextSibling;\n }\n return nextSibling;\n}\n\n/**\n * @param {Array.} namespaceURIs Namespace URIs.\n * @param {Object.} parsers Parsers.\n * @param {Object.>=} opt_parsersNS\n * ParsersNS.\n * @return {Object.>} Parsers NS.\n */\nexport function makeParsersNS (namespaceURIs, parsers, opt_parsersNS) {\n return /** @type {Object.>} */ (\n makeStructureNS(namespaceURIs, parsers, opt_parsersNS));\n}\n\n/**\n * Creates a namespaced structure, using the same values for each namespace.\n * This can be used as a starting point for versioned parsers, when only a few\n * values are version specific.\n * @param {Array.} namespaceURIs Namespace URIs.\n * @param {T} structure Structure.\n * @param {Object.=} opt_structureNS Namespaced structure to add to.\n * @return {Object.} Namespaced structure.\n * @template T\n */\nexport function makeStructureNS (namespaceURIs, structure, opt_structureNS) {\n /**\n * @type {Object.}\n */\n var structureNS = isDef(opt_structureNS) ? opt_structureNS : {};\n var i, ii;\n for (i = 0, ii = namespaceURIs.length; i < ii; ++i) {\n structureNS[namespaceURIs[i]] = structure;\n }\n return structureNS;\n}\n\n\n/**\n * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.\n * @param {T=} opt_this The object to use as `this` in `valueReader`.\n * @return {Function} Parser.\n * @template T\n */\nexport function makeArrayPusher (valueReader, opt_this) {\n return (\n /**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n */\n function(node, objectStack) {\n var value = valueReader.call(isDef(opt_this) ? opt_this : this,\n node, objectStack);\n if (isDef(value)) {\n var array = objectStack[objectStack.length - 1];\n array.push(value);\n }\n });\n}\n\n/**\n * @param {Object} object Object.\n * @param {Object.>} parsersNS Parsers by namespace.\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @param {*=} bind The object to use as `this`.\n * @return {Object|undefined} Object.\n */\nexport function pushParseAndPop (object, parsersNS, node, objectStack, bind) {\n objectStack.push(object);\n parseNode(parsersNS, node, objectStack, bind);\n return objectStack.pop();\n}\n\n\n/**\n * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.\n * @param {string=} opt_property Property.\n * @param {T=} opt_this The object to use as `this` in `valueReader`.\n * @return {XMLParser.Parser} Parser.\n * @template T\n */\nexport function makeObjectPropertySetter (valueReader, opt_property, opt_this) {\n return (\n /**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n */\n function(node, objectStack) {\n let value = valueReader.call(isDef(opt_this) ? opt_this : this,\n node, objectStack);\n if (isDef(value)) {\n var object = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n var property = isDef(opt_property) ? opt_property : node.localName;\n object[property] = value;\n }\n });\n}\n\n\n/**\n * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.\n * @param {string=} opt_property Property.\n * @param {T=} opt_this The object to use as `this` in `valueReader`.\n * @return {Function} Parser.\n * @template T\n */\nexport function makeObjectPropertyPusher (valueReader, opt_property, opt_this) {\n return (\n /**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n */\n function(node, objectStack) {\n var value = valueReader.call(isDef(opt_this) ? opt_this : this,\n node, objectStack);\n\n if (isDef(value)) {\n var object = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n var property = isDef(opt_property) ? opt_property : node.localName;\n var array = setIfUndefined(object, property, []);\n array.push(value);\n }\n });\n }\n","import isDef from './utils/isdef';\nimport { padNumber, trim } from './utils/string';\nimport XMLParser, { getAllTextContent } from './xml_parser';\n\n/**\n * @const\n * @type {string}\n */\nexport const NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema';\n\n/**\n * @param {Node} node Node.\n * @return {boolean|undefined} Boolean.\n */\nexport function readBoolean (node) {\n const s = getAllTextContent(node, false);\n return readBooleanString(s);\n}\n\n/**\n * @param {string} string String.\n * @return {boolean|undefined} Boolean.\n */\nexport function readBooleanString (string) {\n const m = /^\\s*(true|1)|(false|0)\\s*$/.exec(string);\n if (m) {\n return isDef(m[1]) || false;\n } else {\n return undefined;\n }\n}\n\n\n/**\n * @param {Node} node Node.\n * @return {number|undefined} DateTime in seconds.\n */\nexport function readDateTime (node) {\n const s = getAllTextContent(node, false);\n const re = /^\\s*(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(Z|(?:([+\\-])(\\d{2})(?::(\\d{2}))?))\\s*$/;\n const m = re.exec(s);\n if (m) {\n const year = parseInt(m[1], 10);\n const month = parseInt(m[2], 10) - 1;\n const day = parseInt(m[3], 10);\n const hour = parseInt(m[4], 10);\n const minute = parseInt(m[5], 10);\n const second = parseInt(m[6], 10);\n let dateTime = Date.UTC(year, month, day, hour, minute, second) / 1000;\n if (m[7] != 'Z') {\n const sign = m[8] == '-' ? -1 : 1;\n dateTime += sign * 60 * parseInt(m[9], 10);\n if (isDef(m[10])) {\n dateTime += sign * 60 * 60 * parseInt(m[10], 10);\n }\n }\n return dateTime;\n } else {\n return undefined;\n }\n}\n\n\n/**\n * @param {Node} node Node.\n * @return {number|undefined} Decimal.\n */\nexport function readDecimal (node) {\n return readDecimalString(getAllTextContent(node, false));\n}\n\n\n/**\n * @param {string} string String.\n * @return {number|undefined} Decimal.\n */\nexport function readDecimalString (string) {\n // FIXME check spec\n const m = /^\\s*([+\\-]?\\d*\\.?\\d+(?:e[+\\-]?\\d+)?)\\s*$/i.exec(string);\n if (m) {\n return parseFloat(m[1]);\n } else {\n return undefined;\n }\n}\n\n\n/**\n * @param {Node} node Node.\n * @return {number|undefined} Non negative integer.\n */\nexport function readNonNegativeInteger (node) {\n return readNonNegativeIntegerString(getAllTextContent(node, false));\n}\n\n\n/**\n * @param {string} string String.\n * @return {number|undefined} Non negative integer.\n */\nexport function readNonNegativeIntegerString (string) {\n const m = /^\\s*(\\d+)\\s*$/.exec(string);\n if (m) {\n return parseInt(m[1], 10);\n } else {\n return undefined;\n }\n}\n\n\n/**\n * @param {Node} node Node.\n * @return {string|undefined} String.\n */\nexport function readString (node) {\n return trim(getAllTextContent(node, false));\n}\n\n\n/**\n * @param {Node} node Node to append a TextNode with the boolean to.\n * @param {boolean} bool Boolean.\n */\nexport function writeBooleanTextNode (node, bool) {\n writeStringTextNode(node, (bool) ? '1' : '0');\n}\n\n\n/**\n * @param {Node} node Node to append a TextNode with the dateTime to.\n * @param {number} dateTime DateTime in seconds.\n */\nexport function writeDateTimeTextNode (node, dateTime) {\n const date = new Date(dateTime * 1000);\n const string = date.getUTCFullYear() + '-' +\n padNumber(date.getUTCMonth() + 1, 2) + '-' +\n padNumber(date.getUTCDate(), 2) + 'T' +\n padNumber(date.getUTCHours(), 2) + ':' +\n padNumber(date.getUTCMinutes(), 2) + ':' +\n padNumber(date.getUTCSeconds(), 2) + 'Z';\n node.appendChild(XMLParser.DOCUMENT.createTextNode(string));\n};\n\n\n/**\n * @param {Node} node Node to append a TextNode with the decimal to.\n * @param {number} decimal Decimal.\n */\nexport function writeDecimalTextNode (node, decimal) {\n const string = decimal.toPrecision();\n node.appendChild(XMLParser.DOCUMENT.createTextNode(string));\n}\n\n\n/**\n * @param {Node} node Node to append a TextNode with the decimal to.\n * @param {number} nonNegativeInteger Non negative integer.\n */\nexport function writeNonNegativeIntegerTextNode (node, nonNegativeInteger) {\n const string = nonNegativeInteger.toString();\n node.appendChild(XMLParser.DOCUMENT.createTextNode(string));\n}\n\n\n/**\n * @param {Node} node Node to append a TextNode with the string to.\n * @param {string} string String.\n */\nexport function writeStringTextNode (node, string) {\n node.appendChild(XMLParser.DOCUMENT.createTextNode(string));\n}\n","import isDef from './isdef';\n\n/**\n * Make sure we trim BOM and NBSP\n * @type {RegExp}\n */\nconst TRIM_RE = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;\n\n/**\n * Repeats a string n times.\n * @param {String} string The string to repeat.\n * @param {Number} length The number of times to repeat.\n * @return {String} A string containing {@code length} repetitions of\n * {@code string}.\n */\nfunction repeat(string, length) {\n return new Array(length + 1).join(string);\n}\n\n/**\n * @param {String} str\n * @return {String}\n */\nexport function trim (str) {\n return str.replace(TRIM_RE, '');\n}\n\n/**\n * Pads number to given length and optionally rounds it to a given precision.\n * For example:\n *
padNumber(1.25, 2, 3) -> '01.250'\n * padNumber(1.25, 2) -> '01.25'\n * padNumber(1.25, 2, 1) -> '01.3'\n * padNumber(1.25, 0) -> '1.25'
\n *\n * @param {Number} num The number to pad.\n * @param {Number} length The desired length.\n * @param {Number=} opt_precision The desired precision.\n * @return {String} {@code num} as a string with the given options.\n */\nexport function padNumber (num, length, opt_precision) {\n var s = isDef(opt_precision) ? num.toFixed(opt_precision) : String(num);\n var index = s.indexOf('.');\n if (index == -1) {\n index = s.length;\n }\n return repeat('0', Math.max(0, length - index)) + s;\n}\n","/**\n * @const\n * @type {string}\n */\nconst NAMESPACE_URI = 'http://www.w3.org/1999/xlink';\n\n/**\n * @param {Node} node Node.\n * @return {Boolean|undefined} Boolean.\n */\nexport function readHref (node) {\n return node.getAttributeNS(NAMESPACE_URI, 'href');\n}\n","import XMLParser, { \n makeObjectPropertySetter,\n makeObjectPropertyPusher,\n makeParsersNS,\n pushParseAndPop,\n makeArrayPusher\n} from './xml_parser';\nimport { \n readString,\n readDecimalString,\n readBooleanString,\n readNonNegativeIntegerString,\n readNonNegativeInteger,\n readDecimal\n} from './xsd';\nimport { readHref } from './xlink';\nimport setIfUndefined from './utils/setifundefined';\nimport isDef from './utils/isdef';\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Attribution object.\n */\nfunction readAttribution(node, objectStack) {\n return pushParseAndPop({}, ATTRIBUTION_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @return {ol.Extent} Bounding box object.\n */\nfunction readBoundingBoxExtent (node) {\n return [\n readDecimalString(node.getAttribute('minx')),\n readDecimalString(node.getAttribute('miny')),\n readDecimalString(node.getAttribute('maxx')),\n readDecimalString(node.getAttribute('maxy'))\n ];\n}\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object} Bounding box object.\n */\nfunction readBoundingBox (node, objectStack) {\n const extent = readBoundingBoxExtent(node);\n const resolutions = [\n readDecimalString(node.getAttribute('resx')),\n readDecimalString(node.getAttribute('resy'))\n ];\n\n return {\n 'crs': node.getAttribute('CRS') || node.getAttribute('SRS'),\n extent, res: resolutions\n };\n}\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {ol.Extent|undefined} Bounding box object.\n */\nfunction readLatLonBoundingBox (node, objectStack) {\n const extent = readBoundingBoxExtent(node);\n\n if (!isDef(extent[0]) || !isDef(extent[1]) ||\n !isDef(extent[2]) || !isDef(extent[3])) {\n return undefined;\n }\n\n return extent;\n}\n\n\n/**\n * @privat\n * @param {Node} node Node\n * @param {Arra.} objectStack Object stack\n * @return {Object}\n */\nfunction readScaleHint (node, objectStack) {\n const min = parseFloat(node.getAttribute('min'));\n const max = parseFloat(node.getAttribute('max'));\n\n return { min, max };\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {ol.Extent|undefined} Bounding box object.\n */\nfunction readEXGeographicBoundingBox (node, objectStack) {\n const geographicBoundingBox = pushParseAndPop({},\n EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS,\n node, objectStack);\n if (!isDef(geographicBoundingBox)) return undefined;\n\n const westBoundLongitude = /** @type {number|undefined} */\n (geographicBoundingBox['westBoundLongitude']);\n const southBoundLatitude = /** @type {number|undefined} */\n (geographicBoundingBox['southBoundLatitude']);\n const eastBoundLongitude = /** @type {number|undefined} */\n (geographicBoundingBox['eastBoundLongitude']);\n const northBoundLatitude = /** @type {number|undefined} */\n (geographicBoundingBox['northBoundLatitude']);\n\n if (!isDef(westBoundLongitude) || !isDef(southBoundLatitude) ||\n !isDef(eastBoundLongitude) || !isDef(northBoundLatitude)) {\n return undefined;\n }\n\n return [\n westBoundLongitude, southBoundLatitude,\n eastBoundLongitude, northBoundLatitude\n ];\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Capability object.\n */\nfunction readCapability (node, objectStack) {\n return pushParseAndPop({}, CAPABILITY_PARSERS, node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Service object.\n */\nfunction readService (node, objectStack) {\n return pushParseAndPop({}, SERVICE_PARSERS, node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Contact information object.\n */\nfunction readContactInformation (node, objectStack) {\n return pushParseAndPop({}, CONTACT_INFORMATION_PARSERS,\n node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Contact person object.\n */\nfunction readContactPersonPrimary (node, objectStack) {\n return pushParseAndPop({}, CONTACT_PERSON_PARSERS,\n node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Contact address object.\n */\nfunction readContactAddress (node, objectStack) {\n return pushParseAndPop({}, CONTACT_ADDRESS_PARSERS,\n node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Array.|undefined} Format array.\n */\nfunction readException (node, objectStack) {\n return pushParseAndPop(\n [], EXCEPTION_PARSERS, node, objectStack);\n}\n\n\n/**\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @private\n * @return {Object|undefined} Layer object.\n */\nfunction readCapabilityLayer (node, objectStack) {\n const queryable = readBooleanString(node.getAttribute('queryable')); \n return pushParseAndPop({\n queryable: isDef(queryable) ? queryable : false }, \n LAYER_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Layer object.\n */\nfunction readLayer (node, objectStack) {\n var parentLayerObject = /** @type {Object.} */\n (objectStack[objectStack.length - 1]);\n\n const layerObject = /** @type {Object.} */\n (pushParseAndPop({}, LAYER_PARSERS,\n node, objectStack));\n\n if (!isDef(layerObject)) return undefined;\n\n let queryable = readBooleanString(node.getAttribute('queryable'));\n if (!isDef(queryable)) {\n queryable = parentLayerObject['queryable'];\n }\n layerObject['queryable'] = isDef(queryable) ? queryable : false;\n\n let cascaded = readNonNegativeIntegerString(node.getAttribute('cascaded'));\n if (!isDef(cascaded)) {\n cascaded = parentLayerObject['cascaded'];\n }\n layerObject['cascaded'] = cascaded;\n\n let opaque = readBooleanString(node.getAttribute('opaque'));\n if (!isDef(opaque)) {\n opaque = parentLayerObject['opaque'];\n }\n layerObject['opaque'] = isDef(opaque) ? opaque : false;\n\n let noSubsets = readBooleanString(node.getAttribute('noSubsets'));\n if (!isDef(noSubsets)) {\n noSubsets = parentLayerObject['noSubsets'];\n }\n layerObject['noSubsets'] = isDef(noSubsets) ? noSubsets : false;\n\n let fixedWidth = readDecimalString(node.getAttribute('fixedWidth'));\n if (!isDef(fixedWidth)) {\n fixedWidth = parentLayerObject['fixedWidth'];\n }\n layerObject['fixedWidth'] = fixedWidth;\n\n let fixedHeight = readDecimalString(node.getAttribute('fixedHeight'));\n if (!isDef(fixedHeight)) {\n fixedHeight = parentLayerObject['fixedHeight'];\n }\n layerObject['fixedHeight'] = fixedHeight;\n\n // See 7.2.4.8\n const addKeys = ['Style', 'CRS', 'AuthorityURL'];\n for (let i = 0, len = addKeys.length; i < len; i++) {\n const key = addKeys[i];\n const parentValue = parentLayerObject[key];\n if (isDef(parentValue)) {\n let childValue = setIfUndefined(layerObject, key, []);\n childValue = childValue.concat(parentValue);\n layerObject[key] = childValue;\n }\n }\n\n const replaceKeys = ['EX_GeographicBoundingBox', 'BoundingBox', 'Dimension',\n 'Attribution', 'MinScaleDenominator', 'MaxScaleDenominator'\n ];\n for (let i = 0, len = replaceKeys.length; i < len; i++) {\n const key = replaceKeys[i];\n const childValue = layerObject[key];\n if (!isDef(childValue)) {\n const parentValue = parentLayerObject[key];\n layerObject[key] = parentValue;\n }\n }\n\n return layerObject;\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object} Dimension object.\n */\nfunction readDimension (node, objectStack) {\n return {\n 'name': node.getAttribute('name'),\n 'units': node.getAttribute('units'),\n 'unitSymbol': node.getAttribute('unitSymbol'),\n 'default': node.getAttribute('default'),\n 'multipleValues': readBooleanString(node.getAttribute('multipleValues')),\n 'nearestValue': readBooleanString(node.getAttribute('nearestValue')),\n 'current': readBooleanString(node.getAttribute('current')),\n 'values': readString(node)\n };\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Online resource object.\n */\nfunction readFormatOnlineresource (node, objectStack) {\n return pushParseAndPop({}, FORMAT_ONLINERESOURCE_PARSERS,\n node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Request object.\n */\nfunction readRequest (node, objectStack) {\n return pushParseAndPop({}, REQUEST_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} DCP type object.\n */\nfunction readDCPType (node, objectStack) {\n return pushParseAndPop({}, DCPTYPE_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} HTTP object.\n */\nfunction readHTTP (node, objectStack) {\n return pushParseAndPop({}, HTTP_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Operation type object.\n */\nfunction readOperationType (node, objectStack) {\n return pushParseAndPop({}, OPERATIONTYPE_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Online resource object.\n */\nfunction readSizedFormatOnlineresource (node, objectStack) {\n var formatOnlineresource = readFormatOnlineresource(node, objectStack);\n if (isDef(formatOnlineresource)) {\n const size = [\n readNonNegativeIntegerString(node.getAttribute('width')),\n readNonNegativeIntegerString(node.getAttribute('height'))\n ];\n formatOnlineresource['size'] = size;\n return formatOnlineresource;\n }\n return undefined;\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Authority URL object.\n */\nfunction readAuthorityURL (node, objectStack) {\n var authorityObject = readFormatOnlineresource(node, objectStack);\n if (isDef(authorityObject)) {\n authorityObject['name'] = node.getAttribute('name');\n return authorityObject;\n }\n return undefined;\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Metadata URL object.\n */\nfunction readMetadataURL (node, objectStack) {\n var metadataObject = readFormatOnlineresource(node, objectStack);\n if (isDef(metadataObject)) {\n metadataObject['type'] = node.getAttribute('type');\n return metadataObject;\n }\n return undefined;\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Object|undefined} Style object.\n */\nfunction readStyle (node, objectStack) {\n return pushParseAndPop({}, STYLE_PARSERS, node, objectStack);\n}\n\n\n/**\n * @private\n * @param {Node} node Node.\n * @param {Array.<*>} objectStack Object stack.\n * @return {Array.|undefined} Keyword list.\n */\nfunction readKeywordList (node, objectStack) {\n return pushParseAndPop(\n [], KEYWORDLIST_PARSERS, node, objectStack);\n}\n\n\n/**\n * @const\n * @type {Array.}\n */\nconst NAMESPACE_URIS = [\n null,\n 'http://www.opengis.net/wms'\n];\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nexport const PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Service': makeObjectPropertySetter(readService),\n 'Capability': makeObjectPropertySetter(readCapability)\n });\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst CAPABILITY_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Request': makeObjectPropertySetter(readRequest),\n 'Exception': makeObjectPropertySetter(readException),\n 'Layer': makeObjectPropertySetter(readCapabilityLayer)\n });\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst SERVICE_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Name': makeObjectPropertySetter(readString),\n 'Title': makeObjectPropertySetter(readString),\n 'Abstract': makeObjectPropertySetter(readString),\n 'KeywordList': makeObjectPropertySetter(readKeywordList),\n 'OnlineResource': makeObjectPropertySetter(readHref),\n 'ContactInformation': makeObjectPropertySetter(readContactInformation),\n 'Fees': makeObjectPropertySetter(readString),\n 'AccessConstraints': makeObjectPropertySetter(readString),\n 'LayerLimit': makeObjectPropertySetter(readNonNegativeInteger),\n 'MaxWidth': makeObjectPropertySetter(readNonNegativeInteger),\n 'MaxHeight': makeObjectPropertySetter(readNonNegativeInteger)\n });\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst CONTACT_INFORMATION_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'ContactPersonPrimary': makeObjectPropertySetter(readContactPersonPrimary),\n 'ContactPosition': makeObjectPropertySetter(readString),\n 'ContactAddress': makeObjectPropertySetter(readContactAddress),\n 'ContactVoiceTelephone': makeObjectPropertySetter(readString),\n 'ContactFacsimileTelephone': makeObjectPropertySetter(readString),\n 'ContactElectronicMailAddress': makeObjectPropertySetter(readString)\n });\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst CONTACT_PERSON_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'ContactPerson': makeObjectPropertySetter(readString),\n 'ContactOrganization': makeObjectPropertySetter(readString)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst CONTACT_ADDRESS_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'AddressType': makeObjectPropertySetter(readString),\n 'Address': makeObjectPropertySetter(readString),\n 'City': makeObjectPropertySetter(readString),\n 'StateOrProvince': makeObjectPropertySetter(readString),\n 'PostCode': makeObjectPropertySetter(readString),\n 'Country': makeObjectPropertySetter(readString)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst EXCEPTION_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Format': makeArrayPusher(readString)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst LAYER_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Name': makeObjectPropertySetter(readString),\n 'Title': makeObjectPropertySetter(readString),\n 'Abstract': makeObjectPropertySetter(readString),\n 'KeywordList': makeObjectPropertySetter(readKeywordList),\n 'CRS': makeObjectPropertyPusher(readString),\n 'SRS': makeObjectPropertyPusher(readString),\n 'EX_GeographicBoundingBox': makeObjectPropertySetter(readEXGeographicBoundingBox),\n 'LatLonBoundingBox': makeObjectPropertySetter(readLatLonBoundingBox),\n 'BoundingBox': makeObjectPropertyPusher(readBoundingBox),\n 'Dimension': makeObjectPropertyPusher(readDimension),\n 'Attribution': makeObjectPropertySetter(readAttribution),\n 'AuthorityURL': makeObjectPropertyPusher(readAuthorityURL),\n 'Identifier': makeObjectPropertyPusher(readString),\n 'MetadataURL': makeObjectPropertyPusher(readMetadataURL),\n 'DataURL': makeObjectPropertyPusher(readFormatOnlineresource),\n 'FeatureListURL': makeObjectPropertyPusher(readFormatOnlineresource),\n 'Style': makeObjectPropertyPusher(readStyle),\n 'MinScaleDenominator': makeObjectPropertySetter(readDecimal),\n 'MaxScaleDenominator': makeObjectPropertySetter(readDecimal),\n 'ScaleHint': makeObjectPropertySetter(readScaleHint),\n 'Layer': makeObjectPropertyPusher(readLayer)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst ATTRIBUTION_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Title': makeObjectPropertySetter(readString),\n 'OnlineResource': makeObjectPropertySetter(readHref),\n 'LogoURL': makeObjectPropertySetter(readSizedFormatOnlineresource)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS =\n makeParsersNS(NAMESPACE_URIS, {\n 'westBoundLongitude': makeObjectPropertySetter(readDecimal),\n 'eastBoundLongitude': makeObjectPropertySetter(readDecimal),\n 'southBoundLatitude': makeObjectPropertySetter(readDecimal),\n 'northBoundLatitude': makeObjectPropertySetter(readDecimal)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst REQUEST_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'GetCapabilities': makeObjectPropertySetter(\n readOperationType),\n 'GetMap': makeObjectPropertySetter(\n readOperationType),\n 'GetFeatureInfo': makeObjectPropertySetter(\n readOperationType)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst OPERATIONTYPE_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Format': makeObjectPropertyPusher(readString),\n 'DCPType': makeObjectPropertyPusher(\n readDCPType)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst DCPTYPE_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'HTTP': makeObjectPropertySetter(\n readHTTP)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst HTTP_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Get': makeObjectPropertySetter(\n readFormatOnlineresource),\n 'Post': makeObjectPropertySetter(\n readFormatOnlineresource)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst STYLE_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Name': makeObjectPropertySetter(readString),\n 'Title': makeObjectPropertySetter(readString),\n 'Abstract': makeObjectPropertySetter(readString),\n 'LegendURL': makeObjectPropertyPusher(readSizedFormatOnlineresource),\n 'StyleSheetURL': makeObjectPropertySetter(readFormatOnlineresource),\n 'StyleURL': makeObjectPropertySetter(readFormatOnlineresource)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst FORMAT_ONLINERESOURCE_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Format': makeObjectPropertySetter(readString),\n 'OnlineResource': makeObjectPropertySetter(readHref)\n });\n\n\n/**\n * @const\n * @type {Object.>}\n * @private\n */\nconst KEYWORDLIST_PARSERS = makeParsersNS(\n NAMESPACE_URIS, {\n 'Keyword': makeArrayPusher(readString)\n });\n","/**\n * @enum {Number}\n */\nconst NODE_TYPES = {\n ELEMENT: 1,\n ATTRIBUTE: 2,\n TEXT: 3,\n CDATA_SECTION: 4,\n ENTITY_REFERENCE: 5,\n ENTITY: 6,\n PROCESSING_INSTRUCTION: 7,\n COMMENT: 8,\n DOCUMENT: 9,\n DOCUMENT_TYPE: 10,\n DOCUMENT_FRAGMENT: 11,\n NOTATION: 12\n};\n\nexport default NODE_TYPES;\n","import XMLParser, { pushParseAndPop } from './xml_parser';\nimport nodeTypes from './node_types';\nimport { PARSERS } from './parsers';\n\nexport default class WMS {\n /**\n * WMS Capabilities parser\n *\n * @param {String=} xmlString\n * @constructor\n */\n constructor(xmlString, DOMParser) {\n if (!DOMParser && typeof window !== 'undefined') {\n DOMParser = window.DOMParser;\n }\n\n /**\n * @type {String}\n */\n this.version = undefined;\n\n /**\n * @type {XMLParser}\n */\n this._parser = new XMLParser(DOMParser);\n\n /**\n * @type {String=}\n */\n this._data = xmlString;\n }\n\n\n /**\n * @param {String} xmlString\n * @return {WMS}\n */\n data (xmlString) {\n this._data = xmlString;\n return this;\n }\n\n /**\n * @param {String=} xmlString\n * @return {Object}\n */\n toJSON (xmlString) {\n xmlString = xmlString || this._data;\n return this.parse(xmlString);\n }\n\n /**\n * @return {String} xml\n */\n parse (xmlString) {\n return this._readFromDocument(this._parser.toDocument(xmlString));\n }\n\n /**\n * @param {Document} doc\n * @return {Object}\n */\n _readFromDocument (doc) {\n for (let node = doc.firstChild; node; node = node.nextSibling) {\n if (node.nodeType == nodeTypes.ELEMENT) {\n return this.readFromNode(node);\n }\n }\n return null;\n }\n\n /**\n * @param {DOMNode} node\n * @return {Object}\n */\n readFromNode (node) {\n this.version = node.getAttribute('version');\n const wmsCapabilityObject = pushParseAndPop({\n 'version': this.version\n }, PARSERS, node, []);\n\n return wmsCapabilityObject || null;\n }\n}\n "],"names":["normalizeWhitespace","n","let","nextSibling","nodeType","i","push","firstElementChild","parsers","isDef","parser","property","object","const","readDecimalString","readNonNegativeIntegerString","exec","replace","node","getAttributeNS","getAttribute","pushParseAndPop","ATTRIBUTE","TEXT","CDATA_SECTION","ENTITY_REFERENCE","ENTITY","PROCESSING_INSTRUCTION","COMMENT","DOCUMENT","DOCUMENT_TYPE","DOCUMENT_FRAGMENT","NOTATION","CAPABILITY_PARSERS","LAYER_PARSERS","makeObjectPropertySetter","CONTACT_ADDRESS_PARSERS","readString","makeObjectPropertyPusher","eastBoundLongitude","northBoundLatitude","resolutions","extent","readBooleanString","ATTRIBUTION_PARSERS","readDecimal","max","parseFloat","parentLayerObject","addKeys","length","parentValue","layerObject","i$1","DOMParser","window","xmlString","readFromNode"],"mappings":";;;;kTA8DQA,CAAJ,wDAAA,yBAQA,KAAKC,CAAL,aAAA,EAAA,EAAA,cAAA,iCA+CFC,KAAAA,qBAAAA,eAAAA,EAAAA;AAAsBC,CAAAC,SAAtBF,YAAAA,CAAAA,6DAkCK,KAAAG,EAAI,CAAT,MAAA,SAAA,EAAA,EAAA,IAAA,IACc,EAAA,gGAuBRC,KAAA,EAAA,kCAvENJ,MAAAA,EAD+BK,kBAC/BL,cAAAA,EAAAA,EAA4BK,CAAAH,SAA5BF,YAAAA,CAAAA,+BAjBMM,CACJ,mBAFqC,KAErC,CAAIC,CAAA,EAAA,CAAJ,IAEE,eAAA,CAAIA,CAAA,CAAMC,CAAN,CAAJ,eAFF,CAuGF;kBAuBM,cAAA,CADIC,CACJ,mBAAA,CAAAC,CAAA,EAAA,CAAA,kGAyBID,EAAAA,4BAEJL,oBAAAA,MAAA,EAA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