@loaders.gl/ogc 0.0.0-stage → 5.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +52 -0
- package/README.md +10 -2
- package/dist/index.cjs +7052 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/stac/index.cjs +1095 -0
- package/dist/stac/index.cjs.map +6 -0
- package/dist/stac/index.d.ts +4 -0
- package/dist/stac/index.d.ts.map +1 -0
- package/dist/stac/index.js +5 -0
- package/dist/stac/index.js.map +1 -0
- package/dist/stac/stac-source-loader-types.d.ts +44 -0
- package/dist/stac/stac-source-loader-types.d.ts.map +1 -0
- package/dist/stac/stac-source-loader-types.js +43 -0
- package/dist/stac/stac-source-loader-types.js.map +1 -0
- package/dist/stac/stac-source.cjs +1544 -0
- package/dist/stac/stac-source.cjs.map +6 -0
- package/dist/stac/stac-source.d.ts +92 -0
- package/dist/stac/stac-source.d.ts.map +1 -0
- package/dist/stac/stac-source.js +500 -0
- package/dist/stac/stac-source.js.map +1 -0
- package/dist/stac/stac-types.d.ts +213 -0
- package/dist/stac/stac-types.d.ts.map +1 -0
- package/dist/stac/stac-types.js +5 -0
- package/dist/stac/stac-types.js.map +1 -0
- package/dist/wms/bundled.cjs +7295 -0
- package/dist/wms/bundled.cjs.map +6 -0
- package/dist/wms/bundled.d.ts +24 -0
- package/dist/wms/bundled.d.ts.map +1 -0
- package/dist/wms/bundled.js +18 -0
- package/dist/wms/bundled.js.map +1 -0
- package/dist/wms/capability-graph.d.ts +42 -0
- package/dist/wms/capability-graph.d.ts.map +1 -0
- package/dist/wms/capability-graph.js +118 -0
- package/dist/wms/capability-graph.js.map +1 -0
- package/dist/wms/crs-utils.d.ts +24 -0
- package/dist/wms/crs-utils.d.ts.map +1 -0
- package/dist/wms/crs-utils.js +57 -0
- package/dist/wms/crs-utils.js.map +1 -0
- package/dist/wms/csw-capabilities-loader-with-parser.d.ts +34 -0
- package/dist/wms/csw-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/csw-capabilities-loader-with-parser.js +15 -0
- package/dist/wms/csw-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/csw-capabilities-loader.d.ts +56 -0
- package/dist/wms/csw-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/csw-capabilities-loader.js +38 -0
- package/dist/wms/csw-capabilities-loader.js.map +1 -0
- package/dist/wms/csw-domain-loader-with-parser.d.ts +33 -0
- package/dist/wms/csw-domain-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/csw-domain-loader-with-parser.js +15 -0
- package/dist/wms/csw-domain-loader-with-parser.js.map +1 -0
- package/dist/wms/csw-domain-loader.d.ts +55 -0
- package/dist/wms/csw-domain-loader.d.ts.map +1 -0
- package/dist/wms/csw-domain-loader.js +38 -0
- package/dist/wms/csw-domain-loader.js.map +1 -0
- package/dist/wms/csw-records-loader-with-parser.d.ts +33 -0
- package/dist/wms/csw-records-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/csw-records-loader-with-parser.js +15 -0
- package/dist/wms/csw-records-loader-with-parser.js.map +1 -0
- package/dist/wms/csw-records-loader.d.ts +55 -0
- package/dist/wms/csw-records-loader.d.ts.map +1 -0
- package/dist/wms/csw-records-loader.js +38 -0
- package/dist/wms/csw-records-loader.js.map +1 -0
- package/dist/wms/csw-source-loader.d.ts +165 -0
- package/dist/wms/csw-source-loader.d.ts.map +1 -0
- package/dist/wms/csw-source-loader.js +203 -0
- package/dist/wms/csw-source-loader.js.map +1 -0
- package/dist/wms/feature-pagination.d.ts +34 -0
- package/dist/wms/feature-pagination.d.ts.map +1 -0
- package/dist/wms/feature-pagination.js +159 -0
- package/dist/wms/feature-pagination.js.map +1 -0
- package/dist/wms/gml-loader-types.d.ts +68 -0
- package/dist/wms/gml-loader-types.d.ts.map +1 -0
- package/dist/wms/gml-loader-types.js +38 -0
- package/dist/wms/gml-loader-types.js.map +1 -0
- package/dist/wms/gml-loader.cjs +5779 -0
- package/dist/wms/gml-loader.cjs.map +6 -0
- package/dist/wms/gml-loader.d.ts +38 -0
- package/dist/wms/gml-loader.d.ts.map +1 -0
- package/dist/wms/gml-loader.js +195 -0
- package/dist/wms/gml-loader.js.map +1 -0
- package/dist/wms/index.cjs +12416 -0
- package/dist/wms/index.cjs.map +6 -0
- package/dist/wms/index.d.ts +61 -0
- package/dist/wms/index.d.ts.map +1 -0
- package/dist/wms/index.js +36 -0
- package/dist/wms/index.js.map +1 -0
- package/dist/wms/lib/deprecated/create-image-source.d.ts +27 -0
- package/dist/wms/lib/deprecated/create-image-source.d.ts.map +1 -0
- package/dist/wms/lib/deprecated/create-image-source.js +44 -0
- package/dist/wms/lib/deprecated/create-image-source.js.map +1 -0
- package/dist/wms/lib/deprecated/image-source-compatibility.d.ts +14 -0
- package/dist/wms/lib/deprecated/image-source-compatibility.d.ts.map +1 -0
- package/dist/wms/lib/deprecated/image-source-compatibility.js +21 -0
- package/dist/wms/lib/deprecated/image-source-compatibility.js.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.d.ts +79 -0
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.d.ts.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.js +23 -0
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.js.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-domain.d.ts +17 -0
- package/dist/wms/lib/parsers/csw/parse-csw-domain.d.ts.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-domain.js +32 -0
- package/dist/wms/lib/parsers/csw/parse-csw-domain.js.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-records.d.ts +34 -0
- package/dist/wms/lib/parsers/csw/parse-csw-records.d.ts.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-csw-records.js +56 -0
- package/dist/wms/lib/parsers/csw/parse-csw-records.js.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-exception-report.d.ts +6 -0
- package/dist/wms/lib/parsers/csw/parse-exception-report.d.ts.map +1 -0
- package/dist/wms/lib/parsers/csw/parse-exception-report.js +29 -0
- package/dist/wms/lib/parsers/csw/parse-exception-report.js.map +1 -0
- package/dist/wms/lib/parsers/gml/deep-strict-equal.d.ts +3 -0
- package/dist/wms/lib/parsers/gml/deep-strict-equal.d.ts.map +1 -0
- package/dist/wms/lib/parsers/gml/deep-strict-equal.js +118 -0
- package/dist/wms/lib/parsers/gml/deep-strict-equal.js.map +1 -0
- package/dist/wms/lib/parsers/gml/parse-gml.d.ts +66 -0
- package/dist/wms/lib/parsers/gml/parse-gml.d.ts.map +1 -0
- package/dist/wms/lib/parsers/gml/parse-gml.js +641 -0
- package/dist/wms/lib/parsers/gml/parse-gml.js.map +1 -0
- package/dist/wms/lib/parsers/gml/rewind-geometry.d.ts +4 -0
- package/dist/wms/lib/parsers/gml/rewind-geometry.d.ts.map +1 -0
- package/dist/wms/lib/parsers/gml/rewind-geometry.js +45 -0
- package/dist/wms/lib/parsers/gml/rewind-geometry.js.map +1 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.d.ts +19 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.d.ts.map +1 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.js +74 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-limits.js.map +1 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.d.ts +63 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.d.ts.map +1 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.js +82 -0
- package/dist/wms/lib/parsers/ogc-api/tile-matrix-set.js.map +1 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.d.ts +97 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.js +60 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs-capabilities.js.map +1 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs.d.ts +7 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs.js +31 -0
- package/dist/wms/lib/parsers/wfs/parse-wfs.js.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-capabilities.d.ts +126 -0
- package/dist/wms/lib/parsers/wms/parse-wms-capabilities.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-capabilities.js +232 -0
- package/dist/wms/lib/parsers/wms/parse-wms-capabilities.js.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-error.d.ts +8 -0
- package/dist/wms/lib/parsers/wms/parse-wms-error.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-error.js +21 -0
- package/dist/wms/lib/parsers/wms/parse-wms-error.js.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-features.d.ts +20 -0
- package/dist/wms/lib/parsers/wms/parse-wms-features.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-features.js +26 -0
- package/dist/wms/lib/parsers/wms/parse-wms-features.js.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.d.ts +11 -0
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.js +14 -0
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.js.map +1 -0
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.d.ts +101 -0
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.d.ts.map +1 -0
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js +175 -0
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js.map +1 -0
- package/dist/wms/lib/parsers/xml/parse-xml-helpers.d.ts +11 -0
- package/dist/wms/lib/parsers/xml/parse-xml-helpers.d.ts.map +1 -0
- package/dist/wms/lib/parsers/xml/parse-xml-helpers.js +63 -0
- package/dist/wms/lib/parsers/xml/parse-xml-helpers.js.map +1 -0
- package/dist/wms/lib/parsers/xml/parse-xml-text.d.ts +4 -0
- package/dist/wms/lib/parsers/xml/parse-xml-text.d.ts.map +1 -0
- package/dist/wms/lib/parsers/xml/parse-xml-text.js +9 -0
- package/dist/wms/lib/parsers/xml/parse-xml-text.js.map +1 -0
- package/dist/wms/lib/tile-grid.d.ts +14 -0
- package/dist/wms/lib/tile-grid.d.ts.map +1 -0
- package/dist/wms/lib/tile-grid.js +28 -0
- package/dist/wms/lib/tile-grid.js.map +1 -0
- package/dist/wms/managed-vector-source.d.ts +66 -0
- package/dist/wms/managed-vector-source.d.ts.map +1 -0
- package/dist/wms/managed-vector-source.js +307 -0
- package/dist/wms/managed-vector-source.js.map +1 -0
- package/dist/wms/ogc-api-coverages-source-loader.d.ts +64 -0
- package/dist/wms/ogc-api-coverages-source-loader.d.ts.map +1 -0
- package/dist/wms/ogc-api-coverages-source-loader.js +78 -0
- package/dist/wms/ogc-api-coverages-source-loader.js.map +1 -0
- package/dist/wms/ogc-api-edr-source-loader.d.ts +72 -0
- package/dist/wms/ogc-api-edr-source-loader.d.ts.map +1 -0
- package/dist/wms/ogc-api-edr-source-loader.js +82 -0
- package/dist/wms/ogc-api-edr-source-loader.js.map +1 -0
- package/dist/wms/ogc-api-source-loader.d.ts +223 -0
- package/dist/wms/ogc-api-source-loader.d.ts.map +1 -0
- package/dist/wms/ogc-api-source-loader.js +517 -0
- package/dist/wms/ogc-api-source-loader.js.map +1 -0
- package/dist/wms/service-capabilities.d.ts +17 -0
- package/dist/wms/service-capabilities.d.ts.map +1 -0
- package/dist/wms/service-capabilities.js +110 -0
- package/dist/wms/service-capabilities.js.map +1 -0
- package/dist/wms/service-runtime.d.ts +67 -0
- package/dist/wms/service-runtime.d.ts.map +1 -0
- package/dist/wms/service-runtime.js +165 -0
- package/dist/wms/service-runtime.js.map +1 -0
- package/dist/wms/unbundled.cjs +5995 -0
- package/dist/wms/unbundled.cjs.map +6 -0
- package/dist/wms/unbundled.d.ts +18 -0
- package/dist/wms/unbundled.d.ts.map +1 -0
- package/dist/wms/unbundled.js +12 -0
- package/dist/wms/unbundled.js.map +1 -0
- package/dist/wms/wcs-source-loader.d.ts +99 -0
- package/dist/wms/wcs-source-loader.d.ts.map +1 -0
- package/dist/wms/wcs-source-loader.js +178 -0
- package/dist/wms/wcs-source-loader.js.map +1 -0
- package/dist/wms/wfs-capabilities-loader-with-parser.d.ts +35 -0
- package/dist/wms/wfs-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wfs-capabilities-loader-with-parser.js +17 -0
- package/dist/wms/wfs-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/wfs-capabilities-loader.d.ts +59 -0
- package/dist/wms/wfs-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/wfs-capabilities-loader.js +42 -0
- package/dist/wms/wfs-capabilities-loader.js.map +1 -0
- package/dist/wms/wfs-source-loader.d.ts +353 -0
- package/dist/wms/wfs-source-loader.d.ts.map +1 -0
- package/dist/wms/wfs-source-loader.js +606 -0
- package/dist/wms/wfs-source-loader.js.map +1 -0
- package/dist/wms/wip/data-source.d.ts +54 -0
- package/dist/wms/wip/data-source.d.ts.map +1 -0
- package/dist/wms/wip/data-source.js +62 -0
- package/dist/wms/wip/data-source.js.map +1 -0
- package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.d.ts +78 -0
- package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.d.ts.map +1 -0
- package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.js +14 -0
- package/dist/wms/wip/lib/wcs/parse-wcs-capabilities.js.map +1 -0
- package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.d.ts +87 -0
- package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.d.ts.map +1 -0
- package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.js +76 -0
- package/dist/wms/wip/lib/wmts/parse-wmts-capabilities.js.map +1 -0
- package/dist/wms/wip/lib/wmts/parse-wmts.d.ts +7 -0
- package/dist/wms/wip/lib/wmts/parse-wmts.d.ts.map +1 -0
- package/dist/wms/wip/lib/wmts/parse-wmts.js +34 -0
- package/dist/wms/wip/lib/wmts/parse-wmts.js.map +1 -0
- package/dist/wms/wip/wcs-capabilities-loader-with-parser.d.ts +12 -0
- package/dist/wms/wip/wcs-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wip/wcs-capabilities-loader-with-parser.js +16 -0
- package/dist/wms/wip/wcs-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/wip/wcs-capabilities-loader.d.ts +12 -0
- package/dist/wms/wip/wcs-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/wip/wcs-capabilities-loader.js +36 -0
- package/dist/wms/wip/wcs-capabilities-loader.js.map +1 -0
- package/dist/wms/wip/wms-feature-info-loader-with-parser.d.ts +7 -0
- package/dist/wms/wip/wms-feature-info-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wip/wms-feature-info-loader-with-parser.js +15 -0
- package/dist/wms/wip/wms-feature-info-loader-with-parser.js.map +1 -0
- package/dist/wms/wip/wms-feature-info-loader.d.ts +7 -0
- package/dist/wms/wip/wms-feature-info-loader.d.ts.map +1 -0
- package/dist/wms/wip/wms-feature-info-loader.js +19 -0
- package/dist/wms/wip/wms-feature-info-loader.js.map +1 -0
- package/dist/wms/wip/wms-layer-description-loader-with-parser.d.ts +7 -0
- package/dist/wms/wip/wms-layer-description-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wip/wms-layer-description-loader-with-parser.js +15 -0
- package/dist/wms/wip/wms-layer-description-loader-with-parser.js.map +1 -0
- package/dist/wms/wip/wms-layer-description-loader.d.ts +7 -0
- package/dist/wms/wip/wms-layer-description-loader.d.ts.map +1 -0
- package/dist/wms/wip/wms-layer-description-loader.js +19 -0
- package/dist/wms/wip/wms-layer-description-loader.js.map +1 -0
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.d.ts +11 -0
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.js +17 -0
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/wip/wmts-capabilities-loader.d.ts +11 -0
- package/dist/wms/wip/wmts-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/wip/wmts-capabilities-loader.js +36 -0
- package/dist/wms/wip/wmts-capabilities-loader.js.map +1 -0
- package/dist/wms/wms-capabilities-loader-with-parser.d.ts +40 -0
- package/dist/wms/wms-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wms-capabilities-loader-with-parser.js +19 -0
- package/dist/wms/wms-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/wms-capabilities-loader.d.ts +62 -0
- package/dist/wms/wms-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/wms-capabilities-loader.js +38 -0
- package/dist/wms/wms-capabilities-loader.js.map +1 -0
- package/dist/wms/wms-error-loader-with-parser.d.ts +39 -0
- package/dist/wms/wms-error-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wms-error-loader-with-parser.js +28 -0
- package/dist/wms/wms-error-loader-with-parser.js.map +1 -0
- package/dist/wms/wms-error-loader.d.ts +64 -0
- package/dist/wms/wms-error-loader.d.ts.map +1 -0
- package/dist/wms/wms-error-loader.js +40 -0
- package/dist/wms/wms-error-loader.js.map +1 -0
- package/dist/wms/wms-format.d.ts +13 -0
- package/dist/wms/wms-format.d.ts.map +1 -0
- package/dist/wms/wms-format.js +25 -0
- package/dist/wms/wms-format.js.map +1 -0
- package/dist/wms/wms-source-loader.d.ts +226 -0
- package/dist/wms/wms-source-loader.d.ts.map +1 -0
- package/dist/wms/wms-source-loader.js +397 -0
- package/dist/wms/wms-source-loader.js.map +1 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.cjs +2189 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.cjs.map +6 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.d.ts +3 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.js +13 -0
- package/dist/wms/wmts-capabilities-loader-with-parser.js.map +1 -0
- package/dist/wms/wmts-capabilities-loader.d.ts +7 -0
- package/dist/wms/wmts-capabilities-loader.d.ts.map +1 -0
- package/dist/wms/wmts-capabilities-loader.js +24 -0
- package/dist/wms/wmts-capabilities-loader.js.map +1 -0
- package/dist/wms/wmts-source-loader.d.ts +120 -0
- package/dist/wms/wmts-source-loader.d.ts.map +1 -0
- package/dist/wms/wmts-source-loader.js +472 -0
- package/dist/wms/wmts-source-loader.js.map +1 -0
- package/package.json +89 -4
- package/src/index.ts +6 -0
- package/src/stac/index.ts +25 -0
- package/src/stac/stac-source-loader-types.ts +65 -0
- package/src/stac/stac-source.ts +635 -0
- package/src/stac/stac-types.ts +230 -0
- package/src/wms/bundled.ts +30 -0
- package/src/wms/capability-graph.ts +152 -0
- package/src/wms/crs-utils.ts +67 -0
- package/src/wms/csw-capabilities-loader-with-parser.ts +30 -0
- package/src/wms/csw-capabilities-loader.ts +54 -0
- package/src/wms/csw-domain-loader-with-parser.ts +28 -0
- package/src/wms/csw-domain-loader.ts +53 -0
- package/src/wms/csw-records-loader-with-parser.ts +28 -0
- package/src/wms/csw-records-loader.ts +52 -0
- package/src/wms/csw-source-loader.ts +330 -0
- package/src/wms/feature-pagination.ts +198 -0
- package/src/wms/gml-loader-types.ts +62 -0
- package/src/wms/gml-loader.ts +228 -0
- package/src/wms/index.ts +171 -0
- package/src/wms/lib/deprecated/create-image-service.ts.disabled +57 -0
- package/src/wms/lib/deprecated/create-image-source.ts +75 -0
- package/src/wms/lib/deprecated/image-source-compatibility.ts +28 -0
- package/src/wms/lib/deprecated/template-image-service.ts.disabled +68 -0
- package/src/wms/lib/parsers/csw/parse-csw-capabilities.ts +105 -0
- package/src/wms/lib/parsers/csw/parse-csw-domain.ts +47 -0
- package/src/wms/lib/parsers/csw/parse-csw-records.ts +94 -0
- package/src/wms/lib/parsers/csw/parse-exception-report.ts +33 -0
- package/src/wms/lib/parsers/gml/deep-strict-equal.ts +122 -0
- package/src/wms/lib/parsers/gml/parse-gml.ts +849 -0
- package/src/wms/lib/parsers/gml/rewind-geometry.ts +45 -0
- package/src/wms/lib/parsers/ogc-api/tile-matrix-limits.ts +107 -0
- package/src/wms/lib/parsers/ogc-api/tile-matrix-set.ts +167 -0
- package/src/wms/lib/parsers/wfs/parse-wfs-capabilities.ts +165 -0
- package/src/wms/lib/parsers/wfs/parse-wfs.ts +36 -0
- package/src/wms/lib/parsers/wms/parse-wms-capabilities.ts +427 -0
- package/src/wms/lib/parsers/wms/parse-wms-error.ts +24 -0
- package/src/wms/lib/parsers/wms/parse-wms-features.ts +41 -0
- package/src/wms/lib/parsers/wms/parse-wms-layer-description.ts +24 -0
- package/src/wms/lib/parsers/wmts/parse-wmts-capabilities.ts +281 -0
- package/src/wms/lib/parsers/xml/parse-xml-helpers.ts +67 -0
- package/src/wms/lib/parsers/xml/parse-xml-text.ts +11 -0
- package/src/wms/lib/tile-grid.ts +47 -0
- package/src/wms/managed-vector-source.ts +384 -0
- package/src/wms/ogc-api-coverages-source-loader.ts +109 -0
- package/src/wms/ogc-api-edr-source-loader.ts +127 -0
- package/src/wms/ogc-api-source-loader.ts +742 -0
- package/src/wms/service-capabilities.ts +147 -0
- package/src/wms/service-runtime.ts +225 -0
- package/src/wms/unbundled.ts +24 -0
- package/src/wms/wcs-source-loader.ts +260 -0
- package/src/wms/wfs-capabilities-loader-with-parser.ts +30 -0
- package/src/wms/wfs-capabilities-loader.ts +57 -0
- package/src/wms/wfs-source-loader.ts +987 -0
- package/src/wms/wip/data-source.ts +64 -0
- package/src/wms/wip/lib/wcs/parse-wcs-capabilities.ts +91 -0
- package/src/wms/wip/lib/wmts/parse-wmts-capabilities.ts +171 -0
- package/src/wms/wip/lib/wmts/parse-wmts.ts +39 -0
- package/src/wms/wip/services/wmts-service.ts.disabled +348 -0
- package/src/wms/wip/wcs-capabilities-loader-with-parser.ts +29 -0
- package/src/wms/wip/wcs-capabilities-loader.ts +50 -0
- package/src/wms/wip/wms-feature-info-loader-with-parser.ts +25 -0
- package/src/wms/wip/wms-feature-info-loader.ts +28 -0
- package/src/wms/wip/wms-layer-description-loader-with-parser.ts +25 -0
- package/src/wms/wip/wms-layer-description-loader.md.disabled.md +47 -0
- package/src/wms/wip/wms-layer-description-loader.ts +28 -0
- package/src/wms/wip/wmts-capabilities-loader-with-parser.ts +30 -0
- package/src/wms/wip/wmts-capabilities-loader.ts +52 -0
- package/src/wms/wms-capabilities-loader-with-parser.ts +45 -0
- package/src/wms/wms-capabilities-loader.ts +68 -0
- package/src/wms/wms-error-loader-with-parser.ts +44 -0
- package/src/wms/wms-error-loader.ts +56 -0
- package/src/wms/wms-format.ts +52 -0
- package/src/wms/wms-source-loader.ts +686 -0
- package/src/wms/wmts-capabilities-loader-with-parser.ts +17 -0
- package/src/wms/wmts-capabilities-loader.ts +30 -0
- package/src/wms/wmts-source-loader.ts +649 -0
|
@@ -0,0 +1,2189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __esm = (fn, res, err) => function __init() {
|
|
7
|
+
if (err) throw err[0];
|
|
8
|
+
try {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
} catch (e) {
|
|
11
|
+
throw err = [e], e;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
|
|
28
|
+
// ../xml/src/xml-format.ts
|
|
29
|
+
var XMLFormat;
|
|
30
|
+
var init_xml_format = __esm({
|
|
31
|
+
"../xml/src/xml-format.ts"() {
|
|
32
|
+
"use strict";
|
|
33
|
+
XMLFormat = {
|
|
34
|
+
name: "XML",
|
|
35
|
+
id: "xml",
|
|
36
|
+
module: "xml",
|
|
37
|
+
encoding: "xml",
|
|
38
|
+
format: "xml",
|
|
39
|
+
extensions: ["xml"],
|
|
40
|
+
mimeTypes: ["application/xml", "text/xml"],
|
|
41
|
+
category: "table",
|
|
42
|
+
text: true
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// ../xml/src/lib/xml-utils/uncapitalize.ts
|
|
48
|
+
function uncapitalize(str) {
|
|
49
|
+
return typeof str === "string" ? str.charAt(0).toLowerCase() + str.slice(1) : str;
|
|
50
|
+
}
|
|
51
|
+
function uncapitalizeKeys(object) {
|
|
52
|
+
if (Array.isArray(object)) {
|
|
53
|
+
return object.map((element) => uncapitalizeKeys(element));
|
|
54
|
+
}
|
|
55
|
+
if (object && typeof object === "object") {
|
|
56
|
+
const newObject = {};
|
|
57
|
+
for (const [key, value] of Object.entries(object)) {
|
|
58
|
+
newObject[uncapitalize(key)] = uncapitalizeKeys(value);
|
|
59
|
+
}
|
|
60
|
+
return newObject;
|
|
61
|
+
}
|
|
62
|
+
return object;
|
|
63
|
+
}
|
|
64
|
+
var init_uncapitalize = __esm({
|
|
65
|
+
"../xml/src/lib/xml-utils/uncapitalize.ts"() {
|
|
66
|
+
"use strict";
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// ../xml/src/sax-ts/sax.ts
|
|
71
|
+
var DEFAULT_SAX_EVENTS, DEFAULT_SAX_PARSER_OPTIONS, EVENTS, BUFFERS, nameStart, nameBody, entityStart, entityBody, ENTITIES, SAX, SAXParser;
|
|
72
|
+
var init_sax = __esm({
|
|
73
|
+
"../xml/src/sax-ts/sax.ts"() {
|
|
74
|
+
"use strict";
|
|
75
|
+
DEFAULT_SAX_EVENTS = {
|
|
76
|
+
ontext: () => {
|
|
77
|
+
},
|
|
78
|
+
onprocessinginstruction: () => {
|
|
79
|
+
},
|
|
80
|
+
onsgmldeclaration: () => {
|
|
81
|
+
},
|
|
82
|
+
ondoctype: () => {
|
|
83
|
+
},
|
|
84
|
+
oncomment: () => {
|
|
85
|
+
},
|
|
86
|
+
onopentagstart: () => {
|
|
87
|
+
},
|
|
88
|
+
onattribute: () => {
|
|
89
|
+
},
|
|
90
|
+
onopentag: () => {
|
|
91
|
+
},
|
|
92
|
+
onclosetag: () => {
|
|
93
|
+
},
|
|
94
|
+
onopencdata: () => {
|
|
95
|
+
},
|
|
96
|
+
oncdata: () => {
|
|
97
|
+
},
|
|
98
|
+
onclosecdata: () => {
|
|
99
|
+
},
|
|
100
|
+
onerror: () => {
|
|
101
|
+
},
|
|
102
|
+
onend: () => {
|
|
103
|
+
},
|
|
104
|
+
onready: () => {
|
|
105
|
+
},
|
|
106
|
+
onscript: () => {
|
|
107
|
+
},
|
|
108
|
+
onopennamespace: () => {
|
|
109
|
+
},
|
|
110
|
+
onclosenamespace: () => {
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
DEFAULT_SAX_PARSER_OPTIONS = {
|
|
114
|
+
...DEFAULT_SAX_EVENTS,
|
|
115
|
+
strict: false,
|
|
116
|
+
MAX_BUFFER_LENGTH: 64 * 1024,
|
|
117
|
+
lowercase: false,
|
|
118
|
+
lowercasetags: false,
|
|
119
|
+
noscript: false,
|
|
120
|
+
strictEntities: false,
|
|
121
|
+
xmlns: void 0,
|
|
122
|
+
position: void 0,
|
|
123
|
+
trim: void 0,
|
|
124
|
+
normalize: void 0
|
|
125
|
+
};
|
|
126
|
+
EVENTS = [
|
|
127
|
+
"text",
|
|
128
|
+
"processinginstruction",
|
|
129
|
+
"sgmldeclaration",
|
|
130
|
+
"doctype",
|
|
131
|
+
"comment",
|
|
132
|
+
"opentagstart",
|
|
133
|
+
"attribute",
|
|
134
|
+
"opentag",
|
|
135
|
+
"closetag",
|
|
136
|
+
"opencdata",
|
|
137
|
+
"cdata",
|
|
138
|
+
"closecdata",
|
|
139
|
+
"error",
|
|
140
|
+
"end",
|
|
141
|
+
"ready",
|
|
142
|
+
"script",
|
|
143
|
+
"opennamespace",
|
|
144
|
+
"closenamespace"
|
|
145
|
+
];
|
|
146
|
+
BUFFERS = [
|
|
147
|
+
"comment",
|
|
148
|
+
"sgmlDecl",
|
|
149
|
+
"textNode",
|
|
150
|
+
"tagName",
|
|
151
|
+
"doctype",
|
|
152
|
+
"procInstName",
|
|
153
|
+
"procInstBody",
|
|
154
|
+
"entity",
|
|
155
|
+
"attribName",
|
|
156
|
+
"attribValue",
|
|
157
|
+
"cdata",
|
|
158
|
+
"script"
|
|
159
|
+
];
|
|
160
|
+
nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
|
|
161
|
+
nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
|
|
162
|
+
entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
|
|
163
|
+
entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
|
|
164
|
+
ENTITIES = {
|
|
165
|
+
amp: "&",
|
|
166
|
+
gt: ">",
|
|
167
|
+
lt: "<",
|
|
168
|
+
quot: '"',
|
|
169
|
+
apos: "'",
|
|
170
|
+
AElig: 198,
|
|
171
|
+
Aacute: 193,
|
|
172
|
+
Acirc: 194,
|
|
173
|
+
Agrave: 192,
|
|
174
|
+
Aring: 197,
|
|
175
|
+
Atilde: 195,
|
|
176
|
+
Auml: 196,
|
|
177
|
+
Ccedil: 199,
|
|
178
|
+
ETH: 208,
|
|
179
|
+
Eacute: 201,
|
|
180
|
+
Ecirc: 202,
|
|
181
|
+
Egrave: 200,
|
|
182
|
+
Euml: 203,
|
|
183
|
+
Iacute: 205,
|
|
184
|
+
Icirc: 206,
|
|
185
|
+
Igrave: 204,
|
|
186
|
+
Iuml: 207,
|
|
187
|
+
Ntilde: 209,
|
|
188
|
+
Oacute: 211,
|
|
189
|
+
Ocirc: 212,
|
|
190
|
+
Ograve: 210,
|
|
191
|
+
Oslash: 216,
|
|
192
|
+
Otilde: 213,
|
|
193
|
+
Ouml: 214,
|
|
194
|
+
THORN: 222,
|
|
195
|
+
Uacute: 218,
|
|
196
|
+
Ucirc: 219,
|
|
197
|
+
Ugrave: 217,
|
|
198
|
+
Uuml: 220,
|
|
199
|
+
Yacute: 221,
|
|
200
|
+
aacute: 225,
|
|
201
|
+
acirc: 226,
|
|
202
|
+
aelig: 230,
|
|
203
|
+
agrave: 224,
|
|
204
|
+
aring: 229,
|
|
205
|
+
atilde: 227,
|
|
206
|
+
auml: 228,
|
|
207
|
+
ccedil: 231,
|
|
208
|
+
eacute: 233,
|
|
209
|
+
ecirc: 234,
|
|
210
|
+
egrave: 232,
|
|
211
|
+
eth: 240,
|
|
212
|
+
euml: 235,
|
|
213
|
+
iacute: 237,
|
|
214
|
+
icirc: 238,
|
|
215
|
+
igrave: 236,
|
|
216
|
+
iuml: 239,
|
|
217
|
+
ntilde: 241,
|
|
218
|
+
oacute: 243,
|
|
219
|
+
ocirc: 244,
|
|
220
|
+
ograve: 242,
|
|
221
|
+
oslash: 248,
|
|
222
|
+
otilde: 245,
|
|
223
|
+
ouml: 246,
|
|
224
|
+
szlig: 223,
|
|
225
|
+
thorn: 254,
|
|
226
|
+
uacute: 250,
|
|
227
|
+
ucirc: 251,
|
|
228
|
+
ugrave: 249,
|
|
229
|
+
uuml: 252,
|
|
230
|
+
yacute: 253,
|
|
231
|
+
yuml: 255,
|
|
232
|
+
copy: 169,
|
|
233
|
+
reg: 174,
|
|
234
|
+
nbsp: 160,
|
|
235
|
+
iexcl: 161,
|
|
236
|
+
cent: 162,
|
|
237
|
+
pound: 163,
|
|
238
|
+
curren: 164,
|
|
239
|
+
yen: 165,
|
|
240
|
+
brvbar: 166,
|
|
241
|
+
sect: 167,
|
|
242
|
+
uml: 168,
|
|
243
|
+
ordf: 170,
|
|
244
|
+
laquo: 171,
|
|
245
|
+
not: 172,
|
|
246
|
+
shy: 173,
|
|
247
|
+
macr: 175,
|
|
248
|
+
deg: 176,
|
|
249
|
+
plusmn: 177,
|
|
250
|
+
sup1: 185,
|
|
251
|
+
sup2: 178,
|
|
252
|
+
sup3: 179,
|
|
253
|
+
acute: 180,
|
|
254
|
+
micro: 181,
|
|
255
|
+
para: 182,
|
|
256
|
+
middot: 183,
|
|
257
|
+
cedil: 184,
|
|
258
|
+
ordm: 186,
|
|
259
|
+
raquo: 187,
|
|
260
|
+
frac14: 188,
|
|
261
|
+
frac12: 189,
|
|
262
|
+
frac34: 190,
|
|
263
|
+
iquest: 191,
|
|
264
|
+
times: 215,
|
|
265
|
+
divide: 247,
|
|
266
|
+
OElig: 338,
|
|
267
|
+
oelig: 339,
|
|
268
|
+
Scaron: 352,
|
|
269
|
+
scaron: 353,
|
|
270
|
+
Yuml: 376,
|
|
271
|
+
fnof: 402,
|
|
272
|
+
circ: 710,
|
|
273
|
+
tilde: 732,
|
|
274
|
+
Alpha: 913,
|
|
275
|
+
Beta: 914,
|
|
276
|
+
Gamma: 915,
|
|
277
|
+
Delta: 916,
|
|
278
|
+
Epsilon: 917,
|
|
279
|
+
Zeta: 918,
|
|
280
|
+
Eta: 919,
|
|
281
|
+
Theta: 920,
|
|
282
|
+
Iota: 921,
|
|
283
|
+
Kappa: 922,
|
|
284
|
+
Lambda: 923,
|
|
285
|
+
Mu: 924,
|
|
286
|
+
Nu: 925,
|
|
287
|
+
Xi: 926,
|
|
288
|
+
Omicron: 927,
|
|
289
|
+
Pi: 928,
|
|
290
|
+
Rho: 929,
|
|
291
|
+
Sigma: 931,
|
|
292
|
+
Tau: 932,
|
|
293
|
+
Upsilon: 933,
|
|
294
|
+
Phi: 934,
|
|
295
|
+
Chi: 935,
|
|
296
|
+
Psi: 936,
|
|
297
|
+
Omega: 937,
|
|
298
|
+
alpha: 945,
|
|
299
|
+
beta: 946,
|
|
300
|
+
gamma: 947,
|
|
301
|
+
delta: 948,
|
|
302
|
+
epsilon: 949,
|
|
303
|
+
zeta: 950,
|
|
304
|
+
eta: 951,
|
|
305
|
+
theta: 952,
|
|
306
|
+
iota: 953,
|
|
307
|
+
kappa: 954,
|
|
308
|
+
lambda: 955,
|
|
309
|
+
mu: 956,
|
|
310
|
+
nu: 957,
|
|
311
|
+
xi: 958,
|
|
312
|
+
omicron: 959,
|
|
313
|
+
pi: 960,
|
|
314
|
+
rho: 961,
|
|
315
|
+
sigmaf: 962,
|
|
316
|
+
sigma: 963,
|
|
317
|
+
tau: 964,
|
|
318
|
+
upsilon: 965,
|
|
319
|
+
phi: 966,
|
|
320
|
+
chi: 967,
|
|
321
|
+
psi: 968,
|
|
322
|
+
omega: 969,
|
|
323
|
+
thetasym: 977,
|
|
324
|
+
upsih: 978,
|
|
325
|
+
piv: 982,
|
|
326
|
+
ensp: 8194,
|
|
327
|
+
emsp: 8195,
|
|
328
|
+
thinsp: 8201,
|
|
329
|
+
zwnj: 8204,
|
|
330
|
+
zwj: 8205,
|
|
331
|
+
lrm: 8206,
|
|
332
|
+
rlm: 8207,
|
|
333
|
+
ndash: 8211,
|
|
334
|
+
mdash: 8212,
|
|
335
|
+
lsquo: 8216,
|
|
336
|
+
rsquo: 8217,
|
|
337
|
+
sbquo: 8218,
|
|
338
|
+
ldquo: 8220,
|
|
339
|
+
rdquo: 8221,
|
|
340
|
+
bdquo: 8222,
|
|
341
|
+
dagger: 8224,
|
|
342
|
+
Dagger: 8225,
|
|
343
|
+
bull: 8226,
|
|
344
|
+
hellip: 8230,
|
|
345
|
+
permil: 8240,
|
|
346
|
+
prime: 8242,
|
|
347
|
+
Prime: 8243,
|
|
348
|
+
lsaquo: 8249,
|
|
349
|
+
rsaquo: 8250,
|
|
350
|
+
oline: 8254,
|
|
351
|
+
frasl: 8260,
|
|
352
|
+
euro: 8364,
|
|
353
|
+
image: 8465,
|
|
354
|
+
weierp: 8472,
|
|
355
|
+
real: 8476,
|
|
356
|
+
trade: 8482,
|
|
357
|
+
alefsym: 8501,
|
|
358
|
+
larr: 8592,
|
|
359
|
+
uarr: 8593,
|
|
360
|
+
rarr: 8594,
|
|
361
|
+
darr: 8595,
|
|
362
|
+
harr: 8596,
|
|
363
|
+
crarr: 8629,
|
|
364
|
+
lArr: 8656,
|
|
365
|
+
uArr: 8657,
|
|
366
|
+
rArr: 8658,
|
|
367
|
+
dArr: 8659,
|
|
368
|
+
hArr: 8660,
|
|
369
|
+
forall: 8704,
|
|
370
|
+
part: 8706,
|
|
371
|
+
exist: 8707,
|
|
372
|
+
empty: 8709,
|
|
373
|
+
nabla: 8711,
|
|
374
|
+
isin: 8712,
|
|
375
|
+
notin: 8713,
|
|
376
|
+
ni: 8715,
|
|
377
|
+
prod: 8719,
|
|
378
|
+
sum: 8721,
|
|
379
|
+
minus: 8722,
|
|
380
|
+
lowast: 8727,
|
|
381
|
+
radic: 8730,
|
|
382
|
+
prop: 8733,
|
|
383
|
+
infin: 8734,
|
|
384
|
+
ang: 8736,
|
|
385
|
+
and: 8743,
|
|
386
|
+
or: 8744,
|
|
387
|
+
cap: 8745,
|
|
388
|
+
cup: 8746,
|
|
389
|
+
int: 8747,
|
|
390
|
+
there4: 8756,
|
|
391
|
+
sim: 8764,
|
|
392
|
+
cong: 8773,
|
|
393
|
+
asymp: 8776,
|
|
394
|
+
ne: 8800,
|
|
395
|
+
equiv: 8801,
|
|
396
|
+
le: 8804,
|
|
397
|
+
ge: 8805,
|
|
398
|
+
sub: 8834,
|
|
399
|
+
sup: 8835,
|
|
400
|
+
nsub: 8836,
|
|
401
|
+
sube: 8838,
|
|
402
|
+
supe: 8839,
|
|
403
|
+
oplus: 8853,
|
|
404
|
+
otimes: 8855,
|
|
405
|
+
perp: 8869,
|
|
406
|
+
sdot: 8901,
|
|
407
|
+
lceil: 8968,
|
|
408
|
+
rceil: 8969,
|
|
409
|
+
lfloor: 8970,
|
|
410
|
+
rfloor: 8971,
|
|
411
|
+
lang: 9001,
|
|
412
|
+
rang: 9002,
|
|
413
|
+
loz: 9674,
|
|
414
|
+
spades: 9824,
|
|
415
|
+
clubs: 9827,
|
|
416
|
+
hearts: 9829,
|
|
417
|
+
diams: 9830
|
|
418
|
+
};
|
|
419
|
+
Object.keys(ENTITIES).forEach((key) => {
|
|
420
|
+
const e = ENTITIES[key];
|
|
421
|
+
ENTITIES[key] = typeof e === "number" ? String.fromCharCode(e) : e;
|
|
422
|
+
});
|
|
423
|
+
SAX = class _SAX {
|
|
424
|
+
EVENTS = EVENTS;
|
|
425
|
+
ENTITIES = {
|
|
426
|
+
// TODO: make it readonly, needed for entity-mega test
|
|
427
|
+
// amp, gt, lt, quot and apos are resolved to strings instead of numerical
|
|
428
|
+
// codes, IDK why
|
|
429
|
+
...ENTITIES
|
|
430
|
+
};
|
|
431
|
+
XML_ENTITIES = {
|
|
432
|
+
amp: "&",
|
|
433
|
+
gt: ">",
|
|
434
|
+
lt: "<",
|
|
435
|
+
quot: '"',
|
|
436
|
+
apos: "'"
|
|
437
|
+
};
|
|
438
|
+
S = 0;
|
|
439
|
+
opt;
|
|
440
|
+
trackPosition = false;
|
|
441
|
+
column = 0;
|
|
442
|
+
line = 0;
|
|
443
|
+
c = "";
|
|
444
|
+
error;
|
|
445
|
+
q = "";
|
|
446
|
+
bufferCheckPosition;
|
|
447
|
+
closed = false;
|
|
448
|
+
tags = [];
|
|
449
|
+
looseCase = "";
|
|
450
|
+
closedRoot = false;
|
|
451
|
+
sawRoot = false;
|
|
452
|
+
strict = false;
|
|
453
|
+
tag;
|
|
454
|
+
strictEntities;
|
|
455
|
+
state;
|
|
456
|
+
noscript = false;
|
|
457
|
+
attribList = [];
|
|
458
|
+
ns;
|
|
459
|
+
position = 0;
|
|
460
|
+
STATE = {
|
|
461
|
+
BEGIN: this.S++,
|
|
462
|
+
// leading byte order mark or whitespace
|
|
463
|
+
BEGIN_WHITESPACE: this.S++,
|
|
464
|
+
// leading whitespace
|
|
465
|
+
TEXT: this.S++,
|
|
466
|
+
// general stuff
|
|
467
|
+
TEXT_ENTITY: this.S++,
|
|
468
|
+
// & and such.
|
|
469
|
+
OPEN_WAKA: this.S++,
|
|
470
|
+
// <
|
|
471
|
+
SGML_DECL: this.S++,
|
|
472
|
+
// <!BLARG
|
|
473
|
+
SGML_DECL_QUOTED: this.S++,
|
|
474
|
+
// <!BLARG foo "bar
|
|
475
|
+
DOCTYPE: this.S++,
|
|
476
|
+
// <!DOCTYPE
|
|
477
|
+
DOCTYPE_QUOTED: this.S++,
|
|
478
|
+
// <!DOCTYPE "//blah
|
|
479
|
+
DOCTYPE_DTD: this.S++,
|
|
480
|
+
// <!DOCTYPE "//blah" [ ...
|
|
481
|
+
DOCTYPE_DTD_QUOTED: this.S++,
|
|
482
|
+
// <!DOCTYPE "//blah" [ "foo
|
|
483
|
+
COMMENT_STARTING: this.S++,
|
|
484
|
+
// <!-
|
|
485
|
+
COMMENT: this.S++,
|
|
486
|
+
// <!--
|
|
487
|
+
COMMENT_ENDING: this.S++,
|
|
488
|
+
// <!-- blah -
|
|
489
|
+
COMMENT_ENDED: this.S++,
|
|
490
|
+
// <!-- blah --
|
|
491
|
+
CDATA: this.S++,
|
|
492
|
+
// <![CDATA[ something
|
|
493
|
+
CDATA_ENDING: this.S++,
|
|
494
|
+
// ]
|
|
495
|
+
CDATA_ENDING_2: this.S++,
|
|
496
|
+
// ]]
|
|
497
|
+
PROC_INST: this.S++,
|
|
498
|
+
// <?hi
|
|
499
|
+
PROC_INST_BODY: this.S++,
|
|
500
|
+
// <?hi there
|
|
501
|
+
PROC_INST_ENDING: this.S++,
|
|
502
|
+
// <?hi "there" ?
|
|
503
|
+
OPEN_TAG: this.S++,
|
|
504
|
+
// <strong
|
|
505
|
+
OPEN_TAG_SLASH: this.S++,
|
|
506
|
+
// <strong /
|
|
507
|
+
ATTRIB: this.S++,
|
|
508
|
+
// <a
|
|
509
|
+
ATTRIB_NAME: this.S++,
|
|
510
|
+
// <a foo
|
|
511
|
+
ATTRIB_NAME_SAW_WHITE: this.S++,
|
|
512
|
+
// <a foo _
|
|
513
|
+
ATTRIB_VALUE: this.S++,
|
|
514
|
+
// <a foo=
|
|
515
|
+
ATTRIB_VALUE_QUOTED: this.S++,
|
|
516
|
+
// <a foo="bar
|
|
517
|
+
ATTRIB_VALUE_CLOSED: this.S++,
|
|
518
|
+
// <a foo="bar"
|
|
519
|
+
ATTRIB_VALUE_UNQUOTED: this.S++,
|
|
520
|
+
// <a foo=bar
|
|
521
|
+
ATTRIB_VALUE_ENTITY_Q: this.S++,
|
|
522
|
+
// <foo bar="""
|
|
523
|
+
ATTRIB_VALUE_ENTITY_U: this.S++,
|
|
524
|
+
// <foo bar="
|
|
525
|
+
CLOSE_TAG: this.S++,
|
|
526
|
+
// </a
|
|
527
|
+
CLOSE_TAG_SAW_WHITE: this.S++,
|
|
528
|
+
// </a >
|
|
529
|
+
SCRIPT: this.S++,
|
|
530
|
+
// <script> ...
|
|
531
|
+
SCRIPT_ENDING: this.S++
|
|
532
|
+
// <script> ... <
|
|
533
|
+
};
|
|
534
|
+
BUFFERS = BUFFERS;
|
|
535
|
+
// private parser: (strict: boolean, opt: any) => SAXParser;
|
|
536
|
+
CDATA = "[CDATA[";
|
|
537
|
+
DOCTYPE = "DOCTYPE";
|
|
538
|
+
XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
|
|
539
|
+
XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
|
|
540
|
+
rootNS = {
|
|
541
|
+
xml: this.XML_NAMESPACE,
|
|
542
|
+
xmlns: this.XMLNS_NAMESPACE
|
|
543
|
+
};
|
|
544
|
+
comment;
|
|
545
|
+
sgmlDecl;
|
|
546
|
+
textNode = "";
|
|
547
|
+
tagName;
|
|
548
|
+
doctype;
|
|
549
|
+
procInstName;
|
|
550
|
+
procInstBody;
|
|
551
|
+
entity = "";
|
|
552
|
+
attribName;
|
|
553
|
+
attribValue;
|
|
554
|
+
cdata = "";
|
|
555
|
+
script = "";
|
|
556
|
+
startTagPosition = 0;
|
|
557
|
+
constructor() {
|
|
558
|
+
this.S = 0;
|
|
559
|
+
for (const s in this.STATE) {
|
|
560
|
+
if (this.STATE.hasOwnProperty(s)) {
|
|
561
|
+
this.STATE[this.STATE[s]] = s;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
this.S = this.STATE;
|
|
565
|
+
}
|
|
566
|
+
static charAt(chunk, i) {
|
|
567
|
+
let result = "";
|
|
568
|
+
if (i < chunk.length) {
|
|
569
|
+
result = chunk.charAt(i);
|
|
570
|
+
}
|
|
571
|
+
return result;
|
|
572
|
+
}
|
|
573
|
+
static isWhitespace(c) {
|
|
574
|
+
return c === " " || c === "\n" || c === "\r" || c === " ";
|
|
575
|
+
}
|
|
576
|
+
static isQuote(c) {
|
|
577
|
+
return c === '"' || c === "'";
|
|
578
|
+
}
|
|
579
|
+
static isAttribEnd(c) {
|
|
580
|
+
return c === ">" || _SAX.isWhitespace(c);
|
|
581
|
+
}
|
|
582
|
+
static isMatch(regex, c) {
|
|
583
|
+
return regex.test(c);
|
|
584
|
+
}
|
|
585
|
+
static notMatch(regex, c) {
|
|
586
|
+
return !_SAX.isMatch(regex, c);
|
|
587
|
+
}
|
|
588
|
+
static qname(name, attribute) {
|
|
589
|
+
const i = name.indexOf(":");
|
|
590
|
+
const qualName = i < 0 ? ["", name] : name.split(":");
|
|
591
|
+
let prefix = qualName[0];
|
|
592
|
+
let local = qualName[1];
|
|
593
|
+
if (attribute && name === "xmlns") {
|
|
594
|
+
prefix = "xmlns";
|
|
595
|
+
local = "";
|
|
596
|
+
}
|
|
597
|
+
return { prefix, local };
|
|
598
|
+
}
|
|
599
|
+
write(chunk) {
|
|
600
|
+
if (this.error) {
|
|
601
|
+
throw this.error;
|
|
602
|
+
}
|
|
603
|
+
if (this.closed) {
|
|
604
|
+
return this.errorFunction("Cannot write after close. Assign an onready handler.");
|
|
605
|
+
}
|
|
606
|
+
if (chunk === null) {
|
|
607
|
+
return this.end();
|
|
608
|
+
}
|
|
609
|
+
if (typeof chunk === "object") {
|
|
610
|
+
chunk = chunk.toString();
|
|
611
|
+
}
|
|
612
|
+
let i = 0;
|
|
613
|
+
let c;
|
|
614
|
+
while (true) {
|
|
615
|
+
c = _SAX.charAt(chunk, i++);
|
|
616
|
+
this.c = c;
|
|
617
|
+
if (!c) {
|
|
618
|
+
break;
|
|
619
|
+
}
|
|
620
|
+
if (this.trackPosition) {
|
|
621
|
+
this.position++;
|
|
622
|
+
if (c === "\n") {
|
|
623
|
+
this.line++;
|
|
624
|
+
this.column = 0;
|
|
625
|
+
} else {
|
|
626
|
+
this.column++;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
switch (this.state) {
|
|
630
|
+
case this.S.BEGIN:
|
|
631
|
+
this.state = this.S.BEGIN_WHITESPACE;
|
|
632
|
+
if (c === "\uFEFF") {
|
|
633
|
+
continue;
|
|
634
|
+
}
|
|
635
|
+
this.beginWhiteSpace(c);
|
|
636
|
+
continue;
|
|
637
|
+
case this.S.BEGIN_WHITESPACE:
|
|
638
|
+
this.beginWhiteSpace(c);
|
|
639
|
+
continue;
|
|
640
|
+
case this.S.TEXT:
|
|
641
|
+
if (this.sawRoot && !this.closedRoot) {
|
|
642
|
+
const starti = i - 1;
|
|
643
|
+
while (c && c !== "<" && c !== "&") {
|
|
644
|
+
c = _SAX.charAt(chunk, i++);
|
|
645
|
+
if (c && this.trackPosition) {
|
|
646
|
+
this.position++;
|
|
647
|
+
if (c === "\n") {
|
|
648
|
+
this.line++;
|
|
649
|
+
this.column = 0;
|
|
650
|
+
} else {
|
|
651
|
+
this.column++;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
this.textNode += chunk.substring(starti, i - 1);
|
|
656
|
+
}
|
|
657
|
+
if (c === "<" && !(this.sawRoot && this.closedRoot && !this.strict)) {
|
|
658
|
+
this.state = this.S.OPEN_WAKA;
|
|
659
|
+
this.startTagPosition = this.position;
|
|
660
|
+
} else {
|
|
661
|
+
if (!_SAX.isWhitespace(c) && (!this.sawRoot || this.closedRoot)) {
|
|
662
|
+
this.strictFail("Text data outside of root node.");
|
|
663
|
+
}
|
|
664
|
+
if (c === "&") {
|
|
665
|
+
this.state = this.S.TEXT_ENTITY;
|
|
666
|
+
} else {
|
|
667
|
+
this.textNode += c;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
continue;
|
|
671
|
+
case this.S.SCRIPT:
|
|
672
|
+
if (c === "<") {
|
|
673
|
+
this.state = this.S.SCRIPT_ENDING;
|
|
674
|
+
} else {
|
|
675
|
+
this.script += c;
|
|
676
|
+
}
|
|
677
|
+
continue;
|
|
678
|
+
case this.S.SCRIPT_ENDING:
|
|
679
|
+
if (c === "/") {
|
|
680
|
+
this.state = this.S.CLOSE_TAG;
|
|
681
|
+
} else {
|
|
682
|
+
this.script += `<${c}`;
|
|
683
|
+
this.state = this.S.SCRIPT;
|
|
684
|
+
}
|
|
685
|
+
continue;
|
|
686
|
+
case this.S.OPEN_WAKA:
|
|
687
|
+
if (c === "!") {
|
|
688
|
+
this.state = this.S.SGML_DECL;
|
|
689
|
+
this.sgmlDecl = "";
|
|
690
|
+
} else if (_SAX.isWhitespace(c)) {
|
|
691
|
+
} else if (_SAX.isMatch(nameStart, c)) {
|
|
692
|
+
this.state = this.S.OPEN_TAG;
|
|
693
|
+
this.tagName = c;
|
|
694
|
+
} else if (c === "/") {
|
|
695
|
+
this.state = this.S.CLOSE_TAG;
|
|
696
|
+
this.tagName = "";
|
|
697
|
+
} else if (c === "?") {
|
|
698
|
+
this.state = this.S.PROC_INST;
|
|
699
|
+
this.procInstName = this.procInstBody = "";
|
|
700
|
+
} else {
|
|
701
|
+
this.strictFail("Unencoded <");
|
|
702
|
+
if (this.startTagPosition + 1 < this.position) {
|
|
703
|
+
const pad = this.position - this.startTagPosition;
|
|
704
|
+
c = new Array(pad).join(" ") + c;
|
|
705
|
+
}
|
|
706
|
+
this.textNode += `<${c}`;
|
|
707
|
+
this.state = this.S.TEXT;
|
|
708
|
+
}
|
|
709
|
+
continue;
|
|
710
|
+
case this.S.SGML_DECL:
|
|
711
|
+
if ((this.sgmlDecl + c).toUpperCase() === this.CDATA) {
|
|
712
|
+
this.emitNode("onopencdata");
|
|
713
|
+
this.state = this.S.CDATA;
|
|
714
|
+
this.sgmlDecl = "";
|
|
715
|
+
this.cdata = "";
|
|
716
|
+
} else if (this.sgmlDecl + c === "--") {
|
|
717
|
+
this.state = this.S.COMMENT;
|
|
718
|
+
this.comment = "";
|
|
719
|
+
this.sgmlDecl = "";
|
|
720
|
+
} else if ((this.sgmlDecl + c).toUpperCase() === this.DOCTYPE) {
|
|
721
|
+
this.state = this.S.DOCTYPE;
|
|
722
|
+
if (this.doctype || this.sawRoot) {
|
|
723
|
+
this.strictFail("Inappropriately located doctype declaration");
|
|
724
|
+
}
|
|
725
|
+
this.doctype = "";
|
|
726
|
+
this.sgmlDecl = "";
|
|
727
|
+
} else if (c === ">") {
|
|
728
|
+
this.emitNode("onsgmldeclaration", this.sgmlDecl);
|
|
729
|
+
this.sgmlDecl = "";
|
|
730
|
+
this.state = this.S.TEXT;
|
|
731
|
+
} else if (_SAX.isQuote(c)) {
|
|
732
|
+
this.state = this.S.SGML_DECL_QUOTED;
|
|
733
|
+
this.sgmlDecl += c;
|
|
734
|
+
} else {
|
|
735
|
+
this.sgmlDecl += c;
|
|
736
|
+
}
|
|
737
|
+
continue;
|
|
738
|
+
case this.S.SGML_DECL_QUOTED:
|
|
739
|
+
if (c === this.q) {
|
|
740
|
+
this.state = this.S.SGML_DECL;
|
|
741
|
+
this.q = "";
|
|
742
|
+
}
|
|
743
|
+
this.sgmlDecl += c;
|
|
744
|
+
continue;
|
|
745
|
+
case this.S.DOCTYPE:
|
|
746
|
+
if (c === ">") {
|
|
747
|
+
this.state = this.S.TEXT;
|
|
748
|
+
this.emitNode("ondoctype", this.doctype);
|
|
749
|
+
this.doctype = true;
|
|
750
|
+
} else {
|
|
751
|
+
this.doctype += c;
|
|
752
|
+
if (c === "[") {
|
|
753
|
+
this.state = this.S.DOCTYPE_DTD;
|
|
754
|
+
} else if (_SAX.isQuote(c)) {
|
|
755
|
+
this.state = this.S.DOCTYPE_QUOTED;
|
|
756
|
+
this.q = c;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
continue;
|
|
760
|
+
case this.S.DOCTYPE_QUOTED:
|
|
761
|
+
this.doctype += c;
|
|
762
|
+
if (c === this.q) {
|
|
763
|
+
this.q = "";
|
|
764
|
+
this.state = this.S.DOCTYPE;
|
|
765
|
+
}
|
|
766
|
+
continue;
|
|
767
|
+
case this.S.DOCTYPE_DTD:
|
|
768
|
+
this.doctype += c;
|
|
769
|
+
if (c === "]") {
|
|
770
|
+
this.state = this.S.DOCTYPE;
|
|
771
|
+
} else if (_SAX.isQuote(c)) {
|
|
772
|
+
this.state = this.S.DOCTYPE_DTD_QUOTED;
|
|
773
|
+
this.q = c;
|
|
774
|
+
}
|
|
775
|
+
continue;
|
|
776
|
+
case this.S.DOCTYPE_DTD_QUOTED:
|
|
777
|
+
this.doctype += c;
|
|
778
|
+
if (c === this.q) {
|
|
779
|
+
this.state = this.S.DOCTYPE_DTD;
|
|
780
|
+
this.q = "";
|
|
781
|
+
}
|
|
782
|
+
continue;
|
|
783
|
+
case this.S.COMMENT:
|
|
784
|
+
if (c === "-") {
|
|
785
|
+
this.state = this.S.COMMENT_ENDING;
|
|
786
|
+
} else {
|
|
787
|
+
this.comment += c;
|
|
788
|
+
}
|
|
789
|
+
continue;
|
|
790
|
+
case this.S.COMMENT_ENDING:
|
|
791
|
+
if (c === "-") {
|
|
792
|
+
this.state = this.S.COMMENT_ENDED;
|
|
793
|
+
this.comment = this.textApplyOptions(this.comment);
|
|
794
|
+
if (this.comment) {
|
|
795
|
+
this.emitNode("oncomment", this.comment);
|
|
796
|
+
}
|
|
797
|
+
this.comment = "";
|
|
798
|
+
} else {
|
|
799
|
+
this.comment += `-${c}`;
|
|
800
|
+
this.state = this.S.COMMENT;
|
|
801
|
+
}
|
|
802
|
+
continue;
|
|
803
|
+
case this.S.COMMENT_ENDED:
|
|
804
|
+
if (c !== ">") {
|
|
805
|
+
this.strictFail("Malformed comment");
|
|
806
|
+
this.comment += `--${c}`;
|
|
807
|
+
this.state = this.S.COMMENT;
|
|
808
|
+
} else {
|
|
809
|
+
this.state = this.S.TEXT;
|
|
810
|
+
}
|
|
811
|
+
continue;
|
|
812
|
+
case this.S.CDATA:
|
|
813
|
+
if (c === "]") {
|
|
814
|
+
this.state = this.S.CDATA_ENDING;
|
|
815
|
+
} else {
|
|
816
|
+
this.cdata += c;
|
|
817
|
+
}
|
|
818
|
+
continue;
|
|
819
|
+
case this.S.CDATA_ENDING:
|
|
820
|
+
if (c === "]") {
|
|
821
|
+
this.state = this.S.CDATA_ENDING_2;
|
|
822
|
+
} else {
|
|
823
|
+
this.cdata += `]${c}`;
|
|
824
|
+
this.state = this.S.CDATA;
|
|
825
|
+
}
|
|
826
|
+
continue;
|
|
827
|
+
case this.S.CDATA_ENDING_2:
|
|
828
|
+
if (c === ">") {
|
|
829
|
+
if (this.cdata) {
|
|
830
|
+
this.emitNode("oncdata", this.cdata);
|
|
831
|
+
}
|
|
832
|
+
this.emitNode("onclosecdata");
|
|
833
|
+
this.cdata = "";
|
|
834
|
+
this.state = this.S.TEXT;
|
|
835
|
+
} else if (c === "]") {
|
|
836
|
+
this.cdata += "]";
|
|
837
|
+
} else {
|
|
838
|
+
this.cdata += `]]${c}`;
|
|
839
|
+
this.state = this.S.CDATA;
|
|
840
|
+
}
|
|
841
|
+
continue;
|
|
842
|
+
case this.S.PROC_INST:
|
|
843
|
+
if (c === "?") {
|
|
844
|
+
this.state = this.S.PROC_INST_ENDING;
|
|
845
|
+
} else if (_SAX.isWhitespace(c)) {
|
|
846
|
+
this.state = this.S.PROC_INST_BODY;
|
|
847
|
+
} else {
|
|
848
|
+
this.procInstName += c;
|
|
849
|
+
}
|
|
850
|
+
continue;
|
|
851
|
+
case this.S.PROC_INST_BODY:
|
|
852
|
+
if (!this.procInstBody && _SAX.isWhitespace(c)) {
|
|
853
|
+
continue;
|
|
854
|
+
} else if (c === "?") {
|
|
855
|
+
this.state = this.S.PROC_INST_ENDING;
|
|
856
|
+
} else {
|
|
857
|
+
this.procInstBody += c;
|
|
858
|
+
}
|
|
859
|
+
continue;
|
|
860
|
+
case this.S.PROC_INST_ENDING:
|
|
861
|
+
if (c === ">") {
|
|
862
|
+
this.emitNode("onprocessinginstruction", {
|
|
863
|
+
name: this.procInstName,
|
|
864
|
+
body: this.procInstBody
|
|
865
|
+
});
|
|
866
|
+
this.procInstName = this.procInstBody = "";
|
|
867
|
+
this.state = this.S.TEXT;
|
|
868
|
+
} else {
|
|
869
|
+
this.procInstBody += `?${c}`;
|
|
870
|
+
this.state = this.S.PROC_INST_BODY;
|
|
871
|
+
}
|
|
872
|
+
continue;
|
|
873
|
+
case this.S.OPEN_TAG:
|
|
874
|
+
if (_SAX.isMatch(nameBody, c)) {
|
|
875
|
+
this.tagName += c;
|
|
876
|
+
} else {
|
|
877
|
+
this.newTag();
|
|
878
|
+
if (c === ">") {
|
|
879
|
+
this.openTag();
|
|
880
|
+
} else if (c === "/") {
|
|
881
|
+
this.state = this.S.OPEN_TAG_SLASH;
|
|
882
|
+
} else {
|
|
883
|
+
if (!_SAX.isWhitespace(c)) {
|
|
884
|
+
this.strictFail("Invalid character in tag name");
|
|
885
|
+
}
|
|
886
|
+
this.state = this.S.ATTRIB;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
continue;
|
|
890
|
+
case this.S.OPEN_TAG_SLASH:
|
|
891
|
+
if (c === ">") {
|
|
892
|
+
this.openTag(true);
|
|
893
|
+
this.closeTag();
|
|
894
|
+
} else {
|
|
895
|
+
this.strictFail("Forward-slash in opening tag not followed by >");
|
|
896
|
+
this.state = this.S.ATTRIB;
|
|
897
|
+
}
|
|
898
|
+
continue;
|
|
899
|
+
case this.S.ATTRIB:
|
|
900
|
+
if (_SAX.isWhitespace(c)) {
|
|
901
|
+
continue;
|
|
902
|
+
} else if (c === ">") {
|
|
903
|
+
this.openTag();
|
|
904
|
+
} else if (c === "/") {
|
|
905
|
+
this.state = this.S.OPEN_TAG_SLASH;
|
|
906
|
+
} else if (_SAX.isMatch(nameStart, c)) {
|
|
907
|
+
this.attribName = c;
|
|
908
|
+
this.attribValue = "";
|
|
909
|
+
this.state = this.S.ATTRIB_NAME;
|
|
910
|
+
} else {
|
|
911
|
+
this.strictFail("Invalid attribute name");
|
|
912
|
+
}
|
|
913
|
+
continue;
|
|
914
|
+
case this.S.ATTRIB_NAME:
|
|
915
|
+
if (c === "=") {
|
|
916
|
+
this.state = this.S.ATTRIB_VALUE;
|
|
917
|
+
} else if (c === ">") {
|
|
918
|
+
this.strictFail("Attribute without value");
|
|
919
|
+
this.attribValue = this.attribName;
|
|
920
|
+
this.attrib();
|
|
921
|
+
this.openTag();
|
|
922
|
+
} else if (_SAX.isWhitespace(c)) {
|
|
923
|
+
this.state = this.S.ATTRIB_NAME_SAW_WHITE;
|
|
924
|
+
} else if (_SAX.isMatch(nameBody, c)) {
|
|
925
|
+
this.attribName += c;
|
|
926
|
+
} else {
|
|
927
|
+
this.strictFail("Invalid attribute name");
|
|
928
|
+
}
|
|
929
|
+
continue;
|
|
930
|
+
case this.S.ATTRIB_NAME_SAW_WHITE:
|
|
931
|
+
if (c === "=") {
|
|
932
|
+
this.state = this.S.ATTRIB_VALUE;
|
|
933
|
+
} else if (_SAX.isWhitespace(c)) {
|
|
934
|
+
continue;
|
|
935
|
+
} else {
|
|
936
|
+
this.strictFail("Attribute without value");
|
|
937
|
+
this.tag.attributes[this.attribName] = "";
|
|
938
|
+
this.attribValue = "";
|
|
939
|
+
this.emitNode("onattribute", {
|
|
940
|
+
name: this.attribName,
|
|
941
|
+
value: ""
|
|
942
|
+
});
|
|
943
|
+
this.attribName = "";
|
|
944
|
+
if (c === ">") {
|
|
945
|
+
this.openTag();
|
|
946
|
+
} else if (_SAX.isMatch(nameStart, c)) {
|
|
947
|
+
this.attribName = c;
|
|
948
|
+
this.state = this.S.ATTRIB_NAME;
|
|
949
|
+
} else {
|
|
950
|
+
this.strictFail("Invalid attribute name");
|
|
951
|
+
this.state = this.S.ATTRIB;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
continue;
|
|
955
|
+
case this.S.ATTRIB_VALUE:
|
|
956
|
+
if (_SAX.isWhitespace(c)) {
|
|
957
|
+
continue;
|
|
958
|
+
} else if (_SAX.isQuote(c)) {
|
|
959
|
+
this.q = c;
|
|
960
|
+
this.state = this.S.ATTRIB_VALUE_QUOTED;
|
|
961
|
+
} else {
|
|
962
|
+
this.strictFail("Unquoted attribute value");
|
|
963
|
+
this.state = this.S.ATTRIB_VALUE_UNQUOTED;
|
|
964
|
+
this.attribValue = c;
|
|
965
|
+
}
|
|
966
|
+
continue;
|
|
967
|
+
case this.S.ATTRIB_VALUE_QUOTED:
|
|
968
|
+
if (c !== this.q) {
|
|
969
|
+
if (c === "&") {
|
|
970
|
+
this.state = this.S.ATTRIB_VALUE_ENTITY_Q;
|
|
971
|
+
} else {
|
|
972
|
+
this.attribValue += c;
|
|
973
|
+
}
|
|
974
|
+
continue;
|
|
975
|
+
}
|
|
976
|
+
this.attrib();
|
|
977
|
+
this.q = "";
|
|
978
|
+
this.state = this.S.ATTRIB_VALUE_CLOSED;
|
|
979
|
+
continue;
|
|
980
|
+
case this.S.ATTRIB_VALUE_CLOSED:
|
|
981
|
+
if (_SAX.isWhitespace(c)) {
|
|
982
|
+
this.state = this.S.ATTRIB;
|
|
983
|
+
} else if (c === ">") {
|
|
984
|
+
this.openTag();
|
|
985
|
+
} else if (c === "/") {
|
|
986
|
+
this.state = this.S.OPEN_TAG_SLASH;
|
|
987
|
+
} else if (_SAX.isMatch(nameStart, c)) {
|
|
988
|
+
this.strictFail("No whitespace between attributes");
|
|
989
|
+
this.attribName = c;
|
|
990
|
+
this.attribValue = "";
|
|
991
|
+
this.state = this.S.ATTRIB_NAME;
|
|
992
|
+
} else {
|
|
993
|
+
this.strictFail("Invalid attribute name");
|
|
994
|
+
}
|
|
995
|
+
continue;
|
|
996
|
+
case this.S.ATTRIB_VALUE_UNQUOTED:
|
|
997
|
+
if (!_SAX.isAttribEnd(c)) {
|
|
998
|
+
if (c === "&") {
|
|
999
|
+
this.state = this.S.ATTRIB_VALUE_ENTITY_U;
|
|
1000
|
+
} else {
|
|
1001
|
+
this.attribValue += c;
|
|
1002
|
+
}
|
|
1003
|
+
continue;
|
|
1004
|
+
}
|
|
1005
|
+
this.attrib();
|
|
1006
|
+
if (c === ">") {
|
|
1007
|
+
this.openTag();
|
|
1008
|
+
} else {
|
|
1009
|
+
this.state = this.S.ATTRIB;
|
|
1010
|
+
}
|
|
1011
|
+
continue;
|
|
1012
|
+
case this.S.CLOSE_TAG:
|
|
1013
|
+
if (!this.tagName) {
|
|
1014
|
+
if (_SAX.isWhitespace(c)) {
|
|
1015
|
+
continue;
|
|
1016
|
+
} else if (_SAX.notMatch(nameStart, c)) {
|
|
1017
|
+
if (this.script) {
|
|
1018
|
+
this.script += `</${c}`;
|
|
1019
|
+
this.state = this.S.SCRIPT;
|
|
1020
|
+
} else {
|
|
1021
|
+
this.strictFail("Invalid tagname in closing tag.");
|
|
1022
|
+
}
|
|
1023
|
+
} else {
|
|
1024
|
+
this.tagName = c;
|
|
1025
|
+
}
|
|
1026
|
+
} else if (c === ">") {
|
|
1027
|
+
this.closeTag();
|
|
1028
|
+
} else if (_SAX.isMatch(nameBody, c)) {
|
|
1029
|
+
this.tagName += c;
|
|
1030
|
+
} else if (this.script) {
|
|
1031
|
+
this.script += `</${this.tagName}`;
|
|
1032
|
+
this.tagName = "";
|
|
1033
|
+
this.state = this.S.SCRIPT;
|
|
1034
|
+
} else {
|
|
1035
|
+
if (!_SAX.isWhitespace(c)) {
|
|
1036
|
+
this.strictFail("Invalid tagname in closing tag");
|
|
1037
|
+
}
|
|
1038
|
+
this.state = this.S.CLOSE_TAG_SAW_WHITE;
|
|
1039
|
+
}
|
|
1040
|
+
continue;
|
|
1041
|
+
case this.S.CLOSE_TAG_SAW_WHITE:
|
|
1042
|
+
if (_SAX.isWhitespace(c)) {
|
|
1043
|
+
continue;
|
|
1044
|
+
}
|
|
1045
|
+
if (c === ">") {
|
|
1046
|
+
this.closeTag();
|
|
1047
|
+
} else {
|
|
1048
|
+
this.strictFail("Invalid characters in closing tag");
|
|
1049
|
+
}
|
|
1050
|
+
continue;
|
|
1051
|
+
case this.S.TEXT_ENTITY:
|
|
1052
|
+
case this.S.ATTRIB_VALUE_ENTITY_Q:
|
|
1053
|
+
case this.S.ATTRIB_VALUE_ENTITY_U:
|
|
1054
|
+
let returnState;
|
|
1055
|
+
let buffer;
|
|
1056
|
+
switch (this.state) {
|
|
1057
|
+
case this.S.TEXT_ENTITY:
|
|
1058
|
+
returnState = this.S.TEXT;
|
|
1059
|
+
buffer = "textNode";
|
|
1060
|
+
break;
|
|
1061
|
+
case this.S.ATTRIB_VALUE_ENTITY_Q:
|
|
1062
|
+
returnState = this.S.ATTRIB_VALUE_QUOTED;
|
|
1063
|
+
buffer = "attribValue";
|
|
1064
|
+
break;
|
|
1065
|
+
case this.S.ATTRIB_VALUE_ENTITY_U:
|
|
1066
|
+
returnState = this.S.ATTRIB_VALUE_UNQUOTED;
|
|
1067
|
+
buffer = "attribValue";
|
|
1068
|
+
break;
|
|
1069
|
+
default:
|
|
1070
|
+
throw new Error(`Unknown state: ${this.state}`);
|
|
1071
|
+
}
|
|
1072
|
+
if (c === ";") {
|
|
1073
|
+
this[buffer] += this.parseEntity();
|
|
1074
|
+
this.entity = "";
|
|
1075
|
+
this.state = returnState;
|
|
1076
|
+
} else if (_SAX.isMatch(this.entity.length ? entityBody : entityStart, c)) {
|
|
1077
|
+
this.entity += c;
|
|
1078
|
+
} else {
|
|
1079
|
+
this.strictFail("Invalid character in entity name");
|
|
1080
|
+
this[buffer] += `&${this.entity}${c}`;
|
|
1081
|
+
this.entity = "";
|
|
1082
|
+
this.state = returnState;
|
|
1083
|
+
}
|
|
1084
|
+
continue;
|
|
1085
|
+
default:
|
|
1086
|
+
throw new Error(`Unknown state: ${this.state}`);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
if (this.position >= this.bufferCheckPosition) {
|
|
1090
|
+
this.checkBufferLength();
|
|
1091
|
+
}
|
|
1092
|
+
return this;
|
|
1093
|
+
}
|
|
1094
|
+
emit(event, data) {
|
|
1095
|
+
if (this.events.hasOwnProperty(event)) {
|
|
1096
|
+
const eventName = event.replace(/^on/, "");
|
|
1097
|
+
this.events[event](data, eventName, this);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
clearBuffers() {
|
|
1101
|
+
for (let i = 0, l = this.BUFFERS.length; i < l; i++) {
|
|
1102
|
+
this[this[i]] = "";
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
flushBuffers() {
|
|
1106
|
+
this.closeText();
|
|
1107
|
+
if (this.cdata !== "") {
|
|
1108
|
+
this.emitNode("oncdata", this.cdata);
|
|
1109
|
+
this.cdata = "";
|
|
1110
|
+
}
|
|
1111
|
+
if (this.script !== "") {
|
|
1112
|
+
this.emitNode("onscript", this.script);
|
|
1113
|
+
this.script = "";
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
end() {
|
|
1117
|
+
if (this.sawRoot && !this.closedRoot) this.strictFail("Unclosed root tag");
|
|
1118
|
+
if (this.state !== this.S.BEGIN && this.state !== this.S.BEGIN_WHITESPACE && this.state !== this.S.TEXT) {
|
|
1119
|
+
this.errorFunction("Unexpected end");
|
|
1120
|
+
}
|
|
1121
|
+
this.closeText();
|
|
1122
|
+
this.c = "";
|
|
1123
|
+
this.closed = true;
|
|
1124
|
+
this.emit("onend");
|
|
1125
|
+
return new SAXParser(this.opt);
|
|
1126
|
+
}
|
|
1127
|
+
errorFunction(er) {
|
|
1128
|
+
this.closeText();
|
|
1129
|
+
if (this.trackPosition) {
|
|
1130
|
+
er += `
|
|
1131
|
+
Line: ${this.line}
|
|
1132
|
+
Column: ${this.column}
|
|
1133
|
+
Char: ${this.c}`;
|
|
1134
|
+
}
|
|
1135
|
+
const error = new Error(er);
|
|
1136
|
+
this.error = error;
|
|
1137
|
+
this.emit("onerror", error);
|
|
1138
|
+
return this;
|
|
1139
|
+
}
|
|
1140
|
+
attrib() {
|
|
1141
|
+
if (!this.strict) {
|
|
1142
|
+
this.attribName = this.attribName[this.looseCase]();
|
|
1143
|
+
}
|
|
1144
|
+
if (this.attribList.indexOf(this.attribName) !== -1 || this.tag.attributes.hasOwnProperty(this.attribName)) {
|
|
1145
|
+
this.attribName = this.attribValue = "";
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
if (this.opt.xmlns) {
|
|
1149
|
+
const qn = _SAX.qname(this.attribName, true);
|
|
1150
|
+
const prefix = qn.prefix;
|
|
1151
|
+
const local = qn.local;
|
|
1152
|
+
if (prefix === "xmlns") {
|
|
1153
|
+
if (local === "xml" && this.attribValue !== this.XML_NAMESPACE) {
|
|
1154
|
+
this.strictFail(
|
|
1155
|
+
`xml: prefix must be bound to ${this.XML_NAMESPACE}
|
|
1156
|
+
Actual: ${this.attribValue}`
|
|
1157
|
+
);
|
|
1158
|
+
} else if (local === "xmlns" && this.attribValue !== this.XMLNS_NAMESPACE) {
|
|
1159
|
+
this.strictFail(
|
|
1160
|
+
`xmlns: prefix must be bound to ${this.XMLNS_NAMESPACE}
|
|
1161
|
+
Actual: ${this.attribValue}`
|
|
1162
|
+
);
|
|
1163
|
+
} else {
|
|
1164
|
+
const tag = this.tag;
|
|
1165
|
+
const parent = this.tags[this.tags.length - 1] || this;
|
|
1166
|
+
if (tag.ns === parent.ns) {
|
|
1167
|
+
tag.ns = Object.create(parent.ns);
|
|
1168
|
+
}
|
|
1169
|
+
tag.ns[local] = this.attribValue;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
this.attribList.push([this.attribName, this.attribValue]);
|
|
1173
|
+
} else {
|
|
1174
|
+
this.tag.attributes[this.attribName] = this.attribValue;
|
|
1175
|
+
this.emitNode("onattribute", {
|
|
1176
|
+
name: this.attribName,
|
|
1177
|
+
value: this.attribValue
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
this.attribName = this.attribValue = "";
|
|
1181
|
+
}
|
|
1182
|
+
newTag() {
|
|
1183
|
+
if (!this.strict) this.tagName = this.tagName[this.looseCase]();
|
|
1184
|
+
const parent = this.tags[this.tags.length - 1] || this;
|
|
1185
|
+
const tag = { name: this.tagName, attributes: {} };
|
|
1186
|
+
this.tag = tag;
|
|
1187
|
+
if (this.opt.xmlns) {
|
|
1188
|
+
tag.ns = parent.ns;
|
|
1189
|
+
}
|
|
1190
|
+
this.attribList.length = 0;
|
|
1191
|
+
this.emitNode("onopentagstart", tag);
|
|
1192
|
+
}
|
|
1193
|
+
parseEntity() {
|
|
1194
|
+
let entity = this.entity;
|
|
1195
|
+
const entityLC = entity.toLowerCase();
|
|
1196
|
+
let num = NaN;
|
|
1197
|
+
let numStr = "";
|
|
1198
|
+
if (this.ENTITIES[entity]) {
|
|
1199
|
+
return this.ENTITIES[entity];
|
|
1200
|
+
}
|
|
1201
|
+
if (this.ENTITIES[entityLC]) {
|
|
1202
|
+
return this.ENTITIES[entityLC];
|
|
1203
|
+
}
|
|
1204
|
+
entity = entityLC;
|
|
1205
|
+
if (entity.charAt(0) === "#") {
|
|
1206
|
+
if (entity.charAt(1) === "x") {
|
|
1207
|
+
entity = entity.slice(2);
|
|
1208
|
+
num = parseInt(entity, 16);
|
|
1209
|
+
numStr = num.toString(16);
|
|
1210
|
+
} else {
|
|
1211
|
+
entity = entity.slice(1);
|
|
1212
|
+
num = parseInt(entity, 10);
|
|
1213
|
+
numStr = num.toString(10);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
entity = entity.replace(/^0+/, "");
|
|
1217
|
+
if (Number.isNaN(num) || numStr.toLowerCase() !== entity) {
|
|
1218
|
+
this.strictFail("Invalid character entity");
|
|
1219
|
+
return `&${this.entity};`;
|
|
1220
|
+
}
|
|
1221
|
+
return String.fromCodePoint(num);
|
|
1222
|
+
}
|
|
1223
|
+
beginWhiteSpace(c) {
|
|
1224
|
+
if (c === "<") {
|
|
1225
|
+
this.state = this.S.OPEN_WAKA;
|
|
1226
|
+
this.startTagPosition = this.position;
|
|
1227
|
+
} else if (!_SAX.isWhitespace(c)) {
|
|
1228
|
+
this.strictFail("Non-whitespace before first tag.");
|
|
1229
|
+
this.textNode = c;
|
|
1230
|
+
this.state = this.S.TEXT;
|
|
1231
|
+
} else {
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
strictFail(message) {
|
|
1235
|
+
if (typeof this !== "object" || !(this instanceof SAXParser)) {
|
|
1236
|
+
throw new Error("bad call to strictFail");
|
|
1237
|
+
}
|
|
1238
|
+
if (this.strict) {
|
|
1239
|
+
this.errorFunction(message);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
textApplyOptions(text3) {
|
|
1243
|
+
if (this.opt.trim) text3 = text3.trim();
|
|
1244
|
+
if (this.opt.normalize) text3 = text3.replace(/\s+/g, " ");
|
|
1245
|
+
return text3;
|
|
1246
|
+
}
|
|
1247
|
+
emitNode(nodeType, data) {
|
|
1248
|
+
if (this.textNode) this.closeText();
|
|
1249
|
+
this.emit(nodeType, data);
|
|
1250
|
+
}
|
|
1251
|
+
closeText() {
|
|
1252
|
+
this.textNode = this.textApplyOptions(this.textNode);
|
|
1253
|
+
if (this.textNode !== void 0 && this.textNode !== "" && this.textNode !== "undefined") {
|
|
1254
|
+
this.emit("ontext", this.textNode);
|
|
1255
|
+
}
|
|
1256
|
+
this.textNode = "";
|
|
1257
|
+
}
|
|
1258
|
+
checkBufferLength() {
|
|
1259
|
+
var _a;
|
|
1260
|
+
const maxAllowed = Math.max(this.opt.MAX_BUFFER_LENGTH, 10);
|
|
1261
|
+
let maxActual = 0;
|
|
1262
|
+
for (let i = 0, l = this.BUFFERS.length; i < l; i++) {
|
|
1263
|
+
const len = ((_a = this[this.BUFFERS[i]]) == null ? void 0 : _a.length) || 0;
|
|
1264
|
+
if (len > maxAllowed) {
|
|
1265
|
+
switch (this.BUFFERS[i]) {
|
|
1266
|
+
case "textNode":
|
|
1267
|
+
this.closeText();
|
|
1268
|
+
break;
|
|
1269
|
+
case "cdata":
|
|
1270
|
+
this.emitNode("oncdata", this.cdata);
|
|
1271
|
+
this.cdata = "";
|
|
1272
|
+
break;
|
|
1273
|
+
case "script":
|
|
1274
|
+
this.emitNode("onscript", this.script);
|
|
1275
|
+
this.script = "";
|
|
1276
|
+
break;
|
|
1277
|
+
default:
|
|
1278
|
+
this.errorFunction(`Max buffer length exceeded: ${this.BUFFERS[i]}`);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
maxActual = Math.max(maxActual, len);
|
|
1282
|
+
}
|
|
1283
|
+
const m = this.opt.MAX_BUFFER_LENGTH - maxActual;
|
|
1284
|
+
this.bufferCheckPosition = m + this.position;
|
|
1285
|
+
}
|
|
1286
|
+
openTag(selfClosing) {
|
|
1287
|
+
if (this.opt.xmlns) {
|
|
1288
|
+
const tag = this.tag;
|
|
1289
|
+
const qn = _SAX.qname(this.tagName);
|
|
1290
|
+
tag.prefix = qn.prefix;
|
|
1291
|
+
tag.local = qn.local;
|
|
1292
|
+
tag.uri = tag.ns[qn.prefix] || "";
|
|
1293
|
+
if (tag.prefix && !tag.uri) {
|
|
1294
|
+
this.strictFail(`Unbound namespace prefix: ${JSON.stringify(this.tagName)}`);
|
|
1295
|
+
tag.uri = qn.prefix;
|
|
1296
|
+
}
|
|
1297
|
+
const parent = this.tags[this.tags.length - 1] || this;
|
|
1298
|
+
if (tag.ns && parent.ns !== tag.ns) {
|
|
1299
|
+
const that = this;
|
|
1300
|
+
Object.keys(tag.ns).forEach((p) => {
|
|
1301
|
+
that.emitNode("onopennamespace", {
|
|
1302
|
+
prefix: p,
|
|
1303
|
+
uri: tag.ns[p]
|
|
1304
|
+
});
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
for (let i = 0, l = this.attribList.length; i < l; i++) {
|
|
1308
|
+
const nv = this.attribList[i];
|
|
1309
|
+
const name = nv[0];
|
|
1310
|
+
const value = nv[1];
|
|
1311
|
+
const qualName = _SAX.qname(name, true);
|
|
1312
|
+
const prefix = qualName.prefix;
|
|
1313
|
+
const local = qualName.local;
|
|
1314
|
+
const uri = prefix === "" ? "" : tag.ns[prefix] || "";
|
|
1315
|
+
const a = {
|
|
1316
|
+
name,
|
|
1317
|
+
value,
|
|
1318
|
+
prefix,
|
|
1319
|
+
local,
|
|
1320
|
+
uri
|
|
1321
|
+
};
|
|
1322
|
+
if (prefix && prefix !== "xmlns" && !uri) {
|
|
1323
|
+
this.strictFail(`Unbound namespace prefix: ${JSON.stringify(prefix)}`);
|
|
1324
|
+
a.uri = prefix;
|
|
1325
|
+
}
|
|
1326
|
+
this.tag.attributes[name] = a;
|
|
1327
|
+
this.emitNode("onattribute", a);
|
|
1328
|
+
}
|
|
1329
|
+
this.attribList.length = 0;
|
|
1330
|
+
}
|
|
1331
|
+
this.tag.isSelfClosing = Boolean(selfClosing);
|
|
1332
|
+
this.sawRoot = true;
|
|
1333
|
+
this.tags.push(this.tag);
|
|
1334
|
+
this.emitNode("onopentag", this.tag);
|
|
1335
|
+
if (!selfClosing) {
|
|
1336
|
+
if (!this.noscript && this.tagName.toLowerCase() === "script") {
|
|
1337
|
+
this.state = this.S.SCRIPT;
|
|
1338
|
+
} else {
|
|
1339
|
+
this.state = this.S.TEXT;
|
|
1340
|
+
}
|
|
1341
|
+
this.tag = null;
|
|
1342
|
+
this.tagName = "";
|
|
1343
|
+
}
|
|
1344
|
+
this.attribName = this.attribValue = "";
|
|
1345
|
+
this.attribList.length = 0;
|
|
1346
|
+
}
|
|
1347
|
+
closeTag() {
|
|
1348
|
+
if (!this.tagName) {
|
|
1349
|
+
this.strictFail("Weird empty close tag.");
|
|
1350
|
+
this.textNode += "</>";
|
|
1351
|
+
this.state = this.S.TEXT;
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
if (this.script) {
|
|
1355
|
+
if (this.tagName !== "script") {
|
|
1356
|
+
this.script += `</${this.tagName}>`;
|
|
1357
|
+
this.tagName = "";
|
|
1358
|
+
this.state = this.S.SCRIPT;
|
|
1359
|
+
return;
|
|
1360
|
+
}
|
|
1361
|
+
this.emitNode("onscript", this.script);
|
|
1362
|
+
this.script = "";
|
|
1363
|
+
}
|
|
1364
|
+
let t = this.tags.length;
|
|
1365
|
+
let tagName = this.tagName;
|
|
1366
|
+
if (!this.strict) {
|
|
1367
|
+
tagName = tagName[this.looseCase]();
|
|
1368
|
+
}
|
|
1369
|
+
while (t--) {
|
|
1370
|
+
const close = this.tags[t];
|
|
1371
|
+
if (close.name !== tagName) {
|
|
1372
|
+
this.strictFail("Unexpected close tag");
|
|
1373
|
+
} else {
|
|
1374
|
+
break;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
if (t < 0) {
|
|
1378
|
+
this.strictFail(`Unmatched closing tag: ${this.tagName}`);
|
|
1379
|
+
this.textNode += `</${this.tagName}>`;
|
|
1380
|
+
this.state = this.S.TEXT;
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
this.tagName = tagName;
|
|
1384
|
+
let s = this.tags.length;
|
|
1385
|
+
while (s-- > t) {
|
|
1386
|
+
const tag = this.tags.pop();
|
|
1387
|
+
this.tag = tag;
|
|
1388
|
+
this.tagName = this.tag.name;
|
|
1389
|
+
this.emitNode("onclosetag", this.tagName);
|
|
1390
|
+
const x = {};
|
|
1391
|
+
for (const i in tag.ns) {
|
|
1392
|
+
if (tag.ns.hasOwnProperty(i)) {
|
|
1393
|
+
x[i] = tag.ns[i];
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
const parent = this.tags[this.tags.length - 1] || this;
|
|
1397
|
+
if (this.opt.xmlns && tag.ns !== parent.ns) {
|
|
1398
|
+
const that = this;
|
|
1399
|
+
Object.keys(tag.ns).forEach((p) => {
|
|
1400
|
+
const n = tag.ns[p];
|
|
1401
|
+
that.emitNode("onclosenamespace", { prefix: p, uri: n });
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
if (t === 0) this.closedRoot = true;
|
|
1406
|
+
this.tagName = this.attribValue = this.attribName = "";
|
|
1407
|
+
this.attribList.length = 0;
|
|
1408
|
+
this.state = this.S.TEXT;
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
SAXParser = class extends SAX {
|
|
1412
|
+
static ENTITIES = ENTITIES;
|
|
1413
|
+
opt = DEFAULT_SAX_PARSER_OPTIONS;
|
|
1414
|
+
events = DEFAULT_SAX_EVENTS;
|
|
1415
|
+
constructor(opt) {
|
|
1416
|
+
super();
|
|
1417
|
+
this.clearBuffers();
|
|
1418
|
+
this.opt = opt = { ...this.opt, ...opt };
|
|
1419
|
+
this.events = { ...this.events, ...opt };
|
|
1420
|
+
this.q = this.c = "";
|
|
1421
|
+
this.opt.lowercase = this.opt.lowercase || this.opt.lowercasetags;
|
|
1422
|
+
this.bufferCheckPosition = this.opt.MAX_BUFFER_LENGTH;
|
|
1423
|
+
this.looseCase = this.opt.lowercase ? "toLowerCase" : "toUpperCase";
|
|
1424
|
+
this.tags = [];
|
|
1425
|
+
this.closed = this.closedRoot = this.sawRoot = false;
|
|
1426
|
+
this.tag = this.error = null;
|
|
1427
|
+
this.strict = Boolean(this.opt.strict);
|
|
1428
|
+
this.noscript = Boolean(this.opt.strict || this.opt.noscript);
|
|
1429
|
+
this.state = this.S.BEGIN;
|
|
1430
|
+
this.strictEntities = this.opt.strictEntities;
|
|
1431
|
+
this.ENTITIES = this.strictEntities ? Object.create(this.XML_ENTITIES) : Object.create(this.ENTITIES);
|
|
1432
|
+
this.attribList = [];
|
|
1433
|
+
if (this.opt.xmlns) {
|
|
1434
|
+
this.ns = Object.create(this.rootNS);
|
|
1435
|
+
}
|
|
1436
|
+
this.trackPosition = this.opt.position !== false;
|
|
1437
|
+
if (this.trackPosition) {
|
|
1438
|
+
this.position = this.line = this.column = 0;
|
|
1439
|
+
}
|
|
1440
|
+
this.emit("onready");
|
|
1441
|
+
}
|
|
1442
|
+
resume() {
|
|
1443
|
+
this.error = null;
|
|
1444
|
+
return this;
|
|
1445
|
+
}
|
|
1446
|
+
close() {
|
|
1447
|
+
return this.write(null);
|
|
1448
|
+
}
|
|
1449
|
+
flush() {
|
|
1450
|
+
this.flushBuffers();
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
|
|
1456
|
+
// ../xml/src/lib/parsers/parse-xml-internal.ts
|
|
1457
|
+
function parseXMLInternal(text3, options = {}) {
|
|
1458
|
+
const state = new InternalXMLParserState(options);
|
|
1459
|
+
const parser = new SAXParser({
|
|
1460
|
+
strict: true,
|
|
1461
|
+
onopentag: (tag) => state.openElement(tag.name, tag.attributes || {}),
|
|
1462
|
+
ontext: (nodeText) => state.addText(nodeText),
|
|
1463
|
+
oncdata: (cdataText) => state.addText(cdataText),
|
|
1464
|
+
onclosetag: () => state.closeElement(),
|
|
1465
|
+
onerror: (error) => {
|
|
1466
|
+
throw error;
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
parser.write(text3).close();
|
|
1470
|
+
return state.result;
|
|
1471
|
+
}
|
|
1472
|
+
var InternalXMLParserState;
|
|
1473
|
+
var init_parse_xml_internal = __esm({
|
|
1474
|
+
"../xml/src/lib/parsers/parse-xml-internal.ts"() {
|
|
1475
|
+
"use strict";
|
|
1476
|
+
init_sax();
|
|
1477
|
+
InternalXMLParserState = class {
|
|
1478
|
+
/** XML parse options. */
|
|
1479
|
+
options;
|
|
1480
|
+
/** Open element stack. */
|
|
1481
|
+
stack = [];
|
|
1482
|
+
/** Final root result. */
|
|
1483
|
+
result;
|
|
1484
|
+
/** Create parser state from XML parse options. */
|
|
1485
|
+
constructor(options) {
|
|
1486
|
+
this.options = options;
|
|
1487
|
+
}
|
|
1488
|
+
/** Start a new element. */
|
|
1489
|
+
openElement(name, attributes) {
|
|
1490
|
+
const elementName = this.normalizeName(name);
|
|
1491
|
+
const parent = this.stack[this.stack.length - 1];
|
|
1492
|
+
const path = parent ? `${parent.path}.${elementName}` : elementName;
|
|
1493
|
+
this.stack.push({
|
|
1494
|
+
name: elementName,
|
|
1495
|
+
path,
|
|
1496
|
+
attributes: this.normalizeAttributes(attributes),
|
|
1497
|
+
children: {},
|
|
1498
|
+
text: ""
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
/** Add text or CDATA content to the current element. */
|
|
1502
|
+
addText(text3) {
|
|
1503
|
+
const currentElement = this.stack[this.stack.length - 1];
|
|
1504
|
+
const trimmedText = text3.trim();
|
|
1505
|
+
if (currentElement && trimmedText) {
|
|
1506
|
+
currentElement.text += trimmedText;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
/** Finalize the current element and append it to its parent. */
|
|
1510
|
+
closeElement() {
|
|
1511
|
+
const node = this.stack.pop();
|
|
1512
|
+
if (!node) {
|
|
1513
|
+
return;
|
|
1514
|
+
}
|
|
1515
|
+
const value = this.finalizeElement(node);
|
|
1516
|
+
const parent = this.stack[this.stack.length - 1];
|
|
1517
|
+
if (parent) {
|
|
1518
|
+
this.addChild(parent, node.name, node.path, value);
|
|
1519
|
+
} else {
|
|
1520
|
+
this.result = { [node.name]: value };
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
/** Convert an open element node into its public value. */
|
|
1524
|
+
finalizeElement(node) {
|
|
1525
|
+
const hasAttributes = Object.keys(node.attributes).length > 0;
|
|
1526
|
+
const hasChildren = Object.keys(node.children).length > 0;
|
|
1527
|
+
const hasText = node.text.length > 0;
|
|
1528
|
+
if (!hasAttributes && !hasChildren) {
|
|
1529
|
+
return hasText ? this.parseValue(node.text) : "";
|
|
1530
|
+
}
|
|
1531
|
+
const object = { ...node.children };
|
|
1532
|
+
if (hasText) {
|
|
1533
|
+
object[this.options.textNodeName || "value"] = this.parseValue(node.text);
|
|
1534
|
+
}
|
|
1535
|
+
Object.assign(object, node.attributes);
|
|
1536
|
+
return object;
|
|
1537
|
+
}
|
|
1538
|
+
/** Append a child element value, promoting repeated names to arrays. */
|
|
1539
|
+
addChild(parent, name, path, value) {
|
|
1540
|
+
var _a;
|
|
1541
|
+
const existingValue = parent.children[name];
|
|
1542
|
+
const shouldBeArray = Boolean((_a = this.options.arrayPaths) == null ? void 0 : _a.some((arrayPath) => arrayPath === path));
|
|
1543
|
+
if (existingValue === void 0) {
|
|
1544
|
+
parent.children[name] = shouldBeArray ? [value] : value;
|
|
1545
|
+
} else if (Array.isArray(existingValue)) {
|
|
1546
|
+
existingValue.push(value);
|
|
1547
|
+
} else {
|
|
1548
|
+
parent.children[name] = [existingValue, value];
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
/** Normalize all attributes for an element. */
|
|
1552
|
+
normalizeAttributes(attributes) {
|
|
1553
|
+
const normalizedAttributes = {};
|
|
1554
|
+
for (const [name, value] of Object.entries(attributes)) {
|
|
1555
|
+
if (this.options.removeNSPrefix && name.startsWith("xmlns")) {
|
|
1556
|
+
continue;
|
|
1557
|
+
}
|
|
1558
|
+
normalizedAttributes[this.normalizeName(name)] = this.parseAttributeValue(value);
|
|
1559
|
+
}
|
|
1560
|
+
return normalizedAttributes;
|
|
1561
|
+
}
|
|
1562
|
+
/** Normalize XML tag or attribute names according to namespace options. */
|
|
1563
|
+
normalizeName(name) {
|
|
1564
|
+
if (!this.options.removeNSPrefix) {
|
|
1565
|
+
return name;
|
|
1566
|
+
}
|
|
1567
|
+
const separatorIndex = name.indexOf(":");
|
|
1568
|
+
return separatorIndex === -1 ? name : name.slice(separatorIndex + 1);
|
|
1569
|
+
}
|
|
1570
|
+
/** Parse attribute values only when the fast-xml-parser compatibility option requests it. */
|
|
1571
|
+
parseAttributeValue(value) {
|
|
1572
|
+
var _a;
|
|
1573
|
+
return ((_a = this.options._fastXML) == null ? void 0 : _a.parseAttributeValue) ? this.parseValue(value) : value;
|
|
1574
|
+
}
|
|
1575
|
+
/** Parse text node values unless the fast-xml-parser compatibility option disables it. */
|
|
1576
|
+
parseValue(value) {
|
|
1577
|
+
var _a;
|
|
1578
|
+
if (((_a = this.options._fastXML) == null ? void 0 : _a.parseTagValue) === false) {
|
|
1579
|
+
return value;
|
|
1580
|
+
}
|
|
1581
|
+
if (/^(?:true|false)$/i.test(value)) {
|
|
1582
|
+
return value.toLowerCase() === "true";
|
|
1583
|
+
}
|
|
1584
|
+
if (value !== "" && Number.isFinite(Number(value))) {
|
|
1585
|
+
return Number(value);
|
|
1586
|
+
}
|
|
1587
|
+
return value;
|
|
1588
|
+
}
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
|
|
1593
|
+
// ../xml/src/lib/parsers/parse-xml.ts
|
|
1594
|
+
function parseXMLSync(text3, options) {
|
|
1595
|
+
const xml3 = (options == null ? void 0 : options._parser) === "internal" || (options == null ? void 0 : options._parser) === "sax" ? parseXMLInternal(text3, options) : parseXMLSyncFast(text3, options);
|
|
1596
|
+
return (options == null ? void 0 : options.uncapitalizeKeys) ? uncapitalizeKeys(xml3) : xml3;
|
|
1597
|
+
}
|
|
1598
|
+
function parseXMLSyncFast(text3, options) {
|
|
1599
|
+
const fastXMLOptions = {
|
|
1600
|
+
// Default FastXML options
|
|
1601
|
+
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#allowbooleanattributes
|
|
1602
|
+
allowBooleanAttributes: true,
|
|
1603
|
+
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#ignoredeclaration
|
|
1604
|
+
ignoreDeclaration: true,
|
|
1605
|
+
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#removensprefix
|
|
1606
|
+
removeNSPrefix: options == null ? void 0 : options.removeNSPrefix,
|
|
1607
|
+
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#textnodename
|
|
1608
|
+
textNodeName: options == null ? void 0 : options.textNodeName,
|
|
1609
|
+
// Let's application specify keys that are always arrays
|
|
1610
|
+
isArray: (name, jpath, isLeafNode, isAttribute) => {
|
|
1611
|
+
var _a;
|
|
1612
|
+
const array = Boolean((_a = options == null ? void 0 : options.arrayPaths) == null ? void 0 : _a.some((path) => jpath.toString() === path));
|
|
1613
|
+
return array;
|
|
1614
|
+
},
|
|
1615
|
+
// Application overrides
|
|
1616
|
+
...options == null ? void 0 : options._fastXML
|
|
1617
|
+
};
|
|
1618
|
+
return fastParseXML(text3, fastXMLOptions);
|
|
1619
|
+
}
|
|
1620
|
+
function fastParseXML(text3, options) {
|
|
1621
|
+
const parser = new import_fast_xml_parser.XMLParser({
|
|
1622
|
+
ignoreAttributes: false,
|
|
1623
|
+
attributeNamePrefix: "",
|
|
1624
|
+
...options
|
|
1625
|
+
});
|
|
1626
|
+
const parsedXML = parser.parse(text3);
|
|
1627
|
+
return parsedXML;
|
|
1628
|
+
}
|
|
1629
|
+
var import_fast_xml_parser;
|
|
1630
|
+
var init_parse_xml = __esm({
|
|
1631
|
+
"../xml/src/lib/parsers/parse-xml.ts"() {
|
|
1632
|
+
"use strict";
|
|
1633
|
+
init_uncapitalize();
|
|
1634
|
+
init_parse_xml_internal();
|
|
1635
|
+
import_fast_xml_parser = require("fast-xml-parser");
|
|
1636
|
+
}
|
|
1637
|
+
});
|
|
1638
|
+
|
|
1639
|
+
// ../xml/src/xml-loader-with-parser.ts
|
|
1640
|
+
var xml_loader_with_parser_exports = {};
|
|
1641
|
+
__export(xml_loader_with_parser_exports, {
|
|
1642
|
+
XMLLoaderWithParser: () => XMLLoaderWithParser
|
|
1643
|
+
});
|
|
1644
|
+
var _XMLLoaderPreload, XMLLoaderMetadataWithoutPreload, XMLLoaderWithParser;
|
|
1645
|
+
var init_xml_loader_with_parser = __esm({
|
|
1646
|
+
"../xml/src/xml-loader-with-parser.ts"() {
|
|
1647
|
+
"use strict";
|
|
1648
|
+
init_parse_xml();
|
|
1649
|
+
init_xml_loader();
|
|
1650
|
+
({ preload: _XMLLoaderPreload, ...XMLLoaderMetadataWithoutPreload } = XMLLoader);
|
|
1651
|
+
XMLLoaderWithParser = {
|
|
1652
|
+
...XMLLoaderMetadataWithoutPreload,
|
|
1653
|
+
parse: async (arrayBuffer, options) => parseXMLSync(new TextDecoder().decode(arrayBuffer), {
|
|
1654
|
+
...XMLLoaderWithParser.options.xml,
|
|
1655
|
+
...options == null ? void 0 : options.xml
|
|
1656
|
+
}),
|
|
1657
|
+
parseTextSync: (text3, options) => parseXMLSync(text3, { ...XMLLoaderWithParser.options.xml, ...options == null ? void 0 : options.xml })
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
});
|
|
1661
|
+
|
|
1662
|
+
// ../xml/src/xml-loader.ts
|
|
1663
|
+
async function preload() {
|
|
1664
|
+
const { XMLLoaderWithParser: XMLLoaderWithParser2 } = await Promise.resolve().then(() => (init_xml_loader_with_parser(), xml_loader_with_parser_exports));
|
|
1665
|
+
return XMLLoaderWithParser2;
|
|
1666
|
+
}
|
|
1667
|
+
function testXMLFile(text3) {
|
|
1668
|
+
return text3.startsWith("<?xml");
|
|
1669
|
+
}
|
|
1670
|
+
var VERSION, XMLLoader;
|
|
1671
|
+
var init_xml_loader = __esm({
|
|
1672
|
+
"../xml/src/xml-loader.ts"() {
|
|
1673
|
+
"use strict";
|
|
1674
|
+
init_xml_format();
|
|
1675
|
+
VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
1676
|
+
XMLLoader = {
|
|
1677
|
+
dataType: null,
|
|
1678
|
+
batchType: null,
|
|
1679
|
+
...XMLFormat,
|
|
1680
|
+
version: VERSION,
|
|
1681
|
+
worker: false,
|
|
1682
|
+
testText: testXMLFile,
|
|
1683
|
+
options: {
|
|
1684
|
+
xml: {
|
|
1685
|
+
_parser: "fast-xml-parser",
|
|
1686
|
+
uncapitalizeKeys: false,
|
|
1687
|
+
removeNSPrefix: false,
|
|
1688
|
+
textNodeName: "value",
|
|
1689
|
+
arrayPaths: []
|
|
1690
|
+
}
|
|
1691
|
+
},
|
|
1692
|
+
preload
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
});
|
|
1696
|
+
|
|
1697
|
+
// ../xml/src/index.ts
|
|
1698
|
+
var init_src = __esm({
|
|
1699
|
+
"../xml/src/index.ts"() {
|
|
1700
|
+
"use strict";
|
|
1701
|
+
init_xml_loader();
|
|
1702
|
+
init_parse_xml();
|
|
1703
|
+
}
|
|
1704
|
+
});
|
|
1705
|
+
|
|
1706
|
+
// src/wms/lib/parsers/xml/parse-xml-text.ts
|
|
1707
|
+
function parseXMLTextSync2(text3, options) {
|
|
1708
|
+
return parseXMLSync(text3, { ...XMLLoader.options.xml, ...options == null ? void 0 : options.xml });
|
|
1709
|
+
}
|
|
1710
|
+
var init_parse_xml_text = __esm({
|
|
1711
|
+
"src/wms/lib/parsers/xml/parse-xml-text.ts"() {
|
|
1712
|
+
"use strict";
|
|
1713
|
+
init_src();
|
|
1714
|
+
}
|
|
1715
|
+
});
|
|
1716
|
+
|
|
1717
|
+
// src/wms/lib/parsers/wmts/parse-wmts-capabilities.ts
|
|
1718
|
+
function parseWMTSCapabilities2(text3, options) {
|
|
1719
|
+
var _a;
|
|
1720
|
+
const parsedXML = parseXMLTextSync2(text3, {
|
|
1721
|
+
xml: {
|
|
1722
|
+
...(options == null ? void 0 : options.xml) || {},
|
|
1723
|
+
_parser: "internal",
|
|
1724
|
+
textNodeName: "#text",
|
|
1725
|
+
_fastXML: { ...((_a = options == null ? void 0 : options.xml) == null ? void 0 : _a._fastXML) || {}, parseTagValue: false },
|
|
1726
|
+
removeNSPrefix: true,
|
|
1727
|
+
uncapitalizeKeys: true
|
|
1728
|
+
}
|
|
1729
|
+
});
|
|
1730
|
+
const capabilities = parsedXML.capabilities || parsedXML.Capabilities || parsedXML;
|
|
1731
|
+
const contents = capabilities.contents || {};
|
|
1732
|
+
const layers = asArray2(contents.layer).map(normalizeLayer2).filter((layer) => layer.identifier);
|
|
1733
|
+
const tileMatrixSets = asArray2(contents.tileMatrixSet).map(normalizeTileMatrixSet2).filter((tileMatrixSet) => tileMatrixSet.identifier);
|
|
1734
|
+
return {
|
|
1735
|
+
serviceIdentification: normalizeServiceIdentification2(capabilities.serviceIdentification),
|
|
1736
|
+
operationsMetadata: capabilities.operationsMetadata,
|
|
1737
|
+
featureInfoUrl: getFeatureInfoUrl2(capabilities.operationsMetadata),
|
|
1738
|
+
contents: { layers, tileMatrixSets }
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
function getFeatureInfoUrl2(operationsMetadata) {
|
|
1742
|
+
var _a, _b;
|
|
1743
|
+
if (!operationsMetadata) return void 0;
|
|
1744
|
+
const operation = asArray2(operationsMetadata == null ? void 0 : operationsMetadata.operation).find(
|
|
1745
|
+
(candidate) => candidate.name === "GetFeatureInfo"
|
|
1746
|
+
);
|
|
1747
|
+
for (const protocol of asArray2(operation == null ? void 0 : operation.dCP)) {
|
|
1748
|
+
for (const endpoint of asArray2((_a = protocol.hTTP) == null ? void 0 : _a.get)) {
|
|
1749
|
+
const encoding = [
|
|
1750
|
+
...asArray2(endpoint.constraint),
|
|
1751
|
+
...asArray2(operation.constraint),
|
|
1752
|
+
...asArray2(operationsMetadata.constraint)
|
|
1753
|
+
].find((candidate) => candidate.name === "GetEncoding");
|
|
1754
|
+
if (!encoding || encoding.anyValue !== void 0 || asArray2((_b = encoding.allowedValues) == null ? void 0 : _b.value).some((value) => text2(value) === "KVP")) {
|
|
1755
|
+
if (endpoint.href) return endpoint.href;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
return null;
|
|
1760
|
+
}
|
|
1761
|
+
function normalizeLayer2(layer) {
|
|
1762
|
+
var _a, _b;
|
|
1763
|
+
const resourceURLs = asArray2(layer.resourceURL || layer.resourceUrls).map((resourceURL) => ({
|
|
1764
|
+
template: resourceURL.template,
|
|
1765
|
+
format: resourceURL.format,
|
|
1766
|
+
resourceType: resourceURL.resourceType
|
|
1767
|
+
}));
|
|
1768
|
+
const lowerCorner = parseNumbers2((_a = layer.wGS84BoundingBox || layer.wgs84BoundingBox) == null ? void 0 : _a.lowerCorner);
|
|
1769
|
+
const upperCorner = parseNumbers2((_b = layer.wGS84BoundingBox || layer.wgs84BoundingBox) == null ? void 0 : _b.upperCorner);
|
|
1770
|
+
return {
|
|
1771
|
+
identifier: text2(layer.identifier),
|
|
1772
|
+
title: text2(layer.title),
|
|
1773
|
+
abstract: text2(layer.abstract),
|
|
1774
|
+
formats: asArray2(layer.format).map(text2).filter(Boolean),
|
|
1775
|
+
infoFormats: asArray2(layer.infoFormat).map(text2).filter(Boolean),
|
|
1776
|
+
styles: asArray2(layer.style).map((style) => ({
|
|
1777
|
+
identifier: text2(style.identifier),
|
|
1778
|
+
title: text2(style.title),
|
|
1779
|
+
isDefault: style.isDefault === true || style.isDefault === "true"
|
|
1780
|
+
})),
|
|
1781
|
+
tileMatrixSetLinks: asArray2(layer.tileMatrixSetLink).map(normalizeTileMatrixSetLink2),
|
|
1782
|
+
dimensions: asArray2(layer.dimension).map(normalizeDimension2),
|
|
1783
|
+
resourceURLs: resourceURLs.filter((resourceURL) => resourceURL.template),
|
|
1784
|
+
bounds: lowerCorner.length >= 2 && upperCorner.length >= 2 ? [lowerCorner[0], lowerCorner[1], upperCorner[0], upperCorner[1]] : void 0
|
|
1785
|
+
};
|
|
1786
|
+
}
|
|
1787
|
+
function normalizeTileMatrixSetLink2(link) {
|
|
1788
|
+
var _a;
|
|
1789
|
+
const limits = link.tileMatrixSetLimits === void 0 ? void 0 : asArray2((_a = link.tileMatrixSetLimits) == null ? void 0 : _a.tileMatrixLimits).map((limit) => ({
|
|
1790
|
+
tileMatrix: text2(limit.tileMatrix),
|
|
1791
|
+
minimumTileRow: number2(limit.minTileRow),
|
|
1792
|
+
maximumTileRow: number2(limit.maxTileRow),
|
|
1793
|
+
minimumTileColumn: number2(limit.minTileCol),
|
|
1794
|
+
maximumTileColumn: number2(limit.maxTileCol)
|
|
1795
|
+
}));
|
|
1796
|
+
if (limits) validateTileMatrixLimits2(limits);
|
|
1797
|
+
return { tileMatrixSet: text2(link.tileMatrixSet), limits };
|
|
1798
|
+
}
|
|
1799
|
+
function validateTileMatrixLimits2(limits) {
|
|
1800
|
+
const identifiers = /* @__PURE__ */ new Set();
|
|
1801
|
+
for (const limit of limits) {
|
|
1802
|
+
if (!limit.tileMatrix || identifiers.has(limit.tileMatrix))
|
|
1803
|
+
throw new Error("WMTS tile matrix limits require unique matrix identifiers");
|
|
1804
|
+
identifiers.add(limit.tileMatrix);
|
|
1805
|
+
for (const value of [
|
|
1806
|
+
limit.minimumTileRow,
|
|
1807
|
+
limit.maximumTileRow,
|
|
1808
|
+
limit.minimumTileColumn,
|
|
1809
|
+
limit.maximumTileColumn
|
|
1810
|
+
]) {
|
|
1811
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
1812
|
+
throw new Error("WMTS tile matrix limits require nonnegative safe integers");
|
|
1813
|
+
}
|
|
1814
|
+
if (limit.minimumTileRow > limit.maximumTileRow || limit.minimumTileColumn > limit.maximumTileColumn)
|
|
1815
|
+
throw new Error("WMTS tile matrix limits have reversed bounds");
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
function normalizeDimension2(dimension) {
|
|
1819
|
+
return {
|
|
1820
|
+
identifier: text2(dimension.identifier),
|
|
1821
|
+
title: text2(dimension.title) || void 0,
|
|
1822
|
+
abstract: text2(dimension.abstract) || void 0,
|
|
1823
|
+
unitsOfMeasure: text2(dimension.uOM || dimension.uom) || void 0,
|
|
1824
|
+
unitSymbol: text2(dimension.unitSymbol) || void 0,
|
|
1825
|
+
default: dimension.default === void 0 ? void 0 : text2(dimension.default),
|
|
1826
|
+
current: dimension.current === void 0 ? void 0 : ["true", "1"].includes(text2(dimension.current)),
|
|
1827
|
+
values: asArray2(dimension.value).map(text2)
|
|
1828
|
+
};
|
|
1829
|
+
}
|
|
1830
|
+
function normalizeTileMatrixSet2(tileMatrixSet) {
|
|
1831
|
+
return {
|
|
1832
|
+
identifier: text2(tileMatrixSet.identifier),
|
|
1833
|
+
supportedCRS: text2(tileMatrixSet.supportedCRS),
|
|
1834
|
+
matrices: asArray2(tileMatrixSet.tileMatrix).map((matrix) => ({
|
|
1835
|
+
identifier: text2(matrix.identifier),
|
|
1836
|
+
scaleDenominator: number2(matrix.scaleDenominator),
|
|
1837
|
+
topLeftCorner: parseNumbers2(matrix.topLeftCorner),
|
|
1838
|
+
tileWidth: number2(matrix.tileWidth),
|
|
1839
|
+
tileHeight: number2(matrix.tileHeight),
|
|
1840
|
+
matrixWidth: number2(matrix.matrixWidth),
|
|
1841
|
+
matrixHeight: number2(matrix.matrixHeight)
|
|
1842
|
+
}))
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
function normalizeServiceIdentification2(serviceIdentification) {
|
|
1846
|
+
if (!serviceIdentification) return void 0;
|
|
1847
|
+
return {
|
|
1848
|
+
title: text2(serviceIdentification.title),
|
|
1849
|
+
abstract: text2(serviceIdentification.abstract),
|
|
1850
|
+
serviceTypeVersion: text2(serviceIdentification.serviceTypeVersion)
|
|
1851
|
+
};
|
|
1852
|
+
}
|
|
1853
|
+
function asArray2(value) {
|
|
1854
|
+
return value === void 0 || value === null ? [] : Array.isArray(value) ? value : [value];
|
|
1855
|
+
}
|
|
1856
|
+
function text2(value) {
|
|
1857
|
+
return value === void 0 || value === null ? "" : typeof value === "object" ? value["#text"] || "" : String(value);
|
|
1858
|
+
}
|
|
1859
|
+
function number2(value) {
|
|
1860
|
+
if (!text2(value).trim()) return void 0;
|
|
1861
|
+
const parsedValue = Number(text2(value));
|
|
1862
|
+
return Number.isFinite(parsedValue) ? parsedValue : void 0;
|
|
1863
|
+
}
|
|
1864
|
+
function parseNumbers2(value) {
|
|
1865
|
+
return text2(value).trim() ? text2(value).trim().split(/\s+/).map(Number).filter(Number.isFinite) : [];
|
|
1866
|
+
}
|
|
1867
|
+
var init_parse_wmts_capabilities = __esm({
|
|
1868
|
+
"src/wms/lib/parsers/wmts/parse-wmts-capabilities.ts"() {
|
|
1869
|
+
"use strict";
|
|
1870
|
+
init_parse_xml_text();
|
|
1871
|
+
}
|
|
1872
|
+
});
|
|
1873
|
+
|
|
1874
|
+
// src/wms/wms-format.ts
|
|
1875
|
+
var xml2, GMLFormat2, WMSCapabilitiesFormat2, WFSCapabilitiesFormat2, WMSErrorFormat2, CSWCapabilitiesFormat2, CSWDomainFormat2, CSWRecordsFormat2, WCSCapabilitiesFormat2, WMTSCapabilitiesFormat2, WMSFeatureInfoFormat2, WMSLayerDescriptionFormat2;
|
|
1876
|
+
var init_wms_format = __esm({
|
|
1877
|
+
"src/wms/wms-format.ts"() {
|
|
1878
|
+
"use strict";
|
|
1879
|
+
xml2 = (name, id, format) => ({
|
|
1880
|
+
name,
|
|
1881
|
+
id,
|
|
1882
|
+
module: "ogc",
|
|
1883
|
+
encoding: "xml",
|
|
1884
|
+
format,
|
|
1885
|
+
extensions: ["xml"],
|
|
1886
|
+
mimeTypes: ["application/xml", "text/xml"],
|
|
1887
|
+
text: true
|
|
1888
|
+
});
|
|
1889
|
+
GMLFormat2 = xml2("GML", "gml", "gml");
|
|
1890
|
+
WMSCapabilitiesFormat2 = xml2(
|
|
1891
|
+
"WMS Capabilities",
|
|
1892
|
+
"wms-capabilities",
|
|
1893
|
+
"wms-capabilities"
|
|
1894
|
+
);
|
|
1895
|
+
WFSCapabilitiesFormat2 = xml2(
|
|
1896
|
+
"WFS Capabilities",
|
|
1897
|
+
"wfs-capabilities",
|
|
1898
|
+
"wfs-capabilities"
|
|
1899
|
+
);
|
|
1900
|
+
WMSErrorFormat2 = xml2("WMS Error", "wms-error", "wms-error");
|
|
1901
|
+
CSWCapabilitiesFormat2 = xml2(
|
|
1902
|
+
"CSW Capabilities",
|
|
1903
|
+
"csw-capabilities",
|
|
1904
|
+
"csw-capabilities"
|
|
1905
|
+
);
|
|
1906
|
+
CSWDomainFormat2 = xml2("CSW Domain", "csw-domain", "csw-domain");
|
|
1907
|
+
CSWRecordsFormat2 = xml2("CSW Records", "csw-records", "csw-records");
|
|
1908
|
+
WCSCapabilitiesFormat2 = xml2(
|
|
1909
|
+
"WCS Capabilities",
|
|
1910
|
+
"wcs-capabilities",
|
|
1911
|
+
"wcs-capabilities"
|
|
1912
|
+
);
|
|
1913
|
+
WMTSCapabilitiesFormat2 = xml2(
|
|
1914
|
+
"WMTS Capabilities",
|
|
1915
|
+
"wmts-capabilities",
|
|
1916
|
+
"wmts-capabilities"
|
|
1917
|
+
);
|
|
1918
|
+
WMSFeatureInfoFormat2 = xml2("WMS Feature Info", "wms-feature-info", "wms-feature-info");
|
|
1919
|
+
WMSLayerDescriptionFormat2 = xml2(
|
|
1920
|
+
"WMS Layer Description",
|
|
1921
|
+
"wms-layer-description",
|
|
1922
|
+
"wms-layer-description"
|
|
1923
|
+
);
|
|
1924
|
+
}
|
|
1925
|
+
});
|
|
1926
|
+
|
|
1927
|
+
// src/wms/wmts-capabilities-loader.ts
|
|
1928
|
+
var WMTSCapabilitiesLoader;
|
|
1929
|
+
var init_wmts_capabilities_loader = __esm({
|
|
1930
|
+
"src/wms/wmts-capabilities-loader.ts"() {
|
|
1931
|
+
"use strict";
|
|
1932
|
+
init_wms_format();
|
|
1933
|
+
WMTSCapabilitiesLoader = {
|
|
1934
|
+
...WMTSCapabilitiesFormat2,
|
|
1935
|
+
dataType: null,
|
|
1936
|
+
batchType: null,
|
|
1937
|
+
name: "WMTS Capabilities",
|
|
1938
|
+
id: "wmts-capabilities",
|
|
1939
|
+
module: "ogc",
|
|
1940
|
+
version: "0.0.0",
|
|
1941
|
+
worker: false,
|
|
1942
|
+
encoding: "xml",
|
|
1943
|
+
format: "wmts-capabilities",
|
|
1944
|
+
text: true,
|
|
1945
|
+
extensions: ["xml"],
|
|
1946
|
+
mimeTypes: ["application/vnd.ogc.wmts_xml", "application/xml", "text/xml"],
|
|
1947
|
+
options: { wmts: {} },
|
|
1948
|
+
preload: async () => (await Promise.resolve().then(() => (init_wmts_capabilities_loader_with_parser(), wmts_capabilities_loader_with_parser_exports))).WMTSCapabilitiesLoaderWithParser
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
});
|
|
1952
|
+
|
|
1953
|
+
// src/wms/wmts-capabilities-loader-with-parser.ts
|
|
1954
|
+
var wmts_capabilities_loader_with_parser_exports = {};
|
|
1955
|
+
__export(wmts_capabilities_loader_with_parser_exports, {
|
|
1956
|
+
WMTSCapabilitiesLoaderWithParser: () => WMTSCapabilitiesLoaderWithParser
|
|
1957
|
+
});
|
|
1958
|
+
var _preload, metadata, WMTSCapabilitiesLoaderWithParser;
|
|
1959
|
+
var init_wmts_capabilities_loader_with_parser = __esm({
|
|
1960
|
+
"src/wms/wmts-capabilities-loader-with-parser.ts"() {
|
|
1961
|
+
"use strict";
|
|
1962
|
+
init_parse_wmts_capabilities();
|
|
1963
|
+
init_wmts_capabilities_loader();
|
|
1964
|
+
({ preload: _preload, ...metadata } = WMTSCapabilitiesLoader);
|
|
1965
|
+
WMTSCapabilitiesLoaderWithParser = {
|
|
1966
|
+
...metadata,
|
|
1967
|
+
parse: async (arrayBuffer, options) => parseWMTSCapabilities2(new TextDecoder().decode(arrayBuffer), options),
|
|
1968
|
+
parseTextSync: (text3, options) => parseWMTSCapabilities2(text3, options)
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
});
|
|
1972
|
+
|
|
1973
|
+
// dist/wms/wmts-capabilities-loader-with-parser.js
|
|
1974
|
+
var wmts_capabilities_loader_with_parser_exports2 = {};
|
|
1975
|
+
__export(wmts_capabilities_loader_with_parser_exports2, {
|
|
1976
|
+
WMTSCapabilitiesLoaderWithParser: () => WMTSCapabilitiesLoaderWithParser2
|
|
1977
|
+
});
|
|
1978
|
+
module.exports = __toCommonJS(wmts_capabilities_loader_with_parser_exports2);
|
|
1979
|
+
|
|
1980
|
+
// dist/wms/lib/parsers/xml/parse-xml-text.js
|
|
1981
|
+
init_src();
|
|
1982
|
+
function parseXMLTextSync(text3, options) {
|
|
1983
|
+
return parseXMLSync(text3, { ...XMLLoader.options.xml, ...options == null ? void 0 : options.xml });
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
// dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js
|
|
1987
|
+
function parseWMTSCapabilities(text3, options) {
|
|
1988
|
+
var _a;
|
|
1989
|
+
const parsedXML = parseXMLTextSync(text3, {
|
|
1990
|
+
xml: {
|
|
1991
|
+
...(options == null ? void 0 : options.xml) || {},
|
|
1992
|
+
_parser: "internal",
|
|
1993
|
+
textNodeName: "#text",
|
|
1994
|
+
_fastXML: { ...((_a = options == null ? void 0 : options.xml) == null ? void 0 : _a._fastXML) || {}, parseTagValue: false },
|
|
1995
|
+
removeNSPrefix: true,
|
|
1996
|
+
uncapitalizeKeys: true
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
const capabilities = parsedXML.capabilities || parsedXML.Capabilities || parsedXML;
|
|
2000
|
+
const contents = capabilities.contents || {};
|
|
2001
|
+
const layers = asArray(contents.layer).map(normalizeLayer).filter((layer) => layer.identifier);
|
|
2002
|
+
const tileMatrixSets = asArray(contents.tileMatrixSet).map(normalizeTileMatrixSet).filter((tileMatrixSet) => tileMatrixSet.identifier);
|
|
2003
|
+
return {
|
|
2004
|
+
serviceIdentification: normalizeServiceIdentification(capabilities.serviceIdentification),
|
|
2005
|
+
operationsMetadata: capabilities.operationsMetadata,
|
|
2006
|
+
featureInfoUrl: getFeatureInfoUrl(capabilities.operationsMetadata),
|
|
2007
|
+
contents: { layers, tileMatrixSets }
|
|
2008
|
+
};
|
|
2009
|
+
}
|
|
2010
|
+
function getFeatureInfoUrl(operationsMetadata) {
|
|
2011
|
+
var _a, _b;
|
|
2012
|
+
if (!operationsMetadata)
|
|
2013
|
+
return void 0;
|
|
2014
|
+
const operation = asArray(operationsMetadata == null ? void 0 : operationsMetadata.operation).find((candidate) => candidate.name === "GetFeatureInfo");
|
|
2015
|
+
for (const protocol of asArray(operation == null ? void 0 : operation.dCP)) {
|
|
2016
|
+
for (const endpoint of asArray((_a = protocol.hTTP) == null ? void 0 : _a.get)) {
|
|
2017
|
+
const encoding = [
|
|
2018
|
+
...asArray(endpoint.constraint),
|
|
2019
|
+
...asArray(operation.constraint),
|
|
2020
|
+
...asArray(operationsMetadata.constraint)
|
|
2021
|
+
].find((candidate) => candidate.name === "GetEncoding");
|
|
2022
|
+
if (!encoding || encoding.anyValue !== void 0 || asArray((_b = encoding.allowedValues) == null ? void 0 : _b.value).some((value) => text(value) === "KVP")) {
|
|
2023
|
+
if (endpoint.href)
|
|
2024
|
+
return endpoint.href;
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
return null;
|
|
2029
|
+
}
|
|
2030
|
+
function normalizeLayer(layer) {
|
|
2031
|
+
var _a, _b;
|
|
2032
|
+
const resourceURLs = asArray(layer.resourceURL || layer.resourceUrls).map((resourceURL) => ({
|
|
2033
|
+
template: resourceURL.template,
|
|
2034
|
+
format: resourceURL.format,
|
|
2035
|
+
resourceType: resourceURL.resourceType
|
|
2036
|
+
}));
|
|
2037
|
+
const lowerCorner = parseNumbers((_a = layer.wGS84BoundingBox || layer.wgs84BoundingBox) == null ? void 0 : _a.lowerCorner);
|
|
2038
|
+
const upperCorner = parseNumbers((_b = layer.wGS84BoundingBox || layer.wgs84BoundingBox) == null ? void 0 : _b.upperCorner);
|
|
2039
|
+
return {
|
|
2040
|
+
identifier: text(layer.identifier),
|
|
2041
|
+
title: text(layer.title),
|
|
2042
|
+
abstract: text(layer.abstract),
|
|
2043
|
+
formats: asArray(layer.format).map(text).filter(Boolean),
|
|
2044
|
+
infoFormats: asArray(layer.infoFormat).map(text).filter(Boolean),
|
|
2045
|
+
styles: asArray(layer.style).map((style) => ({
|
|
2046
|
+
identifier: text(style.identifier),
|
|
2047
|
+
title: text(style.title),
|
|
2048
|
+
isDefault: style.isDefault === true || style.isDefault === "true"
|
|
2049
|
+
})),
|
|
2050
|
+
tileMatrixSetLinks: asArray(layer.tileMatrixSetLink).map(normalizeTileMatrixSetLink),
|
|
2051
|
+
dimensions: asArray(layer.dimension).map(normalizeDimension),
|
|
2052
|
+
resourceURLs: resourceURLs.filter((resourceURL) => resourceURL.template),
|
|
2053
|
+
bounds: lowerCorner.length >= 2 && upperCorner.length >= 2 ? [lowerCorner[0], lowerCorner[1], upperCorner[0], upperCorner[1]] : void 0
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
function normalizeTileMatrixSetLink(link) {
|
|
2057
|
+
var _a;
|
|
2058
|
+
const limits = link.tileMatrixSetLimits === void 0 ? void 0 : asArray((_a = link.tileMatrixSetLimits) == null ? void 0 : _a.tileMatrixLimits).map((limit) => ({
|
|
2059
|
+
tileMatrix: text(limit.tileMatrix),
|
|
2060
|
+
minimumTileRow: number(limit.minTileRow),
|
|
2061
|
+
maximumTileRow: number(limit.maxTileRow),
|
|
2062
|
+
minimumTileColumn: number(limit.minTileCol),
|
|
2063
|
+
maximumTileColumn: number(limit.maxTileCol)
|
|
2064
|
+
}));
|
|
2065
|
+
if (limits)
|
|
2066
|
+
validateTileMatrixLimits(limits);
|
|
2067
|
+
return { tileMatrixSet: text(link.tileMatrixSet), limits };
|
|
2068
|
+
}
|
|
2069
|
+
function validateTileMatrixLimits(limits) {
|
|
2070
|
+
const identifiers = /* @__PURE__ */ new Set();
|
|
2071
|
+
for (const limit of limits) {
|
|
2072
|
+
if (!limit.tileMatrix || identifiers.has(limit.tileMatrix))
|
|
2073
|
+
throw new Error("WMTS tile matrix limits require unique matrix identifiers");
|
|
2074
|
+
identifiers.add(limit.tileMatrix);
|
|
2075
|
+
for (const value of [
|
|
2076
|
+
limit.minimumTileRow,
|
|
2077
|
+
limit.maximumTileRow,
|
|
2078
|
+
limit.minimumTileColumn,
|
|
2079
|
+
limit.maximumTileColumn
|
|
2080
|
+
]) {
|
|
2081
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
2082
|
+
throw new Error("WMTS tile matrix limits require nonnegative safe integers");
|
|
2083
|
+
}
|
|
2084
|
+
if (limit.minimumTileRow > limit.maximumTileRow || limit.minimumTileColumn > limit.maximumTileColumn)
|
|
2085
|
+
throw new Error("WMTS tile matrix limits have reversed bounds");
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
function normalizeDimension(dimension) {
|
|
2089
|
+
return {
|
|
2090
|
+
identifier: text(dimension.identifier),
|
|
2091
|
+
title: text(dimension.title) || void 0,
|
|
2092
|
+
abstract: text(dimension.abstract) || void 0,
|
|
2093
|
+
unitsOfMeasure: text(dimension.uOM || dimension.uom) || void 0,
|
|
2094
|
+
unitSymbol: text(dimension.unitSymbol) || void 0,
|
|
2095
|
+
default: dimension.default === void 0 ? void 0 : text(dimension.default),
|
|
2096
|
+
current: dimension.current === void 0 ? void 0 : ["true", "1"].includes(text(dimension.current)),
|
|
2097
|
+
values: asArray(dimension.value).map(text)
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
function normalizeTileMatrixSet(tileMatrixSet) {
|
|
2101
|
+
return {
|
|
2102
|
+
identifier: text(tileMatrixSet.identifier),
|
|
2103
|
+
supportedCRS: text(tileMatrixSet.supportedCRS),
|
|
2104
|
+
matrices: asArray(tileMatrixSet.tileMatrix).map((matrix) => ({
|
|
2105
|
+
identifier: text(matrix.identifier),
|
|
2106
|
+
scaleDenominator: number(matrix.scaleDenominator),
|
|
2107
|
+
topLeftCorner: parseNumbers(matrix.topLeftCorner),
|
|
2108
|
+
tileWidth: number(matrix.tileWidth),
|
|
2109
|
+
tileHeight: number(matrix.tileHeight),
|
|
2110
|
+
matrixWidth: number(matrix.matrixWidth),
|
|
2111
|
+
matrixHeight: number(matrix.matrixHeight)
|
|
2112
|
+
}))
|
|
2113
|
+
};
|
|
2114
|
+
}
|
|
2115
|
+
function normalizeServiceIdentification(serviceIdentification) {
|
|
2116
|
+
if (!serviceIdentification)
|
|
2117
|
+
return void 0;
|
|
2118
|
+
return {
|
|
2119
|
+
title: text(serviceIdentification.title),
|
|
2120
|
+
abstract: text(serviceIdentification.abstract),
|
|
2121
|
+
serviceTypeVersion: text(serviceIdentification.serviceTypeVersion)
|
|
2122
|
+
};
|
|
2123
|
+
}
|
|
2124
|
+
function asArray(value) {
|
|
2125
|
+
return value === void 0 || value === null ? [] : Array.isArray(value) ? value : [value];
|
|
2126
|
+
}
|
|
2127
|
+
function text(value) {
|
|
2128
|
+
return value === void 0 || value === null ? "" : typeof value === "object" ? value["#text"] || "" : String(value);
|
|
2129
|
+
}
|
|
2130
|
+
function number(value) {
|
|
2131
|
+
if (!text(value).trim())
|
|
2132
|
+
return void 0;
|
|
2133
|
+
const parsedValue = Number(text(value));
|
|
2134
|
+
return Number.isFinite(parsedValue) ? parsedValue : void 0;
|
|
2135
|
+
}
|
|
2136
|
+
function parseNumbers(value) {
|
|
2137
|
+
return text(value).trim() ? text(value).trim().split(/\s+/).map(Number).filter(Number.isFinite) : [];
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
// dist/wms/wms-format.js
|
|
2141
|
+
var xml = (name, id, format) => ({
|
|
2142
|
+
name,
|
|
2143
|
+
id,
|
|
2144
|
+
module: "ogc",
|
|
2145
|
+
encoding: "xml",
|
|
2146
|
+
format,
|
|
2147
|
+
extensions: ["xml"],
|
|
2148
|
+
mimeTypes: ["application/xml", "text/xml"],
|
|
2149
|
+
text: true
|
|
2150
|
+
});
|
|
2151
|
+
var GMLFormat = xml("GML", "gml", "gml");
|
|
2152
|
+
var WMSCapabilitiesFormat = xml("WMS Capabilities", "wms-capabilities", "wms-capabilities");
|
|
2153
|
+
var WFSCapabilitiesFormat = xml("WFS Capabilities", "wfs-capabilities", "wfs-capabilities");
|
|
2154
|
+
var WMSErrorFormat = xml("WMS Error", "wms-error", "wms-error");
|
|
2155
|
+
var CSWCapabilitiesFormat = xml("CSW Capabilities", "csw-capabilities", "csw-capabilities");
|
|
2156
|
+
var CSWDomainFormat = xml("CSW Domain", "csw-domain", "csw-domain");
|
|
2157
|
+
var CSWRecordsFormat = xml("CSW Records", "csw-records", "csw-records");
|
|
2158
|
+
var WCSCapabilitiesFormat = xml("WCS Capabilities", "wcs-capabilities", "wcs-capabilities");
|
|
2159
|
+
var WMTSCapabilitiesFormat = xml("WMTS Capabilities", "wmts-capabilities", "wmts-capabilities");
|
|
2160
|
+
var WMSFeatureInfoFormat = xml("WMS Feature Info", "wms-feature-info", "wms-feature-info");
|
|
2161
|
+
var WMSLayerDescriptionFormat = xml("WMS Layer Description", "wms-layer-description", "wms-layer-description");
|
|
2162
|
+
|
|
2163
|
+
// dist/wms/wmts-capabilities-loader.js
|
|
2164
|
+
var WMTSCapabilitiesLoader2 = {
|
|
2165
|
+
...WMTSCapabilitiesFormat,
|
|
2166
|
+
dataType: null,
|
|
2167
|
+
batchType: null,
|
|
2168
|
+
name: "WMTS Capabilities",
|
|
2169
|
+
id: "wmts-capabilities",
|
|
2170
|
+
module: "ogc",
|
|
2171
|
+
version: "0.0.0",
|
|
2172
|
+
worker: false,
|
|
2173
|
+
encoding: "xml",
|
|
2174
|
+
format: "wmts-capabilities",
|
|
2175
|
+
text: true,
|
|
2176
|
+
extensions: ["xml"],
|
|
2177
|
+
mimeTypes: ["application/vnd.ogc.wmts_xml", "application/xml", "text/xml"],
|
|
2178
|
+
options: { wmts: {} },
|
|
2179
|
+
preload: async () => (await Promise.resolve().then(() => (init_wmts_capabilities_loader_with_parser(), wmts_capabilities_loader_with_parser_exports))).WMTSCapabilitiesLoaderWithParser
|
|
2180
|
+
};
|
|
2181
|
+
|
|
2182
|
+
// dist/wms/wmts-capabilities-loader-with-parser.js
|
|
2183
|
+
var { preload: _preload2, ...metadata2 } = WMTSCapabilitiesLoader2;
|
|
2184
|
+
var WMTSCapabilitiesLoaderWithParser2 = {
|
|
2185
|
+
...metadata2,
|
|
2186
|
+
parse: async (arrayBuffer, options) => parseWMTSCapabilities(new TextDecoder().decode(arrayBuffer), options),
|
|
2187
|
+
parseTextSync: (text3, options) => parseWMTSCapabilities(text3, options)
|
|
2188
|
+
};
|
|
2189
|
+
//# sourceMappingURL=wmts-capabilities-loader-with-parser.cjs.map
|