diff --git a/demo/mapboxgl/App.vue b/demo/mapboxgl/App.vue index 8bf3ba4e..eb8ae7b1 100644 --- a/demo/mapboxgl/App.vue +++ b/demo/mapboxgl/App.vue @@ -9,27 +9,16 @@ 基础组件
- 深色主题 + +
@@ -254,7 +255,31 @@ import data from './data/data.js'; var host = 'http://support.supermap.com.cn:8090'; export default Vue.extend({ name: 'App', - mixins: [data] // demo data + mixins: [data], // demo data + data() { + return { + layerNamesInput: '', + inputLayers: [], + webMapSelection: [ + { label: 'raster(png) 图层', value: '617580084'}, + { label: 'raster(webp) 图层', value: '1175084848'}, + { label: 'vector(mvt) 图层', value: '1911445594'}, + { label: 'symbol 图层', value: '769608713'}, + { label: '标记图层', value: '1243732508'}, + { label: '天地图(经纬度)', value: '553036596'}, + { label: '单值专题图-点线', value: '1942263014'}, + { label: '单值专题图-面', value: '1414045798'}, + { label: '分段专题图', value: '1951546125'}, + { label: '热力图', value: '1338195847'}, + { label: 'wmts 图层', value: '1953858999'}, + { label: 'wms 图层', value: '649033069'}, + { label: '3D 拉伸图层', value: '1481406908'}, + { label: '空地图', value: '17311606'}, + { label: '相同source多layer', value: '1703080254'}, + ], + mapIdSelected: '617580084' + } + } }); diff --git a/demo/mapboxgl/data/data.js b/demo/mapboxgl/data/data.js index e0d15cf2..89f083ba 100644 --- a/demo/mapboxgl/data/data.js +++ b/demo/mapboxgl/data/data.js @@ -565,12 +565,25 @@ export default { title: '直辖市', children: [ { - title: '上海', + title: 'vector3.0', mapInfo: { - serverUrl: 'https://www.supermapol.com/', - mapId: 394538195, + serverUrl: 'http://localhost:8190/iportal', + mapId: 1243732508, + layerFilter: function(layer) { + if (layer.id === '未命名数据') { + return true; + } + return false; + } + } + }, + { + title: 'raster3.0', + mapInfo: { + serverUrl: 'http://localhost:8190/iportal', + mapId: 649033069, layerFilter: function(layer) { - if (layer.name === '上海_县级行政区划图@公众数据') { + if (layer.id === 'China_wms130') { return true; } return false; diff --git a/src/common/_lang/en.js b/src/common/_lang/en.js index d761672d..ac7a8249 100644 --- a/src/common/_lang/en.js +++ b/src/common/_lang/en.js @@ -135,7 +135,17 @@ export default { title: 'Legend', top: 'Highest', bottom: 'Lowest', - noMatchLayer: 'No matching layer' + noMatchLayer: 'No matching layer', + themeDefault: 'Default', + outOfRange: 'Out of range', + style: 'Style', + color: 'Color', + size: 'Size', + opacity: 'Opacity', + width: 'Width', + outlineColor: 'Outline Color', + parentheses: '({tips})', + colon: ':' }, measure: { mapMeasure: 'Measure', diff --git a/src/common/_lang/zh.js b/src/common/_lang/zh.js index 46ffd177..979ab8d5 100644 --- a/src/common/_lang/zh.js +++ b/src/common/_lang/zh.js @@ -60,8 +60,7 @@ export default { DMS: '度分秒', Mercator: 'Web墨卡托' }, - error: { - }, + error: {}, commontypes: { restData: 'SuperMap Rest 数据服务', restMap: 'SuperMap Rest 地图服务', @@ -140,7 +139,17 @@ export default { title: '图例', top: '最高', bottom: '最低', - noMatchLayer: '没有匹配的图层' + noMatchLayer: '没有匹配的图层', + themeDefault: '缺省风格', + outOfRange: '范围以外的值', + style: '样式', + color: '颜色', + size: '大小', + opacity: '不透明度', + width: '宽度', + outlineColor: '轮廓色', + parentheses: '({tips})', + colon: ':' }, measure: { mapMeasure: '量算', diff --git a/src/common/_mixin/VmUpdater.ts b/src/common/_mixin/VmUpdater.ts index 3fbe0a8e..f86ea25a 100644 --- a/src/common/_mixin/VmUpdater.ts +++ b/src/common/_mixin/VmUpdater.ts @@ -36,7 +36,7 @@ export default class VmUpdater extends Vue { } let setFun = 'set' + item.replace(item[0], item[0].toUpperCase()); // 子组件的viewModel - this.viewModel && this.viewModel[setFun](newVal); + this.viewModel && this.viewModel[setFun]?.(newVal); } }, { deep: true } diff --git a/src/common/_utils/__tests__/WebMapBase.spec.js b/src/common/_utils/__tests__/WebMapBase.spec.js index f99bf2ad..c32b233b 100644 --- a/src/common/_utils/__tests__/WebMapBase.spec.js +++ b/src/common/_utils/__tests__/WebMapBase.spec.js @@ -142,7 +142,7 @@ describe('WebMapBase.spec', () => { it('initWebMap', () => { const newWebMapBaseObj = cloneDeep(WebMapBaseObj); - newWebMapBaseObj.cleanWebMap = jest.fn(); + newWebMapBaseObj.clean = jest.fn(); newWebMapBaseObj._getMapInfo = jest.fn(); newWebMapBaseObj.initWebMap(); expect(newWebMapBaseObj.serverUrl).toBe('123/'); diff --git a/src/common/_utils/iPortalDataService.js b/src/common/_utils/iPortalDataService.js index 11a824bd..4a8310e1 100644 --- a/src/common/_utils/iPortalDataService.js +++ b/src/common/_utils/iPortalDataService.js @@ -20,6 +20,8 @@ export default class iPortalDataService extends Events { this.url = url; this.withCredentials = withCredentials || false; this.epsgCode = options.epsgCode; + this.dataType = options.dataType; + this.dataId = options.dataId; this.iportalServiceProxyUrl = options.iportalServiceProxyUrl; this.eventTypes = ['getdatasucceeded', 'getdatafailed', 'featureisempty']; this.resourceId = options.resourceId; @@ -67,11 +69,17 @@ export default class iPortalDataService extends Events { * @param {Object} [queryInfo.attributeFilter] - 属性过滤条件。 * @param {Object} [queryInfo.keyWord] - 筛选关键字。 */ - getData(queryInfo, preferContent = false) { + getData(queryInfo = {}, preferContent = false) { + if (this.dataType === 'STRUCTUREDDATA') { + this._getStructureDatafromContent(); + return; + } + if (!this.url) { return; } let datasetUrl = this.url; + if (preferContent) { this._getDatafromContent(datasetUrl, queryInfo); return; @@ -120,6 +128,71 @@ export default class iPortalDataService extends Events { }); } + _getStructureDatafromContent() { + let featureResults = []; + let dataId = this.dataId; + let url = '/iportal/web/datas/{dataId}/structureddata/ogc-features/collections/all/items.json'; + url = url.replace('{dataId}', dataId); + let maxFeatures = 5000; + let allRequest = []; + this._getStructureData(url, maxFeatures, 0).then((data) => { + if (data) { + featureResults = data.features; + if (data.numberMatched < maxFeatures) { + this.iserverService._getFeaturesSucceed({ result: { + features: { + type: 'FeatureCollection', + features: featureResults + } + }}); + return; + } + + for (let i = maxFeatures; i < data.numberMatched;) { + allRequest.push( + this._getStructureData(url, maxFeatures, i) + ); + i += maxFeatures; + } + // 所有请求结束 + Promise.all(allRequest).then((results) =>{ + // 结果合并 + results.map((result) =>{ + featureResults = featureResults.concat(result.features); + }); + this.iserverService._getFeaturesSucceed({ result: { + features: { + type: 'FeatureCollection', + features: featureResults + } + }}); + }) + } + }); + } + + _getStructureData(url, count, offset) { + url = `${url}?limit=${count}`; + if (offset) { + url = url + '&offset=' + offset; + } + return SuperMap.FetchRequest.get(url, null, { + withCredentials: this.withCredentials + }) + .then(response => { + return response.json(); + }) + .then(data => { + return data + }) + .catch(error => { + console.log(error); + this.triggerEvent('getdatafailed', { + error + }); + }); + } + _getDatafromRest(serviceType, address, queryInfo) { if (serviceType === 'RESTDATA') { let url = SuperMap.Util.urlPathAppend(address, 'data/datasources'); diff --git a/src/common/web-map/WebMapBase.ts b/src/common/web-map/WebMapBase.ts index ea765dd6..a4e1ef76 100644 --- a/src/common/web-map/WebMapBase.ts +++ b/src/common/web-map/WebMapBase.ts @@ -114,7 +114,7 @@ export default abstract class WebMapBase extends Events { abstract _addLayerSucceeded(); abstract _unproject(point: [number, number]): [number, number]; - abstract cleanWebMap(); + abstract clean(); public echartsLayerResize(): void { this.echartslayer.forEach(echartslayer => { @@ -184,7 +184,7 @@ export default abstract class WebMapBase extends Events { } protected initWebMap() { - this.cleanWebMap(); + this.clean(); this.serverUrl = this.serverUrl && this.webMapService.handleServerUrl(this.serverUrl); if (this.webMapInfo) { // 传入是webmap对象 diff --git a/src/leaflet/web-map/WebMapViewModel.ts b/src/leaflet/web-map/WebMapViewModel.ts index 2bffaa45..d07dd799 100644 --- a/src/leaflet/web-map/WebMapViewModel.ts +++ b/src/leaflet/web-map/WebMapViewModel.ts @@ -1085,7 +1085,7 @@ export default class WebMapViewModel extends WebMapBase { }); } - public cleanWebMap() { + public clean() { if (this.map) { this.map.remove(); this.stopCanvg(); @@ -1095,4 +1095,8 @@ export default class WebMapViewModel extends WebMapBase { this._unprojectCrs = null; } } + + public cleanWebMap() { + this.clean(); + } } diff --git a/src/leaflet/web-map/__tests__/WebMap.spec.js b/src/leaflet/web-map/__tests__/WebMap.spec.js index f149d537..7b5efaab 100644 --- a/src/leaflet/web-map/__tests__/WebMap.spec.js +++ b/src/leaflet/web-map/__tests__/WebMap.spec.js @@ -3,7 +3,6 @@ import SmWebMap from '../WebMap.vue'; import { message } from 'ant-design-vue'; import L from '../../leaflet-wrapper'; import mockFetch from 'vue-iclient/test/unit/mocks/FetchRequest'; -import mapWrapperLoaded from 'vue-iclient/test/unit/mapWrapperLoaded.js'; import iportal_serviceProxy from '../../../../test/unit/mocks/data/iportal_serviceProxy.json'; import flushPromises from 'flush-promises'; import uniqueLayer_point from 'vue-iclient/test/unit/mocks/data/WebMap/uniqueLayer_point'; diff --git a/src/leaflet/web-map/__tests__/WebMapViewModel.spec.js b/src/leaflet/web-map/__tests__/WebMapViewModel.spec.js index 8853cf07..90b026d4 100644 --- a/src/leaflet/web-map/__tests__/WebMapViewModel.spec.js +++ b/src/leaflet/web-map/__tests__/WebMapViewModel.spec.js @@ -756,7 +756,7 @@ describe('WebMapViewModel.spec', () => { }, 100); }); - it('cleanWebMap', async done => { + it('clean', async done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/datas/676516522/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': layerData }; @@ -784,7 +784,7 @@ describe('WebMapViewModel.spec', () => { const viewModel = new WebMapViewModel(id, commonOption); viewModel.on({ addlayerssucceeded: callback }); await flushPromises(); - viewModel.cleanWebMap(); + viewModel.clean(); setTimeout(() => { expect(callback.mock.called).toBeTruthy; expect(viewModel.center).toBe(null); diff --git a/src/mapboxgl/_types/map-event.js b/src/mapboxgl/_types/map-event.js index f45a49b3..ca5674f4 100644 --- a/src/mapboxgl/_types/map-event.js +++ b/src/mapboxgl/_types/map-event.js @@ -40,14 +40,12 @@ export default new Vue({ map }); const sourceList = sourceListModel.getSourceList(); - for (let key in sourceList) { - if (key) { - let layers = sourceList[key].layers || []; - layers.forEach(item => { - if (item.source && item.type !== 'raster') { - sources.push(item.source); - } - }); + for (let item of sourceList) { + if (item) { + let layer = item.layer; + if (layer.source && layer.type !== 'raster') { + sources.push(layer.source); + } } } } diff --git a/src/mapboxgl/attributes/__tests__/Attributes.spec.js b/src/mapboxgl/attributes/__tests__/Attributes.spec.js index 79ad042b..cae63f71 100644 --- a/src/mapboxgl/attributes/__tests__/Attributes.spec.js +++ b/src/mapboxgl/attributes/__tests__/Attributes.spec.js @@ -1,10 +1,11 @@ import { mount, config } from '@vue/test-utils'; import SmAttributes from '../Attributes.vue'; -import SmWebMap from '.././../web-map/WebMap.vue'; -import mapLoaded from 'vue-iclient/test/unit/mapLoaded.js'; +import createEmptyMap from 'vue-iclient/test/unit/createEmptyMap'; +import mapSubComponentLoaded from 'vue-iclient/test/unit/mapSubComponentLoaded'; describe('Attributes.vue', () => { let wrapper; + let mapWrapper; const fieldConfigs = [ { value: '平均最低气温_Num', visible: false }, { value: 'SmID', visible: false }, @@ -230,25 +231,6 @@ describe('Attributes.vue', () => { } }; - const mapInfo = { - extent: { - leftBottom: { x: 0, y: 0 }, - rightTop: { x: 0, y: 0 } - }, - level: 5, - center: { x: 0, y: 0 }, - baseLayer: { - layerType: 'TILE', - name: 'China', - url: 'http://test' - }, - layers: [], - description: '', - projection: 'EPSG:3857', - title: 'testMap', - version: '1.0' - }; - beforeAll(() => { wrapper = null; config.mapLoad = false; @@ -256,6 +238,7 @@ describe('Attributes.vue', () => { beforeEach(() => { wrapper = null; + mapWrapper = null; }); afterEach(() => { @@ -264,6 +247,9 @@ describe('Attributes.vue', () => { if (wrapper) { wrapper.destroy(); } + if (mapWrapper) { + mapWrapper.destroy(); + } }); afterAll(() => { @@ -271,34 +257,14 @@ describe('Attributes.vue', () => { }); it('render default correctly', async done => { - wrapper = mount( - { - template: ` -
- -
- -
-
`, - components: { - SmAttributes, - SmWebMap - }, - data() { - return { - fieldConfigs: fieldConfigs, - mapInfo: mapInfo - }; - } - }, - { - sync: false + mapWrapper = await createEmptyMap(); + wrapper = mount(SmAttributes, { + propsData: { + layerName: "UNIQUE-民航数-0", + fieldConfigs: fieldConfigs } - ); - const callback = jest.fn(); - wrapper.vm.$children[1].$on('loaded', callback); - await mapLoaded(wrapper.vm.$children[0]); - expect(callback.mock.called).toBeTruthy; + }); + await mapSubComponentLoaded(wrapper); expect(wrapper.find('.sm-component-attributes').exists()).toBe(true); const attributes = wrapper.findAll('.sm-component-attributes'); attributes.setProps({ @@ -329,39 +295,24 @@ describe('Attributes.vue', () => { }); it('associate map', async done => { - wrapper = mount({ - template: ` -
- -
- -
-
`, - components: { - SmAttributes, - SmWebMap - }, - data() { - return { - fieldConfigs: fieldConfigs, - mapInfo: mapInfo - }; + mapWrapper = await createEmptyMap(); + wrapper = mount(SmAttributes, { + propsData: { + layerName: "UNIQUE-民航数-0", + fieldConfigs: fieldConfigs } }); - const callback = jest.fn(); - wrapper.vm.$children[1].$on('loaded', callback); - await mapLoaded(wrapper.vm.$children[0]); - expect(callback.mock.called).toBeTruthy; + await mapSubComponentLoaded(wrapper); let e = { point: { x: 0, y: 1 } }; - wrapper.vm.$children[1].viewModel.map.fire('click', e); - const spy = jest.spyOn(wrapper.vm.$children[1].viewModel, 'zoomToFeatures'); + wrapper.vm.viewModel.map.fire('click', e); + const spy = jest.spyOn(wrapper.vm.viewModel, 'zoomToFeatures'); // TODO 具名插槽 overlay 的节点找不到? - wrapper.vm.$children[1].setZoomToFeature(); + wrapper.vm.setZoomToFeature(); await wrapper.vm.$nextTick(); expect(spy).toHaveBeenCalled(); done(); diff --git a/src/mapboxgl/chart/__tests__/Chart.spec.js b/src/mapboxgl/chart/__tests__/Chart.spec.js index 7947ca62..d76d2188 100644 --- a/src/mapboxgl/chart/__tests__/Chart.spec.js +++ b/src/mapboxgl/chart/__tests__/Chart.spec.js @@ -4,7 +4,6 @@ import SmChart from '../Chart.vue'; import mockFetch from 'vue-iclient/test/unit/mocks/FetchRequest'; import chart_restData from 'vue-iclient/test/unit/mocks/data/chart_restData'; import layerData from 'vue-iclient/test/unit/mocks/data/layerData'; -import mapSubComponentLoaded from 'vue-iclient/test/unit/mapSubComponentLoaded.js'; import flushPromises from 'flush-promises'; describe('Chart', () => { @@ -110,7 +109,6 @@ describe('Chart', () => { ] } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.find('div#smchart-1').exists()).toBe(true); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); @@ -235,7 +233,6 @@ describe('Chart', () => { } } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); done(); @@ -361,7 +358,6 @@ describe('Chart', () => { } } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); done(); @@ -482,7 +478,6 @@ describe('Chart', () => { } } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); done(); @@ -530,7 +525,6 @@ describe('Chart', () => { } } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); done(); @@ -723,7 +717,6 @@ describe('Chart', () => { colorGroup: ['#3fb1e3', '#6be6c1', '#626c91', '#a0a7e6', '#c4ebad'] } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); done(); @@ -852,7 +845,6 @@ describe('Chart', () => { } } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); done(); @@ -892,7 +884,6 @@ describe('Chart', () => { ] } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); expect(wrapper.vm.mapTarget).toBe('map'); @@ -947,7 +938,6 @@ describe('Chart', () => { } } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); await wrapper.setProps({ @@ -1057,7 +1047,6 @@ describe('Chart', () => { ] } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); expect(wrapper.vm.mapTarget).toBe('map'); @@ -1112,7 +1101,6 @@ describe('Chart', () => { ] } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); expect(wrapper.vm.mapTarget).toBe('map'); @@ -1157,7 +1145,6 @@ describe('Chart', () => { ] } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); done(); @@ -1210,7 +1197,6 @@ describe('Chart', () => { ] } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); expect(wrapper.vm.$el.outerHTML).toContain('canvas'); expect(wrapper.vm.mapTarget).toBe('map'); @@ -1279,7 +1265,6 @@ describe('Chart', () => { } } }); - await mapSubComponentLoaded(wrapper); await flushPromises(); wrapper.setProps({ mapTarget: 'map', @@ -1386,7 +1371,6 @@ describe('Chart', () => { } } }); - await mapSubComponentLoaded(wrapper); let data=["四川","江苏","云南","江西","海南","台湾","上海","广东","福建","北京"] wrapper.vm._initAxisLabel({}, data) await flushPromises(); diff --git a/src/mapboxgl/compare/__tests__/Compare.spec.js b/src/mapboxgl/compare/__tests__/Compare.spec.js index 10f84b88..d49ba5a1 100644 --- a/src/mapboxgl/compare/__tests__/Compare.spec.js +++ b/src/mapboxgl/compare/__tests__/Compare.spec.js @@ -2,7 +2,6 @@ import { mount, config } from '@vue/test-utils'; import SmWebMap from '../../web-map/WebMap.vue'; import SmCompare from '../Compare.vue'; import Compare from '../index'; -import mapLoaded from 'vue-iclient/test/unit/mapLoaded.js'; jest.mock('mapbox-gl-compare', () => require('@mocks/compare')); @@ -62,8 +61,7 @@ describe('Copmpare.vue', () => { }; } }); - await mapLoaded(wrapper.vm.$children[0].$children[0]); - await mapLoaded(wrapper.vm.$children[0].$children[1]); + await wrapper.vm.$nextTick(); expect(wrapper.find('div.sm-component-compare').exists()).toBe(true); expect(wrapper.find('div#comparison-container').exists()).toBe(true); expect(wrapper.find('#beforeMap').exists()).toBe(true); @@ -110,8 +108,7 @@ describe('Copmpare.vue', () => { } } ); - await mapLoaded(wrapper.vm.$children[0].$children[0]); - await mapLoaded(wrapper.vm.$children[0].$children[1]); + await wrapper.vm.$nextTick(); expect(wrapper.find('.sm-component-compare').attributes()).toHaveProperty('linesize', '5'); expect(wrapper.find('.sm-component-compare').attributes()).toHaveProperty('slidebackground', '#f00'); expect(wrapper.find('.sm-component-compare').attributes()).toHaveProperty('slidesize', '90'); diff --git a/src/mapboxgl/layer-select/LayerSelect.vue b/src/mapboxgl/layer-select/LayerSelect.vue index c1968c0c..91c9cb7b 100644 --- a/src/mapboxgl/layer-select/LayerSelect.vue +++ b/src/mapboxgl/layer-select/LayerSelect.vue @@ -95,15 +95,15 @@ class LayerSelect extends Mixins(MapGetter, Theme) { this.$emit('changedata', { id, type }); } - handleDatas(sourceList): treeSelectDataOption[] { + createLayersTreeData(layerCatalog) { const treeData: treeSelectDataOption[] = []; - this.sourceListDataCache = {}; - Object.keys(sourceList).forEach((sourceName, sIndex) => { - let { id, type, visibility } = sourceList[sourceName]; + layerCatalog.forEach(layer => { + let { id, title, type, visible } = layer; + let layerType = layer.layer?.type; let disabled = false; let selectable = true; if (this.filter) { - let res = this.filter(sourceList[sourceName], 'source', this.map) || {}; + let res = this.filter(layerType, type, this.map) || {}; disabled = res.disabled; selectable = res.selectable; @@ -111,104 +111,32 @@ class LayerSelect extends Mixins(MapGetter, Theme) { return; } } - const sourceValue = `${sourceName}+source`; + const layerValue = `${id}+${type}`; const sourceInfo: treeSelectDataOption = { - title: sourceName, - value: sourceValue, - key: `${sIndex}`, + title: title, + value: layerValue, + key: layer.id, disabled: !!disabled, selectable: selectable }; - this.sourceListDataCache[sourceValue] = { + if(type === 'group') { + sourceInfo.children = this.createLayersTreeData(layer.children); + } + this.sourceListDataCache[layerValue] = { id, - type, - visibility + type: layerType, + visibility: visible ? 'visible' : 'none' }; - if (sourceList[sourceName].sourceLayerList) { - const sourceChildren = []; - Object.keys(sourceList[sourceName].sourceLayerList).forEach((sourceLayerName, slIndex) => { - let disabled = false; - let selectable = true; - const sourceLayerOption = { - id: null, - source: id, - sourceLayer: sourceLayerName - }; - if (this.filter) { - let res = this.filter(sourceLayerOption, 'sourceLayer', this.map) || {}; - disabled = res.disabled; - selectable = res.selectable; - - if (typeof res.show === 'boolean' && res.show === false) { - return; - } - } - const sourceLayerValue = `${sourceLayerName}+sourceLayer`; - const sourceLayerInfo: treeSelectDataOption = { - title: sourceLayerName, - value: sourceLayerValue, - key: `${sIndex}-${slIndex}`, - disabled: !!disabled, - selectable - }; - - this.sourceListDataCache[sourceLayerValue] = sourceLayerOption; - let layers: layerOption[] = sourceList[sourceName].sourceLayerList[sourceLayerName]; - const sourceLayerChildren = this.handleLayers(layers, `${sIndex}-${slIndex}`); - if (sourceLayerChildren.length) { - sourceLayerInfo.children = sourceLayerChildren; - } - sourceChildren.push(sourceLayerInfo); - }); - if (sourceChildren.length) { - sourceInfo.children = sourceChildren; - } - } else { - let layers: layerOption[] = sourceList[sourceName].layers; - const layerChildren = this.handleLayers(layers, sIndex); - if (layerChildren.length) { - sourceInfo.children = layerChildren; - } - } treeData.push(sourceInfo); }); return treeData; } - handleLayers(layers: layerOption[], keyString: number | string): treeSelectDataOption[] { - const layerChildren = []; - layers.forEach((layerInfo, lIndex) => { - let { id, maxzoom, minzoom, source, sourceLayer, type, visibility } = layerInfo; - let disabled = false; - let selectable = true; - if (this.filter) { - let res = this.filter(layerInfo, 'layer', this.map) || {}; - disabled = res.disabled; - selectable = res.selectable; - - if (typeof res.show === 'boolean' && res.show === false) { - return; - } - } - const layerValue = `${layerInfo.id}+layer`; - layerChildren.push({ - title: layerInfo.id, - value: layerValue, - key: `${keyString}-${lIndex}`, - disabled: !!disabled, - selectable - }); - this.sourceListDataCache[layerValue] = { - id, - maxzoom, - minzoom, - source, - sourceLayer, - type, - visibility - }; - }); - return layerChildren; + handleDatas(sourceList): treeSelectDataOption[] { + let treeData: treeSelectDataOption[] = []; + this.sourceListDataCache = {}; + treeData = this.createLayersTreeData(sourceList); + return treeData; } getPopupContainer(triggerNode) { diff --git a/src/mapboxgl/layer-select/LayerSelectViewModel.ts b/src/mapboxgl/layer-select/LayerSelectViewModel.ts index 2a6519d7..72f55c2f 100644 --- a/src/mapboxgl/layer-select/LayerSelectViewModel.ts +++ b/src/mapboxgl/layer-select/LayerSelectViewModel.ts @@ -1,5 +1,4 @@ import mapboxgl from 'vue-iclient/static/libs/mapboxgl/mapbox-gl-enhance'; -import SourceListModel from 'vue-iclient/src/mapboxgl/web-map/SourceListModel'; /** * @class LayerSelectViewModel @@ -18,16 +17,14 @@ class LayerSelectViewModel extends mapboxgl.Evented { } _updateLayers() { - const sourceListModel = new SourceListModel({ - map: this.map - }); - const sourceList = sourceListModel.getSourceList(); + const sourceList = this.webmap.getLayerList(); this.fire('layersupdated', { sourceList }); } setMap(mapInfo: mapInfoType) { - const { map } = mapInfo; + const { map, webmap } = mapInfo; this.map = map; + this.webmap = webmap; this.map.on('styledata', this.updateFn); this._updateLayers(); } diff --git a/src/mapboxgl/web-map/GroupUtil.js b/src/mapboxgl/web-map/GroupUtil.js new file mode 100644 index 00000000..f1121c8a --- /dev/null +++ b/src/mapboxgl/web-map/GroupUtil.js @@ -0,0 +1,48 @@ +class GroupUtil { + getGroupVisible(catalogs, item) { + const rootGroup = this.getRootGroup(catalogs, item); + if (!rootGroup) return true; + + const { visible, children } = rootGroup; + if (!visible) return false; + + return this.getGroupVisible(children, item); + } + + getRootGroup(catalogs, item) { + const isRootItem = catalogs.find(c => (c.id === item.id)); + if (isRootItem) return; // 说明是顶层,不存在父图层组 + + // 图层组中的图层/图层组 + const groups = catalogs.filter(catalog => catalog.type === 'group'); + return groups.find((g) => this.isChild(g, item)); + } + + // 是否是当前图层组的 子图层/子图层组 + isChild(group, child) { + const { children } = group; + const target = children.find((c) => c.id === child.id); + if (target) return true; + + const childrenGroup = children.filter(catalog => catalog.type === 'group'); + return !!childrenGroup.find((c) => this.isChild(c, child)); + } + + getGroupChildrenLayers(layerGroup) { + const targetItems = []; + for (const item of layerGroup) { + // 图层组和图层都只选择可见的 + if (item.visible === false) continue; + + if (item.type !== 'group') { + targetItems.push(item); + continue; + } + // 图层组 + const group = item; + targetItems.push(...this.getGroupChildrenLayers(group.children)); + } + return targetItems; + } +} +export default GroupUtil; diff --git a/src/mapboxgl/web-map/LayerGroup.vue b/src/mapboxgl/web-map/LayerGroup.vue new file mode 100644 index 00000000..ecd7367f --- /dev/null +++ b/src/mapboxgl/web-map/LayerGroup.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/src/mapboxgl/web-map/LayerListModel.js b/src/mapboxgl/web-map/LayerListModel.js new file mode 100644 index 00000000..38f60ca7 --- /dev/null +++ b/src/mapboxgl/web-map/LayerListModel.js @@ -0,0 +1,38 @@ +import GroupUtil from 'vue-iclient/src/mapboxgl/web-map/GroupUtil'; +import LayerModel from 'vue-iclient/src/mapboxgl/web-map/LayerModel'; + +class LayerListModel extends GroupUtil { + constructor(options) { + super(); + this.map = options.map; + this.layerCatalog = options.layerCatalog; + } + + getLayerCatalog() { + if(!this.layerCatalog) return; + const baseLayer = this.map.getStyle().layers[0]; + const baseLayerCatalog = { + id: baseLayer.id, + title: baseLayer.id, + type: 'basic', + layer: baseLayer, + visible: true + }; + this.addInfoToCatalog(this.layerCatalog); + return [baseLayerCatalog].concat(this.layerCatalog); + } + + addInfoToCatalog(layerCatalog) { + layerCatalog.forEach(catalog => { + if(catalog.children) { + this.addInfoToCatalog(catalog.children); + } + // 获取layer + if(catalog.type === 'basic') { + const detailLayer = this.map.getLayer(catalog.id); + catalog.layer = new LayerModel(detailLayer); + } + }); + } +} +export default LayerListModel; diff --git a/src/mapboxgl/web-map/SourceListModel.js b/src/mapboxgl/web-map/SourceListModel.js index f12b1455..9cf841ee 100644 --- a/src/mapboxgl/web-map/SourceListModel.js +++ b/src/mapboxgl/web-map/SourceListModel.js @@ -1,14 +1,16 @@ import SourceModel from 'vue-iclient/src/mapboxgl/web-map/SourceModel'; import LayerModel from 'vue-iclient/src/mapboxgl/web-map/LayerModel'; +import GroupUtil from 'vue-iclient/src/mapboxgl/web-map/GroupUtil'; -class SourceListModel { +class SourceListModel extends GroupUtil { constructor(options) { + super(); this.map = options.map; this.style = this.map.getStyle(); this.layers = this.map.getStyle().layers; this.overlayLayers = this.map.overlayLayersManager; this.detailLayers = null; - this.sourceList = {}; + this.sourceList = []; this.sourceNames = []; this._initLayers(); this._initSource(); @@ -16,10 +18,10 @@ class SourceListModel { } getSourceList() { - let sourceList = {}; - for (let key in this.sourceList) { - if (key && this.excludeSource(key)) { - sourceList[key] = this.sourceList[key]; + let sourceList = []; + for (let item of this.sourceList) { + if (item && this.excludeSource(item.id)) { + sourceList.push(item); } } return sourceList; @@ -91,15 +93,16 @@ class SourceListModel { _initSource() { this.detailLayers && this.detailLayers.forEach(layer => { - if (!this.sourceList[layer.source]) { - const source = this.map.getSource(layer.source); - this.sourceList[layer.source] = new SourceModel({ - source: layer.source, - type: source && source.type + let matchItem = this.sourceList.find(item => item.id === layer.source); + if (!matchItem) { + const sourceListItem = new SourceModel({ + source: layer.source }); + this.sourceList.unshift(sourceListItem); this.sourceNames.push(layer.source); + matchItem = sourceListItem; } - this.sourceList[layer.source].addLayer(new LayerModel(layer), layer.sourceLayer); + matchItem.addLayer(new LayerModel(layer), layer.sourceLayer); }); } } diff --git a/src/mapboxgl/web-map/SourceModel.js b/src/mapboxgl/web-map/SourceModel.js index f89e912e..53e669be 100644 --- a/src/mapboxgl/web-map/SourceModel.js +++ b/src/mapboxgl/web-map/SourceModel.js @@ -1,25 +1,26 @@ class SourceModel { constructor(options) { this.id = options.source; - this.sourceLayerList = {}; - this.layers = []; + this.title = options.source; + this.children = []; + this.sourceType = options.sourceType; this.type = options.type; } - addLayer(layer, sourceLayer) { - if (sourceLayer) { - if (!this.sourceLayerList[sourceLayer]) { - this.sourceLayerList[sourceLayer] = []; - } - this.sourceLayerList[sourceLayer].push(layer); + addLayer(layer) { + this.children.push({ + id: layer.id, + title: layer.id, + visible: layer.visibility === 'visible', + type: 'basic', + layer: layer + }); + this.type = this.children.length > 1 ? 'group' : 'basic'; + this.layer = this.type === 'basic' ? layer : undefined; + if (layer.visibility === 'visible' || this.visible) { + this.visible = true; } else { - this.sourceLayerList = undefined; - } - this.layers.push(layer); - if ([layer.visibility, this.visibility].includes('visible')) { - this.visibility = 'visible'; - } else { - this.visibility = 'none'; + this.visible = false; } } } diff --git a/src/mapboxgl/web-map/WebMapV2.ts b/src/mapboxgl/web-map/WebMapV2.ts new file mode 100644 index 00000000..2201e94e --- /dev/null +++ b/src/mapboxgl/web-map/WebMapV2.ts @@ -0,0 +1,2900 @@ +/* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved. + * This program are made available under the terms of the Apache License, Version 2.0 + * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html. */ +import mapboxgl from 'vue-iclient/static/libs/mapboxgl/mapbox-gl-enhance'; +import SourceListModel from 'vue-iclient/src/mapboxgl/web-map/SourceListModel'; +import { handleMultyPolygon } from 'vue-iclient/src/mapboxgl/_utils/geometry-util'; +import 'vue-iclient/static/libs/iclient-mapboxgl/iclient-mapboxgl.min'; +import 'vue-iclient/static/libs/geostats/geostats'; +import 'vue-iclient/static/libs/json-sql/jsonsql'; +import echarts from 'echarts'; +import EchartsLayer from 'vue-iclient/static/libs/echarts-layer/EchartsLayer'; +import cloneDeep from 'lodash.clonedeep'; +import { geti18n } from 'vue-iclient/src/common/_lang/index'; +import WebMapBase from 'vue-iclient/src/common/web-map/WebMapBase'; +import { getColorWithOpacity } from 'vue-iclient/src/common/_utils/util'; +import { getProjection, registerProjection, toEpsgCode } from 'vue-iclient/src/common/_utils/epsg-define'; +import proj4 from 'proj4'; + +const WORLD_WIDTH = 360; +// 迁徙图最大支持要素数量 +/** + * @class WebMapViewModel + * @category ViewModel + * @classdesc 对接 iPortal/Online 地图类。目前支持地图坐标系包括:'EPSG:3857','EPSG:4326','EPSG:4490','EPSG:4214','EPSG:4610'。 + * @param {number} id - iPortal|Online 地图 ID。 + * @param {Object} options - 参数。 + * @param {string} [options.target='map'] - 地图容器 ID。 + * @param {string} [options.serverUrl="https://www.supermapol.com"] - SuperMap iPortal/Online 服务器地址。当设置 `id` 时有效。 + * @param {string} [options.accessToken] - 用于访问 SuperMap iPortal 、SuperMap Online 中受保护的服务。当设置 `id` 时有效。 + * @param {string} [options.accessKey] - SuperMap iServer 提供的一种基于 Token(令牌)的用户身份验证机制。当设置 `id` 时有效。 + * @param {String} [options.tiandituKey] - 用于访问天地图的服务。当设置 `id` 时有效。 + * @param {String} [options.googleMapsAPIKey] - 用于访问谷歌地图。当设置 `id` 时有效。 + * @param {String} [options.googleMapsLanguage] - 用于定义在谷歌地图图块上显示标签的语言。当设置 `id` 且底图为谷歌地图时有效。 + * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。当设置 `id` 时有效。 + * @param {boolean} [options.excludePortalProxyUrl] - server 传递过来的 URL 是否带有代理。当设置 `id` 时有效。 + * @param {boolean} [options.ignoreBaseProjection = 'false'] - 是否忽略底图坐标系和叠加图层坐标系不一致。 + * @param {String} [options.iportalServiceProxyUrlPrefix] - iportal的代理服务地址前缀。 + * @fires WebMapViewModel#mapinitialized + * @fires WebMapViewModel#getmapinfofailed + * @fires WebMapViewModel#getlayerdatasourcefailed + * @fires WebMapViewModel#addlayerssucceeded + */ +interface webMapOptions { + target?: string; + serverUrl?: string; + accessToken?: string; + accessKey?: string; + tiandituKey?: string; + googleMapsAPIKey?: string; + googleMapsLanguage?: string; + withCredentials?: boolean; + excludePortalProxyUrl?: boolean; + isSuperMapOnline?: boolean; + center?: number[]; + zoom?: number; + proxy?: boolean | string; + iportalServiceProxyUrlPrefix?: string; + checkSameLayer?: boolean; + mapInfo?: Object; +} +interface mapOptions { + center?: [number, number] | mapboxglTypes.LngLatLike | { lon: number; lat: number } | number[]; + zoom?: number; + bounds?: mapboxglTypes.LngLatBoundsLike; + maxBounds?: [[number, number], [number, number]] | mapboxglTypes.LngLatBoundsLike; + minZoom?: number; + maxZoom?: number; + renderWorldCopies?: boolean; + bearing?: number; + pitch?: number; + style?: any; + rasterTileSize?: number; + container?: string; + crs: string; +} + +type layerType = 'POINT' | 'LINE' | 'POLYGON'; + +export default class WebMap extends WebMapBase { + map: mapboxglTypes.Map; + + center: [number, number] | mapboxglTypes.LngLatLike | { lon: number; lat: number } | number[]; + + bounds: mapboxglTypes.LngLatBoundsLike; + + renderWorldCopies: boolean; + + bearing: number; + + pitch: number; + + rasterTileSize: number; + + layerFilter: Function; + + baseLayerProxy: string | boolean; + + private _sourceListModel: SourceListModel; + + private _legendList: any; + + private _handleDataflowFeaturesCallback: Function; + + private _initDataflowLayerCallback: Function; + + private _dataflowService: any; + + private _unprojectProjection: string; + + private _layerTimerList: Array = []; + + private checkSameLayer: boolean; + + private _appreciableLayers: Array = []; + + private _mapInfo: Object; + + private _parentEvents: Object; + + constructor( + id: string | number | Object, + options: webMapOptions = {}, + // @ts-ignore fix-mapoptions + mapOptions: mapOptions = { style: { version: 8, sources: {}, layers: [] } }, + map?: mapboxglTypes.Map, + layerFilter: Function = function () { + return true; + } + ) { + super(id, options, mapOptions); + if (typeof id === 'string' || typeof id === 'number') { + this.mapId = id; + } + if (!this.mapId && !mapOptions.center && !mapOptions.zoom) { + mapOptions.center = [0, 0]; + mapOptions.zoom = 0; + } + if (this.centerValid(mapOptions.center)) { + this.center = mapOptions.center; + } + this.zoom = mapOptions.zoom; + this.bounds = mapOptions.bounds; + this.bearing = mapOptions.bearing; + this.pitch = mapOptions.pitch; + this.rasterTileSize = mapOptions.rasterTileSize || 256; + this.layerFilter = layerFilter; + this.checkSameLayer = options.checkSameLayer; + this._legendList = []; + this._appreciableLayers = []; + this._mapInfo = options.mapInfo; + // @ts-ignore + this._parentEvents = options.parentEvents ?? {}; + if (map) { + this.map = map; + } + this._taskID = new Date(); + this._getMapInfo(this._mapInfo, this._taskID); + } + + public getLegendInfo() { + return this._legendList; + } + + get getSourceListModel(): SourceListModel { + return this._sourceListModel; + } + + _initWebMap(): void {} + + _loadLayers(mapInfo, _taskID): void { + if (this.map) { + // @ts-ignore + if (this.map.getCRS().epsgCode !== this.baseProjection && !this.ignoreBaseProjection) { + this._triggerEvent('projectionIsNotMatch', {}); + return; + } + this._handleLayerInfo(mapInfo, _taskID); + } else { + setTimeout(() => { + this._createMap(mapInfo); + this.map.on('load', () => { + this._handleLayerInfo(mapInfo, _taskID); + }); + }, 0); + } + } + + _setCRS(baseProjection, wkt, bounds): void { + const crs = new mapboxgl.CRS(baseProjection, wkt, bounds, bounds[2] > 180 ? 'meter' : 'degree'); + mapboxgl.CRS.set(crs); + } + + _getMapInfo(mapInfo, _taskID): void { + this._mapInfo = mapInfo; + const { projection } = mapInfo; + let bounds, wkt; + this.baseProjection = toEpsgCode(projection); + let defaultWktValue = getProjection(this.baseProjection); + + if (defaultWktValue) { + wkt = defaultWktValue; + } + if (!mapboxgl.CRS.get(this.baseProjection)) { + if (mapInfo.baseLayer && mapInfo.baseLayer.layerType === 'MAPBOXSTYLE') { + let url = mapInfo.baseLayer.dataSource.url; + if (url.indexOf('/restjsr/') > -1 && !/\/style\.json$/.test(url)) { + url += '/style.json'; + } + this.webMapService.getMapBoxStyle(url).then((res: any) => { + if (res && res.metadata && res.metadata.indexbounds) { + bounds = res.metadata.indexbounds; + } else { + bounds = [ + mapInfo.extent.leftBottom.x, + mapInfo.extent.leftBottom.y, + mapInfo.extent.rightTop.x, + mapInfo.extent.rightTop.y + ]; + } + this._defineProj4(projection); + this._setCRS(this.baseProjection, wkt, bounds); + this._loadLayers(mapInfo, _taskID); + }); + } else if (mapInfo.baseLayer && mapInfo.baseLayer.layerType === 'TILE') { + // 获取地图的wkt + this.getEpsgCodeWKT(`${mapInfo.baseLayer.url}/prjCoordSys.wkt`, { + withoutFormatSuffix: true, + withCredentials: this.webMapService.handleWithCredentials('', mapInfo.baseLayer.url, false) + }).then(res => { + if (!wkt) { + wkt = res; + } + this.getBounds(`${mapInfo.baseLayer.url}.json`, { + withoutFormatSuffix: true, + withCredentials: this.webMapService.handleWithCredentials('', mapInfo.baseLayer.url, false) + }).then(res => { + if (res && res.bounds) { + bounds = [res.bounds.leftBottom.x, res.bounds.leftBottom.y, res.bounds.rightTop.x, res.bounds.rightTop.y]; + } else { + bounds = [ + mapInfo.extent.leftBottom.x, + mapInfo.extent.leftBottom.y, + mapInfo.extent.rightTop.x, + mapInfo.extent.rightTop.y + ]; + } + this._defineProj4(wkt, projection); + this._setCRS(this.baseProjection, wkt, bounds); + this._loadLayers(mapInfo, _taskID); + }); + }); + } else { + // this._defineProj4(projection); + // this._loadLayers(mapInfo, _taskID); + throw Error(geti18n().t('webmap.crsNotSupport')); + } + } else { + this._defineProj4(projection); + bounds = [ + mapInfo.extent.leftBottom.x, + mapInfo.extent.leftBottom.y, + mapInfo.extent.rightTop.x, + mapInfo.extent.rightTop.y + ]; + this._setCRS(this.baseProjection, wkt, bounds); + this._loadLayers(mapInfo, _taskID); + } + } + + _handleLayerInfo(mapInfo, _taskID): void { + mapInfo = this._setLayerID(mapInfo); + this._mapInfo = mapInfo; + this._appreciableLayers = []; + this.layerAdded = 0; + this.expectLayerLen = 0; + const { layers, grid } = mapInfo; + this._setExpectLayerLen(mapInfo); + if (this.expectLayerLen === 0) { + this._sendMapToUser(0, 0); + } + if (this._shouldLoadBaseLayer(mapInfo, this.layerFilter)) { + this._initBaseLayer(mapInfo, () => { + this._addLayerSucceeded(); + }); + } + if (layers && layers.length !== 0) { + let filterLayers = layers; + if (typeof this.layerFilter === 'function') { + filterLayers = layers.filter(this.layerFilter); + } + this._initOverlayLayers(filterLayers, _taskID); + } + if (grid && grid.graticule) { + this._initGraticuleLayer(grid.graticule); + } + } + + _setExpectLayerLen(mapInfo) { + if (this._shouldLoadBaseLayer(mapInfo, this.layerFilter)) { + this.expectLayerLen++; + } + let overLayers = mapInfo.layers; + if (overLayers && overLayers.length > 0) { + if (typeof this.layerFilter === 'function') { + overLayers = overLayers.filter(this.layerFilter); + } + this.expectLayerLen += overLayers.length; + this._appreciableLayers = overLayers.map(layerInfo => { + const { layerID, dataSource, layerType, name, themeSetting, visible } = layerInfo; + let type = ['VECTOR', 'UNIQUE', 'RANGE', 'HEAT', 'MARKER', 'MIGRATION', 'RANK_SYMBOL'].includes(layerType) + ? 'vector' + : 'raster'; + return { + layerID, + dataSource, + layerType: type, + name, + themeSetting, + visible + }; + }); + } + } + + _shouldLoadBaseLayer(mapInfo, layerFilter) { + const baseLayer = mapInfo.baseLayer; + if (!baseLayer) { + return false; + } + if (typeof layerFilter === 'function') { + return layerFilter(baseLayer); + } + return true; + } + + _createMap(mapInfo?): void { + // 获取字体样式 + const fontFamilys: string = this._getLabelFontFamily(mapInfo); + const center = this._getMapCenter(mapInfo); + // zoom + let zoom = mapInfo.level || 0; + let zoomBase = 0; + let { bounds, minZoom, maxZoom } = this.mapOptions; + const interactive = this.mapOptions.interactive; + if (isNaN(minZoom)) { + minZoom = mapInfo.minScale + ? this._transformScaleToZoom(mapInfo.minScale, mapboxgl.CRS.get(this.baseProjection)) + : 0; + } + if (isNaN(maxZoom)) { + maxZoom = mapInfo.maxScale + ? this._transformScaleToZoom(mapInfo.maxScale, mapboxgl.CRS.get(this.baseProjection)) + : 22; + } + if (mapInfo.visibleExtent && mapInfo.visibleExtent.length === 4 && !bounds) { + bounds = [ + this._unproject([mapInfo.visibleExtent[0], mapInfo.visibleExtent[1]]), + this._unproject([mapInfo.visibleExtent[2], mapInfo.visibleExtent[3]]) + ]; + } + if (minZoom > maxZoom) { + [minZoom, maxZoom] = [maxZoom, minZoom]; + } + if (!bounds) { + if (mapInfo.minScale && mapInfo.maxScale) { + zoomBase = Math.min( + this._transformScaleToZoom(mapInfo.minScale, mapboxgl.CRS.get(this.baseProjection)), + this._transformScaleToZoom(mapInfo.maxScale, mapboxgl.CRS.get(this.baseProjection)) + ); + } else { + zoomBase = +Math.log2( + this._getResolution(mapboxgl.CRS.get(this.baseProjection).getExtent()) / this._getResolution(mapInfo.extent) + ).toFixed(2); + } + zoom += zoomBase; + } + + // 初始化 map + this.map = new mapboxgl.Map({ + ...this.mapOptions, + container: this.target, + center: this.center || center, + zoom: this.zoom || zoom, + minZoom, + maxZoom, + bearing: this.bearing || 0, + pitch: this.pitch || 0, + bounds, + interactive: interactive === void 0 ? true : interactive, + style: { + version: 8, + sources: {}, + layers: [] + }, + // @ts-ignore fix-crs + crs: this.baseProjection, + localIdeographFontFamily: fontFamilys || '', + renderWorldCopies: this.renderWorldCopies || false, + transformRequest: (url, resourceType) => { + if (resourceType === 'Tile') { + if (this.isSuperMapOnline && url.indexOf('http://') === 0) { + url = `https://www.supermapol.com/apps/viewer/getUrlResource.png?url=${encodeURIComponent(url)}`; + } + if (this.webMapService.isIportalResourceUrl(url)) { + url = this.webMapService.handleParentRes(url); + } + const proxy = this.webMapService.handleProxy('image'); + return { + url: url, + credentials: this.webMapService.handleWithCredentials(proxy, url, false) ? 'include' : 'omit' + }; + } + return { url }; + }, + fadeDuration: 0 + }); + /** + * @description Map 初始化成功。 + */ + this._triggerEvent('mapinitialized', { map: this.map }); + } + + private _createMVTBaseLayer(layerInfo, addedCallback?: Function) { + let url = layerInfo.dataSource.url; + if (url.indexOf('/restjsr/') > -1 && !/\/style\.json$/.test(url)) { + url += '/style.json'; + } + this.webMapService + // @ts-ignore + .getMapBoxStyle(url) + .then( + (style: any) => { + // @ts-ignore + this.map.addStyle(style); + addedCallback && addedCallback(); + }, + error => { + addedCallback && addedCallback(); + throw new Error(error); + } + ) + .catch(error => { + /** + * @event WebMapViewModel#getmapinfofailed + * @description 获取地图信息失败。 + * @property {Object} error - 失败原因。 + */ + this._triggerEvent('getmapinfofailed', { error }); + }); + } + + _initBaseLayer(mapInfo: any, addedCallback?: Function): void { + const layerInfo = mapInfo.baseLayer || mapInfo; + const layerType = this.getBaseLayerType(layerInfo); + const mapUrls = this.getMapurls(); + let url: string; + this.baseLayerProxy = this.webMapService.handleProxy('image'); + + switch (layerType) { + case 'TIANDITU': + this.baseLayerProxy = null; + this._createTiandituLayer(mapInfo, addedCallback); + break; + case 'BING': + this.baseLayerProxy = null; + this._createBingLayer(layerInfo.layerID || layerInfo.name, layerInfo, addedCallback); + break; + case 'WMS': + this._createWMSLayer(layerInfo, addedCallback); + break; + case 'WMTS': + this._createWMTSLayer(layerInfo, addedCallback); + break; + case 'TILE': + this._createDynamicTiledLayer(layerInfo, addedCallback); + break; + case 'CLOUD': + case 'XYZ': + url = mapUrls[layerInfo.layerType] + .replace('{googleMapsLanguage}', this.googleMapsLanguage) + .replace('{googleMapsAPIKey}', this.googleMapsAPIKey); + this._createXYZLayer(layerInfo, url, addedCallback); + break; + case 'BAIDU': + this._triggerEvent('notsupportbaidumap', {}); + addedCallback && addedCallback(); + break; + case 'MAPBOXSTYLE': + this._createMVTBaseLayer(layerInfo, addedCallback); // 添加矢量瓦片服务作为底图 + break; + } + } + + _initOverlayLayers(layers: any, _taskID: any): void { + // 存储地图上所有的图层对象 + if (this.expectLayerLen > 0) { + layers.forEach(layer => { + const type = this.webMapService.getDatasourceType(layer); + // TODO --- 暂不支持 SAMPLE_DATA + if (type === 'SAMPLE_DATA') { + this._addLayerSucceeded(); + this._triggerEvent('getlayerdatasourcefailed', { + error: 'SAMPLE DATA is not supported', + layer, + map: this.map + }); + return; + } + + if (layer.visibleScale) { + const { minScale, maxScale } = layer.visibleScale; + layer.minzoom = Math.max(this._transformScaleToZoom(minScale), 0); + layer.maxzoom = Math.min(24, this._transformScaleToZoom(maxScale) + 0.0000001); + } + + if (type === 'tile') { + this._initBaseLayer(layer, () => { + this._addLayerSucceeded(); + }); + if (layer.autoUpdateTime) { + this._layerTimerList.push( + setInterval(() => { + this._initBaseLayer(layer); + }, layer.autoUpdateTime) + ); + } + } else { + this.getLayerFeatures(layer, _taskID, type); + if (layer.autoUpdateTime) { + this._layerTimerList.push( + setInterval(() => { + this.getLayerFeatures(layer, _taskID, type); + }, layer.autoUpdateTime) + ); + } + } + }, this); + } + } + + _initOverlayLayer(layerInfo: any, features: any = [], mergeByField?: string) { + const { layerID, layerType, visible, style, featureType, labelStyle, projection } = layerInfo; + layerInfo.visible = visible ? 'visible' : 'none'; + features = this.mergeFeatures(layerID, features, mergeByField); + if (layerType === 'restMap') { + this._createRestMapLayer(features, layerInfo); + return; + } + if (layerType === 'mvt') { + this._createMvtLayer(features.info, layerInfo, features.featureType); + return; + } + + // mbgl 目前不能处理 geojson 复杂面情况 + // mbgl isssue https://github.com/mapbox/mapbox-gl-js/issues/7023 + if (features && features[0] && features[0].geometry && features[0].geometry.type === 'Polygon') { + features = handleMultyPolygon(features); + } + + if ( + features && + projection && + (projection !== this.baseProjection || projection === 'EPSG:3857' || projection === 'EPSG:-1000') && + layerInfo.dataSource && + layerInfo.dataSource.type !== 'REST_DATA' + ) { + this._unprojectProjection = this._defineProj4(projection); + features = this.transformFeatures(features); + } + + features = this.handleLayerFeatures(features, layerInfo); + + if (layerType === 'VECTOR') { + if (featureType === 'POINT') { + if (style.type === 'SYMBOL_POINT') { + this._createSymbolLayer(layerInfo, features); + } else { + this._createGraphicLayer(layerInfo, features); + } + } else { + // 线和面 + this._createVectorLayer(layerInfo, features); + // 不在 _createVectorLayer 里面处理 layerAdded++ 的原因:_createDataflowLayer 也调用了_createVectorLayer ,会导致layerAdded > expectLayerLen + this._addLayerSucceeded(); + } + } else if (layerType === 'UNIQUE') { + this._createUniqueLayer(layerInfo, features); + } else if (layerType === 'RANGE') { + this._createRangeLayer(layerInfo, features); + } else if (layerType === 'HEAT') { + this._createHeatLayer(layerInfo, features); + } else if (layerType === 'MARKER') { + this._createMarkerLayer(layerInfo, features); + } else if (layerType === 'MIGRATION') { + this._createMigrationLayer(layerInfo, features); + } else if (layerType === 'RANK_SYMBOL') { + this._createRankSymbolLayer(layerInfo, features); + } else if (layerType === 'DATAFLOW_POINT_TRACK' || layerType === 'DATAFLOW_HEAT') { + this._createDataflowLayer(layerInfo); + } + if (labelStyle && labelStyle.labelField && layerType !== 'DATAFLOW_POINT_TRACK') { + // 存在标签专题图 + this._addLabelLayer(layerInfo, features, false); + } + } + + _initGraticuleLayer(graticuleInfo: any) { + const options = this._createGraticuleOptions(graticuleInfo); + const graticuleLayers = new mapboxgl.supermap.GraticuleLayer(options); + this.map.addLayer(graticuleLayers); + this._setGraticuleDash(graticuleInfo.lineDash, graticuleLayers); + } + + private _createGraticuleOptions(graticuleInfo) { + let { extent, lonLabelStyle, latLabelStyle } = graticuleInfo; + const { strokeColor, lineDash, strokeWidth, interval } = graticuleInfo; + const strokeStyle = { + lineColor: strokeColor, + lindDasharray: lineDash, + lineWidth: strokeWidth + }; + lonLabelStyle = { + textFont: lonLabelStyle.fontFamily.split(','), + textSize: lonLabelStyle.fontSize, + textAnchor: latLabelStyle.textBaseline, + textColor: lonLabelStyle.fill, + textHaloColor: lonLabelStyle.outlineColor, + textHaloWidth: lonLabelStyle.outlineWidth + }; + latLabelStyle = { + textFont: latLabelStyle.fontFamily.split(','), + textSize: latLabelStyle.fontSize, + textAnchor: latLabelStyle.textBaseline, + textColor: latLabelStyle.fill, + textHaloColor: latLabelStyle.outlineColor, + textHaloWidth: latLabelStyle.outlineWidth + }; + // @ts-ignore + extent = extent || this.map.getCRS().extent; + extent = [this._unproject([extent[0], extent[1]]), this._unproject([extent[2], extent[3]])]; + return { + minZoom: 1, + strokeStyle, + extent, + interval: interval && interval[0], + lngLabelStyle: lonLabelStyle, + latLabelStyle + }; + } + + private _setGraticuleDash(lindDasharray, graticuleLayers) { + this.map.on('zoomend', () => { + if (this.map.getZoom() < 3) { + graticuleLayers.setStrokeStyle({ lindDasharray: [0.1, 3] }); + } else { + graticuleLayers.setStrokeStyle({ lindDasharray }); + } + }); + } + + private _createTiandituLayer(mapInfo: any, addedCallback?: Function): void { + const tiandituUrls = this._getTiandituUrl(mapInfo); + const { labelLayerVisible, name, visible } = mapInfo.baseLayer; + const isLabel = Boolean(labelLayerVisible); + const labelUrl = tiandituUrls.labelUrl; + const tiandituUrl = tiandituUrls.tiandituUrl; + this._addBaselayer(tiandituUrl, name, visible); + isLabel && this._addBaselayer(labelUrl, `${name}-label`, visible); + addedCallback && addedCallback(); + } + + private _createWMTSLayer(layerInfo, addedCallback?: Function): void { + this.webMapService + // @ts-ignore + .getWmtsInfo(layerInfo, this.map.getCRS().epsgCode) + .then( + (result: any) => { + const layerId = layerInfo.layerID || layerInfo.name; + if (result.isMatched) { + const wmtsUrl = this._getWMTSUrl(Object.assign({}, layerInfo, result)); + this._addBaselayer( + [wmtsUrl], + layerId, + layerInfo.visible, + result.matchMinZoom, + result.matchMaxZoom, + false, + result.bounds + ); + addedCallback && addedCallback(); + } + }, + error => { + addedCallback && addedCallback(); + throw new Error(error); + } + ) + .catch(error => { + /** + * @event WebMapViewModel#getmapinfofailed + * @description 获取地图信息失败。 + * @property {Object} error - 失败原因。 + */ + this._triggerEvent('getmapinfofailed', { error }); + }); + } + + private _createBingLayer(layerName: string, layerInfo: any, addedCallback?: Function): void { + const bingUrl = + 'https://dynamic.t0.tiles.ditu.live.com/comp/ch/{quadkey}?it=G,TW,L,LA&mkt=zh-cn&og=109&cstl=w4c&ur=CN&n=z'; + // @ts-ignore + this._addBaselayer([bingUrl], layerName, layerInfo.visible); + addedCallback && addedCallback(); + } + + private _createXYZLayer(layerInfo: any, url: string, addedCallback?: Function): void { + let urlArr: string[] = []; + + if (layerInfo.layerType === 'OSM') { + const res = url.match(/\w\-\w/g)[0]; + const start = res[0]; + const end = res[2]; + let alphabet = ''; + for (let i = 97; i < 123; i++) { + alphabet += String.fromCharCode(i); + } + const alphabetArr = alphabet.split(''); + + const startIndex = alphabetArr.indexOf(start); + const endIndex = alphabetArr.indexOf(end); + + const res3 = alphabetArr.slice(startIndex, endIndex + 1); + + for (let i = 0; i < res3.length; i++) { + const replaceRes = url.replace(/{\w\-\w}/g, res3[i]); + urlArr.push(replaceRes); + } + } else if (layerInfo.layerType === 'GOOGLE_CN') { + const res = url.match(/\d\-\d/g)[0]; + const start = parseInt(res[0]); + const end = parseInt(res[2]); + + for (let i = start; i <= end; i++) { + const replaceRes = url.replace(/{\d\-\d}/g, i.toString()); + urlArr.push(replaceRes); + } + } else { + urlArr = [url]; + } + const layerId = layerInfo.layerID || layerInfo.name; + this._addBaselayer(urlArr, layerId, layerInfo.visible); + addedCallback && addedCallback(); + } + + private _createDynamicTiledLayer(layerInfo: any, addedCallback?: Function): void { + const url = layerInfo.url; + const layerId = layerInfo.layerID || layerInfo.name; + const { minzoom, maxzoom } = layerInfo; + this._addBaselayer([url], layerId, layerInfo.visible, minzoom, maxzoom, true); + addedCallback && addedCallback(); + } + + private _createWMSLayer(layerInfo: any, addedCallback?: Function): void { + this.webMapService + // @ts-ignore + .getWmsInfo(layerInfo) + .then( + (result: any) => { + const layerId = layerInfo.layerID || layerInfo.name; + if (result) { + const wmsUrl = this._getWMSUrl(layerInfo, result.version); + this._addBaselayer([wmsUrl], layerId, layerInfo.visible); + addedCallback && addedCallback(); + } + }, + error => { + addedCallback && addedCallback(); + throw new Error(error); + } + ) + .catch(error => { + /** + * @event WebMapViewModel#getmapinfofailed + * @description 获取地图信息失败。 + * @property {Object} error - 失败原因。 + */ + this._triggerEvent('getmapinfofailed', { error }); + }); + } + + private _createVectorLayer(layerInfo: any, features: any): void { + const type = layerInfo.featureType; + const { layerID, minzoom, maxzoom, style, visible } = layerInfo; + const layerSource = this.map.getSource(layerID); + const sourceData: GeoJSON.FeatureCollection = { + type: 'FeatureCollection', + features: features + }; + if (!layerSource) { + const source: mapboxglTypes.GeoJSONSourceRaw = { + type: 'geojson', + data: sourceData + }; + this.map.addSource(layerID, source); + } else { + // @ts-ignore + layerSource.setData(sourceData); + } + const styleArr = Array.isArray(style) ? style : [style]; + if (styleArr.length === 2) { + // 道路 + if (styleArr[0].lineDash === 'solid' && styleArr[1].lineDash === 'solid') { + styleArr[0].strokeWidth = styleArr[1].strokeWidth; + styleArr[1].strokeWidth = styleArr[1].strokeWidth - 2; + } + // 铁路 + if (styleArr[0].lineDash === 'solid' && styleArr[1].lineDash === 'dash') { + styleArr[0].strokeWidth = styleArr[1].strokeWidth; + styleArr[1].strokeWidth = styleArr[1].strokeWidth * 0.5; + styleArr[1].lineDash = 'dashrailway'; + } + } + styleArr.forEach((element, index) => { + const layerStyle = { + style: this._transformStyleToMapBoxGl(element, type), + layout: { + visibility: visible + } + }; + const newLayerID = index === 0 ? layerID : `${layerID}-additional-${index}`; + this._addOverlayToMap(type, layerID, newLayerID, layerStyle, minzoom, maxzoom); + }); + // 如果面有边框 + type === 'POLYGON' && + style.strokeColor && + this._addStrokeLineForPoly(style, layerID, layerID + '-strokeLine', visible, minzoom, maxzoom); + } + + private _getWMSUrl(mapInfo: any, version = '1.1.1'): string { + let url = mapInfo.url; + const options: any = { + service: 'WMS', + request: 'GetMap', + layers: + mapInfo.layers !== null && typeof mapInfo.layers === 'object' + ? mapInfo.layers.join(',') + : mapInfo.layers || '0', // 如果是多个图层,用逗号分隔 + styles: '', + format: 'image/png', + transparent: 'true', + version, + width: 256, + height: 256 + }; + if (version === '1.3.0') { + options.bbox = this.baseProjection === 'EPSG:4326' ? '{bbox-wms-1.3.0}' : '{bbox-epsg-3857}'; + options.crs = this.baseProjection; + } else { + options.bbox = '{bbox-epsg-3857}'; + options.srs = this.baseProjection; + } + return SuperMap.Util.urlAppend(url, this._getParamString(options, url)); + } + + private _setLayerID(mapInfo): Array { + const sumInfo: Object = {}; + const { baseLayer, layers = [] } = mapInfo; + if (!this.checkSameLayer) { + const baseInfo = this._generateUniqueLayerId(baseLayer.name, 0); + baseLayer.name = baseInfo.newId; + } + const layerNames = layers.map(layer => layer.name); + const _layers: Array = layers.map((layer, index) => { + if (!(layer.name in sumInfo)) { + sumInfo[layer.name] = baseLayer.name === layer.name ? 1 : 0; + } + const matchFirstIndex = layerNames.indexOf(layer.name); + const matchLastIndex = layerNames.lastIndexOf(layer.name); + if (index > matchFirstIndex && index <= matchLastIndex) { + sumInfo[layer.name] = sumInfo[layer.name] + 1; + } + let layerID = sumInfo[layer.name] ? `${layer.name}-${sumInfo[layer.name]}` : layer.name; + if (!this.checkSameLayer || layer.layerType !== 'raster') { + const { newId, newIndex } = this._generateUniqueLayerId(layerID, sumInfo[layer.name]); + sumInfo[layer.name] = newIndex; + layerID = newId; + } + return Object.assign(layer, { layerID }); + }); + mapInfo.layers = _layers; + mapInfo.baseLayer = baseLayer; + return mapInfo; + } + + private _generateUniqueLayerId(newId, index) { + if (this.map.getLayer(newId)) { + index++; + // 判断是否带有-index后缀 + if (newId.match(/-\d+&/gi)) { + newId = newId.replace(/\d+$/gi, index); + } else { + newId = `${newId}-${index}`; + } + return this._generateUniqueLayerId(newId, index); + } else { + return { newId, newIndex: index }; + } + } + + private _getResizedZoom(bounds, mapContainerStyle, tileSize = 512, worldWidth = WORLD_WIDTH) { + const { width, height } = mapContainerStyle; + const lngArcLength = Math.abs(bounds.getEast() - bounds.getWest()); + const latArcLength = Math.abs(this._getBoundsRadian(bounds.getSouth()) - this._getBoundsRadian(bounds.getNorth())); + const lngResizeZoom = +Math.log2(worldWidth / ((lngArcLength / parseInt(width)) * tileSize)).toFixed(2); + const latResizeZoom = +Math.log2(worldWidth / ((latArcLength / parseInt(height)) * tileSize)).toFixed(2); + if (lngResizeZoom <= latResizeZoom) { + return lngResizeZoom; + } + return latResizeZoom; + } + + private _getBoundsRadian(point) { + return (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (point * Math.PI) / 360)); + } + + _createRestMapLayer(restMaps, layer) { + restMaps.forEach(restMapInfo => { + layer = this.getRestMapLayerInfo(restMapInfo, layer); + this._initBaseLayer(layer); + }); + this._addLayerSucceeded(); + } + + _addLayerSucceeded() { + this.layerAdded++; + this._sendMapToUser(this.layerAdded, this.expectLayerLen); + } + + private _createDataflowLayer(layerInfo) { + const dataflowService = new mapboxgl.supermap.DataFlowService(layerInfo.wsUrl).initSubscribe(); + this._handleDataflowFeaturesCallback = this._handleDataflowFeatures.bind(this, layerInfo); + this._initDataflowLayerCallback = this._initDataflowLayer.bind(this, layerInfo); + dataflowService.on('subscribesucceeded', this._initDataflowLayerCallback); + dataflowService.on('messageSucceeded', this._handleDataflowFeaturesCallback); + this._dataflowService = dataflowService; + } + + private _initDataflowLayer() { + this._addLayerSucceeded(); + } + + private _handleDataflowFeatures(layerInfo, e) { + let features = [JSON.parse(e.data)]; + // this.transformFeatures([features]); // TODO 坐标系 + this._triggerEvent('dataflowfeatureupdated', { + features, + identifyField: layerInfo.identifyField, + layerID: layerInfo.layerID + }); + + if (layerInfo.projection === 'EPSG:3857') { + features = this.transformFeatures(features); + } + if (layerInfo.filterCondition) { + // 过滤条件 + let condition = this.replaceFilterCharacter(layerInfo.filterCondition); + const properties = features[0].properties || {}; + condition = this.parseCondition(condition, Object.keys(properties)); + const filterFeature = this.parseConditionFeature(properties); + const sql = 'select * from json where (' + condition + ')'; + const filterResult = window.jsonsql.query(sql, { attributes: filterFeature }); + if (filterResult && filterResult.length > 0) { + this._addDataflowLayer(layerInfo, features[0]); + } + } else { + this._addDataflowLayer(layerInfo, features[0]); + } + } + + private _getDataFlowRotateStyle(features, directionField, identifyField) { + const iconRotateExpression = ['match', ['get', identifyField]]; + features.forEach(feature => { + let value; + if (directionField !== undefined && directionField !== '未设置' && directionField !== 'None') { + value = feature.properties[directionField]; + } else { + value = 0; + } + if (value > 360 || value < 0) { + return null; + } + // @ts-ignore + iconRotateExpression.push(feature.properties[identifyField], parseInt(value)); + }); + // @ts-ignore + iconRotateExpression.push(0); + return iconRotateExpression; + } + + private _addDataflowLayer(layerInfo, feature) { + const layerID = layerInfo.layerID; + if (layerInfo.layerType === 'DATAFLOW_HEAT') { + if (!this.map.getSource(layerID)) { + this._createHeatLayer(layerInfo, [feature], false); + } else { + this._updateDataFlowFeature(layerID, feature, layerInfo); + } + } else { + const layerStyle = layerInfo.pointStyle; + layerInfo.style = layerStyle; + if (!this.map.getSource(layerID)) { + const iconRotateExpression = this._getDataFlowRotateStyle( + [feature], + layerInfo.directionField, + layerInfo.identifyField + ); + if (['BASIC_POINT', 'SVG_POINT', 'IMAGE_POINT'].includes(layerStyle.type)) { + this._createGraphicLayer(layerInfo, [feature], null, iconRotateExpression, false); + } else { + this._createSymbolLayer(layerInfo, [feature], null, iconRotateExpression, false); + } + } else { + this._updateDataFlowFeature(layerID, feature, layerInfo, 'point'); + } + if (layerInfo.labelStyle && layerInfo.visible) { + if (!this.map.getSource(layerID + '-label')) { + this._addLabelLayer(layerInfo, [feature], true); + } else { + this._updateDataFlowFeature(layerID + '-label', feature, layerInfo); + } + } + if (layerInfo.lineStyle && layerInfo.visible) { + if (!this.map.getSource(layerID + '-line')) { + const geometry = feature.geometry.coordinates; + const lineFeature = { + type: 'Feature', + properties: feature.properties, + geometry: { + type: 'LineString', + coordinates: [geometry] + } + }; + this._createVectorLayer( + { style: layerInfo.lineStyle, featureType: 'LINE', visible: 'visible', layerID: layerID + '-line' }, + [lineFeature] + ); + } else { + this._updateDataFlowFeature(layerID + '-line', feature, layerInfo, 'line'); + } + } + } + } + + private _updateDataFlowFeature(sourceID, newFeature, layerInfo, type?) { + const { identifyField, maxPointCount, directionField } = layerInfo; + // @ts-ignore + const features = cloneDeep(this.map.getSource(sourceID)._data.features); + let has = false; + features.map((item, index) => { + if (item.properties[identifyField] === newFeature.properties[identifyField]) { + has = true; + if (type === 'line') { + const coordinates = item.geometry.coordinates; + coordinates.push(newFeature.geometry.coordinates); + if (maxPointCount && coordinates.length > maxPointCount) { + coordinates.splice(0, coordinates.length - maxPointCount); + } + features[index].geometry.coordinates = coordinates; + } else { + features[index] = newFeature; + } + } + }); + if (!has) { + if (type === 'line') { + features.push({ + type: 'Feature', + properties: newFeature.properties, + geometry: { + type: 'LineString', + coordinates: [newFeature.geometry.coordinates] + } + }); + } else { + features.push(newFeature); + } + } + // @ts-ignore + this.map.getSource(sourceID).setData({ type: 'FeatureCollection', features }); + if (type === 'point') { + const type = layerInfo.pointStyle.type; + const iconRotateExpression = this._getDataFlowRotateStyle(features, directionField, identifyField); + if (['SVG_POINT', 'IMAGE_POINT'].includes(type)) { + this.map.setLayoutProperty(sourceID, 'icon-rotate', iconRotateExpression); + } else if (type === 'SYMBOL_POINT') { + this.map.setLayoutProperty(sourceID, 'text-rotate', iconRotateExpression); + } + } + } + + private _createMigrationLayer(layerInfo, features) { + // @ts-ignore + window.echarts = echarts; + const options = this.getEchartsLayerOptions(layerInfo, features, 'GLMap'); + // @ts-ignore + options.GLMap = { roam: true }; + const echartslayer = new EchartsLayer(this.map); + echartslayer.chart.setOption(options); + this.echartslayer.push(echartslayer); + this._addLayerSucceeded(); + } + + private _createRankSymbolLayer(layerInfo, features) { + const { minzoom, maxzoom } = layerInfo; + const fieldName = layerInfo.themeSetting.themeField; + const colors = layerInfo.themeSetting.colors; + const style = layerInfo.style; + const featureType = layerInfo.featureType; + const styleSource: any = this.createRankStyleSource(layerInfo, features); + const styleGroups = styleSource.styleGroups; + features = this.getFilterFeatures(layerInfo.filterCondition, features); + // 获取 expression + const expression = ['match', ['get', 'index']]; + const colorExpression = ['match', ['get', 'index']]; + for (let index = 0; index < features.length; index++) { + const row = features[index]; + const tartget = parseFloat(row.properties[fieldName]); + if (styleGroups) { + for (let i = 0; i < styleGroups.length; i++) { + if (styleGroups[i].start <= tartget && tartget < styleGroups[i].end) { + const radius = + style.type === 'SYMBOL_POINT' || style.type === 'IMAGE_POINT' + ? style.type === 'SYMBOL_POINT' + ? styleGroups[i].radius * 2 + : Number.parseFloat((styleGroups[i].radius / style.imageInfo.size.h).toFixed(2)) * 2 + : styleGroups[i].radius; + expression.push(row.properties.index, radius); + colorExpression.push(row.properties.index, styleGroups[i].color); + break; + } + } + } + } + // @ts-ignore + expression.push(1); + colorExpression.push('rgba(0, 0, 0, 0)'); + // 图例处理 + this._initLegendConfigInfo(layerInfo, styleGroups); + if (colors && colors.length > 0) { + style.fillColor = colorExpression; + } + if (style.type === 'SYMBOL_POINT') { + this._createSymbolLayer(layerInfo, features, expression); + } else if (['SVG_POINT', 'IMAGE_POINT'].includes(style.type)) { + this._createGraphicLayer(layerInfo, features, expression); + } else { + const source: mapboxglTypes.GeoJSONSourceRaw = { + type: 'geojson', + data: { + type: 'FeatureCollection', + features: features + } + }; + // 获取样式 + const layerStyle: any = { + layout: { + visibility: layerInfo.visible + } + }; + layerStyle.style = this._transformStyleToMapBoxGl(layerInfo.style, featureType, expression, 'circle-radius'); + const layerID = layerInfo.layerID; + this._addOverlayToMap(featureType, source, layerID, layerStyle, minzoom, maxzoom); + this._addLayerSucceeded(); + } + } + + private _addTextBackgroundImage(rgba: Array): string { + if (!rgba[3]) { + return ''; + } + const width = 20; // The image will be 64 pixels square. + const bytesPerPixel = 4; // Each pixel is represented by 4 bytes: red, green, blue, and alpha. + const data = new Uint8Array(width * width * bytesPerPixel); + + for (let x = 0; x < width; x++) { + for (let y = 0; y < width; y++) { + const offset = (y * width + x) * bytesPerPixel; + data[offset + 0] = rgba[0]; // red + data[offset + 1] = rgba[1]; // green + data[offset + 2] = rgba[2]; // blue + data[offset + 3] = rgba[3] * 255; // alpha + } + } + const imageId = `text-background-${rgba.join('-')}`; + if (!this.map.hasImage(imageId)) { + this.map.addImage( + imageId, + { width: width, height: width, data: data }, + { + // @ts-ignore + stretchX: [[0, 20]], + stretchY: [[0, 20]], + content: [0, 0, 20, 20] + } + ); + } + return imageId; + } + + private _addLabelLayer(layerInfo: any, features: any, addSource = false): void { + const labelStyle = layerInfo.labelStyle; + let { backgroundFill } = labelStyle; + const fontFamily = labelStyle.fontFamily; + const { minzoom, maxzoom } = layerInfo; + const textSize = parseFloat(labelStyle.fontSize || 14); + let textBackgroundImageId = ''; + if (labelStyle.placement !== 'line') { + textBackgroundImageId = this._addTextBackgroundImage(backgroundFill); + } + backgroundFill = `rgba(${backgroundFill.join(',')})`; + let textHaloColor = 'rgba(255,255,255,0)'; + if (labelStyle.outlineColor && labelStyle.outlineWidth > 0) { + textHaloColor = labelStyle.outlineColor; + } + + let textHaloWidth = (labelStyle.outlineWidth || 0) / 2; + let textAnchor = labelStyle.textAlign || 'center'; + if (labelStyle.textBaseline && labelStyle.textBaseline !== 'middle') { + textAnchor = `${labelStyle.textBaseline}${textAnchor === 'center' ? '' : `-${textAnchor}`}`; + } + + const textOffset = + layerInfo.featureType === 'POINT' + ? [labelStyle.offsetX / textSize || 0, labelStyle.offsetY / textSize || 0] + : [0, 0]; + const layout = { + 'text-field': `{${labelStyle.labelField}}`, + 'text-size': textSize, + 'text-offset': textOffset, + 'text-font': fontFamily ? [fontFamily] : ['DIN Offc Pro Italic', 'Arial Unicode MS Regular'], + 'symbol-placement': + labelStyle.placement === 'line' ? (layerInfo.featureType === 'POLYGON' ? 'line' : 'line-center') : 'point', + 'text-max-angle': layerInfo.featureType === 'POLYGON' ? 40 : 30, + 'symbol-spacing': layerInfo.featureType === 'POLYGON' ? 200 : 50, + 'text-anchor': textAnchor, + 'text-line-height': 1.2, + visibility: layerInfo.visible + }; + if (textBackgroundImageId) { + Object.assign(layout, { + 'icon-image': textBackgroundImageId, + 'icon-allow-overlap': true, + 'icon-text-fit': 'both', + 'icon-text-fit-padding': [2, 4, 2, 4] + }); + } + this._addLayer({ + id: `${layerInfo.layerID}-label`, + type: 'symbol', + source: + this.map.getSource(layerInfo.layerID) && !addSource + ? layerInfo.layerID + : { type: 'geojson', data: { type: 'FeatureCollection', features: features } }, + paint: { + 'text-color': labelStyle.fill, + 'text-halo-color': textHaloColor, + 'text-halo-width': textHaloWidth + }, + layout, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22 + }); + } + + private _createSymbolLayer( + layerInfo: any, + features: any, + textSizeExpresion?, + textRotateExpresion?, + addToMap = true, + filter? + ): void { + // 用来请求symbol_point字体文件 + const target = document.getElementById(`${this.target}`); + target.classList.add('supermapol-icons-map'); + const { layerID, minzoom, maxzoom, style } = layerInfo; + const unicode = style.unicode; + const text = String.fromCharCode(parseInt(unicode.replace(/^&#x/, ''), 16)); + const textSize = + textSizeExpresion || + (Array.isArray(style.fontSize) ? style.fontSize : (style.fontSize && parseFloat(style.fontSize)) || 12); + const rotate = Array.isArray(style.rotation) ? style.rotation : ((style.rotation || 0) * 180) / Math.PI; + if (!this.map.getSource(layerID)) { + this.map.addSource(layerID, { + type: 'geojson', + data: { + type: 'FeatureCollection', + features: [] + } + }); + } + const layerOptions: any = { + id: layerID, + type: 'symbol', + source: layerID, + paint: { + 'text-color': Array.isArray(style.fillColor) + ? style.fillColor + : getColorWithOpacity(style.fillColor, style.fillOpacity), + // 'text-opacity': style.fillOpacity === 0 ? 0.1 : style.fillOpacity, + 'text-halo-color': Array.isArray(style.strokeColor) + ? style.strokeColor + : getColorWithOpacity(style.strokeColor || 'rgba(0,0,0,0)', style.strokeOpacity), + 'text-halo-width': style.strokeWidth || 0 + }, + layout: { + 'text-field': text, + 'text-size': textSize, + 'text-font': ['supermapol-icons'], + 'text-rotate': textRotateExpresion || rotate || 0, + 'text-offset': Array.isArray(style.offsetX) ? style.offsetX : [style.offsetX / 2 || 0, style.offsetY / 2 || 0], + 'text-allow-overlap': true, + visibility: layerInfo.visible + }, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22 + }; + if (filter) { + layerOptions.filter = filter; + } + this._addLayer(layerOptions); + // @ts-ignore + this.map.getSource(layerID).setData({ + type: 'FeatureCollection', + features: features + }); + if (addToMap) { + this._addLayerSucceeded(); + } + } + + private _createGraphicLayer( + layerInfo: any, + features: any, + iconSizeExpression?, + iconRotateExpression?, + addToMap = true, + filter? + ) { + const { layerID, minzoom, maxzoom, style } = layerInfo; + + const source: mapboxglTypes.GeoJSONSourceRaw = { + type: 'geojson', + data: { + type: 'FeatureCollection', + features: features + } + }; + if (!this.map.getSource(layerID)) { + this.map.addSource(layerID, source); + } + const iconID = `imageIcon-${layerID}`; + if (style.type === 'IMAGE_POINT') { + const imageInfo = style.imageInfo; + this.map.loadImage(imageInfo.url, (error, image) => { + if (error) { + console.error(error); + return; + } + const iconSize = Number.parseFloat((style.radius / image.width).toFixed(2)) * 2; + !this.map.hasImage(iconID) && this.map.addImage(iconID, image); + const layerOptions: any = { + id: layerID, + type: 'symbol', + source: layerID, + layout: { + 'icon-image': iconID, + 'icon-anchor': 'bottom-right', + 'icon-size': iconSizeExpression || iconSize, + 'icon-allow-overlap': true, + visibility: layerInfo.visible, + 'icon-offset': [style.offsetX * image.width || 0, style.offsetY * image.height || 0], + 'icon-rotate': iconRotateExpression || ((layerInfo.style.rotation || 0) * 180) / Math.PI + }, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22 + }; + if (filter) { + layerOptions.filter = filter; + } + this._addLayer(layerOptions); + if (addToMap) { + this._addLayerSucceeded(); + } + }); + } else if (style.type === 'SVG_POINT') { + const svgUrl = style.url; + if (!this._svgDiv) { + this._svgDiv = document.createElement('div'); + document.body.appendChild(this._svgDiv); + } + this.getCanvasFromSVG(svgUrl, this._svgDiv, canvas => { + // this.handleSvgColor(style, canvas); + const imgUrl = canvas.toDataURL('img/png'); + imgUrl && + this.map.loadImage(imgUrl, (error, image) => { + if (error) { + console.log(error); + } + const iconSize = Number.parseFloat((style.radius / canvas.width).toFixed(2)) * 2; + if (iconSizeExpression && Array.isArray(iconSizeExpression)) { + iconSizeExpression = iconSizeExpression.map((item, index) => { + if (typeof item === 'number' && index % 2 === 1) { + return (item / canvas.width) * 2; + } + return item; + }); + } + !this.map.hasImage(svgUrl) && this.map.addImage(svgUrl, image, { sdf: true }); + const layerOptions: any = { + id: layerID, + type: 'symbol', + source: layerID, + layout: { + 'icon-image': svgUrl, + 'icon-size': iconSizeExpression || iconSize, + 'icon-anchor': 'bottom-right', + visibility: layerInfo.visible, + 'icon-offset': [style.offsetX * canvas.width || 0, style.offsetY * canvas.height || 0], + 'icon-allow-overlap': true, + 'icon-rotate': iconRotateExpression || ((layerInfo.style.rotation || 0) * 180) / Math.PI + }, + paint: { + 'icon-color': style.fillColor + }, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22 + }; + if (filter) { + layerOptions.filter = filter; + } + this._addLayer(layerOptions); + if (addToMap) { + this._addLayerSucceeded(); + } + }); + }); + } else { + const layerStyle = { + style: this._transformStyleToMapBoxGl(style, layerInfo.featureType), + layout: { + visibility: layerInfo.visible + } + }; + this._addOverlayToMap('POINT', layerID, layerID, layerStyle, minzoom, maxzoom); + if (addToMap) { + this._addLayerSucceeded(); + } + } + } + + private _createUniqueLayer(layerInfo: any, features: any): void { + const symbolConvertFunctionFactory = { + unicode: ({ unicode }): string => { + return String.fromCharCode(parseInt(unicode.replace(/^&#x/, ''), 16)); + }, + fontSize: ({ fontSize }): number => { + if (fontSize) { + return parseFloat(fontSize); + } + return 12; + }, + rotation: ({ rotation }): number => { + return ((rotation || 0) * 180) / Math.PI; + }, + fillColor: ({ fillColor, fillOpacity }): string => { + return getColorWithOpacity(fillColor, fillOpacity); + }, + strokeColor: ({ strokeColor, strokeOpacity }): string => { + return getColorWithOpacity(strokeColor || 'rgba(0,0,0,0)', strokeOpacity); + }, + strokeWidth: ({ strokeWidth }): string => { + return strokeWidth || 0; + }, + offsetX: ({ offsetX, offsetY }): [number, number] => { + return [offsetX / 2 || 0, offsetY / 2 || 0]; + } + }; + const defaultValueFactory = { + unicode: '', + fontSize: 12, + rotation: 0, + strokeColor: 'rgba(0,0,0,0)', + fillColor: 'rgba(0,0,0,0)', + strokeWidth: 0, + offsetX: [0, 0] + }; + const styleGroup = this.getUniqueStyleGroup(layerInfo, features); + features = this.getFilterFeatures(layerInfo.filterCondition, features); + const { layerID, minzoom, maxzoom, style } = layerInfo; + const themeField = styleGroup[0].themeField; + const type = layerInfo.featureType; + + const defultLayerStyle = layerInfo.style; + // 样式expression池 样式key值为webmap的样式key值 + const expressionMap: any = {}; + // 自定义单值值对应的样式 + const customStyleMap = {}; + styleGroup.forEach(style => { + customStyleMap[style.value] = style; + }); + // 遍历要素,判断该要素是不是在自定义单值中,若是在对应样式match expression中增加改要素的索引 + features.forEach(({ properties }) => { + const customStyle = customStyleMap[properties[themeField]]; + if (customStyle) { + const itemStyle = customStyle.style; + for (const key in itemStyle) { + if (Object.prototype.hasOwnProperty.call(itemStyle, key)) { + const itemStyleElement = itemStyle[key]; + if (itemStyleElement !== defultLayerStyle[key]) { + if (!expressionMap[key]) { + expressionMap[key] = ['match', ['get', 'index']]; + } + expressionMap[key].push( + properties.index, + symbolConvertFunctionFactory[key] ? symbolConvertFunctionFactory[key](itemStyle) : itemStyleElement + ); + } + } + } + } + }); + // 给每个expression增加最后一个默认值 + for (const key in expressionMap) { + if (Object.prototype.hasOwnProperty.call(expressionMap, key)) { + const expression = expressionMap[key]; + const defaultStyleItem = defultLayerStyle[key] || defaultValueFactory[key]; + const fn = symbolConvertFunctionFactory[key]; + expression.push( + defaultStyleItem === undefined ? null : (fn && fn({ [key]: defaultStyleItem })) || defaultStyleItem + ); + } + } + // Todo 图例相关 + this._initLegendConfigInfo(layerInfo, styleGroup); + + const source: mapboxglTypes.GeoJSONSourceRaw = { + type: 'geojson', + data: { + type: 'FeatureCollection', + features: features + } + }; + const sourceID = layerID; + if (!this.map.getSource(sourceID)) { + this.map.addSource(sourceID, source); + } else { + // @ts-ignore + this.map.getSource(sourceID).setData(source.data); + } + + const visible = layerInfo.visible; + const layerCreateFcuntion = (type, sourceID, layerID, style, minzoom, maxzoom, filter?) => { + const layerStyle = { + style: this._transformStyleToMapBoxGl({ ...style }, type), + layout: { + visibility: visible + } + }; + this._addOverlayToMap(type, sourceID, layerID, layerStyle, minzoom, maxzoom, filter); + }; + if (['POLYGON', 'LINE'].includes(type)) { + // linedash不能用表达式处理,需用多个图层 + const lineDashExpression = expressionMap.lineDash; + // 非自定义要素过滤表达式 + const defaultFilterExpression: any = ['all']; + let handlerLine = false; + let fristName = ''; + if (lineDashExpression && lineDashExpression.length > 1) { + delete expressionMap.lineDash; + const filterField = lineDashExpression[1]; + const tempLayerID = type === 'POLYGON' ? layerID + '-strokeLine' : layerID; + for (let index = 2; index < lineDashExpression.length - 1; index += 2) { + const filterExpression = ['==', filterField, lineDashExpression[index]]; + defaultFilterExpression.push(['!=', filterField, lineDashExpression[index]]); + const additionalLayerName = `${tempLayerID}-additional-linedasharray-${index / 2}`; + if (!fristName) { + fristName = additionalLayerName; + } + layerCreateFcuntion( + 'LINE', + sourceID, + additionalLayerName, + { ...style, ...expressionMap, lineDash: lineDashExpression[index + 1] }, + minzoom, + maxzoom, + filterExpression + ); + } + if (defaultFilterExpression.length > 1) { + layerCreateFcuntion( + 'LINE', + sourceID, + tempLayerID, + { ...style, ...expressionMap, lineDash: lineDashExpression[lineDashExpression.length] }, + minzoom, + maxzoom, + defaultFilterExpression + ); + } + handlerLine = true; + } + // 没有自定义虚线的情况 + if (type === 'LINE' && !handlerLine) { + layerCreateFcuntion( + 'LINE', + sourceID, + layerID, + { ...style, ...expressionMap }, + minzoom, + maxzoom, + defaultFilterExpression + ); + } + // 面 + if (type === 'POLYGON') { + layerCreateFcuntion('POLYGON', sourceID, layerID, { ...style, ...expressionMap }, minzoom, maxzoom); + if (fristName) { + this.map.moveLayer(layerID, fristName); + } + // 面且没有虚线 + if (!handlerLine) { + layerCreateFcuntion( + 'LINE', + sourceID, + layerID + '-strokeLine', + { ...style, ...expressionMap }, + minzoom, + maxzoom, + defaultFilterExpression + ); + if (fristName) { + this.map.moveLayer(layerID + '-strokeLine', fristName); + } + } + } + } else { + const defaultFilterExpression: any = ['all']; + const unicodeExpression = expressionMap.unicode; + // SYMBOL_POINT + if (unicodeExpression) { + const classNameExpression = expressionMap.className || []; + delete expressionMap.unicode; + delete expressionMap.classname; + const additionalLayerName = `${layerID}-additional-symbol`; + const filterExpression: any = ['any']; + // defaultExpression.push(['!=', filterField, lineDashExpression[index]]); + for (let index = 2; index < classNameExpression.length - 1; index += 2) { + defaultFilterExpression.push(['!=', classNameExpression[1], classNameExpression[index]]); + filterExpression.push(['==', classNameExpression[1], classNameExpression[index]]); + } + // this._createSymbolLayer() + // 用来请求symbol_point字体文件 + const target = document.getElementById(`${this.target}`); + target.classList.add('supermapol-icons-map'); + const symbolStyle = { ...style, ...expressionMap }; + const layerOptions: any = { + id: additionalLayerName, + type: 'symbol', + source: sourceID, + paint: { + 'text-color': symbolStyle.fillColor, + // 'text-opacity': style.fillOpacity === 0 ? 0.1 : style.fillOpacity, + 'text-halo-color': symbolStyle.strokeColor, + 'text-halo-width': symbolStyle.strokeWidth + }, + layout: { + 'text-field': unicodeExpression, + 'text-size': + typeof symbolStyle.fontSize === 'string' ? parseInt(symbolStyle.fontSize) : symbolStyle.fontSize || 12, + 'text-font': ['supermapol-icons'], + 'text-rotate': symbolStyle.rotation || 0, + 'text-offset': Array.isArray(symbolStyle.offsetX) + ? symbolStyle.offsetX + : [symbolStyle.offsetX / 2 || 0, symbolStyle.offsetY / 2 || 0], + 'text-allow-overlap': true, + visibility: visible + }, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22 + }; + if (filterExpression.length > 1) { + layerOptions.filter = filterExpression; + } + this._addLayer(layerOptions); + } + // IMAGE_POINT 或者 SVG_POINT + const imageInfoExpression = expressionMap.imageInfo || []; + const urlExpression = expressionMap.url || []; + if (imageInfoExpression.length > 0 || urlExpression.length > 0) { + delete expressionMap.imageInfo; + delete expressionMap.url; + const imageList = []; + // image表达式 和 过滤表达式 + const imageExpresssion = imageInfoExpression.length > 0 ? [imageInfoExpression[0], imageInfoExpression[1]] : []; + const svgExpresssion = urlExpression.length > 0 ? [urlExpression[0], urlExpression[1]] : []; + const imagefilterExpression: any = ['any']; + const svgfilterExpression: any = ['any']; + for (let index = 2; index < imageInfoExpression.length - 1; index += 2) { + const element = imageInfoExpression[index + 1]; + imageList.push(element.url); + imageExpresssion.push(imageInfoExpression[index]); + imageExpresssion.push(element.url); + defaultFilterExpression.push(['!=', imageInfoExpression[1], imageInfoExpression[index]]); + imagefilterExpression.push(['==', imageInfoExpression[1], imageInfoExpression[index]]); + } + for (let index = 2; index < urlExpression.length - 1; index += 2) { + const element = urlExpression[index + 1]; + imageList.push(element); + svgExpresssion.push(urlExpression[index]); + svgExpresssion.push(element); + defaultFilterExpression.push(['!=', urlExpression[1], urlExpression[index]]); + svgfilterExpression.push(['==', urlExpression[1], urlExpression[index]]); + } + imageExpresssion.push(''); + svgExpresssion.push(''); + + const loadImagePromise = src => { + return new Promise(resolve => { + if (src.indexOf('svg') < 0) { + this.map.loadImage(src, (error, image) => { + if (error) { + console.log(error); + resolve(error); + return; + } + !this.map.hasImage(src) && this.map.addImage(src, image); + resolve({ src, image }); + }); + } else { + if (!this._svgDiv) { + this._svgDiv = document.createElement('div'); + document.body.appendChild(this._svgDiv); + } + this.getCanvasFromSVG(src, this._svgDiv, canvas => { + this.handleSvgColor(defultLayerStyle, canvas); + this.map.loadImage(canvas.toDataURL('img/png'), (error, image) => { + if (error) { + console.log(error); + resolve(error); + return; + } + // sdf: true 可以设置icon-color + !this.map.hasImage(src) && this.map.addImage(src, image, { sdf: true }); + resolve({ src, image }); + }); + }); + } + }); + }; + const promiseList = []; + imageList.forEach(src => { + promiseList.push(loadImagePromise(src)); + }); + const symbolStyle = { ...style, ...expressionMap }; + Promise.all(promiseList).then(images => { + const imageSize = {}; + const radiusMap = {}; + const radiusExpress = expressionMap.radius || []; + for (let index = 2; index < radiusExpress.length - 1; index += 2) { + radiusMap[radiusExpress[index]] = radiusExpress[index + 1]; + } + images.forEach(image => { + if (image && image.src) { + imageSize[image.src] = image.image.width; + } + }); + // icon-color在一个图层中能全起作用或者全不起作用 所以image和svg分两个图层 + // icon-size和图片大小有关系 + if (imageExpresssion.length > 1) { + const iconSizeExpression: any = ['match', ['get', 'index']]; + for (let index = 2; index < imageExpresssion.length - 1; index += 2) { + const featureIndex = imageExpresssion[index]; + const featureSrc = imageExpresssion[index + 1]; + const iconSize = + Number.parseFloat(((radiusMap[featureIndex] || 8) / imageSize[featureSrc]).toFixed(2)) * 2; + iconSizeExpression.push(featureIndex); + iconSizeExpression.push(iconSize); + } + iconSizeExpression.push(1); + + this._addLayer({ + id: `${layerID}-additional-image`, + type: 'symbol', + source: sourceID, + layout: { + 'icon-image': imageExpresssion, + 'icon-anchor': 'bottom-right', + 'icon-size': iconSizeExpression, + 'icon-allow-overlap': true, + visibility: layerInfo.visible, + 'icon-offset': symbolStyle.offsetX || [0, 0], + 'icon-rotate': symbolStyle.rotation || 0 + }, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22, + filter: imagefilterExpression + }); + } + if (svgExpresssion.length > 1) { + const iconSizeExpression: any = ['match', ['get', 'index']]; + for (let index = 2; index < svgExpresssion.length - 1; index += 2) { + const featureIndex = svgExpresssion[index]; + const featureSrc = svgExpresssion[index + 1]; + const iconSize = + Number.parseFloat(((radiusMap[featureIndex] || 8) / imageSize[featureSrc]).toFixed(2)) * 2; + iconSizeExpression.push(featureIndex); + iconSizeExpression.push(iconSize); + } + iconSizeExpression.push(1); + this._addLayer({ + id: `${layerID}-additional-svg`, + type: 'symbol', + source: sourceID, + layout: { + 'icon-image': svgExpresssion, + 'icon-anchor': 'bottom-right', + 'icon-size': 1, + 'icon-allow-overlap': true, + visibility: layerInfo.visible, + 'icon-offset': symbolStyle.offsetX || [0, 0], + 'icon-rotate': symbolStyle.rotation || 0 + }, + paint: { + 'icon-color': symbolStyle.fillColor + }, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22, + filter: svgfilterExpression + }); + } + }); + } + if (style.type === 'SYMBOL_POINT') { + const tmpLayerInfo = { ...layerInfo }; + tmpLayerInfo.style = { ...style, ...expressionMap, type: style.type }; + this._createSymbolLayer( + tmpLayerInfo, + features, + '', + '', + false, + defaultFilterExpression.length > 1 ? defaultFilterExpression : undefined + ); + } else if (style.type === 'IMAGE_POINT' || style.type === 'SVG_POINT') { + const tmpLayerInfo = { ...layerInfo }; + tmpLayerInfo.style = { ...style, ...expressionMap, type: style.type }; + this._createGraphicLayer( + tmpLayerInfo, + features, + '', + '', + false, + defaultFilterExpression.length > 1 ? defaultFilterExpression : undefined + ); + } else { + layerCreateFcuntion( + 'POINT', + sourceID, + layerID, + { ...style, ...expressionMap }, + minzoom, + maxzoom, + defaultFilterExpression.length > 1 ? defaultFilterExpression : undefined + ); + } + } + this._addLayerSucceeded(); + } + + private _getWMTSUrl(options: any): string { + if (options.requestEncoding === 'REST' && options.restResourceURL) { + return options.restResourceURL + .replace('{Style}', options.style || '') + .replace('{TileMatrixSet}', options.tileMatrixSet) + .replace('{TileRow}', '{y}') + .replace('{TileCol}', '{x}') + .replace('{TileMatrix}', '{z}'); + } + const obj = { + service: 'WMTS', + request: 'GetTile', + version: '1.0.0', + style: options.style || '', + layer: options.layer, + tilematrixSet: options.tileMatrixSet, + format: 'image/png', + tilematrix: '{z}', + tilerow: '{y}', + tilecol: '{x}' + }; + return SuperMap.Util.urlAppend(options.kvpResourceUrl, this._getParamString(obj, options.kvpResourceUrl)); + } + + private _createMarkerLayer(layerInfo: any, features: any): void { + const { minzoom, maxzoom } = layerInfo; + const markerLayerID = layerInfo.layerID; + const markerSrc = {}; + features = features || []; + features.forEach((feature: any, index: number) => { + const defaultStyle = feature.dv_v5_markerStyle; + let geomType = feature.geometry.type.toUpperCase(); + if (geomType === 'POINT' && defaultStyle.text) { + // 说明是文字的feature类型 + geomType = 'TEXT'; + } + const layerID = index === 0 ? markerLayerID : markerLayerID + '-' + geomType + '-' + index; + if ( + geomType === 'POINT' && + defaultStyle.src && + defaultStyle.src.indexOf('http://') === -1 && + defaultStyle.src.indexOf('https://') === -1 + ) { + // 说明地址不完整 + defaultStyle.src = this.serverUrl + defaultStyle.src; + } + if (!markerSrc[layerID]) { + markerSrc[layerID] = { + src: defaultStyle.src, + defaultStyle + }; + } + }); + const loadImagePromise = (layerID: string, { src, defaultStyle }) => { + return new Promise(resolve => { + if (!src) { + resolve({ [layerID]: undefined }); + return; + } + if (src.indexOf('svg') < 0 && (src.startsWith('http://') || src.startsWith('https://'))) { + this.map.loadImage(src, (error, image) => { + if (error) { + console.log(error); + resolve(error); + return; + } + !this.map.hasImage(src) && this.map.addImage(src, image); + resolve({ [layerID]: src }); + }); + } else { + if (!this._svgDiv) { + this._svgDiv = document.createElement('div'); + document.body.appendChild(this._svgDiv); + } + this.getCanvasFromSVG(src, this._svgDiv, canvas => { + this.handleSvgColor(defaultStyle, canvas); + const base64Url = canvas.toDataURL('img/png'); + this.map.loadImage(base64Url, (error, image) => { + if (error) { + console.log(error); + resolve(error); + return; + } + const srcUrl = src || base64Url; + !this.map.hasImage(srcUrl) && this.map.addImage(srcUrl, image); + resolve({ [layerID]: srcUrl }); + }); + }); + } + }); + }; + const promiseList = []; + for (const layerID in markerSrc) { + promiseList.push(loadImagePromise(layerID, markerSrc[layerID])); + } + Promise.all(promiseList).then(images => { + for (let i = 0; i < features.length; i++) { + const feature = features[i]; + const defaultStyle = feature.dv_v5_markerStyle; + let geomType = feature.geometry.type.toUpperCase(); + if (geomType === 'POINT' && defaultStyle.text) { + // 说明是文字的feature类型 + geomType = 'TEXT'; + } + const featureInfo = this.setFeatureInfo(feature); + feature.properties.useStyle = defaultStyle; + feature.properties.featureInfo = featureInfo; + + const source: mapboxglTypes.GeoJSONSourceRaw = { + type: 'geojson', + data: feature + }; + const layerID = i === 0 ? markerLayerID : markerLayerID + '-' + geomType + '-' + i; + const iconImageUrl = images[i][layerID]; + // image-marker svg-marker + if (geomType === 'POINT' || geomType === 'TEXT') { + if (!iconImageUrl) { + this._addLayer({ + id: layerID, + type: 'circle', + source: source, + paint: this._transformStyleToMapBoxGl(defaultStyle, geomType), + layout: {}, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22 + }); + continue; + } + this._addLayer({ + id: layerID, + type: 'symbol', + source: source, + layout: { + 'icon-image': iconImageUrl, + 'icon-allow-overlap': true, + 'icon-size': defaultStyle.scale || 1, + visibility: layerInfo.visible + }, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22 + }); + } else { + // line-polygon-marker + const layeStyle: any = { + layout: {} + }; + if (geomType === 'LINESTRING' && defaultStyle.lineCap) { + geomType = 'LINE'; + layeStyle.layout = { + 'line-cap': defaultStyle.lineCap + }; + } + const visible = layerInfo.visible; + layeStyle.layout.visibility = visible; + // get style + layeStyle.style = this._transformStyleToMapBoxGl(defaultStyle, geomType); + this._addOverlayToMap(geomType, source, layerID, layeStyle, minzoom, maxzoom); + // 若面有边框 + geomType === 'POLYGON' && + defaultStyle.strokeColor && + this._addStrokeLineForPoly(defaultStyle, layerID, layerID + '-strokeLine', visible, minzoom, maxzoom); + } + } + this._addLayerSucceeded(); + }); + } + + private _createHeatLayer(layerInfo: any, features: any, addToMap = true): void { + const { minzoom, maxzoom } = layerInfo; + const style = layerInfo.themeSetting; + const layerOption = { + gradient: style.colors.slice(), + radius: parseInt(style.radius) + }; + + // 自定义颜色 + const customSettings = style.customSettings; + for (const i in customSettings) { + layerOption.gradient[i] = customSettings[i]; + } + + const color: string | mapboxglTypes.StyleFunction | mapboxglTypes.Expression = [ + 'interpolate', + ['linear'], + ['heatmap-density'] + ]; + + const step = [0.1, 0.3, 0.5, 0.7, 1]; + layerOption.gradient.forEach((item, index) => { + (color).push(step[index]); + if (index === 0) { + item = mapboxgl.supermap.Util.hexToRgba(item, 0); + } + if (index === 1) { + item = mapboxgl.supermap.Util.hexToRgba(item, 0.5); + } + (color).push(item); + }); + // 图例相关 + this._initLegendConfigInfo(layerInfo, color); + + const paint: mapboxglTypes.HeatmapPaint = { + 'heatmap-color': color, + 'heatmap-radius': style.radius * 3, + 'heatmap-intensity': 2.8 + }; + + if (style.weight && features.length >= 4) { + const weight = []; + features.forEach(item => { + item.properties[style.weight] = +item.properties[style.weight]; + weight.push(item.properties[style.weight]); + }); + const max = SuperMap.ArrayStatistic.getMax(weight); + const min = SuperMap.ArrayStatistic.getMin(weight); + paint['heatmap-weight'] = ['interpolate', ['linear'], ['get', style.weight], min, 0, max, 1]; + } + this._addLayer({ + id: layerInfo.layerID, + type: 'heatmap', + source: { + type: 'geojson', + data: { + type: 'FeatureCollection', + features: features + } + }, + paint: paint, + layout: { + visibility: layerInfo.visible + }, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22 + }); + if (addToMap) { + this._addLayerSucceeded(); + } + } + + private _createRangeLayer(layerInfo: any, features: any): void { + const fieldName = layerInfo.themeSetting.themeField; + const featureType = layerInfo.featureType; + const { minzoom, maxzoom, style } = layerInfo; + const styleGroups = this.getRangeStyleGroup(layerInfo, features); + + features = this.getFilterFeatures(layerInfo.filterCondition, features); + + // 获取 expression + const expression = ['match', ['get', 'index']]; + const datas = features.filter(row => { + const tartget = parseFloat(row.properties[fieldName]); + if (!tartget && tartget !== 0) { + // expression.push(row.properties['index'], 'rgba(0, 0, 0, 0)'); + return false; + } + if (styleGroups) { + for (let i = 0; i < styleGroups.length; i++) { + const startFlag = styleGroups[i].start <= tartget; + const endFlag = tartget < styleGroups[i].end; + const lastEndFlag = i === styleGroups.length - 1 && tartget === styleGroups[i].end; + if (startFlag && (endFlag || lastEndFlag)) { + expression.push(row.properties.index, styleGroups[i].color); + break; + } + } + } + return true; + }, this); + expression.push('rgba(0, 0, 0, 0)'); + const source: mapboxglTypes.GeoJSONSourceRaw = { + type: 'geojson', + data: { + type: 'FeatureCollection', + features: datas + } + }; + // 图例处理 + this._initLegendConfigInfo(layerInfo, styleGroups); + + // 获取样式 + const layerStyle: any = { + layout: {} + }; + if (featureType === 'LINE' && style.lineCap) { + layerStyle.layout = { + 'line-cap': style.lineCap + }; + } + const visible = layerInfo.visible; + layerStyle.layout.visibility = visible; + layerStyle.style = this._transformStyleToMapBoxGl(style, featureType, expression); + // 添加图层 + const layerID = layerInfo.layerID; + this._addOverlayToMap(featureType, source, layerID, layerStyle, minzoom, maxzoom); + // 如果面有边框 + featureType === 'POLYGON' && + style.strokeColor && + this._addStrokeLineForPoly(style, layerID, layerID + '-strokeLine', visible, minzoom, maxzoom); + this._addLayerSucceeded(); + } + + private _sendMapToUser(count: number, layersLen: number): void { + if (count === layersLen) { + /** + * @event WebMapViewModel#addlayerssucceeded + * @description 添加图层成功。 + * @property {mapboxglTypes.Map} map - MapBoxGL Map 对象。 + * @property {Object} mapparams - 地图信息。 + * @property {string} mapParams.title - 地图标题。 + * @property {string} mapParams.description - 地图描述。 + * @property {Array.} layers - 地图上所有的图层对象。 + */ + + this._sourceListModel = new SourceListModel({ + map: this.map + }); + this._rectifyLayersOrder(); + this._triggerEvent('addlayerssucceeded', { + map: this.map, + layers: this._appreciableLayers, + // @ts-ignore + mapparams: this._mapInfo.mapParams, + sourceListModel: this._sourceListModel + }); + } + } + + private _moveLayer(layerID, beforLayerId = undefined) { + if (this.map.getLayer(layerID)) { + this.map.moveLayer(layerID, beforLayerId); + return true; + } + return false; + } + + private _rectifyLayersOrder() { + const exsitLayers = this._appreciableLayers.filter(layer => !!this.map.getLayer(layer.layerID)); + const mapLayers = this.map.getStyle().layers; + for (let index = exsitLayers.length - 1; index > -1; index--) { + const targetlayerId = exsitLayers[index].layerID; + let beforLayerId = exsitLayers[index + 1] ? exsitLayers[index + 1].layerID : undefined; + this._moveLayer(targetlayerId, beforLayerId); + this._moveLayer(`${targetlayerId}-strokeLine`, beforLayerId); + for (let index = 1; index < this.expectLayerLen + 1; index++) { + if (this._moveLayer(`${targetlayerId}-additional-${index}`, beforLayerId)) { + continue; + } else { + break; + } + } + if (mapLayers && mapLayers.length > 0) { + const expandLayers = mapLayers.map(item => item.id.includes(targetlayerId)); + for (let index = 1; index < expandLayers.length; index++) { + if (this._moveLayer(`${targetlayerId}-POINT-${index}`, beforLayerId)) { + continue; + } else if (this._moveLayer(`${targetlayerId}-TEXT-${index}`, beforLayerId)) { + continue; + } else { + break; + } + } + } + this._moveLayer(`${targetlayerId}-label`); + } + } + + private _getParamString(obj: any, existingUrl: string, uppercase = false): string { + const params = []; + for (const i in obj) { + params.push((uppercase ? i.toUpperCase() : i) + '=' + obj[i]); + } + return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&'); + } + + /** + * @private + * @function WebMapViewModel.prototype._transformStyleToMapBoxGl + * @description 根据图层类型将 layerInfo 中的 style 属性格式转换为 mapboxglTypes 中的 style 格式。 + * @param {Object} style - layerInfo中的style属性 + * @param {String} type - 图层类型 + * @param {Array} [expression] - 存储颜色值得表达式 + */ + private _transformStyleToMapBoxGl(style: any, type: layerType, expression?, expressionType?): any { + let transTable = {}; + if ((style.type === 'POINT' || style.type === 'BASIC_POINT' || type === 'POINT') && type !== 'LINE') { + transTable = { + fillColor: 'circle-color', + strokeWidth: 'circle-stroke-width', + fillOpacity: 'circle-opacity', + radius: 'circle-radius', + strokeColor: 'circle-stroke-color', + strokeOpacity: 'circle-stroke-opacity' + }; + } else if (['LINE', 'LINESTRING', 'MULTILINESTRING'].includes(type)) { + transTable = { + strokeWidth: 'line-width', + strokeColor: 'line-color', + strokeOpacity: 'line-opacity' + }; + } else if (['REGION', 'POLYGON', 'MULTIPOLYGON'].includes(type)) { + transTable = { + fillColor: 'fill-color', + fillOpacity: 'fill-opacity' + // strokeColor: 'fill-outline-color' + }; + } + + const newObj = {}; + for (const item in style) { + if (transTable[item]) { + newObj[transTable[item]] = style[item]; + } + } + if (expression) { + if (expressionType) { + newObj[expressionType] = expression; + } else if (newObj['circle-color']) { + newObj['circle-color'] = expression; + } else if (newObj['line-color']) { + newObj['line-color'] = expression; + } else { + newObj['fill-color'] = expression; + } + } + if (style.lineDash && !newObj['line-dasharray']) { + if (Array.isArray(style.lineDash)) { + newObj['line-dasharray'] = style.lineDash; + } else if (style.lineDash !== 'solid' && type === 'LINE') { + newObj['line-dasharray'] = this.getDashStyle(style.lineDash); + } + } + if (style.lineDash && !newObj['circle-translate']) { + if (Array.isArray(style.circleTranslate)) { + newObj['circle-translate'] = style.circleTranslate; + } else if (style.type === 'POINT' || style.type === 'BASIC_POINT' || type === 'POINT') { + const offsetX = style.offsetX || 0; + const offsetY = style.offsetY || 0; + newObj['circle-translate'] = [offsetX * style.radius, offsetY * style.radius]; + } + } + + return newObj; + } + + /** + * @private + * @function WebMapViewModel.prototype._addOverlayToMap + * @description 添加基础矢量图层到 MAP + * @param {Object} style - mabgl style + * @param {String} type - 图层类型 + */ + private _addOverlayToMap( + type: layerType, + source: mapboxglTypes.GeoJSONSourceRaw, + layerID: string, + layerStyle: any, + minzoom: number, + maxzoom: number, + filter?: string + ): void { + const mbglTypeMap = { + POINT: 'circle', + LINE: 'line', + POLYGON: 'fill' + }; + const mbglType = mbglTypeMap[type]; + if (mbglType === 'circle' || mbglType === 'line' || mbglType === 'fill') { + const style: any = { + id: layerID, + type: mbglType, + source: source, + paint: layerStyle.style, + layout: layerStyle.layout || {}, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22 + }; + if (filter) { + style.filter = filter; + } + this._addLayer(style); + } + } + + private _addBaselayer( + url: Array, + layerID: string, + visibility = true, + minzoom = 0, + maxzoom = 22, + isIserver = false, + bounds? + ): void { + const source: mapboxglTypes.RasterSource = { + type: 'raster', + tiles: url, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22, + tileSize: isIserver ? this.rasterTileSize : 256, + // @ts-ignore + rasterSource: isIserver ? 'iserver' : '', + // @ts-ignore + prjCoordSys: + isIserver && !this.isOnlineBaseLayer(url[0], this.baseProjection) && +this.baseProjection.split(':')[1] > 0 + ? { epsgCode: this.baseProjection.split(':')[1] } + : '', + proxy: this.baseLayerProxy + }; + if (bounds) { + source.bounds = bounds; + } + this._addLayer({ + id: layerID, + type: 'raster', + source: source, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22, + layout: { + visibility: visibility ? 'visible' : 'none' + } + }); + this.baseLayerProxy = null; + } + + /** + * @private + * @function WebMapViewModel.prototype._addStrokeLineForPoly + * @description 添加面的边框。 + * @param {Object} style - mabgl style + */ + private _addStrokeLineForPoly( + style: any, + source: any, + layerID: string, + visible: boolean, + minzoom: number, + maxzoom: number + ): void { + const lineStyle = { + style: this._transformStyleToMapBoxGl(style, 'LINE'), + layout: { + visibility: visible + } + }; + this._addOverlayToMap('LINE', source, layerID, lineStyle, minzoom, maxzoom); + } + + private _initLegendConfigInfo(layerInfo: any, style: any): void { + const legendItem = { + layerId: layerInfo.layerID, + layerTitle: layerInfo.layerID, + themeField: layerInfo.layerType === 'HEAT' ? layerInfo.themeSetting.weight : layerInfo.themeSetting.themeField, + styleGroup: style + }; + + const commonStyleGroupMapping = (styleGroup, layerInfo) => { + let newStyleGroup = { + style: { + shape: this._getShape(layerInfo.featureType), + type: this._getType(styleGroup.style.type) + } + }; + this._addProps(newStyleGroup, styleGroup); + return newStyleGroup; + }; + + switch (layerInfo.layerType) { + case 'UNIQUE': + legendItem.styleGroup = legendItem.styleGroup.map(styleGroup => { + return { + fieldValue: styleGroup.value, + ...commonStyleGroupMapping(styleGroup, layerInfo) + }; + }); + break; + case 'RANGE': + case 'RANK_SYMBOL': + legendItem.styleGroup = legendItem.styleGroup.map(styleGroup => { + const newStyleGroup = { + start: styleGroup.start, + end: styleGroup.end, + ...commonStyleGroupMapping(styleGroup, layerInfo) + }; + if (layerInfo.layerType === 'RANGE' && layerInfo.integerType) { + Object.assign(newStyleGroup, { + integerType: layerInfo.integerType + }); + } + return newStyleGroup; + }); + break; + case 'HEAT': + legendItem.styleGroup = [ + { + style: { + shape: 'POINT', + type: 'style', + colors: this._heatColorToGradient(legendItem.styleGroup) + } + } + ]; + break; + default: + break; + } + this._legendList.push(legendItem); + } + + _heatColorToGradient(colors = []) { + const colorList = []; + colors.forEach((color, index) => { + if (index > 5 && index % 2 === 0) { + colorList.push({ + value: color, + key: index === 6 ? 0 : colors[index - 1] + }); + } + }); + return colorList; + } + + _getType(type) { + return ['IMAGE_POINT', 'SVG_POINT'].includes(type) ? 'image' : 'style'; + } + + _getShape(shape) { + return shape === 'POLYGON' ? 'FILL' : shape; + } + + _addProps(newStyleGroup, styleGroup) { + if (newStyleGroup.style.shape === 'POINT') { + Object.assign(newStyleGroup.style, { + color: styleGroup.style.fillColor || styleGroup.color, + opacity: styleGroup.style.fillOpacity, + fontSize: styleGroup.radius * 2 || styleGroup.style.fontSize || '14px' + }); + if (newStyleGroup.style.type === 'image') { + Object.assign(newStyleGroup.style, { + url: styleGroup.style.imageInfo?.url || styleGroup.style.url + }); + return; + } + if (styleGroup.style.className) { + Object.assign(newStyleGroup.style, { + icon: styleGroup.style.className + }); + return; + } + } + if (newStyleGroup.style.shape === 'LINE') { + Object.assign(newStyleGroup.style, { + width: 20, + lineStyles: [ + { + color: styleGroup.color, + lineDash: [], + lineOffset: 0, + lineWidth: 2, + opacity: styleGroup.style.strokeOpacity || 1 + } + ] + }); + return; + } + if (newStyleGroup.style.shape === 'FILL') { + Object.assign(newStyleGroup.style, { + backgroundColor: styleGroup.style.fillColor || styleGroup.color, + opacity: styleGroup.style.fillOpacity, + outlineColor: styleGroup.style.strokeColor, + width: 20, + height: 20 + }); + } + } + + _createMvtLayer(info, layerInfo, featureType) { + const style = this._getDataVectorTileStyle(featureType); + const paint = this._transformStyleToMapBoxGl(style, featureType); + let url = info.url + '/tileFeature.mvt'; + const origin = mapboxgl.CRS.get(this.baseProjection).getOrigin(); + const { minzoom, maxzoom } = layerInfo; + url += `?&returnAttributes=true&width=512&height=512&x={x}&y={y}&scale={scale}&origin={x:${origin[0]},y:${origin[1]}}`; + this._addLayer({ + id: layerInfo.layerID, + // @ts-ignore + type: style.mbglType, + source: { + type: 'vector', + tiles: [url], + proxy: this.webMapService.handleProxy('image') + }, + 'source-layer': `${info.datasetName}@${info.datasourceName}`, + paint, + layout: { + visibility: layerInfo.visible ? 'visible' : 'none' + }, + minzoom: minzoom || 0, + maxzoom: maxzoom || 22 + }); + this._addLayerSucceeded(); + } + + _getDataVectorTileStyle(featureType) { + const styleParameters = { + radius: 8, // 圆点半径 + fillColor: '#EE4D5A', // 填充色 + fillOpacity: 0.9, + strokeColor: '#ffffff', // 边框颜色 + strokeWidth: 1, + strokeOpacity: 1, + lineDash: 'solid', + type: 'BASIC_POINT', + mbglType: 'circle' + }; + if (['LINE', 'LINESTRING', 'MULTILINESTRING'].includes(featureType)) { + styleParameters.strokeColor = '#4CC8A3'; + styleParameters.strokeWidth = 2; + styleParameters.mbglType = 'line'; + } else if (['REGION', 'POLYGON', 'MULTIPOLYGON'].includes(featureType)) { + styleParameters.fillColor = '#826DBA'; + styleParameters.mbglType = 'fill'; + } + return styleParameters; + } + + _unproject(point: [number, number], isReverse = true): [number, number] { + const sourceProjection = this._unprojectProjection || this.baseProjection; + if (sourceProjection === 'EPSG:4326') { + return point; + } + // @ts-ignore + const coor = proj4(sourceProjection, 'EPSG:4326', point); + const proj = proj4.defs(sourceProjection); + if (isReverse && proj.axis && proj.axis.indexOf('ne') === 0) { + coor.reverse(); + } + return coor; + } + + private _getMapCenter(mapInfo) { + // center + let center: [number, number] | mapboxglTypes.LngLat; + center = mapInfo.center && [mapInfo.center.x, mapInfo.center.y]; + + if (!center) { + center = [0, 0]; + } + center = this._unproject(center, false); + center = new mapboxgl.LngLat(center[0], center[1]); + + return center; + } + + private _getLabelFontFamily(mapInfo) { + const fonts: string[] = []; + const layers = mapInfo.layers; + // 获取 label 图层字体类型 + if (layers && layers.length > 0) { + layers.forEach(layer => { + layer.labelStyle && fonts.push(layer.labelStyle.fontFamily); + }, this); + } + fonts.push('supermapol-icons'); + const fontFamilys: string = fonts.join(','); + + return fontFamilys; + } + + private _getTiandituUrl(mapInfo: any): { tiandituUrl: Array; labelUrl: Array } { + const re = /t0/gi; + type urlArr = Array; + const tiandituUrls: { tiandituUrl: urlArr; labelUrl: urlArr } = { tiandituUrl: [], labelUrl: [] }; + + const layerType = mapInfo.baseLayer.layerType.split('_')[1].toLowerCase(); + const isLabel = Boolean(mapInfo.baseLayer.labelLayerVisible); + const token = this.tiandituKey || mapInfo.baseLayer.tk; + let url = `https://t0.tianditu.gov.cn/{layer}_{proj}/wmts?tk=${token}`; + let labelUrl = url; + + const layerLabelMap = { + vec: 'cva', + ter: 'cta', + img: 'cia' + }; + + const tilematrixSet = this.baseProjection === 'EPSG:4326' ? 'c' : 'w'; + const options = { + service: 'WMTS', + request: 'GetTile', + style: 'default', + version: '1.0.0', + layer: layerType, + tilematrixSet: tilematrixSet, + format: 'tiles', + width: 256, + height: 256 + }; + + url += this._getParamString(options, url) + '&tilematrix={z}&tilerow={y}&tilecol={x}'; + + const tiandituUrl = url.replace('{layer}', layerType).replace('{proj}', tilematrixSet); + const tiandituUrlArr: string[] = []; + + for (let i = 0; i < 8; i++) { + tiandituUrlArr.push(tiandituUrl.replace(re, `t${i}`)); + } + tiandituUrls.tiandituUrl = tiandituUrlArr; + + // 如果有 label 图层 + if (isLabel) { + const labelLayer = layerLabelMap[layerType]; + options.layer = labelLayer; + labelUrl += this._getParamString(options, labelUrl) + '&tilematrix={z}&tilerow={y}&tilecol={x}'; + labelUrl = labelUrl.replace('{layer}', labelLayer).replace('{proj}', tilematrixSet); + const labelUrlArr = []; + for (let i = 0; i < 8; i++) { + labelUrlArr.push(labelUrl.replace(re, `t${i}`)); + } + tiandituUrls.labelUrl = labelUrlArr; + } + + return tiandituUrls; + } + + private _defineProj4(projection: string, defaultEpsgCode?) { + let epsgCode = projection; + let epsgValue: string; + if (!projection.split(':')[1]) { + if (defaultEpsgCode && defaultEpsgCode.split(':')[1]) { + epsgCode = defaultEpsgCode; + } else { + epsgCode = toEpsgCode(projection); + } + epsgValue = projection; + } + const defaultValue = getProjection(epsgCode); + const defValue = epsgValue || defaultValue; + + if (!defValue) { + console.error(`${epsgCode} not define`); + } else { + !proj4.defs(epsgCode) && proj4.defs(epsgCode, defValue); + !defaultValue && registerProjection(epsgCode, defValue); + } + return epsgCode; + } + + private _fetchRequest(url: any, type: string, options: Object) { + return SuperMap.FetchRequest.get(url, null, options) + .then(response => { + return response[type](); + }) + .then(results => { + return results; + }) + .catch(error => { + console.log(error); + }); + } + + private getEpsgCodeWKT(projectionUrl, options) { + if (!projectionUrl) { + return; + } + return this._fetchRequest(projectionUrl, 'text', options); + } + + private getBounds(baseUrl, options) { + if (!baseUrl) { + return; + } + return this._fetchRequest(baseUrl, 'json', options); + } + + private _addLayer(layerInfo) { + const { id } = layerInfo; + layerInfo = Object.assign(layerInfo, { id }); + + if (this.map.getLayer(id)) { + if (this.checkSameLayer && this._isSameRasterLayer(id, layerInfo)) return; + this._updateLayer(layerInfo); + return; + } + this.map.addLayer(layerInfo); + } + + private _isSameRasterLayer(id, layerInfo) { + const { + source: { type, tiles } + } = layerInfo; + if (type === 'raster') { + const source = this.map.getSource(id); + if ( + type === source.type && + tiles && + // @ts-ignore + source.tiles && + // @ts-ignore + tiles[0] === source.tiles[0] + ) { + return true; + } + } + return false; + } + + clean() { + if (this.map) { + this.stopCanvg(); + this.map = null; + this._legendList = []; + this._sourceListModel = null; + this.center = null; + this.zoom = null; + this._appreciableLayers = []; + this._dataflowService && + this._dataflowService.off('messageSucceeded', this._handleDataflowFeaturesCallback) && + this._dataflowService.off('subscribesucceeded', this._initDataflowLayerCallback); + this._unprojectProjection = null; + } + if (this._layerTimerList.length) { + this._layerTimerList.forEach(timer => { + clearInterval(timer); + }); + this._layerTimerList = []; + } + } + + cleanWebMap() { + this.clean(); + } + + private centerValid(center) { + if ( + center && + ((<[number, number]>center).length > 0 || + typeof center === mapboxgl.LngLat || + (<{ lng: number; lat: number }>center).lng) + ) { + return true; + } + return false; + } + + private _getResolution(bounds, tileSize = 512.0) { + if (bounds.leftBottom && bounds.rightTop) { + return Math.max(bounds.rightTop.x - bounds.leftBottom.x, bounds.rightTop.y - bounds.leftBottom.y) / tileSize; + } + return Math.max(bounds[2] - bounds[0], bounds[3] - bounds[1]) / tileSize; + } + + private _transformScaleToZoom(scale, crs?) { + // @ts-ignore + const extent = (crs || this.map.getCRS()).getExtent(); + // @ts-ignore + const unit = (crs || this.map.getCRS()).unit; + const scaleBase = 1.0 / SuperMap.Util.getScaleFromResolutionDpi((extent[2] - extent[0]) / 512, 96, unit); + const scaleDenominator = scale.split(':')[1]; + return Math.min(24, +Math.log2(scaleBase / +scaleDenominator).toFixed(2)); + } + + private _updateLayer(layerInfo) { + const { + id, + paint, + source: { type, tiles, data, proxy } + } = layerInfo; + const source = this.map.getSource(id); + if (source) { + if (type === 'geojson' || source.type === 'geojson') { + Object.keys(paint).forEach(name => { + this.map.setPaintProperty(id, name, paint[name]); + }); + // @ts-ignore + data && source.setData(data); + } else if (type === 'raster') { + this._updateRasterSource(id, { proxy, tiles }); + } + } + } + + _updateRasterSource(sourceId, options) { + if (!sourceId) { + return; + } + const source = this.map.getSource(sourceId); + + Object.assign(source, options); + // @ts-ignore + this.map.style.sourceCaches[sourceId].clearTiles(); + // @ts-ignore + this.map.style.sourceCaches[sourceId].update(this.map.transform); + // @ts-ignore + this.map.triggerRepaint(); + } + + updateOverlayLayer(layerInfo: any, features: any, mergeByField?: string) { + // @ts-ignore + const originLayerInfo = this._mapInfo.layers.find(layer => { + return layer.layerID === layerInfo.layerID; + }); + if (features) { + this._initOverlayLayer(originLayerInfo, features, mergeByField); + } else { + const type = this.webMapService.getDatasourceType(originLayerInfo); + this.getLayerFeatures(originLayerInfo, this._taskID, type); + } + } + + isOnlineBaseLayer(url, projection) { + return ( + url.startsWith('https://maptiles.supermapol.com/iserver/services/map_China/rest/maps/China_Dark') && + projection === 'EPSG:3857' + ); + } + + _triggerEvent(name: string, params?: any) { + this.triggerEvent(name, params); + this._parentEvents[name]?.(params); + } +} diff --git a/src/mapboxgl/web-map/WebMapViewModel.ts b/src/mapboxgl/web-map/WebMapViewModel.ts index b112028c..688c351a 100644 --- a/src/mapboxgl/web-map/WebMapViewModel.ts +++ b/src/mapboxgl/web-map/WebMapViewModel.ts @@ -1,20 +1,17 @@ /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html. */ +import { Events } from 'vue-iclient/src/common/_types/event/Events'; import mapboxgl from 'vue-iclient/static/libs/mapboxgl/mapbox-gl-enhance'; import SourceListModel from 'vue-iclient/src/mapboxgl/web-map/SourceListModel'; -import { handleMultyPolygon } from 'vue-iclient/src/mapboxgl/_utils/geometry-util'; +import LayerListModel from 'vue-iclient/src/mapboxgl/web-map/LayerListModel'; import 'vue-iclient/static/libs/iclient-mapboxgl/iclient-mapboxgl.min'; import 'vue-iclient/static/libs/geostats/geostats'; import 'vue-iclient/static/libs/json-sql/jsonsql'; -import echarts from 'echarts'; -import EchartsLayer from 'vue-iclient/static/libs/echarts-layer/EchartsLayer'; -import cloneDeep from 'lodash.clonedeep'; -import { geti18n } from 'vue-iclient/src/common/_lang/index'; -import WebMapBase from 'vue-iclient/src/common/web-map/WebMapBase'; -import { getColorWithOpacity } from 'vue-iclient/src/common/_utils/util'; -import { getProjection, registerProjection, toEpsgCode } from 'vue-iclient/src/common/_utils/epsg-define'; -import proj4 from 'proj4'; +import { toEpsgCode } from 'vue-iclient/src/common/_utils/epsg-define'; +import WebMapService from '../../common/_utils/WebMapService'; +import WebMapV2 from './WebMapV2'; +import iPortalDataService from 'vue-iclient/src/common/_utils/iPortalDataService'; const WORLD_WIDTH = 360; // 迁徙图最大支持要素数量 @@ -73,9 +70,7 @@ interface mapOptions { crs: string; } -type layerType = 'POINT' | 'LINE' | 'POLYGON'; - -export default class WebMapViewModel extends WebMapBase { +export default class WebMapViewModel extends Events { map: mapboxglTypes.Map; center: [number, number] | mapboxglTypes.LngLatLike | { lon: number; lat: number } | number[]; @@ -84,32 +79,45 @@ export default class WebMapViewModel extends WebMapBase { renderWorldCopies: boolean; - bearing: number; + proxy: string | boolean; - pitch: number; + mapOptions: any; - rasterTileSize: number; + options: any; layerFilter: Function; baseLayerProxy: string | boolean; - private _sourceListModel: SourceListModel; + mapId: string | number | Object; + + webMapInfo: any; + + serverUrl: string; + + zoom: number; + + target: string; + + mapParams: { title?: string; description?: string }; + + withCredentials: boolean; - private _legendList: any; - private _handleDataflowFeaturesCallback: Function; + baseProjection: string; - private _initDataflowLayerCallback: Function; + protected _taskID: Date; - private _dataflowService: any; + private _sourceListModel: SourceListModel; - private _unprojectProjection: string; + private _layerListModel: LayerListModel; private _cacheLayerId: Array = []; - private _layerTimerList: Array = []; + private _appreciableLayers: Array = []; + + private _handler: InstanceType; - private checkSameLayer: boolean; + protected webMapService: WebMapService; constructor( id: string | number | Object, @@ -121,7 +129,9 @@ export default class WebMapViewModel extends WebMapBase { return true; } ) { - super(id, options, mapOptions); + super(); + this.serverUrl = options.serverUrl || 'https://www.supermapol.com'; + this.proxy = options.proxy; if (typeof id === 'string' || typeof id === 'number') { this.mapId = id; } else if (id !== null && typeof id === 'object') { @@ -131,18 +141,25 @@ export default class WebMapViewModel extends WebMapBase { mapOptions.center = [0, 0]; mapOptions.zoom = 0; } - if (this.centerValid(mapOptions.center)) { - this.center = mapOptions.center; - } - this.zoom = mapOptions.zoom; this.bounds = mapOptions.bounds; - this.bearing = mapOptions.bearing; - this.pitch = mapOptions.pitch; + this.target = options.target || 'map'; + this.options = options; this.renderWorldCopies = mapOptions.renderWorldCopies; - this.rasterTileSize = mapOptions.rasterTileSize || 256; this.layerFilter = layerFilter; - this.checkSameLayer = options.checkSameLayer; - this._legendList = {}; + this._appreciableLayers = []; + this.webMapService = new WebMapService(id, options); + this.mapOptions = mapOptions; + this.eventTypes = [ + 'getmapinfofailed', + 'crsnotsupport', + 'getlayerdatasourcefailed', + 'addlayerssucceeded', + 'notsupportmvt', + 'notsupportbaidumap', + 'projectionIsNotMatch', + 'beforeremovemap', + 'mapinitialized' + ]; if (map) { this.map = map; this._taskID = new Date(); @@ -154,7 +171,7 @@ export default class WebMapViewModel extends WebMapBase { public resize(keepBounds = false): void { this.map && this.map.resize(); - this.echartsLayerResize(); + this._handler?.echartsLayerResize?.(); const mapContainerStyle = window.getComputedStyle(document.getElementById(this.target)); if (keepBounds && this.map && this.bounds && mapContainerStyle) { const zoom = this._getResizedZoom(this.bounds, mapContainerStyle); @@ -243,14 +260,24 @@ export default class WebMapViewModel extends WebMapBase { Object.keys(sources).forEach(sourceId => { // @ts-ignore if (sources[sourceId].type === 'raster' && sources[sourceId].rasterSource === 'iserver') { - this._updateRasterSource(sourceId, { tileSize }); + this._handler._updateRasterSource?.(sourceId, { tileSize }); } }); } } + public getAppreciableLayers() { + // @ts-ignore + return this._appreciableLayers; + } + + public getLegendInfo() { + return this._handler?.getLegendInfo() ?? []; + } + protected cleanLayers() { this._taskID = null; + // TODO 应该遍历的是可感知图层的渲染图层 this._cacheLayerId.forEach(layerId => { if (this.map && this.map.getLayer(layerId)) { this.map.removeLayer(layerId); @@ -264,758 +291,309 @@ export default class WebMapViewModel extends WebMapBase { this._cacheLayerId = []; } - get getSourceListModel(): SourceListModel { - return this._sourceListModel; - } - - _initWebMap(): void { - this.initWebMap(); - } - - _loadLayers(mapInfo, _taskID): void { - if (this.map) { - // @ts-ignore - if (this.map.getCRS().epsgCode !== this.baseProjection && !this.ignoreBaseProjection) { - this.triggerEvent('projectionIsNotMatch', {}); - return; - } - this._handleLayerInfo(mapInfo, _taskID); - } else { - this._createMap(mapInfo); - this.map.on('load', () => { - this._handleLayerInfo(mapInfo, _taskID); - }); - } - } - - _setCRS(baseProjection, wkt, bounds): void { - const crs = new mapboxgl.CRS( - baseProjection, - wkt, - bounds, - bounds[2] > 180 ? 'meter' : 'degree' - ); - mapboxgl.CRS.set(crs); - } - - _getMapInfo(mapInfo, _taskID): void { - const { projection } = mapInfo; - let bounds, wkt; - this.baseProjection = toEpsgCode(projection); - let defaultWktValue = getProjection(this.baseProjection); - - if (defaultWktValue) { - wkt = defaultWktValue; - } - if (!mapboxgl.CRS.get(this.baseProjection)) { - if (mapInfo.baseLayer && mapInfo.baseLayer.layerType === 'MAPBOXSTYLE') { - let url = mapInfo.baseLayer.dataSource.url; - if (url.indexOf('/restjsr/') > -1 && !/\/style\.json$/.test(url)) { - url += '/style.json'; - } - this.webMapService.getMapBoxStyle(url).then((res: any) => { - if (res && res.metadata && res.metadata.indexbounds) { - bounds = res.metadata.indexbounds; - } else { - bounds = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y]; - } - this._defineProj4(projection); - this._setCRS(this.baseProjection, wkt, bounds); - this._loadLayers(mapInfo, _taskID); - }); - } else if (mapInfo.baseLayer && mapInfo.baseLayer.layerType === 'TILE') { - // 获取地图的wkt - this.getEpsgCodeWKT(`${mapInfo.baseLayer.url}/prjCoordSys.wkt`, { - withoutFormatSuffix: true, - withCredentials: this.webMapService.handleWithCredentials('', mapInfo.baseLayer.url, false) - }).then(res => { - if (!wkt) { - wkt = res; + public getLayerDatas(layerName) { + if (this._layerListModel) { + const dataId = this.getDatasetIdByLayerId(layerName); + if (!dataId) return []; + let promise = new Promise((resolve, reject) => { + const dataService = new iPortalDataService('', this.withCredentials, { dataId, dataType: 'STRUCTUREDDATA' }); + dataService.on({ + getdatafailed: e => { + reject(e); + }, + getdatasucceeded: e => { + resolve(e.features); } - this.getBounds(`${mapInfo.baseLayer.url}.json`, { - withoutFormatSuffix: true, - withCredentials: this.webMapService.handleWithCredentials('', mapInfo.baseLayer.url, false) - }).then(res => { - if (res && res.bounds) { - bounds = [res.bounds.leftBottom.x, res.bounds.leftBottom.y, res.bounds.rightTop.x, res.bounds.rightTop.y]; - } else { - bounds = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y]; - } - this._defineProj4(wkt, projection); - this._setCRS(this.baseProjection, wkt, bounds); - this._loadLayers(mapInfo, _taskID); - }); }); - } else { - // this._defineProj4(projection); - // this._loadLayers(mapInfo, _taskID); - throw Error(geti18n().t('webmap.crsNotSupport')); - } - } else { - this._defineProj4(projection); - bounds = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y]; - this._setCRS(this.baseProjection, wkt, bounds); - this._loadLayers(mapInfo, _taskID); - } - } - - _handleLayerInfo(mapInfo, _taskID): void { - mapInfo = this._setLayerID(mapInfo); - this._layers = []; - this.layerAdded = 0; - this.expectLayerLen = 0; - const { layers, grid } = mapInfo; - this._setExpectLayerLen(mapInfo); - if (this.expectLayerLen === 0) { - this._sendMapToUser(0, 0); - } - if (this._shouldLoadBaseLayer(mapInfo, this.layerFilter)) { - this._initBaseLayer(mapInfo, () => { - this._addLayerSucceeded(); + dataService.getData({}); }); - } - if (layers && layers.length !== 0) { - this._initOverlayLayers(this._layers, _taskID); - } - if (grid && grid.graticule) { - this._initGraticuleLayer(grid.graticule); + return promise; + } else { + // @ts-ignore + return Promise.resolve(this.map.getSource(layerName).getData().features); } } - _setExpectLayerLen(mapInfo) { - if (this._shouldLoadBaseLayer(mapInfo, this.layerFilter)) { - this.expectLayerLen++; - } - let overLayers = mapInfo.layers; - if (overLayers && overLayers.length > 0) { - if (typeof this.layerFilter === 'function') { - overLayers = overLayers.filter(this.layerFilter); - } - this.expectLayerLen += overLayers.length; - this._layers = overLayers; - } + public getDatasetIdByLayerId(layerName) { + const matchLayer = this._appreciableLayers.find(layer => layer.layerID === layerName); + return matchLayer?.dataSource?.serverId; } - _shouldLoadBaseLayer(mapInfo, layerFilter) { - const baseLayer = mapInfo.baseLayer; - if (!baseLayer) { - return false; - } - if (typeof layerFilter === 'function') { - return layerFilter(baseLayer); - } - return true; + public getLayerList() { + return this._layerListModel ? this._layerListModel.getLayerCatalog() : this._sourceListModel?.getSourceList(); } - _createMap(mapInfo?): void { - if (!mapInfo) { - this.mapOptions.container = this.target; - if (this.mapOptions.crs && this.mapOptions.crs.epsgCode) { - this.mapOptions.crs = new mapboxgl.CRS( - this.mapOptions.crs.epsgCode, - this.mapOptions.crs.WKT, - this.mapOptions.crs.extent, - this.mapOptions.crs.unit - ); - } - if (!this.mapOptions.transformRequest) { - this.mapOptions.transformRequest = (url: string, resourceType: string) => { - let proxy = ''; - if (typeof this.proxy === 'string') { - let proxyType = 'data'; - if (resourceType === 'Tile') { - proxyType = 'image'; - } - proxy = this.webMapService.handleProxy(proxyType); - } - return { - url: proxy ? `${proxy}${encodeURIComponent(url)}` : url, - credentials: this.webMapService.handleWithCredentials(proxy, url, this.withCredentials || false) - ? 'include' - : 'omit' - }; - }; - } - setTimeout(() => { - let fadeDuration = 0; - if (Object.prototype.hasOwnProperty.call(this.mapOptions, 'fadeDuration')) { - fadeDuration = this.mapOptions.fadeDuration; - } - this.map = new mapboxgl.Map({ ...this.mapOptions, fadeDuration }); - this.map.on('load', () => { - this.triggerEvent('addlayerssucceeded', { - map: this.map, - mapparams: {}, - layers: [] - }); - }); - }, 0); - - return; - } - // 获取字体样式 - const fontFamilys: string = this._getLabelFontFamily(mapInfo); - const center = this._getMapCenter(mapInfo); - // zoom - let zoom = mapInfo.level || 0; - let zoomBase = 0; - let { bounds, minZoom, maxZoom } = this.mapOptions; - const interactive = this.mapOptions.interactive; - if (isNaN(minZoom)) { - minZoom = mapInfo.minScale - ? this._transformScaleToZoom(mapInfo.minScale, mapboxgl.CRS.get(this.baseProjection)) - : 0; - } - if (isNaN(maxZoom)) { - maxZoom = mapInfo.maxScale - ? this._transformScaleToZoom(mapInfo.maxScale, mapboxgl.CRS.get(this.baseProjection)) - : 22; - } - if (mapInfo.visibleExtent && mapInfo.visibleExtent.length === 4 && !bounds) { - bounds = [ - this._unproject([mapInfo.visibleExtent[0], mapInfo.visibleExtent[1]]), - this._unproject([mapInfo.visibleExtent[2], mapInfo.visibleExtent[3]]) - ]; - } - if (minZoom > maxZoom) { - [minZoom, maxZoom] = [maxZoom, minZoom]; + public getFlatLayers(layers) { + if (!layers) { + layers = this.getLayerList(); } - if (!bounds) { - if (mapInfo.minScale && mapInfo.maxScale) { - zoomBase = Math.min( - this._transformScaleToZoom(mapInfo.minScale, mapboxgl.CRS.get(this.baseProjection)), - this._transformScaleToZoom(mapInfo.maxScale, mapboxgl.CRS.get(this.baseProjection)) - ); + let flatLayers = []; + layers.forEach(layer => { + if (layer.children) { + flatLayers = flatLayers.concat(this.getFlatLayers(layer.children)); } else { - zoomBase = +Math.log2( - this._getResolution(mapboxgl.CRS.get(this.baseProjection).getExtent()) / this._getResolution(mapInfo.extent) - ).toFixed(2); + flatLayers.push(layer); } - zoom += zoomBase; - } - - // 初始化 map - this.map = new mapboxgl.Map({ - ...this.mapOptions, - container: this.target, - center: this.center || center, - zoom: this.zoom || zoom, - minZoom, - maxZoom, - bearing: this.bearing || 0, - pitch: this.pitch || 0, - bounds, - interactive: interactive === void 0 ? true : interactive, - style: { - version: 8, - sources: {}, - layers: [] - }, - // @ts-ignore fix-crs - crs: this.baseProjection, - localIdeographFontFamily: fontFamilys || '', - renderWorldCopies: this.renderWorldCopies || false, - transformRequest: (url, resourceType) => { - if (resourceType === 'Tile') { - if (this.isSuperMapOnline && url.indexOf('http://') === 0) { - url = `https://www.supermapol.com/apps/viewer/getUrlResource.png?url=${encodeURIComponent(url)}`; - } - if (this.webMapService.isIportalResourceUrl(url)) { - url = this.webMapService.handleParentRes(url); - } - const proxy = this.webMapService.handleProxy('image'); - return { - url: url, - credentials: this.webMapService.handleWithCredentials(proxy, url, false) ? 'include' : 'omit' - }; - } - return { url }; - }, - fadeDuration: 0 }); - /** - * @description Map 初始化成功。 - */ - this.triggerEvent('mapinitialized', { map: this.map }); + return flatLayers; } - private _createMVTBaseLayer(layerInfo, addedCallback?: Function) { - let url = layerInfo.dataSource.url; - if (url.indexOf('/restjsr/') > -1 && !/\/style\.json$/.test(url)) { - url += '/style.json'; + public changeItemVisible(item) { + const model = this._layerListModel || this._sourceListModel; + // 当前操作的图层/图层组的上级图层组为显示状态,才修改其显隐 + const parentVisible = model.getGroupVisible(this.getLayerList(), item); + if (!parentVisible) { + return; } - this.webMapService - // @ts-ignore - .getMapBoxStyle(url) - .then( - (style: any) => { - // @ts-ignore - this.map.addStyle(style); - addedCallback && addedCallback(); - }, - error => { - addedCallback && addedCallback(); - throw new Error(error); - } - ) - .catch(error => { - /** - * @event WebMapViewModel#getmapinfofailed - * @description 获取地图信息失败。 - * @property {Object} error - 失败原因。 - */ - this.triggerEvent('getmapinfofailed', { error }); - }); - } - - _initBaseLayer(mapInfo: any, addedCallback?: Function): void { - const layerInfo = mapInfo.baseLayer || mapInfo; - const layerType = this.getBaseLayerType(layerInfo); - const mapUrls = this.getMapurls(); - let url: string; - this.baseLayerProxy = this.webMapService.handleProxy('image'); - - switch (layerType) { - case 'TIANDITU': - this.baseLayerProxy = null; - this._createTiandituLayer(mapInfo, addedCallback); - break; - case 'BING': - this.baseLayerProxy = null; - this._createBingLayer(layerInfo.layerID || layerInfo.name, layerInfo, addedCallback); - break; - case 'WMS': - this._createWMSLayer(layerInfo, addedCallback); - break; - case 'WMTS': - this._createWMTSLayer(layerInfo, addedCallback); - break; - case 'TILE': - this._createDynamicTiledLayer(layerInfo, addedCallback); - break; - case 'CLOUD': - case 'XYZ': - url = mapUrls[layerInfo.layerType] - .replace('{googleMapsLanguage}', this.googleMapsLanguage) - .replace('{googleMapsAPIKey}', this.googleMapsAPIKey); - this._createXYZLayer(layerInfo, url, addedCallback); - break; - case 'BAIDU': - this.triggerEvent('notsupportbaidumap', {}); - addedCallback && addedCallback(); - break; - case 'MAPBOXSTYLE': - this._createMVTBaseLayer(layerInfo, addedCallback); // 添加矢量瓦片服务作为底图 - break; + const visibility = item.visible ? 'none' : 'visible'; + if (item.type === 'group') { + const targetLayers = model.getGroupChildrenLayers(item.children); + this.updateLayersVisible(targetLayers, visibility); + } else { + this.updateLayersVisible([item], visibility); } } - _initOverlayLayers(layers: any, _taskID: any): void { - // 存储地图上所有的图层对象 - if (this.expectLayerLen > 0) { - layers.forEach(layer => { - const type = this.webMapService.getDatasourceType(layer); - // TODO --- 暂不支持 SAMPLE_DATA - if (type === 'SAMPLE_DATA') { - this._addLayerSucceeded(); - this.triggerEvent('getlayerdatasourcefailed', { - error: 'SAMPLE DATA is not supported', - layer, - map: this.map - }); - return; - } - - if (layer.visibleScale) { - const { minScale, maxScale } = layer.visibleScale; - layer.minzoom = Math.max(this._transformScaleToZoom(minScale), 0); - layer.maxzoom = Math.min(24, this._transformScaleToZoom(maxScale) + 0.0000001); - } - - if (type === 'tile') { - this._initBaseLayer(layer, () => { - this._addLayerSucceeded(); - }); - if (layer.autoUpdateTime) { - this._layerTimerList.push( - setInterval(() => { - this._initBaseLayer(layer); - }, layer.autoUpdateTime) - ); - } - } else { - this.getLayerFeatures(layer, _taskID, type); - if (layer.autoUpdateTime) { - this._layerTimerList.push( - setInterval(() => { - this.getLayerFeatures(layer, _taskID, type); - }, layer.autoUpdateTime) - ); - } - } - }, this); - } + updateLayersVisible(layers, visibility) { + layers.forEach(layer => { + this.map.setLayoutProperty(layer.id, 'visibility', visibility); + }); } - _initOverlayLayer(layerInfo: any, features: any = [], mergeByField?: string) { - const { layerID, layerType, visible, style, featureType, labelStyle, projection } = layerInfo; - layerInfo.visible = visible ? 'visible' : 'none'; - features = this.mergeFeatures(layerID, features, mergeByField); - if (layerType === 'restMap') { - this._createRestMapLayer(features, layerInfo); + protected initWebMap() { + this.clean(); + this.serverUrl = this.serverUrl && this.webMapService.handleServerUrl(this.serverUrl); + if (this.webMapInfo) { + // 传入是webmap对象 + const mapInfo = this.webMapInfo; + mapInfo.mapParams = { + title: this.webMapInfo.title, + description: this.webMapInfo.description + }; + this.mapParams = mapInfo.mapParams; + this._getMapInfo(mapInfo); return; - } - if (layerType === 'mvt') { - this._createMvtLayer(features.info, layerInfo, features.featureType); + } else if (!this.mapId || !this.serverUrl) { + this._createMap(); return; } + this._taskID = new Date(); + this.getMapInfo(this._taskID); + } - // mbgl 目前不能处理 geojson 复杂面情况 - // mbgl isssue https://github.com/mapbox/mapbox-gl-js/issues/7023 - if (features && features[0] && features[0].geometry && features[0].geometry.type === 'Polygon') { - features = handleMultyPolygon(features); - } - - if ( - features && - projection && - (projection !== this.baseProjection || projection === 'EPSG:3857' || projection === 'EPSG:-1000') && - layerInfo.dataSource && - layerInfo.dataSource.type !== 'REST_DATA' - ) { - this._unprojectProjection = this._defineProj4(projection); - features = this.transformFeatures(features); - } - - features = this.handleLayerFeatures(features, layerInfo); - - if (layerType === 'VECTOR') { - if (featureType === 'POINT') { - if (style.type === 'SYMBOL_POINT') { - this._createSymbolLayer(layerInfo, features); - } else { - this._createGraphicLayer(layerInfo, features); - } - } else { - // 线和面 - this._createVectorLayer(layerInfo, features); - // 不在 _createVectorLayer 里面处理 layerAdded++ 的原因:_createDataflowLayer 也调用了_createVectorLayer ,会导致layerAdded > expectLayerLen - this._addLayerSucceeded(); + public setZoom(zoom) { + if (this.map) { + this.mapOptions.zoom = zoom; + if (zoom !== +this.map.getZoom().toFixed(2)) { + (zoom || zoom === 0) && this.map.setZoom(zoom, { from: 'setZoom' }); } - } else if (layerType === 'UNIQUE') { - this._createUniqueLayer(layerInfo, features); - } else if (layerType === 'RANGE') { - this._createRangeLayer(layerInfo, features); - } else if (layerType === 'HEAT') { - this._createHeatLayer(layerInfo, features); - } else if (layerType === 'MARKER') { - this._createMarkerLayer(layerInfo, features); - } else if (layerType === 'MIGRATION') { - this._createMigrationLayer(layerInfo, features); - } else if (layerType === 'RANK_SYMBOL') { - this._createRankSymbolLayer(layerInfo, features); - } else if (layerType === 'DATAFLOW_POINT_TRACK' || layerType === 'DATAFLOW_HEAT') { - this._createDataflowLayer(layerInfo); - } - if (labelStyle && labelStyle.labelField && layerType !== 'DATAFLOW_POINT_TRACK') { - // 存在标签专题图 - this._addLabelLayer(layerInfo, features, false); } } - _initGraticuleLayer(graticuleInfo: any) { - const options = this._createGraticuleOptions(graticuleInfo); - const graticuleLayers = new mapboxgl.supermap.GraticuleLayer(options); - this.map.addLayer(graticuleLayers); - this._setGraticuleDash(graticuleInfo.lineDash, graticuleLayers); + public setServerUrl(serverUrl: string): void { + this.serverUrl = serverUrl; + this.webMapService.setServerUrl(serverUrl); } - private _createGraticuleOptions(graticuleInfo) { - let { extent, lonLabelStyle, latLabelStyle } = graticuleInfo; - const { strokeColor, lineDash, strokeWidth, interval } = graticuleInfo; - const strokeStyle = { - lineColor: strokeColor, - lindDasharray: lineDash, - lineWidth: strokeWidth - }; - lonLabelStyle = { - textFont: lonLabelStyle.fontFamily.split(','), - textSize: lonLabelStyle.fontSize, - textAnchor: latLabelStyle.textBaseline, - textColor: lonLabelStyle.fill, - textHaloColor: lonLabelStyle.outlineColor, - textHaloWidth: lonLabelStyle.outlineWidth - }; - latLabelStyle = { - textFont: latLabelStyle.fontFamily.split(','), - textSize: latLabelStyle.fontSize, - textAnchor: latLabelStyle.textBaseline, - textColor: latLabelStyle.fill, - textHaloColor: latLabelStyle.outlineColor, - textHaloWidth: latLabelStyle.outlineWidth - }; - // @ts-ignore - extent = extent || this.map.getCRS().extent; - extent = [this._unproject([extent[0], extent[1]]), this._unproject([extent[2], extent[3]])]; - return { - minZoom: 1, - strokeStyle, - extent, - interval: interval && interval[0], - lngLabelStyle: lonLabelStyle, - latLabelStyle - }; + public setWithCredentials(withCredentials) { + this.withCredentials = withCredentials; + this.webMapService.setWithCredentials(withCredentials); } - private _setGraticuleDash(lindDasharray, graticuleLayers) { - this.map.on('zoomend', () => { - if (this.map.getZoom() < 3) { - graticuleLayers.setStrokeStyle({ lindDasharray: [0.1, 3] }); - } else { - graticuleLayers.setStrokeStyle({ lindDasharray }); - } - }); + public setProxy(proxy) { + this.proxy = proxy; + this.webMapService.setProxy(proxy); } - private _createTiandituLayer(mapInfo: any, addedCallback?: Function): void { - const tiandituUrls = this._getTiandituUrl(mapInfo); - const { labelLayerVisible, name, visible } = mapInfo.baseLayer; - const isLabel = Boolean(labelLayerVisible); - const labelUrl = tiandituUrls.labelUrl; - const tiandituUrl = tiandituUrls.tiandituUrl; - this._addBaselayer(tiandituUrl, name, visible); - isLabel && this._addBaselayer(labelUrl, `${name}-label`, visible); - addedCallback && addedCallback(); + public setMapId(mapId: string | number): void { + if (typeof mapId === 'string' || typeof mapId === 'number') { + this.mapId = mapId; + this.webMapInfo = null; + } else if (mapId !== null && typeof mapId === 'object') { + this.webMapInfo = mapId; + } + this.webMapService.setMapId(mapId); + if (!mapId) { + return; + } + setTimeout(() => { + this._initWebMap(); + }, 0); } - private _createWMTSLayer(layerInfo, addedCallback?: Function): void { + protected getMapInfo(_taskID) { + this.serverUrl = this.serverUrl && this.webMapService.handleServerUrl(this.serverUrl); this.webMapService - // @ts-ignore - .getWmtsInfo(layerInfo, this.map.getCRS().epsgCode) + .getMapInfo() .then( - (result: any) => { - const layerId = layerInfo.layerID || layerInfo.name; - if (result.isMatched) { - const wmtsUrl = this._getWMTSUrl(Object.assign({}, layerInfo, result)); - this._addBaselayer([wmtsUrl], layerId, layerInfo.visible, result.matchMinZoom, result.matchMaxZoom, false, result.bounds); - addedCallback && addedCallback(); + (mapInfo: any) => { + if (this._taskID !== _taskID) { + return; } + // 存储地图的名称以及描述等信息,返回给用户 + this.mapParams = mapInfo.mapParams; + this._getMapInfo(mapInfo, _taskID); }, error => { - addedCallback && addedCallback(); - throw new Error(error); + throw error; } ) .catch(error => { - /** - * @event WebMapViewModel#getmapinfofailed - * @description 获取地图信息失败。 - * @property {Object} error - 失败原因。 - */ this.triggerEvent('getmapinfofailed', { error }); + console.log(error); }); } - private _createBingLayer(layerName: string, layerInfo: any, addedCallback?: Function): void { - const bingUrl = - 'https://dynamic.t0.tiles.ditu.live.com/comp/ch/{quadkey}?it=G,TW,L,LA&mkt=zh-cn&og=109&cstl=w4c&ur=CN&n=z'; - // @ts-ignore - this._addBaselayer([bingUrl], layerName, layerInfo.visible); - addedCallback && addedCallback(); - } - - private _createXYZLayer(layerInfo: any, url: string, addedCallback?: Function): void { - let urlArr: string[] = []; - - if (layerInfo.layerType === 'OSM') { - const res = url.match(/\w\-\w/g)[0]; - const start = res[0]; - const end = res[2]; - let alphabet = ''; - for (let i = 97; i < 123; i++) { - alphabet += String.fromCharCode(i); - } - const alphabetArr = alphabet.split(''); - - const startIndex = alphabetArr.indexOf(start); - const endIndex = alphabetArr.indexOf(end); - - const res3 = alphabetArr.slice(startIndex, endIndex + 1); - - for (let i = 0; i < res3.length; i++) { - const replaceRes = url.replace(/{\w\-\w}/g, res3[i]); - urlArr.push(replaceRes); - } - } else if (layerInfo.layerType === 'GOOGLE_CN') { - const res = url.match(/\d\-\d/g)[0]; - const start = parseInt(res[0]); - const end = parseInt(res[2]); - - for (let i = start; i <= end; i++) { - const replaceRes = url.replace(/{\d\-\d}/g, i.toString()); - urlArr.push(replaceRes); - } - } else { - urlArr = [url]; - } - const layerId = layerInfo.layerID || layerInfo.name; - this._addBaselayer(urlArr, layerId, layerInfo.visible); - addedCallback && addedCallback(); + get getSourceListModel(): SourceListModel { + return this._sourceListModel; } - private _createDynamicTiledLayer(layerInfo: any, addedCallback?: Function): void { - const url = layerInfo.url; - const layerId = layerInfo.layerID || layerInfo.name; - const { minzoom, maxzoom } = layerInfo; - this._addBaselayer([url], layerId, layerInfo.visible, minzoom, maxzoom, true); - addedCallback && addedCallback(); + _initWebMap(): void { + this.initWebMap(); } - private _createWMSLayer(layerInfo: any, addedCallback?: Function): void { - this.webMapService - // @ts-ignore - .getWmsInfo(layerInfo) - .then( - (result: any) => { - const layerId = layerInfo.layerID || layerInfo.name; - if (result) { - const wmsUrl = this._getWMSUrl(layerInfo, result.version); - this._addBaselayer([wmsUrl], layerId, layerInfo.visible); - addedCallback && addedCallback(); + _createWebMapV2(mapInfo) { + this.baseProjection = toEpsgCode(mapInfo.crs); + const webMapHandler = new WebMapV2( + this.mapId, + { + ...this.options, + iportalServiceProxyUrlPrefix: this.webMapService.iportalServiceProxyUrl, + serverUrl: this.serverUrl, + withCredentials: this.withCredentials, + target: this.target, + mapInfo, + parentEvents: { + ...this.eventTypes.reduce((events, name) => { + events[name] = (params) => { + this.triggerEvent(name, params); + }; + return events; + }, {}), + mapinitialized: ({ map }) => { + this.map = map; + this.triggerEvent('mapinitialized', { map: this.map }); + }, + addlayerssucceeded: ({ mapparams, map, sourceListModel, layers }) => { + this.mapParams = mapparams; + this._sourceListModel = sourceListModel; + this._appreciableLayers = layers; + this._cacheLayerId.push(...layers.map(layer => layer.id)); + this.triggerEvent('addlayerssucceeded', { + map: map, + mapparams: this.mapParams + }); } - }, - error => { - addedCallback && addedCallback(); - throw new Error(error); } - ) - .catch(error => { - /** - * @event WebMapViewModel#getmapinfofailed - * @description 获取地图信息失败。 - * @property {Object} error - 失败原因。 - */ - this.triggerEvent('getmapinfofailed', { error }); - }); + }, + this.mapOptions, + this.map, + this.layerFilter + ); + return webMapHandler; } - private _createVectorLayer(layerInfo: any, features: any): void { - const type = layerInfo.featureType; - const { layerID, minzoom, maxzoom, style, visible } = layerInfo; - const layerSource = this.map.getSource(layerID); - const sourceData: GeoJSON.FeatureCollection = { - type: 'FeatureCollection', - features: features - }; - if (!layerSource) { - const source: mapboxglTypes.GeoJSONSourceRaw = { - type: 'geojson', - data: sourceData - }; - this.map.addSource(layerID, source); - } else { - // @ts-ignore - layerSource.setData(sourceData); - } - const styleArr = Array.isArray(style) ? style : [style]; - if (styleArr.length === 2) { - // 道路 - if (styleArr[0].lineDash === 'solid' && styleArr[1].lineDash === 'solid') { - styleArr[0].strokeWidth = styleArr[1].strokeWidth; - styleArr[1].strokeWidth = styleArr[1].strokeWidth - 2; - } - // 铁路 - if (styleArr[0].lineDash === 'solid' && styleArr[1].lineDash === 'dash') { - styleArr[0].strokeWidth = styleArr[1].strokeWidth; - styleArr[1].strokeWidth = styleArr[1].strokeWidth * 0.5; - styleArr[1].lineDash = 'dashrailway'; - } + _createMap() { + this.mapOptions.container = this.target; + if (this.mapOptions.crs && this.mapOptions.crs.epsgCode) { + this.mapOptions.crs = new mapboxgl.CRS( + this.mapOptions.crs.epsgCode, + this.mapOptions.crs.WKT, + this.mapOptions.crs.extent, + this.mapOptions.crs.unit + ); } - styleArr.forEach((element, index) => { - const layerStyle = { - style: this._transformStyleToMapBoxGl(element, type), - layout: { - visibility: visible + if (!this.mapOptions.transformRequest) { + this.mapOptions.transformRequest = (url: string, resourceType: string) => { + let proxy = ''; + if (typeof this.proxy === 'string') { + let proxyType = 'data'; + if (resourceType === 'Tile') { + proxyType = 'image'; + } + proxy = this.webMapService.handleProxy(proxyType); } + return { + url: proxy ? `${proxy}${encodeURIComponent(url)}` : url, + credentials: this.webMapService.handleWithCredentials(proxy, url, this.withCredentials || false) + ? 'include' + : 'omit' + }; }; - const newLayerID = index === 0 ? layerID : `${layerID}-additional-${index}`; - this._addOverlayToMap(type, layerID, newLayerID, layerStyle, minzoom, maxzoom); - }); - // 如果面有边框 - type === 'POLYGON' && - style.strokeColor && - this._addStrokeLineForPoly(style, layerID, layerID + '-strokeLine', visible, minzoom, maxzoom); + } + setTimeout(() => { + let fadeDuration = 0; + if (Object.prototype.hasOwnProperty.call(this.mapOptions, 'fadeDuration')) { + fadeDuration = this.mapOptions.fadeDuration; + } + this.map = new mapboxgl.Map({ ...this.mapOptions, fadeDuration }); + this.map.on('load', () => { + this._sourceListModel = new SourceListModel({ + map: this.map + }); + this.triggerEvent('addlayerssucceeded', { + map: this.map, + mapparams: {}, + layers: [] + }); + }); + }, 0); } - private _getWMSUrl(mapInfo: any, version = '1.1.1'): string { - let url = mapInfo.url; - const options: any = { - service: 'WMS', - request: 'GetMap', - layers: - mapInfo.layers !== null && typeof mapInfo.layers === 'object' - ? mapInfo.layers.join(',') - : mapInfo.layers || '0', // 如果是多个图层,用逗号分隔 - styles: '', - format: 'image/png', - transparent: 'true', - version, - width: 256, - height: 256 - }; - if (version === '1.3.0') { - options.bbox = this.baseProjection === 'EPSG:4326' ? '{bbox-wms-1.3.0}' : '{bbox-epsg-3857}'; - options.crs = this.baseProjection; - } else { - options.bbox = '{bbox-epsg-3857}'; - options.srs = this.baseProjection; - } - return SuperMap.Util.urlAppend(url, this._getParamString(options, url)); + _createWebMapV3(mapInfo: any) { + this.baseProjection = toEpsgCode(mapInfo.crs); + const webMapHandler = new mapboxgl.supermap.WebMapV3( + this.mapId, + { + server: this.serverUrl, + withCredentials: this.withCredentials, + target: this.target + }, + this.mapOptions + ); + this._registerV3Events(webMapHandler, mapInfo); + webMapHandler.initializeMap( + { + ...mapInfo, + layers: typeof this.layerFilter === 'function' ? mapInfo.layers.filter(this.layerFilter) : mapInfo.layers + }, + this.map + ); + return webMapHandler; } - private _setLayerID(mapInfo): Array { - const sumInfo: Object = {}; - const { baseLayer, layers = [] } = mapInfo; - if (!this.checkSameLayer) { - const baseInfo = this._generateUniqueLayerId(baseLayer.name, 0); - baseLayer.name = baseInfo.newId; + _registerV3Events(webMapHandler, mapInfo): void { + if (!webMapHandler) { + return; } - const layerNames = layers.map(layer => layer.name); - const _layers: Array = layers.map((layer, index) => { - if (!(layer.name in sumInfo)) { - sumInfo[layer.name] = baseLayer.name === layer.name ? 1 : 0; - } - const matchFirstIndex = layerNames.indexOf(layer.name); - const matchLastIndex = layerNames.lastIndexOf(layer.name); - if (index > matchFirstIndex && index <= matchLastIndex) { - sumInfo[layer.name] = sumInfo[layer.name] + 1; - } - let layerID = sumInfo[layer.name] ? `${layer.name}-${sumInfo[layer.name]}` : layer.name; - if (!this.checkSameLayer || layer.layerType !== 'raster') { - const { newId, newIndex } = this._generateUniqueLayerId(layerID, sumInfo[layer.name]); - sumInfo[layer.name] = newIndex; - layerID = newId; - } - return Object.assign(layer, { layerID }); + webMapHandler.on('mapinitialized', ({ map }) => { + this.map = map; + this.triggerEvent('mapinitialized', { map: this.map }); + }); + webMapHandler.on('addlayerssucceeded', ({ mapparams, layers }) => { + this.mapParams = mapparams; + this._appreciableLayers = layers; + this._layerListModel = new LayerListModel({ + map: this.map, + layerCatalog: mapInfo.metadata.layerCatalog + }); + this._cacheLayerId.push(...layers.map(layer => layer.id)); + this.triggerEvent('addlayerssucceeded', { + map: this.map, + mapparams: this.mapParams + }); + }); + webMapHandler.on('getlayerresourcesfailed', () => { + console.error('map add images failed.'); + }); + webMapHandler.on('projectionisnotmatch', () => { + console.error('projection is not match'); }); - mapInfo.layers = _layers; - mapInfo.baseLayer = baseLayer; - return mapInfo; } - private _generateUniqueLayerId(newId, index) { - if (this.map.getLayer(newId)) { - index++; - // 判断是否带有-index后缀 - if (newId.match(/-\d+&/gi)) { - newId = newId.replace(/\d+$/gi, index); - } else { - newId = `${newId}-${index}`; - } - return this._generateUniqueLayerId(newId, index); - } else { - return { newId, newIndex: index }; - } + _getMapInfo(mapInfo, _taskID?) { + this._handler = + +mapInfo.version.split('.')[0] === 3 ? this._createWebMapV3(mapInfo) : this._createWebMapV2(mapInfo); } private _getResizedZoom(bounds, mapContainerStyle, tileSize = 512, worldWidth = WORLD_WIDTH) { @@ -1034,1863 +612,50 @@ export default class WebMapViewModel extends WebMapBase { return (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (point * Math.PI) / 360)); } - _createRestMapLayer(restMaps, layer) { - restMaps.forEach(restMapInfo => { - layer = this.getRestMapLayerInfo(restMapInfo, layer); - this._initBaseLayer(layer); - }); - this._addLayerSucceeded(); - } - - _addLayerSucceeded() { - this.layerAdded++; - this._sendMapToUser(this.layerAdded, this.expectLayerLen); - } - - private _createDataflowLayer(layerInfo) { - const dataflowService = new mapboxgl.supermap.DataFlowService(layerInfo.wsUrl).initSubscribe(); - this._handleDataflowFeaturesCallback = this._handleDataflowFeatures.bind(this, layerInfo); - this._initDataflowLayerCallback = this._initDataflowLayer.bind(this, layerInfo); - dataflowService.on('subscribesucceeded', this._initDataflowLayerCallback); - dataflowService.on('messageSucceeded', this._handleDataflowFeaturesCallback); - this._dataflowService = dataflowService; - } - - private _initDataflowLayer() { - this._addLayerSucceeded(); + public setLayersVisible(isShow, ignoreIds) { + const show = isShow ? 'visible' : 'none'; + if (this._cacheLayerId.length) { + this._cacheLayerId.forEach(layerId => { + if ((ignoreIds && !ignoreIds.includes(layerId)) || !ignoreIds) { + this.map.setLayoutProperty(layerId, 'visibility', show); + } + }); + } } - private _handleDataflowFeatures(layerInfo, e) { - let features = [JSON.parse(e.data)]; - // this.transformFeatures([features]); // TODO 坐标系 - this.triggerEvent('dataflowfeatureupdated', { - features, - identifyField: layerInfo.identifyField, - layerID: layerInfo.layerID - }); - - if (layerInfo.projection === 'EPSG:3857') { - features = this.transformFeatures(features); - } - if (layerInfo.filterCondition) { - // 过滤条件 - let condition = this.replaceFilterCharacter(layerInfo.filterCondition); - const properties = features[0].properties || {}; - condition = this.parseCondition(condition, Object.keys(properties)); - const filterFeature = this.parseConditionFeature(properties); - const sql = 'select * from json where (' + condition + ')'; - const filterResult = window.jsonsql.query(sql, { attributes: filterFeature }); - if (filterResult && filterResult.length > 0) { - this._addDataflowLayer(layerInfo, features[0]); + clean() { + this._handler?.clean(); + if (this.map) { + this.triggerEvent('beforeremovemap', {}); + this.map.remove(); + this.map = null; + this._sourceListModel = null; + this._layerListModel = null; + this._appreciableLayers = []; + if (this.mapOptions) { + this.mapOptions.zoom = null; + this.mapOptions.center = null; } - } else { - this._addDataflowLayer(layerInfo, features[0]); } } - private _getDataFlowRotateStyle(features, directionField, identifyField) { - const iconRotateExpression = ['match', ['get', identifyField]]; - features.forEach(feature => { - let value; - if (directionField !== undefined && directionField !== '未设置' && directionField !== 'None') { - value = feature.properties[directionField]; - } else { - value = 0; - } - if (value > 360 || value < 0) { - return null; - } - // @ts-ignore - iconRotateExpression.push(feature.properties[identifyField], parseInt(value)); - }); - // @ts-ignore - iconRotateExpression.push(0); - return iconRotateExpression; + cleanWebMap() { + this.clean(); } - private _addDataflowLayer(layerInfo, feature) { - const layerID = layerInfo.layerID; - if (layerInfo.layerType === 'DATAFLOW_HEAT') { - if (!this.map.getSource(layerID)) { - this._createHeatLayer(layerInfo, [feature], false); - } else { - this._updateDataFlowFeature(layerID, feature, layerInfo); - } - } else { - const layerStyle = layerInfo.pointStyle; - layerInfo.style = layerStyle; - if (!this.map.getSource(layerID)) { - const iconRotateExpression = this._getDataFlowRotateStyle( - [feature], - layerInfo.directionField, - layerInfo.identifyField - ); - if (['BASIC_POINT', 'SVG_POINT', 'IMAGE_POINT'].includes(layerStyle.type)) { - this._createGraphicLayer(layerInfo, [feature], null, iconRotateExpression, false); - } else { - this._createSymbolLayer(layerInfo, [feature], null, iconRotateExpression, false); - } - } else { - this._updateDataFlowFeature(layerID, feature, layerInfo, 'point'); - } - if (layerInfo.labelStyle && layerInfo.visible) { - if (!this.map.getSource(layerID + '-label')) { - this._addLabelLayer(layerInfo, [feature], true); - } else { - this._updateDataFlowFeature(layerID + '-label', feature, layerInfo); - } - } - if (layerInfo.lineStyle && layerInfo.visible) { - if (!this.map.getSource(layerID + '-line')) { - const geometry = feature.geometry.coordinates; - const lineFeature = { - type: 'Feature', - properties: feature.properties, - geometry: { - type: 'LineString', - coordinates: [geometry] - } - }; - this._createVectorLayer( - { style: layerInfo.lineStyle, featureType: 'LINE', visible: 'visible', layerID: layerID + '-line' }, - [lineFeature] - ); - } else { - this._updateDataFlowFeature(layerID + '-line', feature, layerInfo, 'line'); - } - } - } - } - - private _updateDataFlowFeature(sourceID, newFeature, layerInfo, type?) { - const { identifyField, maxPointCount, directionField } = layerInfo; - // @ts-ignore - const features = cloneDeep(this.map.getSource(sourceID)._data.features); - let has = false; - features.map((item, index) => { - if (item.properties[identifyField] === newFeature.properties[identifyField]) { - has = true; - if (type === 'line') { - const coordinates = item.geometry.coordinates; - coordinates.push(newFeature.geometry.coordinates); - if (maxPointCount && coordinates.length > maxPointCount) { - coordinates.splice(0, coordinates.length - maxPointCount); - } - features[index].geometry.coordinates = coordinates; - } else { - features[index] = newFeature; - } - } - }); - if (!has) { - if (type === 'line') { - features.push({ - type: 'Feature', - properties: newFeature.properties, - geometry: { - type: 'LineString', - coordinates: [newFeature.geometry.coordinates] - } - }); - } else { - features.push(newFeature); - } - } - // @ts-ignore - this.map.getSource(sourceID).setData({ type: 'FeatureCollection', features }); - if (type === 'point') { - const type = layerInfo.pointStyle.type; - const iconRotateExpression = this._getDataFlowRotateStyle(features, directionField, identifyField); - if (['SVG_POINT', 'IMAGE_POINT'].includes(type)) { - this.map.setLayoutProperty(sourceID, 'icon-rotate', iconRotateExpression); - } else if (type === 'SYMBOL_POINT') { - this.map.setLayoutProperty(sourceID, 'text-rotate', iconRotateExpression); - } - } - } - - private _createMigrationLayer(layerInfo, features) { - // @ts-ignore - window.echarts = echarts; - const options = this.getEchartsLayerOptions(layerInfo, features, 'GLMap'); - // @ts-ignore - options.GLMap = { roam: true }; - const echartslayer = new EchartsLayer(this.map); - echartslayer.chart.setOption(options); - this.echartslayer.push(echartslayer); - this._addLayerSucceeded(); - } - - private _createRankSymbolLayer(layerInfo, features) { - const { minzoom, maxzoom } = layerInfo; - const fieldName = layerInfo.themeSetting.themeField; - const colors = layerInfo.themeSetting.colors; - const style = layerInfo.style; - const featureType = layerInfo.featureType; - const styleSource: any = this.createRankStyleSource(layerInfo, features); - const styleGroups = styleSource.styleGroups; - features = this.getFilterFeatures(layerInfo.filterCondition, features); - // 获取 expression - const expression = ['match', ['get', 'index']]; - const colorExpression = ['match', ['get', 'index']]; - for (let index = 0; index < features.length; index++) { - const row = features[index]; - const tartget = parseFloat(row.properties[fieldName]); - if (styleGroups) { - for (let i = 0; i < styleGroups.length; i++) { - if (styleGroups[i].start <= tartget && tartget < styleGroups[i].end) { - const radius = - style.type === 'SYMBOL_POINT' || style.type === 'IMAGE_POINT' - ? style.type === 'SYMBOL_POINT' - ? styleGroups[i].radius * 2 - : Number.parseFloat((styleGroups[i].radius / style.imageInfo.size.h).toFixed(2)) * 2 - : styleGroups[i].radius; - expression.push(row.properties.index, radius); - colorExpression.push(row.properties.index, styleGroups[i].color); - break; - } - } - } - } - // @ts-ignore - expression.push(1); - colorExpression.push('rgba(0, 0, 0, 0)'); - // 图例处理 - this._initLegendConfigInfo(layerInfo, styleGroups); - if (colors && colors.length > 0) { - style.fillColor = colorExpression; - } - if (style.type === 'SYMBOL_POINT') { - this._createSymbolLayer(layerInfo, features, expression); - } else if (['SVG_POINT', 'IMAGE_POINT'].includes(style.type)) { - this._createGraphicLayer(layerInfo, features, expression); - } else { - const source: mapboxglTypes.GeoJSONSourceRaw = { - type: 'geojson', - data: { - type: 'FeatureCollection', - features: features - } - }; - // 获取样式 - const layerStyle: any = { - layout: { - visibility: layerInfo.visible - } - }; - layerStyle.style = this._transformStyleToMapBoxGl(layerInfo.style, featureType, expression, 'circle-radius'); - const layerID = layerInfo.layerID; - this._addOverlayToMap(featureType, source, layerID, layerStyle, minzoom, maxzoom); - this._addLayerSucceeded(); - } - } - - private _addTextBackgroundImage(rgba: Array): string { - if (!rgba[3]) { - return ''; - } - const width = 20; // The image will be 64 pixels square. - const bytesPerPixel = 4; // Each pixel is represented by 4 bytes: red, green, blue, and alpha. - const data = new Uint8Array(width * width * bytesPerPixel); - - for (let x = 0; x < width; x++) { - for (let y = 0; y < width; y++) { - const offset = (y * width + x) * bytesPerPixel; - data[offset + 0] = rgba[0]; // red - data[offset + 1] = rgba[1]; // green - data[offset + 2] = rgba[2]; // blue - data[offset + 3] = rgba[3] * 255; // alpha - } - } - const imageId = `text-background-${rgba.join('-')}`; - if (!this.map.hasImage(imageId)) { - this.map.addImage( - imageId, - { width: width, height: width, data: data }, - { - // @ts-ignore - stretchX: [[0, 20]], - stretchY: [[0, 20]], - content: [0, 0, 20, 20] - } - ); - } - return imageId; - } - - private _addLabelLayer(layerInfo: any, features: any, addSource = false): void { - const labelStyle = layerInfo.labelStyle; - let { backgroundFill } = labelStyle; - const fontFamily = labelStyle.fontFamily; - const { minzoom, maxzoom } = layerInfo; - const textSize = parseFloat(labelStyle.fontSize || 14); - let textBackgroundImageId = ''; - if (labelStyle.placement !== 'line') { - textBackgroundImageId = this._addTextBackgroundImage(backgroundFill); - } - backgroundFill = `rgba(${backgroundFill.join(',')})`; - let textHaloColor = 'rgba(255,255,255,0)'; - if (labelStyle.outlineColor && labelStyle.outlineWidth > 0) { - textHaloColor = labelStyle.outlineColor; - } - - let textHaloWidth = (labelStyle.outlineWidth || 0) / 2; - let textAnchor = labelStyle.textAlign || 'center'; - if (labelStyle.textBaseline && labelStyle.textBaseline !== 'middle') { - textAnchor = `${labelStyle.textBaseline}${textAnchor === 'center' ? '' : `-${textAnchor}`}`; - } - - const textOffset = - layerInfo.featureType === 'POINT' - ? [labelStyle.offsetX / textSize || 0, labelStyle.offsetY / textSize || 0] - : [0, 0]; - const layout = { - 'text-field': `{${labelStyle.labelField}}`, - 'text-size': textSize, - 'text-offset': textOffset, - 'text-font': fontFamily ? [fontFamily] : ['DIN Offc Pro Italic', 'Arial Unicode MS Regular'], - 'symbol-placement': - labelStyle.placement === 'line' ? (layerInfo.featureType === 'POLYGON' ? 'line' : 'line-center') : 'point', - 'text-max-angle': layerInfo.featureType === 'POLYGON' ? 40 : 30, - 'symbol-spacing': layerInfo.featureType === 'POLYGON' ? 200 : 50, - 'text-anchor': textAnchor, - 'text-line-height': 1.2, - visibility: layerInfo.visible - }; - if (textBackgroundImageId) { - Object.assign(layout, { - 'icon-image': textBackgroundImageId, - 'icon-allow-overlap': true, - 'icon-text-fit': 'both', - 'icon-text-fit-padding': [2, 4, 2, 4] - }); - } - this._addLayer({ - id: `${layerInfo.layerID}-label`, - type: 'symbol', - source: - this.map.getSource(layerInfo.layerID) && !addSource - ? layerInfo.layerID - : { type: 'geojson', data: { type: 'FeatureCollection', features: features } }, - paint: { - 'text-color': labelStyle.fill, - 'text-halo-color': textHaloColor, - 'text-halo-width': textHaloWidth - }, - layout, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22 - }); - } - - private _createSymbolLayer( - layerInfo: any, - features: any, - textSizeExpresion?, - textRotateExpresion?, - addToMap = true, - filter? - ): void { - // 用来请求symbol_point字体文件 - const target = document.getElementById(`${this.target}`); - target.classList.add('supermapol-icons-map'); - const { layerID, minzoom, maxzoom, style } = layerInfo; - const unicode = style.unicode; - const text = String.fromCharCode(parseInt(unicode.replace(/^&#x/, ''), 16)); - const textSize = - textSizeExpresion || - (Array.isArray(style.fontSize) ? style.fontSize : (style.fontSize && parseFloat(style.fontSize)) || 12); - const rotate = Array.isArray(style.rotation) ? style.rotation : ((style.rotation || 0) * 180) / Math.PI; - if (!this.map.getSource(layerID)) { - this.map.addSource(layerID, { - type: 'geojson', - data: { - type: 'FeatureCollection', - features: [] - } - }); - } - const layerOptions: any = { - id: layerID, - type: 'symbol', - source: layerID, - paint: { - 'text-color': Array.isArray(style.fillColor) - ? style.fillColor - : getColorWithOpacity(style.fillColor, style.fillOpacity), - // 'text-opacity': style.fillOpacity === 0 ? 0.1 : style.fillOpacity, - 'text-halo-color': Array.isArray(style.strokeColor) - ? style.strokeColor - : getColorWithOpacity(style.strokeColor || 'rgba(0,0,0,0)', style.strokeOpacity), - 'text-halo-width': style.strokeWidth || 0 - }, - layout: { - 'text-field': text, - 'text-size': textSize, - 'text-font': ['supermapol-icons'], - 'text-rotate': textRotateExpresion || rotate || 0, - 'text-offset': Array.isArray(style.offsetX) ? style.offsetX : [style.offsetX / 2 || 0, style.offsetY / 2 || 0], - 'text-allow-overlap': true, - visibility: layerInfo.visible - }, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22 - }; - if (filter) { - layerOptions.filter = filter; - } - this._addLayer(layerOptions); - // @ts-ignore - this.map.getSource(layerID).setData({ - type: 'FeatureCollection', - features: features - }); - if (addToMap) { - this._addLayerSucceeded(); - } - } - - private _createGraphicLayer( - layerInfo: any, - features: any, - iconSizeExpression?, - iconRotateExpression?, - addToMap = true, - filter? - ) { - const { layerID, minzoom, maxzoom, style } = layerInfo; - - const source: mapboxglTypes.GeoJSONSourceRaw = { - type: 'geojson', - data: { - type: 'FeatureCollection', - features: features - } - }; - if (!this.map.getSource(layerID)) { - this.map.addSource(layerID, source); - } - const iconID = `imageIcon-${layerID}`; - if (style.type === 'IMAGE_POINT') { - const imageInfo = style.imageInfo; - this.map.loadImage(imageInfo.url, (error, image) => { - if (error) { - console.error(error); - return; - } - const iconSize = Number.parseFloat((style.radius / image.width).toFixed(2)) * 2; - !this.map.hasImage(iconID) && this.map.addImage(iconID, image); - const layerOptions: any = { - id: layerID, - type: 'symbol', - source: layerID, - layout: { - 'icon-image': iconID, - 'icon-anchor': 'bottom-right', - 'icon-size': iconSizeExpression || iconSize, - 'icon-allow-overlap': true, - visibility: layerInfo.visible, - 'icon-offset': [style.offsetX * image.width || 0, style.offsetY * image.height || 0], - 'icon-rotate': iconRotateExpression || ((layerInfo.style.rotation || 0) * 180) / Math.PI - }, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22 - }; - if (filter) { - layerOptions.filter = filter; - } - this._addLayer(layerOptions); - if (addToMap) { - this._addLayerSucceeded(); - } - }); - } else if (style.type === 'SVG_POINT') { - const svgUrl = style.url; - if (!this._svgDiv) { - this._svgDiv = document.createElement('div'); - document.body.appendChild(this._svgDiv); - } - this.getCanvasFromSVG(svgUrl, this._svgDiv, canvas => { - // this.handleSvgColor(style, canvas); - const imgUrl = canvas.toDataURL('img/png'); - imgUrl && - this.map.loadImage(imgUrl, (error, image) => { - if (error) { - console.log(error); - } - const iconSize = Number.parseFloat((style.radius / canvas.width).toFixed(2)) * 2; - if (iconSizeExpression && Array.isArray(iconSizeExpression)) { - iconSizeExpression = iconSizeExpression.map((item, index) => { - if (typeof item === 'number' && index % 2 === 1) { - return (item / canvas.width) * 2; - } - return item; - }); - } - !this.map.hasImage(svgUrl) && this.map.addImage(svgUrl, image, { sdf: true }); - const layerOptions: any = { - id: layerID, - type: 'symbol', - source: layerID, - layout: { - 'icon-image': svgUrl, - 'icon-size': iconSizeExpression || iconSize, - 'icon-anchor': 'bottom-right', - visibility: layerInfo.visible, - 'icon-offset': [style.offsetX * canvas.width || 0, style.offsetY * canvas.height || 0], - 'icon-allow-overlap': true, - 'icon-rotate': iconRotateExpression || ((layerInfo.style.rotation || 0) * 180) / Math.PI - }, - paint: { - 'icon-color': style.fillColor - }, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22 - }; - if (filter) { - layerOptions.filter = filter; - } - this._addLayer(layerOptions); - if (addToMap) { - this._addLayerSucceeded(); - } - }); - }); - } else { - const layerStyle = { - style: this._transformStyleToMapBoxGl(style, layerInfo.featureType), - layout: { - visibility: layerInfo.visible - } - }; - this._addOverlayToMap('POINT', layerID, layerID, layerStyle, minzoom, maxzoom); - if (addToMap) { - this._addLayerSucceeded(); - } - } - } - - private _createUniqueLayer(layerInfo: any, features: any): void { - const symbolConvertFunctionFactory = { - unicode: ({ unicode }): string => { - return String.fromCharCode(parseInt(unicode.replace(/^&#x/, ''), 16)); - }, - fontSize: ({ fontSize }): number => { - if (fontSize) { - return parseFloat(fontSize); - } - return 12; - }, - rotation: ({ rotation }): number => { - return ((rotation || 0) * 180) / Math.PI; - }, - fillColor: ({ fillColor, fillOpacity }): string => { - return getColorWithOpacity(fillColor, fillOpacity); - }, - strokeColor: ({ strokeColor, strokeOpacity }): string => { - return getColorWithOpacity(strokeColor || 'rgba(0,0,0,0)', strokeOpacity); - }, - strokeWidth: ({ strokeWidth }): string => { - return strokeWidth || 0; - }, - offsetX: ({ offsetX, offsetY }): [number, number] => { - return [offsetX / 2 || 0, offsetY / 2 || 0]; - } - }; - const defaultValueFactory = { - unicode: '', - fontSize: 12, - rotation: 0, - strokeColor: 'rgba(0,0,0,0)', - fillColor: 'rgba(0,0,0,0)', - strokeWidth: 0, - offsetX: [0, 0] - }; - const styleGroup = this.getUniqueStyleGroup(layerInfo, features); - features = this.getFilterFeatures(layerInfo.filterCondition, features); - const { layerID, minzoom, maxzoom, style } = layerInfo; - const themeField = styleGroup[0].themeField; - const type = layerInfo.featureType; - - const defultLayerStyle = layerInfo.style; - // 样式expression池 样式key值为webmap的样式key值 - const expressionMap: any = {}; - // 自定义单值值对应的样式 - const customStyleMap = {}; - styleGroup.forEach(style => { - customStyleMap[style.value] = style; - }); - // 遍历要素,判断该要素是不是在自定义单值中,若是在对应样式match expression中增加改要素的索引 - features.forEach(({ properties }) => { - const customStyle = customStyleMap[properties[themeField]]; - if (customStyle) { - const itemStyle = customStyle.style; - for (const key in itemStyle) { - if (Object.prototype.hasOwnProperty.call(itemStyle, key)) { - const itemStyleElement = itemStyle[key]; - if (itemStyleElement !== defultLayerStyle[key]) { - if (!expressionMap[key]) { - expressionMap[key] = ['match', ['get', 'index']]; - } - expressionMap[key].push( - properties.index, - symbolConvertFunctionFactory[key] ? symbolConvertFunctionFactory[key](itemStyle) : itemStyleElement - ); - } - } - } - } - }); - // 给每个expression增加最后一个默认值 - for (const key in expressionMap) { - if (Object.prototype.hasOwnProperty.call(expressionMap, key)) { - const expression = expressionMap[key]; - const defaultStyleItem = defultLayerStyle[key] || defaultValueFactory[key]; - const fn = symbolConvertFunctionFactory[key]; - expression.push( - defaultStyleItem === undefined ? null : (fn && fn({ [key]: defaultStyleItem })) || defaultStyleItem - ); - } - } - // Todo 图例相关 - this._initLegendConfigInfo(layerInfo, styleGroup); - - const source: mapboxglTypes.GeoJSONSourceRaw = { - type: 'geojson', - data: { - type: 'FeatureCollection', - features: features - } - }; - const sourceID = layerID; - if (!this.map.getSource(sourceID)) { - this.map.addSource(sourceID, source); - } else { - // @ts-ignore - this.map.getSource(sourceID).setData(source.data); - } - - const visible = layerInfo.visible; - const layerCreateFcuntion = (type, sourceID, layerID, style, minzoom, maxzoom, filter?) => { - const layerStyle = { - style: this._transformStyleToMapBoxGl({ ...style }, type), - layout: { - visibility: visible - } - }; - this._addOverlayToMap(type, sourceID, layerID, layerStyle, minzoom, maxzoom, filter); - }; - if (['POLYGON', 'LINE'].includes(type)) { - // linedash不能用表达式处理,需用多个图层 - const lineDashExpression = expressionMap.lineDash; - // 非自定义要素过滤表达式 - const defaultFilterExpression: any = ['all']; - let handlerLine = false; - let fristName = ''; - if (lineDashExpression && lineDashExpression.length > 1) { - delete expressionMap.lineDash; - const filterField = lineDashExpression[1]; - const tempLayerID = type === 'POLYGON' ? layerID + '-strokeLine' : layerID; - for (let index = 2; index < lineDashExpression.length - 1; index += 2) { - const filterExpression = ['==', filterField, lineDashExpression[index]]; - defaultFilterExpression.push(['!=', filterField, lineDashExpression[index]]); - const additionalLayerName = `${tempLayerID}-additional-linedasharray-${index / 2}`; - if (!fristName) { - fristName = additionalLayerName; - } - layerCreateFcuntion( - 'LINE', - sourceID, - additionalLayerName, - { ...style, ...expressionMap, lineDash: lineDashExpression[index + 1] }, - minzoom, - maxzoom, - filterExpression - ); - } - if (defaultFilterExpression.length > 1) { - layerCreateFcuntion( - 'LINE', - sourceID, - tempLayerID, - { ...style, ...expressionMap, lineDash: lineDashExpression[lineDashExpression.length] }, - minzoom, - maxzoom, - defaultFilterExpression - ); - } - handlerLine = true; - } - // 没有自定义虚线的情况 - if (type === 'LINE' && !handlerLine) { - layerCreateFcuntion( - 'LINE', - sourceID, - layerID, - { ...style, ...expressionMap }, - minzoom, - maxzoom, - defaultFilterExpression - ); - } - // 面 - if (type === 'POLYGON') { - layerCreateFcuntion('POLYGON', sourceID, layerID, { ...style, ...expressionMap }, minzoom, maxzoom); - if (fristName) { - this.map.moveLayer(layerID, fristName); - } - // 面且没有虚线 - if (!handlerLine) { - layerCreateFcuntion( - 'LINE', - sourceID, - layerID + '-strokeLine', - { ...style, ...expressionMap }, - minzoom, - maxzoom, - defaultFilterExpression - ); - if (fristName) { - this.map.moveLayer(layerID + '-strokeLine', fristName); - } - } - } - } else { - const defaultFilterExpression: any = ['all']; - const unicodeExpression = expressionMap.unicode; - // SYMBOL_POINT - if (unicodeExpression) { - const classNameExpression = expressionMap.className || []; - delete expressionMap.unicode; - delete expressionMap.classname; - const additionalLayerName = `${layerID}-additional-symbol`; - const filterExpression: any = ['any']; - // defaultExpression.push(['!=', filterField, lineDashExpression[index]]); - for (let index = 2; index < classNameExpression.length - 1; index += 2) { - defaultFilterExpression.push(['!=', classNameExpression[1], classNameExpression[index]]); - filterExpression.push(['==', classNameExpression[1], classNameExpression[index]]); - } - // this._createSymbolLayer() - // 用来请求symbol_point字体文件 - const target = document.getElementById(`${this.target}`); - target.classList.add('supermapol-icons-map'); - const symbolStyle = { ...style, ...expressionMap }; - const layerOptions: any = { - id: additionalLayerName, - type: 'symbol', - source: sourceID, - paint: { - 'text-color': symbolStyle.fillColor, - // 'text-opacity': style.fillOpacity === 0 ? 0.1 : style.fillOpacity, - 'text-halo-color': symbolStyle.strokeColor, - 'text-halo-width': symbolStyle.strokeWidth - }, - layout: { - 'text-field': unicodeExpression, - 'text-size': - typeof symbolStyle.fontSize === 'string' ? parseInt(symbolStyle.fontSize) : symbolStyle.fontSize || 12, - 'text-font': ['supermapol-icons'], - 'text-rotate': symbolStyle.rotation || 0, - 'text-offset': Array.isArray(symbolStyle.offsetX) - ? symbolStyle.offsetX - : [symbolStyle.offsetX / 2 || 0, symbolStyle.offsetY / 2 || 0], - 'text-allow-overlap': true, - visibility: visible - }, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22 - }; - if (filterExpression.length > 1) { - layerOptions.filter = filterExpression; - } - this._addLayer(layerOptions); - } - // IMAGE_POINT 或者 SVG_POINT - const imageInfoExpression = expressionMap.imageInfo || []; - const urlExpression = expressionMap.url || []; - if (imageInfoExpression.length > 0 || urlExpression.length > 0) { - delete expressionMap.imageInfo; - delete expressionMap.url; - const imageList = []; - // image表达式 和 过滤表达式 - const imageExpresssion = imageInfoExpression.length > 0 ? [imageInfoExpression[0], imageInfoExpression[1]] : []; - const svgExpresssion = urlExpression.length > 0 ? [urlExpression[0], urlExpression[1]] : []; - const imagefilterExpression: any = ['any']; - const svgfilterExpression: any = ['any']; - for (let index = 2; index < imageInfoExpression.length - 1; index += 2) { - const element = imageInfoExpression[index + 1]; - imageList.push(element.url); - imageExpresssion.push(imageInfoExpression[index]); - imageExpresssion.push(element.url); - defaultFilterExpression.push(['!=', imageInfoExpression[1], imageInfoExpression[index]]); - imagefilterExpression.push(['==', imageInfoExpression[1], imageInfoExpression[index]]); - } - for (let index = 2; index < urlExpression.length - 1; index += 2) { - const element = urlExpression[index + 1]; - imageList.push(element); - svgExpresssion.push(urlExpression[index]); - svgExpresssion.push(element); - defaultFilterExpression.push(['!=', urlExpression[1], urlExpression[index]]); - svgfilterExpression.push(['==', urlExpression[1], urlExpression[index]]); - } - imageExpresssion.push(''); - svgExpresssion.push(''); - - const loadImagePromise = src => { - return new Promise(resolve => { - if (src.indexOf('svg') < 0) { - this.map.loadImage(src, (error, image) => { - if (error) { - console.log(error); - resolve(error); - return; - } - !this.map.hasImage(src) && this.map.addImage(src, image); - resolve({ src, image }); - }); - } else { - if (!this._svgDiv) { - this._svgDiv = document.createElement('div'); - document.body.appendChild(this._svgDiv); - } - this.getCanvasFromSVG(src, this._svgDiv, canvas => { - this.handleSvgColor(defultLayerStyle, canvas); - this.map.loadImage(canvas.toDataURL('img/png'), (error, image) => { - if (error) { - console.log(error); - resolve(error); - return; - } - // sdf: true 可以设置icon-color - !this.map.hasImage(src) && this.map.addImage(src, image, { sdf: true }); - resolve({ src, image }); - }); - }); - } - }); - }; - const promiseList = []; - imageList.forEach(src => { - promiseList.push(loadImagePromise(src)); - }); - const symbolStyle = { ...style, ...expressionMap }; - Promise.all(promiseList).then(images => { - const imageSize = {}; - const radiusMap = {}; - const radiusExpress = expressionMap.radius || []; - for (let index = 2; index < radiusExpress.length - 1; index += 2) { - radiusMap[radiusExpress[index]] = radiusExpress[index + 1]; - } - images.forEach(image => { - if (image && image.src) { - imageSize[image.src] = image.image.width; - } - }); - // icon-color在一个图层中能全起作用或者全不起作用 所以image和svg分两个图层 - // icon-size和图片大小有关系 - if (imageExpresssion.length > 1) { - const iconSizeExpression: any = ['match', ['get', 'index']]; - for (let index = 2; index < imageExpresssion.length - 1; index += 2) { - const featureIndex = imageExpresssion[index]; - const featureSrc = imageExpresssion[index + 1]; - const iconSize = - Number.parseFloat(((radiusMap[featureIndex] || 8) / imageSize[featureSrc]).toFixed(2)) * 2; - iconSizeExpression.push(featureIndex); - iconSizeExpression.push(iconSize); - } - iconSizeExpression.push(1); - - this._addLayer({ - id: `${layerID}-additional-image`, - type: 'symbol', - source: sourceID, - layout: { - 'icon-image': imageExpresssion, - 'icon-anchor': 'bottom-right', - 'icon-size': iconSizeExpression, - 'icon-allow-overlap': true, - visibility: layerInfo.visible, - 'icon-offset': symbolStyle.offsetX || [0, 0], - 'icon-rotate': symbolStyle.rotation || 0 - }, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22, - filter: imagefilterExpression - }); - } - if (svgExpresssion.length > 1) { - const iconSizeExpression: any = ['match', ['get', 'index']]; - for (let index = 2; index < svgExpresssion.length - 1; index += 2) { - const featureIndex = svgExpresssion[index]; - const featureSrc = svgExpresssion[index + 1]; - const iconSize = - Number.parseFloat(((radiusMap[featureIndex] || 8) / imageSize[featureSrc]).toFixed(2)) * 2; - iconSizeExpression.push(featureIndex); - iconSizeExpression.push(iconSize); - } - iconSizeExpression.push(1); - this._addLayer({ - id: `${layerID}-additional-svg`, - type: 'symbol', - source: sourceID, - layout: { - 'icon-image': svgExpresssion, - 'icon-anchor': 'bottom-right', - 'icon-size': 1, - 'icon-allow-overlap': true, - visibility: layerInfo.visible, - 'icon-offset': symbolStyle.offsetX || [0, 0], - 'icon-rotate': symbolStyle.rotation || 0 - }, - paint: { - 'icon-color': symbolStyle.fillColor - }, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22, - filter: svgfilterExpression - }); - } - }); - } - if (style.type === 'SYMBOL_POINT') { - const tmpLayerInfo = { ...layerInfo }; - tmpLayerInfo.style = { ...style, ...expressionMap, type: style.type }; - this._createSymbolLayer( - tmpLayerInfo, - features, - '', - '', - false, - defaultFilterExpression.length > 1 ? defaultFilterExpression : undefined - ); - } else if (style.type === 'IMAGE_POINT' || style.type === 'SVG_POINT') { - const tmpLayerInfo = { ...layerInfo }; - tmpLayerInfo.style = { ...style, ...expressionMap, type: style.type }; - this._createGraphicLayer( - tmpLayerInfo, - features, - '', - '', - false, - defaultFilterExpression.length > 1 ? defaultFilterExpression : undefined - ); - } else { - layerCreateFcuntion( - 'POINT', - sourceID, - layerID, - { ...style, ...expressionMap }, - minzoom, - maxzoom, - defaultFilterExpression.length > 1 ? defaultFilterExpression : undefined - ); - } - } - this._addLayerSucceeded(); - } - - private _getWMTSUrl(options: any): string { - if (options.requestEncoding === 'REST' && options.restResourceURL) { - return options.restResourceURL - .replace('{Style}', options.style || '') - .replace('{TileMatrixSet}', options.tileMatrixSet) - .replace('{TileRow}', '{y}') - .replace('{TileCol}', '{x}') - .replace('{TileMatrix}', '{z}'); - } - const obj = { - service: 'WMTS', - request: 'GetTile', - version: '1.0.0', - style: options.style || '', - layer: options.layer, - tilematrixSet: options.tileMatrixSet, - format: 'image/png', - tilematrix: '{z}', - tilerow: '{y}', - tilecol: '{x}' - }; - return SuperMap.Util.urlAppend(options.kvpResourceUrl, this._getParamString(obj, options.kvpResourceUrl)); - } - - private _createMarkerLayer(layerInfo: any, features: any): void { - const { minzoom, maxzoom } = layerInfo; - const markerLayerID = layerInfo.layerID; - const markerSrc = {}; - features = features || []; - features.forEach((feature: any, index: number) => { - const defaultStyle = feature.dv_v5_markerStyle; - let geomType = feature.geometry.type.toUpperCase(); - if (geomType === 'POINT' && defaultStyle.text) { - // 说明是文字的feature类型 - geomType = 'TEXT'; - } - const layerID = index === 0 ? markerLayerID : markerLayerID + '-' + geomType + '-' + index; - if ( - geomType === 'POINT' && - defaultStyle.src && - defaultStyle.src.indexOf('http://') === -1 && - defaultStyle.src.indexOf('https://') === -1 - ) { - // 说明地址不完整 - defaultStyle.src = this.serverUrl + defaultStyle.src; - } - if (!markerSrc[layerID]) { - markerSrc[layerID] = { - src: defaultStyle.src, - defaultStyle - }; - } - }); - const loadImagePromise = (layerID: string, { src, defaultStyle }) => { - return new Promise(resolve => { - if (!src) { - resolve({ [layerID]: undefined }); - return; - } - if (src.indexOf('svg') < 0 && (src.startsWith('http://') || src.startsWith('https://'))) { - this.map.loadImage(src, (error, image) => { - if (error) { - console.log(error); - resolve(error); - return; - } - !this.map.hasImage(src) && this.map.addImage(src, image); - resolve({ [layerID]: src }); - }); - } else { - if (!this._svgDiv) { - this._svgDiv = document.createElement('div'); - document.body.appendChild(this._svgDiv); - } - this.getCanvasFromSVG(src, this._svgDiv, canvas => { - this.handleSvgColor(defaultStyle, canvas); - const base64Url = canvas.toDataURL('img/png'); - this.map.loadImage(base64Url, (error, image) => { - if (error) { - console.log(error); - resolve(error); - return; - } - const srcUrl = src || base64Url; - !this.map.hasImage(srcUrl) && this.map.addImage(srcUrl, image); - resolve({ [layerID]: srcUrl }); - }); - }); - } - }); - }; - const promiseList = []; - for (const layerID in markerSrc) { - promiseList.push(loadImagePromise(layerID, markerSrc[layerID])); - } - Promise.all(promiseList).then(images => { - for (let i = 0; i < features.length; i++) { - const feature = features[i]; - const defaultStyle = feature.dv_v5_markerStyle; - let geomType = feature.geometry.type.toUpperCase(); - if (geomType === 'POINT' && defaultStyle.text) { - // 说明是文字的feature类型 - geomType = 'TEXT'; - } - const featureInfo = this.setFeatureInfo(feature); - feature.properties.useStyle = defaultStyle; - feature.properties.featureInfo = featureInfo; - - const source: mapboxglTypes.GeoJSONSourceRaw = { - type: 'geojson', - data: feature - }; - const layerID = i === 0 ? markerLayerID : markerLayerID + '-' + geomType + '-' + i; - const iconImageUrl = images[i][layerID]; - // image-marker svg-marker - if (geomType === 'POINT' || geomType === 'TEXT') { - if (!iconImageUrl) { - this._addLayer({ - id: layerID, - type: 'circle', - source: source, - paint: this._transformStyleToMapBoxGl(defaultStyle, geomType), - layout: {}, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22 - }); - continue; - } - this._addLayer({ - id: layerID, - type: 'symbol', - source: source, - layout: { - 'icon-image': iconImageUrl, - 'icon-allow-overlap': true, - 'icon-size': defaultStyle.scale || 1, - visibility: layerInfo.visible - }, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22 - }); - } else { - // line-polygon-marker - const layeStyle: any = { - layout: {} - }; - if (geomType === 'LINESTRING' && defaultStyle.lineCap) { - geomType = 'LINE'; - layeStyle.layout = { - 'line-cap': defaultStyle.lineCap - }; - } - const visible = layerInfo.visible; - layeStyle.layout.visibility = visible; - // get style - layeStyle.style = this._transformStyleToMapBoxGl(defaultStyle, geomType); - this._addOverlayToMap(geomType, source, layerID, layeStyle, minzoom, maxzoom); - // 若面有边框 - geomType === 'POLYGON' && - defaultStyle.strokeColor && - this._addStrokeLineForPoly(defaultStyle, layerID, layerID + '-strokeLine', visible, minzoom, maxzoom); - } - } - this._addLayerSucceeded(); - }); - } - - private _createHeatLayer(layerInfo: any, features: any, addToMap = true): void { - const { minzoom, maxzoom } = layerInfo; - const style = layerInfo.themeSetting; - const layerOption = { - gradient: style.colors.slice(), - radius: parseInt(style.radius) - }; - - // 自定义颜色 - const customSettings = style.customSettings; - for (const i in customSettings) { - layerOption.gradient[i] = customSettings[i]; - } - - const color: string | mapboxglTypes.StyleFunction | mapboxglTypes.Expression = [ - 'interpolate', - ['linear'], - ['heatmap-density'] - ]; - - const step = [0.1, 0.3, 0.5, 0.7, 1]; - layerOption.gradient.forEach((item, index) => { - (color).push(step[index]); - if (index === 0) { - item = mapboxgl.supermap.Util.hexToRgba(item, 0); - } - if (index === 1) { - item = mapboxgl.supermap.Util.hexToRgba(item, 0.5); - } - (color).push(item); - }); - // 图例相关 - this._initLegendConfigInfo(layerInfo, layerOption.gradient); - - const paint: mapboxglTypes.HeatmapPaint = { - 'heatmap-color': color, - 'heatmap-radius': style.radius * 3, - 'heatmap-intensity': 2.8 - }; - - if (style.weight && features.length >= 4) { - const weight = []; - features.forEach(item => { - item.properties[style.weight] = +item.properties[style.weight]; - weight.push(item.properties[style.weight]); - }); - const max = SuperMap.ArrayStatistic.getMax(weight); - const min = SuperMap.ArrayStatistic.getMin(weight); - paint['heatmap-weight'] = ['interpolate', ['linear'], ['get', style.weight], min, 0, max, 1]; - } - this._addLayer({ - id: layerInfo.layerID, - type: 'heatmap', - source: { - type: 'geojson', - data: { - type: 'FeatureCollection', - features: features - } - }, - paint: paint, - layout: { - visibility: layerInfo.visible - }, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22 - }); - if (addToMap) { - this._addLayerSucceeded(); - } - } - - private _createRangeLayer(layerInfo: any, features: any): void { - const fieldName = layerInfo.themeSetting.themeField; - const featureType = layerInfo.featureType; - const { minzoom, maxzoom, style } = layerInfo; - const styleGroups = this.getRangeStyleGroup(layerInfo, features); - - features = this.getFilterFeatures(layerInfo.filterCondition, features); - - // 获取 expression - const expression = ['match', ['get', 'index']]; - const datas = features.filter(row => { - const tartget = parseFloat(row.properties[fieldName]); - if (!tartget && tartget !== 0) { - // expression.push(row.properties['index'], 'rgba(0, 0, 0, 0)'); - return false; - } - if (styleGroups) { - for (let i = 0; i < styleGroups.length; i++) { - const startFlag = styleGroups[i].start <= tartget; - const endFlag = tartget < styleGroups[i].end; - const lastEndFlag = i === styleGroups.length - 1 && tartget === styleGroups[i].end; - if (startFlag && (endFlag || lastEndFlag)) { - expression.push(row.properties.index, styleGroups[i].color); - break; - } - } - } - return true; - }, this); - expression.push('rgba(0, 0, 0, 0)'); - const source: mapboxglTypes.GeoJSONSourceRaw = { - type: 'geojson', - data: { - type: 'FeatureCollection', - features: datas - } - }; - // 图例处理 - this._initLegendConfigInfo(layerInfo, styleGroups); - - // 获取样式 - const layerStyle: any = { - layout: {} - }; - if (featureType === 'LINE' && style.lineCap) { - layerStyle.layout = { - 'line-cap': style.lineCap - }; - } - const visible = layerInfo.visible; - layerStyle.layout.visibility = visible; - layerStyle.style = this._transformStyleToMapBoxGl(style, featureType, expression); - // 添加图层 - const layerID = layerInfo.layerID; - this._addOverlayToMap(featureType, source, layerID, layerStyle, minzoom, maxzoom); - // 如果面有边框 - featureType === 'POLYGON' && - style.strokeColor && - this._addStrokeLineForPoly(style, layerID, layerID + '-strokeLine', visible, minzoom, maxzoom); - this._addLayerSucceeded(); - } - - private _sendMapToUser(count: number, layersLen: number): void { - if (count === layersLen) { - /** - * @event WebMapViewModel#addlayerssucceeded - * @description 添加图层成功。 - * @property {mapboxglTypes.Map} map - MapBoxGL Map 对象。 - * @property {Object} mapparams - 地图信息。 - * @property {string} mapParams.title - 地图标题。 - * @property {string} mapParams.description - 地图描述。 - * @property {Array.} layers - 地图上所有的图层对象。 - */ - - this._sourceListModel = new SourceListModel({ - map: this.map - }); - for (const layerID in this._legendList) { - this._sourceListModel.addSourceStyle(layerID, this._legendList[layerID]); - } - this._rectifyLayersOrder(); - this.triggerEvent('addlayerssucceeded', { - map: this.map, - mapparams: this.mapParams, - layers: this._layers - }); - } - } - - private _moveLayer(layerID, beforLayerId = undefined) { - if (this.map.getLayer(layerID)) { - this.map.moveLayer(layerID, beforLayerId); - return true; + private centerValid(center) { + if ( + center && + ((<[number, number]>center).length > 0 || + typeof center === mapboxgl.LngLat || + (<{ lng: number; lat: number }>center).lng) + ) { + return true; } return false; } - private _rectifyLayersOrder() { - const exsitLayers = this._layers.filter(layer => !!this.map.getLayer(layer.layerID)); - const mapLayers = this.map.getStyle().layers; - for (let index = exsitLayers.length - 1; index > -1; index--) { - const targetlayerId = exsitLayers[index].layerID; - let beforLayerId = exsitLayers[index + 1] ? exsitLayers[index + 1].layerID : undefined; - this._moveLayer(targetlayerId, beforLayerId); - this._moveLayer(`${targetlayerId}-strokeLine`, beforLayerId); - for (let index = 1; index < this.expectLayerLen + 1; index++) { - if (this._moveLayer(`${targetlayerId}-additional-${index}`, beforLayerId)) { - continue; - } else { - break; - } - } - if (mapLayers && mapLayers.length > 0) { - const expandLayers = mapLayers.map(item => item.id.includes(targetlayerId)); - for (let index = 1; index < expandLayers.length; index++) { - if (this._moveLayer(`${targetlayerId}-POINT-${index}`, beforLayerId)) { - continue; - } else if (this._moveLayer(`${targetlayerId}-TEXT-${index}`, beforLayerId)) { - continue; - } else { - break; - } - } - } - this._moveLayer(`${targetlayerId}-label`); - } - } - - private _getParamString(obj: any, existingUrl: string, uppercase = false): string { - const params = []; - for (const i in obj) { - params.push((uppercase ? i.toUpperCase() : i) + '=' + obj[i]); - } - return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&'); - } - - /** - * @private - * @function WebMapViewModel.prototype._transformStyleToMapBoxGl - * @description 根据图层类型将 layerInfo 中的 style 属性格式转换为 mapboxglTypes 中的 style 格式。 - * @param {Object} style - layerInfo中的style属性 - * @param {String} type - 图层类型 - * @param {Array} [expression] - 存储颜色值得表达式 - */ - private _transformStyleToMapBoxGl(style: any, type: layerType, expression?, expressionType?): any { - let transTable = {}; - if ((style.type === 'POINT' || style.type === 'BASIC_POINT' || type === 'POINT') && type !== 'LINE') { - transTable = { - fillColor: 'circle-color', - strokeWidth: 'circle-stroke-width', - fillOpacity: 'circle-opacity', - radius: 'circle-radius', - strokeColor: 'circle-stroke-color', - strokeOpacity: 'circle-stroke-opacity' - }; - } else if (['LINE', 'LINESTRING', 'MULTILINESTRING'].includes(type)) { - transTable = { - strokeWidth: 'line-width', - strokeColor: 'line-color', - strokeOpacity: 'line-opacity' - }; - } else if (['REGION', 'POLYGON', 'MULTIPOLYGON'].includes(type)) { - transTable = { - fillColor: 'fill-color', - fillOpacity: 'fill-opacity' - // strokeColor: 'fill-outline-color' - }; - } - - const newObj = {}; - for (const item in style) { - if (transTable[item]) { - newObj[transTable[item]] = style[item]; - } - } - if (expression) { - if (expressionType) { - newObj[expressionType] = expression; - } else if (newObj['circle-color']) { - newObj['circle-color'] = expression; - } else if (newObj['line-color']) { - newObj['line-color'] = expression; - } else { - newObj['fill-color'] = expression; - } - } - if (style.lineDash && !newObj['line-dasharray']) { - if (Array.isArray(style.lineDash)) { - newObj['line-dasharray'] = style.lineDash; - } else if (style.lineDash !== 'solid' && type === 'LINE') { - newObj['line-dasharray'] = this.getDashStyle(style.lineDash); - } - } - if (style.lineDash && !newObj['circle-translate']) { - if (Array.isArray(style.circleTranslate)) { - newObj['circle-translate'] = style.circleTranslate; - } else if (style.type === 'POINT' || style.type === 'BASIC_POINT' || type === 'POINT') { - const offsetX = style.offsetX || 0; - const offsetY = style.offsetY || 0; - newObj['circle-translate'] = [offsetX * style.radius, offsetY * style.radius]; - } - } - - return newObj; - } - - /** - * @private - * @function WebMapViewModel.prototype._addOverlayToMap - * @description 添加基础矢量图层到 MAP - * @param {Object} style - mabgl style - * @param {String} type - 图层类型 - */ - private _addOverlayToMap( - type: layerType, - source: mapboxglTypes.GeoJSONSourceRaw, - layerID: string, - layerStyle: any, - minzoom: number, - maxzoom: number, - filter?: string - ): void { - const mbglTypeMap = { - POINT: 'circle', - LINE: 'line', - POLYGON: 'fill' - }; - const mbglType = mbglTypeMap[type]; - if (mbglType === 'circle' || mbglType === 'line' || mbglType === 'fill') { - const style: any = { - id: layerID, - type: mbglType, - source: source, - paint: layerStyle.style, - layout: layerStyle.layout || {}, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22 - }; - if (filter) { - style.filter = filter; - } - this._addLayer(style); - } - } - - private _addBaselayer( - url: Array, - layerID: string, - visibility = true, - minzoom = 0, - maxzoom = 22, - isIserver = false, - bounds? - ): void { - const source: mapboxglTypes.RasterSource = { - type: 'raster', - tiles: url, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22, - tileSize: isIserver ? this.rasterTileSize : 256, - // @ts-ignore - rasterSource: isIserver ? 'iserver' : '', - // @ts-ignore - prjCoordSys: - isIserver && !this.isOnlineBaseLayer(url[0], this.baseProjection) && +this.baseProjection.split(':')[1] > 0 - ? { epsgCode: this.baseProjection.split(':')[1] } - : '', - proxy: this.baseLayerProxy - }; - if (bounds) { - source.bounds = bounds; - } - this._addLayer({ - id: layerID, - type: 'raster', - source: source, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22, - layout: { - visibility: visibility ? 'visible' : 'none' - } - }); - this.baseLayerProxy = null; - } - - /** - * @private - * @function WebMapViewModel.prototype._addStrokeLineForPoly - * @description 添加面的边框。 - * @param {Object} style - mabgl style - */ - private _addStrokeLineForPoly( - style: any, - source: any, - layerID: string, - visible: boolean, - minzoom: number, - maxzoom: number - ): void { - const lineStyle = { - style: this._transformStyleToMapBoxGl(style, 'LINE'), - layout: { - visibility: visible - } - }; - this._addOverlayToMap('LINE', source, layerID, lineStyle, minzoom, maxzoom); - } - - private _initLegendConfigInfo(layerInfo: any, style: any): void { - if (!this._legendList[layerInfo.layerID]) { - this._legendList[layerInfo.layerID] = { - layerType: layerInfo.layerType, - featureType: layerInfo.featureType, - layerId: layerInfo.layerID, - themeField: layerInfo.layerType === 'HEAT' ? layerInfo.themeSetting.weight : layerInfo.themeSetting.themeField, - styleGroup: style - }; - } - } - - _createMvtLayer(info, layerInfo, featureType) { - const style = this._getDataVectorTileStyle(featureType); - const paint = this._transformStyleToMapBoxGl(style, featureType); - let url = info.url + '/tileFeature.mvt'; - const origin = mapboxgl.CRS.get(this.baseProjection).getOrigin(); - const { minzoom, maxzoom } = layerInfo; - url += `?&returnAttributes=true&width=512&height=512&x={x}&y={y}&scale={scale}&origin={x:${origin[0]},y:${origin[1]}}`; - this._addLayer({ - id: layerInfo.layerID, - // @ts-ignore - type: style.mbglType, - source: { - type: 'vector', - tiles: [url], - proxy: this.webMapService.handleProxy('image') - }, - 'source-layer': `${info.datasetName}@${info.datasourceName}`, - paint, - layout: { - visibility: layerInfo.visible ? 'visible' : 'none' - }, - minzoom: minzoom || 0, - maxzoom: maxzoom || 22 - }); - this._addLayerSucceeded(); - } - - _getDataVectorTileStyle(featureType) { - const styleParameters = { - radius: 8, // 圆点半径 - fillColor: '#EE4D5A', // 填充色 - fillOpacity: 0.9, - strokeColor: '#ffffff', // 边框颜色 - strokeWidth: 1, - strokeOpacity: 1, - lineDash: 'solid', - type: 'BASIC_POINT', - mbglType: 'circle' - }; - if (['LINE', 'LINESTRING', 'MULTILINESTRING'].includes(featureType)) { - styleParameters.strokeColor = '#4CC8A3'; - styleParameters.strokeWidth = 2; - styleParameters.mbglType = 'line'; - } else if (['REGION', 'POLYGON', 'MULTIPOLYGON'].includes(featureType)) { - styleParameters.fillColor = '#826DBA'; - styleParameters.mbglType = 'fill'; - } - return styleParameters; - } - - _unproject(point: [number, number], isReverse = true): [number, number] { - const sourceProjection = this._unprojectProjection || this.baseProjection; - if (sourceProjection === 'EPSG:4326') { - return point; - } - // @ts-ignore - const coor = proj4(sourceProjection, 'EPSG:4326', point); - const proj = proj4.defs(sourceProjection); - if (isReverse && proj.axis && proj.axis.indexOf('ne') === 0) { - coor.reverse(); - } - return coor; - } - - private _getMapCenter(mapInfo) { - // center - let center: [number, number] | mapboxglTypes.LngLat; - center = mapInfo.center && [mapInfo.center.x, mapInfo.center.y]; - - if (!center) { - center = [0, 0]; - } - center = this._unproject(center, false); - center = new mapboxgl.LngLat(center[0], center[1]); - - return center; - } - - private _getLabelFontFamily(mapInfo) { - const fonts: string[] = []; - const layers = mapInfo.layers; - // 获取 label 图层字体类型 - if (layers && layers.length > 0) { - layers.forEach(layer => { - layer.labelStyle && fonts.push(layer.labelStyle.fontFamily); - }, this); - } - fonts.push('supermapol-icons'); - const fontFamilys: string = fonts.join(','); - - return fontFamilys; - } - - private _getTiandituUrl(mapInfo: any): { tiandituUrl: Array; labelUrl: Array } { - const re = /t0/gi; - type urlArr = Array; - const tiandituUrls: { tiandituUrl: urlArr; labelUrl: urlArr } = { tiandituUrl: [], labelUrl: [] }; - - const layerType = mapInfo.baseLayer.layerType.split('_')[1].toLowerCase(); - const isLabel = Boolean(mapInfo.baseLayer.labelLayerVisible); - const token = this.tiandituKey || mapInfo.baseLayer.tk; - let url = `https://t0.tianditu.gov.cn/{layer}_{proj}/wmts?tk=${token}`; - let labelUrl = url; - - const layerLabelMap = { - vec: 'cva', - ter: 'cta', - img: 'cia' - }; - - const tilematrixSet = this.baseProjection === 'EPSG:4326' ? 'c' : 'w'; - const options = { - service: 'WMTS', - request: 'GetTile', - style: 'default', - version: '1.0.0', - layer: layerType, - tilematrixSet: tilematrixSet, - format: 'tiles', - width: 256, - height: 256 - }; - - url += this._getParamString(options, url) + '&tilematrix={z}&tilerow={y}&tilecol={x}'; - - const tiandituUrl = url.replace('{layer}', layerType).replace('{proj}', tilematrixSet); - const tiandituUrlArr: string[] = []; - - for (let i = 0; i < 8; i++) { - tiandituUrlArr.push(tiandituUrl.replace(re, `t${i}`)); - } - tiandituUrls.tiandituUrl = tiandituUrlArr; - - // 如果有 label 图层 - if (isLabel) { - const labelLayer = layerLabelMap[layerType]; - options.layer = labelLayer; - labelUrl += this._getParamString(options, labelUrl) + '&tilematrix={z}&tilerow={y}&tilecol={x}'; - labelUrl = labelUrl.replace('{layer}', labelLayer).replace('{proj}', tilematrixSet); - const labelUrlArr = []; - for (let i = 0; i < 8; i++) { - labelUrlArr.push(labelUrl.replace(re, `t${i}`)); - } - tiandituUrls.labelUrl = labelUrlArr; - } - - return tiandituUrls; - } - - private _defineProj4(projection: string, defaultEpsgCode?) { - let epsgCode = projection; - let epsgValue: string; - if (!projection.split(':')[1]) { - if (defaultEpsgCode && defaultEpsgCode.split(':')[1]) { - epsgCode = defaultEpsgCode; - } else { - epsgCode = toEpsgCode(projection); - } - epsgValue = projection; - } - const defaultValue = getProjection(epsgCode); - const defValue = epsgValue || defaultValue; - - if (!defValue) { - console.error(`${epsgCode} not define`); - } else { - !proj4.defs(epsgCode) && proj4.defs(epsgCode, defValue); - !defaultValue && registerProjection(epsgCode, defValue); - } - return epsgCode; - } - - private _fetchRequest(url: any, type: string, options: Object) { - return SuperMap.FetchRequest.get(url, null, options).then(response => { - return response[type](); - }) - .then(results => { - return results; - }) - .catch(error => { - console.log(error); - }); - } - - private getEpsgCodeWKT(projectionUrl, options) { - if (!projectionUrl) { - return; - } - return this._fetchRequest(projectionUrl, 'text', options); - } - - private getBounds(baseUrl, options) { - if (!baseUrl) { - return; - } - return this._fetchRequest(baseUrl, 'json', options); - } - - private _addLayer(layerInfo) { - const { id } = layerInfo; - this._cacheLayerId.push(id); - layerInfo = Object.assign(layerInfo, { id }); - - if (this.map.getLayer(id)) { - if (this.checkSameLayer && this._isSameRasterLayer(id, layerInfo)) return; - this._updateLayer(layerInfo); - return; - } - this.map.addLayer(layerInfo); - } - - private _isSameRasterLayer(id, layerInfo) { - const { - source: { type, tiles } - } = layerInfo; - if (type === 'raster') { - const source = this.map.getSource(id); - if ( - type === source.type && - tiles && - // @ts-ignore - source.tiles && - // @ts-ignore - tiles[0] === source.tiles[0] - ) { - return true; - } - } - return false; - } - - public setLayersVisible(isShow, ignoreIds) { - const show = isShow ? 'visible' : 'none'; - if (this._cacheLayerId.length) { - this._cacheLayerId.forEach(layerId => { - if ((ignoreIds && !ignoreIds.includes(layerId)) || !ignoreIds) { - this.map.setLayoutProperty(layerId, 'visibility', show); - } - }); - } - } - - cleanWebMap() { - if (this.map) { - this.triggerEvent('beforeremovemap', {}); - this.stopCanvg(); - this.map.remove(); - this.map = null; - this._legendList = {}; - this._sourceListModel = null; - this.center = null; - this.zoom = null; - this._layers = []; - this._dataflowService && - this._dataflowService.off('messageSucceeded', this._handleDataflowFeaturesCallback) && - this._dataflowService.off('subscribesucceeded', this._initDataflowLayerCallback); - this._unprojectProjection = null; - } - if (this._layerTimerList.length) { - this._layerTimerList.forEach(timer => { - clearInterval(timer); - }); - this._layerTimerList = []; - } - } - - private centerValid(center) { - if ( - center && - ((<[number, number]>center).length > 0 || - typeof center === mapboxgl.LngLat || - (<{ lng: number; lat: number }>center).lng) - ) { - return true; - } - return false; - } - - private _getResolution(bounds, tileSize = 512.0) { - if (bounds.leftBottom && bounds.rightTop) { - return Math.max(bounds.rightTop.x - bounds.leftBottom.x, bounds.rightTop.y - bounds.leftBottom.y) / tileSize; - } - return Math.max(bounds[2] - bounds[0], bounds[3] - bounds[1]) / tileSize; - } - - private _transformScaleToZoom(scale, crs?) { - // @ts-ignore - const extent = (crs || this.map.getCRS()).getExtent(); - // @ts-ignore - const unit = (crs || this.map.getCRS()).unit; - const scaleBase = 1.0 / SuperMap.Util.getScaleFromResolutionDpi((extent[2] - extent[0]) / 512, 96, unit); - const scaleDenominator = scale.split(':')[1]; - return Math.min(24, +Math.log2(scaleBase / +scaleDenominator).toFixed(2)); - } - - private _updateLayer(layerInfo) { - const { - id, - paint, - source: { type, tiles, data, proxy } - } = layerInfo; - const source = this.map.getSource(id); - if (source) { - if (type === 'geojson' || source.type === 'geojson') { - Object.keys(paint).forEach(name => { - this.map.setPaintProperty(id, name, paint[name]); - }); - // @ts-ignore - data && source.setData(data); - } else if (type === 'raster') { - this._updateRasterSource(id, { proxy, tiles }); - } - } - } - - _updateRasterSource(sourceId, options) { - if (!sourceId) { - return; - } - const source = this.map.getSource(sourceId); - - Object.assign(source, options); - // @ts-ignore - this.map.style.sourceCaches[sourceId].clearTiles(); - // @ts-ignore - this.map.style.sourceCaches[sourceId].update(this.map.transform); - // @ts-ignore - this.map.triggerRepaint(); - } - - updateOverlayLayer(layerInfo: any, features: any, mergeByField?: string) { - if (features) { - this._initOverlayLayer(layerInfo, features, mergeByField); - } else { - const type = this.webMapService.getDatasourceType(layerInfo); - this.getLayerFeatures(layerInfo, this._taskID, type); - } - } - - isOnlineBaseLayer(url, projection) { - return ( - url.startsWith('https://maptiles.supermapol.com/iserver/services/map_China/rest/maps/China_Dark') && - projection === 'EPSG:3857' - ); + public updateOverlayLayer(layerInfo: any, features: any, mergeByField?: string) { + this._handler?.updateOverlayLayer?.(layerInfo, features, mergeByField); } } diff --git a/src/mapboxgl/web-map/__tests__/WebMap.spec.js b/src/mapboxgl/web-map/__tests__/WebMap.spec.js index c7c7d48a..932feb6a 100644 --- a/src/mapboxgl/web-map/__tests__/WebMap.spec.js +++ b/src/mapboxgl/web-map/__tests__/WebMap.spec.js @@ -590,7 +590,7 @@ describe('WebMap.vue', () => { }); await mapWrapperLoaded(wrapper); expect(spy).toBeCalled(); - wrapper.setProps({ + await wrapper.setProps({ mapId: '1234', serverUrl: 'https://fakeiportal1.supermap.io/iportal', withCredentials: false, diff --git a/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js b/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js index 9fbcfabd..406eb263 100644 --- a/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js +++ b/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js @@ -110,6 +110,9 @@ const commonMap = { getExtent: () => jest.fn() }; }, + getAppreciableLayers: () => { + return Object.values(layerIdMapList); + }, addLayer: layerInfo => { layerIdMapList[layerInfo.id] = layerInfo; if (typeof layerInfo.source === 'object') { @@ -129,6 +132,7 @@ const commonMap = { on: () => {}, fire: () => {}, setLayoutProperty: () => jest.fn(), + setPaintProperty: jest.fn(), addStyle: () => jest.fn(), remove: () => jest.fn(), setRenderWorldCopies: () => jest.fn(), @@ -202,6 +206,7 @@ document.getElementsByClassName = () => { describe('WebMapViewModel.spec', () => { beforeEach(() => { + jest.useFakeTimers(); jest.setTimeout(30000); }); afterEach(() => { @@ -209,9 +214,10 @@ describe('WebMapViewModel.spec', () => { layerIdMapList = {}; commonMap.style.sourceCaches = sourceIdMapList; jest.restoreAllMocks(); + jest.useRealTimers(); }); - it('test baseLayer layers count maploaded', done => { + it('test baseLayer layers count maploaded', async done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/config/portal.json': iportal_serviceProxy, 'https://fakeiportal.supermap.io/iportal/web/maps/123/map.json': webmap_MAPBOXSTYLE_Tile, @@ -265,12 +271,12 @@ describe('WebMapViewModel.spec', () => { }, addlayerssucceeded: data => { expect(addStyleSpy).toHaveBeenCalledTimes(1); - expect(data.layers.length).toBe(webmap_MAPBOXSTYLE_Tile.layers.length); - expect(viewModel.expectLayerLen).toBe(2); - expect(viewModel.layerAdded).toBe(2); + expect(viewModel.getAppreciableLayers().length).toBe(webmap_MAPBOXSTYLE_Tile.layers.length); done(); } }); + await flushPromises(); + jest.advanceTimersByTime(0); }); it('add uniqueLayer with id is num', async done => { const fetchResource = { @@ -282,11 +288,11 @@ describe('WebMapViewModel.spec', () => { layerData_geojson['LINE_GEOJSON'] }; mockFetch(fetchResource); + const viewModel = new WebMapViewModel(commonId, { ...commonOption }, undefined, { ...commonMap }); const callback = function (data) { - expect(data.layers.length).toBe(uniqueLayer_polygon.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(uniqueLayer_polygon.layers.length); done(); }; - const viewModel = new WebMapViewModel(commonId, { ...commonOption }, undefined, { ...commonMap }); viewModel.on({ addlayerssucceeded: callback }); }); @@ -306,14 +312,23 @@ describe('WebMapViewModel.spec', () => { const callback = function (data) { expect(viewModel.map).not.toBeUndefined(); expect(viewModel.map.options.bounds).not.toBeUndefined(); - expect(data.layers.length).toBe(id.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; const viewModel = new WebMapViewModel(id, { ...commonOption }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); describe('test custom wkt', () => { + beforeEach(() => { + jest.useFakeTimers(); + jest.advanceTimersByTime(0); + }); + afterEach(() => { + jest.useRealTimers(); + }); const commonFetchResource = { 'https://fakeiportal.supermap.io/iportal/web/datas/676516522/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': layerData_CSV, @@ -345,21 +360,30 @@ describe('WebMapViewModel.spec', () => { expect(errorSpy.mock.calls).toEqual([]); done(); }); - it('request wkt info and visibleExtend without EPSFG Prefix ', done => { + it('request wkt info and visibleExtend without EPSFG Prefix ', async done => { const epsgeCode = 'PROJCS["Google Maps Global Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_2SP"],PARAMETER["standard_parallel_1",0],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],AXIS["Northing", "NORTH"],AXIS["Easting", "EAST"],UNIT["Meter",1],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","900913"]]'; mockFetch(commonFetchResource); const id = { ...uniqueLayer_point, projection: epsgeCode }; const callback = function (data) { - expect(data.layers.length).toBe(id.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; const viewModel = new WebMapViewModel(id, { ...commonOption }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); }); describe('multi-coordinate', () => { + beforeEach(() => { + jest.useFakeTimers(); + jest.advanceTimersByTime(0); + }); + afterEach(() => { + jest.useRealTimers(); + }); const projection = 'PROJCS["CGCS2000 / 3-degree Gauss-Kruger CM 117E", \r\n GEOGCS["China Geodetic Coordinate System 2000", \r\n DATUM["China 2000", \r\n SPHEROID["CGCS2000", 6378137.0, 298.257222101, AUTHORITY["EPSG","1024"]], \r\n AUTHORITY["EPSG","1043"]], \r\n PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], \r\n UNIT["degree", 0.017453292519943295], \r\n AXIS["lat", NORTH], \r\n AXIS["lon", EAST], \r\n AUTHORITY["EPSG","4490"]], \r\n PROJECTION["Transverse_Mercator", AUTHORITY["EPSG","9807"]], \r\n PARAMETER["central_meridian", 117.0], \r\n PARAMETER["latitude_of_origin", 0.0], \r\n PARAMETER["scale_factor", 1.0], \r\n PARAMETER["false_easting", 500000.0], \r\n PARAMETER["false_northing", 0.0], \r\n UNIT["m", 1.0], \r\n AXIS["Northing", NORTH], \r\n AXIS["Easting", EAST], \r\n AUTHORITY["EPSG","4548"]]'; const wkt = @@ -396,14 +420,13 @@ describe('WebMapViewModel.spec', () => { }); const id = { ...tileLayer, ...baseLayer, projection: projection }; const viewModel = new WebMapViewModel(id, { ...commonOption }); - await flushPromises(); const callback = function (data) { - console.log(data); - expect(data.layers.length).toBe(id.layers.length); - expect(viewModel.layerAdded).toBe(1); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); it('layerType is MAPBOXSTYLE and webInfo projection is wkt and indexbounds is not exist', async done => { @@ -419,13 +442,13 @@ describe('WebMapViewModel.spec', () => { }); const id = { ...tileLayer, ...baseLayer, projection: projection }; const viewModel = new WebMapViewModel(id, { ...commonOption }); - await flushPromises(); const callback = function (data) { - expect(data.layers.length).toBe(id.layers.length); - expect(viewModel.layerAdded).toBe(1); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); it('layerType is Tile and webInfo projection is wkt', async done => { @@ -439,7 +462,7 @@ describe('WebMapViewModel.spec', () => { await flushPromises(); done(); const callback = function (data) { - expect(data.layers.length).toBe(id.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; viewModel.on({ addlayerssucceeded: callback }); @@ -456,7 +479,7 @@ describe('WebMapViewModel.spec', () => { mockFetch(fetchResource); const id = vectorLayer_point; const callback = function (data) { - expect(data.layers.length).toBe(id.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; const viewModel = new WebMapViewModel(id, { ...commonOption }, undefined, { ...commonMap }); @@ -485,7 +508,7 @@ describe('WebMapViewModel.spec', () => { getSource: () => '' }; const callback = function (data) { - expect(data.layers.length).toBe(roadId.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(roadId.layers.length); done(); }; const viewModel = new WebMapViewModel(roadId, { ...commonOption }, mapOptions, map); @@ -516,26 +539,27 @@ describe('WebMapViewModel.spec', () => { }; const callback = async function (data) { await flushPromises(); - expect(data.layers.length).toBe(subwayId.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(subwayId.layers.length); done(); }; const viewModel = new WebMapViewModel(subwayId, { ...commonOption }, undefined, { ...commonMap }); viewModel.on({ addlayerssucceeded: callback }); }); - it('add vectorLayer_polygon', done => { + it('add vectorLayer_polygon', async done => { const id = vectorLayer_polygon; - const callback = async function (data) { - await flushPromises(); - expect(data.layers.length).toBe(id.layers.length); + const viewModel = new WebMapViewModel(id, { ...commonOption }); + const callback = function (data) { + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; - const viewModel = new WebMapViewModel(id, { ...commonOption }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); // _initGraticuleLayer - it('add rangeLayer', done => { + it('add rangeLayer', async done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/datas/1171594968/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': layerData_CSV @@ -558,9 +582,11 @@ describe('WebMapViewModel.spec', () => { }; const viewModel = new WebMapViewModel(id, { ...commonOption }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('add rangeLayer last end === fieldValue', done => { + it('add rangeLayer last end === fieldValue', async done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/datas/1171594968/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': layerData_CSV @@ -568,336 +594,345 @@ describe('WebMapViewModel.spec', () => { mockFetch(fetchResource); const id = rangeLayer; const viewModel = new WebMapViewModel(id, { ...commonOption }); - const mockFun = jest.spyOn(viewModel, '_addOverlayToMap'); - viewModel.getRangeStyleGroup = () => { - return [ - { - style: { - strokeWidth: 1, - fillColor: '#ffc6c4', - fillOpacity: 0.9, - lineDash: 'solid', - strokeColor: '#ffffff', - type: 'POLYGON', - strokeOpacity: 1 + const callback = () => { + const mockFun = jest.spyOn(viewModel._handler, '_addOverlayToMap'); + viewModel._handler.getRangeStyleGroup = () => { + return [ + { + style: { + strokeWidth: 1, + fillColor: '#ffc6c4', + fillOpacity: 0.9, + lineDash: 'solid', + strokeColor: '#ffffff', + type: 'POLYGON', + strokeOpacity: 1 + }, + color: '#ffc6c4', + start: 20000000000.98, + end: 333333350000000000 + }, + { + style: { + strokeWidth: 1, + fillColor: '#f4a3a8', + fillOpacity: 0.9, + lineDash: 'solid', + strokeColor: '#ffffff', + type: 'POLYGON', + strokeOpacity: 1 + }, + color: '#f4a3a8', + start: 333333350000000000, + end: 666666680000000000 + }, + { + style: { + strokeWidth: 1, + fillColor: '#e38191', + fillOpacity: 0.9, + lineDash: 'solid', + strokeColor: '#ffffff', + type: 'POLYGON', + strokeOpacity: 1 + }, + color: '#e38191', + start: 666666680000000000, + end: 1000000010000000000 }, - color: '#ffc6c4', - start: 20000000000.98, - end: 333333350000000000 + { + style: { + strokeWidth: 1, + fillColor: '#cc607d', + fillOpacity: 0.9, + lineDash: 'solid', + strokeColor: '#ffffff', + type: 'POLYGON', + strokeOpacity: 1 + }, + color: '#cc607d', + start: 1000000010000000000, + end: 1333333340000000000 + }, + { + style: { + strokeWidth: 1, + fillColor: '#ad466c', + fillOpacity: 0.9, + lineDash: 'solid', + strokeColor: '#ffffff', + type: 'POLYGON', + strokeOpacity: 1 + }, + color: '#ad466c', + start: 1333333340000000000, + end: 1666666670000000000 + }, + { + style: { + strokeWidth: 1, + fillColor: '#8b3058', + fillOpacity: 0.9, + lineDash: 'solid', + strokeColor: '#ffffff', + type: 'POLYGON', + strokeOpacity: 1 + }, + color: '#8b3058', + start: 1666666670000000000, + end: 2000000000000000000 + } + ]; + }; + const layerInfo = { + layerType: 'RANGE', + visible: 'visible', + themeSetting: { + themeField: 'TAX', + customSettings: {}, + segmentMethod: 'offset', + segmentCount: 6, + colors: ['#ffc6c4', '#f4a3a8', '#e38191', '#cc607d', '#ad466c', '#8b3058', '#672044'] }, + name: 'DataSource:DEMARCACION_TERRITORIAL_Tax', + featureType: 'POLYGON', + style: { + strokeWidth: 1, + fillColor: '#8b3058', + fillOpacity: 0.9, + lineDash: 'solid', + strokeColor: '#ffffff', + type: 'POLYGON', + strokeOpacity: 1 + }, + projection: 'EPSG:4326', + enableFields: ['TAX'], + dataSource: { + type: 'REST_DATA', + url: 'http://test:8090/iserver/services/data-JSON_test/rest/data', + dataSourceName: 'DataSource:DEMARCACION_TERRITORIAL_Tax' + }, + layerID: 'DataSource:DEMARCACION_TERRITORIAL_Tax' + }; + const features = [ { - style: { - strokeWidth: 1, - fillColor: '#f4a3a8', - fillOpacity: 0.9, - lineDash: 'solid', - strokeColor: '#ffffff', - type: 'POLYGON', - strokeOpacity: 1 + type: 'Feature', + properties: { + TAX: '2.0E18', + index: '0' + }, + geometry: { + type: 'MultiPolygon' }, - color: '#f4a3a8', - start: 333333350000000000, - end: 666666680000000000 + id: 1 }, { - style: { - strokeWidth: 1, - fillColor: '#e38191', - fillOpacity: 0.9, - lineDash: 'solid', - strokeColor: '#ffffff', - type: 'POLYGON', - strokeOpacity: 1 + type: 'Feature', + properties: { + TAX: '2.00000000000098E12', + index: '1' + }, + geometry: { + type: 'MultiPolygon' }, - color: '#e38191', - start: 666666680000000000, - end: 1000000010000000000 + id: 2 }, { - style: { - strokeWidth: 1, - fillColor: '#cc607d', - fillOpacity: 0.9, - lineDash: 'solid', - strokeColor: '#ffffff', - type: 'POLYGON', - strokeOpacity: 1 + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '2' + }, + geometry: { + type: 'MultiPolygon' }, - color: '#cc607d', - start: 1000000010000000000, - end: 1333333340000000000 + id: 3 }, { - style: { - strokeWidth: 1, - fillColor: '#ad466c', - fillOpacity: 0.9, - lineDash: 'solid', - strokeColor: '#ffffff', - type: 'POLYGON', - strokeOpacity: 1 + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '3' }, - color: '#ad466c', - start: 1333333340000000000, - end: 1666666670000000000 + geometry: { + type: 'MultiPolygon' + }, + id: 4 }, { - style: { - strokeWidth: 1, - fillColor: '#8b3058', - fillOpacity: 0.9, - lineDash: 'solid', - strokeColor: '#ffffff', - type: 'POLYGON', - strokeOpacity: 1 + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '4' }, - color: '#8b3058', - start: 1666666670000000000, - end: 2000000000000000000 - } - ]; - }; - const layerInfo = { - layerType: 'RANGE', - visible: 'visible', - themeSetting: { - themeField: 'TAX', - customSettings: {}, - segmentMethod: 'offset', - segmentCount: 6, - colors: ['#ffc6c4', '#f4a3a8', '#e38191', '#cc607d', '#ad466c', '#8b3058', '#672044'] - }, - name: 'DataSource:DEMARCACION_TERRITORIAL_Tax', - featureType: 'POLYGON', - style: { - strokeWidth: 1, - fillColor: '#8b3058', - fillOpacity: 0.9, - lineDash: 'solid', - strokeColor: '#ffffff', - type: 'POLYGON', - strokeOpacity: 1 - }, - projection: 'EPSG:4326', - enableFields: ['TAX'], - dataSource: { - type: 'REST_DATA', - url: 'http://test:8090/iserver/services/data-JSON_test/rest/data', - dataSourceName: 'DataSource:DEMARCACION_TERRITORIAL_Tax' - }, - layerID: 'DataSource:DEMARCACION_TERRITORIAL_Tax' - }; - const features = [ - { - type: 'Feature', - properties: { - TAX: '2.0E18', - index: '0' - }, - geometry: { - type: 'MultiPolygon' - }, - id: 1 - }, - { - type: 'Feature', - properties: { - TAX: '2.00000000000098E12', - index: '1' - }, - geometry: { - type: 'MultiPolygon' - }, - id: 2 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '2' - }, - geometry: { - type: 'MultiPolygon' - }, - id: 3 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '3' - }, - geometry: { - type: 'MultiPolygon' - }, - id: 4 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '4' - }, - geometry: { - type: 'MultiPolygon' - }, - id: 5 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '5' - }, - geometry: { - type: 'MultiPolygon' - }, - id: 6 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '6' - }, - geometry: { - type: 'MultiPolygon' - }, - id: 7 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '7' - }, - geometry: { - type: 'MultiPolygon' - }, - id: 8 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '8' - }, - geometry: { - type: 'MultiPolygon' - }, - id: 9 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '9' - }, - geometry: { - type: 'MultiPolygon' - }, - id: 10 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '10' - }, - geometry: { - type: 'MultiPolygon' + geometry: { + type: 'MultiPolygon' + }, + id: 5 }, - id: 11 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '11' + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '5' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 6 }, - geometry: { - type: 'MultiPolygon' + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '6' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 7 }, - id: 12 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '12' + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '7' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 8 }, - geometry: { - type: 'MultiPolygon' + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '8' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 9 }, - id: 13 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '13' + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '9' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 10 }, - geometry: { - type: 'MultiPolygon' + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '10' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 11 }, - id: 14 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '14' + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '11' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 12 }, - geometry: { - type: 'MultiPolygon' + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '12' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 13 }, - id: 15 - }, - { - type: 'Feature', - properties: { - TAX: '2.000000000098E10', - index: '15' + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '13' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 14 }, - geometry: { - type: 'MultiPolygon' + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '14' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 15 }, - id: 16 - } - ]; - viewModel._createRangeLayer(layerInfo, features); - expect(mockFun.mock.calls[0][3].style['fill-color'].length).toEqual(35); - done(); + { + type: 'Feature', + properties: { + TAX: '2.000000000098E10', + index: '15' + }, + geometry: { + type: 'MultiPolygon' + }, + id: 16 + } + ]; + viewModel._handler._createRangeLayer(layerInfo, features); + expect(mockFun.mock.calls[0][3].style['fill-color'].length).toEqual(35); + done(); + } + viewModel.on({ mapinitialized: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('add heatLayer', done => { + it('add heatLayer', async done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/datas/1920557079/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': layerData_CSV }; mockFetch(fetchResource); const id = heatLayer; + const viewModel = new WebMapViewModel(id, { ...commonOption }); const callback = function (data) { - expect(data.layers.length).toBe(id.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; - const viewModel = new WebMapViewModel(id, { ...commonOption }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('add markerLayer correctly', done => { + it('add markerLayer correctly', async done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/datas/123456/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': layerData_geojson['MARKER_GEOJSON'] }; mockFetch(fetchResource); const id = markerLayer; + const viewModel = new WebMapViewModel(id, { ...commonOption }); const callback = function (data) { - expect(data.layers.length).toBe(id.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; - const viewModel = new WebMapViewModel(id, { ...commonOption }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); it('add markerLayer layerOrder correctly', done => { @@ -907,20 +942,19 @@ describe('WebMapViewModel.spec', () => { }; mockFetch(fetchResource); const id = markerLayer; + const viewModel = new WebMapViewModel(id, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); const callback = function (data) { - expect(data.layers.length).toBe(id.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); const layers = data.map.getStyle().layers; expect(layers[layers.length - 2].id).toBe('民航数-TEXT-7'); - console.log(layers[layers.length - 1]); expect(layers[layers.length - 1].type).toBe('circle'); expect(layers[layers.length - 1].paint['circle-color']).toBe('#de2b41'); done(); }; - const viewModel = new WebMapViewModel(id, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); viewModel.on({ addlayerssucceeded: callback }); }); - it('markerLayer url is error', done => { + it('markerLayer url is error', async done => { const newLayerData_geojson = { ...layerData_geojson['MARKER_GEOJSON'], content: @@ -932,45 +966,51 @@ describe('WebMapViewModel.spec', () => { }; mockFetch(fetchResource); const id = markerLayer; + const viewModel = new WebMapViewModel(id, { ...commonOption }); const callback = function (data) { - expect(data.layers.length).toBe(id.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; - const viewModel = new WebMapViewModel(id, { ...commonOption }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('add migrationLayer', done => { + it('add migrationLayer', async done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/datas/516597759/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': layerData_CSV }; mockFetch(fetchResource); const id = migrationLayer; + const viewModel = new WebMapViewModel(id, { ...commonOption }); const callback = function (data) { - expect(data.layers.length).toBe(id.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; - const viewModel = new WebMapViewModel(id, { ...commonOption }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('add ranksymbolLayer', done => { + it('add ranksymbolLayer', async done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/datas/676516522/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': layerData_CSV }; mockFetch(fetchResource); const id = ranksymbolLayer; + const viewModel = new WebMapViewModel(id, { ...commonOption }); const callback = function (data) { - expect(data.layers.length).toBe(id.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(id.layers.length); done(); }; - const viewModel = new WebMapViewModel(id, { ...commonOption }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('add dataflow and update', done => { + it('add dataflow and update', async done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/datas/676516522/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': layerData_CSV, @@ -982,20 +1022,28 @@ describe('WebMapViewModel.spec', () => { dataflowLayerData.subscribe }; mockFetch(fetchResource); + const viewModel = new WebMapViewModel(dataflowLayer, { ...commonOption }, undefined, { ...commonMap }); const callback = function (data) { - expect(data.layers.length).toBe(dataflowLayer.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(dataflowLayer.layers.length); viewModel.updateOverlayLayer(dataflowLayer.layers[0]); expect(() => { viewModel.updateOverlayLayer(dataflowLayer.layers[0]); }).not.toThrow(); done(); }; - const viewModel = new WebMapViewModel(dataflowLayer, { ...commonOption }, undefined, { ...commonMap }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); // public Func describe('resize', () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + afterEach(() => { + jest.useRealTimers(); + }); it('resize normal', async done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/datas/516597759/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': @@ -1004,14 +1052,20 @@ describe('WebMapViewModel.spec', () => { mockFetch(fetchResource); const id = migrationLayer; const viewModel = new WebMapViewModel(id, { ...commonOption }); - const spy = jest.spyOn(viewModel, 'echartsLayerResize'); + viewModel.on({ + mapinitialized: () => { + const spy = jest.spyOn(viewModel._handler, 'echartsLayerResize'); + viewModel.resize(); + expect(spy).toBeCalled(); + done(); + } + }); await flushPromises(); - viewModel.resize(); - expect(spy).toBeCalled(); + jest.advanceTimersByTime(0); done(); }); - it('resize keepbounds', async done => { + it('resize keepbounds', done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/config/portal.json': iportal_serviceProxy, 'https://fakeiportal.supermap.io/iportal/web/maps/123/map.json': uniqueLayer_polygon, @@ -1022,15 +1076,24 @@ describe('WebMapViewModel.spec', () => { }; mockFetch(fetchResource); const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); - const spy = jest.spyOn(viewModel.map, 'setZoom'); - await flushPromises(); - viewModel.resize(true); - expect(spy).toBeCalled(); - done(); + viewModel.on({ + addlayerssucceeded: () => { + const spy = jest.spyOn(viewModel.map, 'setZoom'); + viewModel.resize(true); + expect(spy).toBeCalled(); + done(); + } + }); }); }); describe('setCrs', () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + afterEach(() => { + jest.useRealTimers(); + }); beforeEach(() => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/config/portal.json': iportal_serviceProxy, @@ -1062,12 +1125,18 @@ describe('WebMapViewModel.spec', () => { epsgCode: 'EPSG:4326' }; const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); - const spy = jest.spyOn(viewModel.map, 'setCRS'); + viewModel.on({ + mapinitialized: () => { + const spy = jest.spyOn(viewModel.map, 'setCRS'); + expect(viewModel.mapOptions.crs).toBeUndefined(); + viewModel.setCrs(crsWithEpsgcode); + expect(viewModel.mapOptions.crs).not.toBeUndefined(); + expect(spy).toBeCalled(); + done(); + } + }); await flushPromises(); - expect(viewModel.mapOptions.crs).toBeUndefined(); - viewModel.setCrs(crsWithEpsgcode); - expect(viewModel.mapOptions.crs).not.toBeUndefined(); - expect(spy).toBeCalled(); + jest.advanceTimersByTime(0); done(); }); @@ -1084,6 +1153,13 @@ describe('WebMapViewModel.spec', () => { }); describe('setCenter', () => { + beforeEach(() => { + jest.useFakeTimers(); + jest.advanceTimersByTime(0); + }); + afterEach(() => { + jest.useRealTimers(); + }); beforeEach(() => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/config/portal.json': iportal_serviceProxy, @@ -1098,8 +1174,9 @@ describe('WebMapViewModel.spec', () => { it('set invalid data', async done => { const center = []; const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); - const spy = jest.spyOn(viewModel.map, 'getCenter'); await flushPromises(); + jest.advanceTimersByTime(0); + const spy = jest.spyOn(viewModel.map, 'getCenter'); expect(spy).not.toBeCalled(); viewModel.setCenter(center); expect(spy).not.toBeCalled(); @@ -1109,8 +1186,9 @@ describe('WebMapViewModel.spec', () => { it('set valid data', async done => { const center = [1, 1]; const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); - const spy = jest.spyOn(viewModel.map, 'setCenter'); await flushPromises(); + jest.advanceTimersByTime(0); + const spy = jest.spyOn(viewModel.map, 'setCenter'); expect(spy).not.toBeCalled(); viewModel.setCenter(center); expect(spy).toBeCalled(); @@ -1130,8 +1208,9 @@ describe('WebMapViewModel.spec', () => { mockFetch(fetchResource); const renderWorldCopies = true; const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); - const spy = jest.spyOn(viewModel.map, 'setRenderWorldCopies'); await flushPromises(); + jest.advanceTimersByTime(0); + const spy = jest.spyOn(viewModel.map, 'setRenderWorldCopies'); expect(spy).not.toBeCalled(); viewModel.setRenderWorldCopies(renderWorldCopies); expect(spy).toBeCalled(); @@ -1150,8 +1229,9 @@ describe('WebMapViewModel.spec', () => { mockFetch(fetchResource); const bearing = 0; const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); - const spy = jest.spyOn(viewModel.map, 'setBearing'); await flushPromises(); + jest.advanceTimersByTime(0); + const spy = jest.spyOn(viewModel.map, 'setBearing'); expect(viewModel.mapOptions.bearing).toBeUndefined(); viewModel.setBearing(); expect(viewModel.mapOptions.bearing).toBeUndefined(); @@ -1174,8 +1254,9 @@ describe('WebMapViewModel.spec', () => { mockFetch(fetchResource); const pitch = 0; const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); - const spy = jest.spyOn(viewModel.map, 'setPitch'); await flushPromises(); + jest.advanceTimersByTime(0); + const spy = jest.spyOn(viewModel.map, 'setPitch'); expect(viewModel.mapOptions.pitch).toBeUndefined(); viewModel.setPitch(); expect(spy).not.toBeCalled(); @@ -1200,8 +1281,9 @@ describe('WebMapViewModel.spec', () => { color: '#fff' }; const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); - const spy = jest.spyOn(viewModel.map, 'setStyle'); await flushPromises(); + jest.advanceTimersByTime(0); + const spy = jest.spyOn(viewModel.map, 'setStyle'); expect(spy).not.toBeCalled(); viewModel.on({ addlayerssucceeded: e => { @@ -1225,13 +1307,18 @@ describe('WebMapViewModel.spec', () => { }; mockFetch(fetchResource); const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); - const spy = jest.spyOn(viewModel, '_updateRasterSource'); + viewModel.on({ + addlayerssucceeded: () => { + const spy = jest.spyOn(viewModel._handler, '_updateRasterSource'); + viewModel.setRasterTileSize(-1); + expect(spy).not.toBeCalled(); + viewModel.setRasterTileSize(2); + expect(spy).toBeCalled(); + done(); + } + }); await flushPromises(); - viewModel.setRasterTileSize(-1); - expect(spy).not.toBeCalled(); - viewModel.setRasterTileSize(2); - expect(spy).toBeCalled(); - done(); + jest.advanceTimersByTime(0); }); it('setLayersVisible', done => { @@ -1244,21 +1331,21 @@ describe('WebMapViewModel.spec', () => { layerData_geojson['LINE_GEOJSON'] }; mockFetch(fetchResource); + const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); const callback = function (data) { - expect(data.layers.length).toBe(uniqueLayer_polygon.layers.length); + expect(viewModel.getAppreciableLayers().length).toBe(uniqueLayer_polygon.layers.length); const isShow = false; const changeShow = true; const ignoreIds = ['China']; const spy1 = jest.spyOn(viewModel.map, 'setLayoutProperty'); viewModel.setLayersVisible(isShow, ignoreIds); - expect(spy1.mock.calls.length).toBe(viewModel._cacheLayerId.length - 1); + expect(spy1.mock.calls.length).toBe(viewModel._cacheLayerId.length); spy1.mockClear(); const spy2 = jest.spyOn(viewModel.map, 'setLayoutProperty'); viewModel.setLayersVisible(changeShow); expect(spy2.mock.calls.length).toBe(viewModel._cacheLayerId.length); done(); }; - const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); viewModel.on({ addlayerssucceeded: callback }); }); @@ -1272,25 +1359,19 @@ describe('WebMapViewModel.spec', () => { layerData_geojson['LINE_GEOJSON'] }; mockFetch(fetchResource); + const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); const callback = function (data) { - expect(data.layers.length).toBe(uniqueLayer_polygon.layers.length); - const spyLayer = jest.spyOn(viewModel.map, 'removeLayer'); - const spySource = jest.spyOn(viewModel.map, 'removeSource'); - const layersLen = Object.keys(layerIdMapList).length; - const sourcesLen = Object.keys(sourceIdMapList).length; + expect(viewModel.getAppreciableLayers().length).toBe(uniqueLayer_polygon.layers.length); expect(viewModel._cacheLayerId.length).not.toBe(0); viewModel.cleanLayers(); - expect(spyLayer.mock.calls.length).toBe(layersLen); - expect(spySource.mock.calls.length).toBe(sourcesLen); expect(viewModel._cacheLayerId.length).toBe(0); done(); }; - const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); viewModel.on({ addlayerssucceeded: callback }); }); // 在 MD 调用 - it('updateOverlayLayer mvt', done => { + it('updateOverlayLayer unique', done => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/config/portal.json': iportal_serviceProxy, 'https://fakeiportal.supermap.io/iportal/web/maps/123/map.json': uniqueLayer_polygon, @@ -1302,54 +1383,59 @@ describe('WebMapViewModel.spec', () => { mockFetch(fetchResource); const viewModel = new WebMapViewModel(commonId, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); const callback = function (data) { - expect(data.layers.length).toBe(uniqueLayer_polygon.layers.length); - const mvtLayerInfo = { - layerID: 'style1', - layerType: 'mvt', - visible: false, - featureType: 'POLYGON', - style: { - radius: 6, - fillColor: '#ff0000', - fillOpacity: 0.9, - strokeColor: '#ffffff', - strokeWidth: 1, - strokeOpacity: 1, - lineDash: 'solid', - symbolType: 'svg', - type: 'POLYGON' + expect(viewModel.getAppreciableLayers().length).toBe(uniqueLayer_polygon.layers.length); + const layerInfo = { ...uniqueLayer_polygon.layers[0], layerID: uniqueLayer_polygon.layers[0].name }; + const features = [{ + type: "Feature", + geometry: { + type: "Point", + coordinates: [ + 116.588918, + 40.07108, + ], }, - labelStyle: {}, - projection: 'EPSG:3857', - featureType: 'POLYGON' - }; - const mvtFeatures = { - info: { url: 'http://fack/iserver/services/mvt-example' }, - featureType: 'POLYGON' - }; - const spy = jest.spyOn(viewModel, '_initOverlayLayer'); - viewModel.updateOverlayLayer(mvtLayerInfo, mvtFeatures); + properties: { + latitude: "40.07108", + longitude: "116.588918", + altitude: "", + geometry: "Point", + "机场": "北京/首都", + "X坐标": "116.588918", + "Y坐标": "40.07108", + "名次": "1", + "2017旅客吞吐量(人次)": "95786296 ", + "2016旅客吞吐量(人次)": "94393454 ", + "同比增速%": "-1.5", + "张家界": "94393454 ", + index: "0", + }, + }]; + const spy = jest.spyOn(viewModel._handler, '_initOverlayLayer'); + viewModel.updateOverlayLayer(layerInfo, features); expect(spy).toBeCalled(); done(); }; viewModel.on({ addlayerssucceeded: callback }); }); - it('add baselayer which is baidu', done => { + it('add baselayer which is baidu', async done => { const callback = function (data) { expect(data).not.toBeUndefined(); done(); }; const viewModel = new WebMapViewModel(baseLayers['BAIDU']); viewModel.on({ notsupportbaidumap: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('_getMapCenter 4490', done => { + it('_getMapCenter 4490', async done => { const fetchResource = { 'http://fake/fakeiportal/web/config/portal.json': iportal_serviceProxy, 'http://fake/fakeiportal/web/maps/1791328696/map.json': raster4490 }; mockFetch(fetchResource); + jest.useFakeTimers(); const viewModel = new WebMapViewModel( '1791328696', { @@ -1373,9 +1459,12 @@ describe('WebMapViewModel.spec', () => { done(); } }); + await flushPromises(); + jest.advanceTimersByTime(120); }); - it('getFilterFeatures 2020年人口总数', done => { + it('getFilterFeatures 2020年人口总数', async done => { + jest.useFakeTimers(); const fetchResource = { 'http://fake/fakeiportal/web/config/portal.json': iportal_serviceProxy, 'http://fake/fakeiportal/web/maps/test/map.json': raster4490 @@ -1399,8 +1488,8 @@ describe('WebMapViewModel.spec', () => { viewModel.on({ mapinitialized: () => { - viewModel._updateDataFlowFeature = jest.fn(); - viewModel._handleDataflowFeatures( + viewModel._handler._updateDataFlowFeature = jest.fn(); + viewModel._handler._handleDataflowFeatures( { filterCondition: '2020年人口总数>10', pointStyle: { "fillColor": "#ee4d5a", @@ -1414,23 +1503,26 @@ describe('WebMapViewModel.spec', () => { }, { data: JSON.stringify({ properties: { '2020年人口总数': 15 } }) } ); - const res = viewModel.getFilterFeatures('2020年人口总数>10', [{ properties: { '2020年人口总数': 15 } }]); + const res = viewModel._handler.getFilterFeatures('2020年人口总数>10', [{ properties: { '2020年人口总数': 15 } }]); expect(res.length).toBe(1); - const res1 = viewModel.getFilterFeatures('气压传感器海拔高度(米)>2000', [ + const res1 = viewModel._handler.getFilterFeatures('气压传感器海拔高度(米)>2000', [ { properties: { '气压传感器海拔高度(米)': 15 } } ]); expect(res1.length).toBe(1); done(); } }); + await flushPromises(); + jest.advanceTimersByTime(120); }); - it('isvj-5215', done => { + it('isvj-5215', async done => { const fetchResource = { 'http://fake/fakeiportal/web/config/portal.json': iportal_serviceProxy, 'http://fake/fakeiportal/web/maps/test/map.json': raster4490 }; mockFetch(fetchResource); + jest.useFakeTimers(); const viewModel = new WebMapViewModel( 'test', { @@ -1553,7 +1645,7 @@ describe('WebMapViewModel.spec', () => { viewModel.on({ mapinitialized: () => { viewModel._updateDataFlowFeature = jest.fn(); - const res = viewModel.getUniqueStyleGroup(parameters, [ + const res = viewModel._handler.getUniqueStyleGroup(parameters, [ { properties: { UserID: 30 } }, { properties: { UserID: 0 } } ]); @@ -1561,6 +1653,8 @@ describe('WebMapViewModel.spec', () => { done(); } }); + await flushPromises(); + jest.advanceTimersByTime(120); }); it('crs not support', done => { const get = jest.spyOn(CRS, 'get'); @@ -1575,31 +1669,37 @@ describe('WebMapViewModel.spec', () => { } }); - it('add baselayer which is bing', done => { + it('add baselayer which is bing', async done => { + jest.useFakeTimers(); const callback = function (data) { expect(data).not.toBeUndefined(); done(); }; const viewModel = new WebMapViewModel(baseLayers['BING']); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('add baselayer which is goole_cn', done => { + it('add baselayer which is goole_cn', async done => { + jest.useFakeTimers(); const callback = function (data) { expect(data).not.toBeUndefined(); done(); }; const viewModel = new WebMapViewModel(baseLayers['GOOGLE']); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('add wmsLayer with correct url and version is less than 1.3', done => { + it('add wmsLayer with correct url and version is less than 1.3', async done => { const fetchResource = { 'http://fake/iserver/services/map-world/wms130/%E4%B8%96%E7%95%8C%E5%9C%B0%E5%9B%BE_Day?REQUEST=GetCapabilities&SERVICE=WMS': wmsCapabilitiesText }; mockFetch(fetchResource); - const viewModel = new WebMapViewModel({ + const mapData = { ...wmsLayer, layers: [ { @@ -1607,14 +1707,19 @@ describe('WebMapViewModel.spec', () => { url: 'http://fake/iserver/services/map-world/wms130/%E4%B8%96%E7%95%8C%E5%9C%B0%E5%9B%BE_Day' } ] - }); - const addLayerSpy = jest.spyOn(viewModel.map, 'addLayer'); + }; + const viewModel = new WebMapViewModel(mapData); const callback = function (data) { - expect(addLayerSpy).toHaveBeenCalledTimes(2); + console.log(33); + expect(viewModel.getAppreciableLayers().length).toBe(mapData.layers.length); + console.log(44); expect(data).not.toBeUndefined(); + console.log(55); done(); }; viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); it('add wmsLayer with correct url and version is 1.3.0', async done => { @@ -1623,8 +1728,7 @@ describe('WebMapViewModel.spec', () => { wmsCapabilitiesTextWith130 }; mockFetch(fetchResource); - const callback = async function (data) { - await flushPromises(); + const callback = function (data) { expect(data).not.toBeUndefined(); expect(data.map.overlayLayersManager['世界地图_Day'].source.tiles[0].indexOf('{bbox-wms-1.3.0}')).toBeGreaterThan( -1 @@ -1643,27 +1747,29 @@ describe('WebMapViewModel.spec', () => { ] }); viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('add wmtsLayer with correct url', done => { + it('add wmtsLayer with correct url', async done => { const fetchResource = { 'http://fack/iserver/services/map-china400/wmts100?REQUEST=GetCapabilities&SERVICE=WMTS&VERSION=1.0.0': wmtsCapabilitiesText }; mockFetch(fetchResource); const viewModel = new WebMapViewModel(baseLayers['WMTS'], { ...commonOption }); - const addLayerSpy = jest.spyOn(viewModel.map, 'addLayer'); const callback = function (data) { - expect(addLayerSpy).toHaveBeenCalledTimes(2); + expect(viewModel.getAppreciableLayers().length).toBe(baseLayers['WMTS'].layers.length); expect(data).not.toBeUndefined(); - expect(viewModel.getSourceListModel).not.toBeNull(); done(); }; viewModel.on({ addlayerssucceeded: callback }); + await flushPromises(); + jest.advanceTimersByTime(0); }); - it('add wmtsLayer with error url', done => { - const callback = async function (data) { + it('add wmtsLayer with error url', async done => { + const callback = function (data) { expect(data).not.toBeUndefined(); done(); }; @@ -1672,32 +1778,33 @@ describe('WebMapViewModel.spec', () => { layers: [{ ...wmtsLayer.layers[0], url: '/iserver/services/map-china400/wmts100' }] }); viewModel.on({ getmapinfofailed: callback }); + jest.advanceTimersByTime(0); + await flushPromises(); }); describe('test layer autorefresh and visblescale', () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + afterEach(() => { + jest.useRealTimers(); + }); it('tile layer', async done => { const viewModel = new WebMapViewModel( restmapLayer, - { ...commonOption }, + { ...commonOption, ignoreBaseProjection: true }, { ...commonMapOptions }, { ...commonMap } ); - jest.useFakeTimers(); - expect(viewModel._layerTimerList.length).toBe(0); await flushPromises(); jest.advanceTimersByTime(1000); - expect(viewModel._layerTimerList.length).not.toBe(0); - jest.useRealTimers(); + expect(viewModel._handler._layerTimerList.length).not.toBe(0); done(); }); it('other layer except tile layer', async done => { const viewModel = new WebMapViewModel(heatLayer, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); - jest.useFakeTimers(); - expect(viewModel._layerTimerList.length).toBe(0); await flushPromises(); - jest.advanceTimersByTime(1000); - expect(viewModel._layerTimerList.length).not.toBe(0); - jest.useRealTimers(); + expect(viewModel._handler._layerTimerList.length).not.toBe(0); done(); }); }); @@ -1721,8 +1828,14 @@ describe('WebMapViewModel.spec', () => { }); describe('test transformRequest', () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + afterEach(() => { + jest.useRealTimers(); + }); const proxyStr = 'http://localhost:8080/iportal/apps/viewer/getUrlResource.png?url='; - it('add online map', done => { + it('add online map', async done => { const viewModel = new WebMapViewModel(baseLayers['TILE'], { isSuperMapOnline: true, serverUrl: 'https://www.supermapol.com' @@ -1735,19 +1848,30 @@ describe('WebMapViewModel.spec', () => { 'https://', 'http://' ); + await flushPromises(); + jest.advanceTimersByTime(0); const transformed = viewModel.map.options.transformRequest(mockTileUrl, 'Tile'); expect(transformed.url).toMatch('https://www.supermapol.com/apps/viewer/getUrlResource.png?url='); done(); }); - it('add iportal map', done => { + it('add iportal map', async done => { const viewModel = new WebMapViewModel(baseLayers['BAIDU']); const mockTileUrl = ''; + await flushPromises(); + jest.advanceTimersByTime(0); const transformed = viewModel.map.options.transformRequest(mockTileUrl); expect(transformed.url).toBe(mockTileUrl); done(); }); describe('add internet map', () => { + beforeEach(() => { + jest.useFakeTimers(); + jest.advanceTimersByTime(0); + }); + afterEach(() => { + jest.useRealTimers(); + }); const tiles = [ 'https://t0.tianditu.gov.cn/ter_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=ter&tilematrix={z}&tilerow={y}&tilecol={x}', 'https://t1.tianditu.gov.cn/ter_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=ter&tilematrix={z}&tilerow={y}&tilecol={x}', @@ -1779,13 +1903,12 @@ describe('WebMapViewModel.spec', () => { minzoom: 0, maxzoom: 22 }; - it('test fadeDuration', done => { - jest.useFakeTimers(); + it('test fadeDuration', async done => { const viewModel = new WebMapViewModel('', { ...commonOption }, { ...mapOptions, fadeDuration: 300 }); expect(viewModel.map).toBeUndefined(); + await flushPromises(); jest.advanceTimersByTime(0); expect(viewModel.map).not.toBeUndefined(); - jest.useRealTimers(); done(); }); it('test transformRequest when proxy is string', done => { @@ -1804,24 +1927,16 @@ describe('WebMapViewModel.spec', () => { }); }); }); - it('layerFilter', done => { - const callback = function (data) { - expect(data.layers.length).toBe(1); - done(); - }; + it('layerFilter', async done => { const viewModel = new WebMapViewModel(vectorLayer_line, {}, undefined, null, function (layer) { return layer.name === '浙江省高等院校(3)'; }); + const callback = function () { + expect(viewModel.getAppreciableLayers().length).toBe(1); + done(); + }; viewModel.on({ addlayerssucceeded: callback }); - }); - - it('stopCanvg', done => { - const viewModel = new WebMapViewModel(vectorLayer_line, {}, undefined, null, function (layer) { - return layer.name === '浙江省高等院校(3)'; - }); - viewModel.canvgsV = [{ stop: jest.fn() }]; - viewModel.stopCanvg(); - expect(viewModel.canvgsV.length).toBe(0); - done(); + await flushPromises(); + jest.advanceTimersByTime(0); }); }); diff --git a/src/mapboxgl/web-map/control/identify/__tests__/Identify.spec.js b/src/mapboxgl/web-map/control/identify/__tests__/Identify.spec.js index c869d34f..3fd2d8c2 100644 --- a/src/mapboxgl/web-map/control/identify/__tests__/Identify.spec.js +++ b/src/mapboxgl/web-map/control/identify/__tests__/Identify.spec.js @@ -1,32 +1,14 @@ import { mount, config } from '@vue/test-utils'; import SmIdentify from '../Identify.vue'; import Identify from '../index'; -import SmWebMap from '../../../WebMap.vue'; -import mapLoaded from 'vue-iclient/test/unit/mapLoaded.js'; import { LineStyle, CircleStyle, FillStyle } from '../../../../_types/index'; import mapboxgl from '@libs/mapboxgl/mapbox-gl-enhance.js'; +import mapSubComponentLoaded from 'vue-iclient/test/unit/mapSubComponentLoaded'; +import createEmptyMap from 'vue-iclient/test/unit/createEmptyMap'; describe('Identify.vue', () => { let wrapper; - let identifyWrapper; - const mapInfo = { - extent: { - leftBottom: { x: 0, y: 0 }, - rightTop: { x: 0, y: 0 } - }, - level: 5, - center: { x: 0, y: 0 }, - baseLayer: { - layerType: 'TILE', - name: 'China', - url: 'http://test' - }, - layers: [], - description: '', - projection: 'EPSG:3857', - title: 'testMap', - version: '1.0' - }; + let mapWrapper; beforeEach(() => { config.mapLoad = false; @@ -36,56 +18,40 @@ describe('Identify.vue', () => { afterEach(() => { jest.restoreAllMocks(); config.mapLoad = true; + if (mapWrapper) { + mapWrapper.destroy(); + } if (wrapper) { wrapper.destroy(); } }); it('render default correctly', async done => { - wrapper = mount({ - template: ` - - - `, - components: { - SmIdentify, - SmWebMap - }, - data() { - return { - mapInfo: mapInfo, - autoResize: false - }; + mapWrapper = await createEmptyMap(); + wrapper = mount(SmIdentify, { + propsData: { + layers: ['民航数据'], + fields: ['机场','同比增速%','2017旅客吞吐量(人次)'], + autoResize: false } }); - const callback = jest.fn(); - identifyWrapper = wrapper.vm.$children[0].$children[0]; - identifyWrapper.$on('loaded', callback); - await mapLoaded(wrapper.vm.$children[0]); - expect(callback.mock.called).toBeTruthy; + await mapSubComponentLoaded(wrapper); expect(wrapper.find('.sm-component-identify').exists()).toBe(true); - identifyWrapper.getWidthStyle; - expect(identifyWrapper.keyMaxWidth).toBe(110); - expect(identifyWrapper.valueMaxWidth).toBe(170); + wrapper.vm.getWidthStyle; + expect(wrapper.vm.keyMaxWidth).toBe(110); + expect(wrapper.vm.valueMaxWidth).toBe(170); done(); }); it('clcik map', async done => { - wrapper = mount({ - template: ` - - - `, - components: { - SmIdentify, - SmWebMap - }, - data() { - return { - mapInfo: mapInfo - }; + mapWrapper = await createEmptyMap(); + wrapper = mount(SmIdentify, { + propsData: { + layers: ['China'], + fields: ['机场','同比增速%','2017旅客吞吐量(人次)'] } }); + await mapSubComponentLoaded(wrapper); const spyPopup = jest.spyOn(mapboxgl, 'Popup'); spyPopup.mockReturnValue({ setLngLat: jest.fn().mockReturnValue({ @@ -98,12 +64,7 @@ describe('Identify.vue', () => { }) }) }); - const callback = jest.fn(); - identifyWrapper = wrapper.vm.$children[0].$children[0]; - identifyWrapper.$on('loaded', callback); - await mapLoaded(wrapper.vm.$children[0]); - expect(callback.mock.called).toBeTruthy; - const spy = jest.spyOn(identifyWrapper.viewModel, 'removed'); + const spy = jest.spyOn(wrapper.vm.viewModel, 'removed'); const e = { target: '', point: { @@ -111,7 +72,7 @@ describe('Identify.vue', () => { y: 10 } }; - identifyWrapper.map.fire('click', e); + wrapper.vm.map.fire('click', e); await wrapper.setProps({ layers: ['民航数据'] }); @@ -122,58 +83,22 @@ describe('Identify.vue', () => { it('clcik layer on map', async done => { // 设置外界传入的参数,对面填充和边框的颜色 const color = '#FF0000'; - wrapper = mount({ - template: ` - - - - `, - // ` - // - // `, - components: { - SmIdentify, - SmWebMap - }, - data() { - return { - mapInfo: { - extent: { - leftBottom: { x: 0, y: 0 }, - rightTop: { x: 0, y: 0 } - }, - level: 5, - center: { x: 0, y: 0 }, - baseLayer: { - mapId: 1160955209, - layerType: 'TILE', - name: 'China', - url: 'http://172.16.14.44:8190/iportal' - }, - layers: [], - description: '', - projection: 'EPSG:3857', - title: 'testMap', - version: '1.0' - }, - layerStyles: { - line: new LineStyle({ 'line-width': 3, 'line-color': '#3fb1e3' }), - circle: new CircleStyle({ 'circle-color': '#3fb1e3', 'circle-radius': 6 }), - fill: new FillStyle({ 'fill-color': '#3fb1e3', 'fill-opacity': 0.8 }), - stokeLine: new LineStyle({ 'line-width': 3, 'line-color': color }) - } - }; + mapWrapper = await createEmptyMap(); + wrapper = mount(SmIdentify, { + propsData: { + layers: ['第七次人口普查全国各省人口数(未包含港澳台','第七次人口普查全国各省人口数(未包含港澳台-strokeLine'], + fields: ['地区','人口数'], + layerStyle: { + line: new LineStyle({ 'line-width': 3, 'line-color': '#3fb1e3' }), + circle: new CircleStyle({ 'circle-color': '#3fb1e3', 'circle-radius': 6 }), + fill: new FillStyle({ 'fill-color': '#3fb1e3', 'fill-opacity': 0.8 }), + stokeLine: new LineStyle({ 'line-width': 3, 'line-color': color }) + } } }); - const callback = jest.fn(); - identifyWrapper = wrapper.vm.$children[0].$children[0]; - identifyWrapper.$on('loaded', callback); - await mapLoaded(wrapper.vm.$children[0]); - identifyWrapper.setViewModel(); - const spy = jest.spyOn(identifyWrapper.viewModel, 'addOverlayToMap'); + await mapSubComponentLoaded(wrapper); + wrapper.vm.setViewModel(); + const spy = jest.spyOn(wrapper.vm.viewModel, 'addOverlayToMap'); // 手动设置点击事件的参数,确认是再点击面 const layer = { id: '第七次人口普查全国各省人口数(未包含港澳台', @@ -191,55 +116,26 @@ describe('Identify.vue', () => { const filter = '["all",["==","地区","青海"]]'; // - identifyWrapper.viewModel.addOverlayToMap(layer, filter); + wrapper.vm.viewModel.addOverlayToMap(layer, filter); // 确保修改图层的函数被执行 expect(spy).toHaveBeenCalledTimes(1); // 判断图层颜色是否被修改 - expect(identifyWrapper.viewModel.layerStyle.stokeLine.paint['line-color']).toBe(color); + expect(wrapper.vm.viewModel.layerStyle.stokeLine.paint['line-color']).toBe(color); done(); }); it('clcik layer not on map', async done => { - wrapper = mount({ - template: ` - - `, - components: { - SmIdentify, - SmWebMap - }, - data() { - return { - mapInfo: { - extent: { - leftBottom: { x: 0, y: 0 }, - rightTop: { x: 0, y: 0 } - }, - level: 5, - center: { x: 0, y: 0 }, - baseLayer: { - mapId: 1160955209, - layerType: 'TILE', - name: 'China', - url: 'http://172.16.14.44:8190/iportal' - }, - layers: [], - description: '', - projection: 'EPSG:3857', - title: 'testMap', - version: '1.0' - } - }; + mapWrapper = await createEmptyMap(); + wrapper = mount(SmIdentify, { + propsData: { + layers: ['test'] } }); - const callback = jest.fn(); - identifyWrapper = wrapper.vm.$children[0].$children[0]; - identifyWrapper.$on('loaded', callback); - await mapLoaded(wrapper.vm.$children[0]); - identifyWrapper.bindQueryRenderedFeatures( + await mapSubComponentLoaded(wrapper); + wrapper.vm.bindQueryRenderedFeatures( { target: { getLayer: jest.fn(), @@ -252,34 +148,23 @@ describe('Identify.vue', () => { }, ['test'] ); + done(); }); it('grab', async done => { - wrapper = mount({ - template: ` - - - `, - components: { - SmIdentify, - SmWebMap - }, - data() { - return { - mapInfo: mapInfo - }; + mapWrapper = await createEmptyMap(); + wrapper = mount(SmIdentify, { + propsData: { + layers: ['China'], + fields: ['机场','同比增速%','2017旅客吞吐量(人次)'] } }); - const callback = jest.fn(); - identifyWrapper = wrapper.vm.$children[0].$children[0]; - identifyWrapper.$on('loaded', callback); - await mapLoaded(wrapper.vm.$children[0]); - expect(callback.mock.called).toBeTruthy; - const spy = jest.spyOn(identifyWrapper.map, 'getCanvas'); - identifyWrapper.getWidthStyle; - identifyWrapper.layerStyle; - identifyWrapper.changeCursorGrab(); - identifyWrapper.changeCursorPointer(); + await mapSubComponentLoaded(wrapper); + const spy = jest.spyOn(wrapper.vm.map, 'getCanvas'); + wrapper.vm.getWidthStyle; + wrapper.vm.layerStyle; + wrapper.vm.changeCursorGrab(); + wrapper.vm.changeCursorPointer(); expect(spy).toHaveBeenCalledTimes(4); done(); }); diff --git a/src/mapboxgl/web-map/control/layer-color/LayerColor.vue b/src/mapboxgl/web-map/control/layer-color/LayerColor.vue index f30c13ae..c2b5724b 100644 --- a/src/mapboxgl/web-map/control/layer-color/LayerColor.vue +++ b/src/mapboxgl/web-map/control/layer-color/LayerColor.vue @@ -72,6 +72,7 @@ const TYPE_MAP = { circle: ['circle-color', 'circle-stroke-color'], line: ['line-color'], fill: ['fill-color', 'fill-outline-color'], + background: ['background-color'], symbol: ['icon-color', 'icon-halo-color', 'text-color', 'text-halo-color'] }; @@ -144,13 +145,13 @@ class SmLayerColor extends Mixins(MapGetter, Control, Theme, BaseCard) { return ''; } - filtercb(item, type) { - if (item.type === 'raster') { + filtercb(layerType, type) { + if (layerType === 'raster' || layerType === 'heatmap') { return { show: false }; } - if (type === 'sourceLayer' || type === 'source') { + if (type === 'group') { return { disabled: true }; diff --git a/src/mapboxgl/web-map/control/layer-list/LayerList.vue b/src/mapboxgl/web-map/control/layer-list/LayerList.vue index 2721ca76..d7b93784 100644 --- a/src/mapboxgl/web-map/control/layer-list/LayerList.vue +++ b/src/mapboxgl/web-map/control/layer-list/LayerList.vue @@ -13,97 +13,13 @@ >
- - - -
- -
- {{ sourcelayerKey }} -
-
-
- -
-
- -
{{ name }}
-
-
- -
-
-
+ +
= []; - sourceList: Object; + sourceList: Array = []; layerList: Array = []; attributesProps: Object = {}; layerUpdateFn: Function; @@ -246,12 +164,6 @@ class SmLayerList extends Mixins(MapGetter, Control, Theme, BaseCard) { return intersection(this.sourceNames, this.sourceList && Object.keys(this.sourceList)); } - get layerName() { - return function (source) { - return source.layers[0].id; - }; - } - get attributesStyle() { let attributesStyle; let position; @@ -294,8 +206,12 @@ class SmLayerList extends Mixins(MapGetter, Control, Theme, BaseCard) { this.viewModel = new LayerListViewModel(); } - toggleVisibility(sourceLayer, sourceName, visibility: string) { - this.viewModel && this.viewModel.changeLayerVisible(sourceLayer, sourceName, visibility); + checkAttributesEnabled(item) { + return this.viewModel.checkAttributesEnabled(item); + } + + toggleItemVisibility(item) { + this.viewModel && this.viewModel.changeItemVisible(item); } addNewLayer() { @@ -306,11 +222,7 @@ class SmLayerList extends Mixins(MapGetter, Control, Theme, BaseCard) { this.viewModel.deleteLayer(); } - toggleLayerGroupVisibility(sourceName, visibility: string) { - this.viewModel && this.viewModel.changeLayerGroupVisibility(sourceName, visibility); - } - - toggleAttributesVisibility(e, layerName: string) { + toggleAttributesVisibility(e, layerName: string, title: string) { if (e.target.className.indexOf('sm-components-icon-attribute-open') !== -1) { e.target.setAttribute('class', this.attributesIconClass); this.displayAttributes = !this.displayAttributes; @@ -318,21 +230,22 @@ class SmLayerList extends Mixins(MapGetter, Control, Theme, BaseCard) { } this.closeAttributesIconClass(); this.removeAttributes(); - this.handleAttributesProps(layerName); + this.handleAttributesProps(layerName, title); e.target.setAttribute('class', `${this.attributesIconClass} sm-components-icon-attribute-open`); // @ts-ignore this.attributesContainer.appendChild(this.$refs.attributes.$el); this.displayAttributes = !this.displayAttributes; } - handleAttributesProps(layerName: string) { + async handleAttributesProps(layerName: string, title: string) { const props = Object.assign({}, this.attributes); for (const key in props) { if (ATTRIBUTES_NEEDED_PROPS.indexOf(key) === -1) { delete props[key]; } } - this.attributesProps = { layerName, title: layerName, ...props }; + const dataset = await this.viewModel.getLayerDatas(layerName); + this.attributesProps = { dataset: Object.freeze(dataset), title, ...props }; } layerUpdate() { diff --git a/src/mapboxgl/web-map/control/layer-list/LayerListViewModel.ts b/src/mapboxgl/web-map/control/layer-list/LayerListViewModel.ts index 42f4372a..6c10d497 100644 --- a/src/mapboxgl/web-map/control/layer-list/LayerListViewModel.ts +++ b/src/mapboxgl/web-map/control/layer-list/LayerListViewModel.ts @@ -1,5 +1,4 @@ import mapboxgl from 'vue-iclient/static/libs/mapboxgl/mapbox-gl-enhance'; -import SourceListModel from 'vue-iclient/src/mapboxgl/web-map/SourceListModel'; /** * @class LayerListViewModel @@ -14,7 +13,7 @@ interface MapEventCallBack { class LayerListViewModel extends mapboxgl.Evented { map: mapboxglTypes.Map; - sourceList: Object; + sourceList: Array; sourceNames: Array; @@ -22,11 +21,9 @@ class LayerListViewModel extends mapboxgl.Evented { updateFn: MapEventCallBack; - sourceListModel: SourceListModel; - constructor() { super(); - this.sourceList = {}; + this.sourceList = []; this.sourceNames = []; } @@ -35,18 +32,15 @@ class LayerListViewModel extends mapboxgl.Evented { } setMap(mapInfo) { - const { map } = mapInfo; + const { map, webmap } = mapInfo; this.map = map; + this.webmap = webmap; this.updateFn = this._updateLayers.bind(this); this.map.on('styledata', this.updateFn); } initLayerList() { - this.sourceListModel = new SourceListModel({ - map: this.map - }); - this.sourceList = this.sourceListModel.getSourceList(); - this.sourceNames = this.sourceListModel.getSourceNames().reverse(); + this.sourceList = this.webmap.getLayerList(); return this.sourceList; } @@ -54,33 +48,32 @@ class LayerListViewModel extends mapboxgl.Evented { return this.sourceNames; } - changeLayerVisible(sourcelayer, sourceName: string, visibility: string) { - this.sourceListModel.getLayersBySourceLayer(sourceName, sourcelayer).forEach(layer => { - this.map.setLayoutProperty(layer.id, 'visibility', this.changeVisibility(visibility)); - }); + checkAttributesEnabled(item) { + const source = this.map.getSource(item.layer.source); + const hasDatasetId = this.webmap.getDatasetIdByLayerId(item.id); + return source.type === 'geojson' || hasDatasetId; } - changeVisibility(visibility: string) { - return visibility === 'visible' ? 'none' : 'visible'; + async getLayerDatas(layerName) { + const features = await this.webmap.getLayerDatas(layerName); + return this.setDataset(features); } - changeLayerGroupVisibility(sourceName: string, visibility: string) { - let sourceLayers = this.sourceListModel.getSourceLayersBySource(sourceName); - if (sourceLayers) { - for (let sourcelayer in sourceLayers) { - sourceLayers[sourcelayer].forEach(layer => { - this.map.setLayoutProperty(layer.id, 'visibility', this.changeVisibility(visibility)); - }); - } - } else { - for (let layer of this.sourceList[sourceName].layers) { - this.map.setLayoutProperty(layer.id, 'visibility', this.changeVisibility(visibility)); - } + // 将features转换成属性表dataset所需的GeoJSONParameter形式 + setDataset(features) { + let dataset = { type: 'geoJSON', geoJSON: null }; + if (features) { + dataset.geoJSON = { type: 'FeatureCollection', features }; } + return dataset; + } + + changeItemVisible(item) { + this.webmap.changeItemVisible(item); } removed() { - this.sourceList = {}; + this.sourceList = []; this.sourceNames = []; this.map.off('styledata', this.updateFn); } diff --git a/src/mapboxgl/web-map/control/layer-list/__tests__/LayerList.spec.js b/src/mapboxgl/web-map/control/layer-list/__tests__/LayerList.spec.js index f3de0062..4d1ec574 100644 --- a/src/mapboxgl/web-map/control/layer-list/__tests__/LayerList.spec.js +++ b/src/mapboxgl/web-map/control/layer-list/__tests__/LayerList.spec.js @@ -5,14 +5,82 @@ import LayerList from '../index'; import mockFetch from 'vue-iclient/test/unit/mocks/FetchRequest'; import iportal_serviceProxy from 'vue-iclient/test/unit/mocks/data/iportal_serviceProxy'; import uniqueLayer_point from 'vue-iclient/test/unit/mocks/data/WebMap/uniqueLayer_point'; +import layer_v3 from 'vue-iclient/test/unit/mocks/data/WebMap/layer_v3'; import layerData from 'vue-iclient/test/unit/mocks/data/layerData'; -import mapWrapperLoaded from 'vue-iclient/test/unit/mapWrapperLoaded.js'; -import flushPromises from 'flush-promises'; +import mapboxgl from '@libs/mapboxgl/mapbox-gl-enhance.js'; describe('LayerList.vue', () => { let wrapper; let mapWrapper; + const commonMap = { + map:{ + resize: () => jest.fn(), + getZoom: () => jest.fn(), + setZoom: () => jest.fn(), + setCRS: () => jest.fn(), + getCenter: () => { + return { + lng: 1, + lat: 2 + }; + }, + setCenter: () => jest.fn(), + getBearing: () => 2, + setBearing: () => jest.fn(), + getPitch: () => 2, + setPitch: () => jest.fn(), + getStyle: () => { + return { + layers: [{ + id: 1 + }] + } + }, + addSource: () => jest.fn(), + getSource: () => jest.fn(), + removeSource: jest.fn(), + triggerRepaint: () => jest.fn(), + style: jest.fn(), + getLayer: jest.fn(), + removeLayer: jest.fn(), + getCRS: () => { + return { + epsgCode: 'EPSG:3857', + getExtent: () => jest.fn() + }; + }, + addLayer: () => jest.fn(), + moveLayer: () => jest.fn(), + overlayLayersManager: {}, + on: () => { }, + off: () => { }, + fire: () => { }, + setLayoutProperty: () => jest.fn(), + addStyle: () => jest.fn(), + remove: () => jest.fn(), + setRenderWorldCopies: () => jest.fn(), + setStyle: () => jest.fn(), + loadImage: function (src, callback) { + callback(null, { width: 15 }); + }, + addImage: function () { }, + hasImage: function () { + return false; + } + }, + mapparams: {}, + layers: [] + }; + + mapboxgl.supermap.WebMapV3 = () => { + return { + on: (event, callback) => { + callback(commonMap); + } + } + } + beforeEach(() => { wrapper = null; mapWrapper = null; @@ -46,21 +114,23 @@ describe('LayerList.vue', () => { mapId: '123' } }); - wrapper = mount(SmLayerList, { - propsData: { - mapTarget: 'map' - } - }); - const callback = jest.fn(); - wrapper.vm.$on('loaded', callback); - await mapWrapperLoaded(mapWrapper); - await flushPromises(); - expect(callback.mock.called).toBeTruthy; - let spylayerVisibility = jest.spyOn(wrapper.vm, 'toggleLayerGroupVisibility'); - wrapper.findAll('.sm-components-icon-hidden').at(0).trigger('click'); - expect(spylayerVisibility).toHaveBeenCalledTimes(1); - wrapper.vm.$nextTick(); - done(); + const addCallback = function (data) { + wrapper = mount(SmLayerList, { + propsData: { + mapTarget: 'map' + } + }); + const callback = jest.fn(); + wrapper.vm.$on('loaded', callback); + expect(callback.mock.called).toBeTruthy; + let spylayerVisibility = jest.spyOn(wrapper.vm, 'toggleItemVisibility'); + wrapper.vm.$nextTick(() => { + wrapper.find('.sm-component-layer-list__layer > i').trigger('click'); + expect(spylayerVisibility).toHaveBeenCalledTimes(1); + done(); + }); + }; + mapWrapper.vm.viewModel.on({ addlayerssucceeded: addCallback }); }); it('layerGroupVisibility vector-tile', async done => { @@ -122,23 +192,26 @@ describe('LayerList.vue', () => { mapOptions: mapOptions } }); - wrapper = mount(SmLayerList, { - propsData: { - mapTarget: 'map' - } - }); - let spyProperty = jest.spyOn(wrapper.vm.viewModel, 'changeLayerGroupVisibility'); - const callback = jest.fn(); - wrapper.vm.$on('loaded', callback); - await mapWrapperLoaded(mapWrapper); - await flushPromises(); - expect(callback.mock.called).toBeTruthy; - expect(wrapper.vm.mapTarget).toBe('map'); - wrapper.vm.$nextTick(() => { - wrapper.find('i.sm-components-icon-visible').trigger('click'); - expect(spyProperty).toHaveBeenCalledWith('vector-tiles', 'visible'); - done(); - }); + + const addCallback = function (data) { + wrapper = mount(SmLayerList, { + propsData: { + mapTarget: 'map' + } + }); + let spyProperty = jest.spyOn(wrapper.vm.viewModel, 'changeItemVisible'); + const callback = jest.fn(); + wrapper.vm.$on('loaded', callback); + expect(callback.mock.called).toBeTruthy; + expect(wrapper.vm.mapTarget).toBe('map'); + wrapper.vm.$nextTick(() => { + wrapper.find('.sm-components-icon-partially-visible').trigger('click'); + expect(spyProperty).toHaveBeenCalledTimes(1); + done(); + }); + }; + mapWrapper.vm.viewModel.on({ addlayerssucceeded: addCallback }); + }); it('attributes style', () => { @@ -165,4 +238,36 @@ describe('LayerList.vue', () => { expect(wrapper.find('div.sm-component-layer-list').exists()).toBe(true); expect(wrapper.vm.attributes.position).toBe('left'); }); + + it('render v3 layers', async done => { + const fetchResource = { + 'https://fakeiportal.supermap.io/iportal/web/config/portal.json': iportal_serviceProxy, + 'https://fakeiportal.supermap.io/iportal/web/maps/123/map.json': layer_v3, + 'https://fakeiportal.supermap.io/iportal/web/datas/676516522/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=123': layerData + }; + mockFetch(fetchResource); + mapWrapper = mount(SmWebMap, { + propsData: { + serverUrl: 'https://fakeiportal.supermap.io/iportal', + mapId: '123' + } + }); + const addCallback = function (data) { + wrapper = mount(SmLayerList, { + propsData: { + mapTarget: 'map' + } + }); + const callback = jest.fn(); + wrapper.vm.$on('loaded', callback); + expect(callback.mock.called).toBeTruthy; + let spylayerVisibility = jest.spyOn(wrapper.vm, 'toggleItemVisibility'); + wrapper.vm.$nextTick(() => { + wrapper.find('.sm-component-layer-list__layer > i').trigger('click'); + expect(spylayerVisibility).toHaveBeenCalledTimes(1); + done(); + }); + }; + mapWrapper.vm.viewModel.on({ addlayerssucceeded: addCallback }); + }); }); diff --git a/src/mapboxgl/web-map/control/layer-list/style/layer-list.scss b/src/mapboxgl/web-map/control/layer-list/style/layer-list.scss index f43c28c6..ac568571 100644 --- a/src/mapboxgl/web-map/control/layer-list/style/layer-list.scss +++ b/src/mapboxgl/web-map/control/layer-list/style/layer-list.scss @@ -38,7 +38,7 @@ .#{$iconfont-class-prefix}-solid-triangle-down { display: none; } - &.#{$collapse-prefix}-item-active { + &.#{$collapse-prefix}-item-active > .#{$collapse-prefix}-header{ .#{$iconfont-class-prefix}-solid-triangle-right { display: none; } diff --git a/src/mapboxgl/web-map/control/legend/Legend.vue b/src/mapboxgl/web-map/control/legend/Legend.vue index e857cef4..7ee30af1 100644 --- a/src/mapboxgl/web-map/control/legend/Legend.vue +++ b/src/mapboxgl/web-map/control/legend/Legend.vue @@ -12,163 +12,65 @@ class="sm-component-legend" > + @@ -182,30 +84,17 @@ import SmCard from 'vue-iclient/src/common/card/Card.vue'; import SmCollapse from 'vue-iclient/src/common/collapse/Collapse.vue'; import SmCollapsePanel from 'vue-iclient/src/common/collapse/Panel.vue'; import LegendViewModel from './LegendViewModel'; -import { getColorWithOpacity } from 'vue-iclient/src/common/_utils/util'; +import StyleItem from './subs/StyleItem.vue'; +import StyleField from './subs/StyleField.vue'; export default { name: 'SmLegend', components: { SmCard, SmCollapse, - SmCollapsePanel - }, - filters: { - selectLayerType(featureType, style) { - if (style.className) { - return style.className; - } - const result = { - POLYGON: 'sm-components-icon-ploygon', - POINT: 'sm-components-icon-multi-point', - LINE: 'sm-components-icon-line' - }[featureType]; - if (featureType === 'POINT' && style.type !== 'BASIC_POINT') { - return ''; - } - return result; - } + SmCollapsePanel, + StyleItem, + StyleField }, mixins: [MapGetter, Control, Theme, BaseCard], props: { @@ -247,94 +136,9 @@ export default { return { legendList: {}, // 控制第一个图例默认展开 - activeLegend: [], - - themeStyle: {} + activeLegend: [] }; }, - computed: { - uniqueSymbolStyle() { - return function (styleItem) { - const { style, radius, color } = styleItem; - let generateStyle = {}; - switch (style.type) { - case 'BASIC_POINT': - generateStyle.color = getColorWithOpacity(color, style.fillOpacity); - break; - case 'SYMBOL_POINT': - generateStyle.color = getColorWithOpacity(color, style.fillOpacity); - generateStyle.fontSize = `${radius * 2}px`; - break; - case 'IMAGE_POINT': - generateStyle.background = `url(${style.imageInfo.url})`; - generateStyle.backgroundSize = 'contain'; - generateStyle.width = `${(style.radius || radius) * 2}px`; - generateStyle.height = `${(style.radius || radius) * 2}px`; - break; - case 'SVG_POINT': - generateStyle['-webkit-mask'] = `url(${style.url})`; - generateStyle.backgroundColor = getColorWithOpacity(color, style.fillOpacity); - generateStyle['-webkit-mask-size'] = 'contain'; - generateStyle.width = `${(style.radius || radius) * 2}px`; - generateStyle.height = `${(style.radius || radius) * 2}px`; - break; - default: - generateStyle.color = getColorWithOpacity(color, style.fillOpacity); - break; - } - return generateStyle; - }; - }, - rankSymbolStyle() { - return function (styleItem) { - const { style, radius, color } = styleItem; - let generateStyle = {}; - switch (style.type) { - case 'BASIC_POINT': - generateStyle.background = getColorWithOpacity(color || style.fillColor, style.fillOpacity); - generateStyle.width = `${radius * 2}px`; - generateStyle.height = `${radius * 2}px`; - generateStyle.borderRadius = `${radius}px`; - break; - case 'SYMBOL_POINT': - generateStyle.color = getColorWithOpacity(color || style.fillColor, style.fillOpacity); - generateStyle.fontSize = `${radius * 2}px`; - break; - case 'IMAGE_POINT': - generateStyle.background = `url(${style.imageInfo.url})`; - generateStyle.backgroundSize = 'contain'; - generateStyle.width = `${radius * 2}px`; - generateStyle.height = `${radius * 2}px`; - break; - default: - break; - } - return generateStyle; - }; - }, - showRangeInfo() { - return (item, layerKey) => { - const { start, end } = item; - if (start !== undefined && end !== undefined) { - if (this.legendList[layerKey].integerType) { - return this.getIntegerRangeInfo(start, end); - } - return `${start} - ${end}`; - } - return start !== undefined ? `≥${start}` : `≤${end}`; - }; - }, - rankIconStyle() { - return styleGroup => { - if (styleGroup instanceof Array) { - const radiusArr = styleGroup.map(item => item.radius); - const maxRadius = Math.max(...radiusArr); - return { width: `${maxRadius * 2}px` }; - } - return {}; - }; - } - }, watch: { layerNames: function () { this.initLegendList(); @@ -343,29 +147,21 @@ export default { methods: { initLegendList() { this.legendList = {}; + let defaultChoosenLayers = []; if (this.viewModel) { - this.layerNames.forEach(layer => { - let style = this.viewModel.getStyle(layer); - if (!style) { - return; - } - if (!this.legendList[layer]) { - this.$set(this.legendList, layer, style); + this.legendList = this.layerNames.reduce((list, name) => { + const styles = this.viewModel.getStyle(name); + if (styles) { + list[name] = styles; + !defaultChoosenLayers.length && defaultChoosenLayers.push(name); } - }); - this.activeLegend = JSON.stringify(this.legendList) !== '{}' ? Object.keys(this.legendList)[0] : []; - this.activeLegend = this.isShowTitle ? this.activeLegend : Object.keys(this.legendList); - } - }, - getIntegerRangeInfo(start, end) { - if (end - 1 === start || end === start) { - return `${start}`; + return list; + }, {}); + this.activeLegend = this.isShowTitle ? defaultChoosenLayers : Object.keys(this.legendList); } - return `${start} - ${end - 1}`; } }, loaded() { - // show用来控制图例列表的显示 this.viewModel = new LegendViewModel(this.webmap); this.initLegendList(); }, diff --git a/src/mapboxgl/web-map/control/legend/LegendViewModel.js b/src/mapboxgl/web-map/control/legend/LegendViewModel.js index b715ae81..eb3e26fd 100644 --- a/src/mapboxgl/web-map/control/legend/LegendViewModel.js +++ b/src/mapboxgl/web-map/control/legend/LegendViewModel.js @@ -10,11 +10,13 @@ class LegendViewModel extends mapboxgl.Evented { constructor(webmap) { super(webmap); this.webmap = webmap; - this.sourceListModel = this.webmap ? this.webmap.getSourceListModel : {}; + this.legendInfo = this.webmap.getLegendInfo(); } getStyle(layerName) { - return this.sourceListModel && this.sourceListModel.getLegendStyle(layerName); + return this.legendInfo.filter((info) => { + return info.layerId === layerName && info.styleGroup.length > 0; + }); } } export default LegendViewModel; diff --git a/src/mapboxgl/web-map/control/legend/__tests__/legend.spec.js b/src/mapboxgl/web-map/control/legend/__tests__/legend.spec.js index edd98287..1eedeaaa 100644 --- a/src/mapboxgl/web-map/control/legend/__tests__/legend.spec.js +++ b/src/mapboxgl/web-map/control/legend/__tests__/legend.spec.js @@ -1,29 +1,13 @@ import { mount } from '@vue/test-utils'; -import SmWebMap from '../../../WebMap.vue'; import SmLegend from '../Legend.vue'; import mockFetch from 'vue-iclient/test/unit/mocks/FetchRequest'; -import iportal_serviceProxy from 'vue-iclient/test/unit/mocks/data/iportal_serviceProxy'; -import uniqueLayer_point from 'vue-iclient/test/unit/mocks/data/WebMap/uniqueLayer_point'; -import layerData from 'vue-iclient/test/unit/mocks/data/layerData'; -import mapSubComponentLoaded from 'vue-iclient/test/unit/mapSubComponentLoaded.js'; +import mapLegends from 'vue-iclient/test/unit/mocks/data/WebMap/map_legends.json'; describe('Legend.vue', () => { let wrapper; let mapWrapper; beforeEach(() => { - const fetchResource = { - 'https://fakeiportal.supermap.io/iportal/web/config/portal.json': iportal_serviceProxy, - 'https://fakeiportal.supermap.io/iportal/web/maps/123/map.json': uniqueLayer_point, - 'https://fakeiportal.supermap.io/iportal/web/datas/676516522/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=123': layerData - }; - mockFetch(fetchResource); - mapWrapper = mount(SmWebMap, { - propsData: { - serverUrl: 'https://fakeiportal.supermap.io/iportal', - mapId: '123' - } - }); }); afterEach(() => { @@ -36,14 +20,18 @@ describe('Legend.vue', () => { } }); - it('render default correctly', async done => { + it('render default correctly', done => { wrapper = mount(SmLegend, { propsData: { layerNames: ['民航数据'], mapTarget: 'map' } }); - await mapSubComponentLoaded(wrapper); + wrapper.vm.webmap = { + getLegendInfo: jest.fn(() => mapLegends) + } + wrapper.vm.$options.loaded.call(wrapper.vm); + expect(wrapper.vm.legendList).not.toEqual({}); expect(wrapper.vm.mapTarget).toBe('map'); done(); }); diff --git a/src/mapboxgl/web-map/control/legend/style/legend.scss b/src/mapboxgl/web-map/control/legend/style/legend.scss index 0b966153..089d30f3 100644 --- a/src/mapboxgl/web-map/control/legend/style/legend.scss +++ b/src/mapboxgl/web-map/control/legend/style/legend.scss @@ -14,6 +14,7 @@ border: none; min-width: 30px; min-height: 30px; + .#{$card-collapse-prefix}__content { box-shadow: none; max-height: 400px; @@ -54,6 +55,10 @@ padding-bottom: 10px; } + @include e(fieldvalue) { + margin-left: 8px; + } + .is-not-header { &.is-top-left, &.is-bottom-left { @@ -133,99 +138,20 @@ .#{$collapse-prefix}-content-box { padding: 0; @include e(wrap) { - display: flex; - align-items: center; height: 100%; min-width: 80px; } - @include e(range) { - overflow: hidden; - @include e(range-item) { - & > div { - > i { - display: inline-block; - vertical-align: text-bottom; - width: 14px; - height: 14px; - } - } - } - } - - @include e(rank-icon) { - & > i { - display: inline-block; - vertical-align: middle; - } - } - - @include e(heatbox) { - display: flex; - overflow: hidden !important; - height: 120px; - } - - @include e(heat) { - height: 100%; - > i { - display: inline-block; - width: 14px; - height: 100%; - } - } - @include e(heatText range-item rank-item) { - span { - i { - font-size: inherit; - } - } - } - @include e(heatText) { - display: flex; - flex-direction: column; - justify-content: space-between; - height: 100%; - } - - @include e(point) { - padding: 0; - margin: 0; - &::-webkit-scrollbar-thumb { - background: $scrollbar-background; - } - } - - @include e(heatbox item range-item rank-item) { - margin-bottom: 8px; - line-height: 20px; - display: flex; - align-items: center; - > * { - &:first-child { - text-align: center; - } - &:last-child { - width: auto; - padding-left: 10px; - } - } - &:last-child { - margin-bottom: 0; - } - } @include e(item) { list-style: none; + display: flex; + align-items: center; + margin: 8px 0 16px; > i { font-size: 14px; } } - @include e(field-value) { - margin-left: 12px; - max-width: 86%; - } - @include e(title) { width: 85%; & + i { @@ -234,4 +160,45 @@ } } } + + @include e(linearcolor) { + height: 10px; + } + + @include e(colorstop colorfieldrange) { + position: relative; + height: 15px; + } + + @include e(colorstop) { + .color-stop-holder { + position: absolute; + width: 10px; + cursor: not-allowed; + opacity: 0.25; + } + .color-arrow { + width: 0; + height: 0; + border-right: 5px solid transparent; + border-bottom: 4px solid #d9d9d9; + border-left: 5px solid transparent; + } + .color-value { + width: 10px; + height: 8px; + border: 1px solid #d9d9d9; + } + } + + @include e(colorfieldrange) { + .color-field-holder { + position: absolute; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + max-width: 80px; + margin-left: 2px; + } + } } diff --git a/src/mapboxgl/web-map/control/legend/subs/ImageRenderer.vue b/src/mapboxgl/web-map/control/legend/subs/ImageRenderer.vue new file mode 100644 index 00000000..10b6013a --- /dev/null +++ b/src/mapboxgl/web-map/control/legend/subs/ImageRenderer.vue @@ -0,0 +1,92 @@ + + + diff --git a/src/mapboxgl/web-map/control/legend/subs/StyleField.vue b/src/mapboxgl/web-map/control/legend/subs/StyleField.vue new file mode 100644 index 00000000..0ed3162d --- /dev/null +++ b/src/mapboxgl/web-map/control/legend/subs/StyleField.vue @@ -0,0 +1,42 @@ + + + diff --git a/src/mapboxgl/web-map/control/legend/subs/StyleItem.vue b/src/mapboxgl/web-map/control/legend/subs/StyleItem.vue new file mode 100644 index 00000000..04f4ac23 --- /dev/null +++ b/src/mapboxgl/web-map/control/legend/subs/StyleItem.vue @@ -0,0 +1,35 @@ + + + diff --git a/src/mapboxgl/web-map/control/legend/subs/StyleRenderer.vue b/src/mapboxgl/web-map/control/legend/subs/StyleRenderer.vue new file mode 100644 index 00000000..df6c86b7 --- /dev/null +++ b/src/mapboxgl/web-map/control/legend/subs/StyleRenderer.vue @@ -0,0 +1,336 @@ + + + diff --git a/src/mapboxgl/web-map/control/legend/subs/StyleValue.vue b/src/mapboxgl/web-map/control/legend/subs/StyleValue.vue new file mode 100644 index 00000000..addcef08 --- /dev/null +++ b/src/mapboxgl/web-map/control/legend/subs/StyleValue.vue @@ -0,0 +1,45 @@ + + + diff --git a/src/mapboxgl/web-map/control/measure/__tests__/Measure.spec.js b/src/mapboxgl/web-map/control/measure/__tests__/Measure.spec.js index 49e1b20c..babd9054 100644 --- a/src/mapboxgl/web-map/control/measure/__tests__/Measure.spec.js +++ b/src/mapboxgl/web-map/control/measure/__tests__/Measure.spec.js @@ -4,38 +4,16 @@ import SmMeasure from '../Measure'; import mockFetch from 'vue-iclient/test/unit/mocks/FetchRequest'; import uniqueLayer_point from 'vue-iclient/test/unit/mocks/data/WebMap/uniqueLayer_point'; import mapSubComponentLoaded from 'vue-iclient/test/unit/mapSubComponentLoaded.js'; -import mapWrapperLoaded from 'vue-iclient/test/unit/mapWrapperLoaded.js'; +import createEmptyMap from 'vue-iclient/test/unit/createEmptyMap'; jest.mock('@libs/mapbox-gl-draw/mapbox-gl-draw', () => require('@mocks/mapboxgl_draw').MapboxDraw); describe('measure', () => { let mapWrapper; let measureWrapper; - const mapInfo = { - extent: { - leftBottom: { x: 0, y: 0 }, - rightTop: { x: 0, y: 0 } - }, - level: 5, - center: { x: 0, y: 0 }, - baseLayer: { - layerType: 'TILE', - name: 'China', - url: 'http://test' - }, - layers: [], - description: '', - projection: 'EPSG:3857', - title: 'testMap', - version: '1.0' - }; - beforeEach(() => { - mapWrapper = mount(SmWebMap, { - propsData: { - mapId: mapInfo - } - }); + beforeEach(async () => { + mapWrapper = await createEmptyMap(); }); afterEach(() => { @@ -61,11 +39,10 @@ describe('measure', () => { 'https://fakeiportal.supermap.io/iportal/web/maps/123/map.json': uniqueLayer_point }; mockFetch(fetchResource); - await mapWrapperLoaded(mapWrapper); const spychangeMode = jest.spyOn(measureWrapper.vm, 'changeMeasureMode'); expect(measureWrapper.vm.mapTarget).toBe('map'); - jest.useFakeTimers(); await mapSubComponentLoaded(measureWrapper); + jest.useFakeTimers(); expect(measureWrapper.find('.sm-component-measure').exists()).toBe(true); try { measureWrapper.find('.sm-component-measure__modeIcon').find('i.sm-components-icon-line').trigger('click'); @@ -127,10 +104,9 @@ describe('measure', () => { 'https://fakeiportal.supermap.io/iportal/web/maps/123/map.json': uniqueLayer_point }; mockFetch(fetchResource); - await mapWrapperLoaded(mapWrapper); expect(measureWrapper.vm.mapTarget).toBe('map'); - jest.useFakeTimers(); await mapSubComponentLoaded(measureWrapper); + jest.useFakeTimers(); expect(measureWrapper.vm.mapTarget).toBe('map'); expect(measureWrapper.findAll('.sm-component-select-selection-selected-value').at(0).text()).toBe('kilometers'); const spychangeMode = jest.spyOn(measureWrapper.vm.viewModel.draw, 'changeMode'); @@ -212,7 +188,6 @@ describe('measure', () => { 'https://fakeiportal.supermap.io/iportal/web/maps/123/map.json': uniqueLayer_point }; mockFetch(fetchResource); - await mapWrapperLoaded(mapWrapper); await mapSubComponentLoaded(measureWrapper); try { expect(measureWrapper.vm.mapTarget).toBe('map'); diff --git a/src/mapboxgl/web-map/control/mini-map/__tests__/MiniMap.spec.js b/src/mapboxgl/web-map/control/mini-map/__tests__/MiniMap.spec.js index f60ac97a..1d94d4f3 100644 --- a/src/mapboxgl/web-map/control/mini-map/__tests__/MiniMap.spec.js +++ b/src/mapboxgl/web-map/control/mini-map/__tests__/MiniMap.spec.js @@ -1,23 +1,23 @@ import { mount } from '@vue/test-utils'; -import SmWebMap from '../../../WebMap.vue'; import SmMiniMap from '../MiniMap.vue'; import mockFetch from 'vue-iclient/test/unit/mocks/FetchRequest'; import iportal_serviceProxy from 'vue-iclient/test/unit/mocks/data/iportal_serviceProxy'; import uniqueLayer_point from 'vue-iclient/test/unit/mocks/data/WebMap/uniqueLayer_point'; import layerData from 'vue-iclient/test/unit/mocks/data/layerData'; import mapSubComponentLoaded from 'vue-iclient/test/unit/mapSubComponentLoaded.js'; +import createEmptyMap from 'vue-iclient/test/unit/createEmptyMap'; describe('MiniMap.vue', () => { let wrapper; let mapWrapper; - beforeEach(() => { + beforeEach(async () => { const fetchResource = { 'https://fakeiportal.supermap.io/iportal/web/config/portal.json': iportal_serviceProxy, 'https://fakeiportal.supermap.io/iportal/web/maps/123/map.json': uniqueLayer_point, 'https://fakeiportal.supermap.io/iportal/web/datas/676516522/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=123': layerData }; mockFetch(fetchResource); - mapWrapper = mount(SmWebMap, { + mapWrapper = await createEmptyMap({ propsData: { serverUrl: 'https://fakeiportal.supermap.io/iportal', mapId: '123' @@ -35,16 +35,13 @@ describe('MiniMap.vue', () => { } }); - it('render default correctly', async done => { + it('render default correctly', done => { wrapper = mount(SmMiniMap, { propsData: { mapTarget: 'map' } }); - await mapSubComponentLoaded(wrapper); expect(wrapper.vm.mapTarget).toBe('map'); - setTimeout(() => { - done(); - }, 1000); + done(); }); }); diff --git a/src/mapboxgl/web-map/control/zoom/__tests__/Zoom.spec.js b/src/mapboxgl/web-map/control/zoom/__tests__/Zoom.spec.js index d8e5c521..b375f47e 100644 --- a/src/mapboxgl/web-map/control/zoom/__tests__/Zoom.spec.js +++ b/src/mapboxgl/web-map/control/zoom/__tests__/Zoom.spec.js @@ -1,14 +1,11 @@ import { mount, config } from '@vue/test-utils'; -import SmWebMap from '../../../../web-map/WebMap.vue'; import SmZoom from '../Zoom.vue'; -import flushPromises from 'flush-promises'; import createEmptyMap from 'vue-iclient/test/unit/createEmptyMap.js'; import mockFetch from 'vue-iclient/test/unit/mocks/FetchRequest'; import iportal_serviceProxy from 'vue-iclient/test/unit/mocks/data/iportal_serviceProxy'; import uniqueLayer_point from 'vue-iclient/test/unit/mocks/data/WebMap/uniqueLayer_point'; import layerData from 'vue-iclient/test/unit/mocks/data/layerData'; import mapSubComponentLoaded from 'vue-iclient/test/unit/mapSubComponentLoaded.js'; -import mapWrapperLoaded from 'vue-iclient/test/unit/mapWrapperLoaded.js'; describe('Zoom.vue', () => { let mapWrapper; @@ -55,7 +52,7 @@ describe('Zoom.vue', () => { 'https://fakeiportal.supermap.io/iportal/web/datas/676516522/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=123': layerData }; mockFetch(fetchResource); - mapWrapper = mount(SmWebMap, { + mapWrapper = await createEmptyMap({ propsData: { serverUrl: 'https://fakeiportal.supermap.io/iportal', mapId: '123' @@ -68,11 +65,7 @@ describe('Zoom.vue', () => { showZoomSlider: true } }); - const callback = jest.fn(); - wrapper.vm.$on('loaded', callback); - await mapWrapperLoaded(mapWrapper); - await flushPromises(); - expect(callback.mock.called).toBeTruthy; + await mapSubComponentLoaded(wrapper); expect(wrapper.vm.showZoom).toBe(true); expect(wrapper.vm.position).toBe('top-left'); expect(wrapper.vm.showZoomSlider).toBe(true); @@ -91,7 +84,7 @@ describe('Zoom.vue', () => { 'https://fakeiportal.supermap.io/iportal/web/datas/676516522/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=123': layerData }; mockFetch(fetchResource); - mapWrapper = mount(SmWebMap, { + mapWrapper = await createEmptyMap({ propsData: { serverUrl: 'https://fakeiportal.supermap.io/iportal', mapId: '123' @@ -104,11 +97,7 @@ describe('Zoom.vue', () => { showZoomSlider: true } }); - const callback = jest.fn(); - wrapper.vm.$on('loaded', callback); - await mapWrapperLoaded(mapWrapper); - await flushPromises(); - expect(callback.mock.called).toBeTruthy; + await mapSubComponentLoaded(wrapper); expect(wrapper.vm.showZoom).toBe(true); expect(wrapper.vm.position).toBe('top-left'); expect(wrapper.vm.showZoomSlider).toBe(true); @@ -131,7 +120,6 @@ describe('Zoom.vue', () => { showZoomSlider: true } }); - await mapSubComponentLoaded(wrapper); const slider = jest.spyOn(wrapper.vm, 'setZoom'); expect(wrapper.find('.sm-component-slider-handle').exists()).toBe(true); wrapper.vm.sliderChange(); diff --git a/src/mapboxgl/web-map/layer/animate-marker/__tests__/AnimateMarkerLayer.spec.js b/src/mapboxgl/web-map/layer/animate-marker/__tests__/AnimateMarkerLayer.spec.js index 6da19ff2..4cd972c1 100644 --- a/src/mapboxgl/web-map/layer/animate-marker/__tests__/AnimateMarkerLayer.spec.js +++ b/src/mapboxgl/web-map/layer/animate-marker/__tests__/AnimateMarkerLayer.spec.js @@ -424,7 +424,6 @@ describe('AnimateMarkerLayer.vue', () => { features }); expect(mockFn.mock.calls).toEqual([[true]]); - await mapSubComponentLoaded(wrapper); await wrapper.setProps({ features: newFeatures }); diff --git a/src/mapboxgl/web-map/layer/heatmap/__tests__/HeatmapLayer.spec.js b/src/mapboxgl/web-map/layer/heatmap/__tests__/HeatmapLayer.spec.js index bee8e54b..2dcf2e68 100644 --- a/src/mapboxgl/web-map/layer/heatmap/__tests__/HeatmapLayer.spec.js +++ b/src/mapboxgl/web-map/layer/heatmap/__tests__/HeatmapLayer.spec.js @@ -1,7 +1,6 @@ import { mount, config } from '@vue/test-utils'; import SmHeatmapLayer from '../HeatmapLayer.vue'; import createEmptyMap from 'vue-iclient/test/unit/createEmptyMap.js'; -import mapSubComponentLoaded from 'vue-iclient/test/unit/mapSubComponentLoaded.js'; describe('HeatmapLayer.vue', () => { let wrapper; @@ -42,6 +41,9 @@ describe('HeatmapLayer.vue', () => { afterEach(() => { jest.restoreAllMocks(); + if (mapWrapper) { + mapWrapper.destroy(); + } if (wrapper) { wrapper.destroy(); } @@ -54,14 +56,13 @@ describe('HeatmapLayer.vue', () => { } }) - it('render', async done => { + it('render', done => { wrapper = mount(SmHeatmapLayer, { propsData: { mapTarget: 'map', data } }); - await mapSubComponentLoaded(wrapper); expect(wrapper.vm.mapTarget).toBe('map'); done(); }); @@ -91,7 +92,6 @@ describe('HeatmapLayer.vue', () => { data: newData, layerStyle: {} }); - await mapSubComponentLoaded(wrapper); expect(wrapper.vm.viewModel.data).toBe(newData); done(); }); diff --git a/static/libs/iclient-mapboxgl/iclient-mapboxgl.min.js b/static/libs/iclient-mapboxgl/iclient-mapboxgl.min.js index 6a47346e..2d696a2d 100644 --- a/static/libs/iclient-mapboxgl/iclient-mapboxgl.min.js +++ b/static/libs/iclient-mapboxgl/iclient-mapboxgl.min.js @@ -4,4 +4,4 @@ * license: Apache-2.0 * version: v11.2.0-dev * - */!function(){var t={5023:function(t,e,r){var n=r(6727);t.exports=n},3123:function(t,e,r){var n=r(8690);t.exports=n},879:function(t,e,r){r(7422);var n=r(97);t.exports=n.Object.assign},3723:function(t,e,r){r(4835);var n=r(8384);t.exports=n.f("asyncIterator")},5980:function(t,e,r){var n=r(729),o=r(8434),i=TypeError;t.exports=function(t){if(n(t))return t;throw i(o(t)+" is not a function")}},7563:function(t,e,r){var n=r(691),o=String,i=TypeError;t.exports=function(t){if(n(t))return t;throw i(o(t)+" is not an object")}},8632:function(t,e,r){var n=r(6462),o=r(5333),i=r(6803),a=function(t){return function(e,r,a){var s,u=n(e),l=i(u),c=o(a,l);if(t&&r!=r){for(;l>c;)if((s=u[c++])!=s)return!0}else for(;l>c;c++)if((t||c in u)&&u[c]===r)return t||c||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},2177:function(t,e,r){var n=r(9738),o=n({}.toString),i=n("".slice);t.exports=function(t){return i(o(t),8,-1)}},9029:function(t,e,r){var n=r(1675),o=r(9402),i=r(7238),a=r(704);t.exports=function(t,e,r){for(var s=o(e),u=a.f,l=i.f,c=0;c0&&n[0]<4?1:+(n[0]+n[1])),!o&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(o=+n[1]),t.exports=o},8525:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},7926:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(5835),i=r(7238).f,a=r(8268),s=r(7454),u=r(161),l=r(9029),c=r(3175);t.exports=function(t,e){var r,f,h,p,y,d=t.target,b=t.global,v=t.stat;if(r=b?o:v?o[d]||u(d,{}):(o[d]||{}).prototype)for(f in e){if(p=e[f],h=t.dontCallGetSet?(y=i(r,f))&&y.value:r[f],!c(b?f:d+(v?".":"#")+f,t.forced)&&void 0!==h){if(n(p)==n(h))continue;l(p,h)}(t.sham||h&&h.sham)&&a(p,"sham",!0),s(r,f,p,t)}}},6583:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},9096:function(t,e,r){var n=r(6583);t.exports=!n(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},5057:function(t,e,r){var n=r(9096),o=Function.prototype.call;t.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},1864:function(t,e,r){var n=r(6539),o=r(1675),i=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=o(i,"name"),u=s&&"something"===function(){}.name,l=s&&(!n||n&&a(i,"name").configurable);t.exports={EXISTS:s,PROPER:u,CONFIGURABLE:l}},9738:function(t,e,r){var n=r(9096),o=Function.prototype,i=o.call,a=n&&o.bind.bind(i,i);t.exports=n?a:function(t){return function(){return i.apply(t,arguments)}}},8078:function(t,e,r){var n=r(5835),o=r(729);t.exports=function(t,e){return arguments.length<2?(r=n[t],o(r)?r:void 0):n[t]&&n[t][e];var r}},2337:function(t,e,r){var n=r(5980),o=r(6254);t.exports=function(t,e){var r=t[e];return o(r)?void 0:n(r)}},5835:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=function(t){return t&&t.Math==Math&&t};t.exports=o("object"==("undefined"==typeof globalThis?"undefined":n(globalThis))&&globalThis)||o("object"==("undefined"==typeof window?"undefined":n(window))&&window)||o("object"==("undefined"==typeof self?"undefined":n(self))&&self)||o("object"==(void 0===r.g?"undefined":n(r.g))&&r.g)||function(){return this}()||this||Function("return this")()},1675:function(t,e,r){var n=r(9738),o=r(5825),i=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(o(t),e)}},940:function(t){t.exports={}},2175:function(t,e,r){var n=r(6539),o=r(6583),i=r(3343);t.exports=!n&&!o(function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})},5407:function(t,e,r){var n=r(9738),o=r(6583),i=r(2177),a=Object,s=n("".split);t.exports=o(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"==i(t)?s(t,""):a(t)}:a},6111:function(t,e,r){var n=r(9738),o=r(729),i=r(9700),a=n(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return a(t)}),t.exports=i.inspectSource},4751:function(t,e,r){var n,o,i,a=r(9801),s=r(5835),u=r(691),l=r(8268),c=r(1675),f=r(9700),h=r(7307),p=r(940),y=s.TypeError,d=s.WeakMap;if(a||f.state){var b=f.state||(f.state=new d);b.get=b.get,b.has=b.has,b.set=b.set,n=function(t,e){if(b.has(t))throw y("Object already initialized");return e.facade=t,b.set(t,e),e},o=function(t){return b.get(t)||{}},i=function(t){return b.has(t)}}else{var v=h("state");p[v]=!0,n=function(t,e){if(c(t,v))throw y("Object already initialized");return e.facade=t,l(t,v,e),e},o=function(t){return c(t,v)?t[v]:{}},i=function(t){return c(t,v)}}t.exports={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var r;if(!u(e)||(r=o(e)).type!==t)throw y("Incompatible receiver, "+t+" required");return r}}}},729:function(t,e,r){var n=r(9967),o=n.all;t.exports=n.IS_HTMLDDA?function(t){return"function"==typeof t||t===o}:function(t){return"function"==typeof t}},3175:function(t,e,r){var n=r(6583),o=r(729),i=/#|\.prototype\./,a=function(t,e){var r=u[s(t)];return r==c||r!=l&&(o(e)?n(e):!!e)},s=a.normalize=function(t){return String(t).replace(i,".").toLowerCase()},u=a.data={},l=a.NATIVE="N",c=a.POLYFILL="P";t.exports=a},6254:function(t){t.exports=function(t){return null===t||void 0===t}},691:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(729),i=r(9967),a=i.all;t.exports=i.IS_HTMLDDA?function(t){return"object"==n(t)?null!==t:o(t)||t===a}:function(t){return"object"==n(t)?null!==t:o(t)}},1437:function(t){t.exports=!1},4192:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(8078),i=r(729),a=r(5522),s=r(7860),u=Object;t.exports=s?function(t){return"symbol"==n(t)}:function(t){var e=o("Symbol");return i(e)&&a(e.prototype,u(t))}},6803:function(t,e,r){var n=r(5108);t.exports=function(t){return n(t.length)}},7948:function(t,e,r){var n=r(9738),o=r(6583),i=r(729),a=r(1675),s=r(6539),u=r(1864).CONFIGURABLE,l=r(6111),c=r(4751),f=c.enforce,h=c.get,p=String,y=Object.defineProperty,d=n("".slice),b=n("".replace),v=n([].join),m=s&&!o(function(){return 8!==y(function(){},"length",{value:8}).length}),g=String(String).split("String"),w=t.exports=function(t,e,r){"Symbol("===d(p(e),0,7)&&(e="["+b(p(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(e="get "+e),r&&r.setter&&(e="set "+e),(!a(t,"name")||u&&t.name!==e)&&(s?y(t,"name",{value:e,configurable:!0}):t.name=e),m&&r&&a(r,"arity")&&t.length!==r.arity&&y(t,"length",{value:r.arity});try{r&&a(r,"constructor")&&r.constructor?s&&y(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=f(t);return a(n,"source")||(n.source=v(g,"string"==typeof e?e:"")),t};Function.prototype.toString=w(function(){return i(this)&&h(this).source||l(this)},"toString")},4920:function(t){var e=Math.ceil,r=Math.floor;t.exports=Math.trunc||function(t){var n=+t;return(n>0?r:e)(n)}},7328:function(t,e,r){"use strict";var n=r(6539),o=r(9738),i=r(5057),a=r(6583),s=r(5403),u=r(7485),l=r(5339),c=r(5825),f=r(5407),h=Object.assign,p=Object.defineProperty,y=o([].concat);t.exports=!h||a(function(){if(n&&1!==h({b:1},h(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},r=Symbol();return t[r]=7,"abcdefghijklmnopqrst".split("").forEach(function(t){e[t]=t}),7!=h({},t)[r]||"abcdefghijklmnopqrst"!=s(h({},e)).join("")})?function(t,e){for(var r=c(t),o=arguments.length,a=1,h=u.f,p=l.f;o>a;)for(var d,b=f(arguments[a++]),v=h?y(s(b),h(b)):s(b),m=v.length,g=0;m>g;)d=v[g++],n&&!i(p,b,d)||(r[d]=b[d]);return r}:h},704:function(t,e,r){var n=r(6539),o=r(2175),i=r(4821),a=r(7563),s=r(9737),u=TypeError,l=Object.defineProperty,c=Object.getOwnPropertyDescriptor;e.f=n?i?function(t,e,r){if(a(t),e=s(e),a(r),"function"==typeof t&&"prototype"===e&&"value"in r&&"writable"in r&&!r.writable){var n=c(t,e);n&&n.writable&&(t[e]=r.value,r={configurable:"configurable"in r?r.configurable:n.configurable,enumerable:"enumerable"in r?r.enumerable:n.enumerable,writable:!1})}return l(t,e,r)}:l:function(t,e,r){if(a(t),e=s(e),a(r),o)try{return l(t,e,r)}catch(t){}if("get"in r||"set"in r)throw u("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},7238:function(t,e,r){var n=r(6539),o=r(5057),i=r(5339),a=r(4925),s=r(6462),u=r(9737),l=r(1675),c=r(2175),f=Object.getOwnPropertyDescriptor;e.f=n?f:function(t,e){if(t=s(t),e=u(e),c)try{return f(t,e)}catch(t){}if(l(t,e))return a(!o(i.f,t,e),t[e])}},5454:function(t,e,r){var n=r(497),o=r(8525).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},7485:function(t,e){e.f=Object.getOwnPropertySymbols},5522:function(t,e,r){var n=r(9738);t.exports=n({}.isPrototypeOf)},497:function(t,e,r){var n=r(9738),o=r(1675),i=r(6462),a=r(8632).indexOf,s=r(940),u=n([].push);t.exports=function(t,e){var r,n=i(t),l=0,c=[];for(r in n)!o(s,r)&&o(n,r)&&u(c,r);for(;e.length>l;)o(n,r=e[l++])&&(~a(c,r)||u(c,r));return c}},5403:function(t,e,r){var n=r(497),o=r(8525);t.exports=Object.keys||function(t){return n(t,o)}},5339:function(t,e){"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!r.call({1:2},1);e.f=o?function(t){var e=n(this,t);return!!e&&e.enumerable}:r},2821:function(t,e,r){var n=r(5057),o=r(729),i=r(691),a=TypeError;t.exports=function(t,e){var r,s;if("string"===e&&o(r=t.toString)&&!i(s=n(r,t)))return s;if(o(r=t.valueOf)&&!i(s=n(r,t)))return s;if("string"!==e&&o(r=t.toString)&&!i(s=n(r,t)))return s;throw a("Can't convert object to primitive value")}},9402:function(t,e,r){var n=r(8078),o=r(9738),i=r(5454),a=r(7485),s=r(7563),u=o([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=i.f(s(t)),r=a.f;return r?u(e,r(t)):e}},97:function(t,e,r){var n=r(5835);t.exports=n},1894:function(t,e,r){var n=r(6254),o=TypeError;t.exports=function(t){if(n(t))throw o("Can't call method on "+t);return t}},7307:function(t,e,r){var n=r(5464),o=r(6065),i=n("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},9700:function(t,e,r){var n=r(5835),o=r(161),i=n["__core-js_shared__"]||o("__core-js_shared__",{});t.exports=i},5464:function(t,e,r){var n=r(1437),o=r(9700);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.30.2",mode:n?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.2/LICENSE",source:"https://github.com/zloirock/core-js"})},4993:function(t,e,r){var n=r(9282),o=r(6583),i=r(5835).String;t.exports=!!Object.getOwnPropertySymbols&&!o(function(){var t=Symbol();return!i(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41})},5333:function(t,e,r){var n=r(1087),o=Math.max,i=Math.min;t.exports=function(t,e){var r=n(t);return r<0?o(r+e,0):i(r,e)}},6462:function(t,e,r){var n=r(5407),o=r(1894);t.exports=function(t){return n(o(t))}},1087:function(t,e,r){var n=r(4920);t.exports=function(t){var e=+t;return e!=e||0===e?0:n(e)}},5108:function(t,e,r){var n=r(1087),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},5825:function(t,e,r){var n=r(1894),o=Object;t.exports=function(t){return o(n(t))}},1044:function(t,e,r){var n=r(5057),o=r(691),i=r(4192),a=r(2337),s=r(2821),u=r(3121),l=TypeError,c=u("toPrimitive");t.exports=function(t,e){if(!o(t)||i(t))return t;var r,u=a(t,c);if(u){if(void 0===e&&(e="default"),r=n(u,t,e),!o(r)||i(r))return r;throw l("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},9737:function(t,e,r){var n=r(1044),o=r(4192);t.exports=function(t){var e=n(t,"string");return o(e)?e:e+""}},8434:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},6065:function(t,e,r){var n=r(9738),o=0,i=Math.random(),a=n(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++o+i,36)}},7860:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(4993);t.exports=o&&!Symbol.sham&&"symbol"==n(Symbol.iterator)},4821:function(t,e,r){var n=r(6539),o=r(6583);t.exports=n&&o(function(){return 42!=Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},9801:function(t,e,r){var n=r(5835),o=r(729),i=n.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},5336:function(t,e,r){var n=r(97),o=r(1675),i=r(8384),a=r(704).f;t.exports=function(t){var e=n.Symbol||(n.Symbol={});o(e,t)||a(e,t,{value:i.f(t)})}},8384:function(t,e,r){var n=r(3121);e.f=n},3121:function(t,e,r){var n=r(5835),o=r(5464),i=r(1675),a=r(6065),s=r(4993),u=r(7860),l=n.Symbol,c=o("wks"),f=u?l.for||l:l&&l.withoutSetter||a;t.exports=function(t){return i(c,t)||(c[t]=s&&i(l,t)?l[t]:f("Symbol."+t)),c[t]}},7422:function(t,e,r){var n=r(7926),o=r(7328);n({target:"Object",stat:!0,arity:2,forced:Object.assign!==o},{assign:o})},4835:function(t,e,r){r(5336)("asyncIterator")},6727:function(t,e,r){var n=r(879);t.exports=n},8690:function(t,e,r){var n=r(3723);t.exports=n},2057:function(t,e,r){"use strict";var n=r(5954),o=r(9162),i=r(1290);t.exports={XMLParser:o,XMLValidator:n,XMLBuilder:i}},144:function(t,e){"use strict";var r=":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",n="["+r+"][: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\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",o=new RegExp("^"+n+"$");e.isExist=function(t){return void 0!==t},e.isEmptyObject=function(t){return 0===Object.keys(t).length},e.merge=function(t,e,r){if(e)for(var n=Object.keys(e),o=n.length,i=0;i5&&"xml"===n)return y("InvalidXml","XML declaration allowed only at the start of the document.",b(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function s(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){var r=1;for(e+=8;e"===t[e]&&0===--r)break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e"===t[e+2]){e+=2;break}return e}e.validate=function(t,e){e=Object.assign({},o,e);var r,u=[],l=!1,f=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(var d=0;d"!==t[d]&&" "!==t[d]&&"\t"!==t[d]&&"\n"!==t[d]&&"\r"!==t[d];d++)g+=t[d];if("/"===(g=g.trim())[g.length-1]&&(g=g.substring(0,g.length-1),d--),r=g,!n.isName(r)){return y("InvalidTag",0===g.trim().length?"Invalid space after '<'.":"Tag '"+g+"' is an invalid name.",b(t,d))}var w=c(t,d);if(!1===w)return y("InvalidAttr","Attributes for '"+g+"' have open quote.",b(t,d));var O=w.value;if(d=w.index,"/"===O[O.length-1]){var S=d-O.length,_=h(O=O.substring(0,O.length-1),e);if(!0!==_)return y(_.err.code,_.err.msg,b(t,S+_.err.line));l=!0}else if(m){if(!w.tagClosed)return y("InvalidTag","Closing tag '"+g+"' doesn't have proper closing.",b(t,d));if(O.trim().length>0)return y("InvalidTag","Closing tag '"+g+"' can't have attributes or invalid starting.",b(t,v));var P=u.pop();if(g!==P.tagName){var x=b(t,P.tagStartPos);return y("InvalidTag","Expected closing tag '"+P.tagName+"' (opened in line "+x.line+", col "+x.col+") instead of closing tag '"+g+"'.",b(t,v))}0==u.length&&(f=!0)}else{var k=h(O,e);if(!0!==k)return y(k.err.code,k.err.msg,b(t,d-O.length+k.err.line));if(!0===f)return y("InvalidXml","Multiple possible root nodes found.",b(t,d));-1!==e.unpairedTags.indexOf(g)||u.push({tagName:g,tagStartPos:v}),l=!0}for(d++;d0)||y("InvalidXml","Invalid '"+JSON.stringify(u.map(function(t){return t.tagName}),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):y("InvalidXml","Start tag expected.",1)};var u='"',l="'";function c(t,e){for(var r="",n="",o=!1;e"===t[e]&&""===n){o=!0;break}r+=t[e]}return""===n&&{value:r,index:e,tagClosed:o}}var f=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function h(t,e){for(var r=n.getAllMatches(t,f),o={},i=0;i","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function a(t){this.options=Object.assign({},i,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=l),this.processTextOrObjNode=s,this.options.format?(this.indentate=u,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function s(t,e,r){var n=this.j2x(t,r+1);return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}function u(t){return this.options.indentBy.repeat(t)}function l(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}a.prototype.build=function(t){return this.options.preserveOrder?o(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={},r=this.options.arrayNodeName,n=t,r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,t=e),this.j2x(t,0).val);var e,r,n},a.prototype.j2x=function(t,e){var r="",o="";for(var i in t)if(void 0===t[i])this.isAttribute(i)&&(o+="");else if(null===t[i])this.isAttribute(i)?o+="":"?"===i[0]?o+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(t[i]instanceof Date)o+=this.buildTextValNode(t[i],i,"",e);else if("object"!==n(t[i])){var a=this.isAttribute(i);if(a)r+=this.buildAttrPairStr(a,""+t[i]);else if(i===this.options.textNodeName){var s=this.options.tagValueProcessor(i,""+t[i]);o+=this.replaceEntitiesValue(s)}else o+=this.buildTextValNode(t[i],i,"",e)}else if(Array.isArray(t[i])){for(var u=t[i].length,l="",c=0;c"+t+o},a.prototype.closeTag=function(t){var e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":">")+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(n)+"\x3c!--".concat(t,"--\x3e")+this.newLine;if("?"===e[0])return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;var o=this.options.tagValueProcessor(e,t);return""===(o=this.replaceEntitiesValue(o))?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+o+"0&&this.options.processEntities)for(var e=0;e0&&e.processEntities)for(var r=0;r0&&(s=e),function t(e,a,s,u){for(var l="",c=!1,f=0;f":l+=v+"/>":m&&0!==m.length||!a.suppressEmptyNode?m&&m.endsWith(">")?l+=v+">".concat(m).concat(u,""):(l+=v+">",m&&""!==u&&(m.includes("/>")||m.includes("")):l+=v+"/>",c=!0}else{var g=n(h[":@"],a),w="?xml"===p?"":u,O=h[p][0][a.textNodeName];O=0!==O.length?" "+O:"",l+=w+"<".concat(p).concat(O).concat(g,"?>"),c=!0}else l+=u+"\x3c!--".concat(h[p][0][a.textNodeName],"--\x3e"),c=!0;else c&&(l+=u),l+=""),c=!1;else{var S=h[p];o(y,a)||(S=i(S=a.tagValueProcessor(p,S),a)),c&&(l+=u),l+=S,c=!1}}return l}(t,a,"",s)}},8763:function(t,e,r){function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r"===t[e]){if(p?"-"===t[e-1]&&"-"===t[e-2]&&(p=!1,o--):o--,0===o)break}else"["===t[e]?i=!0:t[e];else{if(i&&u(t,e)){var y=n(a(t,(e+=7)+1),3);entityName=y[0],val=y[1],e=y[2],-1===val.indexOf("&")&&(r[h(entityName)]={regx:RegExp("&".concat(entityName,";"),"g"),val:val})}else if(i&&l(t,e))e+=8;else if(i&&c(t,e))e+=8;else if(i&&f(t,e))e+=9;else{if(!s)throw new Error("Invalid DOCTYPE");p=!0}o++}if(0!==o)throw new Error("Unclosed DOCTYPE");return{entities:r,i:e}}},4706:function(t,e){var r={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:function(){return!1},commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}};e.buildOptions=function(t){return Object.assign({},r,t)},e.defaultOptions=r},9244:function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){"@babel/helpers - typeof";return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,a.nameRegexp),function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"}},this.addExternalEntities=f,this.parseXml=b,this.parseTextData=h,this.resolveNameSpace=p,this.buildAttributesMap=d,this.isItStopNode=w,this.replaceEntitiesValue=m,this.readStopNodeData=_,this.saveTextToParentTag=g,this.addChild=v}));function f(t){for(var e=Object.keys(t),r=0;r0)){s||(t=this.replaceEntitiesValue(t));var u=this.options.tagValueProcessor(e,t,r,i,a);return null===u||void 0===u?t:o(u)!==o(t)||u!==t?u:this.options.trimValues?P(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?P(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function p(t){if(this.options.removeNSPrefix){var e=t.split(":"),r="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=r+e[1])}return t}var y=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function d(t,e,r){if(!this.options.ignoreAttributes&&"string"==typeof t){for(var n=a.getAllMatches(t,y),i=n.length,s={},u=0;u",a,"Closing Tag is not closed."),c=t.substring(a+2,l).trim();if(this.options.removeNSPrefix){var f=c.indexOf(":");-1!==f&&(c=c.substr(f+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&(o=this.saveTextToParentTag(o,r,i));var h=i.substring(i.lastIndexOf(".")+1);if(c&&-1!==this.options.unpairedTags.indexOf(c))throw new Error("Unpaired tag can not be used as closing tag: "));var p=0;h&&-1!==this.options.unpairedTags.indexOf(h)?(p=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=i.lastIndexOf("."),i=i.substring(0,p),r=this.tagsNodeStack.pop(),o="",a=l}else if("?"===t[a+1]){var y=S(t,a,!1,"?>");if(!y)throw new Error("Pi Tag is not closed.");if(o=this.saveTextToParentTag(o,r,i),this.options.ignoreDeclaration&&"?xml"===y.tagName||this.options.ignorePiTags);else{var d=new s(y.tagName);d.add(this.options.textNodeName,""),y.tagName!==y.tagExp&&y.attrExpPresent&&(d[":@"]=this.buildAttributesMap(y.tagExp,i,y.tagName)),this.addChild(r,d,i)}a=y.closeIndex+1}else if("!--"===t.substr(a+1,3)){var b=O(t,"--\x3e",a+4,"Comment is not closed.");if(this.options.commentPropName){var v=t.substring(a+4,b-2);o=this.saveTextToParentTag(o,r,i),r.add(this.options.commentPropName,[n({},this.options.textNodeName,v)])}a=b}else if("!D"===t.substr(a+1,2)){var m=u(t,a);this.docTypeEntities=m.entities,a=m.i}else if("!["===t.substr(a+1,2)){var g=O(t,"]]>",a,"CDATA is not closed.")-2,w=t.substring(a+9,g);if(o=this.saveTextToParentTag(o,r,i),this.options.cdataPropName)r.add(this.options.cdataPropName,[n({},this.options.textNodeName,w)]);else{var _=this.parseTextData(w,r.tagname,i,!0,!1,!0);void 0==_&&(_=""),r.add(this.options.textNodeName,_)}a=g+2}else{var P=S(t,a,this.options.removeNSPrefix),x=P.tagName,k=P.tagExp,j=P.attrExpPresent,E=P.closeIndex;this.options.transformTagName&&(x=this.options.transformTagName(x)),r&&o&&"!xml"!==r.tagname&&(o=this.saveTextToParentTag(o,r,i,!1));var T=r;if(T&&-1!==this.options.unpairedTags.indexOf(T.tagname)&&(r=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),x!==e.tagname&&(i+=i?"."+x:x),this.isItStopNode(this.options.stopNodes,i,x)){var C="";if(k.length>0&&k.lastIndexOf("/")===k.length-1)a=P.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(x))a=P.closeIndex;else{var R=this.readStopNodeData(t,x,E+1);if(!R)throw new Error("Unexpected end of ".concat(x));a=R.i,C=R.tagContent}var A=new s(x);x!==k&&j&&(A[":@"]=this.buildAttributesMap(k,i,x)),C&&(C=this.parseTextData(C,x,i,!0,j,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),A.add(this.options.textNodeName,C),this.addChild(r,A,i)}else{if(k.length>0&&k.lastIndexOf("/")===k.length-1){"/"===x[x.length-1]?(x=x.substr(0,x.length-1),i=i.substr(0,i.length-1),k=x):k=k.substr(0,k.length-1),this.options.transformTagName&&(x=this.options.transformTagName(x));var M=new s(x);x!==k&&j&&(M[":@"]=this.buildAttributesMap(k,i,x)),this.addChild(r,M,i),i=i.substr(0,i.lastIndexOf("."))}else{var L=new s(x);this.tagsNodeStack.push(r),x!==k&&j&&(L[":@"]=this.buildAttributesMap(k,i,x)),this.addChild(r,L,i),r=L}o="",a=E}}else o+=t[a]}return e.child};function v(t,e,r){var n=this.options.updateTag(e.tagname,r,e[":@"]);!1===n||("string"==typeof n?(e.tagname=n,t.addChild(e)):t.addChild(e))}var m=function(t){if(this.options.processEntities){for(var e in this.docTypeEntities){var r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(var n in this.lastEntities){var o=this.lastEntities[n];t=t.replace(o.regex,o.val)}if(this.options.htmlEntities)for(var i in this.htmlEntities){var a=this.htmlEntities[i];t=t.replace(a.regex,a.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function g(t,e,r,n){return t&&(void 0===n&&(n=0===Object.keys(e.child).length),void 0!==(t=this.parseTextData(t,e.tagname,r,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,n))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function w(t,e,r){var n="*."+r;for(var o in t){var i=t[o];if(n===i||e===i)return!0}return!1}function O(t,e,r,n){var o=t.indexOf(e,r);if(-1===o)throw new Error(n);return o+e.length-1}function S(t,e,r){var n=function(t,e){for(var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",o="",i=e;i3&&void 0!==arguments[3]?arguments[3]:">");if(n){var o=n.data,i=n.index,a=o.search(/\s/),s=o,u=!0;if(-1!==a&&(s=o.substr(0,a).replace(/\s\s*$/,""),o=o.substr(a+1)),r){var l=s.indexOf(":");-1!==l&&(u=(s=s.substr(l+1))!==n.data.substr(l+1))}return{tagName:s,tagExp:o,closeIndex:i,attrExpPresent:u}}}function _(t,e,r){for(var n=r,o=1;r",r,"".concat(e," is not closed"));if(t.substring(r+2,i).trim()===e&&0===--o)return{tagContent:t.substring(n,r),i:i};r=i}else if("?"===t[r+1]){r=O(t,"?>",r+1,"StopNode is not closed.")}else if("!--"===t.substr(r+1,3)){r=O(t,"--\x3e",r+3,"StopNode is not closed.")}else if("!["===t.substr(r+1,2)){r=O(t,"]]>",r,"StopNode is not closed.")-2}else{var a=S(t,r,">");if(a)(a&&a.tagName)===e&&"/"!==a.tagExp[a.tagExp.length-1]&&o++,r=a.closeIndex}}function P(t,e,r){if(e&&"string"==typeof t){var n=t.trim();return"true"===n||"false"!==n&&l(t,r)}return a.isExist(t)?t:""}t.exports=c},9162:function(t,e,r){function n(t,e){for(var r=0;r0&&(u[i.textNodeName]=s):void 0!==s&&(u[i.textNodeName]=s),u}(t,e)}},5295:function(t){"use strict";function e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function r(t,e){for(var r=0;r0)?this.child.push((e(r={},t.tagname,t.child),e(r,":@",t[":@"]),r)):this.child.push(e({},t.tagname,t.child))}}])&&r(n.prototype,o),i&&r(n,i),Object.defineProperty(n,"prototype",{writable:!1}),t}();t.exports=n},5937:function(t){!function(e){"use strict";if(e.__disableNativeFetch||!e.fetch){s.prototype.append=function(t,e){t=i(t),e=a(e);var r=this.map[t];r||(r=[],this.map[t]=r),r.push(e)},s.prototype.delete=function(t){delete this.map[i(t)]},s.prototype.get=function(t){var e=this.map[i(t)];return e?e[0]:null},s.prototype.getAll=function(t){return this.map[i(t)]||[]},s.prototype.has=function(t){return this.map.hasOwnProperty(i(t))},s.prototype.set=function(t,e){this.map[i(t)]=[a(e)]},s.prototype.forEach=function(t,e){Object.getOwnPropertyNames(this.map).forEach(function(r){this.map[r].forEach(function(n){t.call(e,n,r,this)},this)},this)};var r={blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e},n=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];h.prototype.clone=function(){return new h(this)},f.call(h.prototype),f.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new s(this.headers),url:this.url})},y.error=function(){var t=new y(null,{status:0,statusText:""});return t.type="error",t};var o=[301,302,303,307,308];y.redirect=function(t,e){if(-1===o.indexOf(e))throw new RangeError("Invalid status code");return new y(null,{status:e,headers:{location:t}})},e.Headers=s,e.Request=h,e.Response=y,e.fetch=function(t,e){return new Promise(function(n,o){var i;i=h.prototype.isPrototypeOf(t)&&!e?t:new h(t,e);var a=new XMLHttpRequest;var u=!1;function l(){if(4===a.readyState){var t=1223===a.status?204:a.status;if(t<100||t>599){if(u)return;return u=!0,void o(new TypeError("Network request failed"))}var e={status:t,statusText:a.statusText,headers:function(t){var e=new s;return t.getAllResponseHeaders().trim().split("\n").forEach(function(t){var r=t.trim().split(":"),n=r.shift().trim(),o=r.join(":").trim();e.append(n,o)}),e}(a),url:"responseURL"in a?a.responseURL:/^X-Request-URL:/m.test(a.getAllResponseHeaders())?a.getResponseHeader("X-Request-URL"):void 0},r="response"in a?a.response:a.responseText;u||(u=!0,n(new y(r,e)))}}a.onreadystatechange=l,a.onload=l,a.onerror=function(){u||(u=!0,o(new TypeError("Network request failed")))},a.open(i.method,i.url,!0);try{"include"===i.credentials&&("withCredentials"in a?a.withCredentials=!0:console&&console.warn&&console.warn("withCredentials is not supported, you can ignore this warning"))}catch(t){console&&console.warn&&console.warn("set withCredentials error:"+t)}"responseType"in a&&r.blob&&(a.responseType="blob"),i.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),a.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0,t.exports&&(t.exports=e.fetch)}function i(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){this.map={},t instanceof s?t.forEach(function(t,e){this.append(e,t)},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function u(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function c(t){var e=new FileReader;return e.readAsArrayBuffer(t),l(e)}function f(){return this.bodyUsed=!1,this._initBody=function(t,e){if(this._bodyInit=t,"string"==typeof t)this._bodyText=t;else if(r.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t,this._options=e;else if(r.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(t){if(!r.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t))throw new Error("unsupported BodyInit type")}else this._bodyText=""},r.blob?(this.blob=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(c)},this.text=function(){var t,e,r,n,o,i,a,s=u(this);if(s)return s;if(this._bodyBlob)return t=this._bodyBlob,e=this._options,r=new FileReader,n=e.headers.map["content-type"]?e.headers.map["content-type"].toString():"",o=/charset\=[0-9a-zA-Z\-\_]*;?/,i=t.type.match(o)||n.match(o),a=[t],i&&a.push(i[0].replace(/^charset\=/,"").replace(/;$/,"")),r.readAsText.apply(r,a),l(r);if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)}):this.text=function(){var t=u(this);return t||Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(p)}),this.json=function(){return this.text().then(JSON.parse)},this}function h(t,e){var r,o,i=(e=e||{}).body;if(h.prototype.isPrototypeOf(t)){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new s(t.headers)),this.method=t.method,this.mode=t.mode,i||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=t;if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new s(e.headers)),this.method=(r=e.method||this.method||"GET",o=r.toUpperCase(),n.indexOf(o)>-1?o:r),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i,e)}function p(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function y(t,e){e||(e={}),this._initBody(t,e),this.type="default",this.status=e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText,this.headers=e.headers instanceof s?e.headers:new s(e.headers),this.url=e.url||""}}("undefined"!=typeof self?self:this)},4238:function(t,e){var r,n,o;n=[e,t],void 0===(o="function"==typeof(r=function(t,e){"use strict";var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function o(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t,a=e.timeout||r.timeout,s=e.jsonpCallback||r.jsonpCallback,u=void 0;return new Promise(function(r,l){var c=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=s+"_"+c;window[c]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),u&&clearTimeout(u),o(f),n(c)},i+=-1===i.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+i+s+"="+c),e.charset&&h.setAttribute("charset",e.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),u=setTimeout(function(){l(new Error("JSONP request to "+t+" timed out")),n(c),o(f),window[c]=function(){n(c)}},a),h.onerror=function(){l(new Error("JSONP request to "+t+" failed")),n(c),o(f),u&&clearTimeout(u)}})}})?r.apply(e,n):r)||(t.exports=o)},8813:function(t){var e=[],r=[],n="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function o(t,o){if(o=o||{},void 0===t)throw new Error(n);var i,a=!0===o.prepend?"prepend":"append",s=void 0!==o.container?o.container:document.querySelector("head"),u=e.indexOf(s);return-1===u&&(u=e.push(s)-1,r[u]={}),void 0!==r[u]&&void 0!==r[u][a]?i=r[u][a]:(i=r[u][a]=function(){var t=document.createElement("style");return t.setAttribute("type","text/css"),t}(),"prepend"===a?s.insertBefore(i,s.childNodes[0]):s.appendChild(i)),65279===t.charCodeAt(0)&&(t=t.substr(1,t.length)),i.styleSheet?i.styleSheet.cssText+=t:i.textContent+=t,i}t.exports=o,t.exports.insertCss=o},2138:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t=r.nmd(t);var o=200,i="__lodash_hash_undefined__",a=9007199254740991,s="[object Arguments]",u="[object Boolean]",l="[object Date]",c="[object Function]",f="[object GeneratorFunction]",h="[object Map]",p="[object Number]",y="[object Object]",d="[object RegExp]",b="[object Set]",v="[object String]",m="[object Symbol]",g="[object ArrayBuffer]",w="[object DataView]",O="[object Float32Array]",S="[object Float64Array]",_="[object Int8Array]",P="[object Int16Array]",x="[object Int32Array]",k="[object Uint8Array]",j="[object Uint8ClampedArray]",E="[object Uint16Array]",T="[object Uint32Array]",C=/\w*$/,R=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,M={};M[s]=M["[object Array]"]=M[g]=M[w]=M[u]=M[l]=M[O]=M[S]=M[_]=M[P]=M[x]=M[h]=M[p]=M[y]=M[d]=M[b]=M[v]=M[m]=M[k]=M[j]=M[E]=M[T]=!0,M["[object Error]"]=M[c]=M["[object WeakMap]"]=!1;var L="object"==(void 0===r.g?"undefined":n(r.g))&&r.g&&r.g.Object===Object&&r.g,N="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self,I=L||N||Function("return this")(),D="object"==n(e)&&e&&!e.nodeType&&e,F=D&&"object"==n(t)&&t&&!t.nodeType&&t,B=F&&F.exports===D;function G(t,e){return t.set(e[0],e[1]),t}function U(t,e){return t.add(e),t}function z(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o-1},jt.prototype.set=function(t,e){var r=this.__data__,n=At(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},Et.prototype.clear=function(){this.__data__={hash:new kt,map:new(yt||jt),string:new kt}},Et.prototype.delete=function(t){return Dt(this,t).delete(t)},Et.prototype.get=function(t){return Dt(this,t).get(t)},Et.prototype.has=function(t){return Dt(this,t).has(t)},Et.prototype.set=function(t,e){return Dt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new jt},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof jt){var n=r.__data__;if(!yt||n.length-1&&t%1==0&&t-1&&t%1==0&&t<=a}(t.length)&&!Yt(t)}var Wt=ft||function(){return!1};function Yt(t){var e=Qt(t)?et.call(t):"";return e==c||e==f}function Qt(t){var e=n(t);return!!t&&("object"==e||"function"==e)}function Xt(t){return Ht(t)?Ct(t):function(t){if(!zt(t))return ht(t);var e=[];for(var r in Object(t))tt.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return Mt(t,!0,!0)}},7820:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=9007199254740991,i="[object Arguments]",a="[object Function]",s="[object GeneratorFunction]",u="[object Map]",l="[object Set]",c=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,h="object"==(void 0===r.g?"undefined":n(r.g))&&r.g&&r.g.Object===Object&&r.g,p="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self,y=h||p||Function("return this")();function d(t,e){return function(t,e){for(var r=-1,n=t?t.length:0,o=Array(n);++r-1&&t%1==0&&t-1&&t%1==0&&t<=o}(t.length)&&!Y(t)}function Y(t){var e=Q(t)?x.call(t):"";return e==a||e==s}function Q(t){var e=n(t);return!!t&&("object"==e||"function"==e)}var X,Z=(X=function(t){return W(t)?B(t):U(t)},function(t){var e,r,n,o=J(t);return o==u?(e=t,r=-1,n=Array(e.size),e.forEach(function(t,e){n[++r]=[e,t]}),n):o==l?function(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=[t,t]}),r}(t):d(t,X(t))});t.exports=Z},9819:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t=r.nmd(t);var o=200,i="Expected a function",a="__lodash_hash_undefined__",s=1,u=2,l=1/0,c=9007199254740991,f="[object Arguments]",h="[object Array]",p="[object Boolean]",y="[object Date]",d="[object Error]",b="[object Function]",v="[object GeneratorFunction]",m="[object Map]",g="[object Number]",w="[object Object]",O="[object RegExp]",S="[object Set]",_="[object String]",P="[object Symbol]",x="[object ArrayBuffer]",k="[object DataView]",j=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,E=/^\w*$/,T=/^\./,C=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,R=/\\(\\)?/g,A=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,L={};L["[object Float32Array]"]=L["[object Float64Array]"]=L["[object Int8Array]"]=L["[object Int16Array]"]=L["[object Int32Array]"]=L["[object Uint8Array]"]=L["[object Uint8ClampedArray]"]=L["[object Uint16Array]"]=L["[object Uint32Array]"]=!0,L[f]=L[h]=L[x]=L[p]=L[k]=L[y]=L[d]=L[b]=L[m]=L[g]=L[w]=L[O]=L[S]=L[_]=L["[object WeakMap]"]=!1;var N="object"==(void 0===r.g?"undefined":n(r.g))&&r.g&&r.g.Object===Object&&r.g,I="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self,D=N||I||Function("return this")(),F="object"==n(e)&&e&&!e.nodeType&&e,B=F&&"object"==n(t)&&t&&!t.nodeType&&t,G=B&&B.exports===F&&N.process,U=function(){try{return G&&G.binding("util")}catch(t){}}(),z=U&&U.isTypedArray;function J(t,e){return!!(t?t.length:0)&&function(t,e,r){if(e!=e)return function(t,e,r,n){var o=t.length,i=r+(n?1:-1);for(;n?i--:++i-1}function V(t,e,r){for(var n=-1,o=t?t.length:0;++n-1},Tt.prototype.set=function(t,e){var r=this.__data__,n=Lt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},Ct.prototype.clear=function(){this.__data__={hash:new Et,map:new(dt||Tt),string:new Et}},Ct.prototype.delete=function(t){return Vt(this,t).delete(t)},Ct.prototype.get=function(t){return Vt(this,t).get(t)},Ct.prototype.has=function(t){return Vt(this,t).has(t)},Ct.prototype.set=function(t,e){return Vt(this,t).set(t,e),this},Rt.prototype.add=Rt.prototype.push=function(t){return this.__data__.set(t,a),this},Rt.prototype.has=function(t){return this.__data__.has(t)},At.prototype.clear=function(){this.__data__=new Tt},At.prototype.delete=function(t){return this.__data__.delete(t)},At.prototype.get=function(t){return this.__data__.get(t)},At.prototype.has=function(t){return this.__data__.has(t)},At.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Tt){var n=r.__data__;if(!dt||n.lengthl))return!1;var f=i.get(t);if(f&&i.get(e))return f==e;var h=-1,p=!0,y=o&s?new Rt:void 0;for(i.set(t,e),i.set(e,t);++h-1&&t%1==0&&t-1&&t%1==0&&t<=c}function se(t){var e=n(t);return!!t&&("object"==e||"function"==e)}function ue(t){return!!t&&"object"==n(t)}function le(t){return"symbol"==n(t)||ue(t)&&st.call(t)==P}var ce=z?function(t){return function(e){return t(e)}}(z):function(t){return ue(t)&&ae(t.length)&&!!L[st.call(t)]};function fe(t){return oe(t)?Mt(t):Gt(t)}function he(t){return t}t.exports=function(t,e){return t&&t.length?function(t,e,r){var n=-1,i=J,a=t.length,s=!0,u=[],l=u;if(r)s=!1,i=V;else if(a>=o){var c=e?null:zt(t);if(c)return X(c);s=!1,i=W,l=new Rt}else l=e?[]:u;t:for(;++n=t.minX&&e.maxY>=t.minY}function d(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function b(t,e,r,o,i){for(var a,s=[e,r];s.length;)(r=s.pop())-(e=s.pop())<=o||(a=e+Math.ceil((r-e)/o/2)*o,n(t,a,e,r,i),s.push(e,a,a,r))}o.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,r=[],n=this.toBBox;if(!y(t,e))return r;for(var o,i,a,s,u=[];e;){for(o=0,i=e.children.length;o=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(o,i,e)},_split:function(t,e){var r=t[e],n=r.children.length,o=this._minEntries;this._chooseSplitAxis(r,o,n);var i=this._chooseSplitIndex(r,o,n),s=d(r.children.splice(i,r.children.length-i));s.height=r.height,s.leaf=r.leaf,a(r,this.toBBox),a(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(r,s)},_splitRoot:function(t,e){this.data=d([t,e]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,r){var n,o,i,a,u,l,c,h,p,y,d,b,v,m;for(l=c=1/0,n=e;n<=r-e;n++)o=s(t,0,n,this.toBBox),i=s(t,n,r,this.toBBox),p=o,y=i,void 0,void 0,void 0,void 0,d=Math.max(p.minX,y.minX),b=Math.max(p.minY,y.minY),v=Math.min(p.maxX,y.maxX),m=Math.min(p.maxY,y.maxY),a=Math.max(0,v-d)*Math.max(0,m-b),u=f(o)+f(i),a=e;o--)i=t.children[o],u(c,t.leaf?a(i):i),f+=h(c);return f},_adjustParentBBoxes:function(t,e,r){for(var n=r;n>=0;n--)u(e[n],t)},_condense:function(t){for(var e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children).splice(e.indexOf(t[r]),1):this.clear():a(t[r],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}},4333:function(t,e,r){var n,o,i;function a(t){"@babel/helpers - typeof";return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}i=function(){"use strict";function t(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function e(t,e){return te?1:0}return function(r,n,o,i,a){!function e(r,n,o,i,a){for(;i>o;){if(i-o>600){var s=i-o+1,u=n-o+1,l=Math.log(s),c=.5*Math.exp(2*l/3),f=.5*Math.sqrt(l*c*(s-c)/s)*(u-s/2<0?-1:1),h=Math.max(o,Math.floor(n-u*c/s+f)),p=Math.min(i,Math.floor(n+(s-u)*c/s+f));e(r,n,h,p,a)}var y=r[n],d=o,b=i;for(t(r,o,n),a(r[i],y)>0&&t(r,o,i);d0;)b--}0===a(r[o],y)?t(r,o,b):t(r,++b,i),b<=n&&(o=b+1),n<=b&&(i=b-1)}}(r,n,o||0,i||r.length-1,a||e)}},"object"===a(e)?t.exports=i():void 0===(o="function"==typeof(n=i)?n.call(e,r,e,t):n)||(t.exports=o)},8795:function(t){var e=/^[-+]?0x[a-fA-F0-9]+$/,r=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var n={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};t.exports=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(o=Object.assign({},n,o),!t||"string"!=typeof t)return t;var i=t.trim();if(void 0!==o.skipLike&&o.skipLike.test(i))return t;if(o.hex&&e.test(i))return Number.parseInt(i,16);var a=r.exec(i);if(a){var s=a[1],u=a[2],l=function(t){return t&&-1!==t.indexOf(".")?("."===(t=t.replace(/0+$/,""))?t="0":"."===t[0]?t="0"+t:"."===t[t.length-1]&&(t=t.substr(0,t.length-1)),t):t}(a[3]),c=a[4]||a[6];if(!o.leadingZeros&&u.length>0&&s&&"."!==i[2])return t;if(!o.leadingZeros&&u.length>0&&!s&&"."!==i[1])return t;var f=Number(i),h=""+f;return-1!==h.search(/[eE]/)?o.eNotation?f:t:c?o.eNotation?f:t:-1!==i.indexOf(".")?"0"===h&&""===l?f:h===l?f:s&&h==="-"+l?f:t:u?l===h?f:s+l===h?f:t:i===h?f:i===s+h?f:t}return t}},12:function(t,e,r){var n,o;function i(t){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t=r.nmd(t),function(a,s){"use strict";"object"===i(t)&&t.exports?t.exports=s():void 0===(o="function"==typeof(n=s)?n.call(e,r,e,t):n)||(t.exports=o)}(0,function(t){"use strict";var e=t&&t.IPv6;return{best:function(t){var e,r,n=t.toLowerCase().split(":"),o=n.length,i=8;for(""===n[0]&&""===n[1]&&""===n[2]?(n.shift(),n.shift()):""===n[0]&&""===n[1]?n.shift():""===n[o-1]&&""===n[o-2]&&n.pop(),-1!==n[(o=n.length)-1].indexOf(".")&&(i=7),e=0;e1;s++)r.splice(0,1);n[a]=r.join("")}var u=-1,l=0,c=0,f=-1,h=!1;for(a=0;al&&(u=f,l=c)):"0"===n[a]&&(h=!0,f=a,c=1);c>l&&(u=f,l=c),l>1&&n.splice(u,l,""),o=n.length;var p="";for(""===n[0]&&(p=":"),a=0;a=t.length-1)return!1;var n=t.lastIndexOf(".",e-1);if(n<=0||n>=e-1)return!1;var o=r.list[t.slice(e+1)];return!!o&&o.indexOf(" "+t.slice(n+1,e)+" ")>=0},is:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;if(t.lastIndexOf(".",e-1)>=0)return!1;var n=r.list[t.slice(e+1)];return!!n&&n.indexOf(" "+t.slice(0,e)+" ")>=0},get:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return null;var n=t.lastIndexOf(".",e-1);if(n<=0||n>=e-1)return null;var o=r.list[t.slice(e+1)];return o?o.indexOf(" "+t.slice(n+1,e)+" ")<0?null:t.slice(n+1):null},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=e),this}};return r})},9545:function(t,e,r){var n,o,i;function a(t){"@babel/helpers - typeof";return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t=r.nmd(t),function(s,u){"use strict";"object"===a(t)&&t.exports?t.exports=u(r(9167),r(12),r(5199)):(o=[r(9167),r(12),r(5199)],void 0===(i="function"==typeof(n=u)?n.apply(e,o):n)||(t.exports=i))}(0,function(t,e,r,n){"use strict";var o=n&&n.URI;function i(t,e){var r=arguments.length>=1,n=arguments.length>=2;if(!(this instanceof i))return r?n?new i(t,e):new i(t):new i;if(void 0===t){if(r)throw new TypeError("undefined is not a valid argument for URI");t="undefined"!=typeof location?location.href+"":""}if(null===t&&r)throw new TypeError("null is not a valid argument for URI");return this.href(t),void 0!==e?this.absoluteTo(e):this}i.version="1.19.11";var s=i.prototype,u=Object.prototype.hasOwnProperty;function l(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function c(t){return void 0===t?"Undefined":String(Object.prototype.toString.call(t)).slice(8,-1)}function f(t){return"Array"===c(t)}function h(t,e){var r,n,o={};if("RegExp"===c(e))o=null;else if(f(e))for(r=0,n=e.length;r]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,i.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},i.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,i.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,i.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},i.hostProtocols=["http","https"],i.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,i.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},i.getDomAttribute=function(t){if(t&&t.nodeName){var e=t.nodeName.toLowerCase();if("input"!==e||"image"===t.type)return i.domAttributes[e]}},i.encode=v,i.decode=decodeURIComponent,i.iso8859=function(){i.encode=escape,i.decode=unescape},i.unicode=function(){i.encode=v,i.decode=decodeURIComponent},i.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},i.encodeQuery=function(t,e){var r=i.encode(t+"");return void 0===e&&(e=i.escapeQuerySpace),e?r.replace(/%20/g,"+"):r},i.decodeQuery=function(t,e){t+="",void 0===e&&(e=i.escapeQuerySpace);try{return i.decode(e?t.replace(/\+/g,"%20"):t)}catch(e){return t}};var m,g={encode:"encode",decode:"decode"},w=function(t,e){return function(r){try{return i[e](r+"").replace(i.characters[t][e].expression,function(r){return i.characters[t][e].map[r]})}catch(t){return r}}};for(m in g)i[m+"PathSegment"]=w("pathname",g[m]),i[m+"UrnPathSegment"]=w("urnpath",g[m]);var O=function(t,e,r){return function(n){var o;o=r?function(t){return i[e](i[r](t))}:i[e];for(var a=(n+"").split(t),s=0,u=a.length;s-1&&(e.fragment=t.substring(r+1)||null,t=t.substring(0,r)),(r=t.indexOf("?"))>-1&&(e.query=t.substring(r+1)||null,t=t.substring(0,r)),"//"===(t=(t=t.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://")).replace(/^[/\\]{2,}/i,"//")).substring(0,2)?(e.protocol=null,t=t.substring(2),t=i.parseAuthority(t,e)):(r=t.indexOf(":"))>-1&&(e.protocol=t.substring(0,r)||null,e.protocol&&!e.protocol.match(i.protocol_expression)?e.protocol=void 0:"//"===t.substring(r+1,r+3).replace(/\\/g,"/")?(t=t.substring(r+3),t=i.parseAuthority(t,e)):(t=t.substring(r+1),e.urn=!0)),e.path=t,e},i.parseHost=function(t,e){t||(t="");var r,n,o=(t=t.replace(/\\/g,"/")).indexOf("/");if(-1===o&&(o=t.length),"["===t.charAt(0))r=t.indexOf("]"),e.hostname=t.substring(1,r)||null,e.port=t.substring(r+2,o)||null,"/"===e.port&&(e.port=null);else{var a=t.indexOf(":"),s=t.indexOf("/"),u=t.indexOf(":",a+1);-1!==u&&(-1===s||u-1?o:t.length-1);return a>-1&&(-1===o||a-1?p.slice(0,y)+p.slice(y).replace(a,""):p.replace(a,"")).length<=l[0].length||r.ignore&&r.ignore.test(p))){var v=e(p,c,h=c+p.length,t);void 0!==v?(v=String(v),t=t.slice(0,c)+v+t.slice(h),n.lastIndex=c+v.length):n.lastIndex=h}}return n.lastIndex=0,t},i.ensureValidHostname=function(e,r){var n=!!e,o=!1;if(!!r&&(o=p(i.hostProtocols,r)),o&&!n)throw new TypeError("Hostname cannot be empty, if protocol is "+r);if(e&&e.match(i.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(e).match(i.invalid_hostname_characters))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-:_]')}},i.ensureValidPort=function(t){if(t){var e=Number(t);if(!(/^[0-9]+$/.test(e)&&e>0&&e<65536))throw new TypeError('Port "'+t+'" is not a valid port')}},i.noConflict=function(t){if(t){var e={URI:this.noConflict()};return n.URITemplate&&"function"==typeof n.URITemplate.noConflict&&(e.URITemplate=n.URITemplate.noConflict()),n.IPv6&&"function"==typeof n.IPv6.noConflict&&(e.IPv6=n.IPv6.noConflict()),n.SecondLevelDomains&&"function"==typeof n.SecondLevelDomains.noConflict&&(e.SecondLevelDomains=n.SecondLevelDomains.noConflict()),e}return n.URI===this&&(n.URI=o),this},s.build=function(t){return!0===t?this._deferred_build=!0:(void 0===t||this._deferred_build)&&(this._string=i.build(this._parts),this._deferred_build=!1),this},s.clone=function(){return new i(this)},s.valueOf=s.toString=function(){return this.build(!1)._string},s.protocol=S("protocol"),s.username=S("username"),s.password=S("password"),s.hostname=S("hostname"),s.port=S("port"),s.query=_("query","?"),s.fragment=_("fragment","#"),s.search=function(t,e){var r=this.query(t,e);return"string"==typeof r&&r.length?"?"+r:r},s.hash=function(t,e){var r=this.fragment(t,e);return"string"==typeof r&&r.length?"#"+r:r},s.pathname=function(t,e){if(void 0===t||!0===t){var r=this._parts.path||(this._parts.hostname?"/":"");return t?(this._parts.urn?i.decodeUrnPath:i.decodePath)(r):r}return this._parts.urn?this._parts.path=t?i.recodeUrnPath(t):"":this._parts.path=t?i.recodePath(t):"/",this.build(!e),this},s.path=s.pathname,s.href=function(t,e){var r;if(void 0===t)return this.toString();this._string="",this._parts=i._parts();var n=t instanceof i,o="object"===a(t)&&(t.hostname||t.path||t.pathname);t.nodeName&&(t=t[i.getDomAttribute(t)]||"",o=!1);if(!n&&o&&void 0!==t.pathname&&(t=t.toString()),"string"==typeof t||t instanceof String)this._parts=i.parse(String(t),this._parts);else{if(!n&&!o)throw new TypeError("invalid input");var s=n?t._parts:t;for(r in s)"query"!==r&&u.call(this._parts,r)&&(this._parts[r]=s[r]);s.query&&this.query(s.query,!1)}return this.build(!e),this},s.is=function(t){var e=!1,n=!1,o=!1,a=!1,s=!1,u=!1,l=!1,c=!this._parts.urn;switch(this._parts.hostname&&(c=!1,n=i.ip4_expression.test(this._parts.hostname),o=i.ip6_expression.test(this._parts.hostname),s=(a=!(e=n||o))&&r&&r.has(this._parts.hostname),u=a&&i.idn_expression.test(this._parts.hostname),l=a&&i.punycode_expression.test(this._parts.hostname)),t.toLowerCase()){case"relative":return c;case"absolute":return!c;case"domain":case"name":return a;case"sld":return s;case"ip":return e;case"ip4":case"ipv4":case"inet4":return n;case"ip6":case"ipv6":case"inet6":return o;case"idn":return u;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return l}return null};var P=s.protocol,x=s.port,k=s.hostname;s.protocol=function(t,e){if(t&&!(t=t.replace(/:(\/\/)?$/,"")).match(i.protocol_expression))throw new TypeError('Protocol "'+t+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return P.call(this,t,e)},s.scheme=s.protocol,s.port=function(t,e){return this._parts.urn?void 0===t?"":this:(void 0!==t&&(0===t&&(t=null),t&&(":"===(t+="").charAt(0)&&(t=t.substring(1)),i.ensureValidPort(t))),x.call(this,t,e))},s.hostname=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0!==t){var r={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==i.parseHost(t,r))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');t=r.hostname,this._parts.preventInvalidHostname&&i.ensureValidHostname(t,this._parts.protocol)}return k.call(this,t,e)},s.origin=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){var r=this.protocol();return this.authority()?(r?r+"://":"")+this.authority():""}var n=i(t);return this.protocol(n.protocol()).authority(n.authority()).build(!e),this},s.host=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t)return this._parts.hostname?i.buildHost(this._parts):"";if("/"!==i.parseHost(t,this._parts))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');return this.build(!e),this},s.authority=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t)return this._parts.hostname?i.buildAuthority(this._parts):"";if("/"!==i.parseAuthority(t,this._parts))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');return this.build(!e),this},s.userinfo=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){var r=i.buildUserinfo(this._parts);return r?r.substring(0,r.length-1):r}return"@"!==t[t.length-1]&&(t+="@"),i.parseUserinfo(t,this._parts),this.build(!e),this},s.resource=function(t,e){var r;return void 0===t?this.path()+this.search()+this.hash():(r=i.parse(t),this._parts.path=r.path,this._parts.query=r.query,this._parts.fragment=r.fragment,this.build(!e),this)},s.subdomain=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,r)||""}var n=this._parts.hostname.length-this.domain().length,o=this._parts.hostname.substring(0,n),a=new RegExp("^"+l(o));if(t&&"."!==t.charAt(t.length-1)&&(t+="."),-1!==t.indexOf(":"))throw new TypeError("Domains cannot contain colons");return t&&i.ensureValidHostname(t,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(a,t),this.build(!e),this},s.domain=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("boolean"==typeof t&&(e=t,t=void 0),void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.match(/\./g);if(r&&r.length<2)return this._parts.hostname;var n=this._parts.hostname.length-this.tld(e).length-1;return n=this._parts.hostname.lastIndexOf(".",n-1)+1,this._parts.hostname.substring(n)||""}if(!t)throw new TypeError("cannot set domain empty");if(-1!==t.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(i.ensureValidHostname(t,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=t;else{var o=new RegExp(l(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(o,t)}return this.build(!e),this},s.tld=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("boolean"==typeof t&&(e=t,t=void 0),void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.lastIndexOf("."),o=this._parts.hostname.substring(n+1);return!0!==e&&r&&r.list[o.toLowerCase()]&&r.get(this._parts.hostname)||o}var i;if(!t)throw new TypeError("cannot set TLD empty");if(t.match(/[^a-zA-Z0-9-]/)){if(!r||!r.is(t))throw new TypeError('TLD "'+t+'" contains characters other than [A-Z0-9]');i=new RegExp(l(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(i,t)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");i=new RegExp(l(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(i,t)}return this.build(!e),this},s.directory=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t||!0===t){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var r=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,r)||(this._parts.hostname?"/":"");return t?i.decodePath(n):n}var o=this._parts.path.length-this.filename().length,a=this._parts.path.substring(0,o),s=new RegExp("^"+l(a));return this.is("relative")||(t||(t="/"),"/"!==t.charAt(0)&&(t="/"+t)),t&&"/"!==t.charAt(t.length-1)&&(t+="/"),t=i.recodePath(t),this._parts.path=this._parts.path.replace(s,t),this.build(!e),this},s.filename=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("string"!=typeof t){if(!this._parts.path||"/"===this._parts.path)return"";var r=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(r+1);return t?i.decodePathSegment(n):n}var o=!1;"/"===t.charAt(0)&&(t=t.substring(1)),t.match(/\.?\//)&&(o=!0);var a=new RegExp(l(this.filename())+"$");return t=i.recodePath(t),this._parts.path=this._parts.path.replace(a,t),o?this.normalizePath(e):this.build(!e),this},s.suffix=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t||!0===t){if(!this._parts.path||"/"===this._parts.path)return"";var r,n,o=this.filename(),a=o.lastIndexOf(".");return-1===a?"":(r=o.substring(a+1),n=/^[a-z0-9%]+$/i.test(r)?r:"",t?i.decodePathSegment(n):n)}"."===t.charAt(0)&&(t=t.substring(1));var s,u=this.suffix();if(u)s=t?new RegExp(l(u)+"$"):new RegExp(l("."+u)+"$");else{if(!t)return this;this._parts.path+="."+i.recodePath(t)}return s&&(t=i.recodePath(t),this._parts.path=this._parts.path.replace(s,t)),this.build(!e),this},s.segment=function(t,e,r){var n=this._parts.urn?":":"/",o=this.path(),i="/"===o.substring(0,1),a=o.split(n);if(void 0!==t&&"number"!=typeof t&&(r=e,e=t,t=void 0),void 0!==t&&"number"!=typeof t)throw new Error('Bad segment "'+t+'", must be 0-based integer');if(i&&a.shift(),t<0&&(t=Math.max(a.length+t,0)),void 0===e)return void 0===t?a:a[t];if(null===t||void 0===a[t])if(f(e)){a=[];for(var s=0,u=e.length;s= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=h-p,x=Math.floor,k=String.fromCharCode;function j(t){throw new RangeError(_[t])}function E(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function T(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+E((t=t.replace(S,".")).split("."),e).join(".")}function C(t){for(var e,r,n=[],o=0,i=t.length;o=55296&&e<=56319&&o65535&&(e+=k((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=k(t)}).join("")}function A(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function M(t,e,r){var n=0;for(t=r?x(t/b):t>>1,t+=x(t/e);t>P*y>>1;n+=h)t=x(t/P);return x(n+(P+1)*t/(t+d))}function L(t){var e,r,n,o,i,a,s,u,l,c,d,b=[],w=t.length,O=0,S=m,_=v;for((r=t.lastIndexOf(g))<0&&(r=0),n=0;n=128&&j("not-basic"),b.push(t.charCodeAt(n));for(o=r>0?r+1:0;o=w&&j("invalid-input"),((u=(d=t.charCodeAt(o++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:h)>=h||u>x((f-O)/a))&&j("overflow"),O+=u*a,!(u<(l=s<=_?p:s>=_+y?y:s-_));s+=h)a>x(f/(c=h-l))&&j("overflow"),a*=c;_=M(O-i,e=b.length+1,0==i),x(O/e)>f-S&&j("overflow"),S+=x(O/e),O%=e,b.splice(O++,0,S)}return R(b)}function N(t){var e,r,n,o,i,a,s,u,l,c,d,b,w,O,S,_=[];for(b=(t=C(t)).length,e=m,r=0,i=v,a=0;a=e&&dx((f-r)/(w=n+1))&&j("overflow"),r+=(s-e)*w,e=s,a=0;af&&j("overflow"),d==e){for(u=r,l=h;!(u<(c=l<=i?p:l>=i+y?y:l-i));l+=h)S=u-c,O=h-c,_.push(k(A(c+S%O,0))),u=x(S/O);_.push(k(A(u,0))),i=M(r,w,n==o),r=0,++n}++r,++e}return _.join("")}if(l={version:"1.3.2",ucs2:{decode:C,encode:R},decode:L,encode:N,toASCII:function(t){return T(t,function(t){return O.test(t)?"xn--"+N(t):t})},toUnicode:function(t){return T(t,function(t){return w.test(t)?L(t.slice(4).toLowerCase()):t})}},"object"==o(r.amdO)&&r.amdO)void 0===(n=function(){return l}.call(e,r,e,t))||(t.exports=n);else if(a&&s)if(t.exports==a)s.exports=l;else for(c in l)l.hasOwnProperty(c)&&(a[c]=l[c]);else i.punycode=l}(this)},3679:function(){"use strict"},2143:function(t,e,r){"use strict";var n=mapboxgl,o=r.n(n);!function(){o().Map.prototype.overlayLayersManager={},void 0===o().Map.prototype.addLayerBak&&(o().Map.prototype.addLayerBak=o().Map.prototype.addLayer,o().Map.prototype.addLayer=function(t,e){return t.source||"custom"===t.type||"background"===t.type?(this.addLayerBak(t,e),t.overlay&&!this.overlayLayersManager[t.id]&&(this.overlayLayersManager[t.id]=t),this):this.overlayLayersManager[t.id]||this.style._layers[t.id]?void this.fire("error",{error:new Error("A layer with this id already exists.")}):(function(t,e){t.onAdd&&t.onAdd(e)}(t,this),this.overlayLayersManager[t.id]=t,this)}),o().Map.prototype.getLayer=function(t){return this.overlayLayersManager[t]?this.overlayLayersManager[t]:this.style.getLayer(t)},o().Map.prototype.moveLayer=function(t,e){return this.overlayLayersManager[t]?(this.overlayLayersManager[t].moveLayer?this.overlayLayersManager[t].moveLayer(t,e):function(t,e){var r=document.getElementById(t);if(e){var n=document.getElementById(e);n||o().Evented.prototype.fire("error",{error:new Error('Layer with id "'.concat(e,'" does not exist on this document.'))})}r&&n?n.parentNode.insertBefore(r,n):r.parentNode.appendChild(r)}(t,e),this):this.style._layers[t]?(this.style.moveLayer(t,e),this._update(!0),this):void 0},o().Map.prototype.removeLayer=function(t){return this.overlayLayersManager[t]&&delete this.overlayLayersManager[t],this.style.removeLayer(t),this._update(!0),this},o().Map.prototype.setLayoutProperty=function(t,e,r){return this.overlayLayersManager[t]?("visibility"===e&&(r="visible"===r,n=this.overlayLayersManager[t],o=r,n.setVisibility&&n.setVisibility(o),this.style.fire("data",{dataType:"style"})),this):(this.style.setLayoutProperty(t,e,r),this._update(!0),this);var n,o},o().Map.prototype.updateTransform=function(t,e,r,n,i,a,s){this.transform.units=t;var u=this.mercatorZfromAltitude;o().MercatorCoordinate.fromLngLat=function(t,n){n=n||0;var i=o().LngLat.convert(t);return new(o().MercatorCoordinate)((i.lng-e)/a,(r-i.lat)/s,u(n,i.lat))},o().MercatorCoordinate.prototype.toLngLat=function(){return new(o().LngLat)(this.x*a+e,r-this.y*s)},this.customConvertPoint=window.URL.createObjectURL(new Blob(["customConvertPoint = {projectX:function(x){return (x - "+n+") / "+a+" + 0.5},projectY:function(y){y = 0.5 - ((y - "+i+") / "+s+");return y < 0 ? 0 : y > 1 ? 1 : y;},toY:function(y){return (0.5-y)*"+s+"+"+i+";}}"],{type:"text/javascript"}))}}();function i(t,e){for(var r=0;r"+r+"",this._createStyleSheet(),this._container}},{key:"_createStyleSheet",value:function(){var t=document.createElement("style");t.type="text/css",t.innerHTML=".iclient-logo{margin:0 !important;}.iclient-logo a{border: none;display: block;height:31px;}.iclient-logo img{border: none;white-space: nowrap}",document.getElementsByTagName("head")[0].appendChild(t)}},{key:"_extend",value:function(t){for(var e=0;e0&&(r=parseFloat(t.toPrecision(e))),r},format:function(t,e,r,n){e=void 0!==e?e:0,r=void 0!==r?r:y.thousandsSeparator,n=void 0!==n?n:y.decimalSeparator,null!=e&&(t=parseFloat(t.toFixed(e)));var o=t.toString().split(".");1===o.length&&null==e&&(e=0);var i,a=o[0];if(r)for(var s=/(-?[0-9]+)([0-9]{3})/;s.test(a);)a=a.replace(s,"$1"+r+"$2");if(0==e)i=a;else{var u=o.length>1?o[1]:"0";null!=e&&(u+=new Array(e-u.length+1).join("0")),i=a+n+u}return i}};Number.prototype.limitSigDigs||(Number.prototype.limitSigDigs=function(t){return y.limitSigDigs(this,t)});var d={bind:function(t,e){var r=Array.prototype.slice.apply(arguments,[2]);return function(){var n=r.concat(Array.prototype.slice.apply(arguments,[0]));return t.apply(e,n)}},bindAsEventListener:function(t,e){return function(r){return t.call(e,r||window.event)}},False:function(){return!1},True:function(){return!0},Void:function(){}},b={filter:function(t,e,r){var n=[];if(Array.prototype.filter)n=t.filter(e,r);else{var o=t.length;if("function"!=typeof e)throw new TypeError;for(var i=0;i-1||k.indexOf("trident")>-1&&k.indexOf("rv")>-1?(_="msie",S=k.match(/msie ([\d.]+)/)||k.match(/rv:([\d.]+)/)):k.indexOf("chrome")>-1?(_="chrome",S=k.match(/chrome\/([\d.]+)/)):k.indexOf("firefox")>-1?(_="firefox",S=k.match(/firefox\/([\d.]+)/)):k.indexOf("opera")>-1?(_="opera",S=k.match(/version\/([\d.]+)/)):k.indexOf("safari")>-1&&(_="safari",S=k.match(/version\/([\d.]+)/)),P=S?S[1]:"",k.indexOf("ipad")>-1||k.indexOf("ipod")>-1||k.indexOf("iphone")>-1?x="apple":k.indexOf("android")>-1&&(P=(S=k.match(/version\/([\d.]+)/))?S[1]:"",x="android"),{name:_,version:P,device:x}),C=(j=!0,E=T,document.createElement("canvas").getContext?("firefox"===E.name&&parseFloat(E.version)<5&&(j=!1),"safari"===E.name&&parseFloat(E.version)<4&&(j=!1),"opera"===E.name&&parseFloat(E.version)<10&&(j=!1),"msie"===E.name&&parseFloat(E.version)<9&&(j=!1)):j=!1,j),R=function(){var t=navigator.userAgent.toLowerCase();return-1===t.indexOf("webkit")&&-1!==t.indexOf("gecko")}(),A={assign:function(t){for(var e=0;e=0;r--)t[r]===e&&t.splice(r,1);return t},indexOf:function(t,e){if(null==t)return-1;if("function"==typeof t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r=0&&parseFloat(s)<1?(t.style.filter="alpha(opacity="+100*s+")",t.style.opacity=s):1===parseFloat(s)&&(t.style.filter="",t.style.opacity="")},applyDefaults:function(t,e){t=t||{};var r="function"==typeof window.Event&&e instanceof window.Event;for(var n in e)(void 0===t[n]||!r&&e.hasOwnProperty&&e.hasOwnProperty(n)&&!t.hasOwnProperty(n))&&(t[n]=e[n]);return!r&&e&&e.hasOwnProperty&&e.hasOwnProperty("toString")&&!t.hasOwnProperty("toString")&&(t.toString=e.toString),t},getParameterString:function(t){var e=[];for(var r in t){var n,o=t[r];if(null!=o&&"function"!=typeof o)n=Array.isArray(o)||"[object Object]"===o.toString()?encodeURIComponent(JSON.stringify(o)):encodeURIComponent(o),e.push(encodeURIComponent(r)+"="+n)}return e.join("&")},urlAppend:function(t,e){var r=t;if(e){0===e.indexOf("?")&&(e=e.substring(1));var n=(t+" ").split(/[?&]/);r+=" "===n.pop()?e:n.length?"&"+e:"?"+e}return r},urlPathAppend:function(t,e){var r=t;if(!e)return r;0===e.indexOf("/")&&(e=e.substring(1));var n=t.split("?");return n[0].indexOf("/",n[0].length-1)<0&&(n[0]+="/"),r="".concat(n[0]).concat(e).concat(n.length>1?"?".concat(n[1]):"")},DEFAULT_PRECISION:14,toFloat:function(t,e){return null==e&&(e=A.DEFAULT_PRECISION),"number"!=typeof t&&(t=parseFloat(t)),0===e?t:parseFloat(t.toPrecision(e))},rad:function(t){return t*Math.PI/180},getParameters:function(t){t=null===t||void 0===t?window.location.href:t;var e="";if(p.contains(t,"?")){var r=t.indexOf("?")+1,n=p.contains(t,"#")?t.indexOf("#"):t.length;e=t.substring(r,n)}for(var o={},i=e.split(/[&;]/),a=0,s=i.length;a1?1/t:t},getResolutionFromScale:function(t,e){var r;t&&(null==e&&(e="degrees"),r=1/(A.normalizeScale(t)*M[e]*96));return r},getScaleFromResolution:function(t,e){return null==e&&(e="degrees"),t*M[e]*96},getBrowser:function(){return T},isSupportCanvas:C,supportCanvas:function(){return A.isSupportCanvas},isInTheSameDomain:function(t){return!t||(-1===t.indexOf("//")||A.isSameDomain(t,document.location.toString()))},isSameDomain:function(t,e){return new(w())(t).normalize().origin()===new(w())(e).normalize().origin()},calculateDpi:function(t,e,r,n,o){if(t&&e&&r){var i,a=t.getWidth(),s=t.getHeight(),u=e.w,l=e.h;if(o=o||6378137,"degree"===(n=n||"degrees").toLowerCase()||"degrees"===n.toLowerCase()||"dd"===n.toLowerCase()){var c=a/u,f=s/l;i=254/(c>f?c:f)/r/(2*Math.PI*o/360)/1e4}else{i=254/(a/u)/r/1e4}return i}},toJSON:function(t){var e=t;if(null==e)return null;switch(e.constructor){case String:return e=(e=(e=(e=(e=(e=(e='"'+e.replace(/(["\\])/g,"\\$1")+'"').replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace("<","<")).replace(">",">")).replace(/%/g,"%25")).replace(/&/g,"%26");case Array:for(var r="",n=0,o=e.length;n0?"{"+u.join(",")+"}":"{}"}return e.toString()}},getResolutionFromScaleDpi:function(t,e,r,n){return n=n||6378137,r=r||"",t>0&&e>0?(t=A.normalizeScale(t),"degree"===r.toLowerCase()||"degrees"===r.toLowerCase()||"dd"===r.toLowerCase()?254/e/t/(2*Math.PI*n/360)/1e4:254/e/t/1e4):-1},getScaleFromResolutionDpi:function(t,e,r,n){return n=n||6378137,r=r||"",t>0&&e>0?"degree"===r.toLowerCase()||"degrees"===r.toLowerCase()||"dd"===r.toLowerCase()?254/e/t/(2*Math.PI*n/360)/1e4:254/e/t/1e4:-1},transformResult:function(t){return t.responseText&&"string"==typeof t.responseText&&(t=JSON.parse(t.responseText)),t},copyAttributes:function(t,e){if(t=t||{},e)for(var r in e){var n=e[r];void 0!==n&&"CLASS_NAME"!==r&&"function"!=typeof n&&(t[r]=n)}return t},copyAttributesWithClip:function(t,e,r){if(t=t||{},e)for(var n in e){var o=!1;if(r&&r.length)for(var i=0,a=r.length;i=0&&i<=1&&o<=1&&i>=0?new m.Point(t.x+o*(e.x-t.x),t.y+o*(e.y-t.y)):"No Intersection";else if(0==s&&0==u){var c=Math.max(t.y,e.y),f=Math.min(t.y,e.y),h=Math.max(t.x,e.x),p=Math.min(t.x,e.x);a=(r.y>=f&&r.y<=c||n.y>=f&&n.y<=c)&&r.x>=p&&r.x<=h||n.x>=p&&n.x<=h?"Coincident":"Parallel"}else a="Parallel";return a},getTextBounds:function(t,e,r){document.body.appendChild(r),r.style.width="auto",r.style.height="auto",t.fontSize&&(r.style.fontSize=t.fontSize),t.fontFamily&&(r.style.fontFamily=t.fontFamily),t.fontWeight&&(r.style.fontWeight=t.fontWeight),r.style.position="relative",r.style.visibility="hidden",r.style.display="inline-block",r.innerHTML=e;var n=r.clientWidth,o=r.clientHeight;return document.body.removeChild(r),{textWidth:n,textHeight:o}},convertPath:function(t,e){return e?t.replace(/\{([\w-\.]+)\}/g,function(t,r){var n;return n=e.hasOwnProperty(r)?function(t){if(void 0==t||null==t)return"";if(t instanceof Date)return t.toJSON();if(function(t){if("string"!=typeof t&&"object"!==O(t))return!1;try{var e=t.toString();return"[object Object]"===e||"[object Array]"===e}catch(t){return!1}}(t))return JSON.stringify(t);return t.toString()}(e[r]):t,encodeURIComponent(n)}):t}},M={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754,yd:36};M.in=M.inches,M.degrees=M.dd,M.nmi=1852*M.m;var L=.0254000508001016;function N(t,e){for(var r=0;rt.right;)e.lon-=t.getWidth()}return e}},{key:"destroy",value:function(){this.lon=null,this.lat=null}}])&&N(e.prototype,r),n&&N(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function D(t,e){for(var r=0;rthis.right)&&(this.right=r.right),(null==this.top||r.top>this.top)&&(this.top=r.top))}}},{key:"containsLonLat",value:function(t,e){"boolean"==typeof e&&(e={inclusive:e}),e=e||{};var r=this.contains(t.lon,t.lat,e.inclusive),n=e.worldBounds;if(n&&!r){var o=n.getWidth(),i=(n.left+n.right)/2,a=Math.round((t.lon-i)/o);r=this.containsLonLat({lon:t.lon-a*o,lat:t.lat},{inclusive:e.inclusive})}return r}},{key:"containsPixel",value:function(t,e){return this.contains(t.x,t.y,e)}},{key:"contains",value:function(t,e,r){if(null==r&&(r=!0),null==t||null==e)return!1;var n=!1;return n=r?t>=this.left&&t<=this.right&&e>=this.bottom&&e<=this.top:t>this.left&&tthis.bottom&&e=r.bottom&&t.bottom<=r.top||r.bottom>=t.bottom&&r.bottom<=t.top,a=t.top>=r.bottom&&t.top<=r.top||r.top>t.bottom&&r.top=r.left&&t.left<=r.right||r.left>=t.left&&r.left<=t.right,u=t.right>=r.left&&t.right<=r.right||r.right>=t.left&&r.right<=t.right;n=(i||a)&&(s||u)}if(e.worldBounds&&!n){var l=e.worldBounds,c=l.getWidth(),f=!l.containsBounds(r),h=!l.containsBounds(t);f&&!h?(t=t.add(-c,0),n=r.intersectsBounds(t,{inclusive:e.inclusive})):h&&!f&&(r=r.add(-c,0),n=t.intersectsBounds(r,{inclusive:e.inclusive}))}return n}},{key:"containsBounds",value:function(t,e,r){null==e&&(e=!1),null==r&&(r=!0);var n=this.contains(t.left,t.bottom,r),o=this.contains(t.right,t.bottom,r),i=this.contains(t.left,t.top,r),a=this.contains(t.right,t.top,r);return e?n||o||i||a:n&&o&&i&&a}},{key:"determineQuadrant",value:function(t){var e="",r=this.getCenterLonLat();return e+=t.lat=t.right&&o.right>t.right;)o=o.add(-i,0);var a=o.left+r;at.left&&o.right-n>t.right&&(o=o.add(-i,0))}return o}},{key:"toServerJSONObject",value:function(){return{rightTop:{x:this.right,y:this.top},leftBottom:{x:this.left,y:this.bottom},left:this.left,right:this.right,top:this.top,bottom:this.bottom}}},{key:"destroy",value:function(){this.left=null,this.right=null,this.top=null,this.bottom=null,this.centerLonLat=null}}])&&D(e.prototype,r),n&&D(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function B(t){"@babel/helpers - typeof";return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function G(t,e){for(var r=0;r-1)){if(null!=e&&e=0;--r)e=this.removeComponent(t[r])||e;return e}},{key:"removeComponent",value:function(t){return A.removeItem(this.components,t),this.clearBounds(),!0}},{key:"getArea",value:function(){for(var t=0,e=0,r=this.components.length;e=1?1:v)<=-1?-1:v,c=180*Math.acos(v)/Math.PI,a=(c=o.x==r.x?e.x>r.x&&n.x>r.x||e.xh*e.x+p&&n.y>h*n.x+p||e.yr.y?n.xr.x&&(s=!1):o.xh*n.x+p&&(s=!1):o.x>r.x?n.y>r.y&&(s=!1):n.y=0?180*Math.atan(m)/Math.PI:Math.abs(180*Math.atan(m)/Math.PI)+90,w=Math.abs(e.y);r.y==w&&w==o.y&&r.x=0?m>=0?l+=u:l=180-(l-90)+u:l=m>0?l-180+u:90-l+u:O>=0?m>=0?l-=u:l=180-(l-90)-u:l=m>=0?l-180-u:90-l-u,l=l*Math.PI/180;var _=e.x+i*Math.cos(l),P=e.y+i*Math.sin(l);f.push(new q(_,P))}f.push(o)}return f}},{key:"createLineEPS",value:function(t){var e=[],r=t.length;if(r<2)return t;for(var n=0;n2;return e&&pt(bt(i.prototype),"removeComponent",this).apply(this,arguments),e}},{key:"getSortedSegments",value:function(){for(var t,e,r=this.components.length-1,n=new Array(r),o=0;o3;if(e){this.components.pop(),wt(_t(i.prototype),"removeComponent",this).apply(this,arguments);var r=this.components[0];wt(_t(i.prototype),"addComponent",this).apply(this,[r])}return e}},{key:"getArea",value:function(){var t=0;if(this.components&&this.components.length>2){for(var e=0,r=0,n=this.components.length;r0){t+=Math.abs(this.components[0].getArea());for(var e=1,r=this.components.length;e0&&r.push(","),r.push(this.writeNewline(),this.writeIndent(),e));return this.level-=1,r.push(this.writeNewline(),this.writeIndent(),"]"),r.join("")},string:function(t){var e={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return/["\\\x00-\x1f]/.test(t)?'"'+t.replace(/([\x00-\x1f\\"])/g,function(t,r){var n=e[r];return n||(n=r.charCodeAt(),"\\u00"+Math.floor(n/16).toString(16)+(n%16).toString(16))})+'"':'"'+t+'"'},number:function(t){return isFinite(t)?String(t):"null"},boolean:function(t){return String(t)},date:function(t){function e(t){return t<10?"0"+t:t}return'"'+t.getFullYear()+"-"+e(t.getMonth()+1)+"-"+e(t.getDate())+"T"+e(t.getHours())+":"+e(t.getMinutes())+":"+e(t.getSeconds())+'"'}},e}return e=i,(r=[{key:"read",value:function(t,e){var r;if(this.nativeJSON)try{r=JSON.parse(t,e)}catch(e){return{data:t}}return this.keepData&&(this.data=r),r}},{key:"write",value:function(t,e){this.pretty=!!e;var r=null,n=Ht(t);if(this.serialize[n])try{r=!this.pretty&&this.nativeJSON?JSON.stringify(t):this.serialize[n].apply(this,[t])}catch(t){}return r}},{key:"writeIndent",value:function(){var t=[];if(this.pretty)for(var e=0;e0))return null;for(var a=0,s=0,u=[];a0){t+='"points":[';for(var r=0,n=this.components.length;rt[i]){var a=t[i];t[i]=t[o],t[o]=a;var s=e[i];if(e[i]=e[o],e[o]=s,r&&r.length>0){var u=r[i];r[i]=r[o],r[o]=u}if(n&&n.length>0){var l=n[i];n[i]=n[o],n[o]=l}}}}],(r=[{key:"destroy",value:function(){var t=this;t.id=null,t.style=null,t.parts=null,t.partTopo=null,t.points=null,t.type=null,t.prjCoordSys=null}},{key:"toGeometry",value:function(){var t=this;switch(t.type.toUpperCase()){case Ce.POINT:return t.toGeoPoint();case Ce.LINE:return t.toGeoLine();case Ce.LINEM:return t.toGeoLinem();case Ce.REGION:return t.toGeoRegion();case Ce.POINTEPS:return t.toGeoPoint();case Ce.LINEEPS:return t.toGeoLineEPS();case Ce.REGIONEPS:return t.toGeoRegionEPS();case Ce.GEOCOMPOUND:return t.transformGeoCompound()}}},{key:"toGeoPoint",value:function(){var t=this.parts||[],e=this.points||[],r=t.length;if(r>0){if(1===r)return new q(e[0].x,e[0].y);for(var n=[],o=0;o0){if(1===r){for(var n=[],o=0;o0){if(1===s){for(t=0,r=[];t=0;g--)if(v[m]=-1,f[g].containsBounds(f[m])){h[m]=-1*h[g],h[m]<0&&(v[m]=g);break}for(var w=0;w0?i.push(c[w]):(i[v[w]].components=i[v[w]].components.concat(c[w].components),i.push(""))}else{i=new Array;for(var O=0;O0&&i.length>0&&(i[i.length-1].components=i[i.length-1].components.concat(u),u=[]),i.push(c[O])),O==o-1){var S=i.length;if(S)i[S-1].components=i[S-1].components.concat(u);else for(var _=0,P=u.length;_=0;w--)if(m[g]=-1,h[w].containsBounds(h[g])){p[g]=-1*p[w],p[g]<0&&(m[g]=w);break}for(var O=0;O0?a.push(f[O]):(a[m[O]].components=a[m[O]].components.concat(f[O].components),a.push(""))}else{a=new Array;for(var S=0;S0&&a.length>0&&(a[a.length-1].components=a[a.length-1].components.concat(l),l=[]),a.push(f[S])),S==o-1){var _=a.length;if(_)a[_-1].components=a[_-1].components.concat(l);else for(var P=0,x=l.length;P-1||(e[n]=t[n]);return e}}])&&wr(e.prototype,r),n&&wr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}(),kr=function(t){return"[object Array]"==Object.prototype.toString.call(t)},jr=function(t){return"string"==typeof t&&t.constructor===String},Er={toSuperMapGeometry:function(t){if(t&&t.type)return(new xr).read(t,"FeatureCollection")[0].geometry},toSuperMapBounds:function(t){return kr(t)?new F(t[0],t[1],t[2],t[3]):t instanceof o().LngLatBounds?new F(t.getWest(),t.getSouth(),t.getEast(),t.getNorth()):t},toSuperMapPoint:function(t){return kr(t)?new q(t[0],t[1]):t.lng&&t.lat?new q(t.lng,t.lat):new q(t.geometry.coordinates[0],t.geometry.coordinates[1])},toSuperMapPolygon:function(t){var e=t.getWest(),r=t.getEast(),n=t.getSouth(),o=t.getNorth();return new Ct([new Pt([new q(e,n),new q(r,n),new q(r,o),new q(e,o)])])},isArray:kr,toGeoJSON:function(t){if(t)return(new xr).toGeoJSON(t)},toProcessingParam:function(t){var e={};if(t.length<1)e="";else{for(var r=[],n=0;n1&&(r=parseFloat(r)*l),n.labelAlign&&"cm"!==n.labelAlign)switch(n.labelAlign){case"lt":u.x+=e/2,u.y+=r/2;break;case"lm":u.x+=e/2;break;case"lb":u.x+=e/2,u.y-=r/2;break;case"ct":u.y+=r/2;break;case"cb":u.y-=r/2;break;case"rt":u.x-=e/2,u.y+=r/2;break;case"rm":u.x-=e/2;break;case"rb":u.x-=e/2,u.y-=r/2}return this.bsInfo.h=r,this.bsInfo.w=e,o=u.x-parseFloat(e)/2,i=u.y+parseFloat(r)/2,s=u.x+parseFloat(e)/2,a=u.y-parseFloat(r)/2,new F(o,i,s,a)}},{key:"getLabelPxBoundsByText",value:function(t,e){var r,n,o,i,a=this.getLabelPxSize(e),s=A.cloneObject(t);if(e.labelAlign&&"cm"!==e.labelAlign)switch(e.labelAlign){case"lt":s.x+=a.w/2,s.y+=a.h/2;break;case"lm":s.x+=a.w/2;break;case"lb":s.x+=a.w/2,s.y-=a.h/2;break;case"ct":s.y+=a.h/2;break;case"cb":s.y-=a.h/2;break;case"rt":s.x-=a.w/2,s.y+=a.h/2;break;case"rm":s.x-=a.w/2;break;case"rb":s.x-=a.w/2,s.y-=a.h/2}return this.bsInfo.h=a.h,this.bsInfo.w=a.w,r=s.x-a.w/2,n=s.y+a.h/2,i=e.fontStyle&&"italic"===e.fontStyle?s.x+a.w/2+parseInt(parseFloat(e.fontSize)/2):s.x+a.w/2,o=s.y-a.h/2,new F(r,n,i,o)}},{key:"getLabelPxSize",value:function(t){var e,r,n,o,i=parseFloat(t.strokeWidth);e=t.label||this.text,r=t.fontSize?parseFloat(t.fontSize):parseFloat("12px");var a=e.split("\n"),s=a.length;o=s>1?r*s+s+i+.2*r:r+i+.2*r+1,n=0,this.labelWTmp&&n255?r++:n++;return e.cnC=r,e.enC=n,e.textC=t.length,e}}])&&Cr(e.prototype,r),n&&Cr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Ir(t,e){for(var r=0;r1&&(t=new q(e[0],e[1])),new Jt(t,this.attributes)}}])&&Fr(e.prototype,r),n&&Fr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Gr(t){"@babel/helpers - typeof";return(Gr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ur(t,e){for(var r=0;ri&&(i=t+s+100,n.width=i,r=!0),e+u>a&&(a=e+u+100,n.height=a,r=!0),t<-s&&(i+=s=100*Math.ceil(-t/100),n.width=i,r=!0),e<-u&&(a+=u=100*Math.ceil(-e/100),n.height=a,r=!0),r&&o.translate(s,u)}},{key:"getPixelOffset",value:function(){return{x:this._offsetX,y:this._offsetY}}},{key:"indexOf",value:function(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r3&&(e=Array.prototype.slice.call(e,1));for(var n=this._handlers[t],o=n.length,i=0;i4&&(e=Array.prototype.slice.call(e,1,e.length-1));for(var n=e[e.length-1],o=this._handlers[t],i=o.length,a=0;a-this.EPSILON&&tthis.EPSILON||t<-this.EPSILON}},{key:"cubicAt",value:function(t,e,r,n,o){var i=1-o;return i*i*(i*t+3*o*e)+o*o*(o*n+3*i*r)}},{key:"cubicDerivativeAt",value:function(t,e,r,n,o){var i=1-o;return 3*(((e-t)*i+2*(r-e)*o)*i+(n-r)*o*o)}},{key:"cubicRootAt",value:function(t,e,r,n,o,i){var a=n+3*(e-r)-t,s=3*(r-2*e+t),u=3*(e-t),l=t-o,c=s*s-3*a*u,f=s*u-9*a*l,h=u*u-3*s*l,p=0;if(this.isAroundZero(c)&&this.isAroundZero(f))if(this.isAroundZero(s))i[0]=0;else{var y=-u/s;y>=0&&y<=1&&(i[p++]=y)}else{var d=f*f-4*c*h;if(this.isAroundZero(d)){var b=f/c,v=-s/a+b,m=-b/2;v>=0&&v<=1&&(i[p++]=v),m>=0&&m<=1&&(i[p++]=m)}else if(d>0){var g=Math.sqrt(d),w=c*s+1.5*a*(-f+g),O=c*s+1.5*a*(-f-g),S=(-s-((w=w<0?-Math.pow(-w,this.ONE_THIRD):Math.pow(w,this.ONE_THIRD))+(O=O<0?-Math.pow(-O,this.ONE_THIRD):Math.pow(O,this.ONE_THIRD))))/(3*a);S>=0&&S<=1&&(i[p++]=S)}else{var _=(2*c*s-3*a*f)/(2*Math.sqrt(c*c*c)),P=Math.acos(_)/3,x=Math.sqrt(c),k=Math.cos(P),j=(-s-2*x*k)/(3*a),E=(-s+x*(k+this.THREE_SQRT*Math.sin(P)))/(3*a),T=(-s+x*(k-this.THREE_SQRT*Math.sin(P)))/(3*a);j>=0&&j<=1&&(i[p++]=j),E>=0&&E<=1&&(i[p++]=E),T>=0&&T<=1&&(i[p++]=T)}}return p}},{key:"cubicExtrema",value:function(t,e,r,n,o){var i=6*r-12*e+6*t,a=9*e+3*n-3*t-9*r,s=3*e-3*t,u=0;if(this.isAroundZero(a)){if(this.isNotAroundZero(i)){var l=-s/i;l>=0&&l<=1&&(o[u++]=l)}}else{var c=i*i-4*a*s;if(this.isAroundZero(c))o[0]=-i/(2*a);else if(c>0){var f=Math.sqrt(c),h=(-i+f)/(2*a),p=(-i-f)/(2*a);h>=0&&h<=1&&(o[u++]=h),p>=0&&p<=1&&(o[u++]=p)}}return u}},{key:"cubicSubdivide",value:function(t,e,r,n,o,i){var a=(e-t)*o+t,s=(r-e)*o+e,u=(n-r)*o+r,l=(s-a)*o+a,c=(u-s)*o+s,f=(c-l)*o+l;i[0]=t,i[1]=a,i[2]=l,i[3]=f,i[4]=f,i[5]=c,i[6]=u,i[7]=n}},{key:"cubicProjectPoint",value:function(t,e,r,n,o,i,a,s,u,l,c){var f,h=this.vector.create(),p=this.vector.create(),y=this.vector.create(),d=.005,b=1/0;h[0]=u,h[1]=l;for(var v=0;v<1;v+=.05){p[0]=this.cubicAt(t,r,o,a,v),p[1]=this.cubicAt(e,n,i,s,v);var m=this.vector.distSquare(h,p);m=0&&S=0&&l<=1&&(o[u++]=l)}}else{var c=a*a-4*i*s;if(this.isAroundZero(c)){var f=-a/(2*i);f>=0&&f<=1&&(o[u++]=f)}else if(c>0){var h=Math.sqrt(c),p=(-a+h)/(2*i),y=(-a-h)/(2*i);p>=0&&p<=1&&(o[u++]=p),y>=0&&y<=1&&(o[u++]=y)}}return u}},{key:"quadraticExtremum",value:function(t,e,r){var n=t+r-2*e;return 0===n?.5:(t-e)/n}},{key:"quadraticProjectPoint",value:function(t,e,r,n,o,i,a,s,u){var l,c=this.vector.create(),f=this.vector.create(),h=this.vector.create(),p=.005,y=1/0;c[0]=a,c[1]=s;for(var d=0;d<1;d+=.05){f[0]=this.quadraticAt(t,r,o,d),f[1]=this.quadraticAt(e,n,i,d);var b=this.vector.distSquare(c,f);b=0&&w0){for(var m=this.isInsidePolygon(e.pointList,b,v),g=t.holePolygonPointLists,w=!1,O=0,S=g.length;Oe+s&&a>n+s||at+s&&i>r+s||ie+f&&c>n+f&&c>i+f&&c>s+f||ct+f&&l>r+f&&l>o+f&&l>a+f||le+l&&u>n+l&&u>i+l||ut+l&&s>r+l&&s>o+l||sr||f+c=l)return!0;if(i){var h=n;n=this.normalizeRadian(o),o=this.normalizeRadian(h)}else n=this.normalizeRadian(n),o=this.normalizeRadian(o);n>o&&(o+=l);var p=Math.atan2(u,s);return p<0&&(p+=l),p>=n&&p<=o||p+l>=n&&p+l<=o}},{key:"isInsideBrokenLine",value:function(t,e,r,n){for(var o=Math.max(e,10),i=0,a=t.length-1;ir*r}},{key:"isInsideRect",value:function(t,e,r,n,o,i){return o>=t&&o<=t+r&&i>=e&&i<=e+n}},{key:"isInsideCircle",value:function(t,e,r,n,o){return(n-t)*(n-t)+(o-e)*(o-e)e&&i>n||io?ne&&l>n&&l>i&&l>s||l1&&this.swapExtrema(),y=c.cubicAt(e,n,i,s,h[0]),v>1&&(d=c.cubicAt(e,n,i,s,h[1]))),2==v?ge&&s>n&&s>i||s=0&&f<=1){for(var h=0,p=u.quadraticAt(e,n,i,f),y=0;ya||(l[y]a?0:ir||s<-r)return 0;var c=Math.sqrt(r*r-s*s);if(u[0]=-c,u[1]=c,Math.abs(n-o)>=l){n=0,o=l;var f=i?1:-1;return a>=u[0]+t&&a<=u[1]+t?f:0}if(i){var h=n;n=this.normalizeRadian(o),o=this.normalizeRadian(h)}else n=this.normalizeRadian(n),o=this.normalizeRadian(o);n>o&&(o+=l);for(var p=0,y=0;y<2;y++){var d=u[y];if(d+t>a){var b=Math.atan2(s,d),v=i?1:-1;b<0&&(b=l+b),(b>=n&&b<=o||b+l>=n&&b+l<=o)&&(b>Math.PI/2&&b<1.5*Math.PI&&(v=-v),p+=v)}}return p}},{key:"isInsidePath",value:function(t,e,r,n,o){for(var i=0,a=0,s=0,u=0,l=0,c=!0,f=!0,h="stroke"===(r=r||"fill")||"both"===r,p="fill"===r||"both"===r,y=0;y0&&(p&&(i+=this.windingLine(a,s,u,l,n,o)),0!==i))return!0;u=b[b.length-2],l=b[b.length-1],c=!1,f&&"A"!==d.command&&(f=!1,a=u,s=l)}switch(d.command){case"M":a=b[0],s=b[1];break;case"L":if(h&&this.isInsideLine(a,s,b[0],b[1],e,n,o))return!0;p&&(i+=this.windingLine(a,s,b[0],b[1],n,o)),a=b[0],s=b[1];break;case"C":if(h&&this.isInsideCubicStroke(a,s,b[0],b[1],b[2],b[3],b[4],b[5],e,n,o))return!0;p&&(i+=this.windingCubic(a,s,b[0],b[1],b[2],b[3],b[4],b[5],n,o)),a=b[4],s=b[5];break;case"Q":if(h&&this.isInsideQuadraticStroke(a,s,b[0],b[1],b[2],b[3],e,n,o))return!0;p&&(i+=this.windingQuadratic(a,s,b[0],b[1],b[2],b[3],n,o)),a=b[2],s=b[3];break;case"A":var v=b[0],m=b[1],g=b[2],w=b[3],O=b[4],S=b[5],_=Math.cos(O)*g+v,P=Math.sin(O)*w+m;f?(f=!1,u=_,l=P):i+=this.windingLine(a,s,_,P);var x=(n-v)*w/g+v;if(h&&this.isInsideArcStroke(v,m,w,O,O+S,1-b[7],e,x,o))return!0;p&&(i+=this.windingArc(v,m,w,O,O+S,1-b[7],x,o)),a=Math.cos(O+S)*g+v,s=Math.sin(O+S)*w+m;break;case"z":if(h&&this.isInsideLine(a,s,u,l,e,n,o))return!0;c=!0}}return p&&(i+=this.windingLine(a,s,u,l,n,o)),0!==i}},{key:"getTextWidth",value:function(t,e){var r=t+":"+e;if(this._textWidthCache[r])return this._textWidthCache[r];this._ctx=this._ctx||this.util.getContext(),this._ctx.save(),e&&(this._ctx.font=e);for(var n=0,o=0,i=(t=(t+"").split("\n")).length;othis.TEXT_CACHE_MAX&&(this._textWidthCacheCounter=0,this._textWidthCache={}),n}},{key:"getTextHeight",value:function(t,e){var r=t+":"+e;if(this._textHeightCache[r])return this._textHeightCache[r];this._ctx=this._ctx||this.util.getContext(),this._ctx.save(),e&&(this._ctx.font=e),t=(t+"").split("\n");var n=(this._ctx.measureText("ZH").width+2)*t.length;return this._ctx.restore(),this._textHeightCache[r]=n,++this._textHeightCacheCounter>this.TEXT_CACHE_MAX&&(this._textHeightCacheCounter=0,this._textHeightCache={}),n}}])&&Qr(e.prototype,r),n&&Qr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Zr(t,e){for(var r=0;r1)for(var o=0,i=n-1;o1?Math.ceil(t):t}),e.indexOf("hex")>-1)return"#"+((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1);if(e.indexOf("hs")>-1){var r=this.map(t.slice(1,3),function(t){return t+"%"});t[1]=r[0],t[2]=r[1]}return e.indexOf("a")>-1?(3===t.length&&t.push(1),t[3]=this.adjust(t[3],[0,1]),e+"("+t.slice(0,4).join(",")+")"):e+"("+t.slice(0,3).join(",")+")"}}},{key:"toArray",value:function(t){(t=this.trim(t)).indexOf("rgba")<0&&(t=this.toRGBA(t));var e=[],r=0;return t.replace(/[\d.]+/g,function(t){r<3?t|=0:t=+t,e[r++]=t}),e}},{key:"convert",value:function(t,e){if(!this.isCalculableColor(t))return t;var r=this.getData(t),n=r[3];return void 0===n&&(n=1),t.indexOf("hsb")>-1?r=this._HSV_2_RGB(r):t.indexOf("hsl")>-1&&(r=this._HSL_2_RGB(r)),e.indexOf("hsb")>-1||e.indexOf("hsv")>-1?r=this._RGB_2_HSB(r):e.indexOf("hsl")>-1&&(r=this._RGB_2_HSL(r)),r[3]=n,this.toColor(r,e)}},{key:"toRGBA",value:function(t){return this.convert(t,"rgba")}},{key:"toRGB",value:function(t){return this.convert(t,"rgb")}},{key:"toHex",value:function(t){return this.convert(t,"hex")}},{key:"toHSVA",value:function(t){return this.convert(t,"hsva")}},{key:"toHSV",value:function(t){return this.convert(t,"hsv")}},{key:"toHSBA",value:function(t){return this.convert(t,"hsba")}},{key:"toHSB",value:function(t){return this.convert(t,"hsb")}},{key:"toHSLA",value:function(t){return this.convert(t,"hsla")}},{key:"toHSL",value:function(t){return this.convert(t,"hsl")}},{key:"toName",value:function(t){for(var e in this._nameColors)if(this.toHex(this._nameColors[e])===this.toHex(t))return e;return null}},{key:"trim",value:function(t){return String(t).replace(/\s+/g,"")}},{key:"normalize",value:function(t){if(this._nameColors[t]&&(t=this._nameColors[t]),t=(t=this.trim(t)).replace(/hsv/i,"hsb"),/^#[\da-f]{3}$/i.test(t)){var e=(3840&(t=parseInt(t.slice(1),16)))<<8,r=(240&t)<<4,n=15&t;t="#"+((1<<24)+(e<<4)+e+(r<<4)+r+(n<<4)+n).toString(16).slice(1)}return t}},{key:"lift",value:function(t,e){if(!this.isCalculableColor(t))return t;var r=e>0?1:-1;void 0===e&&(e=0),e=Math.abs(e)>1?1:Math.abs(e),t=this.toRGB(t);for(var n=this.getData(t),o=0;o<3;o++)n[o]=1===r?n[o]*(1-e)|0:(255-n[o])*e+n[o]|0;return"rgb("+n.join(",")+")"}},{key:"reverse",value:function(t){if(!this.isCalculableColor(t))return t;var e=this.getData(this.toRGBA(t));return e=this.map(e,function(t){return 255-t}),this.toColor(e,"rgb")}},{key:"mix",value:function(t,e,r){if(!this.isCalculableColor(t)||!this.isCalculableColor(e))return t;void 0===r&&(r=.5);for(var n=2*(r=1-this.adjust(r,[0,1]))-1,o=this.getData(this.toRGBA(t)),i=this.getData(this.toRGBA(e)),a=o[3]-i[3],s=((n*a==-1?n:(n+a)/(1+n*a))+1)/2,u=1-s,l=[],c=0;c<3;c++)l[c]=o[c]*s+i[c]*u;var f=o[3]*r+i[3]*(1-r);return f=Math.max(0,Math.min(1,f)),1===o[3]&&1===i[3]?this.toColor(l,"rgb"):(l[3]=f,this.toColor(l,"rgba"))}},{key:"random",value:function(){return"#"+Math.random().toString(16).slice(2,8)}},{key:"getData",value:function(e){var r,n,o=(e=this.normalize(e)).match(this.colorRegExp);if(null===o)throw new Error("The color format error");var i,a=[];if(o[2])i=[(r=o[2].replace("#","").split(""))[0]+r[1],r[2]+r[3],r[4]+r[5]],a=this.map(i,function(e){return t.prototype.adjust.call(this,parseInt(e,16),[0,255])});else if(o[4]){var s=o[4].split(",");n=s[3],i=s.slice(0,3),a=this.map(i,function(e){return e=Math.floor(e.indexOf("%")>0?2.55*parseInt(e,0):e),t.prototype.adjust.call(this,e,[0,255])}),void 0!==n&&a.push(this.adjust(parseFloat(n),[0,1]))}else if(o[5]||o[6]){var u=(o[5]||o[6]).split(","),l=parseInt(u[0],0)/360,c=u[1],f=u[2];n=u[3],(a=this.map([c,f],function(e){return t.prototype.adjust.call(this,parseFloat(e)/100,[0,1])})).unshift(l),void 0!==n&&a.push(this.adjust(parseFloat(n),[0,1]))}return a}},{key:"alpha",value:function(t,e){if(!this.isCalculableColor(t))return t;null===e&&(e=1);var r=this.getData(this.toRGBA(t));return r[3]=this.adjust(Number(e).toFixed(4),[0,1]),this.toColor(r,"rgba")}},{key:"map",value:function(t,e){if("function"!=typeof e)throw new TypeError;for(var r=t?t.length:0,n=0;n=e[1]&&(t=e[1]),t}},{key:"isCalculableColor",value:function(t){return t instanceof Array||"string"==typeof t}},{key:"_HSV_2_RGB",value:function(t){var e,r,n,o=t[0],i=t[1],a=t[2];if(0===i)e=255*a,r=255*a,n=255*a;else{var s=6*o;6===s&&(s=0);var u=0|s,l=a*(1-i),c=a*(1-i*(s-u)),f=a*(1-i*(1-(s-u))),h=0,p=0,y=0;0===u?(h=a,p=f,y=l):1===u?(h=c,p=a,y=l):2===u?(h=l,p=a,y=f):3===u?(h=l,p=c,y=a):4===u?(h=f,p=l,y=a):(h=a,p=l,y=c),e=255*h,r=255*p,n=255*y}return[e,r,n]}},{key:"_HSL_2_RGB",value:function(t){var e,r,n,o=t[0],i=t[1],a=t[2];if(0===i)e=255*a,r=255*a,n=255*a;else{var s,u=2*a-(s=a<.5?a*(1+i):a+i-i*a);e=255*this._HUE_2_RGB(u,s,o+1/3),r=255*this._HUE_2_RGB(u,s,o),n=255*this._HUE_2_RGB(u,s,o-1/3)}return[e,r,n]}},{key:"_HUE_2_RGB",value:function(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),6*r<1?t+6*(e-t)*r:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}},{key:"_RGB_2_HSB",value:function(t){var e,r,n=t[0]/255,o=t[1]/255,i=t[2]/255,a=Math.min(n,o,i),s=Math.max(n,o,i),u=s-a,l=s;if(0===u)e=0,r=0;else{r=u/s;var c=((s-n)/6+u/2)/u,f=((s-o)/6+u/2)/u,h=((s-i)/6+u/2)/u;n===s?e=h-f:o===s?e=1/3+c-h:i===s&&(e=2/3+f-c),e<0&&(e+=1),e>1&&(e-=1)}return[e*=360,r*=100,l*=100]}},{key:"_RGB_2_HSL",value:function(t){var e,r,n=t[0]/255,o=t[1]/255,i=t[2]/255,a=Math.min(n,o,i),s=Math.max(n,o,i),u=s-a,l=(s+a)/2;if(0===u)e=0,r=0;else{r=l<.5?u/(s+a):u/(2-s-a);var c=((s-n)/6+u/2)/u,f=((s-o)/6+u/2)/u,h=((s-i)/6+u/2)/u;n===s?e=h-f:o===s?e=1/3+c-h:i===s&&(e=2/3+f-c),e<0&&(e+=1),e>1&&(e-=1)}return[e*=360,r*=100,l*=100]}}])&&Zr(e.prototype,r),n&&Zr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function $r(t,e){for(var r=0;ro&&(o=u[0]),u[1]a&&(a=u[1])}e[0]=n,e[1]=i,r[0]=o,r[1]=a}}},{key:"cubeBezier",value:function(t,e,r,n,o,i){var a=new Yr,s=[];a.cubicExtrema(t[0],e[0],r[0],n[0],s);for(var u=0;uo&&!i?o+=2*Math.PI:nn&&(f[0]=Math.cos(p)*r+t,f[1]=Math.sin(p)*r+e,u.min(a,f,a),u.max(s,f,s))}}])&&$r(e.prototype,r),n&&$r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function en(t,e){for(var r=0;r=200&&o.status<300||304===o.status?e&&e(o.responseText):r&&r(),o.onreadystatechange=new Function,o=null)},o.send(null)}}])&&sn(e.prototype,r),n&&sn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ln(t,e){for(var r=0;r1)for(var e in arguments)console.log(arguments[e])}}var e,r,n;return e=t,(r=[{key:"destory",value:function(){return!0}}])&&fn(e.prototype,r),n&&fn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function pn(t,e){for(var r=0;ra-2?a-1:p+1][0]+i[0],e[p>a-2?a-1:p+1][1]+i[1]],m=[e[p>a-3?a-1:p+2][0]+i[0],e[p>a-3?a-1:p+2][1]+i[1]]);var g=y*y,w=y*g;s.push([O(d[0],b[0],v[0],m[0],y,g,w),O(d[1],b[1],v[1],m[1],y,g,w)])}return s;function O(t,e,r,n,o,i,a){var s=.5*(r-t),u=.5*(n-e);return(2*(e-r)+s+u)*a+(-3*(e-r)-2*s-u)*i+s*o+e}}},{key:"SUtil_dashedLineTo",value:function(t,e,r,n,o,i,a){var s=[5,5];if(i="number"!=typeof i?5:i,t.setLineDash)return s[0]=i,s[1]=i,a&&a instanceof Array?t.setLineDash(a):t.setLineDash(s),t.moveTo(e,r),void t.lineTo(n,o);var u=n-e,l=o-r,c=Math.floor(Math.sqrt(u*u+l*l)/i);u/=c,l/=c;for(var f=!0,h=0;h-5e-5&&t<5e-5}mn.Util_vector.sub(e,t,this.position),n(e[0])&&n(e[1])||(mn.Util_vector.normalize(e,e),r[2]=e[0]*this.scale[1],r[3]=e[1]*this.scale[1],r[0]=e[1]*this.scale[0],r[1]=-e[0]*this.scale[0],r[4]=this.position[0],r[5]=this.position[1],this.decomposeTransform())})}var e,r,n;return e=t,(r=[{key:"destroy",value:function(){this.position=null,this.rotation=null,this.scale=null,this.needLocalTransform=null,this.needTransform=null}},{key:"updateNeedTransform",value:function(){function t(t){return t>5e-5||t<-5e-5}this.needLocalTransform=t(this.rotation[0])||t(this.position[0])||t(this.position[1])||t(this.scale[0]-1)||t(this.scale[1]-1)}},{key:"updateTransform",value:function(){if(this.updateNeedTransform(),this.parent?this.needTransform=this.needLocalTransform||this.parent.needTransform:this.needTransform=this.needLocalTransform,this.needTransform){var t=[0,0],e=this.transform||mn.Util_matrix.create();if(mn.Util_matrix.identity(e),this.needLocalTransform){if(o(this.scale[0])||o(this.scale[1])){t[0]=-this.scale[2]||0,t[1]=-this.scale[3]||0;var r=o(t[0])||o(t[1]);r&&mn.Util_matrix.translate(e,e,t),mn.Util_matrix.scale(e,e,this.scale),r&&(t[0]=-t[0],t[1]=-t[1],mn.Util_matrix.translate(e,e,t))}if(this.rotation instanceof Array){if(0!==this.rotation[0]){t[0]=-this.rotation[1]||0,t[1]=-this.rotation[2]||0;var n=o(t[0])||o(t[1]);n&&mn.Util_matrix.translate(e,e,t),mn.Util_matrix.rotate(e,e,this.rotation[0]),n&&(t[0]=-t[0],t[1]=-t[1],mn.Util_matrix.translate(e,e,t))}}else 0!=+this.rotation&&mn.Util_matrix.rotate(e,e,this.rotation);(o(this.position[0])||o(this.position[1]))&&mn.Util_matrix.translate(e,e,this.position)}this.transform=e,this.parent&&this.parent.needTransform&&(this.needLocalTransform?mn.Util_matrix.mul(this.transform,this.parent.transform,this.transform):mn.Util_matrix.copy(this.transform,this.parent.transform))}function o(t){return t>5e-5||t<-5e-5}}},{key:"setTransform",value:function(t){if(this.needTransform){var e=this.transform;t.transform(e[0],e[1],e[2],e[3],e[4],e[5])}}},{key:"decomposeTransform",value:function(){if(this.transform){var t=this.transform,e=t[0]*t[0]+t[1]*t[1],r=this.position,n=this.scale,o=this.rotation;a(e-1)&&(e=Math.sqrt(e));var i=t[2]*t[2]+t[3]*t[3];a(i-1)&&(i=Math.sqrt(i)),r[0]=t[4],r[1]=t[5],n[0]=e,n[1]=i,n[2]=n[3]=0,o[0]=Math.atan2(-t[1]/i,t[0]/e),o[1]=o[2]=0}function a(t){return t>5e-5||t<-5e-5}}}])&&gn(e.prototype,r),n&&gn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function On(t){"@babel/helpers - typeof";return(On="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Sn(t,e){for(var r=0;r0}},{key:"addRoot",value:function(t){t instanceof En&&t.addChildrenToStorage(this),this.addToMap(t),this._roots.push(t)}},{key:"delRoot",value:function(t){if(void 0===t){for(var e=0;e=0&&(this.delFromMap(i.id),this._roots.splice(a,1),i instanceof En&&i.delChildrenFromStorage(this))}}},{key:"addToMap",value:function(t){return t instanceof En&&(t._storage=this),t.modSelf(),this._elements[t.id]=t,this}},{key:"get",value:function(t){return this._elements[t]}},{key:"delFromMap",value:function(t){var e=this._elements[t];return e&&(delete this._elements[t],e instanceof En&&(e._storage=null)),this}},{key:"dispose",value:function(){this._elements=null,this._roots=null,this._hoverElements=null}}])&&Tn(e.prototype,r),n&&Tn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Rn(t){"@babel/helpers - typeof";return(Rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function An(t,e){for(var r=0;r1},isLeftClick:function(t){return t.which&&1===t.which||t.button&&1===t.button},isRightClick:function(t){return t.which&&3===t.which||t.button&&2===t.button},stop:function(t,e){e||(t.preventDefault?t.preventDefault():t.returnValue=!1),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},findElement:function(t,e){for(var r=Gn.element(t);r.parentNode&&(!r.tagName||r.tagName.toUpperCase()!=e.toUpperCase());)r=r.parentNode;return r},observe:function(t,e,r,n){var o=A.getElement(t);if(n=n||!1,"keypress"===e&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||o.attachEvent)&&(e="keydown"),this.observers||(this.observers={}),!o._eventCacheID){var i="eventCacheID_";o.id&&(i=o.id+"_"+i),o._eventCacheID=A.createUniqueID(i)}var a=o._eventCacheID;this.observers[a]||(this.observers[a]=[]),this.observers[a].push({element:o,name:e,observer:r,useCapture:n}),o.addEventListener?"mousewheel"===e?o.addEventListener(e,r,{useCapture:n,passive:!1}):o.addEventListener(e,r,n):o.attachEvent&&o.attachEvent("on"+e,r)},stopObservingElement:function(t){var e=A.getElement(t)._eventCacheID;this._removeElementObservers(Gn.observers[e])},_removeElementObservers:function(t){if(t)for(var e=t.length-1;e>=0;e--){var r=t[e],n=new Array(r.element,r.name,r.observer,r.useCapture);Gn.stopObserving.apply(this,n)}},stopObserving:function(t,e,r,n){n=n||!1;var o=A.getElement(t),i=o._eventCacheID;"keypress"===e&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||o.detachEvent)&&(e="keydown");var a=!1,s=Gn.observers[i];if(s)for(var u=0;!a&&u0&&(this.setCtxGlobalAlpha(t,"stroke",r),t.stroke()),this.setCtxGlobalAlpha(t,"reset",r);break;case"stroke":this.setCtxGlobalAlpha(t,"stroke",r),r.lineWidth>0&&t.stroke(),this.setCtxGlobalAlpha(t,"reset",r);break;default:this.setCtxGlobalAlpha(t,"fill",r),t.fill(),this.setCtxGlobalAlpha(t,"reset",r)}this.drawText(t,r,this.style),this.afterBrush(t)}},{key:"beforeBrush",value:function(t,e){var r=this.style;return this.brushTypeOnly&&(r.brushType=this.brushTypeOnly),e&&(r=this.getHighlightStyle(r,this.highlightStyle||{},this.brushTypeOnly)),"stroke"==this.brushTypeOnly&&(r.strokeColor=r.strokeColor||r.color),t.save(),this.doClip(t),this.setContext(t,r),this.setTransform(t),r}},{key:"afterBrush",value:function(t){t.restore()}},{key:"setContext",value:function(t,e){for(var r=[["color","fillStyle"],["strokeColor","strokeStyle"],["opacity","globalAlpha"],["lineCap","lineCap"],["lineJoin","lineJoin"],["miterLimit","miterLimit"],["lineWidth","lineWidth"],["shadowBlur","shadowBlur"],["shadowColor","shadowColor"],["shadowOffsetX","shadowOffsetX"],["shadowOffsetY","shadowOffsetY"]],n=0,o=r.length;n=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height&&mn.Util_area.isInside(this,this.style,t,e)}},{key:"drawText",value:function(t,e,r){if(void 0!==e.text&&!1!==e.text){var n=e.textColor||e.color||e.strokeColor;t.fillStyle=n;var o,a,s,u,l=10,c=e.textPosition||this.textPosition||"top",f=[];switch(f=this.refOriginalPosition&&2===this.refOriginalPosition.length?this.refOriginalPosition:[0,0],c){case"inside":case"top":case"bottom":case"left":case"right":if(this.getRect){var h=(r||e).__rect||this.getRect(r||e);switch(c){case"inside":s=h.x+h.width/2,u=h.y+h.height/2,o="center",a="middle","stroke"!=e.brushType&&n==e.color&&(t.fillStyle="#fff");break;case"left":s=h.x-l,u=h.y+h.height/2,o="end",a="middle";break;case"right":s=h.x+h.width+l,u=h.y+h.height/2,o="start",a="middle";break;case"top":s=h.x+h.width/2,u=h.y-l,o="center",a="bottom";break;case"bottom":s=h.x+h.width/2,u=h.y+h.height+l,o="center",a="top"}}break;case"start":case"end":var p=0,y=0,d=0,b=0;if(void 0!==e.pointList){var v=e.pointList;if(v.length<2)return;var m=v.length;switch(c){case"start":p=v[0][0]+f[0],y=v[1][0]+f[0],d=v[0][1]+f[1],b=v[1][1]+f[1];break;case"end":p=v[m-2][0]+f[0],y=v[m-1][0]+f[0],d=v[m-2][1]+f[1],b=v[m-1][1]+f[1]}}else p=e.xStart+f[0]||0,y=e.xEnd+f[0]||0,d=e.yStart+f[1]||0,b=e.yEnd+f[1]||0;switch(c){case"start":o=p0&&t>this._zlevelList[0]){for(o=0;ot);o++);n=this._layers[this._zlevelList[o]]}this._zlevelList.splice(o+1,0,t),e=new Oo(A.createUniqueID("_levelLayer_"+t),this);var i=n?n.dom:this._bgDom;i.nextSibling?i.parentNode.insertBefore(e.dom,i.nextSibling):i.parentNode.appendChild(e.dom),e.initContext(),this._layers[t]=e,this._layerConfig[t]&&(new zr).merge(e,this._layerConfig[t],!0),e.updateTransform()}return e}},{key:"getLayers",value:function(){return this._layers}},{key:"_updateLayerStatus",value:function(t){var e=this._layers,r={};for(var n in e)"hover"!==n&&(r[n]=e[n].elCount,e[n].elCount=0);for(var o=0;o0?1.1:1/1.1,r=this.painter.getLayers(),n=!1;for(var o in r)if("hover"!==o){var i=r[o],a=i.position;if(i.zoomable){i.__zoom=i.__zoom||1;var s=i.__zoom;s*=e,e=(s=Math.max(Math.min(i.maxZoom,s),i.minZoom))/i.__zoom,i.__zoom=s,a[0]-=(this._mouseX-a[0])*(e-1),a[1]-=(this._mouseY-a[1])*(e-1),i.scale[0]*=e,i.scale[1]*=e,i.dirty=!0,n=!0}}n&&this.painter.refresh(),this._dispatchAgency(this._lastHover,cn.EVENT.MOUSEWHEEL,t),this._mousemoveHandler(t)},mousemove:function(t){this._clickThreshold++,t=this._zrenderEventFixed(t),this._lastX=this._mouseX,this._lastY=this._mouseY,this._mouseX=mn.Util_event.getX(t),this._mouseY=mn.Util_event.getY(t);var e=this._mouseX-this._lastX,r=this._mouseY-this._lastY;this._processDragStart(t),this._hasfound=0,this._event=t,this._iterateAndFindHover(),this._hasfound||((!this._draggingTarget||this._lastHover&&this._lastHover!=this._draggingTarget)&&(this._processOutShape(t),this._processDragLeave(t)),this._lastHover=null,this.storage.delHover(),this.painter.clearHover());var n="";if(this._draggingTarget)this.storage.drift(this._draggingTarget.id,e,r),this._draggingTarget.modSelf(),this.storage.addHover(this._draggingTarget);else if(this._isMouseDown){var o=this.painter.getLayers(),i=!1;for(var a in o)if("hover"!==a){var s=o[a];s.panable&&(n="move",s.position[0]+=e,s.position[1]+=r,i=!0,s.dirty=!0)}i&&this.painter.refresh()}this._draggingTarget||this._hasfound&&this._lastHover.draggable?n="move":this._hasfound&&this._lastHover.clickable&&(n="pointer"),this.root.style.cursor=n,this._dispatchAgency(this._lastHover,cn.EVENT.MOUSEMOVE,t),(this._draggingTarget||this._hasfound||this.storage.hasHoverShape())&&this.painter.refreshHover()},mouseout:function(t){var e=(t=this._zrenderEventFixed(t)).toElement||t.relatedTarget;if(e!=this.root)for(;e&&9!=e.nodeType;){if(e==this.root)return void this._mousemoveHandler(t);e=e.parentNode}t.zrenderX=this._lastX,t.zrenderY=this._lastY,this.root.style.cursor="",this._isMouseDown=0,this._processOutShape(t),this._processDrop(t),this._processDragEnd(t),this.painter.refreshHover(),this.dispatch(cn.EVENT.GLOBALOUT,t)},mousedown:function(t){if(this._clickThreshold=0,2==this._lastDownButton)return this._lastDownButton=t.button,void(this._mouseDownTarget=null);this._lastMouseDownMoment=new Date,t=this._zrenderEventFixed(t),this._isMouseDown=1,this._mouseDownTarget=this._lastHover,this._dispatchAgency(this._lastHover,cn.EVENT.MOUSEDOWN,t),this._lastDownButton=t.button},mouseup:function(t){t=this._zrenderEventFixed(t),this.root.style.cursor="",this._isMouseDown=0,this._mouseDownTarget=null,this._dispatchAgency(this._lastHover,cn.EVENT.MOUSEUP,t),this._processDrop(t),this._processDragEnd(t)},touchstart:function(t){t=this._zrenderEventFixed(t,!0),this._lastTouchMoment=new Date,this._mobildFindFixed(t),this._mousedownHandler(t)},touchmove:function(t){t=this._zrenderEventFixed(t,!0),this._mousemoveHandler(t),this._isDragging&&mn.Util_event.stop(t)},touchend:function(t){t=this._zrenderEventFixed(t,!0),this._mouseupHandler(t);var e=new Date;e-this._lastTouchMoment=0;o--){var i=r[o];if(void 0!==i.zlevel&&(t=this.painter.getLayer(i.zlevel,t),n[0]=this._mouseX,n[1]=this._mouseY,t.needTransform&&(mn.Util_matrix.invert(e,t.transform),mn.Util_vector.applyTransform(n,n,e))),this._findHover(i,n[0],n[1]))break}}},{key:"_mobildFindFixed",value:function(t){var e=[{x:10},{x:-20},{x:10,y:10},{y:-20}];this._lastHover=null,this._mouseX=t.zrenderX,this._mouseY=t.zrenderY,this._event=t,this._iterateAndFindHover();for(var r=0;!this._lastHover&&r=0&&this._clips.splice(e,1)}},{key:"_update",value:function(){for(var t=(new Date).getTime(),e=t-this._time,r=this._clips,n=r.length,o=[],i=[],a=0;a=0&&!(d[w]<=a);w--);w=Math.min(w,l-2)}else{for(w=k;wa);w++);w=Math.min(w-1,l-2)}k=w,j=a;var s=d[w+1]-d[w];if(0!==s){var c,y;for(O=(a-d[w])/s,i?(_=b[w],S=b[0===w?w:w-1],P=b[w>l-2?l-1:w+1],x=b[w>l-3?l-1:w+2],f?Uo._catmullRomInterpolateArray(S,_,P,x,O,O*O,O*O*O,n(t,u),p):(c=h?Uo.rgba2String(E):Uo._catmullRomInterpolate(S,_,P,x,O,O*O,O*O*O),r(t,u,c))):f?Uo._interpolateArray(b[w],b[w+1],O,n(t,u),p):(h?(Uo._interpolateArray(b[w],b[w+1],O,E,1),y=Uo.rgba2String(E)):y=Uo._interpolateNumber(b[w],b[w+1],O),r(t,u,y)),w=0;w=0;e--)t[e].destroy()}}},{key:"setVisibility",value:function(t){t!==this.visibility&&(this.visibility=t,this.display(t),this.redrawThematicFeatures(this.map.getBounds()))}},{key:"display",value:function(t){this.div.style.display=t?"block":"none"}},{key:"setOpacity",value:function(t){if(t!==this.opacity){this.opacity=t;var e=this.div;A.modifyDOMElement(e,null,null,null,null,null,null,t),null!==this.map&&o().Evented.prototype.fire("changelayer",{layer:this,property:"opacity"})}}},{key:"addFeatures",value:function(t){}},{key:"removeFeatures",value:function(t){var e=this;if(t){if(t===e.features)return e.removeAllFeatures();A.isArray(t)||"function"==typeof t||(t=[t]);for(var r=[],n=0;n=r.left&&a.x<=r.right&&a.y>=r.top&&a.y<=r.bottom){n=!0;break}}return n}},{key:"clearCache",value:function(){this.cache={},this.charts=[]}},{key:"removeFeatures",value:function(t){this.clearCache(),$o(ri(a.prototype),"removeFeatures",this).call(this,t)}},{key:"removeAllFeatures",value:function(){this.clearCache(),$o(ri(a.prototype),"removeAllFeatures",this).call(this)}},{key:"redraw",value:function(){return this.clearCache(),!!this.renderer&&(this.redrawThematicFeatures(this.map.getBounds()),!0)}},{key:"clear",value:function(){this.renderer&&(this.renderer.clearAll(),this.renderer.refresh()),this.removeAllFeatures(),this.clearCache()}}])&&Ko(e.prototype,r),n&&Ko(e,n),Object.defineProperty(e,"prototype",{writable:!1}),a}();function oi(t,e){for(var r=0;rn&&(n=u[0]),u[1]o&&(o=u[1]))}return t.__rect={x:e,y:r,width:n-e,height:o-r},t.__rect}},{key:"getRectNoRotation",value:function(t){this.refOriginalPosition&&2===this.refOriginalPosition.length||(this.refOriginalPosition=[0,0]);var e,r=this.refOriginalPosition,n=mn.Util_area.getTextHeight("ZH",t.textFont),o=mn.Util_area.getTextWidth(t.text,t.textFont),i=mn.Util_area.getTextHeight(t.text,t.textFont),a=t.x+r[0];"end"==t.textAlign||"right"==t.textAlign?a-=o:"center"==t.textAlign&&(a-=o/2),e="top"==t.textBaseline?t.y+r[1]:"bottom"==t.textBaseline?t.y+r[1]-i:t.y+r[1]-i/2;var s,u=!1;if(t.maxWidth){var l=parseInt(t.maxWidth);l-1&&(o+=!0===u?n/3*(o/s):n/3));return{x:a,y:e,width:o,height:i}}},{key:"getTextBackground",value:function(t,e){this.refOriginalPosition&&2===this.refOriginalPosition.length||(this.refOriginalPosition=[0,0]);var r=this.refOriginalPosition;if(!e&&t.__textBackground)return t.__textBackground;var n=this.getRectNoRotation(t),o=t.x+r[0],i=t.y+r[1],a=[];if(t.textRotation&&0!==t.textRotation){var s=t.textRotation,u=this.getRotatedLocation(n.x,n.y,o,i,s),l=this.getRotatedLocation(n.x+n.width,n.y,o,i,s),c=this.getRotatedLocation(n.x+n.width,n.y+n.height,o,i,s),f=this.getRotatedLocation(n.x,n.y+n.height,o,i,s);a.push(u),a.push(l),a.push(c),a.push(f)}else{var h=[n.x,n.y],p=[n.x+n.width,n.y],y=[n.x+n.width,n.y+n.height],d=[n.x,n.y+n.height];a.push(h),a.push(p),a.push(y),a.push(d)}return t.__textBackground=a,t.__textBackground}},{key:"getRotatedLocation",value:function(t,e,r,n,o){var i,a,s=new Array;return e=-e,n=-n,o=-o,i=(t-r)*Math.cos(o/180*Math.PI)-(e-n)*Math.sin(o/180*Math.PI)+r,a=(t-r)*Math.sin(o/180*Math.PI)+(e-n)*Math.cos(o/180*Math.PI)+n,s[0]=i,s[1]=-a,s}}])&&ba(e.prototype,r),n&&ba(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Sa(t){"@babel/helpers - typeof";return(Sa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _a(t,e){for(var r=0;r0&&("stroke"==r.brushType||"both"==r.brushType)&&(n||(t.beginPath(),this.buildPath(t,r)),this.setCtxGlobalAlpha(t,"stroke",r),t.stroke(),this.setCtxGlobalAlpha(t,"reset",r)),this.drawText(t,r,this.style);var o=A.cloneObject(r);if(o.pointList&&this.holePolygonPointLists&&this.holePolygonPointLists.length>0)for(var i=this.holePolygonPointLists,a=i.length,s=0;s0&&("stroke"==o.brushType||"both"==o.brushType)?(n||(t.beginPath(),this.buildPath(t,o)),t.globalCompositeOperation="source-over",this.setCtxGlobalAlpha(t,"stroke",o),t.stroke(),this.setCtxGlobalAlpha(t,"reset",o)):t.globalCompositeOperation="source-over"}t.restore()}},{key:"buildPath",value:function(t,e){e.showShadow&&(t.shadowBlur=e.shadowBlur,t.shadowColor=e.shadowColor,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY),this.refOriginalPosition&&2===this.refOriginalPosition.length||(this.refOriginalPosition=[0,0]);var r=this.refOriginalPosition,n=e.pointList;if(!(n.length<2))if(e.smooth&&"spline"!==e.smooth){var o,i,a,s=mn.SUtil_smoothBezier(n,e.smooth,!0,e.smoothConstraint,r);t.moveTo(n[0][0]+r[0],n[0][1]+r[1]);for(var u=n.length,l=0;li&&(i=u[l][0]+r[0]),u[l][1]+r[1]s&&(s=u[l][1]+r[1]);return n="stroke"==t.brushType||"fill"==t.brushType?t.lineWidth||1:0,t.__rect={x:Math.round(o-n/2),y:Math.round(a-n/2),width:i-o+n,height:s-a+n},t.__rect}}])&&Ca(e.prototype,r),n&&Ca(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Ia(t){"@babel/helpers - typeof";return(Ia="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Da(t,e){for(var r=0;rc&&(r*=c/(a=r+n),n*=c/a),o+i>c&&(o*=c/(a=o+i),i*=c/a),n+o>f&&(n*=f/(a=n+o),o*=f/a),r+i>f&&(r*=f/(a=r+i),i*=f/a),t.moveTo(u+r,l),t.lineTo(u+c-n,l),0!==n&&t.quadraticCurveTo(u+c,l,u+c,l+n),t.lineTo(u+c,l+f-o),0!==o&&t.quadraticCurveTo(u+c,l+f,u+c-o,l+f),t.lineTo(u+i,l+f),0!==i&&t.quadraticCurveTo(u,l+f,u,l+f-i),t.lineTo(u,l+r),0!==r&&t.quadraticCurveTo(u,l,u+r,l)}},{key:"buildPath",value:function(t,e){this.refOriginalPosition&&2===this.refOriginalPosition.length||(this.refOriginalPosition=[0,0]);var r=this.refOriginalPosition;e.radius?this._buildRadiusPath(t,e):(t.moveTo(e.x+r[0],e.y+r[1]),t.lineTo(e.x+r[0]+e.width,e.y+r[1]),t.lineTo(e.x+r[0]+e.width,e.y+r[1]+e.height),t.lineTo(e.x+r[0],e.y+r[1]+e.height),t.lineTo(e.x+r[0],e.y+r[1])),t.closePath()}},{key:"getRect",value:function(t){this.refOriginalPosition&&2===this.refOriginalPosition.length||(this.refOriginalPosition=[0,0]);var e,r=this.refOriginalPosition;return t.__rect?t.__rect:(e="stroke"==t.brushType||"fill"==t.brushType?t.lineWidth||1:0,t.__rect={x:Math.round(t.x+r[0]-e/2),y:Math.round(t.y+r[1]-e/2),width:t.width+e,height:t.height+e},t.__rect)}}])&&Va(e.prototype,r),n&&Va(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Xa(t){"@babel/helpers - typeof";return(Xa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Za(t,e){for(var r=0;r1?mn.Util_computeBoundingBox.arc(a,s,u,c,f,!h,r,o):(r[0]=o[0]=a,r[1]=o[1]=s),mn.Util_computeBoundingBox.arc(a,s,l,c,f,!h,n,i),mn.Util_vector.min(r,r,n),mn.Util_vector.max(o,o,i),t.__rect={x:r[0],y:r[1],width:o[0]-r[0],height:o[1]-r[1]},t.__rect}}])&&Za(e.prototype,r),n&&Za(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function ns(t,e){for(var r=0;r=15){var h=parseInt(i.axis3DParameter),p=[o[0]-h,o[1]+h];i.axisUseArrow?(c.push([p[0]+1.5,p[1]-7.5]),c.push([p[0]-1,p[1]+1]),c.push([p[0]+7.5,p[1]-1.5]),f.push([p[0],p[1]])):f.push([p[0],p[1]]),f.push([o[0],o[1]])}f.push([o[2]+5,o[1]])}else{var y=Math.abs(o[1]-o[3])/l,d=o[3];f.push([o[0],d-5]);for(var b=0;b=15){var m=parseInt(i.axis3DParameter),g=[o[0]-m,o[1]+m];i.axisUseArrow?(c.push([g[0]+1.5,g[1]-7.5]),c.push([g[0]-1,g[1]+1]),c.push([g[0]+7.5,g[1]-1.5]),f.push([g[0],g[1]])):f.push([g[0],g[1]]),f.push([o[0],o[1]])}f.push([o[2]+5,o[1]])}if(i.axisUseArrow){var w=[[o[2]+5,o[1]+4],[o[2]+13,o[1]],[o[2]+5,o[1]-4]],O=[[o[0]-4,o[3]-5],[o[0],o[3]-13],[o[0]+4,o[3]-5]],S=new ki(w);S.style={fillColor:"#008acd"},A.copyAttributesWithClip(S.style,i.axisStyle),s.push(t.createShape(S));var _=new ki(O);if(_.style={fillColor:"#008acd"},A.copyAttributesWithClip(_.style,i.axisStyle),s.push(t.createShape(_)),i.axis3DParameter&&!isNaN(i.axis3DParameter)&&i.axis3DParameter>=15){var P=new ki(c);P.style={fillColor:"#008acd"},A.copyAttributesWithClip(P.style,i.axisStyle),s.push(t.createShape(P))}}var x=new gi(f);x.style={strokeLinecap:"butt",strokeLineJoin:"round",strokeColor:"#008acd",strokeWidth:1},i.axisStyle&&A.copyAttributesWithClip(x.style,i.axisStyle),x.clickable=!1,x.hoverable=!1;var k=[t.createShape(x)],j=[];if(i.axisYLabels&&i.axisYLabels.length&&i.axisYLabels.length>0){var E=i.axisYLabels,T=E.length,C=[0,0];if(i.axisYLabelsOffset&&i.axisYLabelsOffset.length&&(C=i.axisYLabelsOffset),1==T){var R=new Wi(o[0]-5+C[0],o[3]+C[1],E[0]);R.style={labelAlign:"right"},i.axisYLabelsStyle&&A.copyAttributesWithClip(R.style,i.axisYLabelsStyle),R.clickable=!1,R.hoverable=!1,j.push(t.createShape(R))}else for(var M=o[3],L=Math.abs(o[1]-o[3])/(T-1),N=0;N0){var F=i.axisXLabels,B=F.length,G=[0,0];if(i.axisXLabelsOffset&&i.axisXLabelsOffset.length&&(G=i.axisXLabelsOffset),n&&n.xPositions&&n.xPositions.length&&n.xPositions.length==B)for(var U=n.xPositions,z=0;z=0&&r[o]&&A.copyAttributesWithClip(a,r[o]),n&&n.length&&void 0!==i)for(var s=n,u=s.length,l=parseFloat(i),c=0;c0){var l=i[i.length-1];if(Math.abs(l[0]-n[0])<=a&&Math.abs(l[1]-n[1])<=a)continue}i.push(n)}if(i.length<2)return null;var c=new Object;(c=A.copyAttributesWithClip(c,this.style,["pointList"])).pointList=i;var f=new za({style:c,clickable:this.isClickAble,hoverable:this.isHoverAble});this.highlightStyle&&(f.highlightStyle=this.highlightStyle),f.refOriginalPosition=this.location,f.refDataID=this.data.id,f.isHoverByRefDataID=this.isMultiHover,this.shapeOptions&&A.copyAttributesWithClip(f,this.shapeOptions),this.shapes.push(f)}},{key:"multiPointToTF",value:function(t){for(var e=t.components,r=[],n=[],o=this.location,i=[],a=this.nodesClipPixel,s=0;s0){var l=i[i.length-1];if(Math.abs(l[0]-n[0])<=a&&Math.abs(l[1]-n[1])<=a)continue}i.push(n);var c=new Object;c.r=6,(c=A.copyAttributesWithClip(c,this.style)).x=n[0],c.y=n[1];var f=new ya({style:c,clickable:this.isClickAble,hoverable:this.isHoverAble});this.highlightStyle&&(f.highlightStyle=this.highlightStyle),f.refOriginalPosition=o,f.refDataID=this.data.id,f.isHoverByRefDataID=this.isMultiHover,this.shapeOptions&&A.copyAttributesWithClip(f,this.shapeOptions),this.shapes.push(f)}}},{key:"multiLineStringToTF",value:function(t){for(var e=t.components,r=0;r0){var h=i[i.length-1];if(Math.abs(h[0]-n[0])<=u&&Math.abs(h[1]-n[1])<=u)continue}i.push(n)}}else{a=[];for(var p=0;p0){var y=a[a.length-1];if(Math.abs(y[0]-n[0])<=u&&Math.abs(y[1]-n[1])<=u)continue}a.push(n)}}a.length<2||s.push(a)}if(!(i.length<2)){var d={};(d=A.copyAttributesWithClip(d,this.style,["pointList"])).pointList=i;var b=new Na({style:d,clickable:this.isClickAble,hoverable:this.isHoverAble});this.highlightStyle&&(b.highlightStyle=this.highlightStyle),b.refOriginalPosition=this.location,b.refDataID=this.data.id,b.isHoverByRefDataID=this.isMultiHover,s.length>0&&(b.holePolygonPointLists=s),this.shapeOptions&&A.copyAttributesWithClip(b,this.shapeOptions),this.shapes.push(b)}}},{key:"rectangleToTF",value:function(t){var e=this.location,r=new I(t.x,t.y),n=this.layer.map.getResolution(),o=this.getLocalXY(r),i=new Object;i.r=6,(i=A.copyAttributesWithClip(i,this.style)).x=o[0]-e[0],i.y=o[1]-e[1]-2*t.width/n,i.width=t.width/n,i.height=t.height/n;var a=new Qa({style:i,clickable:this.isClickAble,hoverable:this.isHoverAble});this.highlightStyle&&(a.highlightStyle=this.highlightStyle),a.refOriginalPosition=e,a.refDataID=this.data.id,a.isHoverByRefDataID=this.isMultiHover,this.shapeOptions&&A.copyAttributesWithClip(a,this.shapeOptions),this.shapes.push(a)}},{key:"geoTextToTF",value:function(t){var e=this.location,r=this.getLocalXY(t),n=new Object;n.r=6,(n=A.copyAttributesWithClip(n,this.style,["x","y","text"])).x=r[0]-e[0],n.y=r[1]-e[1],n.text=t.text;var o=new Oa({style:n,clickable:this.isClickAble,hoverable:this.isHoverAble});this.highlightStyle&&(o.highlightStyle=this.highlightStyle),o.refOriginalPosition=e,o.refDataID=this.data.id,o.isHoverByRefDataID=this.isMultiHover,this.shapeOptions&&A.copyAttributesWithClip(o,this.shapeOptions),this.shapes.push(o)}},{key:"updateAndAddShapes",value:function(){var t=this.getLocalXY(this.lonlat);this.location=t;for(var e=this.layer.renderer,r=0,n=this.shapes.length;rs){var h=i[0];i.splice(0,1),delete o[h]}}}if(this.renderer.render(),r&&this.isHoverAble&&this.isMultiHover){var p=this.getShapesByFeatureID(r);this.renderer.updateHoverShapes(p)}}},{key:"createThematicFeature",value:function(t){var e=A.copyAttributesWithClip(this.style);t.style&&!0===this.isAllowFeatureStyle&&(e=A.copyAttributesWithClip(t.style));var r={};r.nodesClipPixel=this.nodesClipPixel,r.isHoverAble=this.isHoverAble,r.isMultiHover=this.isMultiHover,r.isClickAble=this.isClickAble,r.highlightStyle=os.transformStyle(this.highlightStyle);for(var n=new ps(t,this,os.transformStyle(e),r),o=0;o0&&0==this.labelFeatures.length)for(var e=this.setLabelsStyle(this.features),r=0,n=e.length;r=0&&y.x<=f.x&&y.y>=0&&y.y<=f.y){if(r.style.minZoomLevel>-1&&l<=r.style.minZoomLevel)continue;if(r.style.maxZoomLevel>-1&&l>r.style.maxZoomLevel)continue;var d=null;r.isStyleChange?(r.isStyleChange=null,d=this.calculateLabelBounds(r,y)):d=r.geometry.bsInfo.w&&r.geometry.bsInfo.h?this.calculateLabelBounds2(r,y):this.calculateLabelBounds(r,y);var b=new F(0,f.y,f.x,0),v=d.length;if(this.isAvoid){var m=this.getAvoidInfo(b,d);if(m){if("left"===m.aspectW){r.style.labelXOffset+=m.offsetX;for(var g=0;g=o[u].start&&a=o[u].start&&as&&(s=r,u="top")}if(e.y>t.bottom){var n=Math.abs(e.y-t.bottom);n>s&&(s=n,u="bottom")}if(e.xa&&(a=o,l="left")}if(e.x>t.right){var i=Math.abs(e.x-t.right);i>a&&(a=i,l="right")}}}}},{key:"isQuadrilateralOverLap",value:function(t,e){var r=t.length,n=e.length;if(5!==r||5!==n)return null;for(var o=!1,i=0;it-n&&r.time1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[-180,180],o=n[1],i=n[0],a=o-i;return t===o&&e?t:t===i&&r?t:0===((t-i)%a+a)%a&&e?o:((t-i)%a+a)%a+i}function zs(t){var e=parseInt(t),r=parseInt(60*(t-e)),n=parseInt(60*(60*(t-e)-r));return r=0===parseInt(r/10)?"0".concat(r):r,n=0===parseInt(n/10)?"0".concat(n):n,"".concat(e,"°").concat(r,"'").concat(n)}function Js(t,e,r){return 1/(t*e*(1/.0254)*Gs(r))}function Vs(t,e){for(var r=0;rthis.mapVOptions.maxZoom)}},{key:"_getResolution",value:function(){var t=this.map.getBounds(),e=(t.getEast()-t.getWest())/this.map.getCanvas().getBoundingClientRect().width;return Gs("DEGREE")*e}},{key:"_getCenterPixel",value:function(){return this.map.project(new(o().LngLat)(0,0))}},{key:"addData",value:function(t,e){this.renderer.addData(t,e)}},{key:"update",value:function(t){this.renderer.update(t)}},{key:"getData",value:function(){return this.renderer&&(this.dataSet=this.renderer.getData()),this.dataSet}},{key:"removeData",value:function(t){this.renderer&&this.renderer.removeData(t)}},{key:"clearData",value:function(){this.renderer.clearData()}},{key:"show",value:function(){return this.renderer&&this.renderer.show(),this}},{key:"hide",value:function(){return this.renderer&&this.renderer.hide(),this}},{key:"getTopLeft",value:function(){var t,e=this.map;e&&(t=e.getBounds().getNorthWest());return t}},{key:"bindEvent",value:function(){var t=this.map;this.mapVOptions.methods&&(this.mapVOptions.methods.click&&t.on("click",this.renderer.clickEvent),this.mapVOptions.methods.mousemove&&t.on("mousemove",this.renderer.mousemoveEvent))}},{key:"unbindEvent",value:function(){var t=this.map;this.mapvOptions.methods&&(this.mapvOptions.methods.click&&t.off("click",this.clickEvent),this.mapvOptions.methods.mousemove&&t.off("mousemove",this.mousemoveEvent))}},{key:"setVisibility",value:function(t){t!==this.visibility&&(this.visibility=t,t?this.show():this.hide())}},{key:"setZIndex",value:function(t){this.renderer.setZIndex(t)}}])&&Vs(e.prototype,r),n&&Vs(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Hs(t,e){for(var r=0;r",a="
"+(e._createLegendElement.call(e)||"")+"
";this._container.innerHTML=i+a}return e._appendLegendCSSStyle(),this._container},r.prototype.onRemove=function(){this._container.parentNode.removeChild(this._container),this._map=void 0},new r}},{key:"_createLegendElement",value:function(){}},{key:"_addLayer",value:function(){var t=this.getLayerStyleOptions(),e=this.id?this.id:"theme3DLayer",r=this.sourceId=e+"Source";this.map.getSource(r)?(this.map.removeSource(r),this.map.addSource(r,{type:"geojson",data:this.data})):this.map.addSource(r,{type:"geojson",data:this.data}),this.map.addLayer({id:e,type:"fill-extrusion",source:r,paint:t}),this.map.moveLayer(e)}},{key:"_addHighLightLayer",value:function(){if(this.map){var t=this.map;t.addLayer({id:this._highlightLayerId,type:"fill-extrusion",source:this.sourceId,paint:this.getHighlightStyleOptions(),filter:["in","$id",""]}),this._selectFeatureId=null,t.on("mousemove",this.id,this._onMouseMove.bind(this)),t.on("mouseout",this.id,this._onMouseMove.bind(this))}}},{key:"_onMouseMove",value:function(t){var e=this,r=this.map,n=r.queryRenderedFeatures(t.point,{layers:[e.id]});if(e.highlight&&e.highlight.callback&&e.highlight.callback(n,t),!n||n.length<1)return e._clearHighlight.call(e),void(e._selectFeatureId=null);var o=n[0].id;e._selectFeatureId!==o&&(e._selectFeatureId=o,r.setFilter(e._highlightLayerId,["==","$id",e._selectFeatureId]))}},{key:"_clearHighlight",value:function(){this.map&&this.map.setFilter(this._highlightLayerId,["in","$id",""])}},{key:"_appendLegendCSSStyle",value:function(){var t=document.createElement("style");t.type="text/css";t.innerHTML="\n .legend {\n display: inline-block;\n border-radius: 2px;\n -moz-border-radius: 2px;\n -webkit-border-radius: 2px;\n font-size: 12px;\n color: rgba(0, 0, 0, 0.8);\n background-color: rgb(255, 255, 255);\n }\n .legend-light {\n color: rgba(0, 0, 0, 0.8);\n background-color: rgb(255, 255, 255);\n box-shadow: 0px 0px 6px #bbbbbb;\n -moz-box-shadow: 0px 6px 10px #bbbbbb;\n -webkit-box-shadow: 0px 0px 6px #bbbbbb;\n }\n .legend-dark {\n color: rgba(255, 255, 255, 0.8);\n background-color: rgb(64, 64, 64);\n }\n .legend .legend-title {\n min-height: 14px;\n max-width: 500px;\n padding:6px 10px;\n }\n .legend-light .legend-title {\n color: rgba(0, 0, 0, 0.8);\n }\n .legend-dark .legend-title {\n color: rgba(255, 255, 255, 0.8);\n }\n .legend-content{\n padding:6px 10px;\n }\n "+this._legendCSSStyle(),document.getElementsByTagName("head")[0].appendChild(t)}},{key:"_legendCSSStyle",value:function(){return"\n .legend ul {\n padding: 0;\n margin: 0 16px;\n height: 100%;\n display: block;\n list-style: none;\n }\n\n .legend li {\n vertical-align: middle;\n }\n\n .legend li span:first-child {\n vertical-align: middle;\n }\n\n .legend li span:last-child {\n line-height: 28px;\n max-width: 200px;\n vertical-align: middle;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n -ms-text-overflow: ellipsis;\n }\n\n .legend-vertical li {\n height: 28px;\n }\n\n .legend-vertical li span:first-child {\n display: inline-block;\n width: 60px;\n height: 100%;\n }\n\n .legend-vertical li span:last-child {\n display: inline-block;\n margin-left: 16px;\n height: 100%;\n }\n\n .legend-horizontal li {\n height: 56px;\n float: left;\n }\n\n .legend-horizontal li span:first-child {\n display: block;\n width: 100%;\n height: 50%;\n }\n\n .legend-horizontal li span:last-child {\n display: block;\n vertical-align: middle;\n width: 60px;\n height: 50%;\n text-align: center;\n }\n "}},{key:"_extend",value:function(t){for(var e=0;e";for(t=0;t "+o;else o=o+"-"+this._getWrapperText(this.colorStops[t+1][0]);r+="
  • "+o+"
  • "}return r+=""}},{key:"_getWrapperText",value:function(t){var e=t*(null==this.legendRatio?1:parseFloat(this.legendRatio)),r=parseFloat(e);return r%1e6<=1e6?r.toString():parseInt(r/1e3)+"k"}}])&&Qs(e.prototype,r),n&&Qs(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function eu(t){"@babel/helpers - typeof";return(eu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ru(t,e){for(var r=0;r0&&r.attributes){var n=this.themeField,o=r.attributes,i=this.styleGroups,a=!1,s=null;for(var u in o)if(n===u){a=!0,s=o[u];break}if(a)for(var l=0,c=i.length;l=i[l].start&&s"+n+""}return t+=""}}])&&yu(e.prototype,r),n&&yu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function wu(t){"@babel/helpers - typeof";return(wu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ou(t,e){for(var r=0;r0&&r.attributes){var n=this.themeField,o=r.attributes,i=this.styleGroups,a=!1,s=null;for(var u in o)if(n===u){a=!0,s=o[u];break}if(a)for(var l=0,c=i.length;l0&&void 0!==arguments[0]?arguments[0]:null;if(!t||0===t.length||t===this.graphics)return this.graphics.length=0,this.layer.props.data&&(this.layer.props.data.length=0),void this.update();A.isArray(t)||(t=[t]);for(var e=t.length-1;e>=0;e--){var r=t[e],n=A.indexOf(this.graphics,r);-1!==n&&this.graphics.splice(n,1)}this.update()}},{key:"update",value:function(){if("Awaiting state"!==this.layer.lifecycle){this.layer.setChangeFlags({dataChanged:!0,propsChanged:!0,viewportChanged:!0,updateTriggersChanged:!0});var t=this.getState(),e=parseInt(this.canvas.style.width),r=parseInt(this.canvas.style.height);t.width=e,t.height=r,this.layer.setState(t)}}},{key:"clear",value:function(){this.removeGraphics(),this.deckGL.finalize()}},{key:"remove",value:function(){this.mapOptions.targetElement.removeChild(this.canvas)}},{key:"destroy",value:function(){this.remove(),this.clear()}},{key:"moveTo",value:function(t,e){var r=document.getElementById(this.id);if(e=void 0===e||e){var n=document.getElementById(t);r&&n&&n.parentNode.insertBefore(r,n)}else{var o=document.getElementById(t);if(r){if(o.nextSibling)return void o.parentNode.insertBefore(r,o.nextSibling);o.parentNode.appendChild(r)}}}},{key:"setVisibility",value:function(t){this.canvas&&t!==this.visibility&&(this.visibility=t,this.canvas.style.display=t?"block":"none")}},{key:"draw",value:function(){var t=this.getState(),e={};for(var r in t)e[r]=t[r];var n=parseInt(this.canvas.style.width),o=parseInt(this.canvas.style.height);e.width=n,e.height=o,e.layers=[this.layer],e.canvas=this.canvas,this.deckGL.setProps(e)}},{key:"_initContainer",value:function(){this.canvas=this._createCanvas(this.mapOptions.mapElement),this.mapOptions.targetElement.appendChild(this.canvas)}},{key:"_createCanvas",value:function(t){var e=document.createElement("canvas");return this.id&&(e.id=this.id),e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.cursor="",e.width=parseInt(t.style.width),e.height=parseInt(t.style.height),e.style.width=t.style.width,e.style.height=t.style.height,e}},{key:"getState",value:function(){var t=this.functions.getMapState();return function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:null;this.renderer&&this.renderer.removeGraphics(t)}},{key:"clear",value:function(){this.renderer&&this.renderer.clear()}},{key:"remove",value:function(){this.renderer&&this.renderer.remove()}},{key:"moveTo",value:function(t,e){this.renderer.moveTo(t,e)}},{key:"setVisibility",value:function(t){this.renderer.setVisibility(t)}},{key:"getState",value:function(){return this.renderer.getState()}},{key:"getMapState",value:function(){var t={},e=this.map.getCenter(),r={longitude:e.lng,latitude:e.lat,zoom:this.map.getZoom(),maxZoom:this.map.getMaxZoom(),pitch:this.map.getPitch(),bearing:this.map.getBearing()};for(var n in r)t[n]=r[n];return this.map.getCRS&&this.map.getCRS()!==o().CRS.EPSG3857&&(t.coordinateSystem=this.coordinateSystem,t.isGeographicCoordinateSystem=this.isGeographicCoordinateSystem),t}}])&&Ru(e.prototype,r),n&&Ru(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Mu=function(){try{return THREE}catch(t){return{}}}();function Lu(t,e,r){if(t===r||t===e)return t;var n=r-e;return((t-e)%n+n)%n+e}function Nu(t){return t*Math.PI/180}var Iu={matrix:[1,-1,0,0],projection:{R:6378137,minZoom:0,maxZoom:22,nativeMaxZoom:19,RAD:Math.PI/180,METERS_PER_DEGREE:6378137*Math.PI/180,MAX_LATITUDE:85.0511287798,project:function(t){var e=this.RAD,r=this.METERS_PER_DEGREE,n=this.MAX_LATITUDE,o=t instanceof Array?{lng:t[0],lat:t[1]}:{lng:t.lng,lat:t.lat},i=o.lng,a=Math.max(Math.min(n,o.lat),-n);return{x:i*r,y:(0===a?0:Math.log(Math.tan((90+a)*e/2))/e)*r}},unproject:function(t){var e,r=t.x,n=t.y,o=this.RAD,i=this.METERS_PER_DEGREE;return 0===n?e=0:(e=n/i,e=(2*Math.atan(Math.exp(e*o))-Math.PI/2)/o),{lng:Lu(r/i,-180,180),lat:Lu(e,-this.MAX_LATITUDE,this.MAX_LATITUDE)}},locate:function(t,e,r){if(!t)return null;if(e=e||0,r=r||0,!e&&!r)return t;var n=t.lng;if(0!==e){var o=Math.abs(e),i=Nu(t.lng);n=Lu(180*(i+=2*Math.sqrt(Math.pow(Math.sin(o/(2*this.R)),2)/Math.pow(Math.cos(i),2))*(o>0?1:-1))/Math.PI,-180,180)}var a=t.lat;if(0!==r){var s=Math.abs(r),u=Nu(t.lat);a=Lu(180*(u+=2*Math.sin(s/(2*this.R))*(s>0?1:-1))/Math.PI,-90,90)}return{lng:n,lat:a}},getResolution:function(t){if(!this.resolutions){for(var e=[],r=12756274*Math.PI,n=0;n<=this.maxZoom;n++)e[n]=r/(256*Math.pow(2,n));this.resolutions=e}var o=0|t,i=this.resolutions.length;o=o<0?0:o>i-1?i-1:o;var a=this.resolutions[o];return(0|t)!==t&&o!==i-1?a+(this.resolutions[o+1]-a)*(t-o):a}},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},lngLatToPoint:function(t,e){var r=this.project(t);return this.transform(r,this.projection.getResolution(e))},locate:function(t,e,r){return this.projection.locate(t,e,r)},transform:function(t,e){return{x:this.matrix[0]*(t.x-this.matrix[2])/e,y:this.matrix[1]*(t.y-this.matrix[3])/e}}};function Du(t,e){for(var r=0;r=0;e--)t.children[e]instanceof Mu.Mesh&&t.remove(t.children[e]);return this}},{key:"clearAll",value:function(t){var e=this.scene;if(!e)return this;for(var r=e.children.length-1;r>=0;r--)!t&&e.children[r]instanceof Mu.Camera||e.remove(e.children[r]);return this}},{key:"setPosition",value:function(t,e){if(!t||!e)return this;var r=this.lngLatToPosition(e);return t.position.set(r.x,r.y,r.z),this}},{key:"lngLatToPosition",value:function(t){var e=Iu.projection.nativeMaxZoom,r=Iu.lngLatToPoint(t,e);return new Ju(r.x,r.y,-0)}},{key:"distanceToThreeVector3",value:function(t,e,r){var n=this.map,o=r||n.getCenter(),i=Iu.projection.nativeMaxZoom,a=Iu.locate(o,t,e),s=Iu.lngLatToPoint(o,i),u=Iu.lngLatToPoint(a,i),l=Math.abs(u.x-s.x)*Math.sign(t),c=Math.abs(u.y-s.y)*Math.sign(e);return new Ju(l,c,0)}},{key:"removeDuplicatedCoordinates",value:function(t){function e(t,e){return t[0]===e[0]&&t[1]===e[1]}for(var r=[].concat(t),n=r.length-1;n>=1;n--)e(r[n],r[n-1])&&r.splice(n,1);return e(r[0],r[r.length-1])&&r.splice(r.length-1,1),r}},{key:"getCoordinatesCenter",value:function(t){for(var e=0,r=0,n=0,o=0,i=t.length;o0?this.convertFastToPixelPoints(t):this.canvasContext.clearRect(0,0,this.maxWidth,this.maxWidth)}},{key:"convertFastToPixelPoints",value:function(t){var e,r,n,o,i,a,s,u=[],l=t.getEast()-t.getWest(),c=t.getNorth()-t.getSouth(),f=this.mapElement;o=l/f.width>c/f.height?l/f.width:c/f.height,this.useRadius=this.useGeoUnit?parseInt(this.radius/o):this.radius;for(var h=0;h0&&this.maxWidth>0))return!1;var r=this.canvasContext;r.setTransform(1,0,0,1,0,0),this.canvasContext.clearRect(0,0,this.maxWidth,this.maxHeight),this.drawCircle(this.useRadius),this.createGradient();for(var n=0;nt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:this.options;(t=t||{}).strokeStyle=Object.assign({},Tl,t.strokeStyle||{}),t.lngLabelStyle=Object.assign({},El,t.lngLabelStyle||{}),t.latLabelStyle=Object.assign({},El,t.latLabelStyle||{}),this.options=Object.assign({},Cl,t,{extent:this.getDefaultExtent(t.extent),wrapX:t.wrapX}),this.oldExtent=this.options.extent,this._calcInterval(),this.isRotate=!1,this.visible=!0,this.features=this._getGraticuleFeatures()}},{key:"_createCanvas",value:function(){if(!this.canvas){var t=this.mapElement;this.canvas=document.createElement("canvas"),this.canvas.id=this.canvasId,this.canvas.style.position="absolute",this.canvas.style.top="0px",this.canvas.style.left="0px";var e=("undefined"==typeof window?{}:window).devicePixelRatio||1;this.canvas.width=parseInt(t.style.width)*e,this.canvas.height=parseInt(t.style.height)*e,this.canvas.style.width=t.style.width,this.canvas.style.height=t.style.height,this.canvas.globalAlpha=this.options.opacity,this.targetElement.appendChild(this.canvas)}}},{key:"_drawCanvas",value:function(){this.canvas||this._createCanvas(),this.setVisibility(),this._reset()}},{key:"_resizeCallback",value:function(){this.targetElement&&this.targetElement.removeChild(this.canvas),this.canvas=null,this._drawCanvas()}},{key:"_reset",value:function(){this._updateRotate(),this._updateExtent(),this._calcInterval(),this._drawLabel()}},{key:"_updateRotate",value:function(){var t=this.getMapStateByKey("getBearing");this.isRotate=t>-180&&t<=-90||t>=90&&t<180}},{key:"_updateExtent",value:function(){if(this.options.wrapX&&!this.oldExtent){var t=this.getMapStateByKey("getBounds"),e=t._ne,r=t._sw;this.options.extent=[r.lng,r.lat,e.lng,e.lat]}}},{key:"_calcInterval",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.interval;"function"==typeof t?(t=t(this.map),this._currLngInterval=t,this._currLatInterval=t):(this._currLngInterval=t,this._currLatInterval=t)}},{key:"_formatLat",value:function(t){return this.options.latFormatTickLabel?this.options.latLabelFormatter(t):t<0?zs(-1*t)+"S":t>0?zs(t)+"N":""+zs(t)}},{key:"_formatLng",value:function(t){return this.options.lngLabelFormatter?this.options.lngLabelFormatter(t):(t=Us(t))>0&&t<=180?zs(t)+"E":t<0&&t>=-180?zs(-1*t)+"W":""+zs(t)}},{key:"_parsePxToInt",value:function(t){t.length>2&&"p"===t.charAt(t.length-2)&&(t=t.substr(0,t.length-2));try{return parseInt(t,10)}catch(t){console.log(t)}return 0}},{key:"_drawLabel",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.visible,r=this.canvas,n=r.getContext("2d");if(e&&this.options.showLabel){if(this.mapElement){this._currLngInterval&&this._currLatInterval||this._calcInterval(),n.clearRect(0,0,r.width,r.height);var o=this.options,i=o.lngLabelStyle,a=o.latLabelStyle,s=this._getGridiculePoints(),u=s.lngPoints,l=s.latPonits;u.forEach(function(e){t._drawLng(n,e[0],e[1],e[2],i)}),l.forEach(function(e){t._drawLat(n,e[0],e[1],e[2],a)})}}else n.clearRect(0,0,r.width,r.height)}},{key:"_drawLat",value:function(t,e,r,n,o){t=this._setLabelStyle(t,o);var i=this.canvas.width,a=12;try{var s=t.font.split(" ")[0];a=this._parsePxToInt(s)}catch(t){console.log(t)}if(!n){var u=e;e=r,r=this.getMapStateByKey("project",[u,e])}var l=this._formatLat(e),c=t.measureText(l).width;t.strokeText(l,(n?i:r.x)-c,(n?r:r.y)+a/2),t.fillText(l,(n?i:r.x)-c,(n?r:r.y)+a/2)}},{key:"_drawLng",value:function(t,e,r,n,o){t=this._setLabelStyle(t,o);var i=this.canvas.height;if(!n){var a=r;r=this.getMapStateByKey("project",[e,a])}var s=this._formatLng(e),u=t.measureText(s).width;t.strokeText(s,(n?r:r.x)-u/2,n?i:r.y),t.fillText(s,(n?r:r.x)-u/2,n?i:r.y)}},{key:"_getLatPoints",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-180,180],r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.features;if(o){if(this.options.wrapX&&-180===e[0]&&180===e[1])return[];var i=[];return o.forEach(function(o){var a=o.geometry.coordinates[0][1];if(o.geometry.coordinates[1][1]===a){var s="number"==typeof n?n:e[1];t.isRotate&&(s="number"==typeof r?r:e[0]),t.options.wrapX&&(i=i.concat(t._getWrapPoints(s,a,[s,s]))),i.push([s,a])}}),i}}},{key:"_getLngPoints",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-90,90],r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.features;if(o){var i="number"==typeof r?r:e[0];this.isRotate&&(i="number"==typeof n?n:e[1]);var a=[];return o.forEach(function(e){var r=e.geometry.coordinates[0][0];e.geometry.coordinates[1][0]===r&&(a.push([r,i]),t.options.wrapX&&(a=a.concat(t._getWrapPoints(r,i))))}),a}}},{key:"_getWrapPoints",value:function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.oldExtent,n=[],o=this.getMapStateByKey("getBounds"),i=o._ne,a=o._sw,s=r.length>2?r[2]:r[1];t>=a.lng;){var u=Us(t,180===s,-180===r[0]);(!r||u>=r[0]&&u<=s)&&n.push([t,e]),t-=360}for(;t<=i.lng;){var l=Us(t,180===s,-180===r[0]);(!r||l>=r[0]&&l<=s)&&n.push([t,e]),t+=360}return n}},{key:"_getGridiculePoints",value:function(){var t=this._getEdgeLat(),e=this._getEdgeLng(),r=this._getRange(),n=r.latRange,o=r.lngRange,i=r.firstLat,a=r.firstLng,s=r.lastLat,u=r.lastLng;return{latPonits:this._getUniquePoint(this._getLatPoints(o,a,u),t,1),lngPoints:this._getUniquePoint(this._getLngPoints(n,i,s),e,0)}}},{key:"_getEdgeLat",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._currLatInterval,r=[],n=[],o=this.canvas.width,i=this.canvas.height,a=this._getRange().extent,s=this.getMapStateByKey("getBounds")._ne;if(this.options.wrapX&&Us(s.lng)>a[2])return[];for(var u=this._countDecimals(e),l=0;l<=i;l++){var c=this.getMapStateByKey("unproject",[o,l]),f=Us(c.lng);(this.options.wrapX?f>=a[0]&&f<=a[2]:c.lng>=a[0]&&c.lng<=a[2])&&c.lat>=a[1]&&c.lat<=a[3]&&(r.push([c.lat,l]),n.push(c.lat),void 0===t&&c.lat.toFixed(u)%e==0&&(t=Number(c.lat.toFixed(u))))}var h=this._getIntersectRange(t,n,r,e),p=h.first,y=h.last,d=h.coordinates,b=h.points;t=Math.min(Math.max(p,-90),90);var v=Math.max(Math.min(Math.round(y),90),-90);return-90!==t||-90!==v?this._getClosestCoordinate(t,v,d,b,e):[]}},{key:"_getEdgeLng",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._currLngInterval,r=[],n=[],o=this.canvas.width,i=this.canvas.height,a=this.options.extent,s=this._countDecimals(e),u=this.getMapStateByKey("getBounds")._sw;if(this.options.wrapX&&Us(u.lat)>a[3])return[];for(var l=0;l<=o;l++){var c=this.getMapStateByKey("unproject",[l,i]),f=Us(c.lng);(this.options.wrapX?f>=a[0]&&f<=a[2]:c.lng>=a[0]&&c.lng<=a[2])&&c.lat>=a[1]&&c.lat<=a[3]&&(r.push([c.lng,l]),n.push(c.lng),void 0===t&&c.lng.toFixed(s)%e==0&&(t=Number(c.lng.toFixed(s))))}var h=this._getIntersectRange(t,n,r,e),p=h.first,y=h.last,d=h.coordinates,b=h.points;return t=p,this._getClosestCoordinate(t,y,d,b,e)}},{key:"_getIntersectRange",value:function(t,e,r,n){var o=e[e.length-1];if(t>o){o=t,e.reverse(),r.reverse();for(var i=this._countDecimals(n),a=0;a<=e.length;a++){var s=e[a];if(s.toFixed(i)%n==0){t=Number(s.toFixed(i));break}}}return{first:t,last:o,coordinates:e,points:r}}},{key:"_getClosestCoordinate",value:function(t,e,r,n,o){for(var i=[],a=t;a<=e;){var s=this._getClosestNumberIndex(a,r),u=n[s];i.push([Math.round(u[0]),u[1],!0]),a+=o,r=r.slice(s),n=n.slice(s)}return i}},{key:"_getClosestNumberIndex",value:function(t,e){for(var r=0,n=Number.MAX_VALUE,o=0;o2&&void 0!==arguments[2]?arguments[2]:0;if(this.options.wrapX)return t.concat(e);if(!e||0===e.length)return t;var n=e,o=this.canvas.width,i=this.canvas.height;for(var a in t){var s=this.getMapStateByKey("project",t[a]),u=n.findIndex(function(e){return e[0]===t[a][r]});u<=-1?n.push(t[a]):s&&s.x>=0&&s.x<=o&&s.y>=0&&s.y<=i&&(n[u]=t[a])}return n}},{key:"_countDecimals",value:function(t){return Math.floor(t)!==t&&t.toString().split(".")[1].length||0}},{key:"_getGraticuleFeatures",value:function(){var t=this._currLngInterval||10,e=this._currLatInterval||10,r=[],n=this._getRange(),o=n.latRange,i=n.lngRange,a=n.firstLat,s=n.firstLng,u=n.lastLat,l=n.lastLng;this.options.wrapX&&!this.oldExtent&&(o=[-90,90],i=[-180,180],a=s=u=l=null),"number"==typeof s&&r.unshift(this._makeLineFeature(this._makeLineCoords(s,o,a,u))),"number"==typeof l&&r.unshift(this._makeLineFeature(this._makeLineCoords(l,o,a,u)));for(var c=i[0];c<=i[1];c+=t)r.unshift(this._makeLineFeature(this._makeLineCoords(c,o,a,u)));"number"==typeof a&&r.unshift(this._makeLineFeature(this._makeLineCoords(a,i,s,l,"lat"))),"number"==typeof u&&r.unshift(this._makeLineFeature(this._makeLineCoords(u,i,s,l,"lat")));for(var f=o[0];f<=o[1];f+=e)r.unshift(this._makeLineFeature(this._makeLineCoords(f,i,s,l,"lat")));return r}},{key:"_getRange",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.extent&&xl(this.options.extent);t&&0!==t.length||(t=this.getDefaultExtent());var e={};if((t=t.map(function(t){return Number(t.toFixed(6))}))[1]%this._currLatInterval!=0){e.firstLat=t[1];var r=Math.ceil(t[1]/this._currLatInterval);t[1]=r*this._currLatInterval}if(t[3]%this._currLatInterval!=0){e.lastLat=t[3];var n=Math.floor(t[3]/this._currLatInterval);t[3]=n*this._currLatInterval}if(t[0]%this._currLngInterval!=0){e.firstLng=t[0];var o=Math.ceil(t[0]/this._currLngInterval);t[0]=o*this._currLngInterval}if(t[2]%this._currLngInterval!=0){e.lastLng=t[2];var i=Math.floor(t[2]/this._currLngInterval);t[2]=i*this._currLngInterval}return Object.assign({latRange:[t[1],t[3]],lngRange:[t[0],t[2]],extent:t},e)}},{key:"_makeLineCoords",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[-90,90],r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"lng";t="lng"===o?this._lngFix(t):t,r="number"==typeof r?r:e[0],n="number"==typeof n?n:e[1];for(var i=Math.abs(r-n),a=[],s=r;s<=n;s+=i)"lng"===o?a.push([t,s]):a.push([s,t]);return a}},{key:"_makeLineFeature",value:function(t){return{type:"Feature",geometry:{type:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"LineString",coordinates:t}}}},{key:"_lngFix",value:function(t){return t>=180?180:t<=-180?-180:t}},{key:"_transformStrokeStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.strokeStyle;if(!t||"string"==typeof t)return{paint:{"line-color":t||"rgba(0,0,0,0.2)"}};var e={visibility:this.visible?"visible":"none","line-join":t.lineJoin||"round","line-cap":t.lineCap||"round"},r={"line-color":t.lineColor||"rgba(0,0,0,0.2)","line-width":t.lineWidth||1,"line-offset":t.lineDashOffset||0,"line-translate-anchor":"viewport"};return t.lineWidth&&("function"==typeof t.lineWidth?r["line-width"]=t.lineWidth(this.map):r["line-width"]=t.lineWidth),t.lindDasharray&&("function"==typeof t.lindDasharray?r["line-dasharray"]=t.lindDasharray(this.map):r["line-dasharray"]=t.lindDasharray),{layout:e,paint:r}}},{key:"_setLabelStyle",value:function(t,e){return e.textColor&&(t.fillStyle=e.textColor),e.textSize&&(t.font=e.textSize+" "+(e.textFont||["Calibri","sans-serif"]).join(",")),e.textHaloColor&&(t.strokeStyle=e.textHaloColor,t.lineWidth=e.textHaloWidth||1),e.textAnchor&&(t.textBaseline=this._getTxetBaseline(e.textAnchor),t.textAligin=this._getTxetAlign(e.textAligin)),t}},{key:"_getTxetBaseline",value:function(t){if(!t)return"bottom";var e=t.split("-");return e.includes("bottom")?"bottom":e.includes("top")?"top":e.includes("center")?"middle":void 0}},{key:"_getTxetAlign",value:function(t){if(!t)return"center";var e=t.split("-");return e.includes("left")?"left":e.includes("right")?"right":e.includes("center")?"center":void 0}}])&&jl(e.prototype,r),n&&jl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Al(t,e){for(var r=0;r=this.options.minZoom&&e<=this.options.maxZoom,this.renderer&&(this.renderer.visible=this.visible),this.map.getLayer(this.sourceId)&&this.map.setLayoutProperty(this.sourceId,"visibility",this.visible?"visible":"none"),this.renderer&&this.renderer._drawLabel()}},{key:"setMinZoom",value:function(t){this.options.minZoom=t,this.setVisibility()}},{key:"setMaxZoom",value:function(t){this.options.maxZoom=t,this.setVisibility()}},{key:"setShowLabel",value:function(t){this.options.showLabel=t,this.renderer._drawLabel()}},{key:"setExtent",value:function(t){this.options.extent=this.getDefaultExtent(t,this.map),this.updateGraticuleLayer(),this.renderer._drawLabel()}},{key:"setStrokeStyle",value:function(t){if(this.map&&this.map.getLayer(this.sourceId)){this.options.strokeStyle=t;var e=this.renderer._transformStrokeStyle(t),r=e.layout,n=e.paint;for(var o in r)this.map.setLayoutProperty(this.sourceId,o,r[o]);for(var i in n)this.map.setPaintProperty(this.sourceId,i,n[i])}}},{key:"setLngLabelStyle",value:function(t){this.options.lngLabelStyle=t,this.renderer._drawLabel()}},{key:"setLatLabelStyle",value:function(t){this.options.latLabelStyle=t,this.renderer._drawLabel()}},{key:"setIntervals",value:function(t){this.renderer&&this.renderer.setIntervals(t)}},{key:"getDefaultExtent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.map,r=(e.getCRS&&e.getCRS()||{}).extent;if(r||(r=[-180,-85.05119,180,85.05119]),!t||0===t.length)return r;var n=o().LngLatBounds.convert(t),i=n._sw,a=n._ne;return t=[i.lng,i.lat,a.lng,a.lat],t=[Math.max(r[0],t[0]),Math.max(r[1],t[1]),Math.min(r[2],t[2]),Math.min(r[3],t[3])]}},{key:"addGraticuleLayer",value:function(){if(!this.map.getSource(this.sourceId)){var t={type:"geojson",data:{type:"FeatureCollection",features:this.renderer.features}};this.map.addSource(this.sourceId,t)}if(!this.map.getLayer(this.sourceId)){var e=Object.assign({id:this.sourceId,type:"line",source:this.sourceId},this.renderer._transformStrokeStyle());this.map.addLayer(e)}}},{key:"_getLatPoints",value:function(t,e,r,n){return this.renderer._getLatPoints(t,e,r,n)}},{key:"_bindEvent",value:function(){this.map.on("styledata",this.styleDataEevent),this.map.on("resize",this.resizeEvent),this.map.on("zoomend",this.zoomendEvent)}},{key:"_unbindEvent",value:function(){this.map.off("styledata",this.styleDataEevent),this.map.off("resize",this.resizeEvent),this.map.off("zoomend",this.zoomendEvent)}},{key:"_setLayerTop",value:function(){var t=this,e=this.map;if(e){var r=e.getStyle&&e.getStyle().layers;r&&r.length&&r.findIndex(function(e){return e.id===t.sourceId})!==r.length-1&&e.getLayer(this.sourceId)&&(e.removeLayer(this.sourceId),this.addGraticuleLayer())}}},{key:"updateGraticuleLayer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.features;if(this.map.getSource(this.sourceId)){var e={type:"FeatureCollection",features:t};this.map.getSource(this.sourceId).setData(e)}this.addGraticuleLayer()}}])&&Al(e.prototype,r),n&&Al(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Gl=(r(9957),r(5937),r(4238)),Ul=r.n(Gl),zl=window.fetch,Jl={limitLength:1500,queryKeys:[],queryValues:[],supermap_callbacks:{},addQueryStrings:function(t){for(var e in t){this.queryKeys.push(e),"string"!=typeof t[e]&&(t[e]=A.toJSON(t[e]));var r=encodeURIComponent(t[e]);this.queryValues.push(r)}},issue:function(t){for(var e=this,r=e.getUid(),n=t.url,o=[],i=n,a=0,s=e.queryKeys?e.queryKeys.length:0,u=0;u=e.limitLength){if(0==a)return!1;o.push(i),i=n,a=0,u--}else if(i.length+e.queryKeys[u].length+2+e.queryValues[u].length>e.limitLength)for(var l=e.queryValues[u];l.length>0;){var c=e.limitLength-i.length-e.queryKeys[u].length-2;i.indexOf("?")>-1?i+="&":i+="?";var f=l.substring(0,c);"%"===f.substring(c-1,c)?(c-=1,f=l.substring(0,c)):"%"===f.substring(c-2,c-1)&&(c-=2,f=l.substring(0,c)),i+=e.queryKeys[u]+"="+f,l=l.substring(c),f.length>0&&(o.push(i),i=n,a=0)}else a++,i.indexOf("?")>-1?i+="&":i+="?",i+=e.queryKeys[u]+"="+e.queryValues[u];return o.push(i),e.send(o,"SuperMapJSONPCallbacks_"+r,t&&t.proxy)},getUid:function(){return 1e3*(new Date).getTime()+Math.floor(1e17*Math.random())},send:function(t,e,r){var n=t.length;if(n>0)return new Promise(function(o){for(var i=(new Date).getTime(),a=0;a-1?s+="&":s+="?",s+="sectionCount="+n,s+="§ionIndex="+a,s+="&jsonpUserID="+i,r&&(s=decodeURIComponent(s),s=r+encodeURIComponent(s)),Ul()(s,{jsonpCallbackFunction:e,timeout:3e4}).then(function(t){o(t.json())})}})},GET:function(t){return this.queryKeys.length=0,this.queryValues.length=0,this.addQueryStrings(t.params),this.issue(t)},POST:function(t){return this.queryKeys.length=0,this.queryValues.length=0,this.addQueryStrings({requestEntity:t.data}),this.issue(t)},PUT:function(t){return this.queryKeys.length=0,this.queryValues.length=0,this.addQueryStrings({requestEntity:t.data}),this.issue(t)},DELETE:function(t){return this.queryKeys.length=0,this.queryValues.length=0,this.addQueryStrings({requestEntity:t.data}),this.issue(t)}},Vl=function(){return void 0!=Ml?Ml:window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest},ql=function(){return Ll||45e3},Hl={commit:function(t,e,r,n){switch(t=t?t.toUpperCase():t){case"GET":return this.get(e,r,n);case"POST":return this.post(e,r,n);case"PUT":return this.put(e,r,n);case"DELETE":return this.delete(e,r,n);default:return this.get(e,r,n)}},supportDirectRequest:function(t,e){return!!A.isInTheSameDomain(t)||(void 0!=e.crossOrigin?e.crossOrigin:Vl()||e.proxy)},get:function(t,e,r){r=r||{};if(t=A.urlAppend(t,this._getParameterString(e||{})),t=this._processUrl(t,r),!this.supportDirectRequest(t,r)){var n={url:t=t.replace(".json",".jsonp"),data:e};return Jl.GET(n)}return this.urlIsLong(t)?this._postSimulatie("GET",t.substring(0,t.indexOf("?")),e,r):this._fetch(t,e,r,"GET")},delete:function(t,e,r){r=r||{};if(t=A.urlAppend(t,this._getParameterString(e||{})),t=this._processUrl(t,r),!this.supportDirectRequest(t,r)){t=t.replace(".json",".jsonp");var n={url:t+="&_method=DELETE",data:e};return Jl.DELETE(n)}return this.urlIsLong(t)?this._postSimulatie("DELETE",t.substring(0,t.indexOf("?")),e,r):this._fetch(t,e,r,"DELETE")},post:function(t,e,r){if(r=r||{},t=this._processUrl(t,r),!this.supportDirectRequest(t,r)){t=t.replace(".json",".jsonp");var n={url:A.urlAppend(t,"_method=POST"),data:e};return Jl.POST(n)}return this._fetch(t,e,r,"POST")},put:function(t,e,r){if(r=r||{},t=this._processUrl(t,r),!this.supportDirectRequest(t,r)){t=t.replace(".json",".jsonp");var n={url:t+="&_method=PUT",data:e};return Jl.PUT(n)}return this._fetch(t,e,r,"PUT")},urlIsLong:function(t){for(var e=0,r=null,n=0,o=t.length;n-1?"&":"?")+"_method="+t,"string"!=typeof r&&(r=JSON.stringify(r)),this.post(e,r,n)},_processUrl:function(t,e){if(this._isMVTRequest(t))return t;if(-1===t.indexOf(".json")&&!e.withoutFormatSuffix)if(t.indexOf("?")<0)t+=".json";else{var r=t.split("?");2===r.length&&(t=r[0]+".json?"+r[1])}return e&&e.proxy&&("function"==typeof e.proxy?t=e.proxy(t):(t=decodeURIComponent(t),t=e.proxy+encodeURIComponent(t))),t},_fetch:function(t,e,r,n){return(r=r||{}).headers=r.headers||{},r.headers["Content-Type"]||FormData.prototype.isPrototypeOf(e)||(r.headers["Content-Type"]="application/x-www-form-urlencoded;charset=UTF-8"),r.timeout?this._timeout(r.timeout,zl(t,{method:n,headers:r.headers,body:"PUT"===n||"POST"===n?e:void 0,credentials:this._getWithCredentials(r),mode:"cors",timeout:ql()}).then(function(t){return t})):zl(t,{method:n,body:"PUT"===n||"POST"===n?e:void 0,headers:r.headers,credentials:this._getWithCredentials(r),mode:"cors",timeout:ql()}).then(function(t){return t})},_getWithCredentials:function(t){return!0===t.withCredentials?"include":!1===t.withCredentials?"omit":"same-origin"},_fetchJsonp:function(t,e){return e=e||{},Ul()(t,{method:"GET",timeout:e.timeout}).then(function(t){return t})},_timeout:function(t,e){return new Promise(function(r,n){setTimeout(function(){n(new Error("timeout"))},t),e.then(r,n)})},_getParameterString:function(t){var e=[];for(var r in t){var n,o=t[r];if(null!=o&&"function"!=typeof o)n=Array.isArray(o)||"[object Object]"===o.toString()?encodeURIComponent(JSON.stringify(o)):encodeURIComponent(o),e.push(encodeURIComponent(r)+"="+n)}return e.join("&")},_isMVTRequest:function(t){return t.indexOf(".mvt")>-1||t.indexOf(".pbf")>-1}};!function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(Nl||(Nl={}));var Wl,Yl=new Int32Array(2),Ql=new Float32Array(Yl.buffer),Xl=new Float64Array(Yl.buffer),Zl=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];function Kl(t,e){for(var r=0;r>24}},{key:"readUint8",value:function(t){return this.bytes_[t]}},{key:"readInt16",value:function(t){return this.readUint16(t)<<16>>16}},{key:"readUint16",value:function(t){return this.bytes_[t]|this.bytes_[t+1]<<8}},{key:"readInt32",value:function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}},{key:"readUint32",value:function(t){return this.readInt32(t)>>>0}},{key:"readInt64",value:function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<>8}},{key:"writeUint16",value:function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}},{key:"writeInt32",value:function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}},{key:"writeUint32",value:function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}},{key:"writeInt64",value:function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}},{key:"writeUint64",value:function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}},{key:"writeFloat32",value:function(t,e){Ql[0]=e,this.writeInt32(t,Yl[0])}},{key:"writeFloat64",value:function(t,e){Xl[0]=e,this.writeInt32(t,Yl[Zl?0:1]),this.writeInt32(t+4,Yl[Zl?1:0])}},{key:"getBufferIdentifier",value:function(){if(this.bytes_.length>10),56320+(1023&i)))}return n}},{key:"__union_with_string",value:function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)}},{key:"__indirect",value:function(t){return t+this.readInt32(t)}},{key:"__vector",value:function(t){return t+this.readInt32(t)+4}},{key:"__vector_len",value:function(t){return this.readInt32(t+this.readInt32(t))}},{key:"__has_identifier",value:function(t){if(4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}},{key:"createScalarList",value:function(t,e){for(var r=[],n=0;n=0;r--)t.addInt32(e[r]);return t.endVector()}},{key:"startEndsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"addXy",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"createXyVector",value:function(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}},{key:"startXyVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addZ",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"createZVector",value:function(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}},{key:"startZVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addM",value:function(t,e){t.addFieldOffset(3,e,0)}},{key:"createMVector",value:function(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}},{key:"startMVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addT",value:function(t,e){t.addFieldOffset(4,e,0)}},{key:"createTVector",value:function(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}},{key:"startTVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addTm",value:function(t,e){t.addFieldOffset(5,e,0)}},{key:"createTmVector",value:function(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}},{key:"startTmVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addType",value:function(t,e){t.addFieldInt8(6,e,Nl.Unknown)}},{key:"addParts",value:function(t,e){t.addFieldOffset(7,e,0)}},{key:"createPartsVector",value:function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}},{key:"startPartsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endGeometry",value:function(t){return t.endObject()}},{key:"createGeometry",value:function(e,r,n,o,i,a,s,u,l){return t.startGeometry(e),t.addEnds(e,r),t.addXy(e,n),t.addZ(e,o),t.addM(e,i),t.addT(e,a),t.addTm(e,s),t.addType(e,u),t.addParts(e,l),t.endGeometry(e)}}],(r=[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"ends",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}},{key:"endsLength",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"endsArray",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"xy",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}},{key:"xyLength",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"xyArray",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"z",value:function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}},{key:"zLength",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"zArray",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"m",value:function(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}},{key:"mLength",value:function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"mArray",value:function(){var t=this.bb.__offset(this.bb_pos,10);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"t",value:function(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}},{key:"tLength",value:function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"tArray",value:function(){var t=this.bb.__offset(this.bb_pos,12);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"tm",value:function(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):BigInt(0)}},{key:"tmLength",value:function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"type",value:function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):Nl.Unknown}},{key:"parts",value:function(e,r){var n=this.bb.__offset(this.bb_pos,18);return n?(r||new t).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}},{key:"partsLength",value:function(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}}])&&tc(e.prototype,r),n&&tc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function nc(t,e){for(var r=[],n=0;n>1]),r.push(o)}return r}function oc(t,e,r){if(!r||0===r.length)return[nc(t,e)];var n,o=0,i=Array.from(r).map(function(e){return t.slice(o,o=e<<1)});return e&&(o=0,n=Array.from(r).map(function(t){return e.slice(o,o=t)})),i.map(function(t,e){return nc(t,n?n[e]:void 0)})}function ic(t,e){var r=e;if(r===Nl.Unknown&&(r=t.type()),r===Nl.GeometryCollection){for(var n=[],o=0;o=0;r--)t.addInt8(e[r]);return t.endVector()}},{key:"startPropertiesVector",value:function(t,e){t.startVector(1,e,1)}},{key:"addColumns",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"createColumnsVector",value:function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}},{key:"startColumnsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endFeature",value:function(t){return t.endObject()}},{key:"finishFeatureBuffer",value:function(t,e){t.finish(e)}},{key:"finishSizePrefixedFeatureBuffer",value:function(t,e){t.finish(e,void 0,!0)}},{key:"createFeature",value:function(e,r,n,o){return t.startFeature(e),t.addGeometry(e,r),t.addProperties(e,n),t.addColumns(e,o),t.endFeature(e)}}],(r=[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"geometry",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new rc).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}},{key:"properties",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}},{key:"propertiesLength",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"propertiesArray",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"columns",value:function(t,e){var r=this.bb.__offset(this.bb_pos,8);return r?(e||new sc).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}},{key:"columnsLength",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}}])&&uc(e.prototype,r),n&&uc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),cc=(new TextEncoder,new TextDecoder);function fc(t,e){var r={};if(!e||0===e.length)return r;var n=t.propertiesArray();if(!n)return r;for(var o=new DataView(n.buffer,n.byteOffset),i=t.propertiesLength(),a=0;a0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:function(t,e){if(!t.length)return e;if(!e.length)return t;var r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}(e,r.value)}})},yc.prototype.slice=function(t){if((t|=0)<0)throw new Error("invalid length");var e=this,r=this._array.length-this._index;if(this._index+t<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=t));var n=new Uint8Array(t);return n.set(this._array.subarray(this._index)),function o(){return e._source.read().then(function(i){return i.done?(e._array=pc,e._index=0,r>0?n.subarray(0,r):null):r+i.value.length>=t?(e._array=i.value,e._index=t-r,n.set(i.value.subarray(0,t-r),r),n):(n.set(i.value,r),r+=i.value.length,o())})}()},yc.prototype.cancel=function(){return this._source.cancel()};var bc=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.bb=null,this.bb_pos=0}var e,r,n;return e=t,n=[{key:"getRootAsCrs",value:function(e,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"getSizePrefixedRootAsCrs",value:function(e,r){return e.setPosition(e.position()+4),(r||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startCrs",value:function(t){t.startObject(6)}},{key:"addOrg",value:function(t,e){t.addFieldOffset(0,e,0)}},{key:"addCode",value:function(t,e){t.addFieldInt32(1,e,0)}},{key:"addName",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"addDescription",value:function(t,e){t.addFieldOffset(3,e,0)}},{key:"addWkt",value:function(t,e){t.addFieldOffset(4,e,0)}},{key:"addCodeString",value:function(t,e){t.addFieldOffset(5,e,0)}},{key:"endCrs",value:function(t){return t.endObject()}},{key:"createCrs",value:function(e,r,n,o,i,a,s){return t.startCrs(e),t.addOrg(e,r),t.addCode(e,n),t.addName(e,o),t.addDescription(e,i),t.addWkt(e,a),t.addCodeString(e,s),t.endCrs(e)}}],(r=[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"org",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"code",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}},{key:"name",value:function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"description",value:function(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"wkt",value:function(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"codeString",value:function(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}}])&&dc(e.prototype,r),n&&dc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function vc(t,e){for(var r=0;r=0;r--)t.addFloat64(e[r]);return t.endVector()}},{key:"startEnvelopeVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addGeometryType",value:function(t,e){t.addFieldInt8(2,e,Nl.Unknown)}},{key:"addHasZ",value:function(t,e){t.addFieldInt8(3,+e,0)}},{key:"addHasM",value:function(t,e){t.addFieldInt8(4,+e,0)}},{key:"addHasT",value:function(t,e){t.addFieldInt8(5,+e,0)}},{key:"addHasTm",value:function(t,e){t.addFieldInt8(6,+e,0)}},{key:"addColumns",value:function(t,e){t.addFieldOffset(7,e,0)}},{key:"createColumnsVector",value:function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}},{key:"startColumnsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"addFeaturesCount",value:function(t,e){t.addFieldInt64(8,e,BigInt("0"))}},{key:"addIndexNodeSize",value:function(t,e){t.addFieldInt16(9,e,16)}},{key:"addCrs",value:function(t,e){t.addFieldOffset(10,e,0)}},{key:"addTitle",value:function(t,e){t.addFieldOffset(11,e,0)}},{key:"addDescription",value:function(t,e){t.addFieldOffset(12,e,0)}},{key:"addMetadata",value:function(t,e){t.addFieldOffset(13,e,0)}},{key:"endHeader",value:function(t){return t.endObject()}},{key:"finishHeaderBuffer",value:function(t,e){t.finish(e)}},{key:"finishSizePrefixedHeaderBuffer",value:function(t,e){t.finish(e,void 0,!0)}}],(r=[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"name",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"envelope",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}},{key:"envelopeLength",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"envelopeArray",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"geometryType",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Nl.Unknown}},{key:"hasZ",value:function(){var t=this.bb.__offset(this.bb_pos,10);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}},{key:"hasM",value:function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}},{key:"hasT",value:function(){var t=this.bb.__offset(this.bb_pos,14);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}},{key:"hasTm",value:function(){var t=this.bb.__offset(this.bb_pos,16);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}},{key:"columns",value:function(t,e){var r=this.bb.__offset(this.bb_pos,18);return r?(e||new sc).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}},{key:"columnsLength",value:function(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"featuresCount",value:function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):BigInt("0")}},{key:"indexNodeSize",value:function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}},{key:"crs",value:function(t){var e=this.bb.__offset(this.bb_pos,24);return e?(t||new bc).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}},{key:"title",value:function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"description",value:function(t){var e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"metadata",value:function(t){var e=this.bb.__offset(this.bb_pos,30);return e?this.bb.__string(this.bb_pos+e,t):null}}])&&vc(e.prototype,r),n&&vc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function gc(t){for(var e=mc.getRootAsHeader(t),r=e.featuresCount(),n=e.indexNodeSize(),o=[],i=0;i0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Pc(t){return this instanceof Pc?(this.v=t,this):new Pc(t)}function xc(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(t,e||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(t){o[t]&&(n[t]=function(e){return new Promise(function(r,n){i.push([t,e,r,n])>1||s(t,e)})})}function s(t,e){try{(r=o[t](e)).value instanceof Pc?Promise.resolve(r.value.v).then(u,l):c(i[0][2],r)}catch(t){c(i[0][3],t)}var r}function u(t){s("next",t)}function l(t){s("throw",t)}function c(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}}var kc=function(t){function e(e){var r=t.call(this,e)||this;return Object.defineProperty(r,"name",{value:"RepeaterOverflowError",enumerable:!1}),"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(r,r.constructor.prototype):r.__proto__=r.constructor.prototype,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r,r.constructor),r}return function(t,e){function r(){this.constructor=t}wc(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e}(Error);(function(){function t(t){if(t<0)throw new RangeError("Capacity may not be less than 0");this._c=t,this._q=[]}Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this._q.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),t.prototype.add=function(t){if(this.full)throw new Error("Buffer full");this._q.push(t)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()}})(),function(){function t(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this._q.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(t){for(;this._q.length>=this._c;)this._q.shift();this._q.push(t)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()}}(),function(){function t(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this._q.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(t){this._q.length=Rc;return Promise.resolve(e).then(function(e){return!r&&t.state>=Ac?Nc(t).then(function(t){return{value:t,done:!0}}):{value:e,done:r}})}function Dc(t,e){var r,n;if(!(t.state>=Cc))if(t.state=Cc,t.onnext(),t.onstop(),null==t.err&&(t.err=e),0!==t.pushes.length||void 0!==t.buffer&&!t.buffer.empty)try{for(var o=_c(t.pushes),i=o.next();!i.done;i=o.next()){i.value.resolve()}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}else Fc(t)}function Fc(t){var e,r;if(!(t.state>=Rc)){t.state=Ac||(t.state=Tc)){t.state=Tc;var e=function(t,e){if(jc(e),t.pushes.length>=Mc)throw new kc("No more than "+Mc+" pending calls to push are allowed on a single repeater.");if(t.state>=Cc)return Promise.resolve(void 0);var r,n=void 0===t.pending?Promise.resolve(e):t.pending.then(function(){return e});n=n.catch(function(e){t.state=Mc)throw new kc("No more than "+Mc+" pending calls to next are allowed on a single repeater.");if(e.state<=Ec&&Gc(e),e.onnext(t),void 0!==e.buffer&&!e.buffer.empty){var r=Ic(e,e.buffer.remove());if(e.pushes.length){var n=e.pushes.shift();e.buffer.add(n.value),e.onnext=n.resolve}return r}if(e.pushes.length){var o=e.pushes.shift();return e.onnext=o.resolve,Ic(e,o.value)}return e.state>=Cc?(Fc(e),Ic(e,Nc(e))):new Promise(function(r){return e.nexts.push({resolve:r,value:t})})},t.prototype.return=function(t){jc(t);var e=Uc.get(this);if(void 0===e)throw new Error("WeakMap error");return Fc(e),e.execution=Promise.resolve(e.execution).then(function(){return t}),Ic(e,Nc(e))},t.prototype.throw=function(t){var e=Uc.get(this);if(void 0===e)throw new Error("WeakMap error");return e.state<=Ec||e.state>=Cc||void 0!==e.buffer&&!e.buffer.empty?(Fc(e),null==e.err&&(e.err=t),Ic(e,Nc(e))):this.next(Promise.reject(t))},t.prototype[Symbol.asyncIterator]=function(){return this},t.race=Vc,t.merge=qc,t.zip=Hc,t.latest=Wc,t}();function Jc(t,e){var r,n,o=[],i=function(t){null!=t&&"function"==typeof t[Symbol.asyncIterator]?o.push(t[Symbol.asyncIterator]()):null!=t&&"function"==typeof t[Symbol.iterator]?o.push(t[Symbol.iterator]()):o.push(function(){return xc(this,arguments,function(){return Sc(this,function(r){switch(r.label){case 0:return e.yieldValues?[4,Pc(t)]:[3,3];case 1:return[4,r.sent()];case 2:r.sent(),r.label=3;case 3:return e.returnValues?[4,Pc(t)]:[3,5];case 4:return[2,r.sent()];case 5:return[2]}})})}())};try{for(var a=_c(t),s=a.next();!s.done;s=a.next()){i(s.value)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o}function Vc(t){var e=this,r=Jc(t,{returnValues:!0});return new zc(function(t,n){return Oc(e,void 0,void 0,function(){var e,o,i,a,s,u;return Sc(this,function(l){switch(l.label){case 0:if(!r.length)return n(),[2];o=!1,n.then(function(){e(),o=!0}),l.label=1;case 1:l.trys.push([1,,5,7]),a=void 0,s=0,u=function(){var o,u,l,c,f,h;return Sc(this,function(p){switch(p.label){case 0:o=s;try{for(f=void 0,u=_c(r),l=u.next();!l.done;l=u.next())c=l.value,Promise.resolve(c.next()).then(function(t){t.done?(n(),void 0===i&&(i=t)):s===o&&(s++,e(t))},function(t){return n(t)})}catch(t){f={error:t}}finally{try{l&&!l.done&&(h=u.return)&&h.call(u)}finally{if(f)throw f.error}}return[4,new Promise(function(t){return e=t})];case 1:return void 0===(a=p.sent())?[3,3]:[4,t(a.value)];case 2:p.sent(),p.label=3;case 3:return[2]}})},l.label=2;case 2:return o?[3,4]:[5,u()];case 3:return l.sent(),[3,2];case 4:return[2,i&&i.value];case 5:return n(),[4,Promise.race(r.map(function(t){return t.return&&t.return()}))];case 6:return l.sent(),[7];case 7:return[2]}})})})}function qc(t){var e=this,r=Jc(t,{yieldValues:!0});return new zc(function(t,n){return Oc(e,void 0,void 0,function(){var e,o,i,a=this;return Sc(this,function(s){switch(s.label){case 0:if(!r.length)return n(),[2];e=[],o=!1,n.then(function(){var t,r;o=!0;try{for(var n=_c(e),i=n.next();!i.done;i=n.next()){(0,i.value)()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),s.label=1;case 1:return s.trys.push([1,,3,4]),[4,Promise.all(r.map(function(r,s){return Oc(a,void 0,void 0,function(){var a;return Sc(this,function(u){switch(u.label){case 0:u.trys.push([0,,6,9]),u.label=1;case 1:return o?[3,5]:(Promise.resolve(r.next()).then(function(t){return e[s](t)},function(t){return n(t)}),[4,new Promise(function(t){e[s]=t})]);case 2:return void 0===(a=u.sent())?[3,4]:a.done?(i=a,[2]):[4,t(a.value)];case 3:u.sent(),u.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return r.return?[4,r.return()]:[3,8];case 7:u.sent(),u.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return s.sent(),[2,i&&i.value];case 3:return n(),[7];case 4:return[2]}})})})}function Hc(t){var e=this,r=Jc(t,{returnValues:!0});return new zc(function(t,n){return Oc(e,void 0,void 0,function(){var e,o,i,a;return Sc(this,function(s){switch(s.label){case 0:if(!r.length)return n(),[2,[]];o=!1,n.then(function(){e(),o=!0}),s.label=1;case 1:s.trys.push([1,,6,8]),s.label=2;case 2:return o?[3,5]:(Promise.all(r.map(function(t){return t.next()})).then(function(t){return e(t)},function(t){return n(t)}),[4,new Promise(function(t){return e=t})]);case 3:return void 0===(i=s.sent())?[2]:(a=i.map(function(t){return t.value}),i.some(function(t){return t.done})?[2,a]:[4,t(a)]);case 4:return s.sent(),[3,2];case 5:return[3,8];case 6:return n(),[4,Promise.all(r.map(function(t){return t.return&&t.return()}))];case 7:return s.sent(),[7];case 8:return[2]}})})})}function Wc(t){var e=this,r=Jc(t,{yieldValues:!0,returnValues:!0});return new zc(function(t,n){return Oc(e,void 0,void 0,function(){var e,o,i,a,s,u=this;return Sc(this,function(l){switch(l.label){case 0:if(!r.length)return n(),[2,[]];o=[],i=!1,n.then(function(){var t,r;e();try{for(var n=_c(o),a=n.next();!a.done;a=n.next()){(0,a.value)()}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}i=!0}),l.label=1;case 1:return l.trys.push([1,,5,7]),Promise.all(r.map(function(t){return t.next()})).then(function(t){return e(t)},function(t){return n(t)}),[4,new Promise(function(t){return e=t})];case 2:return void 0===(a=l.sent())?[2]:(s=a.map(function(t){return t.value}),a.every(function(t){return t.done})?[2,s]:[4,t(s.slice())]);case 3:return l.sent(),[4,Promise.all(r.map(function(e,r){return Oc(u,void 0,void 0,function(){var u;return Sc(this,function(l){switch(l.label){case 0:if(a[r].done)return[2,a[r].value];l.label=1;case 1:return i?[3,4]:(Promise.resolve(e.next()).then(function(t){return o[r](t)},function(t){return n(t)}),[4,new Promise(function(t){return o[r]=t})]);case 2:return void 0===(u=l.sent())?[2,a[r].value]:u.done?[2,u.value]:(s[r]=u.value,[4,t(s.slice())]);case 3:return l.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,l.sent()];case 5:return n(),[4,Promise.all(r.map(function(t){return t.return&&t.return()}))];case 6:return l.sent(),[7];case 7:return[2]}})})})}function Yc(t,e){for(var r=0;rt)){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function ef(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return rf(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rf(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rf(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);rthis.nodes[1]),this.nodes[1]=t}},{key:"toString",value:function(){return"[NodeRange level: ".concat(this._level,", nodes: ").concat(this.nodes[0],"-").concat(this.nodes[1],"]")}}])&&of(e.prototype,r),n&&of(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),a=n.minX,s=n.minY,u=n.maxX,l=n.maxY,Kc.info("tree items: ".concat(e,", nodeSize: ").concat(r)),c=cf(e,r),f=c[0][0],void 0,d=c.length-1,h=new i([0,1],d),p=[h],Kc.debug("starting stream search with queue: ".concat(p,", numItems: ").concat(e,", nodeSize: ").concat(r,", levelBounds: ").concat(c)),y=tf().mark(function t(){var n,h,y,d,b,v,m,g,w,O,S,_;return tf().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=p.shift(),Kc.debug("popped node: ".concat(n,", queueLength: ").concat(p.length)),h=n.startNode(),y=h>=f,d=ef(c[n.level()],2),b=d[1],v=Math.min(n.endNode()+r,b),m=v-h,t.next=9,new sf(o(h*uf,m*uf),0);case 9:g=t.sent,w=new Float64Array(g),O=new Uint32Array(g),S=tf().mark(function t(r){var o,c,d,b,v,m,g,S;return tf().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(uw[o+2])){t.next=7;break}return t.abrupt("return","continue");case 7:if(!(s>w[o+3])){t.next=9;break}return t.abrupt("return","continue");case 9:if(c=O[8+(o<<1)],d=O[9+(o<<1)],b=pf(d,c),!y){t.next=17;break}return v=function(){if(r ").concat(b)),g.extendEndNodeToNewOffset(b),t.abrupt("return","continue");case 23:void 0,_=n.level()-1,S=new i([b,b+1],_),void 0!==g&&g.level()==S.level()?Kc.info("Same level, but too far away. Pushing new request at offset: ".concat(b," rather than merging with distant ").concat(g)):Kc.info("Pushing new level for ".concat(S," onto queue with nearestNodeRange: ").concat(g," since there's not already a range for this level.")),p.push(S);case 26:case"end":return t.stop()}var _},t)}),_=h;case 14:if(!(_=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function mf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(t,e)||gf(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gf(t,e){if(t){if("string"==typeof t)return wf(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?wf(t,e):void 0}}function wf(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function Sf(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function _f(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){Sf(i,n,o,a,s,"next",t)}function s(t){Sf(i,n,o,a,s,"throw",t)}a(void 0)})}}function Pf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xf(t,e){for(var r=0;rXc.global.extraRequestThreshold()&&(Kc.info("Pushing new feature batch, since gap ".concat(w," was too large")),a.push(s),s=[]),s.push([d,v]);case 23:u=!1,r.next=9;break;case 26:r.next=32;break;case 28:r.prev=28,r.t0=r.catch(7),l=!0,c=r.t0;case 32:if(r.prev=32,r.prev=33,!u||null==f.return){r.next=37;break}return r.next=37,Tf(f.return());case 37:if(r.prev=37,!l){r.next=40;break}throw c;case 40:return r.finish(37);case 41:return r.finish(32);case 42:return e.headerClient.logUsage("header+index"),s.length>0&&a.push(s),O=a.flatMap(function(t){return e.readFeatureBatch(t)}),r.delegateYield(Cf(Af(zc.merge(O))),"t1",46);case 46:case"end":return r.stop()}},r,null,[[7,28,32,42],[33,,37,41]])}))()}},{key:"lengthBeforeTree",value:function(){return yf.length+df+this.headerLength}},{key:"lengthBeforeFeatures",value:function(){return this.lengthBeforeTree()+this.indexLength}},{key:"buildFeatureClient",value:function(){return new Nf(this.headerClient.httpClient)}},{key:"readFeatureBatch",value:function(t){var e=this;return jf(Of().mark(function r(){var n,o,i,a,s,u,l,c,f,h,p;return Of().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:n=mf(t[0],1),o=n[0],i=mf(t[t.length-1],2),a=i[0],s=i[1],u=a+s-o,l=e.buildFeatureClient(),c=vf(t),r.prev=7,c.s();case 9:if((f=c.n()).done){r.next=17;break}return h=mf(f.value,1),p=h[0],r.next=13,Tf(e.readFeature(l,p,u));case 13:return r.next=15,r.sent;case 15:r.next=9;break;case 17:r.next=22;break;case 19:r.prev=19,r.t0=r.catch(7),c.e(r.t0);case 22:return r.prev=22,c.f(),r.finish(22);case 25:l.logUsage("feature");case 26:case"end":return r.stop()}},r,null,[[7,19,22,25]])}))()}},{key:"readFeature",value:function(){var t=_f(Of().mark(function t(e,r,n){var o,i,a,s,u,l,c;return Of().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=r+this.lengthBeforeFeatures(),t.next=3,e.getRange(o,4,n,"feature length");case 3:return a=t.sent,i=new DataView(a).getUint32(0,!0),t.next=7,e.getRange(o+4,i,n,"feature data");case 7:return s=t.sent,u=new Uint8Array(s),(l=new Uint8Array(i+df)).set(u,df),(c=new $l(l)).setPosition(df),t.abrupt("return",lc.getRootAsFeature(c));case 14:case"end":return t.stop()}},t,this)}));return function(e,r,n){return t.apply(this,arguments)}}()}],[{key:"open",value:function(){var e=_f(Of().mark(function e(r){var n,o,i,a,s,u,l,c,f,h,p;return Of().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=2024,o=new Nf(r),i=function(){var t,e=0;for(t=0;t<3;t++){e+=Math.pow(16,t)*uf}return e}(),a=n+i,Kc.debug("fetching header. minReqLength: ".concat(a," (assumedHeaderLength: ").concat(n,", assumedIndexLength: ").concat(i,")")),e.t0=Uint8Array,e.next=8,o.getRange(0,8,a,"header");case 8:if(e.t1=e.sent,(s=new e.t0(e.t1)).subarray(0,3).every(function(t,e){return yf[e]===t})){e.next=13;break}throw Kc.error("bytes: ".concat(s," != ").concat(yf)),new Error("Not a FlatGeobuf file");case 13:return Kc.debug("magic bytes look good"),e.next=16,o.getRange(8,4,a,"header");case 16:if(l=e.sent,!((u=new DataView(l).getUint32(0,!0))>10485760||u<8)){e.next=21;break}throw new Error("Invalid header size");case 21:return Kc.debug("headerLength: ".concat(u)),e.next=24,o.getRange(12,u,a,"header");case 24:return c=e.sent,f=new $l(new Uint8Array(c)),h=gc(f),p=lf(h.featuresCount,h.indexNodeSize),Kc.debug("completed: opening http reader"),e.abrupt("return",new t(o,h,u,p));case 30:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()}]),t}(),Nf=function(){function t(e){Pf(this,t),this.bytesEverUsed=0,this.bytesEverFetched=0,this.buffer=new ArrayBuffer(0),this.head=0,this.httpClient="string"==typeof e?new If(e):e}return kf(t,[{key:"getRange",value:function(){var t=_f(Of().mark(function t(e,r,n,o){var i,a,s;return Of().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.bytesEverUsed+=r,i=e-this.head,a=i+r,!(i>=0&&a<=this.buffer.byteLength)){t.next=5;break}return t.abrupt("return",this.buffer.slice(i,a));case 5:return s=Math.max(r,n),this.bytesEverFetched+=s,Kc.debug("requesting for new Range: ".concat(e,"-").concat(e+r-1)),t.next=10,this.httpClient.getRange(e,s,o);case 10:return this.buffer=t.sent,this.head=e,t.abrupt("return",this.buffer.slice(0,r));case 13:case"end":return t.stop()}},t,this)}));return function(e,r,n,o){return t.apply(this,arguments)}}()},{key:"logUsage",value:function(t){var e=t.split(" ")[0],r=this.bytesEverUsed,n=this.bytesEverFetched,o=(100*r/n).toFixed(2);Kc.info("".concat(e," bytes used/requested: ").concat(r," / ").concat(n," = ").concat(o,"%"))}}]),t}(),If=function(){function t(e){Pf(this,t),this.requestsEverMade=0,this.bytesEverRequested=0,this.url=e}return kf(t,[{key:"getRange",value:function(){var t=_f(Of().mark(function t(e,r,n){var o,i;return Of().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.requestsEverMade+=1,this.bytesEverRequested+=r,o="bytes=".concat(e,"-").concat(e+r-1),Kc.info("request: #".concat(this.requestsEverMade,", purpose: ").concat(n,"), bytes: (this_request: ").concat(r,", ever: ").concat(this.bytesEverRequested,"), Range: ").concat(o)),t.next=6,fetch(this.url,{headers:{Range:o}});case 6:return i=t.sent,t.abrupt("return",i.arrayBuffer());case 8:case"end":return t.stop()}},t,this)}));return function(e,r,n){return t.apply(this,arguments)}}()}]),t}();function Df(t){"@babel/helpers - typeof";return(Df="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ff(){Ff=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new _(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return x()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===c)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var c={};function f(){}function h(){}function p(){}var y={};s(y,o,function(){return this});var d=Object.getPrototypeOf,b=d&&d(d(P([])));b&&b!==e&&r.call(b,o)&&(y=b);var v=p.prototype=f.prototype=Object.create(y);function m(t){["next","throw","return"].forEach(function(e){s(t,e,function(t){return this._invoke(e,t)})})}function g(t,e){var n;this._invoke=function(o,i){function a(){return new e(function(n,a){!function n(o,i,a,s){var u=l(t[o],t,i);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==Df(f)&&r.call(f,"__await")?e.resolve(f.__await).then(function(t){n("next",t,a,s)},function(t){n("throw",t,a,s)}):e.resolve(f).then(function(t){c.value=t,a(c)},function(t){return n("throw",t,a,s)})}s(u.arg)}(o,i,n,a)})}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,c;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function Bf(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function Gf(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){Bf(i,n,o,a,s,"next",t)}function s(t){Bf(i,n,o,a,s,"throw",t)}a(void 0)})}}function Uf(t){var e,r,n,o=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);o--;){if(r&&null!=(e=t[r]))return e.call(t);if(n&&null!=(e=t[n]))return new zf(e.call(t));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function zf(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then(function(t){return{value:t,done:e}})}return(zf=function(t){this.s=t,this.n=t.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var r=this.s.return;return void 0===r?Promise.resolve({value:t,done:!0}):e(r.apply(this.s,arguments))},throw:function(t){var r=this.s.return;return void 0===r?Promise.reject(t):e(r.apply(this.s,arguments))}},new zf(t)}function Jf(t){return new Hf(t,0)}function Vf(t){return function(){return new qf(t.apply(this,arguments))}}function qf(t){var e,r;function n(e,r){try{var i=t[e](r),a=i.value,s=a instanceof Hf;Promise.resolve(s?a.v:a).then(function(r){if(s){var u="return"===e?"return":"next";if(!a.k||r.done)return n(u,r);r=t[u](r).value}o(i.done?"return":"normal",r)},function(t){n("throw",t)})}catch(t){o("throw",t)}}function o(t,o){switch(t){case"return":e.resolve({value:o,done:!0});break;case"throw":e.reject(o);break;default:e.resolve({value:o,done:!1})}(e=e.next)?n(e.key,e.arg):r=null}this._invoke=function(t,o){return new Promise(function(i,a){var s={key:t,arg:o,resolve:i,reject:a,next:null};r?r=r.next=s:(e=r=s,n(t,o))})},"function"!=typeof t.return&&(this.return=void 0)}function Hf(t,e){this.v=t,this.k=e}function Wf(){return(Wf=Vf(Ff().mark(function t(e,r,n){var o,i,a,s,u,l,c,f,h,p;return Ff().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o="function"==typeof(y=e).slice?y:new yc("function"==typeof y.read?y:y.getReader()),i=function(){var t=Gf(Ff().mark(function t(e){return Ff().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.slice(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),t.t0=Uint8Array,t.next=5,Jf(i(8,"magic bytes"));case 5:if(t.t1=t.sent,(a=new t.t0(t.t1)).subarray(0,3).every(function(t,e){return yf[e]===t})){t.next=9;break}throw new Error("Not a FlatGeobuf file");case 9:return t.t2=Uint8Array,t.next=12,Jf(i(4,"header length"));case 12:return t.t3=t.sent,a=new t.t2(t.t3),s=new $l(a),u=s.readUint32(0),t.t4=Uint8Array,t.next=19,Jf(i(u,"header data"));case 19:if(t.t5=t.sent,a=new t.t4(t.t5),s=new $l(a),l=gc(s),n&&n(l),c=l.indexNodeSize,f=l.featuresCount,!(c>0)){t.next=29;break}return h=lf(f,c),t.next=29,Jf(i(h,"entire index, w/o rect"));case 29:return t.next=31,Jf(Qf(i,l,r));case 31:if(!(p=t.sent)){t.next=36;break}return t.next=34,p;case 34:t.next=29;break;case 36:case"end":return t.stop()}var y},t)}))).apply(this,arguments)}function Yf(){return(Yf=Vf(Ff().mark(function t(e,r,n,o){var i,a,s,u,l,c,f;return Ff().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Jf(Lf.open(e));case 2:i=t.sent,Kc.debug("opened reader"),o&&o(i.header),a=!1,s=!1,t.prev=7,l=Uf(i.selectBbox(r));case 9:return t.next=11,Jf(l.next());case 11:if(!(a=!(c=t.sent).done)){t.next=18;break}return f=c.value,t.next=15,n(f,i.header);case 15:a=!1,t.next=9;break;case 18:t.next=24;break;case 20:t.prev=20,t.t0=t.catch(7),s=!0,u=t.t0;case 24:if(t.prev=24,t.prev=25,!a||null==l.return){t.next=29;break}return t.next=29,Jf(l.return());case 29:if(t.prev=29,!s){t.next=32;break}throw u;case 32:return t.finish(29);case 33:return t.finish(24);case 34:case"end":return t.stop()}},t,null,[[7,20,24,34],[25,,29,33]])}))).apply(this,arguments)}function Qf(t,e,r){return Xf.apply(this,arguments)}function Xf(){return(Xf=Gf(Ff().mark(function t(e,r,n){var o,i,a,s,u;return Ff().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Uint8Array,t.next=3,e(4,"feature length");case 3:if(t.t1=t.sent,0!==(o=new t.t0(t.t1)).byteLength){t.next=7;break}return t.abrupt("return");case 7:return i=new $l(o),a=i.readUint32(0),t.t2=Uint8Array,t.next=12,e(a,"feature data");case 12:return t.t3=t.sent,o=new t.t2(t.t3),(s=new Uint8Array(a+4)).set(o,4),(i=new $l(s)).setPosition(df),u=lc.getRootAsFeature(i),t.abrupt("return",n(u,r));case 20:case"end":return t.stop()}},t)}))).apply(this,arguments)}function Zf(t,e){return{type:"FeatureCollection",features:function(t,e,r){if(!t.subarray(0,3).every(function(t,e){return yf[e]===t}))throw new Error("Not a FlatGeobuf file");var n=new $l(t),o=n.readUint32(yf.length);n.setPosition(yf.length+df);var i=gc(n);r&&r(i);var a=yf.length+df+o,s=i.indexNodeSize,u=i.featuresCount;s>0&&(a+=lf(u,s));for(var l=[];a=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function ih(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function ah(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){ih(i,n,o,a,s,"next",t)}function s(t){ih(i,n,o,a,s,"throw",t)}a(void 0)})}}function sh(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e.layerID?e.layerID:A.createUniqueID("FGBLayer_"),this.layerId=this.id+"outer",this.sourceId=this.layerId,this.options=e,this.strategy=e.strategy||"bbox",this.url=e.url,this.layerType="",this.extent=e.extent,this.init()}var e,r,n;return e=t,(r=[{key:"init",value:function(){"bbox"===this.strategy&&(this.loadedExtentsRtree_=new(rh()))}},{key:"iterateFeatures",value:function(){var t=ah(oh().mark(function t(e){var r,n,o,i,a,s,u;return oh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r={type:"FeatureCollection",features:[]},n=!1,o=!1,t.prev=3,a=uh(e);case 5:return t.next=7,a.next();case 7:if(!(n=!(s=t.sent).done)){t.next=15;break}u=s.value,this.options.featureLoader&&"function"==typeof this.options.featureLoader&&(u=this.options.featureLoader(u)),this.layerType||(this.layerType=ch[u.geometry.type]),r.features.push(u);case 12:n=!1,t.next=5;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(3),o=!0,i=t.t0;case 21:if(t.prev=21,t.prev=22,!n||null==a.return){t.next=26;break}return t.next=26,a.return();case 26:if(t.prev=26,!o){t.next=29;break}throw i;case 29:return t.finish(26);case 30:return t.finish(21);case 31:return t.abrupt("return",r);case 32:case"end":return t.stop()}},t,this,[[3,17,21,31],[22,,26,30]])}));return function(e){return t.apply(this,arguments)}}()},{key:"_loadData",value:function(){var t=ah(oh().mark(function t(e){var r,n,o=this;return oh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]},e.length){t.next=7;break}return t.next=4,this._getStream(this.url);case 4:r=t.sent,t.next=9;break;case 7:n.value={extent:e.slice()},this.loadedExtentsRtree_.insert(n);case 9:return t.next=11,th(r&&r.body||this.url,n,function(t){o.layerType=ch[t.geometryType]});case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"_getStream",value:function(){var t=ah(oh().mark(function t(e){return oh().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Hl.get(e,{},{withoutFormatSuffix:!0}).then(function(t){return t});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()},{key:"_containsExtent",value:function(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}},{key:"_getInExtent",value:function(t){var e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.loadedExtentsRtree_.search(e).map(function(t){return t.value})}},{key:"_forEachInExtent",value:function(t,e){return this._forEach(this._getInExtent(t),e)}},{key:"_forEach",value:function(t,e){for(var r,n=0,o=t.length;n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function yh(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function dh(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){yh(i,n,o,a,s,"next",t)}function s(t){yh(i,n,o,a,s,"throw",t)}a(void 0)})}}function bh(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e.layerID?e.layerID:A.createUniqueID("FGBLayer_"),this.layerId=this.id+"outer",this.sourceId=this.layerId,this.options=e,this.strategy=e.strategy||"bbox",this.url=e.url,this.layerType="",this.extent=e.extent,this.overlay=!0,this.type="custom",this.renderingMode="3d",this._updateFeaturesFn=this._updateFeatures.bind(this)}var e,r,n;return e=t,(r=[{key:"onAdd",value:function(t){this.map=t;var e,r,n,o=[];if("bbox"===this.strategy){var i=this.map.getBounds().toArray();o=[i[0][0],i[0][1],i[1][0],i[1][1]],this.map.on("moveend",this._updateFeaturesFn)}if(this.extent){var a=(e=this.extent,n=[],function(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}(e,r=o)&&(e[0]>r[0]?n[0]=e[0]:n[0]=r[0],e[1]>r[1]?n[1]=e[1]:n[1]=r[1],e[2]0?(r.totalTimes--,r.ajaxPolling(t)):r._commit(t)}},{key:"ajaxPolling",value:function(t){var e=this,r=t.url,n=/^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;return e.index=parseInt(Math.random()*e.length),e.url=e.urls[e.index],r=r.replace(n,n.exec(e.url)[0]),t.url=r,t.isInTheSameDomain=A.isInTheSameDomain(r),e._commit(t)}},{key:"calculatePollingTimes",value:function(){var t=this;t.times?t.totalTimes>t.POLLING_TIMES?t.times>t.POLLING_TIMES?t.totalTimes=t.POLLING_TIMES:t.totalTimes=t.times:t.timest.POLLING_TIMES&&(t.totalTimes=t.POLLING_TIMES),t.totalTimes--}},{key:"isServiceSupportPolling",value:function(){return!("SuperMap.REST.ThemeService"===this.CLASS_NAME||"SuperMap.REST.EditFeaturesService"===this.CLASS_NAME)}},{key:"transformResult",value:function(t,e){return{result:t=A.transformResult(t),options:e}}},{key:"transformErrorResult",value:function(t,e){return{error:(t=A.transformResult(t)).error||t,options:e}}},{key:"serviceProcessCompleted",value:function(t,e){t=this.transformResult(t).result,this.events.triggerEvent("processCompleted",{result:t,options:e})}},{key:"serviceProcessFailed",value:function(t,e){var r=(t=this.transformErrorResult(t).error).error||t;this.events.triggerEvent("processFailed",{error:r,options:e})}},{key:"_returnContent",value:function(t){return t.scope.format!==Ee.FGB&&!!t.scope.returnContent}},{key:"supportDataFormat",value:function(t){return this.dataFormat().includes(t)}},{key:"dataFormat",value:function(){return[Ee.GEOJSON,Ee.ISERVER]}},{key:"_commit",value:function(t){var e=this;if("POST"===t.method||"PUT"===t.method||"PATCH"===t.method)if(t.params&&(t.url=A.urlAppend(t.url,A.getParameterString(t.params||{}))),"object"!==Rh(t.data)||t.data instanceof FormData)t.params=t.data;else try{t.params=A.toJSON(t.data)}catch(t){console.log("不是json对象")}return Hl.commit(t.method,t.url,t.params,{headers:t.headers,withoutFormatSuffix:t.withoutFormatSuffix,withCredentials:t.withCredentials,crossOrigin:t.crossOrigin,timeout:t.async?0:null,proxy:t.proxy}).then(function(t){return t.text?t.text():t.json?t.json():t}).then(function(e){var r=e;return"string"==typeof e&&(r=(new Zt).read(e)),(!r||r.error||r.code>=300&&304!==r.code)&&(r=r&&r.error?{error:r.error}:{error:r}),r&&t.scope.format===Ee.FGB&&(r.newResourceLocation=r.newResourceLocation.replace(".json","")+".fgb"),r}).catch(function(t){return{error:t}}).then(function(r){var n={object:e};if(r.error){var o="processFailed";if(e.events&&e.events.listeners[o]&&e.events.listeners[o].length){var i=t.failure&&(t.scope?d.bind(t.failure,t.scope):t.failure);i?i(r,t):e.serviceProcessFailed(r,t)}else(n=Th(Th({},n),e.transformErrorResult(r,t))).type=o,t.failure&&t.failure(n)}else{var a="processCompleted";if(e.events&&e.events.listeners[a]&&e.events.listeners[a].length){var s=t.success&&(t.scope?d.bind(t.success,t.scope):t.success);s?s(r,t):e.serviceProcessCompleted(r,t)}else r.succeed=void 0==r.succeed||r.succeed,(n=Th(Th({},n),e.transformResult(r,t))).type=a,t.success&&t.success(n)}return n})}}])&&Ah(e.prototype,r),n&&Ah(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Lh(t){"@babel/helpers - typeof";return(Lh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Nh(){Nh=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new _(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return x()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===c)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var c={};function f(){}function h(){}function p(){}var y={};s(y,o,function(){return this});var d=Object.getPrototypeOf,b=d&&d(d(P([])));b&&b!==e&&r.call(b,o)&&(y=b);var v=p.prototype=f.prototype=Object.create(y);function m(t){["next","throw","return"].forEach(function(e){s(t,e,function(t){return this._invoke(e,t)})})}function g(t,e){var n;this._invoke=function(o,i){function a(){return new e(function(n,a){!function n(o,i,a,s){var u=l(t[o],t,i);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==Lh(f)&&r.call(f,"__await")?e.resolve(f.__await).then(function(t){n("next",t,a,s)},function(t){n("throw",t,a,s)}):e.resolve(f).then(function(t){c.value=t,a(c)},function(t){return n("throw",t,a,s)})}s(u.arg)}(o,i,n,a)})}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,c;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function Ih(t){return function(t){if(Array.isArray(t))return Dh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Dh(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dh(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dh(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function Wh(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function Yh(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:"id";return tp()(t,e)}function up(t){return t.hasOwnProperty("start")&&t.hasOwnProperty("end")}function lp(t,e,r){var n=t.id,o=t.properties,i=t.lables,a=e?function(t,e){if(!e)return{};for(var r=t.id,n=t.labels,o=e.filter(function(t){return"entity"===t.type}),i=0;it.length)&&(e=t.length);for(var r=0,n=new Array(e);r\n
  • 展开
  • \n ":"
      \n
    • 折叠
    • \n
    ":void 0}},handleMenuClick:function(e,r){switch(e.id.split("-")[0]){case"hide":t.hideItem(r);break;case"expand":t.expandNode(r);break;case"collapse":t.collapseNode(r);break;case"show":t.showItem(r)}},offsetX:26,offsetY:0,itemTypes:["node","edge","canvas"]})}},{key:"_getGraphConfig",value:function(t){var e=this,r={speed:120,maxIteration:83,tick:function(){e.refreshPositions()}},n={type:"fruchterman",gravity:5},o={},i={type:"line",style:{endArrow:{path:"M 0,0 L 4,2 L 4,-2 Z",fill:"#e0e0e0"},lineWidth:.5},labelCfg:{autoRotate:!0,style:{fontSize:4,fill:"#333"}}},a={default:["drag-canvas","zoom-canvas","drag-node"]},s=this._getContextMenu(),u=[new(yp().ToolBar),s],l={lineWidth:3,stroke:"#b4d6ff"},c={stroke:"#b4d6ff",shadowColor:"#b4d6ff",shadowBlur:5,endArrow:{path:"M 0,0 L 4,2 L 4,-2 Z",fill:"#b4d6ff"}};if(!t)return this._setToolBarStyle(),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"knowledgeGraph",e=document.querySelector("#".concat(t));return{container:t,width:e.scrollWidth,height:e.scrollHeight,plugins:u,modes:a,layout:wp(wp({},n),r),defaultNode:o,defaultEdge:i,nodeStateStyles:{hover:l},edgeStateStyles:{hover:c}}}();t.container=t.container||"knowledgeGraph";var f="string"==typeof t.container?document.querySelector("#".concat(t.container)):t.container;return t.width=t.width||f.scrollWidth,t.height=t.height||f.scrollHeight,t.layout=wp(wp(wp({},n),t.layout||{}),!1!==t.animate?r:{}),t.defaultNode=wp(wp({},o),t.defaultNode||{}),t.defaultEdge=wp(wp({},i),t.defaultEdge||{}),t.modes={default:[!1!==t.dragCanvas&&"drag-canvas",!1!==t.zoomCanvas&&"zoom-canvas",!1!==t.dragNode&&"drag-node"]},t.nodeStateStyles={hover:wp(wp({},l),t.nodeHighlightStyle||{})},t.edgeStateStyles={hover:wp(wp({},c),t.edgeHighlightStyle||{})},!1!==t.showToolBar&&(t.plugins=[new(yp().ToolBar)],this._setToolBarStyle()),!1!==t.showContextMenu&&(t.plugins=[].concat(vp(t.plugins||[]),[s]),this._setToolBarStyle()),t}},{key:"changeSize",value:function(t,e){return this.graph.changeSize(t,e)}},{key:"autoResize",value:function(){var t=this,e=this.getContainer();window.addEventListener("resize",function(){var r=e.scrollWidth,n=e.scrollHeight;t.graph.changeSize(r,n),t.graph.refresh()})}},{key:"zoom",value:function(t,e,r,n){this.graph.zoom(t,e,r,n)}},{key:"zoomTo",value:function(t,e,r,n){this.graph.zoomTo(t,e,r,n)}},{key:"fitView",value:function(t,e,r,n){this.graph.fitView(t,e,r,n)}},{key:"fitCenter",value:function(t,e){this.graph.fitCenter(t,e)}},{key:"getGraphCenterPoint",value:function(){return this.graph.getGraphCenterPoint()}},{key:"getViewPortCenterPoint",value:function(){return this.graph.getViewPortCenterPoint()}},{key:"getZoom",value:function(){return this.graph.getZoom()}},{key:"getMinZoom",value:function(){return this.graph.getMinZoom()}},{key:"setMinZoom",value:function(t){this.graph.setMinZoom(t)}},{key:"getMaxZoom",value:function(){return this.graph.getMaxZoom()}},{key:"setMaxZoom",value:function(t){this.graph.setMaxZoom(t)}},{key:"getWidth",value:function(){return this.graph.getWidth()}},{key:"getHeight",value:function(){return this.graph.getHeight()}},{key:"setCenter",value:function(t){var e=this.graph.getWidth()/2,r=this.graph.getHeight()/2,n=this.graph.getCanvasByPoint(t.x,t.y);this.graph.translate(e-n.x,r-n.y)}},{key:"_setToolBarStyle",value:function(){bp()("\n .g6-component-toolbar li[code='redo'],\n .g6-component-toolbar li[code='undo'],\n .g6-component-toolbar li[code='realZoom'] {\n display: none;\n }\n .g6-component-contextmenu {\n position: absolute;\n z-index: 2;\n list-style-type: none;\n border-radius: 6px;\n font-size: 14px;\n width: fit-content;\n transition: opacity .2s;\n text-align: center;\n box-shadow: 0 5px 18px 0 rgba(0, 0, 0, 0.6);\n border: 0px;\n }\n .g6-component-contextmenu ul {\n padding-left: 0px;\n margin: 0;\n }\n .g6-component-contextmenu li {\n cursor: pointer;\n list-style-type: none;\n list-style: none;\n margin-left: 0;\n line-height: 38px;\n padding: 0px 35px;\n }\n .g6-component-contextmenu li:hover {\n color: #333;\n background: #aaaaaa45;\n }\n ")}},{key:"highlightNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t.on("node:mouseenter",function(e){var r=e.item;t.setAutoPaint(!1),t.getNodes().forEach(function(e){t.clearItemStates(e)}),t.setItemState(r,"hover",!0),t.paint(),t.setAutoPaint(!0)}),t.on("node:mouseleave",function(){t.setAutoPaint(!1),t.getNodes().forEach(function(e){t.clearItemStates(e)}),t.paint(),t.setAutoPaint(!0)})}},{key:"highlightEdge",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t.on("edge:mouseenter",function(e){var r=e.item;t.setAutoPaint(!1),t.getNodes().forEach(function(e){t.clearItemStates(e)}),t.setItemState(r,"hover",!0),t.paint(),t.setAutoPaint(!0)}),t.on("edge:mouseleave",function(){t.setAutoPaint(!1),t.getEdges().forEach(function(e){t.clearItemStates(e)}),t.paint(),t.setAutoPaint(!0)})}},{key:"setData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph;this.data?e.changeData(t):e.data(t),this.data=t}},{key:"render",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).render()}},{key:"updateGraph",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph;this.data=t,e.changeData(t)}},{key:"refresh",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).refresh()}},{key:"getContainer",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).getContainer()}},{key:"getCanvas",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).get("canvas")}},{key:"getNodes",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).getNodes()}},{key:"getEdges",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).getEdges()}},{key:"getNeighbors",value:function(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).getNeighbors(t,e)}},{key:"findById",value:function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph).findById(t)}},{key:"find",value:function(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).find(t,e)}},{key:"findAll",value:function(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).findAll(t,e)}},{key:"getEdgesByNode",value:function(t){return t.getEdges()}},{key:"getInEdges",value:function(t){return t.getInEdges()}},{key:"getOutEdges",value:function(t){return t.getOutEdges()}},{key:"getSourceByEdge",value:function(t){return t.getSource()}},{key:"getTargetByEdge",value:function(t){return t.getTarget()}},{key:"expandNode",value:function(t){var e=t.getModel().id;this._expandCollapseNode(this.collpasedData[e],"show"),delete this.collpasedData[e]}},{key:"collapseNode",value:function(t){var e=t.getModel().id,r=[];this._collapseFunc(t,r),this.collpasedData[e]=r,this._expandCollapseNode(r)}},{key:"isCollpased",value:function(t){return!!this.collpasedData[t]}},{key:"_collapseFunc",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=this.getNeighbors(t,"target"),n=this.getNeighbors(t,"source"),o=0;o1&&void 0!==arguments[1]?arguments[1]:"hide";t&&t.forEach(function(t){"hide"===r?e.hideItem(t.id):(e.showItem(t.id),e.isCollpased(t.id)&&delete e.collpasedData[t.id]),t.children&&e._expandCollapseNode(t.children,r)})}},{key:"showItem",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).showItem(t,e)}},{key:"hideItem",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).hideItem(t,e)}},{key:"show",value:function(t){t.show()}},{key:"hide",value:function(t){t.hide()}},{key:"changeVisibility",value:function(t,e){t.changeVisibility(e)}},{key:"isVisible",value:function(t){return t.isVisible()}},{key:"getModel",value:function(t){return t.getModel()}},{key:"addItem",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).addItem(t,e)}},{key:"removeItem",value:function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph).removeItem(t)}},{key:"updateItem",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).updateItem(t,e)}},{key:"refreshItem",value:function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph).refreshItem(t)}},{key:"refreshPositions",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).refreshPositions()}},{key:"on",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).on(t,e)}},{key:"off",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).off(t,e)}},{key:"toDataURL",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).toDataURL(t,e)}},{key:"bindNodeDefaultDragEvent",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t.on("node:dragstart",function(t){Pp(t)}),t.on("node:drag",function(t){Pp(t)}),t.on("node:dragend",function(t){t.item.get("model").fx=null,t.item.get("model").fy=null})}},{key:"stopDefaultEventPropagation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t.on("click",function(t){t.stopPropagation()}),t.on("mousedown",function(t){t.stopPropagation()}),t.on("mouseover",function(t){t.stopPropagation()}),t.on("mouseout",function(t){t.stopPropagation()})}},{key:"clear",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).clear()}},{key:"destroy",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).destroy()}}])&&Sp(e.prototype,r),n&&Sp(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Pp(t){var e=t.item.get("model");return e.fx=t.x,e.fy=t.y,e.x=t.x,e.y=t.y,e}var xp=r(2138),kp=r.n(xp);function jp(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:"G6";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.graph=null,this.config=kp()(e),this.graphRender=null,this.type=r,this.createGraphRender(this.type),this.config=this.graphRender._getGraphConfig(this.config),this.createGraph(this.config),this.CLASS_NAME="SuperMap.KnowledgeGraph"}var e,r,n;return e=t,n=[{key:"dataFromGraphMap",value:function(t,e){return ap(t,e)}},{key:"dataFromKnowledgeGraphQuery",value:function(t){return ap(t)}}],(r=[{key:"handleNodeStatus",value:function(t){var e=t.expand,r=t.collapse,n=t.hidden;this.expandNodes(e),this.collapseNodes(r),this.hideNodes(n)}},{key:"expandNodes",value:function(t){var e=this;t&&t.forEach(function(t){e.expandNode(t+"")})}},{key:"collapseNodes",value:function(t){var e=this;t&&t.forEach(function(t){e.collapseNode(t+"")})}},{key:"hideNodes",value:function(t){var e=this;t&&t.forEach(function(t){e.hideItem(t+"")})}},{key:"createGraphRender",value:function(t){"G6"===t&&(this.graphRender=new _p)}},{key:"createGraph",value:function(t){var e=this.initGraph(t);return this.graph=e,this.autoResize(),e}},{key:"getGraph",value:function(){return this.graph}},{key:"autoResize",value:function(){this.config&&!1!==this.config.autoResize&&this.graphRender.autoResize()}},{key:"zoom",value:function(t,e,r,n){this.graphRender.zoom(t,e,r,n)}},{key:"zoomTo",value:function(t,e,r,n){this.graphRender.zoomTo(t,e,r,n)}},{key:"fitView",value:function(t,e,r,n){this.graphRender.fitView(t,e,r,n)}},{key:"fitCenter",value:function(t,e){this.graphRender.fitCenter(t,e)}},{key:"getGraphCenterPoint",value:function(){return this.graphRender.getGraphCenterPoint()}},{key:"getViewPortCenterPoint",value:function(){return this.graphRender.getViewPortCenterPoint()}},{key:"getZoom",value:function(){return this.graphRender.getZoom()}},{key:"getMinZoom",value:function(){return this.graphRender.getMinZoom()}},{key:"setMinZoom",value:function(t){this.graphRender.setMinZoom(t)}},{key:"getMaxZoom",value:function(){return this.graphRender.getMaxZoom()}},{key:"setMaxZoom",value:function(t){this.graphRender.setMaxZoom(t)}},{key:"getWidth",value:function(){return this.graphRender.getWidth()}},{key:"getHeight",value:function(){return this.graphRender.getHeight()}},{key:"initGraph",value:function(t){var e=this,r=this.graphRender.initGraph(t);this.graph=r;return this.graph.on("beforelayout",function(){void 0!==e.config.zoom&&e.zoom(e.config.zoom),void 0!==e.config.center&&e.graphRender.setCenter({x:e.config.center[0],y:e.config.center[1]})}),r}},{key:"setData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph;t=t||{nodes:[],edges:[]},this.config&&this.config.nodeLabelMaxWidth&&(t.nodes=this.nodeLabelOpenEllipsis(this.config.nodeLabelMaxWidth,t.nodes)),this.graphRender.setData(t,e),this.render(e),this.data=t}},{key:"render",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t&&this.graphRender.render(t)}},{key:"updateGraph",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph;e&&this.graphRender.updateGraph(t,e)}},{key:"refresh",value:function(){return this.graphRender.refresh()}},{key:"changeSize",value:function(t,e){return this.graphRender.changeSize(t,e)}},{key:"resize",value:function(t,e){this.graphRender.changeSize(t,e),this.graphRender.refresh()}},{key:"getContainer",value:function(){return this.graphRender.getContainer()}},{key:"getCanvas",value:function(){return this.graphRender.getCanvas()}},{key:"getNodes",value:function(){return this.graphRender.getNodes()}},{key:"getEdges",value:function(){return this.graphRender.getEdges()}},{key:"getNeighbors",value:function(t,e){return this.graphRender.getNeighbors(t,e)}},{key:"findById",value:function(t){return this.graphRender.findById(t)}},{key:"find",value:function(t,e){return this.graphRender.find(t,e)}},{key:"findAll",value:function(t,e){return this.graphRender.findAll(t,e)}},{key:"getEdgesByNode",value:function(t){return this.graphRender.getEdgesByNode(t)}},{key:"getInEdges",value:function(t){return this.graphRender.getInEdges(t)}},{key:"getOutEdges",value:function(t){return this.graphRender.getOutEdges(t)}},{key:"getSourceByEdge",value:function(t){return this.graphRender.getSourceByEdge(t)}},{key:"getTargetByEdge",value:function(t){return this.graphRender.getTargetByEdge(t)}},{key:"expandNode",value:function(t){var e=this.findById(t);e&&this.graphRender.expandNode(e)}},{key:"collapseNode",value:function(t){var e=this.findById(t);e&&this.graphRender.collapseNode(e)}},{key:"showItem",value:function(t,e){this.graphRender.showItem(t,e)}},{key:"hideItem",value:function(t,e){this.graphRender.hideItem(t,e)}},{key:"show",value:function(t){this.graphRender.show(t)}},{key:"hide",value:function(t){this.graphRender.hide(t)}},{key:"changeVisibility",value:function(t,e){this.graphRender.changeVisibility(t,e)}},{key:"isVisible",value:function(t){return this.graphRender.isVisible(t)}},{key:"getModel",value:function(t){return this.graphRender.getModel(t)}},{key:"addItem",value:function(t,e){return this.graphRender.addItem(t,e)}},{key:"removeItem",value:function(t){return this.graphRender.removeItem(t)}},{key:"updateItem",value:function(t,e){return this.graphRender.updateItem(t,e)}},{key:"refreshItem",value:function(t){return this.graphRender.refreshItem(t)}},{key:"refreshPositions",value:function(){return this.graphRender.refreshPositions()}},{key:"on",value:function(t,e){this.graphRender.on(t,e)}},{key:"off",value:function(t,e){this.graphRender.off(t,e)}},{key:"toDataURL",value:function(t,e){this.graphRender.toDataURL(t,e)}},{key:"nodeLabelOpenEllipsis",value:function(t,e){var r=this;return e?t?e.map(function(e){var n=e.labelCfg&&e.labelCfg.fontSize||r.defaultNode&&r.defaultNode.labelCfg&&r.defaultNode.labelCfg.fontSize||14;return e.label=function(t,e,r){var n=1*r;e*=1.6;if(function(t){for(var e=0,r=0;r0&&t.charCodeAt(r)<128?e++:e+=2;return e}(t)*n>e){var o=Math.floor((e-20)/n),i=t.substring(0,o);return(t.substring(o).length+"…".length)*n>e?i+"\n"+t.substring(o,o+o-2)+"…":0==t.substring(o).length?i:i+"\n"+t.substring(o)}return t}(e.label,t,n),e}):e:[]}},{key:"clear",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t&&t.clear()}},{key:"destroy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t&&t.destroy()}}])&&jp(e.prototype,r),n&&jp(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Tp(t){"@babel/helpers - typeof";return(Tp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Cp(){Cp=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new _(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return x()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===c)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var c={};function f(){}function h(){}function p(){}var y={};s(y,o,function(){return this});var d=Object.getPrototypeOf,b=d&&d(d(P([])));b&&b!==e&&r.call(b,o)&&(y=b);var v=p.prototype=f.prototype=Object.create(y);function m(t){["next","throw","return"].forEach(function(e){s(t,e,function(t){return this._invoke(e,t)})})}function g(t,e){var n;this._invoke=function(o,i){function a(){return new e(function(n,a){!function n(o,i,a,s){var u=l(t[o],t,i);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==Tp(f)&&r.call(f,"__await")?e.resolve(f.__await).then(function(t){n("next",t,a,s)},function(t){n("throw",t,a,s)}):e.resolve(f).then(function(t){c.value=t,a(c)},function(t){return n("throw",t,a,s)})}s(u.arg)}(o,i,n,a)})}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,c;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function Rp(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function Ap(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0}function ay(t){var e,r=function(t){var e,r,n=t.paint,o=void 0===n?{}:n,i=t.layout,a=void 0===i?{}:i,s=Object.keys(o).concat(Object.keys(a)),u=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ty(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(oy);try{var l=function(){var t=r.value,n=s.some(function(e){return e.startsWith(t.prefix)});if(n)return e=t.type,"break"};for(u.s();!(r=u.n()).done;){var c=l();if("break"===c)break}}catch(t){u.e(t)}finally{u.f()}return e||ny.symbol}(t);return(ry(e={},ny.symbol,{type:"layout",name:"icon-image"}),ry(e,ny.line,{type:"paint",name:"line-pattern"}),ry(e,ny.fill,{type:"paint",name:"fill-pattern"}),e)[r]}var sy=["array","boolean","collator","format","literal","number","object","string","to-boolean","to-color","to-number","to-string","typeof","feature-state","geometry-type","id","line-progress","properties","at","get","has","length","!","!=","<","<=","==",">",">=","all","any","case","match","coalesce","interpolate","interpolate-hcl","interpolate-lab","step","let","var","concat","downcase","is-supported-script","resolved-locale","upcase","rgb","rgba","-","*","/","%","^","+","abs","acos","asin","atan","ceil","cos","e","floor","ln","ln2","log10","log2","max","min","pi","round","sin","sqrt","tan","zoom","heatmap-density"];function uy(t){if(t&&t.length>0){var e=$p(t,1)[0];return"string"==typeof e&&sy.includes(e)}return!1}function ly(t){return Object.keys(t).every(function(e){return!uy(t[e])})}function cy(t){return(iy(t)?t:[t]).every(function(t){return ly(t.paint||{})&&ly(t.layout||{})})}var fy=function(t){return["background-color","background-color-transition","background-pattern","background-pattern-transition","background-opacity","background-opacity-transition","fill-antialias","fill-opacity","fill-opacity-transition","fill-color","fill-color-transition","fill-outline-color","fill-outline-color-transition","fill-translate","fill-translate-transition","fill-translate-anchor","fill-pattern","fill-pattern-transition","fill-extrusion-opacity","fill-extrusion-opacity-transition","fill-extrusion-color","fill-extrusion-color-transition","fill-extrusion-translate","fill-extrusion-translate-transition","fill-extrusion-translate-anchor","fill-extrusion-pattern","fill-extrusion-pattern-transition","fill-extrusion-height","fill-extrusion-height-transition","fill-extrusion-base","fill-extrusion-base-transition","fill-extrusion-vertical-gradient","line-opacity","line-opacity-transition","line-color","line-color-transition","line-translate","line-translate-transition","line-translate-anchor","line-width","line-width-transition","line-gap-width","line-gap-width-transition","line-offset","line-offset-transition","line-blur","line-blur-transition","line-dasharray","line-dasharray-transition","line-pattern","line-pattern-transition","line-gradient","icon-opacity","icon-opacity-transition","icon-color","icon-color-transition","icon-halo-color","icon-halo-color-transition","icon-halo-width","icon-halo-width-transition","icon-halo-blur","icon-halo-blur-transition","icon-translate","icon-translate-transition","icon-translate-anchor","text-opacity","text-opacity-transition","text-color","text-color-transition","text-halo-color","text-halo-color-transition","text-halo-width","text-halo-width-transition","text-halo-blur","text-halo-blur-transition","text-translate","text-translate-transition","text-translate-anchor","raster-opacity","raster-opacity-transition","raster-hue-rotate","raster-hue-rotate-transition","raster-brightness-min","raster-brightness-min-transition","raster-brightness-max","raster-brightness-max-transition","raster-saturation","raster-saturation-transition","raster-contrast","raster-contrast-transition","raster-fade-duration","raster-resampling","circle-sort-key","circle-radius","circle-radius-transition","circle-color","circle-color-transition","circle-blur","circle-blur-transition","circle-opacity","circle-opacity-transition","circle-translate","circle-translate-transition","circle-translate-anchor","circle-pitch-scale","circle-pitch-alignment","circle-stroke-width","circle-stroke-width-transition","circle-stroke-color","circle-stroke-color-transition","circle-stroke-opacity","circle-stroke-opacity-transition","heatmap-radius","heatmap-radius-transition","heatmap-weight","heatmap-intensity","heatmap-intensity-transition","heatmap-color","heatmap-opacity","heatmap-opacity-transition","hillshade-illumination-direction","hillshade-illumination-anchor","hillshade-exaggeration","hillshade-exaggeration-transition","hillshade-shadow-color","hillshade-shadow-color-transition","hillshade-highlight-color","hillshade-highlight-color-transition","hillshade-accent-color","hillshade-accent-color-transition"].includes(t)};function hy(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function py(t){for(var e=1;e0}},{key:"removeSymbol",value:function(t){this.symbolManager.removeSymbol(t)}},{key:"getSymbol",value:function(t){return this.symbolManager.getSymbol(t)}},{key:"getLayerIds",value:function(t){return this.compositeSymbolRender.getLayerIds(t)||[]}},{key:"getLayerId",value:function(t){return this.compositeSymbolRender.getLayerId(t)}},{key:"removeLayerId",value:function(t){return this.compositeSymbolRender.removeLayerId(t)}},{key:"getLayer",value:function(t){var e=this.map.getLayerBySymbolBak(t),r=this.getLayerSymbol(t);if(e)return r?py(py({},e),{},{symbol:r}):e;var n=this.getLayerIds(t);if(n[0]){var o=this.map.getLayerBySymbolBak(n[0]);return o&&py(py({},o),{},{symbol:r,id:t})}}},{key:"removeLayer",value:function(t){var e=this,r=this.getLayerIds(t);r.length>0?(r.forEach(function(t){return e.map.style.removeLayer(t)}),this.removeLayerId(t)):this.map.style.removeLayer(t)}},{key:"getStyle",value:function(){var t=this,e=this.map.style.serialize();return this.hasSymbol()&&(e.layers=e.layers.reduce(function(e,r){var n=t.getLayerId(r.id);return n?!e.find(function(t){return t.id===n})&&e.push(py(py({},r),{},{symbol:t.getLayerSymbol(n),id:n})):t.getLayerSymbol(r.id)?e.push(py(py({},r),{},{symbol:t.getLayerSymbol(r.id)})):e.push(r),e},[])),e}},{key:"getFirstLayerId",value:function(t){return this.getLayerIds(t)[0]}},{key:"moveLayer",value:function(t,e){var r=this,n=this.getLayerIds(t),o=e&&this.map.style.getLayer(e),i=o&&o.id||e&&this.getFirstLayerId(e);n.length>0?n.forEach(function(t){return r.map.style.moveLayer(t,i)}):this.map.style.moveLayer(t,i)}},{key:"setFilter",value:function(t,e,r){var n=this;if(uy(this.getLayerSymbol(t))){var o=this.getFirstLayerId(t);this.map.style.setFilter(o,e,r);var i=this.getLayerSymbol(t);this.setSymbol(t,i)}else{var a=this.getLayerIds(t);a.length>0?a.forEach(function(t){return n.map.style.setFilter(t,e,r)}):this.map.style.setFilter(t,e,r)}}},{key:"getFilter",value:function(t){var e=this.getFirstLayerId(t);if(this.map.style.getLayer(e))return this.map.style.getFilter(e)}},{key:"setLayerZoomRange",value:function(t,e,r){var n=this,o=this.getLayerIds(t);o.length>0?o.forEach(function(t){return n.map.style.setLayerZoomRange(t,e,r)}):this.map.style.setLayerZoomRange(t,e,r)}},{key:"setPaintProperty",value:function(t,e,r,n){var o=this,i=this.getLayerIds(t);i.length>0?i.forEach(function(t){return o.map.style.setPaintProperty(t,e,r,n)}):this.map.style.setPaintProperty(t,e,r,n)}},{key:"getPaintProperty",value:function(t,e){var r=this.getFirstLayerId(t);return this.map.style.getPaintProperty(r,e)}},{key:"setLayoutProperty",value:function(t,e,r,n){var o=this,i=this.getLayerIds(t);i.length>0?i.forEach(function(t){return o.map.style.setLayoutProperty(t,e,r,n)}):this.map.style.setLayoutProperty(t,e,r,n)}},{key:"getLayoutProperty",value:function(t,e){var r=this.getFirstLayerId(t);return this.map.style.getLayoutProperty(r,e)}},{key:"updateLayerSymbol",value:function(t){var e=this;Object.keys(this._layerSymbols).forEach(function(r){var n=e._layerSymbols[r];n.includes(t)&&e.setSymbol(r,n)})}},{key:"updateSymbol",value:function(t,e){return this.getSymbol(t)?cy(e)?(this.symbolManager.addSymbol(t,e),void this.updateLayerSymbol(t)):this.map.fire("error",{error:new Error("Symbol is not supported expressions.")}):this.map.fire("error",{error:new Error('Symbol "'.concat(t,'" could not be loaded. Please make sure you have added the symbol with map.addSymbol().'))})}},{key:"setSymbolProperty",value:function(t,e,r,n){var o=this.getSymbol(t);if(!o)return this.map.fire("error",{error:new Error('Symbol "'.concat(t,'" could not be loaded. Please make sure you have added the symbol with map.addSymbol().'))});if(uy(n))return this.map.fire("error",{error:new Error("Symbol value is not supported expressions.")});var i=fy(r)?"paint":"layout";if(o.length>0){var a=o[e];if(!a)return this.map.fire("error",{error:new Error("symbol[".concat(e,"] does not exist."))});a[i]||(a[i]={}),Object.assign(a[i],yy({},r,n))}else o[i]||(o[i]={}),Object.assign(o[i],yy({},r,n));this.symbolManager.addSymbol(t,o),this.updateLayerSymbol(t)}},{key:"getSymbolProperty",value:function(t,e,r){var n=this.getSymbol(t);if(n){var o=fy(r)?"paint":"layout";return n.length>0?n[e]&&n[e][o]&&n[e][o][r]:n[o]&&n[o][r]}this.map.fire("error",{error:new Error('Symbol "'.concat(t,'" could not be loaded. Please make sure you have added the symbol with map.addSymbol().'))})}}])&&dy(e.prototype,r),n&&dy(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function vy(t){"@babel/helpers - typeof";return(vy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function my(){my=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new _(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return x()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===c)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var c={};function f(){}function h(){}function p(){}var y={};s(y,o,function(){return this});var d=Object.getPrototypeOf,b=d&&d(d(P([])));b&&b!==e&&r.call(b,o)&&(y=b);var v=p.prototype=f.prototype=Object.create(y);function m(t){["next","throw","return"].forEach(function(e){s(t,e,function(t){return this._invoke(e,t)})})}function g(t,e){var n;this._invoke=function(o,i){function a(){return new e(function(n,a){!function n(o,i,a,s){var u=l(t[o],t,i);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==vy(f)&&r.call(f,"__await")?e.resolve(f.__await).then(function(t){n("next",t,a,s)},function(t){n("throw",t,a,s)}):e.resolve(f).then(function(t){c.value=t,a(c)},function(t){return n("throw",t,a,s)})}s(u.arg)}(o,i,n,a)})}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,c;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function gy(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function wy(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){gy(i,n,o,a,s,"next",t)}function s(t){gy(i,n,o,a,s,"throw",t)}a(void 0)})}}var Oy=function(){var t=function(t){return o().Map.prototype.symbolHandler||(o().Map.prototype.symbolHandler=new by(t)),o().Map.prototype.symbolHandler._update(t)};function e(){return(e=wy(my().mark(function t(e,r){var n,o,i,a,s,u;return my().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n="".concat(r.basePath,"/").concat(e,"/").concat(e),t.next=4,Hl.get("".concat(n,".json")).then(function(t){return t.ok?t.json():null}).catch(function(){return null});case 4:if(o=t.sent){t.next=7;break}return t.abrupt("return",null);case 7:if(i=o.paint||{},a=o.layout||{},s=i["fill-pattern"]||i["line-pattern"]||a["icon-image"],t.t0=s,!t.t0){t.next=15;break}return t.next=14,new Promise(function(t){var e=new Image;e.src="".concat(n,".png"),e.onload=function(r){t(r?e:null)},e.onerror=function(){t(null)}});case 14:t.t0=t.sent;case 15:return u=t.t0,t.abrupt("return",{value:o,image:u});case 17:case"end":return t.stop()}},t)}))).apply(this,arguments)}function r(r,n){return function(t,r){return e.apply(this,arguments)}(r,n).then(function(e){if(!e)return null;var r=e.value,o=e.image;return o&&t(n).addSymbolImageToMap(r,o),r})}void 0===o().Map.prototype.addLayerBySymbolBak&&(o().Map.prototype.addLayerBySymbolBak=o().Map.prototype.addLayer,o().Map.prototype.addLayer=function(e,r){var n=t(this);if(!(n.getLayerIds(e.id).length>0))return e.symbol?(n.addLayer(e,r),this):(this.addLayerBySymbolBak(e,r),this);this.fire("error",{error:new Error("A layer with this id already exists.")})}),void 0===o().Map.prototype.getLayerBySymbolBak&&(o().Map.prototype.getLayerBySymbolBak=o().Map.prototype.getLayer,o().Map.prototype.getLayer=function(e){return t(this).getLayer(e)}),void 0===o().Map.prototype.moveLayerBySymbolBak&&(o().Map.prototype.moveLayerBySymbolBak=o().Map.prototype.moveLayer,o().Map.prototype.moveLayer=function(e,r){return!this.style.getLayer(e)||r&&!this.style.getLayer(r)?(t(this).moveLayer(e,r),this._update(!0)):this.moveLayerBySymbolBak(e,r)}),void 0===o().Map.prototype.removeLayerBySymbolBak&&(o().Map.prototype.removeLayerBySymbolBak=o().Map.prototype.removeLayer,o().Map.prototype.removeLayer=function(e){return this.style.getLayer(e)?this.removeLayerBySymbolBak(e):t(this).removeLayer(e)}),void 0===o().Map.prototype.setLayoutPropertyBySymbolBak&&(o().Map.prototype.setLayoutPropertyBySymbolBak=o().Map.prototype.setLayoutProperty,o().Map.prototype.setLayoutProperty=function(e,r,n,o){return this.overlayLayersManager[e]||this.style.getLayer(e)?this.setLayoutPropertyBySymbolBak(e,r,n,o):(t(this).setLayoutProperty(e,r,n,o),this._update(!0))}),o().Map.prototype.setSymbol=function(e,r){t(this).setSymbol(e,r)},o().Map.prototype.setStyleBak||(o().Map.prototype.setStyleBak=o().Map.prototype.setStyle,o().Map.prototype.setStyle=function(t,e){var r=this;return this.setStyleBak(t,e),this.style&&this.style.once("style.load",function(){t.layers.filter(function(t){return t.symbol}).forEach(function(t){r.setSymbol(t.id,t.symbol)})}),this}),o().Map.prototype.loadSymbol=(n=wy(my().mark(function t(e,n){var o,i,a,s,u,l,c=this;return my().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("string"!=typeof e){t.next=9;break}return t.next=3,r(e,this);case 3:o=t.sent,i=null,o||(i="Symbol ".concat(e," is not exists")),n(i,o),t.next=21;break;case 9:if(!A.isArray(e)){t.next=20;break}return a=e.map(function(t){return r(t,c)}),t.next=13,Promise.all(a);case 13:s=t.sent,u=null,(l=e.filter(function(t,e){return!s[e]})).length>0&&(u="Symbol ".concat(l.join(",")," is not exists")),n(u,s),t.next=21;break;case 20:n({message:"Symbol id must be a string or string[]."});case 21:case"end":return t.stop()}},t,this)})),function(t,e){return n.apply(this,arguments)}),o().Map.prototype.addSymbol=function(e,r){t(this).addSymbol(e,r)},o().Map.prototype.getSymbol=function(e){return t(this).getSymbol(e)},o().Map.prototype.hasSymbol=function(t){return t?!!this.getSymbol(t):(this.fire("error",{error:new Error("Missing required symbol id")}),!1)},o().Map.prototype.removeSymbol=function(e){t(this).removeSymbol(e)},o().Map.prototype.updateSymbol=function(e,r){t(this).updateSymbol(e,r)},o().Map.prototype.setSymbolProperty=function(e,r,n,o){t(this).setSymbolProperty(e,r,n,o)},o().Map.prototype.getSymbolProperty=function(e,r,n){return t(this).getSymbolProperty(e,r,n)},o().Map.prototype.getStyle=function(){if(this.style)return t(this).getStyle()},o().Map.prototype.setFilter=function(e,r,n){return this.style.getLayer(e)?(this.style.setFilter(e,r,n),this._update(!0)):(t(this).setFilter(e,r,n),this._update(!0))},o().Map.prototype.getFilter=function(e){return this.style.getLayer(e)?this.style.getFilter(e):t(this).getFilter(e)},o().Map.prototype.setLayerZoomRange=function(e,r,n){return this.style.getLayer(e)?(this.style.setLayerZoomRange(e,r,n),this._update(!0)):(t(this).setLayerZoomRange(e,r,n),this._update(!0))},o().Map.prototype.setPaintProperty=function(e,r,n,o){return this.style.getLayer(e)?(this.style.setPaintProperty(e,r,n,o),this._update(!0)):(t(this).setPaintProperty(e,r,n,o),this._update(!0))},o().Map.prototype.getPaintProperty=function(e,r){return this.style.getLayer(e)?this.style.getPaintProperty(e,r):t(this).getPaintProperty(e,r)},o().Map.prototype.getLayoutProperty=function(e,r){return this.style.getLayer(e)?this.style.getLayoutProperty(e,r):t(this).getLayoutProperty(e,r)},void 0===o().Map.prototype.onBak&&(o().Map.prototype.onBak=o().Map.prototype.on,o().Map.prototype.on=function(e,r,n){var o=this;return void 0===n||this.style.getLayer(r)?this.onBak(e,r,n):(t(this).getLayerIds(r).forEach(function(t){return o.onBak(e,t,n)}),this)}),void 0===o().Map.prototype.onceBak&&(o().Map.prototype.onceBak=o().Map.prototype.once,o().Map.prototype.once=function(e,r,n){var o=this;return void 0===n||this.style.getLayer(r)?this.onceBak(e,r,n):(t(this).getLayerIds(r).forEach(function(t){return o.onceBak(e,t,n)}),this)}),void 0===o().Map.prototype.offBak&&(o().Map.prototype.offBak=o().Map.prototype.off,o().Map.prototype.off=function(e,r,n){var o=this;return void 0===n||this.style.getLayer(r)?this.offBak(e,r,n):(t(this).getLayerIds(r).forEach(function(t){return o.offBak(e,t,n)}),this)});var n};function Sy(t,e){for(var r=0;r=0){var e=JSON.parse(t.data);return t.filterParam=e,t.eventType="setFilterParamSucceeded",void this.events.triggerEvent("setFilterParamSucceeded",t)}var r=JSON.parse(t.data);t.featureResult=r,t.eventType="messageSucceeded",this.events.triggerEvent("messageSucceeded",t)}},{key:"_connect",value:function(t){return t=jh.appendCredential(t),"WebSocket"in window?new WebSocket(t):"MozWebSocket"in window?new(0,window.MozWebSocket)(t):(console.log("no WebSocket"),null)}}])&&xd(e.prototype,r),n&&xd(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Rd(t){"@babel/helpers - typeof";return(Rd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ad(t,e){for(var r=0;r=0&&n.toIndex>=0&&!o&&(n.url=A.urlAppend(n.url,"fromIndex=".concat(n.fromIndex,"&toIndex=").concat(n.toIndex))),n.returnContent&&(t.returnCountOnly||t.returnDatasetInfoOnly||t.returnFeaturesOnly||console.warn("recommend set returnFeaturesOnly config to true to imporve performance. if need get Total amount and Dataset information. FeatureService provide getFeaturesCount and getFeaturesDatasetInfo method"),t.returnCountOnly&&(n.url=A.urlAppend(n.url,"&returnCountOnly="+t.returnCountOnly)),t.returnDatasetInfoOnly&&(n.url=A.urlAppend(n.url,"&returnDatasetInfoOnly="+t.returnDatasetInfoOnly)),t.returnFeaturesOnly&&(n.url=A.urlAppend(n.url,"&returnFeaturesOnly="+t.returnFeaturesOnly))),r=n.getJsonParameters(t),n.request({method:"POST",data:r,scope:n,success:e,failure:e})}}},{key:"transformResult",value:function(t,e){t=A.transformResult(t);var r=new xr;(this.format===Ee.GEOJSON&&t.features&&(t.features=r.toGeoJSON(t.features)),this.returnFeaturesOnly&&Array.isArray(t))&&(t={succeed:t.succeed,features:r.toGeoJSON(t)});return{result:t,options:e}}},{key:"dataFormat",value:function(){return[Ee.GEOJSON,Ee.ISERVER,Ee.FGB]}}])&&Cb(e.prototype,r),n&&Cb(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Db(t,e){for(var r=0;r0;)t.fields.pop();t.fields=null}}}])&&zb(e.prototype,r),n&&zb(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Qb(t){"@babel/helpers - typeof";return(Qb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Xb(t,e){for(var r=0;r0;)t.fields.pop();t.fields=null}t.attributeFilter=null,t.spatialQueryMode=null,t.getFeatureMode=null}}])&&mv(e.prototype,r),n&&mv(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function xv(t){"@babel/helpers - typeof";return(xv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function kv(t,e){for(var r=0;r0;)t.fields.pop();t.fields=null}t.geometry&&(t.geometry.destroy(),t.geometry=null)}}])&&Mv(e.prototype,r),n&&Mv(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Gv(t){"@babel/helpers - typeof";return(Gv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Uv(t,e){for(var r=0;r0;)t.fields.pop();t.fields=null}t.attributeFilter=null,t.spatialQueryMode=null,t.getFeatureMode=null}}])&&Yv(e.prototype,r),n&&Yv(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function em(t){"@babel/helpers - typeof";return(em="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rm(t,e){for(var r=0;r0)for(var e in t.items)t.items[e].destroy(),t.items[e]=null;t.items=null}t.defaultStyle&&(t.defaultStyle.destroy(),t.defaultStyle=null)}},{key:"toServerJSONObject",value:function(){var t={};if((t=A.copyAttributes(t,this)).defaultStyle&&t.defaultStyle.toServerJSONObject&&(t.defaultStyle=t.defaultStyle.toServerJSONObject()),t.items){for(var e=[],r=t.items.length,n=0;n0)for(var e in t.items)t.items[e].destroy(),t.items[e]=null;t.items=null}t.rangeExpression=null,t.rangeMode=null,t.rangeParameter=null,t.colorGradientType=null}}])&&aO(e.prototype,r),n&&aO(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function pO(t,e){for(var r=0;r0?t[0].subLayers.layers:null)?r.length:0,this.handleLayers(n,r),{result:t[0],options:e}}},{key:"handleLayers",value:function(t,e){var r;if(t)for(var n=0;n0)this.handleLayers(e[n].subLayers.layers.length,e[n].subLayers.layers);else switch(e[n].ugcLayerType){case"THEME":(r=new BO).fromJson(e[n]),e[n]=r;break;case"GRID":(r=new YO).fromJson(e[n]),e[n]=r;break;case"IMAGE":(r=new eS).fromJson(e[n]),e[n]=r;break;case"VECTOR":(r=new uS).fromJson(e[n]),e[n]=r}}}}])&&cS(e.prototype,r),n&&cS(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function vS(t){"@babel/helpers - typeof";return(vS="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function mS(t,e){for(var r=0;r0&&(n+='"subLayers":'+t.toJSON()),n+=',"visible":true,',n+='"name":"'+this.getMapName(this.mapUrl)+'"',n+="}]",r.request({method:"PUT",data:n,scope:r,success:e,failure:e})}}},{key:"createTempLayerComplete",value:function(t,e){return e.result=A.transformResult(e.result),e.result.succeed&&(this.lastparams.resourceID=e.result.newResourceID),this.processAsync(this.lastparams,t)}},{key:"getMapName",value:function(t){var e=t;"/"===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1));var r=e.lastIndexOf("/");return e.substring(r+1,e.length)}},{key:"transformResult",value:function(t,e){return null!=(t=A.transformResult(t))&&null!=this.lastparams&&null!=this.lastparams.resourceID&&(t.newResourceID=this.lastparams.resourceID),{result:t,options:e}}}])&&VS(e.prototype,r),n&&VS(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function ZS(t,e){for(var r=0;r=200&&t.code<300||0==t.code||304===t.code,n=t.code&&r;return!t.code||n?{result:t,options:e}:{error:t,options:e}}}])&&a_(e.prototype,r),n&&a_(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function p_(t){"@babel/helpers - typeof";return(p_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function y_(t,e){for(var r=0;r0&&(r+=","),r+='{"x":'+e[o].x+',"y":'+e[o].y+"}";else if(!0===t)for(var i=0;i0&&(r+=","),r+=e[i];return r+="]"}}])&&fP(e.prototype,r),n&&fP(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function vP(t,e){for(var r=0;r0&&(r+=","),r+='{"x":'+e[o].x+',"y":'+e[o].y+"}";else if(!0===t)for(var i=0;i0&&(r+=","),r+=e[i];return r+="]"}},{key:"toGeoJSONResult",value:function(t){if(!t||!t.facilityPathList)return t;var e=new xr;return t.facilityPathList.map(function(t){return t.route&&(t.route=e.toGeoJSON(t.route)),t.pathGuideItems&&(t.pathGuideItems=e.toGeoJSON(t.pathGuideItems)),t.edgeFeatures&&(t.edgeFeatures=e.toGeoJSON(t.edgeFeatures)),t.nodeFeatures&&(t.nodeFeatures=e.toGeoJSON(t.nodeFeatures)),t}),t}}])&&WP(e.prototype,r),n&&WP(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function $P(t,e){for(var r=0;r0&&(e+=","),e+=A.toJSON(t[n]);return e+="]"}},{key:"toGeoJSONResult",value:function(t){if(!t)return null;var e=new xr;return t.demandResults&&(t.demandResults=e.toGeoJSON(t.demandResults)),t.supplyResults&&(t.supplyResults=e.toGeoJSON(t.supplyResults)),t}}])&&rx(e.prototype,r),n&&rx(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function ux(t,e){for(var r=0;r0&&(r+=","),r+='{"x":'+e[o].x+',"y":'+e[o].y+"}";else if(!0===t)for(var i=0;i0&&(r+=","),r+=e[i];return r+="]"}},{key:"toGeoJSONResult",value:function(t){if(!t||!t.pathList)return null;var e=new xr;return t.pathList.map(function(t){return t.route&&(t.route=e.toGeoJSON(t.route)),t.pathGuideItems&&(t.pathGuideItems=e.toGeoJSON(t.pathGuideItems)),t.edgeFeatures&&(t.edgeFeatures=e.toGeoJSON(t.edgeFeatures)),t.nodeFeatures&&(t.nodeFeatures=e.toGeoJSON(t.nodeFeatures)),t}),t}}])&&fx(e.prototype,r),n&&fx(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function vx(t,e){for(var r=0;r0&&(r+=","),r+='{"x":'+e[o].x+',"y":'+e[o].y+"}";else if(!0===t)for(var i=0;i0&&(r+=","),r+=e[i];return r+="]"}},{key:"toGeoJSONResult",value:function(t){if(!t||!t.pathList||t.pathList.length<1)return null;var e=new xr;return t.pathList.forEach(function(t){t.route&&(t.route=e.toGeoJSON(t.route)),t.pathGuideItems&&(t.pathGuideItems=e.toGeoJSON(t.pathGuideItems)),t.edgeFeatures&&(t.edgeFeatures=e.toGeoJSON(t.edgeFeatures)),t.nodeFeatures&&(t.nodeFeatures=e.toGeoJSON(t.nodeFeatures))}),t}}])&&wx(e.prototype,r),n&&wx(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function kx(t,e){for(var r=0;r0&&(r+=","),r+='{"x":'+e[o].x+',"y":'+e[o].y+"}";else if(!0===t)for(var i=0;i0&&(r+=","),r+=e[i];return r+="]"}},{key:"toGeoJSONResult",value:function(t){if(!t||!t.serviceAreaList)return t;var e=new xr;return t.serviceAreaList.map(function(t){return t.serviceRegion&&(t.serviceRegion=e.toGeoJSON(t.serviceRegion)),t.edgeFeatures&&(t.edgeFeatures=e.toGeoJSON(t.edgeFeatures)),t.nodeFeatures&&(t.nodeFeatures=e.toGeoJSON(t.nodeFeatures)),t.routes&&(t.routes=e.toGeoJSON(t.routes)),t}),t}}])&&Tx(e.prototype,r),n&&Tx(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Nx(t,e){for(var r=0;r0&&(e+=","),e+='{"x":'+o[r].x+',"y":'+o[r].y+"}";i+=e+="]"}else if(!0===t.isAnalyzeById){for(var a="[",s=t.nodes,u=s.length,l=0;l0&&(a+=","),a+=s[l];i+=a+="]"}return i}},{key:"toGeoJSONResult",value:function(t){if(!t||!t.tspPathList)return null;var e=new xr;return t.tspPathList.forEach(function(t){t.route&&(t.route=e.toGeoJSON(t.route)),t.pathGuideItems&&(t.pathGuideItems=e.toGeoJSON(t.pathGuideItems)),t.edgeFeatures&&(t.edgeFeatures=e.toGeoJSON(t.edgeFeatures)),t.nodeFeatures&&(t.nodeFeatures=e.toGeoJSON(t.nodeFeatures))}),t}}])&&Fx(e.prototype,r),n&&Fx(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function Vx(t,e){for(var r=0;r0)for(var e in t.items)t.items[e].destroy(),t.items[e]=null;t.items=null}t.numericPrecision=null,t.rangeMode=null,t.rangeCount=null,t.colorGradientType=null}}])&&$j(e.prototype,r),n&&$j(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function eE(t,e){for(var r=0;r=0;t--)this.points[t].destroy();this.points=null}}}])&&LN(e.prototype,r),n&&LN(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function UN(t){"@babel/helpers - typeof";return(UN="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zN(t,e){for(var r=0;r0&&(1===o.length?r+="'displayFilter':\""+o[0]+'",':r+="'displayFilter':\""+o[a]+'",'),(i=t.displayOrderBy)&&i.length>0&&(1===i.length?r+="'displayOrderBy':'"+i[0]+"',":r+="'displayOrderBy':'"+i[a]+"',"),(e=t.fieldValuesDisplayFilter)&&(r+="'fieldValuesDisplayFilter':"+A.toJSON(e)+","),t.joinItems&&t.joinItems.length>0&&t.joinItems[a]&&(r+="'joinItems':["+A.toJSON(t.joinItems[a])+"],"),t.datasetNames&&t.dataSourceNames){var u=t.datasetNames[a]?a:t.datasetNames.length-1,l=t.dataSourceNames[a]?a:t.dataSourceNames.length-1;r+="'datasetInfo': {'name': '"+t.datasetNames[u]+"','dataSourceName': '"+t.dataSourceNames[l]+"'}},"}else r+="},"}t.themes&&t.themes.length>0&&(r=r.substring(0,r.length-1)),r+="]},";var c=this.url.split("/");return r+="'name': '"+c[c.length-2]+"'}]"}}])&&YI(e.prototype,r),n&&YI(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function eD(t){"@babel/helpers - typeof";return(eD="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rD(t,e){for(var r=0;r0&&o.push(","),r=e[i].geometry,o.push(this.extractGeometry(r));return n&&o.push(")"),o.join("")}},{key:"extractGeometry",value:function(t){var e=t.CLASS_NAME.split(".")[2].toLowerCase();return this.extract[e]?("collection"===e?"GEOMETRYCOLLECTION":e.toUpperCase())+"("+this.extract[e].apply(this,[t])+")":null}}])&&IF(e.prototype,r),n&&IF(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function UF(t,e){for(var r=0;r=0?e.speed:1,this.frequency=e.speed&&e.frequency>=0?e.frequency:1e3,this.startTime=e.startTime&&null!=e.startTime?e.startTime:0,this.endTime=e.endTime&&null!=e.endTime&&e.endTime>=r.startTime?e.endTime:+new Date,this.repeat=void 0===e.repeat||e.repeat,this.reverse=void 0!==e.reverse&&e.reverse,this.currentTime=null,this.oldTime=null,this.running=!1,this.EVENT_TYPES=["start","pause","stop"],r.events=new Jn(this,null,this.EVENT_TYPES),r.speed=Number(r.speed),r.frequency=Number(r.frequency),r.startTime=Number(r.startTime),r.endTime=Number(r.endTime),r.startTime=Date.parse(new Date(r.startTime)),r.endTime=Date.parse(new Date(r.endTime)),r.currentTime=r.startTime,this.CLASS_NAME="SuperMap.TimeControlBase"}var e,r,n;return e=t,(r=[{key:"updateOptions",value:function(t){var e=this;(t=t||{}).speed&&t.speed>=0&&(e.speed=t.speed,e.speed=Number(e.speed)),t.speed&&t.frequency>=0&&(e.frequency=t.frequency,e.frequency=Number(e.frequency)),t.startTime&&null!=t.startTime&&(e.startTime=t.startTime,e.startTime=Date.parse(new Date(e.startTime))),t.endTime&&null!=t.endTime&&t.endTime>=e.startTime&&(e.endTime=t.endTime,e.endTime=Date.parse(new Date(e.endTime))),null!=t.repeat&&(e.repeat=t.repeat),null!=t.reverse&&(e.reverse=t.reverse)}},{key:"start",value:function(){var t=this;t.running||(t.running=!0,t.tick(),t.events.triggerEvent("start",t.currentTime))}},{key:"pause",value:function(){this.running=!1,this.events.triggerEvent("pause",this.currentTime)}},{key:"stop",value:function(){var t=this;t.currentTime=t.startTime,t.running&&(t.running=!1),t.events.triggerEvent("stop",t.currentTime)}},{key:"toggle",value:function(){this.running?this.pause():this.start()}},{key:"setSpeed",value:function(t){return t>=0&&(this.speed=t,!0)}},{key:"getSpeed",value:function(){return this.speed}},{key:"setFrequency",value:function(t){return t>=0&&(this.frequency=t,!0)}},{key:"getFrequency",value:function(){return this.frequency}},{key:"setStartTime",value:function(t){var e=this;return!((t=Date.parse(new Date(t)))>e.endTime)&&(e.startTime=t,e.currentTime=e.endTime&&(e.currentTime=e.startTime,e.tick()),!0)}},{key:"getEndTime",value:function(){return this.endTime}},{key:"setCurrentTime",value:function(t){var e=this;return e.currentTime=Date.parse(new Date(e.currentTime)),t>=e.startTime&&t<=e.endTime&&(e.currentTime=t,e.startTime=e.currentTime,e.tick(),!0)}},{key:"getCurrentTime",value:function(){return this.currentTime}},{key:"setRepeat",value:function(t){this.repeat=t}},{key:"getRepeat",value:function(){return this.repeat}},{key:"setReverse",value:function(t){this.reverse=t}},{key:"getReverse",value:function(){return this.reverse}},{key:"getRunning",value:function(){return this.running}},{key:"destroy",value:function(){var t=this;t.speed=null,t.frequency=null,t.startTime=null,t.endTime=null,t.currentTime=null,t.repeat=null,t.running=!1,t.reverse=null}},{key:"tick",value:function(){}}])&&UF(e.prototype,r),n&&UF(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function JF(t){"@babel/helpers - typeof";return(JF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function VF(t,e){for(var r=0;r=t.endTime&&(t.currentTime=t.endTime)}}}])&&VF(e.prototype,r),n&&VF(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function ZF(t,e){for(var r=0;r3&&void 0!==arguments[3]?arguments[3]:{headers:this.headers,crossOrigin:this.crossOrigin,withCredentials:this.withCredentials};return e=jh.appendCredential(e),Hl.commit(t,e,r,n).then(function(t){return t.json()})}}])&&sB(e.prototype,r),n&&sB(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function lB(t,e){for(var r=0;r0)for(var e in t.items)t.items[e].destroy(),t.items[e]=null;t.items=null}t.reverseColor=null,t.rangeMode=null,t.rangeParameter=null,t.colorGradientType=null}}])&&dU(e.prototype,r),n&&dU(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function SU(t,e){for(var r=0;r0)for(var e in t.items)t.items[e].destroy(),t.items[e]=null;t.items=null}t.defaultcolor&&(t.defaultcolor.destroy(),t.defaultcolor=null)}},{key:"toServerJSONObject",value:function(){var t={};if((t=A.copyAttributes(t,this)).defaultcolor&&t.defaultcolor.toServerJSONObject&&(t.defaultcolor=t.defaultcolor.toServerJSONObject()),t.items){for(var e=[],r=t.items.length,n=0;n0&&(t=t.substring(0,t.length-1)),"{"+t+"}"}return null}}])&&LU(e.prototype,r),n&&LU(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function IU(t,e){for(var r=0;r3&&void 0!==arguments[3]?arguments[3]:{};return e=jh.appendCredential(e),n.crossOrigin=this.options.crossOrigin,n.headers=this.options.headers,Hl.commit(t,e,r,n).then(function(t){return t.json()})}}])&&zz(e.prototype,r),n&&zz(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Vz(t){"@babel/helpers - typeof";return(Vz="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function qz(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);re.geoFence.radius&&(e.outOfGeoFence&&e.outOfGeoFence(t),e.events.triggerEvent("outOfGeoFence",{data:t})),r})}},{key:"_distance",value:function(t,e,r,n){return Math.sqrt((t-r)*(t-r)+(e-n)*(e-n))}},{key:"_getMeterPerMapUnit",value:function(t){var e;return"meter"===t?e=1:"degree"===t&&(e=2*Math.PI*6378137/360),e}}])&&cJ(e.prototype,r),n&&cJ(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function hJ(t,e){for(var r=0;r=e)if("RANGE"===r)for(o=0;o=0&&this.getSqrtInterval(t,r):"logarithm"===e?this.getMin(t)>0&&this.getGeometricProgression(t,r):void 0}},{key:"getSum",value:function(t){return this.getInstance(t).sum()}},{key:"getMax",value:function(t){return this.getInstance(t).max()}},{key:"getMin",value:function(t){return this.getInstance(t).min()}},{key:"getMean",value:function(t){return this.getInstance(t).mean()}},{key:"getMedian",value:function(t){return this.getInstance(t).median()}},{key:"getTimes",value:function(t){return t.length}},{key:"getEqInterval",value:function(t,e){return this.getInstance(t).getClassEqInterval(e)}},{key:"getJenks",value:function(t,e){return this.getInstance(t).getClassJenks(e)}},{key:"getSqrtInterval",value:function(t,e){return t=t.map(function(t){return Math.sqrt(t)}),this.getInstance(t).getClassEqInterval(e).map(function(t){return t*t})}},{key:"getGeometricProgression",value:function(t,e){return this.getInstance(t).getClassGeometricProgression(e)}}],(r=null)&&dJ(e.prototype,r),n&&dJ(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();var vJ=r(7820),mJ=r.n(vJ);function gJ(t){"@babel/helpers - typeof";return(gJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function wJ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function OJ(t,e){for(var r=0;rl&&(u[o]=u[o].slice(n-l),l=n)}function d(t){var e,i,a,s;if(t instanceof Function)return t.call(c.parsers);if("string"==typeof t)e=r.charAt(n)===t?t:null,i=1,y();else{if(y(),!(e=t.exec(u[o])))return null;i=e[0].length}if(e){var f=n+=i;for(s=n+u[o].length-i;n=0&&"\n"!==n.charAt(a);a--)t.column++;return new Error([t.filename,t.line,t.column,t.message].join(";"))}return this.env=e=e||{},this.env.filename=this.env.filename||null,this.env.inputs=this.env.inputs||{},c={parse:function(i){var a,c=null;if(n=o=l=s=0,u=[],r=i.replace(/\r\n/g,"\n"),e.filename&&(f.env.inputs[e.filename]=r),u=function(t){for(var e,n,o,i,a=0,s=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,u=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,l=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,f=0,h=t[0],p=0;p0?"missing closing `}`":"missing opening `{`"}),t.map(function(t){return t.join("")})}([[]]),c)throw b(c);var h=function(t,e){var r=t.specificity,n=e.specificity;return r[0]!=n[0]?n[0]-r[0]:r[1]!=n[1]?n[1]-r[1]:r[2]!=n[2]?n[2]-r[2]:n[3]-r[3]};return(a=new t.Tree.Ruleset([],d(this.parsers.primary))).root=!0,a.toList=function(t){t.error=function(e){t.errors||(t.errors=new Error("")),t.errors.message?t.errors.message+="\n"+b(e).message:t.errors.message=b(e).message},t.frames=t.frames||[];var e=this.flatten([],[],t);return e.sort(h),e},a},parsers:{primary:function(){for(var t,e=[];(t=d(this.rule)||d(this.ruleset)||d(this.comment))||d(/^[\s\n]+/)||(t=d(this.invalid));)t&&e.push(t);return e},invalid:function(){var e=d(/^[^;\n]*[;\n]/);if(e)return new t.Tree.Invalid(e,a)},comment:function(){var e;if("/"===r.charAt(n))return"/"===r.charAt(n+1)?new t.Tree.Comment(d(/^\/\/.*/),!0):(e=d(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/))?new t.Tree.Comment(e):void 0},entities:{quoted:function(){if('"'===r.charAt(n)||"'"===r.charAt(n)){var e=d(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);return e?new t.Tree.Quoted(e[1]||e[2]):void 0}},field:function(){if(d("[")){var e=d(/(^[^\]]+)/);if(d("]"))return e?new t.Tree.Field(e[1]):void 0}},comparison:function(){var t=d(/^=~|=|!=|<=|>=|<|>/);if(t)return t},keyword:function(){var e=d(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);if(e)return new t.Tree.Keyword(e)},call:function(){var e,r;if(e=/^([\w\-]+|%)\(/.exec(u[o])){if("url"===(e=e[1]))return null;n+=e.length;if(d("("),r=d(this.entities.arguments),d(")"))return e?new t.Tree.Call(e,r,n):void 0}},arguments:function(){for(var t,e=[];t=d(this.expression);){e.push(t);if(!d(","))break}return e},literal:function(){return d(this.entities.dimension)||d(this.entities.keywordcolor)||d(this.entities.hexcolor)||d(this.entities.quoted)},url:function(){var e;if("u"===r.charAt(n)&&d(/^url\(/)){e=d(this.entities.quoted)||d(this.entities.variable)||d(/^[\-\w%@_match\/.&=:;#+?~]+/)||"";return d(")")?new t.Tree.URL(void 0!==e.value||e instanceof t.Tree.Variable?e:new t.Tree.Quoted(e)):new t.Tree.Invalid(e,a,"Missing closing ) in URL.")}},variable:function(){var o,i=n;if("@"===r.charAt(n)&&(o=d(/^@[\w-]+/)))return new t.Tree.Variable(o,i,e.filename)},hexcolor:function(){var e;if("#"===r.charAt(n)&&(e=d(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/)))return new t.Tree.Color(e[1])},keywordcolor:function(){var e=u[o].match(/^[a-z]+/);if(e&&e[0]in t.Tree.Reference.data.colors)return new t.Tree.Color(t.Tree.Reference.data.colors[d(/^[a-z]+/)])},dimension:function(){var e=r.charCodeAt(n);if(!(e>57||e<45||47===e)){var o=d(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);return o?new t.Tree.Dimension(o[1],o[2],a):void 0}}},variable:function(){var t;if("@"===r.charAt(n)&&(t=d(/^(@[\w-]+)\s*:/)))return t[1]},entity:function(){var t=d(this.entities.call)||d(this.entities.literal),e=d(this.entities.field)||d(this.entities.variable),r=d(this.entities.url)||d(this.entities.keyword);return t||e||r},end:function(){var t;return d(";")||("string"==typeof(t="}")?r.charAt(n)===t:!!t.test(u[o]))},element:function(){var e=d(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);if(e)return new t.Tree.Element(e)},attachment:function(){var t=d(/^::([\w\-]+(?:\/[\w\-]+)*)/);if(t)return t[1]},selector:function(){for(var e,o,i,s,u,l=[],c=new t.Tree.Filterset,f=[],h=0,p=0;(i=d(this.element))||(u=d(this.zoom))||(s=d(this.filter))||(e=d(this.attachment));){if(h++,i)l.push(i);else if(u)f.push(u),p++;else if(s){var y=c.add(s);if(y)throw b({message:y,index:n-1});p++}else{if(o)throw b({message:"Encountered second attachment name.",index:n-1});o=e}var v=r.charAt(n);if("{"===v||"}"===v||";"===v||","===v)break}if(h)return new t.Tree.Selector(c,f,l,o,p,a)},filter:function(){h();var r,n,o;if(d("[")&&(r=d(/^[a-zA-Z0-9\-_]+/)||d(this.entities.quoted)||d(this.entities.variable)||d(this.entities.keyword)||d(this.entities.field))&&(r instanceof t.Tree.Quoted&&(r=new t.Tree.Field(r.toString())),(n=d(this.entities.comparison))&&(o=d(this.entities.quoted)||d(this.entities.variable)||d(this.entities.dimension)||d(this.entities.keyword)||d(this.entities.field)))){if(!d("]"))throw b({message:"Missing closing ] of filter.",index:a-1});return r.is||(r=new t.Tree.Field(r)),new t.Tree.Filter(r,n,o,a,e.filename)}},zoom:function(){h();var e,r;if(d(/^\[\s*zoom/g)&&(e=d(this.entities.comparison))&&(r=d(this.entities.variable)||d(this.entities.dimension))&&d("]"))return new t.Tree.Zoom(e,r,a);p()},block:function(){var t;if(d("{")&&(t=d(this.primary))&&d("}"))return t},ruleset:function(){var e,r,n=[];for(h();e=d(this.selector);){for(n.push(e);d(this.comment););if(!d(","))break;for(;d(this.comment););}if(e)for(;d(this.comment););if(n.length>0&&(r=d(this.block))){if(1===n.length&&n[0].elements.length&&"Map"===n[0].elements[0].value){var o=new t.Tree.Ruleset(n,r);return o.isMap=!0,o}return new t.Tree.Ruleset(n,r)}p()},rule:function(){var o,i,u=r.charAt(n);if(h(),"."!==u&&"#"!==u&&(o=d(this.variable)||d(this.property))){if((i=d(this.value))&&d(this.end))return new t.Tree.Rule(o,i,a,e.filename);s=n,p()}},font:function(){for(var e,r=[],n=[];e=d(this.entity);)n.push(e);if(r.push(new t.Tree.Expression(n)),d(","))for(;(e=d(this.expression))&&(r.push(e),d(",")););return new t.Tree.Value(r)},value:function(){for(var e,r=[];(e=d(this.expression))&&(r.push(e),d(",")););return r.length>1?new t.Tree.Value(r.map(function(t){return t.value[0]})):1===r.length?new t.Tree.Value(r):void 0},sub:function(){var t;if(d("(")&&(t=d(this.expression))&&d(")"))return t},multiplication:function(){var e,r,n,o;if(e=d(this.operand)){for(;(n=d("/")||d("*")||d("%"))&&(r=d(this.operand));)o=new t.Tree.Operation(n,[o||e,r],a);return o||e}},addition:function(){var e,o,i,s;if(e=d(this.multiplication)){for(;(i=d(/^[-+]\s+/)||" "!=r.charAt(n-1)&&(d("+")||d("-")))&&(o=d(this.multiplication));)s=new t.Tree.Operation(i,[s||e,o],a);return s||e}},operand:function(){return d(this.sub)||d(this.entity)},expression:function(){for(var e,r=[];e=d(this.addition)||d(this.entity);)r.push(e);if(r.length>0)return new t.Tree.Expression(r)},property:function(){var t=d(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);if(t)return t[1]}}}}},{key:"parse",value:function(t){var e=this.parser;return this.ruleSet=e.parse(t)}},{key:"toShaders",value:function(){if(this.ruleSet){var t=this.ruleSet;if(t){var e=t.toList(this.env);e.reverse();var r={},n=[];this._toShaders(r,n,e);for(var o=[],i={},a=0,s=e.length;a=0){if(!e.featureFilter){var i=o+n.length,a=r.indexOf(")",i+1),s="featureId&&(featureId"+r.substring(i,a)+")";Object.defineProperty(e,"featureFilter",{configurable:!0,enumerable:!1,value:function(t){return!!s}})}return{property:p,getValue:Function("attributes","zoom","seftFilter","var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){"+r+";} return _value; ")}}return{property:p,getValue:Function("attributes","zoom","var _value = null;"+r+"; return _value; ")}}(c[p],f);Object.defineProperty(f,"attachment",{configurable:!0,enumerable:!1,value:l}),Object.defineProperty(f,"elements",{configurable:!0,enumerable:!1,value:u.elements}),o.push(f),i[n[a]]=!0}Object.defineProperty(f,"zoom",{configurable:!0,enumerable:!1,value:u.zoom})}return o}}return null}},{key:"_toShaders",value:function(e,r,n){for(var o=0,i=n.length;o= minzoom - 1e-6 and scale < maxzoom + 1e-6"},maxzoom:{"default-value":"1.79769e+308",type:"float","default-meaning":"The layer will be visible at the maximum possible scale",doc:"The maximum scale denominator that this layer will be visible at. The default is the numeric limit of the C++ double type, which may vary slightly by system, but is likely a massive number like 1.79769e+308 and ensures that this layer will always be visible unless the value is reduced. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"},queryable:{"default-value":!1,type:"boolean","default-meaning":"The layer will not be available for the direct querying of data values",doc:"This property was added for GetFeatureInfo/WMS compatibility and is rarely used. It is off by default meaning that in a WMS context the layer will not be able to be queried unless the property is explicitly set to true"},"clear-label-cache":{"default-value":!1,type:"boolean","default-meaning":"The renderer's collision detector cache (used for avoiding duplicate labels and overlapping markers) will not be cleared immediately before processing this layer",doc:"This property, by default off, can be enabled to allow a user to clear the collision detector cache before a given layer is processed. This may be desirable to ensure that a given layers data shows up on the map even if it normally would not because of collisions with previously rendered labels or markers"},"group-by":{"default-value":"",type:"string","default-meaning":"No special layer grouping will be used during rendering",doc:"https://github.com/mapnik/mapnik/wiki/Grouped-rendering"},"buffer-size":{"default-value":"0",type:"float","default-meaning":"No buffer will be used",doc:"Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"},"maximum-extent":{"default-value":"none",type:"bbox","default-meaning":"No clipping extent will be used",doc:"An extent to be used to limit the bounds used to query this specific layer data during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Layer."}},symbolizers:{"*":{"image-filters":{css:"image-filters","default-value":"none","default-meaning":"no filters",type:"functions",functions:[["agg-stack-blur",2],["emboss",0],["blur",0],["gray",0],["sobel",0],["edge-detect",0],["x-gradient",0],["y-gradient",0],["invert",0],["sharpen",0]],doc:"A list of image filters."},"comp-op":{css:"comp-op","default-value":"src-over","default-meaning":"add the current layer on top of other layers",doc:"Composite operation. This defines how this layer should behave relative to layers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]},opacity:{css:"opacity",type:"float",doc:"An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)","default-value":1,"default-meaning":"no separate buffer will be used and no alpha will be applied to the style after rendering"}},map:{"background-color":{css:"background-color","default-value":"none","default-meaning":"transparent",type:"color",doc:"Map Background color"},"background-image":{css:"background-image",type:"uri","default-value":"","default-meaning":"transparent",doc:"An image that is repeated below all features on a map as a background.",description:"Map Background image"},srs:{css:"srs",type:"string","default-value":"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs","default-meaning":"The proj4 literal of EPSG:4326 is assumed to be the Map's spatial reference and all data from layers within this map will be plotted using this coordinate system. If any layers do not declare an srs value then they will be assumed to be in the same srs as the Map and not transformations will be needed to plot them in the Map's coordinate space",doc:"Map spatial reference (proj4 string)"},"buffer-size":{css:"buffer-size","default-value":"0",type:"float","default-meaning":"No buffer will be used",doc:'Extra tolerance around the map (in pixels) used to ensure labels crossing tile boundaries are equally rendered in each tile (e.g. cut in each tile). Not intended to be used in combination with "avoid-edges".'},"maximum-extent":{css:"","default-value":"none",type:"bbox","default-meaning":"No clipping extent will be used",doc:"An extent to be used to limit the bounds used to query all layers during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Map."},base:{css:"base","default-value":"","default-meaning":"This base path defaults to an empty string meaning that any relative paths to files referenced in styles or layers will be interpreted relative to the application process.",type:"string",doc:"Any relative paths used to reference files will be understood as relative to this directory path if the map is loaded from an in memory object rather than from the filesystem. If the map is loaded from the filesystem and this option is not provided it will be set to the directory of the stylesheet."},"paths-from-xml":{css:"","default-value":!0,"default-meaning":"Paths read from XML will be interpreted from the location of the XML",type:"boolean",doc:"value to control whether paths in the XML will be interpreted from the location of the XML or from the working directory of the program that calls load_map()"},"minimum-version":{css:"","default-value":"none","default-meaning":"Mapnik version will not be detected and no error will be thrown about compatibility",type:"string",doc:"The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"},"font-directory":{css:"font-directory",type:"uri","default-value":"none","default-meaning":"No map-specific fonts will be registered",doc:"Path to a directory which holds fonts which should be registered when the Map is loaded (in addition to any fonts that may be automatically registered)."}},polygon:{fill:{css:"polygon-fill",type:"color","default-value":"rgba(128,128,128,1)","default-meaning":"gray and fully opaque (alpha = 1), same as rgb(128,128,128)",doc:"Fill color to assign to a polygon"},"fill-opacity":{css:"polygon-opacity",type:"float",doc:"The opacity of the polygon","default-value":1,"default-meaning":"opaque"},gamma:{css:"polygon-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of polygon edges"},"gamma-method":{css:"polygon-gamma-method",type:["power","linear","none","threshold","multiply"],"default-value":"power","default-meaning":"pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",doc:"An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"},clip:{css:"polygon-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"polygon-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"polygon-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"polygon-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},line:{stroke:{css:"line-color","default-value":"rgba(0,0,0,1)",type:"color","default-meaning":"black and fully opaque (alpha = 1), same as rgb(0,0,0)",doc:"The color of a drawn line"},"stroke-width":{css:"line-width","default-value":1,type:"float",doc:"The width of a line in pixels"},"stroke-opacity":{css:"line-opacity","default-value":1,type:"float","default-meaning":"opaque",doc:"The opacity of a line"},"stroke-linejoin":{css:"line-join","default-value":"miter",type:["miter","round","bevel"],doc:"The behavior of lines when joining"},"stroke-linecap":{css:"line-cap","default-value":"butt",type:["butt","round","square"],doc:"The display of line endings"},"stroke-gamma":{css:"line-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of stroke line"},"stroke-gamma-method":{css:"line-gamma-method",type:["power","linear","none","threshold","multiply"],"default-value":"power","default-meaning":"pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",doc:"An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"},"stroke-dasharray":{css:"line-dasharray",type:"numbers",doc:"A pair of length values [a,b], where (a) is the dash length and (b) is the gap length respectively. More than two values are supported for more complex patterns.","default-value":"none","default-meaning":"solid line"},"stroke-dashoffset":{css:"line-dash-offset",type:"numbers",doc:"valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)","default-value":"none","default-meaning":"solid line"},"stroke-miterlimit":{css:"line-miterlimit",type:"float",doc:"The limit on the ratio of the miter length to the stroke-width. Used to automatically convert miter joins to bevel joins for sharp angles to avoid the miter extending beyond the thickness of the stroking path. Normally will not need to be set, but a larger value can sometimes help avoid jaggy artifacts.","default-value":4,"default-meaning":"Will auto-convert miters to bevel line joins when theta is less than 29 degrees as per the SVG spec: 'miterLength / stroke-width = 1 / sin ( theta / 2 )'"},clip:{css:"line-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"line-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},offset:{css:"line-offset",type:"float","default-value":0,"default-meaning":"no offset",doc:"Offsets a line a number of pixels parallel to its actual path. Postive values move the line left, negative values move it right (relative to the directionality of the line)."},rasterizer:{css:"line-rasterizer",type:["full","fast"],"default-value":"full",doc:"Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."},"geometry-transform":{css:"line-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"line-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},markers:{file:{css:"marker-file",doc:"An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.","default-value":"","default-meaning":"An ellipse or circle, if width equals height",type:"uri"},opacity:{css:"marker-opacity",doc:"The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke","default-value":1,"default-meaning":"The stroke-opacity and fill-opacity will be used",type:"float"},"fill-opacity":{css:"marker-fill-opacity",doc:"The fill opacity of the marker","default-value":1,"default-meaning":"opaque",type:"float"},stroke:{css:"marker-line-color",doc:"The color of the stroke around a marker shape.","default-value":"black",type:"color"},"stroke-width":{css:"marker-line-width",doc:"The width of the stroke around a marker shape, in pixels. This is positioned on the boundary, so high values can cover the area itself.",type:"float"},"stroke-opacity":{css:"marker-line-opacity","default-value":1,"default-meaning":"opaque",doc:"The opacity of a line",type:"float"},placement:{css:"marker-placement",type:["point","line","interior"],"default-value":"point","default-meaning":"Place markers at the center point (centroid) of the geometry",doc:"Attempt to place markers on a point, in the center of a polygon, or if markers-placement:line, then multiple times along a line. 'interior' placement can be used to ensure that points placed on polygons are forced to be inside the polygon interior"},"multi-policy":{css:"marker-multi-policy",type:["each","whole","largest"],"default-value":"each","default-meaning":"If a feature contains multiple geometries and the placement type is either point or interior then a marker will be rendered for each",doc:"A special setting to allow the user to control rendering behavior for 'multi-geometries' (when a feature contains multiple geometries). This setting does not apply to markers placed along lines. The 'each' policy is default and means all geometries will get a marker. The 'whole' policy means that the aggregate centroid between all geometries will be used. The 'largest' policy means that only the largest (by bounding box areas) feature will get a rendered marker (this is how text labeling behaves by default)."},"marker-type":{css:"marker-type",type:["arrow","ellipse"],"default-value":"ellipse",doc:"The default marker-type. If a SVG file is not given as the marker-file parameter, the renderer provides either an arrow or an ellipse (a circle if height is equal to width)"},width:{css:"marker-width","default-value":10,doc:"The width of the marker, if using one of the default types.",type:"expression"},height:{css:"marker-height","default-value":10,doc:"The height of the marker, if using one of the default types.",type:"expression"},fill:{css:"marker-fill","default-value":"blue",doc:"The color of the area of the marker.",type:"color"},"allow-overlap":{css:"marker-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping markers are shown or hidden.","default-meaning":"Do not allow makers to overlap with each other - overlapping markers will not be shown."},"ignore-placement":{css:"marker-ignore-placement",type:"boolean","default-value":!1,"default-meaning":"do not store the bbox of this geometry in the collision detector cache",doc:"value to control whether the placement of the feature will prevent the placement of other features"},spacing:{css:"marker-spacing",doc:"Space between repeated labels","default-value":100,type:"float"},"max-error":{css:"marker-max-error",type:"float","default-value":.2,doc:"The maximum difference between actual marker placement and the marker-spacing parameter. Setting a high value can allow the renderer to try to resolve placement conflicts with other symbolizers."},transform:{css:"marker-transform",type:"functions",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]],"default-value":"","default-meaning":"No transformation",doc:"SVG transformation definition"},clip:{css:"marker-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"marker-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"marker-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"marker-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},shield:{name:{css:"shield-name",type:"expression",serialization:"content",doc:'Value to use for a shield"s text label. Data columns are specified using brackets like [column_name]'},file:{css:"shield-file",required:!0,type:"uri","default-value":"none",doc:"Image file to render behind the shield text"},"face-name":{css:"shield-face-name",type:"string",validate:"font",doc:"Font name and style to use for the shield text","default-value":"",required:!0},"unlock-image":{css:"shield-unlock-image",type:"boolean",doc:"This parameter should be set to true if you are trying to position text beside rather than on top of the shield image","default-value":!1,"default-meaning":"text alignment relative to the shield image uses the center of the image as the anchor for text positioning."},size:{css:"shield-size",type:"float",doc:"The size of the shield text in pixels"},fill:{css:"shield-fill",type:"color",doc:"The color of the shield text"},placement:{css:"shield-placement",type:["point","line","vertex","interior"],"default-value":"point",doc:"How this shield should be placed. Point placement attempts to place it on top of points, line places along lines multiple times per feature, vertex places on the vertexes of polygons, and interior attempts to place inside of polygons."},"avoid-edges":{css:"shield-avoid-edges",doc:"Tell positioning algorithm to avoid labeling near intersection edges.",type:"boolean","default-value":!1},"allow-overlap":{css:"shield-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping shields are shown or hidden.","default-meaning":"Do not allow shields to overlap with other map elements already placed."},"minimum-distance":{css:"shield-min-distance",type:"float","default-value":0,doc:"Minimum distance to the next shield symbol, not necessarily the same shield."},spacing:{css:"shield-spacing",type:"float","default-value":0,doc:"The spacing between repeated occurrences of the same shield on a line"},"minimum-padding":{css:"shield-min-padding","default-value":0,doc:"Determines the minimum amount of padding that a shield gets relative to other shields",type:"float"},"wrap-width":{css:"shield-wrap-width",type:"unsigned","default-value":0,doc:"Length of a chunk of text in characters before wrapping text"},"wrap-before":{css:"shield-wrap-before",type:"boolean","default-value":!1,doc:"Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."},"wrap-character":{css:"shield-wrap-character",type:"string","default-value":" ",doc:"Use this character instead of a space to wrap long names."},"halo-fill":{css:"shield-halo-fill",type:"color","default-value":"#FFFFFF","default-meaning":"white",doc:"Specifies the color of the halo around the text."},"halo-radius":{css:"shield-halo-radius",doc:"Specify the radius of the halo in pixels","default-value":0,"default-meaning":"no halo",type:"float"},"character-spacing":{css:"shield-character-spacing",type:"unsigned","default-value":0,doc:"Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."},"line-spacing":{css:"shield-line-spacing",doc:"Vertical spacing between lines of multiline labels (in pixels)",type:"unsigned"},dx:{css:"shield-text-dx",type:"float",doc:"Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},dy:{css:"shield-text-dy",type:"float",doc:"Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},"shield-dx":{css:"shield-dx",type:"float",doc:"Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},"shield-dy":{css:"shield-dy",type:"float",doc:"Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},opacity:{css:"shield-opacity",type:"float",doc:"(Default 1.0) - opacity of the image used for the shield","default-value":1},"text-opacity":{css:"shield-text-opacity",type:"float",doc:"(Default 1.0) - opacity of the text placed on top of the shield","default-value":1},"horizontal-alignment":{css:"shield-horizontal-alignment",type:["left","middle","right","auto"],doc:"The shield's horizontal alignment from its centerpoint","default-value":"auto"},"vertical-alignment":{css:"shield-vertical-alignment",type:["top","middle","bottom","auto"],doc:"The shield's vertical alignment from its centerpoint","default-value":"middle"},"text-transform":{css:"shield-text-transform",type:["none","uppercase","lowercase","capitalize"],doc:"Transform the case of the characters","default-value":"none"},"justify-alignment":{css:"shield-justify-alignment",type:["left","center","right","auto"],doc:"Define how text in a shield's label is justified","default-value":"auto"},clip:{css:"shield-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},"comp-op":{css:"shield-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},"line-pattern":{file:{css:"line-pattern-file",type:"uri","default-value":"none",required:!0,doc:"An image file to be repeated and warped along a line"},clip:{css:"line-pattern-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"line-pattern-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"line-pattern-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"line-pattern-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},"polygon-pattern":{file:{css:"polygon-pattern-file",type:"uri","default-value":"none",required:!0,doc:"Image to use as a repeated pattern fill within a polygon"},alignment:{css:"polygon-pattern-alignment",type:["local","global"],"default-value":"local",doc:"Specify whether to align pattern fills to the layer or to the map."},gamma:{css:"polygon-pattern-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of polygon pattern edges"},opacity:{css:"polygon-pattern-opacity",type:"float",doc:"(Default 1.0) - Apply an opacity level to the image used for the pattern","default-value":1,"default-meaning":"The image is rendered without modifications"},clip:{css:"polygon-pattern-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"polygon-pattern-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"polygon-pattern-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"polygon-pattern-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},raster:{opacity:{css:"raster-opacity","default-value":1,"default-meaning":"opaque",type:"float",doc:"The opacity of the raster symbolizer on top of other symbolizers."},"filter-factor":{css:"raster-filter-factor","default-value":-1,"default-meaning":"Allow the datasource to choose appropriate downscaling.",type:"float",doc:"This is used by the Raster or Gdal datasources to pre-downscale images using overviews. Higher numbers can sometimes cause much better scaled image output, at the cost of speed."},scaling:{css:"raster-scaling",type:["near","fast","bilinear","bilinear8","bicubic","spline16","spline36","hanning","hamming","hermite","kaiser","quadric","catrom","gaussian","bessel","mitchell","sinc","lanczos","blackman"],"default-value":"near",doc:"The scaling algorithm used to making different resolution versions of this raster layer. Bilinear is a good compromise between speed and accuracy, while lanczos gives the highest quality."},"mesh-size":{css:"raster-mesh-size","default-value":16,"default-meaning":"Reprojection mesh will be 1/16 of the resolution of the source image",type:"unsigned",doc:"A reduced resolution mesh is used for raster reprojection, and the total image size is divided by the mesh-size to determine the quality of that mesh. Values for mesh-size larger than the default will result in faster reprojection but might lead to distortion."},"comp-op":{css:"raster-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},point:{file:{css:"point-file",type:"uri",required:!1,"default-value":"none",doc:"Image file to represent a point"},"allow-overlap":{css:"point-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping points are shown or hidden.","default-meaning":"Do not allow points to overlap with each other - overlapping markers will not be shown."},"ignore-placement":{css:"point-ignore-placement",type:"boolean","default-value":!1,"default-meaning":"do not store the bbox of this geometry in the collision detector cache",doc:"value to control whether the placement of the feature will prevent the placement of other features"},opacity:{css:"point-opacity",type:"float","default-value":1,"default-meaning":"Fully opaque",doc:"A value from 0 to 1 to control the opacity of the point"},placement:{css:"point-placement",type:["centroid","interior"],doc:"How this point should be placed. Centroid calculates the geometric center of a polygon, which can be outside of it, while interior always places inside of a polygon.","default-value":"centroid"},transform:{css:"point-transform",type:"functions",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]],"default-value":"","default-meaning":"No transformation",doc:"SVG transformation definition"},"comp-op":{css:"point-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},text:{name:{css:"text-name",type:"expression",required:!0,"default-value":"",serialization:"content",doc:"Value to use for a text label. Data columns are specified using brackets like [column_name]"},"face-name":{css:"text-face-name",type:"string",validate:"font",doc:"Font name and style to render a label in",required:!0},size:{css:"text-size",type:"float","default-value":10,doc:"Text size in pixels"},"text-ratio":{css:"text-ratio",doc:"Define the amount of text (of the total) present on successive lines when wrapping occurs","default-value":0,type:"unsigned"},"wrap-width":{css:"text-wrap-width",doc:"Length of a chunk of text in characters before wrapping text","default-value":0,type:"unsigned"},"wrap-before":{css:"text-wrap-before",type:"boolean","default-value":!1,doc:"Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."},"wrap-character":{css:"text-wrap-character",type:"string","default-value":" ",doc:"Use this character instead of a space to wrap long text."},spacing:{css:"text-spacing",type:"unsigned",doc:"Distance between repeated text labels on a line (aka. label-spacing)"},"character-spacing":{css:"text-character-spacing",type:"float","default-value":0,doc:"Horizontal spacing adjustment between characters in pixels"},"line-spacing":{css:"text-line-spacing","default-value":0,type:"unsigned",doc:"Vertical spacing adjustment between lines in pixels"},"label-position-tolerance":{css:"text-label-position-tolerance","default-value":0,type:"unsigned",doc:"Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"},"max-char-angle-delta":{css:"text-max-char-angle-delta",type:"float","default-value":"22.5",doc:"The maximum angle change, in degrees, allowed between adjacent characters in a label. This value internally is converted to radians to the default is 22.5*math.pi/180.0. The higher the value the fewer labels will be placed around around sharp corners."},fill:{css:"text-fill",doc:"Specifies the color for the text","default-value":"#000000",type:"color"},opacity:{css:"text-opacity",doc:"A number from 0 to 1 specifying the opacity for the text","default-value":1,"default-meaning":"Fully opaque",type:"float"},"halo-fill":{css:"text-halo-fill",type:"color","default-value":"#FFFFFF","default-meaning":"white",doc:"Specifies the color of the halo around the text."},"halo-radius":{css:"text-halo-radius",doc:"Specify the radius of the halo in pixels","default-value":0,"default-meaning":"no halo",type:"float"},dx:{css:"text-dx",type:"float",doc:"Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},dy:{css:"text-dy",type:"float",doc:"Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},"vertical-alignment":{css:"text-vertical-alignment",type:["top","middle","bottom","auto"],doc:"Position of label relative to point position.","default-value":"auto","default-meaning":'Default affected by value of dy; "bottom" for dy>0, "top" for dy<0.'},"avoid-edges":{css:"text-avoid-edges",doc:"Tell positioning algorithm to avoid labeling near intersection edges.","default-value":!1,type:"boolean"},"minimum-distance":{css:"text-min-distance",doc:"Minimum permitted distance to the next text symbolizer.",type:"float"},"minimum-padding":{css:"text-min-padding",doc:"Determines the minimum amount of padding that a text symbolizer gets relative to other text",type:"float"},"minimum-path-length":{css:"text-min-path-length",type:"float","default-value":0,"default-meaning":"place labels on all paths",doc:"Place labels only on paths longer than this value."},"allow-overlap":{css:"text-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping text is shown or hidden.","default-meaning":"Do not allow text to overlap with other text - overlapping markers will not be shown."},orientation:{css:"text-orientation",type:"expression",doc:"Rotate the text."},placement:{css:"text-placement",type:["point","line","vertex","interior"],"default-value":"point",doc:"Control the style of placement of a point versus the geometry it is attached to."},"placement-type":{css:"text-placement-type",doc:'Re-position and/or re-size text to avoid overlaps. "simple" for basic algorithm (using text-placements string,) "dummy" to turn this feature off.',type:["dummy","simple"],"default-value":"dummy"},placements:{css:"text-placements",type:"string","default-value":"",doc:'If "placement-type" is set to "simple", use this "POSITIONS,[SIZES]" string. An example is `text-placements: "E,NE,SE,W,NW,SW";` '},"text-transform":{css:"text-transform",type:["none","uppercase","lowercase","capitalize"],doc:"Transform the case of the characters","default-value":"none"},"horizontal-alignment":{css:"text-horizontal-alignment",type:["left","middle","right","auto"],doc:"The text's horizontal alignment from its centerpoint","default-value":"auto"},"justify-alignment":{css:"text-align",type:["left","right","center","auto"],doc:"Define how text is justified","default-value":"auto","default-meaning":"Auto alignment means that text will be centered by default except when using the `placement-type` parameter - in that case either right or left justification will be used automatically depending on where the text could be fit given the `text-placements` directives"},clip:{css:"text-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},"comp-op":{css:"text-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},building:{fill:{css:"building-fill","default-value":"#FFFFFF",doc:"The color of the buildings walls.",type:"color"},"fill-opacity":{css:"building-fill-opacity",type:"float",doc:"The opacity of the building as a whole, including all walls.","default-value":1},height:{css:"building-height",doc:"The height of the building in pixels.",type:"expression","default-value":"0"}}},colors:{aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50],transparent:[0,0,0,0]},filter:{value:["true","false","null","point","linestring","polygon","collection"]}};function xJ(t,e){for(var r=0;r1&&(e=arguments[1]),arguments.length>2&&(r=arguments[2]),{is:"tag",val:t,color:e,mode:r,toString:function(n){return'\n\t"}}},hsl:function(t,e,r){return this.hsla(t,e,r,1)},hsla:function(t,e,r,n){if([t=this.number(t)%360/360,e=this.number(e),r=this.number(r),n=this.number(n)].some(isNaN))return null;var o=r<=.5?r*(e+1):r+e-r*e,i=2*r-o;return this.rgba(255*a(t+1/3),255*a(t),255*a(t-1/3),n);function a(t){return 6*(t=t<0?t+1:t>1?t-1:t)<1?i+(o-i)*t*6:2*t<1?o:3*t<2?i+(o-i)*(2/3-t)*6:i}},hue:function(t){return"toHSL"in t?new _J.Tree.Dimension(Math.round(t.toHSL().h)):null},saturation:function(t){return"toHSL"in t?new _J.Tree.Dimension(Math.round(100*t.toHSL().s),"%"):null},lightness:function(t){return"toHSL"in t?new _J.Tree.Dimension(Math.round(100*t.toHSL().l),"%"):null},alpha:function(t){return"toHSL"in t?new _J.Tree.Dimension(t.toHSL().a):null},saturate:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.s+=e.value/100,r.s=this.clamp(r.s),this.hsla_simple(r)},desaturate:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.s-=e.value/100,r.s=this.clamp(r.s),this.hsla_simple(r)},lighten:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.l+=e.value/100,r.l=this.clamp(r.l),this.hsla_simple(r)},darken:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.l-=e.value/100,r.l=this.clamp(r.l),this.hsla_simple(r)},fadein:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.a+=e.value/100,r.a=this.clamp(r.a),this.hsla_simple(r)},fadeout:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.a-=e.value/100,r.a=this.clamp(r.a),this.hsla_simple(r)},spin:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL(),n=(r.h+e.value)%360;return r.h=n<0?360+n:n,this.hsla_simple(r)},replace:function(t,e,r){return"field"===t.is?t.toString+".replace("+e.toString()+", "+r.toString()+")":t.replace(e,r)},mix:function(t,e,r){var n=r.value/100,o=2*n-1,i=t.toHSL().a-e.toHSL().a,a=((o*i==-1?o:(o+i)/(1+o*i))+1)/2,s=1-a,u=[t.rgb[0]*a+e.rgb[0]*s,t.rgb[1]*a+e.rgb[1]*s,t.rgb[2]*a+e.rgb[2]*s],l=t.alpha*n+e.alpha*(1-n);return new _J.Tree.Color(u,l)},greyscale:function(t){return this.desaturate(t,new _J.Tree.Dimension(100))},"%":function(t){for(var e=Array.prototype.slice.call(arguments,1),r=t.value,n=0;n.5?l/(2-a-s):l/(a+s),a){case r:t=(n-o)/l+(n=0){if(!t.ppi)return t.error({message:"ppi is not set, so metric units can't be used",index:this.index}),{is:"undefined",value:"undefined"};this.value=this.value/this.densities[this.unit]*t.ppi,this.unit="px"}return this}},{key:"toColor",value:function(){return new _J.Tree.Color([this.value,this.value,this.value])}},{key:"round",value:function(){return this.value=Math.round(this.value),this}},{key:"toString",value:function(){return this.value.toString()}},{key:"operate",value:function(t,e,r){return"%"===this.unit&&"%"!==r.unit?(t.error({message:"If two operands differ, the first must not be %",index:this.index}),{is:"undefined",value:"undefined"}):"%"!==this.unit&&"%"===r.unit?"*"===e||"/"===e||"%"===e?(t.error({message:"Percent values can only be added or subtracted from other values",index:this.index}),{is:"undefined",value:"undefined"}):new _J.Tree.Dimension(_J.Tree.operate(e,this.value,this.value*r.value*.01),this.unit):new _J.Tree.Dimension(_J.Tree.operate(e,this.value,r.value),this.unit||r.unit)}}]),t}(),_J.Tree.Element=function(){function t(e){wJ(this,t),this.value=e.trim(),"#"===this.value[0]&&(this.type="id",this.clean=this.value.replace(/^#/,"")),"."===this.value[0]&&(this.type="class",this.clean=this.value.replace(/^\./,"")),-1!==this.value.indexOf("*")&&(this.type="wildcard")}return SJ(t,[{key:"specificity",value:function(){return["id"===this.type?1:0,"class"===this.type?1:0]}},{key:"toString",value:function(){return this.value}}]),t}(),_J.Tree.Expression=function(){function t(e){wJ(this,t),this.is="expression",this.value=e}return SJ(t,[{key:"ev",value:function(t){return this.value.length>1?new _J.Tree.Expression(this.value.map(function(e){return e.ev(t)})):this.value[0].ev(t)}},{key:"toString",value:function(t){return this.value.map(function(e){return e.toString(t)}).join(" ")}}]),t}(),_J.Tree.Field=function(){function t(e){wJ(this,t),this.is="field",this.value=e||""}return SJ(t,[{key:"toString",value:function(){return'["'+this.value.toUpperCase()+'"]'}},{key:"ev",value:function(){return this}}]),t}(),_J.Tree.Filter=function(){function t(e,r,n,o,i){wJ(this,t),this.ops={"<":[" < ","numeric"],">":[" > ","numeric"],"=":[" = ","both"],"!=":[" != ","both"],"<=":[" <= ","numeric"],">=":[" >= ","numeric"],"=~":[".match(","string",")"]},this.key=e,this.op=r,this.val=n,this.index=o,this.filename=i,this.id=this.key+this.op+this.val}return SJ(t,[{key:"ev",value:function(t){return this.key=this.key.ev(t),this.val=this.val.ev(t),this}},{key:"toString",value:function(){return"["+this.id+"]"}}]),t}(),_J.Tree.Filterset=function(){function t(){wJ(this,t),this.filters={}}return SJ(t,[{key:"toJS",value:function(t){function e(t){var e=t.op;"="===e&&(e="==");var r=t.val;void 0!==t._val&&(r=t._val.toString(!0)),t.key&&"scale"===t.key.value?r=+r:"string"!=typeof r&&"object"!==gJ(r)||(r="'"+r+"'");var n="attributes";return n+"&&"+n+t.key+"&&"+n+t.key+" "+e+r}var r=[];for(var n in this.filters)r.push(e(this.filters[n]));return r.join(" && ")}},{key:"toString",value:function(){var t=[];for(var e in this.filters)t.push(this.filters[e].id);return t.sort().join("\t")}},{key:"ev",value:function(t){for(var e in this.filters)this.filters[e].ev(t);return this}},{key:"clone",value:function(){var t=new _J.Tree.Filterset;for(var e in this.filters)t.filters[e]=this.filters[e];return t}},{key:"cloneWith",value:function(t){var e=[];for(var r in t.filters){var n=this.addable(t.filters[r]);if(!1===n)return!1;!0===n&&e.push(t.filters[r])}if(!e.length)return null;var o=new _J.Tree.Filterset;for(r in this.filters)o.filters[r]=this.filters[r];for(;r=e.shift();)o.add(r);return o}},{key:"addable",value:function(t){var e=t.key.toString(),r=t.val.toString();switch(r.match(/^[0-9]+(\.[0-9]*)?_match/)&&(r=parseFloat(r)),t.op){case"=":return void 0!==this.filters[e+"="]?this.filters[e+"="].val.toString()==r&&null:void 0===this.filters[e+"!="+r]&&(!(void 0!==this.filters[e+">"]&&this.filters[e+">"].val>=r)&&(!(void 0!==this.filters[e+"<"]&&this.filters[e+"<"].val<=r)&&(!(void 0!==this.filters[e+">="]&&this.filters[e+">="].val>r)&&!(void 0!==this.filters[e+"<="]&&this.filters[e+"<="].val"]&&this.filters[e+">"].val>=r?null:void 0!==this.filters[e+"<"]&&this.filters[e+"<"].val<=r?null:void 0!==this.filters[e+">="]&&this.filters[e+">="].val>r?null:!(void 0!==this.filters[e+"<="]&&this.filters[e+"<="].val":return e+"="in this.filters?!(this.filters[e+"="].val<=r)&&null:!(void 0!==this.filters[e+"<"]&&this.filters[e+"<"].val<=r)&&(!(void 0!==this.filters[e+"<="]&&this.filters[e+"<="].val<=r)&&(void 0!==this.filters[e+">"]&&this.filters[e+">"].val>=r?null:!(void 0!==this.filters[e+">="]&&this.filters[e+">="].val>r)||null));case">=":return void 0!==this.filters[e+"="]?!(this.filters[e+"="].val"]&&this.filters[e+">"].val>=r?null:!(void 0!==this.filters[e+">="]&&this.filters[e+">="].val>=r)||null));case"<":return void 0!==this.filters[e+"="]?!(this.filters[e+"="].val>=r)&&null:!(void 0!==this.filters[e+">"]&&this.filters[e+">"].val>=r)&&(!(void 0!==this.filters[e+">="]&&this.filters[e+">="].val>=r)&&(void 0!==this.filters[e+"<"]&&this.filters[e+"<"].val<=r?null:!(void 0!==this.filters[e+"<="]&&this.filters[e+"<="].valr)&&null:!(void 0!==this.filters[e+">"]&&this.filters[e+">"].val>=r)&&(!(void 0!==this.filters[e+">="]&&this.filters[e+">="].val>r)&&(void 0!==this.filters[e+"<"]&&this.filters[e+"<"].val<=r?null:!(void 0!==this.filters[e+"<="]&&this.filters[e+"<="].val<=r)||null))}}},{key:"conflict",value:function(t){var e=t.key.toString(),r=t.val.toString();return isNaN(parseFloat(r))||(r=parseFloat(r)),("="===t.op&&void 0!==this.filters[e+"="]&&r!=this.filters[e+"="].val.toString()||"!="===t.op&&void 0!==this.filters[e+"="]&&r==this.filters[e+"="].val.toString()||"="===t.op&&void 0!==this.filters[e+"!="]&&r===this.filters[e+"!="].val.toString())&&t.toString()+" added to "+this.toString()+" produces an invalid filter"}},{key:"add",value:function(t,e){var r,n=t.key.toString(),o=t.op,i=this.conflict(t);if(i)return i;if("="===o){for(var a in this.filters)this.filters[a].key===n&&delete this.filters[a];this.filters[n+"="]=t}else if("!="===o)this.filters[n+"!="+t.val]=t;else if("=~"===o)this.filters[n+"=~"+t.val]=t;else if(">"===o){for(var s in this.filters)this.filters[s].key===n&&this.filters[s].val<=t.val&&delete this.filters[s];this.filters[n+">"]=t}else if(">="===o){for(var u in this.filters)r=+this.filters[u].val.toString(),this.filters[u].key===n&&r",this.filters[n+">"]=t):this.filters[n+">="]=t}else if("<"===o){for(var l in this.filters)r=+this.filters[l].val.toString(),this.filters[l].key===n&&r>=t.val&&delete this.filters[l];this.filters[n+"<"]=t}else if("<="===o){for(var c in this.filters)r=+this.filters[c].val.toString(),this.filters[c].key===n&&r>t.val&&delete this.filters[c];void 0!==this.filters[n+"!="+t.val]?(delete this.filters[n+"!="+t.val],t.op="<",this.filters[n+"<"]=t):this.filters[n+"<="]=t}}}]),t}(),_J.Tree.Fontset=SJ(function t(e,r){wJ(this,t),this.fonts=r,this.name="fontset-"+e.effects.length}),_J.Tree.Invalid=function(){function t(e,r,n){wJ(this,t),this.is="invalid",this.chunk=e,this.index=r,this.type="syntax",this.message=n||"Invalid code: "+this.chunk}return SJ(t,[{key:"ev",value:function(t){return t.error({chunk:this.chunk,index:this.index,type:"syntax",message:this.message||"Invalid code: "+this.chunk}),{is:"undefined"}}}]),t}(),_J.Tree.Keyword=function(){function t(e){wJ(this,t),this.value=e;var r={transparent:"color",true:"boolean",false:"boolean"};this.is=r[e]?r[e]:"keyword"}return SJ(t,[{key:"ev",value:function(){return this}},{key:"toString",value:function(){return this.value}}]),t}(),_J.Tree.Literal=function(){function t(e){wJ(this,t),this.value=e||"",this.is="field"}return SJ(t,[{key:"toString",value:function(){return this.value}},{key:"ev",value:function(){return this}}]),t}(),_J.Tree.Operation=function(){function t(e,r,n){wJ(this,t),this.is="operation",this.op=e.trim(),this.operands=r,this.index=n}return SJ(t,[{key:"ev",value:function(t){var e,r=this.operands[0].ev(t),n=this.operands[1].ev(t);return"undefined"===r.is||"undefined"===n.is?{is:"undefined",value:"undefined"}:(r instanceof _J.Tree.Dimension&&n instanceof _J.Tree.Color&&("*"===this.op||"+"===this.op?(e=n,n=r,r=e):t.error({name:"OperationError",message:"Can't substract or divide a color from a number",index:this.index})),r instanceof _J.Tree.Quoted&&n instanceof _J.Tree.Quoted&&"+"!==this.op?(t.error({message:"Can't subtract, divide, or multiply strings.",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):r instanceof _J.Tree.Field||n instanceof _J.Tree.Field||r instanceof _J.Tree.Literal||n instanceof _J.Tree.Literal?"color"===r.is||"color"===n.is?(t.error({message:"Can't subtract, divide, or multiply colors in expressions.",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):new _J.Tree.Literal(r.ev(t).toString(!0)+this.op+n.ev(t).toString(!0)):void 0===r.operate?(t.error({message:"Cannot do math with type "+r.is+".",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):r.operate(t,this.op,n))}}]),t}(),_J.Tree.Quoted=function(){function t(e){wJ(this,t),this.is="string",this.value=e||""}return SJ(t,[{key:"toString",value:function(t){var e=this.value.replace(/&/g,"&"),r=e.replace(/\'/g,"\\'").replace(/\"/g,""").replace(//g,">");return!0===t?"'"+r+"'":e}},{key:"ev",value:function(){return this}},{key:"operate",value:function(t,e,r){return new _J.Tree.Quoted(_J.Tree.operate(e,this.toString(),r.toString(this.contains_field)))}}]),t}(),_J.Tree.Reference={_validateValue:{font:function(t,e){return!t.validation_data||!t.validation_data.fonts||-1!=t.validation_data.fonts.indexOf(e)}},setData:function(t){this.data=t,this.selector_cache=function(t){var e={};for(var r in t.symbolizers)for(var n in t.symbolizers[r])t.symbolizers[r][n].hasOwnProperty("css")&&(e[t.symbolizers[r][n].css]=[t.symbolizers[r][n],r,n]);return e}(t),this.mapnikFunctions=function(t){var e={};for(var r in t.symbolizers)for(var n in t.symbolizers[r])if("functions"===t.symbolizers[r][n].type)for(var o=0;o1?Array.prototype.push.apply(r,n.find(new _J.Tree.Selector(null,null,t.elements.slice(1)),e)):r.push(n);break}}),this._lookups[n]=r)}},{key:"evZooms",value:function(t){for(var e=0;e_J.Tree.Zoom.maxZoom||e<0)&&t.error({message:"Only zoom levels between 0 and "+_J.Tree.Zoom.maxZoom+" supported.",index:this.index}),this.op){case"=":return this.zoom="zoom && zoom === "+e,this;case">":this.zoom="zoom && zoom > "+e;break;case">=":this.zoom="zoom && zoom >= "+e;break;case"<":this.zoom="zoom && zoom < "+e;break;case"<=":this.zoom="zoom && zoom <= "+e}return this}},{key:"toString",value:function(){for(var t="",e=0;e<=_J.Tree.Zoom.maxZoom;e++)t+=this.zoom&1<=l[2]||l[1]<=l[3])&&(this.DVBOrigonPoint=[l[0],l[3]],this.DVBWidth=Math.abs(l[2]-l[0]),this.DVBHeight=Math.abs(l[1]-l[3]),this.DVBCenterPoint=[this.DVBOrigonPoint[0]+this.DVBWidth/2,this.DVBOrigonPoint[1]+this.DVBHeight/2],this.origonPointOffset=[this.DVBOrigonPoint[0]-a[0],this.DVBOrigonPoint[1]-a[1]],!0)}},{key:"resetLocation",value:function(t){t&&(this.lonlat=t);var e=this.getLocalXY(this.lonlat);e[0]+=this.XOffset,e[1]+=this.YOffset,this.location=e;var r=this.width,n=this.height,o=this.location;return this.chartBounds=new F(o[0]-r/2,o[1]+n/2,o[0]+r/2,o[1]-n/2),this.resetLinearGradient(),o}},{key:"resetLinearGradient",value:function(){}},{key:"shapesConvertToRelativeCoordinate",value:function(){for(var t=this.shapes,e=this.location,r=0,n=t.length;r=0?n.push(parseFloat(o[a].toString()).toFixed(r)):n.push(parseFloat(o[a].toString()))}catch(t){throw new Error("not a number")}return n.length===e.length&&n};var GJ=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&DJ(t,e)}(i,MJ);var e,r,n,o=FJ(i);function i(t,e,r,n,a){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(s=o.call(this,t,e,r,n,a)).CLASS_NAME="SuperMap.Feature.Theme.Bar",s}return e=i,(r=[{key:"destroy",value:function(){IJ(BJ(i.prototype),"destroy",this).call(this)}},{key:"assembleShapes",value:function(){var t={showShadow:!0,shadowBlur:8,shadowColor:"rgba(100,100,100,0.8)",shadowOffsetX:2,shadowOffsetY:2},e=this.setting;if(e.barLinearGradient||(e.barLinearGradient=[["#00FF00","#00CD00"],["#00CCFF","#5E87A2"],["#00FF66","#669985"],["#CCFF00","#94A25E"],["#FF9900","#A2945E"]]),e.dataViewBoxParameter||(void 0===e.useAxis||e.useAxis?e.dataViewBoxParameter=[45,15,15,15]:e.dataViewBoxParameter=[5,5,5,5]),this.initBaseParameter()){var r=this.DVBCodomain;this.DVBUnitValue=(r[1]-r[0])/this.DVBHeight;var n=this.dataViewBox,o=this.dataValues;if(!(o.length<1)){for(var i=0,a=o.length;ir[1])return;var s=this.calculateXShapeInfo();if(s){var u=s.xPositions,l=s.width;(void 0===e.useBackground||e.useBackground)&&this.shapes.push(os.Background(this.shapeFactory,this.chartBox,e)),(void 0===e.useAxis||e.useAxis)&&(this.shapes=this.shapes.concat(os.GraphAxis(this.shapeFactory,n,e,s)));for(var c=0;c=e.length&&(r%=e.length);var u=e[r][0],l=e[r][1],c=(new Kr).getLinearGradient(a,0,s,0,[[0,u],[1,l]]);o.style.color=c}}}}])&&NJ(e.prototype,r),n&&NJ(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function UJ(t){"@babel/helpers - typeof";return(UJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zJ(t,e){for(var r=0;re[1])return;var a=this.calculateXShapeInfo();if(a){var s=a.xPositions,u=a.width;(void 0===t.useBackground||t.useBackground)&&this.shapes.push(os.Background(this.shapeFactory,this.chartBox,t)),(!t.axis3DParameter||isNaN(t.axis3DParameter)||t.axis3DParameter<15)&&(t.axis3DParameter=20),(void 0===t.useAxis||t.useAxis)&&(this.shapes=this.shapes.concat(os.GraphAxis(this.shapeFactory,r,t,a)));for(var l=t.bar3DParameter&&!isNaN(t.bar3DParameter)?t.bar3DParameter:10,c=0;c=s[2]||s[1]<=s[3])&&(this.DVBOrigonPoint=[s[0],s[3]],this.DVBWidth=Math.abs(s[2]-s[0]),this.DVBHeight=Math.abs(s[1]-s[3]),this.DVBCenterPoint=[this.DVBOrigonPoint[0]+this.DVBWidth/2,this.DVBOrigonPoint[1]+this.DVBHeight/2],this.origonPointOffset=[this.DVBOrigonPoint[0]-o[0],this.DVBOrigonPoint[1]-o[1]],!0)}}])&&QJ(e.prototype,r),n&&QJ(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function eV(t){"@babel/helpers - typeof";return(eV="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rV(t,e){for(var r=0;r0?this.DVBUnitValue=t.maxR/(o[1]-o[0]):this.DVBUnitValue=t.maxR;var i=this.DVBUnitValue,a=n[0]*i+t.minR;if(this.width=2*a,this.height=2*a,this.initBaseParameter()&&(!o||!(n[0]o[1]))){var s=this.DVBCenterPoint,u=new sa(s[0],s[1],a);u.style=os.ShapeStyleTool(null,t.circleStyle,null,null,0),void 0!==t.fillColor?u.style.fillColor=t.fillColor:u.style.fillColor="#ff9277",u.highlightStyle=os.ShapeStyleTool(null,t.circleHoverStyle),void 0!==t.circleHoverAble&&(u.hoverable=t.circleHoverAble),void 0!==t.circleClickAble&&(u.clickable=t.circleClickAble),u.refDataID=this.data.id,u.dataInfo={field:this.fields[0],r:a,value:n[0]},this.shapes.push(this.shapeFactory.createShape(u)),this.shapesConvertToRelativeCoordinate()}}}])&&rV(e.prototype,r),n&&rV(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function uV(t){"@babel/helpers - typeof";return(uV="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function lV(t,e){for(var r=0;rr[1])return null;a=u[f],s=e[1]-(o[f]-r[0])/n;var p=new hi(a,s);p.style=os.ShapeStyleTool({fillColor:"#ee9900"},t.pointStyle,t.pointStyleByFields,t.pointStyleByCodomain,f,o[f]),p.highlightStyle=os.ShapeStyleTool(null,t.pointHoverStyle),void 0!==t.pointHoverAble&&(p.hoverable=t.pointHoverAble),void 0!==t.pointClickAble&&(p.clickable=t.pointClickAble),p.refDataID=this.data.id,p.dataInfo={field:this.fields[f],value:o[f]},c.push(this.shapeFactory.createShape(p));var y=[a,s];l.push(y)}var d=new gi(l);d.style=os.ShapeStyleTool({strokeColor:"#ee9900"},t.lineStyle),d.clickable=!1,d.hoverable=!1;var b=this.shapeFactory.createShape(d);this.shapes.push(b),this.shapes=this.shapes.concat(c),this.shapesConvertToRelativeCoordinate()}}}}},{key:"calculateXShapeInfo",value:function(){var t,e=this.dataViewBox,r=this.setting,n=this.dataValues.length;if(n<1)return null;var o=[],i=this.DVBWidth,a=0;if(r.xShapeBlank&&r.xShapeBlank.length&&2==r.xShapeBlank.length){var s=i-((t=r.xShapeBlank)[0]+t[1]);if(s<=n)return null;a=s/(n-1)}else t=[a=i/(n+1),a,a];for(var u=0,l=0;ln[1])return;for(var i=0,a=0;a=360&&(c=359.9999999);var d=new Gi(u[0],u[1],h,l,c);if(void 0===t.sectorStyleByFields){var b=p%e.length;d.style=os.ShapeStyleTool(null,t.sectorStyle,e,null,b)}else d.style=os.ShapeStyleTool(null,t.sectorStyle,t.sectorStyleByFields,t.sectorStyleByCodomain,p,r[p]);d.highlightStyle=os.ShapeStyleTool(null,t.sectorHoverStyle),void 0!==t.sectorHoverAble&&(d.hoverable=t.sectorHoverAble),void 0!==t.sectorClickAble&&(d.clickable=t.sectorClickAble),d.refDataID=this.data.id,d.dataInfo={field:this.fields[p],value:r[p]},this.shapes.push(this.shapeFactory.createShape(d)),l=c}this.shapesConvertToRelativeCoordinate()}}}}])&&bV(e.prototype,r),n&&bV(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function SV(t){"@babel/helpers - typeof";return(SV="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _V(t,e){for(var r=0;rr[1])return null;a=u[l],s=e[1]-(o[l]-r[0])/n;var f=new hi(a,s);f.style=os.ShapeStyleTool({fillColor:"#ee9900"},t.pointStyle,t.pointStyleByFields,t.pointStyleByCodomain,l,o[l]),f.highlightStyle=os.ShapeStyleTool(null,t.pointHoverStyle),void 0!==t.pointHoverAble&&(f.hoverable=t.pointHoverAble),void 0!==t.pointClickAble&&(f.clickable=t.pointClickAble),f.refDataID=this.data.id,f.dataInfo={field:this.fields[l],value:o[l]},this.shapes.push(this.shapeFactory.createShape(f))}this.shapesConvertToRelativeCoordinate()}}}},{key:"calculateXShapeInfo",value:function(){var t,e=this.dataViewBox,r=this.setting,n=this.dataValues.length;if(n<1)return null;var o=[],i=this.DVBWidth,a=0;if(r.xShapeBlank&&r.xShapeBlank.length&&2==r.xShapeBlank.length){var s=i-((t=r.xShapeBlank)[0]+t[1]);if(s<=n)return null;a=s/(n-1)}else t=[a=i/(n+1),a,a];for(var u=0,l=0;ln[1])return;for(var i=0,a=0;a=0&&e.innerRingRadius1&&void 0!==arguments[1]?arguments[1]:"warring";"success"===e?(this.icon.setAttribute("class","supermapol-icons-message-success"),this.messageBoxContainer.setAttribute("class","component-messageboxcontainer component-border-bottom-green")):"failure"===e?(this.icon.setAttribute("class","supermapol-icons-message-failure"),this.messageBoxContainer.setAttribute("class","component-messageboxcontainer component-border-bottom-red")):"warring"===e&&(this.icon.setAttribute("class","supermapol-icons-message-warning"),this.messageBoxContainer.setAttribute("class","component-messageboxcontainer component-border-bottom-orange")),this.messageBox.innerHTML=t,this.messageBoxContainer.hidden=!1}}])&&GV(e.prototype,r),n&&GV(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),zV=function(){try{return echarts}catch(t){return{}}}(),JV={"en-US":{title_dataFlowService:"Data Flow Service",title_distributedAnalysis:"Distributed Analysis",title_clientComputing:"Client Computing",title_dataServiceQuery:"Data Service Query",title_searchCity:"Search city",title_searchLayer:" Search layer",text_input_value_inputDataFlowUrl:"Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe",text_displayFeaturesInfo:"Display feature information",text_subscribe:"subscribe",text_cancelSubscribe:"unsubscribe",text_densityAnalysis:"Density Analysis",text_CalculateTheValuePerUnitArea:"Calculate the value per unit area within the neighborhood shape",text_option_selectDataset:"Please select a dataset",text_label_dataset:"Dataset",text_option_simplePointDensityAnalysis:"Simple point density analysis",text_option_nuclearDensityAnalysis:"Nuclear density analysis",text_label_analyticalMethod:"Analytical method",text_option_quadrilateral:"Quadrilateral",text_option_hexagon:"hexagon",text_label_meshType:"Mesh type",text_option_notSet:"Not set",text_label_weightField:"Weight field",text_label_gridSizeInMeters:"Grid size",text_label_searchRadius:"Search radius",text_label_queryRange:"Scope of analysis",text_label_areaUnit:"Area unit",text_option_equidistantSegmentation:"Equidistant segmentation",text_option_logarithm:"Logarithm",text_option_equalCountingSegment:"Equal counting segment",text_option_squareRootSegmentation:"Square root segmentation",text_label_thematicMapSegmentationMode:"Thematic map segmentation mode",text_label_thematicMapSegmentationParameters:"Thematic map segmentation parameters",text_option_greenOrangePurpleGradient:"Green orange purple gradient",text_option_greenOrangeRedGradient:"Green orange red gradient",text_option_rainbowGradient:"Rainbow gradient",text_option_spectralGradient:"Spectral gradient",text_option_terrainGradient:"Terrain gradient",text_label_thematicMapColorGradientMode:"Thematic map color gradient mode",text_label_resultLayerName:"Result layer name",text_chooseFile:"Open File",text_isoline:"Isoline",text_extractDiscreteValue:"Extract discrete value generation curve",text_buffer:"Buffer",text_specifyTheDistance:"Specify the distance to create the surrounding area",text_label_analysisLayer:"Analysis layer",text_label_extractField:"Extract field",text_label_extractedValue:"Extracted value",text_label_distanceAttenuation:"Distance attenuation",text_label_gridSize:"gridSize",text_label_bufferRadius:"Buffer radius",text_label_defaultkilometers:"Default 10 kilometers",text_label_kilometer:"kilometer",text_label_unit:"unit",text_retainOriginal:"Retain original object field",text_mergeBuffer:"Merge buffer",text_label_color:"Color",text_label_buffer:"[Buffer]",text_label_isolines:"[Isolines]",text_label_queryRangeTips:"The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850",text_label_queryModel:"Query mode",text_label_IDArrayOfFeatures:"ID array of features",text_label_maxFeatures:"The maximum number of features that can be returned",text_label_bufferDistance:"Buffer distance",text_label_queryRange1:"Query range",text_label_spatialQueryMode:"Spatial query mode",text_label_featureFilter:"Feature filter",text_label_geometricObject:"Geometric object",text_label_queryMode:"Query mode",text_label_searchTips:"Search for city locations or layer features",text_label_chooseSearchLayers:"Select a query layer",text_loadSearchCriteria:"Load search criteria",text_saveSearchCriteria:"Save search criteria",btn_analyze:"Analyze",btn_analyzing:"Analyzing",btn_emptyTheAnalysisLayer:"Empty the analysis layer",btn_cancelAnalysis:"Cancel",btn_query:"Query",btn_querying:"Querying",btn_emptyTheRresultLayer:"Clear all result layers","msg_dataReturnedIsEmpty.":"The request is successful and the data returned by the query is empty.",msg_dataFlowServiceHasBeenSubscribed:"The data stream service has been subscribed to.",msg_inputDataFlowUrlFirst:"Please enter the data stream service address first.",msg_datasetOrMethodUnsupport:"This dataset does not support this analysis type. Please reselect the dataset.",msg_selectDataset:"Please select a data set!",msg_setTheWeightField:"Please set the weight field!",msg_theFieldNotSupportAnalysis:"The field you currently select does not support analysis!",msg_resultIsEmpty:"The result of the analysis is empty!",msg_openFileFail:"Failed to open file!",msg_fileTypeUnsupported:"File format is not supported!",msg_fileSizeExceeded:"File size exceeded! The file size should not exceed 10M!",msg_dataInWrongGeoJSONFormat:"Wrong data format! Non standard GEOJSON format data!",msg_dataInWrongFormat:"Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!",msg_searchKeywords:"Search keywords cannot be empty. Please enter your search criteria.",msg_searchGeocodeField:"Did not match the address matching service data!",msg_cityGeocodeField:"The address matching service of the current city is not configured.",msg_getFeatureField:"No related vector features found!",msg_dataflowservicesubscribed:"The data stream service has been subscribed to.",msg_subscribesucceeded:"The data stream service subscription was successful.",msg_crsunsupport:"Does not support the coordinate system of the current map",msg_tilematrixsetunsupport:"Incoming TileMatrixSet is not supported",msg_jsonResolveFiled:"JSON format parsing failure!",msg_requestContentFiled:"Failed to request data through iportal!",msg_getdatafailed:"Failed to get data!"},"zh-CN":{title_dataFlowService:"数据流服务",title_distributedAnalysis:"分布式分析",title_clientComputing:"客户端计算",title_dataServiceQuery:"数据服务查询",title_searchCity:"搜索城市",title_searchLayer:"搜索图层",text_input_value_inputDataFlowUrl:"请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe",text_displayFeaturesInfo:"显示要素信息",text_subscribe:"订阅",text_cancelSubscribe:"取消订阅",text_densityAnalysis:"密度分析",text_CalculateTheValuePerUnitArea:"计算点指定邻域形状内的每单位面积量值",text_option_selectDataset:"请选择数据集",text_label_dataset:"数据集",text_option_simplePointDensityAnalysis:"简单点密度分析",text_option_nuclearDensityAnalysis:"核密度分析",text_label_analyticalMethod:"分析方法",text_option_quadrilateral:"四边形",text_option_hexagon:"六边形",text_label_meshType:"网格面类型",text_option_notSet:"未设置",text_label_weightField:"权重字段",text_label_gridSizeInMeters:"网格大小",text_label_searchRadius:"搜索半径",text_label_queryRange:"分析范围",text_label_areaUnit:"面积单位",text_option_equidistantSegmentation:"等距离分段",text_option_logarithm:"对数",text_option_equalCountingSegment:"等计数分段",text_option_squareRootSegmentation:"平方根分段",text_label_thematicMapSegmentationMode:"专题图分段模式",text_label_thematicMapSegmentationParameters:"专题图分段参数",text_option_greenOrangePurpleGradient:"绿橙紫渐变",text_option_greenOrangeRedGradient:"绿橙红渐变",text_option_rainbowGradient:"彩虹渐变",text_option_spectralGradient:"光谱渐变",text_option_terrainGradient:"地形渐变",text_label_thematicMapColorGradientMode:"专题图颜色渐变模式",text_label_resultLayerName:"结果图层名称",text_chooseFile:"选择文件",text_isoline:"等值线",text_extractDiscreteValue:"提取离散值生成曲线",text_buffer:"缓冲区",text_specifyTheDistance:"指定距离创建周边区域",text_label_analysisLayer:"分析图层",text_label_extractField:"提取字段",text_label_extractedValue:"提取值",text_label_distanceAttenuation:"距离衰减",text_label_gridSize:"栅格大小",text_label_bufferRadius:"缓冲半径",text_label_defaultkilometers:"默认10千米",text_option_kilometer:"千米",text_label_unit:"单位",text_retainOriginal:"保留原对象字段属性",text_mergeBuffer:"合并缓冲区",text_label_color:"颜色",text_label_buffer:"[缓冲区]",text_label_isolines:"[等值线]",text_label_queryRangeTips:"默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850",text_label_IDArrayOfFeatures:"要素 ID 数组",text_label_maxFeatures:"最多可返回的要素数量",text_label_bufferDistance:"缓冲区距离",text_label_queryRange1:"查询范围",text_label_spatialQueryMode:"空间查询模式",text_label_featureFilter:"要素过滤器",text_label_geometricObject:"几何对象",text_label_queryMode:"查询模式",text_label_searchTips:"搜索城市地点或图层要素",text_label_chooseSearchLayers:"选择查询图层",text_loadSearchCriteria:"加载搜索条件",text_saveSearchCriteria:"保存搜索条件",btn_analyze:"分析",btn_analyzing:"分析中",btn_emptyTheAnalysisLayer:"清空分析图层",btn_cancelAnalysis:"取消",btn_query:"查询",btn_querying:"查询中",btn_emptyTheRresultLayer:"清除所有结果图层",msg_dataFlowServiceHasBeenSubscribed:"已订阅该数据流服务。",msg_inputDataFlowUrlFirst:"请先输入数据流服务地址。",msg_datasetOrMethodUnsupport:"该数据集不支持本分析类型,请重新选择数据集",msg_selectDataset:"请选择数据集!",msg_setTheWeightField:"请设置权重字段!",msg_theFieldNotSupportAnalysis:"您当前选择的字段不支持分析!",msg_resultIsEmpty:"分析的结果为空!",msg_dataReturnedIsEmpty:"请求成功,查询返回的数据为空。",msg_openFileFail:"打开文件失败!",msg_fileTypeUnsupported:"不支持该文件格式!",msg_fileSizeExceeded:"文件大小超限!文件大小不得超过 10M!",msg_dataInWrongGeoJSONFormat:"数据格式错误!非标准的 GEOJSON 格式数据!",msg_dataInWrongFormat:"数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!",msg_searchKeywords:"搜索关键字不能为空,请输入搜索条件。",msg_searchGeocodeField:"未匹配到地址匹配服务数据!",msg_cityGeocodeField:"未配置当前城市的地址匹配服务。",msg_getFeatureField:"未查找到相关矢量要素!",msg_dataflowservicesubscribed:"已订阅该数据流服务。",msg_subscribesucceeded:"数据流服务订阅成功。",msg_crsunsupport:"不支持当前地图的坐标系",msg_tilematrixsetunsupport:"不支持传入的TileMatrixSet",msg_jsonResolveFiled:"json格式解析失败!",msg_requestContentFiled:"通过iportal请求数据失败!",msg_getdatafailed:"获取数据失败!"},code:null,defaultCode:"en-US",getCode:function(){return JV.code||JV.setCode(),JV.code},setCode:function(){var t=this.getLanguageFromCookie();t||(t=JV.defaultCode,t="Netscape"===navigator.appName?navigator.language:navigator.browserLanguage),0===t.indexOf("zh")&&(t="zh-CN"),0===t.indexOf("en")&&(t="en-US"),JV.code=t},getLanguageFromCookie:function(){for(var t=document.cookie.split(";"),e=0;e0){var a=i.SheetNames[0],s=VV.utils.sheet_to_csv(i.Sheets[a]);e&&e.call(n,s)}}catch(t){r&&r.call(n,t)}},o.onerror=function(t){r&&r.call(n,t)},this.rABF&&o.readAsArrayBuffer(t.file)},processDataToGeoJson:function(t,e,r,n,o){var i=null;if("EXCEL"===t||"CSV"===t)i=this.processExcelDataToGeoJson(e),r&&r.call(o,i);else if("JSON"===t||"GEOJSON"===t){var a=e;"string"==typeof a&&(a=JSON.parse(a)),"ISERVER"===a.type?i=a.data.recordsets[0].features:"FeatureCollection"===a.type?i=a:n&&n.call(o,JV.i18n("msg_dataInWrongGeoJSONFormat")),r&&r.call(o,i)}else n&&n.call(o,JV.i18n("msg_dataInWrongFormat"))},processExcelDataToGeoJson:function(t){for(var e=this.string2Csv(t),r=e.colTitles,n=-1,o=-1,i=0,a=r.length;i0?(n.dataItemServices.forEach(function(n){if("RESTDATA"===n.serviceType&&"PUBLISHED"===n.serviceStatus)o=n;else{if("RESTMAP"!==n.serviceType||"PUBLISHED"!==n.serviceStatus)return void r.getDatafromContent(t,e);o=n}}),o&&r.getDatafromRest(o.serviceType,o.address,e)):r.getDatafromContent(t,e):r._fireFailedEvent(n)}).catch(function(t){console.log(t),r._fireFailedEvent(t)})}},{key:"getDatafromContent",value:function(t,e){var r=this,n={result:{}},o=this;t+="/content.json?pageSize=9999999¤tPage=1",Hl.get(t,null,{withCredentials:this.datasets.withCredentials}).then(function(t){return t.json()}).then(function(t){if(!1!==t.succeed){if(t.type){if("JSON"===t.type||"GEOJSON"===t.type){if(t.content=JSON.parse(t.content.trim()),!t.content.features)return void console.log(JV.i18n("msg_jsonResolveFiled"));var i=r._formatGeoJSON(t.content);n.result.features={type:t.content.type,features:i}}else if("EXCEL"===t.type||"CSV"===t.type){var a=r._excelData2Feature(t.content);n.result.features={type:"FeatureCollection",features:a}}e(n,"content")}}else o._fireFailedEvent(t)},this).catch(function(t){console.log(t),o._fireFailedEvent(t)})}},{key:"getDatafromRest",value:function(t,e,r){var n=this,o=this.datasets.withCredentials;if("RESTDATA"===t){var i,a,s="".concat(e,"/data/datasources");Hl.get(s,null,{withCredentials:o}).then(function(t){return t.json()}).then(function(t){i=t.datasourceNames[0],s="".concat(e,"/data/datasources/").concat(i,"/datasets"),Hl.get(s,null,{withCredentials:o}).then(function(t){return t.json()}).then(function(t){return a=t.datasetNames[0],n.getDatafromRestData("".concat(e,"/data"),[i+":"+a],r),[i+":"+a]}).catch(function(t){n._fireFailedEvent(t)})}).catch(function(t){n._fireFailedEvent(t)})}else{var u,l,c,f="".concat(e,"/maps");Hl.get(f,null,{withCredentials:o}).then(function(t){return t.json()}).then(function(t){u=t[0].name,c=t[0].path,f=f="".concat(e,"/maps/").concat(u,"/layers"),Hl.get(f,null,{withCredentials:o}).then(function(t){return t.json()}).then(function(t){return l=t[0].subLayers.layers[0].caption,n.getDatafromRestMap(l,c,r),l}).catch(function(t){n._fireFailedEvent(t)})}).catch(function(t){n._fireFailedEvent(t)})}}},{key:"getDatafromRestData",value:function(t,e,r){var n=this;this.datasets.queryInfo.attributeFilter=this.datasets.queryInfo.attributeFilter||"SmID>0",this._getFeatureBySQL(t,e,this.datasets.queryInfo,function(t){r(t,"RESTDATA")},function(t){console.log(t),n._fireFailedEvent(t)})}},{key:"getDatafromRestMap",value:function(t,e,r){var n=this;this.datasets.queryInfo.attributeFilter=this.datasets.queryInfo.attributeFilter||"smid=1",this._queryFeatureBySQL(e,t,this.datasets.queryInfo,null,null,function(t){r(t,"RESTMAP")},function(t){console.log(t),n._fireFailedEvent(t)})}},{key:"_getFeatureBySQL",value:function(t,e,r,n,o){var i,a,s={name:e.join().replace(":","@")};Object.assign(s,r),i=new Fb(s),a=new lv({queryParameter:i,datasetNames:e,fromIndex:0,toIndex:1e5,returnContent:!0}),new bv(t).processAsync(a,function(t){"processCompleted"===t.type?n&&n(t):o&&o(t)})}},{key:"_queryFeatureBySQL",value:function(t,e,r,n,o,i,a,s,u,l){var c,f,h={name:e};Object.assign(h,r),c=new Fb(h),n&&(c.fields=n);var p={queryParams:[c]};l&&(p.queryOption=Re.ATTRIBUTE),s&&(p.startRecord=s),u&&(p.expectCount=u),o&&(p.prjCoordSys={epsgCode:o}),f=new EC(p),this._queryBySQL(t,f,function(t){"processCompleted"===t.type?i(t):a(t)})}},{key:"_queryBySQL",value:function(t,e,r,n){new NC(t,{format:this._processFormat(n)}).processAsync(e,r)}},{key:"_processFormat",value:function(t){return t||Ee.GEOJSON}},{key:"_formatGeoJSON",value:function(t){var e=t.features;return e.forEach(function(t,e){t.properties.index=e}),e}},{key:"_excelData2Feature",value:function(t){for(var e=t.colTitles,r=-1,n=-1,o=0,i=e.length;o=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function QV(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&t.forEach(function(t){t.xAxis&&e.xField.push({field:t.xAxis.field,name:t.xAxis.name}),t.yAxis&&e.yField.push({field:t.yAxis.field,name:t.yAxis.name})})}},{key:"getDatasetInfo",value:function(t){var e=this;this.createChart=t,this.datasets&&this._checkUrl(this.datasets.url)&&(this.chartModel=new WV(this.datasets),"iServer"===this.datasets.type?this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this)):"iPortal"===this.datasets.type&&this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this)),this.chartModel.events.on({getdatafailed:function(t){e.events.triggerEvent("getdatafailed",t)}}))}},{key:"_getDatasetInfoSuccess",value:function(t){var e=this.datasets.url,r=e.indexOf("rest");if(r>0){var n=e.indexOf("/",r+5),o=e.substring(r+5,n),i=e.substring(0,r+4)+"/data";if("maps"===o){var a=e.indexOf("/",n+1),s=e.substring(n+1,a);i=e.substring(0,r+4)+"/maps/"+s,t.result.dataUrl=i,this._getLayerFeatures(t)}else"data"===o&&(t.result.dataUrl=i,this._getDataFeatures(t))}}},{key:"_getDataInfoSuccess",value:function(t,e){"RESTMAP"===e?this._getChartDatasFromLayer(t):this._getChartDatas(t)}},{key:"_getDataFeatures",value:function(t){this.chartModel.getDataFeatures(t,this._getChartDatas.bind(this))}},{key:"_getLayerFeatures",value:function(t){this.chartModel.getLayerFeatures(t,this._getChartDatasFromLayer.bind(this))}},{key:"_getChartDatas",value:function(t){if(t){this.features=t.result.features;var e=this.features.features,r={};if(e.length){var n=e[0],o=[],i=[];for(var a in n.properties)o.push(a),i.push(this._getDataType(n.properties[a]));for(var s in r={features:e,fieldCaptions:o,fieldTypes:i,fieldValues:[]},i){var u=[];for(var l in e){var c=e[l],f=r.fieldCaptions[s],h=c.properties[f];u.push(h)}r.fieldValues.push(u)}this.createChart(r)}}}},{key:"_getChartDatasFromLayer",value:function(t){if(t.result.recordsets){var e=t.result.recordsets[0],r=e.features.features;this.features=e.features;var n={};if(r.length){for(var o in(n={features:e.features,fieldCaptions:e.fieldCaptions,fieldTypes:e.fieldTypes,fieldValues:[]}).fieldCaptions){var i=[];for(var a in r){var s=r[a],u=n.fieldCaptions[o],l=s.properties[u];i.push(l)}n.fieldValues.push(i)}this.createChart(n)}}}},{key:"_createChartOptions",value:function(t){return this.calculatedData=this._createChartDatas(t),this.updateChartOptions(this.chartType)}},{key:"changeType",value:function(t){if(t!==this.chartType)return this.chartType=t,this.updateChartOptions(this.chartType)}},{key:"updateData",value:function(t,e,r){this.updateChart=r,this.xField=[],this.yField=[],this._initXYField(e),t.type=t.type||"iServer",t.withCredentials=t.withCredentials||!1,this.datasets=t,this.getDatasetInfo(this._updateDataSuccess.bind(this))}},{key:"_updateDataSuccess",value:function(t){var e=this._createChartOptions(t);this.updateChart(e)}},{key:"updateChartOptions",value:function(t,e){if(this.calculatedData){var r=this.grid,n=this._createChartSeries(this.calculatedData,t),o=[];for(var i in this.calculatedData.XData)o.push({value:this.calculatedData.XData[i].fieldsData});var a={type:"category",name:this.xField[0].name||"X",data:o,nameTextStyle:{color:"#fff",fontSize:14},splitLine:{show:!1},axisLine:{lineStyle:{color:"#eee"}}},s={type:"value",name:this.yFieldName||"Y",data:{},nameTextStyle:{color:"#fff",fontSize:14},splitLine:{show:!1},axisLine:{lineStyle:{color:"#eee"}}},u={formatter:"{b0}: {c0}"},l="#404a59";return e&&(e.grid&&(r=e.grid),e.tooltip&&(u=e.tooltip),e.backgroundColor&&(l=e.backgroundColor)),{backgroundColor:l,grid:r,series:n,xAxis:a,yAxis:s,tooltip:u}}}},{key:"_createChartDatas",value:function(t){var e=0,r=[],n=t.fieldCaptions,o=this;n.forEach(function(t,r){o.xField[0]&&t===o.xField[0].field&&(e=r)}),this.yFieldName="",this.yField.forEach(function(t,e){0!==e&&(o.yFieldName=o.yFieldName+","),o.yFieldName=o.yFieldName+t.name,n.forEach(function(e,n){e===t.field&&r.push(n)})});var i=this._getAttrData(t,e),a=[];if(r.length>0)r.forEach(function(e){var r=[];for(var n in t.fieldValues[e])r.push({value:t.fieldValues[e][n]});a.push(r)});else{for(var s=[],u=[],l=i.length,c=0;c0;t--)this.header.removeChild(this.header.children[t]),this.content.removeChild(this.content.children[t])}},{key:"_changeTabsPage",value:function(t){for(var e=t.target.index,r=0;r0;e--)this.content.removeChild(this.content.children[e-1]);var r=this.config[t];for(var n in r)this._createCityItem(n,r[n])}},{key:"_createCityItem",value:function(t,e){var r=document.createElement("div"),n=document.createElement("div");n.setAttribute("class","component-citytabpag__py-key"),n.innerHTML=t,r.appendChild(n);var o=document.createElement("div");o.setAttribute("class","component-citytabpag__content");for(var i=0;i0&&this.appendTabs(t),this.rootContainer=e}},{key:"setTabs",value:function(t){this.removeAllTabs(),this.appendTabs(t)}},{key:"appendTabs",value:function(t){for(var e=0;e0;t--)this.navTabsTitle.removeChild(this.navTabsTitle.children[t]),this.navTabsContent.removeChild(this.navTabsContent.children[t])}},{key:"_changeTabsPage",value:function(t){for(var e=t.target.index,r=0;r=0;t--)this.content.removeChild(this.content.children[t])}},{key:"setPageLink",value:function(t){this.pageNumberLis=[],this.currentPageNumberLis=[],this.clearPageLink(),this._createPageLi(t),this._appendPageLink()}},{key:"_createPageLi",value:function(t){for(var e=0;e1;t--)this.link.removeChild(this.link.children[t])}},{key:"_createLink",value:function(t){for(var e=0;e<4;e++){var r=document.createElement("li");r.setAttribute("class","disable");var n=document.createElement("span");r.appendChild(n),0===e?(n.id="first",n.setAttribute("class","supermapol-icons-first")):1===e?(n.id="prev",n.setAttribute("class","supermapol-icons-prev")):2===e?(n.id="next",n.setAttribute("class","supermapol-icons-next")):3===e&&(n.id="last",n.setAttribute("class","supermapol-icons-last")),t.appendChild(r)}}},{key:"_changePageEvent",value:function(t){var e=t.target;if("disable"!==e.parentElement.classList[0]){var r;if(e.id)r=e.id;else{if(!Number(e.innerHTML))return;r=Number(e.innerHTML)}this._prePageNum(r),this.clearPageLink(),this._appendPageLink()}}},{key:"_changeDisableState",value:function(){this.link.children[0].setAttribute("class",""),this.link.children[1].setAttribute("class",""),this.link.children[this.link.children.length-1].setAttribute("class",""),this.link.children[this.link.children.length-2].setAttribute("class",""),1===this.currentPage&&(this.link.children[0].setAttribute("class","disable"),this.link.children[1].setAttribute("class","disable")),this.currentPage===this.pageNumberLis.length&&(this.link.children[this.link.children.length-1].setAttribute("class","disable"),this.link.children[this.link.children.length-2].setAttribute("class","disable"))}},{key:"_prePageNum",value:function(t){var e=[];if(this.currentPage="first"===t?1:"last"===t?this.pageNumberLis.length:"prev"===t?this.currentPage-1:"next"===t?this.currentPage+1:t,this.pageNumberLis.length<=5)for(var r=0;r=this.pageNumberLis.length-3)for(var o=this.pageNumberLis.length-5;o0&&(this.currentPageNumberLis=e)}}])&&Zq(e.prototype,r),n&&Zq(e,n),Object.defineProperty(e,"prototype",{writable:!1}),i}();function rH(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function nH(t){for(var e=1;e|<|=|!/g," ").split(" ").filter(function(t){return t}).forEach(function(t){var n=e.find(function(e){return e===t});if(uH(t)&&n&&(r=r.replace(n,"$"+n)),n){var o=iH(n);r=r.replace(n,o)}}),r}function sH(t){var e={};for(var r in t){var n=r;uH(r)&&(n="$"+r),e[n=iH(n)]=t[r]}return e}function uH(t){return/^\d/.test(t)}LF.Lang=JV,LF.i18n=LF.Lang.i18n,LF.Util=nH(nH({},LF.Util),A),LF.Browser=T,LF.INCHES_PER_UNIT=M,LF.METERS_PER_INCH=L,LF.DOTS_PER_INCH=96,LF.IS_GECKO=R,LF.setCORS=function(t){Ml=t},LF.isCORS=Vl,LF.setRequestTimeout=function(t){return Ll=t},LF.getRequestTimeout=ql,LF.FetchRequest=Hl,LF.inherit=function(t,e){var r,n,o,i=function(){};for(i.prototype=e.prototype,t.prototype=new i,r=2,n=arguments.length;r-1){var n=this.server.split(r);n.length>1&&(e=n[0]+r+this.server+"web/maps/"+this.mapId+"/map.json")}this._getMapInfo(e)}},{key:"_createMap",value:function(t){var e=[],r=t.layers;r&&r.length>0&&r.forEach(function(t){t.labelStyle&&e.push(t.labelStyle.fontFamily)},this),e.push("'supermapol-icons'");var n,i=e.join(","),a=t.center,s=t.level||0,u=0;if(t.minScale&&t.maxScale)u=this._transformScaleToZoom(t.minScale,o().CRS?o().CRS.get(this.baseProjection):"EPSG:3857");else{var l=this._getResolution(o().CRS?o().CRS.get(this.baseProjection).getExtent():[-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892])/this._getResolution(t.extent);u=+Math.log(l)/Math.LN2.toFixed(2)}s+=u,n=a?this._unproject([a.x,a.y]):new(o().LngLat)(0,0),this.map=new(o().Map)({container:this.target,center:n,zoom:s,style:{version:8,sources:{},layers:[]},crs:this.baseProjection,localIdeographFontFamily:i||""}),this.fire("mapinitialized")}},{key:"_getMapInfo",value:function(t){var e=this,r=-1===t.indexOf(".json")?"".concat(t,".json"):t;Hl.get(r,null,{withCredentials:this.withCredentials}).then(function(t){return t.json()}).then(function(t){e.baseProjection=t.projection,e.mapParams={title:t.title,description:t.description};if(!(e.baseProjection in{"EPSG:4490":"EPSG:4490","EPSG:4214":"EPSG:4214","EPSG:4610":"EPSG:4610","EPSG:3857":"EPSG:3857","EPSG:4326":"EPSG:4326"}))throw Error(JV.i18n("msg_crsunsupport"));e._createMap(t,e.mapSetting);var r=t.layers;e.map.on("load",function(){e._addBaseMap(t),r&&0!==r.length?e._addLayers(r):e._sendMapToUser(0,0)})}).catch(function(t){e.fire("getmapfailed",{error:t})})}},{key:"_addBaseMap",value:function(t){this._createBaseLayer(t)}},{key:"_createBaseLayer",value:function(t){var e=t.baseLayer||t,r=e.layerType;(r.indexOf("TIANDITU_VEC")>-1||r.indexOf("TIANDITU_IMG")>-1||r.indexOf("TIANDITU_TER")>-1)&&(r=r.substr(0,12));var n;switch(r){case"TIANDITU_VEC":case"TIANDITU_IMG":case"TIANDITU_TER":this._createTiandituLayer(t);break;case"BING":this._createBingLayer(e.name);break;case"WMS":this._createWMSLayer(e);break;case"WMTS":this._createWMTSLayer(e);break;case"TILE":case"SUPERMAP_REST":this._createDynamicTiledLayer(e);break;case"CLOUD":case"CLOUD_BLACK":case"OSM":case"JAPAN_ORT":case"JAPAN_RELIEF":case"JAPAN_PALE":case"JAPAN_STD":case"GOOGLE_CN":case"GOOGLE":n={CLOUD:"http://t2.dituhui.com/FileService/image?map=quanguo&type=web&x={x}&y={y}&z={z}",CLOUD_BLACK:"http://t3.dituhui.com/MapService/getGdp?x={x}&y={y}&z={z}",OSM:"http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png",GOOGLE:"https://www.google.cn/maps/vt/pb=!1m4!1m3!1i{z}!2i{x}!3i{y}!2m3!1e0!2sm!3i380072576!3m8!2szh-CN!3scn!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e0!5m1!1e0",GOOGLE_CN:"https://mt{0-3}.google.cn/vt/lyrs=m&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}",JAPAN_STD:"https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png",JAPAN_PALE:"https://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png",JAPAN_RELIEF:"https://cyberjapandata.gsi.go.jp/xyz/relief/{z}/{x}/{y}.png",JAPAN_ORT:"https://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg"}[r],this._createXYZLayer(e,n);break;case"MAPBOXSTYLE":this._createMapboxStyle(e)}}},{key:"_createMapboxStyle",value:function(t){var e,r=this,n=t.dataSource,o=void 0===n?{}:n,i=o.serverId,a=o.url;e=void 0!==i?"".concat(this.server,"web/datas/").concat(i,"/download"):a,Hl.get(e,null,{withCredentials:this.withCredentials,withoutFormatSuffix:!0,headers:{"Content-Type":"application/json;chartset=uft-8"}}).then(function(t){return t.json()}).then(function(t){r._matchStyleObject(t),r.map.setStyle(t)})}},{key:"_matchStyleObject",value:function(t){var e=t.sprite,r=t.glyphs;e&&"object"===hH(e)&&(t.sprite=Object.values(e)[0]),r&&"object"===hH(r)&&(t.glyphs=Object.values(r)[0])}},{key:"_createTiandituLayer",value:function(t){var e=this._getTiandituUrl(t),r=t.baseLayer.layerType,n=Boolean(t.baseLayer.labelLayerVisible),o=e.labelUrl,i=e.tiandituUrl;this._addBaselayer(i,"tianditu-layers-"+r),n&&this._addBaselayer(o,"tianditu-label-layers-"+r)}},{key:"_createWMTSLayer",value:function(t){var e=this,r=this._getWMTSUrl(t);this._filterWMTSIsMatched(t,function(n,o){n&&e._addBaselayer([r],"wmts-layers"+t.name,0,o)})}},{key:"_filterWMTSIsMatched",value:function(t,e){var r=this,n=!1,o=22,i=t.url;Hl.get(i,null,{withCredentials:!1,withoutFormatSuffix:!0}).then(function(t){return t.text()}).then(function(i){var a=new fH.XMLParser({numberParseOptions:{hex:!1,leadingZeros:!1,eNotation:!1},alwaysCreateTextNode:!0,textNodeName:"_text"}).parse(i).Capabilities.Contents.TileMatrixSet;Array.isArray(a)||(a=[a]);for(var s=0;s-1)n=!0;else{if(!a[s].WellKnownScaleSet||"Custom"!==a[s].WellKnownScaleSet._text)throw Error(JV.i18n("msg_tilematrixsetunsupport"));for(var u=[],l="EPSG:3857"===r.map.crs?vH:mH,c=0,f=l.length;c-1&&(r.svgDiv||(r.svgDiv=document.createElement("div"),document.body.appendChild(r.svgDiv)),r._getCanvasFromSVG(o.src,r.svgDiv,function(e){var n=e.toDataURL("img/png");n&&r.map.loadImage(n,function(e,n){e&&console.log(e),r.map.addImage(s+"",n),r.map.addLayer({id:u,type:"symbol",source:a,layout:{"icon-image":s+"","icon-size":o.scale,visibility:t.visible}})},r)})),!o.src){var l={layout:{}};"LINESTRING"===n&&o.lineCap&&(n="LINE",l.layout={"line-cap":o.lineCap});var c=t.visible;l.layout.visibility=c,l.style=r._transformStyleToMapBoxGl(o,n),r._addOverlayToMap(n,a,u,l),"POLYGON"===n&&o.strokeColor&&r._addStrokeLineForPoly(o,a,u+"-strokeLine",c)}},this)}},{key:"setFeatureInfo",value:function(t){var e,r=t.dv_v5_markerInfo;if(!r||!r.dataViz_title)return r;e=r;var n=t.properties;for(var o in e)n[o]&&(e[o]=n[o],delete n[o]);return e}},{key:"_createHeatLayer",value:function(t,e){var r=t.themeSetting,n={};n.gradient=r.colors.slice(),n.radius=parseInt(r.radius);var o=r.customSettings;for(var i in o)n.gradient[i]=o[i];r.weight&&this._changeWeight(e,r.weight);var a=["interpolate",["linear"],["heatmap-density"]],s=(1/n.gradient.length).toFixed(2);n.gradient.forEach(function(t,e){a.push(e*s),0===e&&(t=Er.hexToRgba(t,0)),a.push(t)});var u={"heatmap-color":a,"heatmap-radius":r.radius+15,"heatmap-intensity":{base:1,stops:[[0,.8],[22,1]]}};if(e[0].weight&&e.length>=4){var l=[];e.forEach(function(t){l.push(t.weight)});var c=bJ.getMax(l),f=bJ.getMin(l);u["heatmap-weight"]=["interpolate",["linear"],["get","weight"],f,0,c,1]}this.map.addLayer({id:t.layerID,type:"heatmap",source:{type:"geojson",data:{type:"FeatureCollection",features:e}},paint:u})}},{key:"_changeWeight",value:function(t,e){this.fieldMaxValue={},this._getMaxValue(t,e);var r=this.fieldMaxValue[e];t.forEach(function(t){var n=t.properties[e];t.weight=n/r})}},{key:"_getMaxValue",value:function(t,e){var r,n=[],o=e;this.fieldMaxValue[o]||(t.forEach(function(t){(r=t.properties)&&parseFloat(r[o])&&n.push(parseFloat(r[o]))}),this.fieldMaxValue[o]=bJ.getArrayStatistic(n,"Maximum"))}},{key:"_createRangeLayer",value:function(t,e){var r=t.themeSetting.themeField,n=t.style,o=t.featureType,i=this._getRangeStyleGroup(t,e),a={type:"geojson",data:{type:"FeatureCollection",features:e=this._getFiterFeatures(t.filterCondition,e)}},s=["match",["get","index"]];e.forEach(function(t){for(var e=parseFloat(t.properties[r]),n=0;n0&&n.push(i)}return n}},{key:"_replaceFilterCharacter",value:function(t){return t=t.replace(/=/g,"==").replace(/AND|and/g,"&&").replace(/or|OR/g,"||").replace(/<==/g,"<=").replace(/>==/g,">=")}},{key:"_getRangeStyleGroup",value:function(t,e){var r,n=t.featureType,o=t.style,i=[],a=t.themeSetting,s=a.customSettings,u=a.themeField,l=a.segmentCount;e.forEach(function(t){(r=t.properties||t.get("Properties"))?r[u]&&Er.isNumber(r[u])&&i.push(parseFloat(r[u])):t.get(u)&&Er.isNumber(t.get(u))&&t.get(u)&&i.push(parseFloat(t.get(u)))},this);var c=bJ.getArraySegments(i,a.segmentMethod,l);if(c){var f=l;for(var h in r&&c[0]===c[r.length-1]&&(f=1,c.length=2),c){var p=c[h];p=0==h?Math.floor(100*p)/100:Math.ceil(100*p)/100+.1,c[h]=Number(p.toFixed(2))}for(var y=a.colors,d=0;d1e-7;s++)e=1,a+=u=Math.PI/2-2*Math.atan(i*e)-a;return new(o().LngLat)(t[0]*r/n,a*r)}},{key:"_getParamString",value:function(t,e,r){var n=[];for(var o in t)n.push((r?o.toUpperCase():o)+"="+t[o]);return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}},{key:"_isXField",value:function(t){var e=t.toLowerCase();return"x"===e||"smx"===e||"jd"===e||"经度"===e||"东经"===e||"longitude"===e||"lot"===e||"lon"===e||"lng"===e}},{key:"_isYField",value:function(t){var e=t.toLowerCase();return"y"===e||"smy"===e||"wd"===e||"纬度"===e||"北纬"===e||"latitude"===e||"lat"===e}},{key:"_transformStyleToMapBoxGl",value:function(t,e,r){var n={};"POINT"!==t.type&&"BASIC_POINT"!==t.type&&"POINT"!==e||"LINE"===e?"LINE"===e?n={strokeWidth:"line-width",strokeColor:"line-color",strokeOpacity:"line-opacity"}:"POLYGON"===e&&(n={fillColor:"fill-color",fillOpacity:"fill-opacity",strokeColor:"fill-outline-color"}):n={fillColor:"circle-color",strokeWidth:"circle-stroke-width",fillOpacity:"circle-opacity",radius:"circle-radius",strokeColor:"circle-stroke-color",strokeOpacity:"circle-stroke-opacity"};var o={};for(var i in t)n[i]&&(o[n[i]]=t[i]);return r&&(o["circle-color"]?o["circle-color"]=r:o["line-color"]?o["line-color"]=r:o["fill-color"]=r),t.lineDash&&"solid"!==t.lineDash&&"LINE"===e&&(o["line-dasharray"]=this._dashStyle(t)),o}},{key:"_dashStyle",value:function(t){if(!t)return[];var e=t.strokeDashstyle||t.lineDash;switch(e){case"solid":return[];case"dot":return[1,4];case"dash":return[4,4];case"dashdot":return[4,4,1,4];case"longdash":return[8,4];case"longdashdot":return[8,4,1,4];default:return e?A.isArray(e)?e:(e=p.trim(e).replace(/\s+/g,",")).replace(/\[|\]/gi,"").split(","):[]}}},{key:"_getCanvasFromSVG",value:function(t,e,r){var n=this,o=document.createElement("canvas");o.id="dataviz-canvas-"+Er.newGuid(8),o.style.display="none",e.appendChild(o);var i=window.canvg&&window.canvg.default?window.canvg.default:cH(),a=o.getContext("2d");i.from(a,t,{ignoreMouse:!0,ignoreAnimation:!0,forceRedraw:function(){return!1}}).then(function(t){t.start(),n._canvgsV.push(t),o.width>300||o.height>300||r(o)})}},{key:"_stopCanvg",value:function(){this._canvgsV.forEach(function(t){return t.stop()}),this._canvgsV=[]}},{key:"_addOverlayToMap",value:function(t,e,r,n){"circle"!==(t={POINT:"circle",LINE:"line",POLYGON:"fill"}[t])&&"line"!==t&&"fill"!==t||this.map.addLayer({id:r,type:t,source:e,paint:n.style,layout:n.layout||{}})}},{key:"_addBaselayer",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:22,o=arguments.length>4?arguments[4]:void 0;this.map.addLayer({id:e,type:"raster",source:{type:"raster",tiles:t,tileSize:256,rasterSource:o?"iserver":"",prjCoordSys:o?{epsgCode:this.baseProjection.split(":")[1]}:""},minzoom:r,maxzoom:n})}},{key:"_addStrokeLineForPoly",value:function(t,e,r,n){var o={};o.style=this._transformStyleToMapBoxGl(t,"LINE"),o.layout={visibility:n},this._addOverlayToMap("LINE",e,r,o)}},{key:"_parseGeoJsonData2Feature",value:function(t){for(var e=t.allDatas.features,r=[],n=0,o=e.length;n 0"}),i=new lv({queryParameter:o,datasetNames:e,fromIndex:0,toIndex:1e5,returnContent:!0}),new bv(t).processAsync(i,function(t){"processCompleted"===t.type?r(t):n(t)})}},{key:"_queryFeatureBySQL",value:function(t,e,r,n,o,i,a,s,u,l){var c,f;c=new Fb({name:e,attributeFilter:r}),n&&(c.fields=n);var h={queryParams:[c]};l&&(h.queryOption=Re.ATTRIBUTE),s&&(h.startRecord=s),u&&(h.expectCount=u),o&&(h.prjCoordSys={epsgCode:o}),f=new EC(h),new oR(t).queryBySQL(f,function(t){"processCompleted"===t.type?i(t):a(t)})}},{key:"_handleMultyPolygon",value:function(t){return t.forEach(function(t){if("Polygon"===t.geometry.type){var e=t.geometry.coordinates;if(e.length>1){var r=[];e.forEach(function(t){r.push([t])}),t.geometry.coordinates=r,t.geometry.type="MultiPolygon"}}}),t}},{key:"_transformScaleToZoom",value:function(t,e){var r=295829515.2024169;"EPSG:3857"!==(e||this.map.getCRS()).epsgCode&&(r=295295895);var n=t.split(":")[1];return Math.min(24,+Math.log2(r/+n).toFixed(2))}},{key:"_getResolution",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:512;return t.leftBottom&&t.rightTop?Math.max(t.rightTop.x-t.leftBottom.x,t.rightTop.y-t.leftBottom.y)/e:Math.max(t[2]-t[0],t[3]-t[1])/e}}])&&pH(e.prototype,r),n&&pH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),a}();function OH(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:22,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:512,n=[],o=Math.abs(t.left-t.right)/r,i=0;iMath.abs(t-e[o])&&(r=Math.abs(t-e[o]),n=o);return n}(Js(r,n,o),i)}var xH=1,kH=2,jH=3,EH=4,TH=5,CH=6378137,RH=6356752.314,AH=.0066943799901413165,MH=484813681109536e-20,LH=Math.PI/2,NH=.16666666666666666,IH=.04722222222222222,DH=.022156084656084655,FH=1e-10,BH=.017453292519943295,GH=57.29577951308232,UH=Math.PI/4,zH=2*Math.PI,JH=3.14159265359,VH={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},qH={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},HH=/[\s_\-\/\(\)]/g;function WH(t,e){if(t[e])return t[e];for(var r,n=Object.keys(t),o=e.toLowerCase().replace(HH,""),i=-1;++i=this.text.length)return;t=this.text[this.place++]}switch(this.state){case XH:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},rW.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(tW.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},rW.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=XH)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=XH,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},rW.prototype.number=function(t){if(!eW.test(t)){if(tW.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},rW.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},rW.prototype.keyword=function(t){if($H.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=XH)}if(!tW.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},rW.prototype.neutral=function(t){if(KH.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(eW.test(t))return this.word=t,void(this.state=3);if(!tW.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},rW.prototype.output=function(){for(;this.place0?90:-90)):(t.lat0=sW(t.lat1>0?90:-90),t.lat_ts=t.lat1)}(o),o}function lW(t){var e=this;if(2===arguments.length){var r=arguments[1];"string"==typeof r?"+"===r.charAt(0)?lW[t]=YH(arguments[1]):lW[t]=uW(arguments[1]):lW[t]=r}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){Array.isArray(t)?lW.apply(e,t):lW(t)});if("string"==typeof t){if(t in lW)return lW[t]}else"EPSG"in t?lW["EPSG:"+t.EPSG]=t:"ESRI"in t?lW["ESRI:"+t.ESRI]=t:"IAU2000"in t?lW["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(lW);var cW=lW;var fW=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var hW=["3857","900913","3785","102113"];var pW=function(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in cW}(t))return cW[t];if(function(t){return fW.some(function(e){return t.indexOf(e)>-1})}(t)){var e=uW(t);if(function(t){var e=WH(t,"authority");if(e){var r=WH(e,"epsg");return r&&hW.indexOf(r)>-1}}(e))return cW["EPSG:3857"];var r=function(t){var e=WH(t,"extension");if(e)return WH(e,"proj4")}(e);return r?YH(r):e}return function(t){return"+"===t[0]}(t)?YH(t):void 0};function yW(t,e){var r,n;if(t=t||{},!e)return t;for(n in e)void 0!==(r=e[n])&&(t[n]=r);return t}function dW(t,e,r){var n=t*e;return r/Math.sqrt(1-n*n)}function bW(t){return t<0?-1:1}function vW(t){return Math.abs(t)<=JH?t:t-bW(t)*zH}function mW(t,e,r){var n=t*r,o=.5*t;return n=Math.pow((1-n)/(1+n),o),Math.tan(.5*(LH-e))/n}function gW(t,e){for(var r,n,o=.5*t,i=LH-2*Math.atan(e),a=0;a<=15;a++)if(r=t*Math.sin(i),i+=n=LH-2*Math.atan(e*Math.pow((1-r)/(1+r),o))-i,Math.abs(n)<=1e-10)return i;return-9999}function wW(t){return t}var OW=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=dW(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,r,n=t.x,o=t.y;if(o*GH>90&&o*GH<-90&&n*GH>180&&n*GH<-180)return null;if(Math.abs(Math.abs(o)-LH)<=FH)return null;if(this.sphere)e=this.x0+this.a*this.k0*vW(n-this.long0),r=this.y0+this.a*this.k0*Math.log(Math.tan(UH+.5*o));else{var i=Math.sin(o),a=mW(this.e,o,i);e=this.x0+this.a*this.k0*vW(n-this.long0),r=this.y0-this.a*this.k0*Math.log(a)}return t.x=e,t.y=r,t},inverse:function(t){var e,r,n=t.x-this.x0,o=t.y-this.y0;if(this.sphere)r=LH-2*Math.atan(Math.exp(-o/(this.a*this.k0)));else{var i=Math.exp(-o/(this.a*this.k0));if(-9999===(r=gW(this.e,i)))return null}return e=vW(this.long0+n/(this.a*this.k0)),t.x=e,t.y=r,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:wW,inverse:wW,names:["longlat","identity"]}],SW={},_W=[];function PW(t,e){var r=_W.length;return t.names?(_W[r]=t,t.names.forEach(function(t){SW[t.toLowerCase()]=r}),this):(console.log(e),!0)}var xW={start:function(){OW.forEach(PW)},add:PW,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==SW[e]&&_W[SW[e]]?_W[SW[e]]:void 0}},kW={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"}},jW=kW.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};kW.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var EW={};EW.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},EW.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},EW.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},EW.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},EW.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},EW.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},EW.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},EW.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},EW.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},EW.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},EW.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},EW.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},EW.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},EW.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},EW.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},EW.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},EW.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var TW=function(t,e,r,n,o,i,a){var s={};return s.datum_type=void 0===t||"none"===t?TH:EH,e&&(s.datum_params=e.map(parseFloat),0===s.datum_params[0]&&0===s.datum_params[1]&&0===s.datum_params[2]||(s.datum_type=xH),s.datum_params.length>3&&(0===s.datum_params[3]&&0===s.datum_params[4]&&0===s.datum_params[5]&&0===s.datum_params[6]||(s.datum_type=kH,s.datum_params[3]*=MH,s.datum_params[4]*=MH,s.datum_params[5]*=MH,s.datum_params[6]=s.datum_params[6]/1e6+1))),a&&(s.datum_type=jH,s.grids=a),s.a=r,s.b=n,s.es=o,s.ep2=i,s},CW={};function RW(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:CW[t]||null,isNull:!1}}function AW(t){return t/3600*Math.PI/180}function MW(t,e,r){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,r)))}function LW(t){return t.map(function(t){return[AW(t.longitudeShift),AW(t.latitudeShift)]})}function NW(t,e,r){return{name:MW(t,e+8,e+16).trim(),parent:MW(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,r),upperLatitude:t.getFloat64(e+88,r),lowerLongitude:t.getFloat64(e+104,r),upperLongitude:t.getFloat64(e+120,r),latitudeInterval:t.getFloat64(e+136,r),longitudeInterval:t.getFloat64(e+152,r),gridNodeCount:t.getInt32(e+168,r)}}function IW(t,e,r,n){for(var o=e+176,i=[],a=0;a-1.001*LH)u=-LH;else if(u>LH&&u<1.001*LH)u=LH;else{if(u<-LH)return{x:-1/0,y:-1/0,z:t.z};if(u>LH)return{x:1/0,y:1/0,z:t.z}}return s>Math.PI&&(s-=2*Math.PI),o=Math.sin(u),a=Math.cos(u),i=o*o,{x:((n=r/Math.sqrt(1-e*i))+l)*a*Math.cos(s),y:(n+l)*a*Math.sin(s),z:(n*(1-e)+l)*o}}function GW(t,e,r,n){var o,i,a,s,u,l,c,f,h,p,y,d,b,v,m,g=t.x,w=t.y,O=t.z?t.z:0;if(o=Math.sqrt(g*g+w*w),i=Math.sqrt(g*g+w*w+O*O),o/r<1e-12){if(v=0,i/r<1e-12)return LH,m=-n,{x:t.x,y:t.y,z:t.z}}else v=Math.atan2(w,g);a=O/i,f=(s=o/i)*(1-e)*(u=1/Math.sqrt(1-e*(2-e)*s*s)),h=a*u,b=0;do{b++,l=e*(c=r/Math.sqrt(1-e*h*h))/(c+(m=o*f+O*h-c*(1-e*h*h))),d=(y=a*(u=1/Math.sqrt(1-l*(2-l)*s*s)))*f-(p=s*(1-l)*u)*h,f=p,h=y}while(d*d>1e-24&&b<30);return{x:v,y:Math.atan(y/Math.abs(p)),z:m}}function UW(t){return t===xH||t===kH}function zW(t,e,r){if(function(t,e){return t.datum_type===e.datum_type&&!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===xH?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==kH||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6])}(t,e))return r;if(t.datum_type===TH||e.datum_type===TH)return r;var n=t.a,o=t.es;if(t.datum_type===jH){if(0!==JW(t,!1,r))return;n=CH,o=AH}var i=e.a,a=e.b,s=e.es;if(e.datum_type===jH&&(i=CH,a=RH,s=AH),o===s&&n===i&&!UW(t.datum_type)&&!UW(e.datum_type))return r;if((r=BW(r,o,n),UW(t.datum_type)&&(r=function(t,e,r){if(e===xH)return{x:t.x+r[0],y:t.y+r[1],z:t.z+r[2]};if(e===kH){var n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],u=r[5],l=r[6];return{x:l*(t.x-u*t.y+s*t.z)+n,y:l*(u*t.x+t.y-a*t.z)+o,z:l*(-s*t.x+a*t.y+t.z)+i}}}(r,t.datum_type,t.datum_params)),UW(e.datum_type)&&(r=function(t,e,r){if(e===xH)return{x:t.x-r[0],y:t.y-r[1],z:t.z-r[2]};if(e===kH){var n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],u=r[5],l=r[6],c=(t.x-n)/l,f=(t.y-o)/l,h=(t.z-i)/l;return{x:c+u*f-s*h,y:-u*c+f+a*h,z:s*c-a*f+h}}}(r,e.datum_type,e.datum_params)),r=GW(r,s,i,a),e.datum_type===jH)&&0!==JW(e,!0,r))return;return r}function JW(t,e,r){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;for(var n={x:-r.x,y:r.y},o={x:Number.NaN,y:Number.NaN},i=[],a=0;an.y||c>n.x||p1e-12&&Math.abs(a.y)>1e-12);if(u<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=vW(i.x+r.ll[0]),n.y=i.y+r.ll[1]}else isNaN(i.x)||(n.x=t.x+i.x,n.y=t.y+i.y);return n}function qW(t,e){var r,n={x:t.x/e.del[0],y:t.y/e.del[1]},o=Math.floor(n.x),i=Math.floor(n.y),a=n.x-1*o,s=n.y-1*i,u={x:Number.NaN,y:Number.NaN};if(o<0||o>=e.lim[0])return u;if(i<0||i>=e.lim[1])return u;r=i*e.lim[0]+o;var l=e.cvs[r][0],c=e.cvs[r][1];r++;var f=e.cvs[r][0],h=e.cvs[r][1];r+=e.lim[0];var p=e.cvs[r][0],y=e.cvs[r][1];r--;var d=e.cvs[r][0],b=e.cvs[r][1],v=a*s,m=a*(1-s),g=(1-a)*(1-s),w=(1-a)*s;return u.x=g*l+m*f+w*d+v*p,u.y=g*c+m*h+w*b+v*y,u}function HW(t,e,r){var n,o,i,a=r.x,s=r.y,u=r.z||0,l={};for(i=0;i<3;i++)if(!e||2!==i||void 0!==r.z)switch(0===i?(n=a,o=-1!=="ew".indexOf(t.axis[i])?"x":"y"):1===i?(n=s,o=-1!=="ns".indexOf(t.axis[i])?"y":"x"):(n=u,o="z"),t.axis[i]){case"e":l[o]=n;break;case"w":l[o]=-n;break;case"n":l[o]=n;break;case"s":l[o]=-n;break;case"u":void 0!==r[o]&&(l.z=n);break;case"d":void 0!==r[o]&&(l.z=-n);break;default:return null}return l}function WW(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function YW(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function QW(t,e,r,n){var o,i=void 0!==(r=Array.isArray(r)?WW(r):{x:r.x,y:r.y,z:r.z,m:r.m}).z;if(function(t){YW(t.x),YW(t.y)}(r),t.datum&&e.datum&&function(t,e){return(t.datum.datum_type===xH||t.datum.datum_type===kH||t.datum.datum_type===jH)&&"WGS84"!==e.datumCode||(e.datum.datum_type===xH||e.datum.datum_type===kH||e.datum.datum_type===jH)&&"WGS84"!==t.datumCode}(t,e)&&(r=QW(t,o=new FW("WGS84"),r,n),t=o),n&&"enu"!==t.axis&&(r=HW(t,!1,r)),"longlat"===t.projName)r={x:r.x*BH,y:r.y*BH,z:r.z||0};else if(t.to_meter&&(r={x:r.x*t.to_meter,y:r.y*t.to_meter,z:r.z||0}),!(r=t.inverse(r)))return;if(t.from_greenwich&&(r.x+=t.from_greenwich),r=zW(t.datum,e.datum,r))return e.from_greenwich&&(r={x:r.x-e.from_greenwich,y:r.y,z:r.z||0}),"longlat"===e.projName?r={x:r.x*GH,y:r.y*GH,z:r.z||0}:(r=e.forward(r),e.to_meter&&(r={x:r.x/e.to_meter,y:r.y/e.to_meter,z:r.z||0})),n&&"enu"!==e.axis?HW(e,!0,r):(i||delete r.z,r)}var XW=FW("WGS84");function ZW(t,e,r,n){var o,i,a;return Array.isArray(r)?(o=QW(t,e,r,n)||{x:NaN,y:NaN},r.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof o.z?[o.x,o.y,o.z].concat(r.splice(3)):[o.x,o.y,r[2]].concat(r.splice(3)):[o.x,o.y].concat(r.splice(2)):[o.x,o.y]):(i=QW(t,e,r,n),2===(a=Object.keys(r)).length?i:(a.forEach(function(n){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===n||"y"===n||"z"===n)return}else if("x"===n||"y"===n)return;i[n]=r[n]}),i))}function KW(t){return t instanceof FW?t:t.oProj?t.oProj:FW(t)}var $W=function(t,e,r){t=KW(t);var n,o=!1;return void 0===e?(e=t,t=XW,o=!0):(void 0!==e.x||Array.isArray(e))&&(r=e,e=t,t=XW,o=!0),e=KW(e),r?ZW(t,e,r):(n={forward:function(r,n){return ZW(t,e,r,n)},inverse:function(r,n){return ZW(e,t,r,n)}},o&&(n.oProj=e),n)},tY=6,eY="AJSAJS",rY="AFAFAF",nY=65,oY=73,iY=79,aY=86,sY=90,uY={forward:lY,inverse:function(t){var e=pY(dY(t.toUpperCase()));if(e.lat&&e.lon)return[e.lon,e.lat,e.lon,e.lat];return[e.left,e.bottom,e.right,e.top]},toPoint:cY};function lY(t,e){return e=e||5,function(t,e){var r="00000"+t.easting,n="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(p=t.easting,y=t.northing,d=t.zoneNumber,b=yY(d),v=Math.floor(p/1e5),m=Math.floor(y/1e5)%20,o=v,i=m,a=b,s=a-1,u=eY.charCodeAt(s),l=rY.charCodeAt(s),c=u+o-1,f=l+i,h=!1,c>sY&&(c=c-sY+nY-1,h=!0),(c===oY||uoY||(c>oY||uiY||(c>iY||usY&&(c=c-sY+nY-1),f>aY?(f=f-aY+nY-1,h=!0):h=!1,(f===oY||loY||(f>oY||liY||(f>iY||laY&&(f=f-aY+nY-1),String.fromCharCode(c)+String.fromCharCode(f))+r.substr(r.length-5,e)+n.substr(n.length-5,e);var o,i,a,s,u,l,c,f,h;var p,y,d,b,v,m}(function(t){var e,r,n,o,i,a,s,u=t.lat,l=t.lon,c=6378137,f=fY(u),h=fY(l);s=Math.floor((l+180)/6)+1,180===l&&(s=60);u>=56&&u<64&&l>=3&&l<12&&(s=32);u>=72&&u<84&&(l>=0&&l<9?s=31:l>=9&&l<21?s=33:l>=21&&l<33?s=35:l>=33&&l<42&&(s=37));a=fY(6*(s-1)-180+3),.006739496752268451,e=c/Math.sqrt(1-.00669438*Math.sin(f)*Math.sin(f)),r=Math.tan(f)*Math.tan(f),n=.006739496752268451*Math.cos(f)*Math.cos(f),o=Math.cos(f)*(h-a),i=c*(.9983242984503243*f-.002514607064228144*Math.sin(2*f)+2639046602129982e-21*Math.sin(4*f)-3.418046101696858e-9*Math.sin(6*f));var p=.9996*e*(o+(1-r+n)*o*o*o/6+(5-18*r+r*r+72*n-.39089081163157013)*o*o*o*o*o/120)+5e5,y=.9996*(i+e*Math.tan(f)*(o*o/2+(5-r+9*n+4*n*n)*o*o*o*o/24+(61-58*r+r*r+600*n-2.2240339282485886)*o*o*o*o*o*o/720));u<0&&(y+=1e7);return{northing:Math.round(y),easting:Math.round(p),zoneNumber:s,zoneLetter:function(t){var e="Z";84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C");return e}(u)}}({lat:t[1],lon:t[0]}),e)}function cY(t){var e=pY(dY(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function fY(t){return t*(Math.PI/180)}function hY(t){return t/Math.PI*180}function pY(t){var e=t.northing,r=t.easting,n=t.zoneLetter,o=t.zoneNumber;if(o<0||o>60)return null;var i,a,s,u,l,c,f,h,p=6378137,y=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),d=r-5e5,b=e;n<"N"&&(b-=1e7),c=6*(o-1)-180+3,h=(f=b/.9996/6367449.145945056)+(3*y/2-27*y*y*y/32)*Math.sin(2*f)+(21*y*y/16-55*y*y*y*y/32)*Math.sin(4*f)+151*y*y*y/96*Math.sin(6*f),i=p/Math.sqrt(1-.00669438*Math.sin(h)*Math.sin(h)),a=Math.tan(h)*Math.tan(h),s=.006739496752268451*Math.cos(h)*Math.cos(h),u=.99330562*p/Math.pow(1-.00669438*Math.sin(h)*Math.sin(h),1.5),l=d/(.9996*i);var v=h-i*Math.tan(h)/u*(l*l/2-(5+3*a+10*s-4*s*s-.06065547077041606)*l*l*l*l/24+(61+90*a+298*s+45*a*a-1.6983531815716497-3*s*s)*l*l*l*l*l*l/720);v=hY(v);var m,g=(l-(1+2*a+s)*l*l*l/6+(5-2*s+28*a-3*s*s+.05391597401814761+24*a*a)*l*l*l*l*l/120)/Math.cos(h);if(g=c+hY(g),t.accuracy){var w=pY({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});m={top:w.lat,right:w.lon,bottom:v,left:g}}else m={lat:v,lon:g};return m}function yY(t){var e=t%tY;return 0===e&&(e=tY),e}function dY(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,r=t.length,n=null,o="",i=0;!/[A-Z]/.test(e=t.charAt(i));){if(i>=2)throw"MGRSPoint bad conversion from: "+t;o+=e,i++}var a=parseInt(o,10);if(0===i||i+3>r)throw"MGRSPoint bad conversion from: "+t;var s=t.charAt(i++);if(s<="A"||"B"===s||"Y"===s||s>="Z"||"I"===s||"O"===s)throw"MGRSPoint zone letter "+s+" not handled: "+t;n=t.substring(i,i+=2);for(var u=yY(a),l=function(t,e){var r=eY.charCodeAt(e-1),n=1e5,o=!1;for(;r!==t.charCodeAt(0);){if(++r===oY&&r++,r===iY&&r++,r>sY){if(o)throw"Bad character: "+t;r=nY,o=!0}n+=1e5}return n}(n.charAt(0),u),c=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var r=rY.charCodeAt(e-1),n=0,o=!1;for(;r!==t.charCodeAt(0);){if(++r===oY&&r++,r===iY&&r++,r>aY){if(o)throw"Bad character: "+t;r=nY,o=!0}n+=1e5}return n}(n.charAt(1),u);c0&&(h=1e5/Math.pow(10,d),p=t.substring(i,i+d),b=parseFloat(p)*h,y=t.substring(i+d),v=parseFloat(y)*h),{easting:b+l,northing:v+c,zoneLetter:s,zoneNumber:a,accuracy:h}}function bY(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function vY(t,e,r){if(!(this instanceof vY))return new vY(t,e,r);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var n=t.split(",");this.x=parseFloat(n[0],10),this.y=parseFloat(n[1],10),this.z=parseFloat(n[2],10)||0}else this.x=t,this.y=e,this.z=r||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}vY.fromMGRS=function(t){return new vY(cY(t))},vY.prototype.toMGRS=function(t){return lY([this.x,this.y],t)};var mY=vY,gY=1,wY=.25,OY=.046875,SY=.01953125,_Y=.01068115234375,PY=.75,xY=.46875,kY=.013020833333333334,jY=.007120768229166667,EY=.3645833333333333,TY=.005696614583333333,CY=.3076171875;function RY(t){var e=[];e[0]=gY-t*(wY+t*(OY+t*(SY+t*_Y))),e[1]=t*(PY-t*(OY+t*(SY+t*_Y)));var r=t*t;return e[2]=r*(xY-t*(kY+t*jY)),r*=t,e[3]=r*(EY-t*TY),e[4]=r*t*CY,e}function AY(t,e,r,n){return r*=e,e*=e,n[0]*t-r*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}var MY=20;function LY(t,e,r){for(var n=1/(1-e),o=t,i=MY;i;--i){var a=Math.sin(o),s=1-e*a*a;if(o-=s=(AY(o,a,Math.cos(o),r)-t)*(s*Math.sqrt(s))*n,Math.abs(s)FH?Math.tan(i):0,y=Math.pow(p,2),d=Math.pow(y,2);e=1-this.es*Math.pow(s,2),l/=Math.sqrt(e);var b=AY(i,s,u,this.en);r=this.a*(this.k0*l*(1+c/6*(1-y+f+c/20*(5-18*y+d+14*f-58*y*f+c/42*(61+179*d-d*y-479*y)))))+this.x0,n=this.a*(this.k0*(b-this.ml0+s*a*l/2*(1+c/12*(5-y+9*f+4*h+c/30*(61+d-58*y+270*f-330*y*f+c/56*(1385+543*d-d*y-3111*y))))))+this.y0}else{var v=u*Math.sin(a);if(Math.abs(Math.abs(v)-1)=1){if(v-1>FH)return 93;n=0}else n=Math.acos(n);i<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=r,t.y=n,t},inverse:function(t){var e,r,n,o,i=(t.x-this.x0)*(1/this.a),a=(t.y-this.y0)*(1/this.a);if(this.es)if(r=LY(e=this.ml0+a/this.k0,this.es,this.en),Math.abs(r)FH?Math.tan(r):0,c=this.ep2*Math.pow(u,2),f=Math.pow(c,2),h=Math.pow(l,2),p=Math.pow(h,2);e=1-this.es*Math.pow(s,2);var y=i*Math.sqrt(e)/this.k0,d=Math.pow(y,2);n=r-(e*=l)*d/(1-this.es)*.5*(1-d/12*(5+3*h-9*c*h+c-4*f-d/30*(61+90*h-252*c*h+45*p+46*c-d/56*(1385+3633*h+4095*p+1574*p*h)))),o=vW(this.long0+y*(1-d/6*(1+2*h+c-d/20*(5+28*h+24*p+8*c*h+6*c-d/42*(61+662*h+1320*p+720*p*h))))/u)}else n=LH*bW(a),o=0;else{var b=Math.exp(i/this.k0),v=.5*(b-1/b),m=this.lat0+a/this.k0,g=Math.cos(m);e=Math.sqrt((1-Math.pow(g,2))/(1+Math.pow(v,2))),n=Math.asin(e),a<0&&(n=-n),o=0===v&&0===g?0:vW(Math.atan2(v,g)+this.long0)}return t.x=o,t.y=n,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function IY(t){var e=Math.exp(t);return e=(e-1/e)/2}function DY(t,e){t=Math.abs(t),e=Math.abs(e);var r=Math.max(t,e),n=Math.min(t,e)/(r||1);return r*Math.sqrt(1+Math.pow(n,2))}function FY(t){var e=Math.abs(t);return e=function(t){var e=1+t,r=e-1;return 0===r?t:t*Math.log(e)/r}(e*(1+e/(DY(1,e)+1))),t<0?-e:e}function BY(t,e){for(var r,n=2*Math.cos(2*e),o=t.length-1,i=t[o],a=0;--o>=0;)r=n*i-a+t[o],a=i,i=r;return e+r*Math.sin(2*e)}function GY(t,e,r){for(var n,o,i=Math.sin(e),a=Math.cos(e),s=IY(r),u=function(t){var e=Math.exp(t);return e=(e+1/e)/2}(r),l=2*a*u,c=-2*i*s,f=t.length-1,h=t[f],p=0,y=0,d=0;--f>=0;)n=y,o=p,h=l*(y=h)-n-c*(p=d)+t[f],d=c*y-o+l*p;return[(l=i*u)*h-(c=a*s)*d,l*d+c*h]}var UY={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(NY.init.apply(this),this.forward=NY.forward,this.inverse=NY.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),r=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),r*=e,this.cgb[1]=r*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=r*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),r*=e,this.cgb[2]=r*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=r*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),r*=e,this.cgb[3]=r*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=r*(1237/630+e*(e*(-24832/14175)-2.4)),r*=e,this.cgb[4]=r*(4174/315+e*(-144838/6237)),this.cbg[4]=r*(-734/315+e*(109598/31185)),r*=e,this.cgb[5]=r*(601676/22275),this.cbg[5]=r*(444337/155925),r=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+r*(.25+r*(1/64+r/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=r*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=r*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),r*=e,this.utg[2]=r*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=r*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),r*=e,this.utg[3]=r*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=r*(49561/161280+e*(-179/168+e*(6601661/7257600))),r*=e,this.utg[4]=r*(-4583/161280+e*(108847/3991680)),this.gtu[4]=r*(34729/80640+e*(-3418889/1995840)),r*=e,this.utg[5]=-.03233083094085698*r,this.gtu[5]=.6650675310896665*r;var n=BY(this.cbg,this.lat0);this.Zb=-this.Qn*(n+function(t,e){for(var r,n=2*Math.cos(e),o=t.length-1,i=t[o],a=0;--o>=0;)r=n*i-a+t[o],a=i,i=r;return Math.sin(e)*r}(this.gtu,2*n))},forward:function(t){var e=vW(t.x-this.long0),r=t.y;r=BY(this.cbg,r);var n=Math.sin(r),o=Math.cos(r),i=Math.sin(e),a=Math.cos(e);r=Math.atan2(n,a*o),e=Math.atan2(i*o,DY(n,o*a)),e=FY(Math.tan(e));var s,u,l=GY(this.gtu,2*r,2*e);return r+=l[0],e+=l[1],Math.abs(e)<=2.623395162778?(s=this.a*(this.Qn*e)+this.x0,u=this.a*(this.Qn*r+this.Zb)+this.y0):(s=1/0,u=1/0),t.x=s,t.y=u,t},inverse:function(t){var e,r,n=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(o=(o-this.Zb)/this.Qn,n/=this.Qn,Math.abs(n)<=2.623395162778){var i=GY(this.utg,2*o,2*n);o+=i[0],n+=i[1],n=Math.atan(IY(n));var a=Math.sin(o),s=Math.cos(o),u=Math.sin(n),l=Math.cos(n);o=Math.atan2(a*l,DY(u,l*s)),e=vW((n=Math.atan2(u,l*s))+this.long0),r=BY(this.cgb,o)}else e=1/0,r=1/0;return t.x=e,t.y=r,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"]};var zY={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(vW(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*BH,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,UY.init.apply(this),this.forward=UY.forward,this.inverse=UY.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function JY(t,e){return Math.pow((1-t)/(1+t),e)}var VY=20;var qY={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+UH)/(Math.pow(Math.tan(.5*this.lat0+UH),this.C)*JY(this.e*t,this.ratexp))},forward:function(t){var e=t.x,r=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+UH),this.C)*JY(this.e*Math.sin(r),this.ratexp))-LH,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,r=t.y,n=Math.pow(Math.tan(.5*r+UH)/this.K,1/this.C),o=VY;o>0&&(r=2*Math.atan(n*JY(this.e*Math.sin(t.y),-.5*this.e))-LH,!(Math.abs(r-t.y)<1e-14));--o)t.y=r;return o?(t.x=e,t.y=r,t):null},names:["gauss"]};var HY={init:function(){qY.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,r,n,o;return t.x=vW(t.x-this.long0),qY.forward.apply(this,[t]),e=Math.sin(t.y),r=Math.cos(t.y),n=Math.cos(t.x),o=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*r*n),t.x=o*r*Math.sin(t.x),t.y=o*(this.cosc0*e-this.sinc0*r*n),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,r,n,o,i;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,i=Math.sqrt(t.x*t.x+t.y*t.y)){var a=2*Math.atan2(i,this.R2);e=Math.sin(a),r=Math.cos(a),o=Math.asin(r*this.sinc0+t.y*e*this.cosc0/i),n=Math.atan2(t.x*e,i*this.cosc0*r-t.y*this.sinc0*e)}else o=this.phic0,n=0;return t.x=n,t.y=o,qY.inverse.apply(this,[t]),t.x=vW(t.x+this.long0),t},names:["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};var WY={init:function(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=FH&&(this.k0=.5*(1+bW(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=FH&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=FH&&(this.k0=.5*this.cons*dW(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/mW(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=dW(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-LH,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,r,n,o,i,a,s=t.x,u=t.y,l=Math.sin(u),c=Math.cos(u),f=vW(s-this.long0);return Math.abs(Math.abs(s-this.long0)-Math.PI)<=FH&&Math.abs(u+this.lat0)<=FH?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*l+this.coslat0*c*Math.cos(f)),t.x=this.a*e*c*Math.sin(f)+this.x0,t.y=this.a*e*(this.coslat0*l-this.sinlat0*c*Math.cos(f))+this.y0,t):(r=2*Math.atan(this.ssfn_(u,l,this.e))-LH,o=Math.cos(r),n=Math.sin(r),Math.abs(this.coslat0)<=FH?(i=mW(this.e,u*this.con,this.con*l),a=2*this.a*this.k0*i/this.cons,t.x=this.x0+a*Math.sin(s-this.long0),t.y=this.y0-this.con*a*Math.cos(s-this.long0),t):(Math.abs(this.sinlat0)0?vW(this.long0+Math.atan2(t.x,-1*t.y)):vW(this.long0+Math.atan2(t.x,t.y)):vW(this.long0+Math.atan2(t.x*Math.sin(s),a*this.coslat0*Math.cos(s)-t.y*this.sinlat0*Math.sin(s))),t.x=e,t.y=r,t)}if(Math.abs(this.coslat0)<=FH){if(a<=FH)return r=this.lat0,e=this.long0,t.x=e,t.y=r,t;t.x*=this.con,t.y*=this.con,n=a*this.cons/(2*this.a*this.k0),r=this.con*gW(this.e,n),e=this.con*vW(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else o=2*Math.atan(a*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,a<=FH?i=this.X0:(i=Math.asin(Math.cos(o)*this.sinX0+t.y*Math.sin(o)*this.cosX0/a),e=vW(this.long0+Math.atan2(t.x*Math.sin(o),a*this.cosX0*Math.cos(o)-t.y*this.sinX0*Math.sin(o)))),r=-1*gW(this.e,Math.tan(.5*(LH+i)));return t.x=e,t.y=r,t},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],ssfn_:function(t,e,r){return e*=r,Math.tan(.5*(LH+t))*Math.pow((1-e)/(1+e),.5*r)}};var YY={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),r=this.a,n=1/this.rf,o=2*n-Math.pow(n,2),i=this.e=Math.sqrt(o);this.R=this.k0*r*Math.sqrt(1-o)/(1-o*Math.pow(e,2)),this.alpha=Math.sqrt(1+o/(1-o)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),s=Math.log(Math.tan(Math.PI/4+t/2)),u=Math.log((1+i*e)/(1-i*e));this.K=a-this.alpha*s+this.alpha*i/2*u},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),r=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),n=-this.alpha*(e+r)+this.K,o=2*(Math.atan(Math.exp(n))-Math.PI/4),i=this.alpha*(t.x-this.lambda0),a=Math.atan(Math.sin(i)/(Math.sin(this.b0)*Math.tan(o)+Math.cos(this.b0)*Math.cos(i))),s=Math.asin(Math.cos(this.b0)*Math.sin(o)-Math.sin(this.b0)*Math.cos(o)*Math.cos(i));return t.y=this.R/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))+this.y0,t.x=this.R*a+this.x0,t},inverse:function(t){for(var e=t.x-this.x0,r=t.y-this.y0,n=e/this.R,o=2*(Math.atan(Math.exp(r/this.R))-Math.PI/4),i=Math.asin(Math.cos(this.b0)*Math.sin(o)+Math.sin(this.b0)*Math.cos(o)*Math.cos(n)),a=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(o))),s=this.lambda0+a/this.alpha,u=0,l=i,c=-1e3,f=0;Math.abs(l-c)>1e-7;){if(++f>20)return;u=1/this.alpha*(Math.log(Math.tan(Math.PI/4+i/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),c=l,l=2*Math.atan(Math.exp(u))-Math.PI/2}return t.x=s,t.y=l,t},names:["somerc"]},QY=1e-7;var XY={init:function(){var t,e,r,n,o,i,a,s,u,l,c,f,h,p=0,y=0,d=0,b=0,v=0,m=0,g=0;this.no_off=(h="object"==typeof(f=this).PROJECTION?Object.keys(f.PROJECTION)[0]:f.PROJECTION,"no_uoff"in f||"no_off"in f||-1!==["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(h)),this.no_rot="no_rot"in this;var w=!1;"alpha"in this&&(w=!0);var O=!1;if("rectified_grid_angle"in this&&(O=!0),w&&(g=this.alpha),O&&(p=this.rectified_grid_angle*BH),w||O)y=this.longc;else if(d=this.long1,v=this.lat1,b=this.long2,m=this.lat2,Math.abs(v-m)<=QY||(t=Math.abs(v))<=QY||Math.abs(t-LH)<=QY||Math.abs(Math.abs(this.lat0)-LH)<=QY||Math.abs(Math.abs(m)-LH)<=QY)throw new Error;var S=1-this.es;e=Math.sqrt(S),Math.abs(this.lat0)>FH?(s=Math.sin(this.lat0),r=Math.cos(this.lat0),t=1-this.es*s*s,this.B=r*r,this.B=Math.sqrt(1+this.es*this.B*this.B/S),this.A=this.B*this.k0*e/t,(o=(n=this.B*e/(r*Math.sqrt(t)))*n-1)<=0?o=0:(o=Math.sqrt(o),this.lat0<0&&(o=-o)),this.E=o+=n,this.E*=Math.pow(mW(this.e,this.lat0,s),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=o=1),w||O?(w?(c=Math.asin(Math.sin(g)/n),O||(p=g)):(c=p,g=Math.asin(n*Math.sin(c))),this.lam0=y-Math.asin(.5*(o-1/o)*Math.tan(c))/this.B):(i=Math.pow(mW(this.e,v,Math.sin(v)),this.B),a=Math.pow(mW(this.e,m,Math.sin(m)),this.B),o=this.E/i,u=(a-i)/(a+i),l=((l=this.E*this.E)-a*i)/(l+a*i),(t=d-b)<-Math.pi?b-=zH:t>Math.pi&&(b+=zH),this.lam0=vW(.5*(d+b)-Math.atan(l*Math.tan(.5*this.B*(d-b))/u)/this.B),c=Math.atan(2*Math.sin(this.B*vW(d-this.lam0))/(o-1/o)),p=g=Math.asin(n*Math.sin(c))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(p),this.cosrot=Math.cos(p),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.A,this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(g))),this.lat0<0&&(this.u_0=-this.u_0)),o=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(UH-o)),this.v_pole_s=this.ArB*Math.log(Math.tan(UH+o))},forward:function(t){var e,r,n,o,i,a,s,u,l={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-LH)>FH){if(e=.5*((i=this.E/Math.pow(mW(this.e,t.y,Math.sin(t.y)),this.B))-(a=1/i)),r=.5*(i+a),o=Math.sin(this.B*t.x),n=(e*this.singam-o*this.cosgam)/r,Math.abs(Math.abs(n)-1)0?this.v_pole_n:this.v_pole_s,s=this.ArB*t.y;return this.no_rot?(l.x=s,l.y=u):(s-=this.u_0,l.x=u*this.cosrot+s*this.sinrot,l.y=s*this.cosrot-u*this.sinrot),l.x=this.a*l.x+this.x0,l.y=this.a*l.y+this.y0,l},inverse:function(t){var e,r,n,o,i,a,s,u={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(r=t.y,e=t.x):(r=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),o=.5*((n=Math.exp(-this.BrA*r))-1/n),i=.5*(n+1/n),s=((a=Math.sin(this.BrA*e))*this.cosgam+o*this.singam)/i,Math.abs(Math.abs(s)-1)FH?this.ns=Math.log(n/s)/Math.log(o/u):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(o,this.ns)),this.rh=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,r=t.y;Math.abs(2*Math.abs(r)-Math.PI)<=FH&&(r=bW(r)*(LH-2*FH));var n,o,i=Math.abs(Math.abs(r)-LH);if(i>FH)n=mW(this.e,r,Math.sin(r)),o=this.a*this.f0*Math.pow(n,this.ns);else{if((i=r*this.ns)<=0)return null;o=0}var a=this.ns*vW(e-this.long0);return t.x=this.k0*(o*Math.sin(a))+this.x0,t.y=this.k0*(this.rh-o*Math.cos(a))+this.y0,t},inverse:function(t){var e,r,n,o,i,a=(t.x-this.x0)/this.k0,s=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(a*a+s*s),r=1):(e=-Math.sqrt(a*a+s*s),r=-1);var u=0;if(0!==e&&(u=Math.atan2(r*a,r*s)),0!==e||this.ns>0){if(r=1/this.ns,n=Math.pow(e/(this.a*this.f0),r),-9999===(o=gW(this.e,n)))return null}else o=-LH;return i=vW(u/this.ns+this.long0),t.x=i,t.y=o,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]};var KY={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,r,n,o,i,a,s,u=t.x,l=t.y,c=vW(u-this.long0);return e=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/e)-this.s45),n=-c*this.alfa,o=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(n)),i=Math.asin(Math.cos(r)*Math.sin(n)/Math.cos(o)),a=this.n*i,s=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(o/2+this.s45),this.n),t.y=s*Math.cos(a)/1,t.x=s*Math.sin(a)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var e,r,n,o,i,a,s,u=t.x;t.x=t.y,t.y=u,this.czech||(t.y*=-1,t.x*=-1),i=Math.sqrt(t.x*t.x+t.y*t.y),o=Math.atan2(t.y,t.x)/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/i,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(o)),r=Math.asin(Math.cos(n)*Math.sin(o)/Math.cos(e)),t.x=this.long0-r/this.alfa,a=e,s=0;var l=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-t.y)<1e-10&&(s=1),a=t.y,l+=1}while(0===s&&l<15);return l>=15?null:t},names:["Krovak","krovak"]};function $Y(t,e,r,n,o){return t*o-e*Math.sin(2*o)+r*Math.sin(4*o)-n*Math.sin(6*o)}function tQ(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function eQ(t){return.375*t*(1+.25*t*(1+.46875*t))}function rQ(t){return.05859375*t*t*(1+.75*t)}function nQ(t){return t*t*t*(35/3072)}function oQ(t,e,r){var n=e*r;return t/Math.sqrt(1-n*n)}function iQ(t){return Math.abs(t)1e-7?(1-t*t)*(e/(1-(r=t*e)*r)-.5/t*Math.log((1-r)/(1+r))):2*e}var lQ=.3333333333333333,cQ=.17222222222222222,fQ=.10257936507936508,hQ=.06388888888888888,pQ=.0664021164021164,yQ=.016415012942191543;var dQ={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-LH)0)switch(this.qp=uQ(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,r=[];return r[0]=t*lQ,e=t*t,r[0]+=e*cQ,r[1]=e*hQ,e*=t,r[0]+=e*fQ,r[1]+=e*pQ,r[2]=e*yQ,r}(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=uQ(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,r,n,o,i,a,s,u,l,c,f=t.x,h=t.y;if(f=vW(f-this.long0),this.sphere){if(i=Math.sin(h),c=Math.cos(h),n=Math.cos(f),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((r=this.mode===this.EQUIT?1+c*n:1+this.sinph0*i+this.cosph0*c*n)<=FH)return null;e=(r=Math.sqrt(2/r))*c*Math.sin(f),r*=this.mode===this.EQUIT?i:this.cosph0*i-this.sinph0*c*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(h+this.lat0)=0?(e=(l=Math.sqrt(a))*o,r=n*(this.mode===this.S_POLE?l:-l)):e=r=0}}return t.x=this.a*e+this.x0,t.y=this.a*r+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,r,n,o,i,a,s,u,l,c,f=t.x/this.a,h=t.y/this.a;if(this.sphere){var p,y=0,d=0;if((r=.5*(p=Math.sqrt(f*f+h*h)))>1)return null;switch(r=2*Math.asin(r),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(d=Math.sin(r),y=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(p)<=FH?0:Math.asin(h*d/p),f*=d,h=y*p;break;case this.OBLIQ:r=Math.abs(p)<=FH?this.lat0:Math.asin(y*this.sinph0+h*d*this.cosph0/p),f*=d*this.cosph0,h=(y-Math.sin(r)*this.sinph0)*p;break;case this.N_POLE:h=-h,r=LH-r;break;case this.S_POLE:r-=LH}e=0!==h||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(f,h):0}else{if(s=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(f/=this.dd,h*=this.dd,(a=Math.sqrt(f*f+h*h))1&&(t=t>1?1:-1),Math.asin(t)}var vQ={init:function(){Math.abs(this.lat1+this.lat2)FH?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,r=t.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var n=uQ(this.e3,this.sin_phi),o=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,i=this.ns0*vW(e-this.long0),a=o*Math.sin(i)+this.x0,s=this.rh-o*Math.cos(i)+this.y0;return t.x=a,t.y=s,t},inverse:function(t){var e,r,n,o,i,a;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),n=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),n=-1),o=0,0!==e&&(o=Math.atan2(n*t.x,n*t.y)),n=e*this.ns0/this.a,this.sphere?a=Math.asin((this.c-n*n)/(2*this.ns0)):(r=(this.c-n*n)/this.ns0,a=this.phi1z(this.e3,r)),i=vW(o/this.ns0+this.long0),t.x=i,t.y=a,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,e){var r,n,o,i,a,s=bQ(.5*e);if(t0||Math.abs(i)<=FH?(a=this.x0+1*this.a*r*Math.sin(n)/i,s=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*r*o)/i):(a=this.x0+this.infinity_dist*r*Math.sin(n),s=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*r*o)),t.x=a,t.y=s,t},inverse:function(t){var e,r,n,o,i,a;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(o=Math.atan2(e,this.rc),r=Math.sin(o),a=bQ((n=Math.cos(o))*this.sin_p14+t.y*r*this.cos_p14/e),i=Math.atan2(t.x*r,e*this.cos_p14*n-t.y*this.sin_p14*r),i=vW(this.long0+i)):(a=this.phic0,i=0),t.x=i,t.y=a,t},names:["gnom"]};var gQ={init:function(){this.sphere||(this.k0=dW(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,r,n=t.x,o=t.y,i=vW(n-this.long0);if(this.sphere)e=this.x0+this.a*i*Math.cos(this.lat_ts),r=this.y0+this.a*Math.sin(o)/Math.cos(this.lat_ts);else{var a=uQ(this.e,Math.sin(o));e=this.x0+this.a*this.k0*i,r=this.y0+this.a*a*.5/this.k0}return t.x=e,t.y=r,t},inverse:function(t){var e,r;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=vW(this.long0+t.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(r=function(t,e){var r=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-r)<1e-6)return e<0?-1*LH:LH;for(var n,o,i,a,s=Math.asin(.5*e),u=0;u<30;u++)if(o=Math.sin(s),i=Math.cos(s),a=t*o,s+=n=Math.pow(1-a*a,2)/(2*i)*(e/(1-t*t)-o/(1-a*a)+.5/t*Math.log((1-a)/(1+a))),Math.abs(n)<=1e-10)return s;return NaN}(this.e,2*t.y*this.k0/this.a),e=vW(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=r,t},names:["cea"]};var wQ={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,r=t.y,n=vW(e-this.long0),o=iQ(r-this.lat0);return t.x=this.x0+this.a*n*this.rc,t.y=this.y0+this.a*o,t},inverse:function(t){var e=t.x,r=t.y;return t.x=vW(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=iQ(this.lat0+(r-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","eqc"]},OQ=20;var SQ={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=tQ(this.es),this.e1=eQ(this.es),this.e2=rQ(this.es),this.e3=nQ(this.es),this.ml0=this.a*$Y(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,r,n,o=t.x,i=t.y,a=vW(o-this.long0);if(n=a*Math.sin(i),this.sphere)Math.abs(i)<=FH?(e=this.a*a,r=-1*this.a*this.lat0):(e=this.a*Math.sin(n)/Math.tan(i),r=this.a*(iQ(i-this.lat0)+(1-Math.cos(n))/Math.tan(i)));else if(Math.abs(i)<=FH)e=this.a*a,r=-1*this.ml0;else{var s=oQ(this.a,this.e,Math.sin(i))/Math.tan(i);e=s*Math.sin(n),r=this.a*$Y(this.e0,this.e1,this.e2,this.e3,i)-this.ml0+s*(1-Math.cos(n))}return t.x=e+this.x0,t.y=r+this.y0,t},inverse:function(t){var e,r,n,o,i,a,s,u,l;if(n=t.x-this.x0,o=t.y-this.y0,this.sphere)if(Math.abs(o+this.a*this.lat0)<=FH)e=vW(n/this.a+this.long0),r=0;else{var c;for(a=this.lat0+o/this.a,s=n*n/this.a/this.a+a*a,u=a,i=OQ;i;--i)if(u+=l=-1*(a*(u*(c=Math.tan(u))+1)-u-.5*(u*u+s)*c)/((u-a)/c-1),Math.abs(l)<=FH){r=u;break}e=vW(this.long0+Math.asin(n*Math.tan(u)/this.a)/Math.sin(r))}else if(Math.abs(o+this.ml0)<=FH)r=0,e=vW(this.long0+n/this.a);else{var f,h,p,y,d;for(a=(this.ml0+o)/this.a,s=n*n/this.a/this.a+a*a,u=a,i=OQ;i;--i)if(d=this.e*Math.sin(u),f=Math.sqrt(1-d*d)*Math.tan(u),h=this.a*$Y(this.e0,this.e1,this.e2,this.e3,u),p=this.e0-2*this.e1*Math.cos(2*u)+4*this.e2*Math.cos(4*u)-6*this.e3*Math.cos(6*u),u-=l=(a*(f*(y=h/this.a)+1)-y-.5*f*(y*y+s))/(this.es*Math.sin(2*u)*(y*y+s-2*a*y)/(4*f)+(a-y)*(f*p-2/Math.sin(2*u))-p),Math.abs(l)<=FH){r=u;break}f=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),e=vW(this.long0+Math.asin(n*f/this.a)/Math.sin(r))}return t.x=e,t.y=r,t},names:["Polyconic","poly"]};var _Q={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,r=t.x,n=t.y-this.lat0,o=r-this.long0,i=n/MH*1e-5,a=o,s=1,u=0;for(e=1;e<=10;e++)s*=i,u+=this.A[e]*s;var l,c=u,f=a,h=1,p=0,y=0,d=0;for(e=1;e<=6;e++)l=p*c+h*f,h=h*c-p*f,p=l,y=y+this.B_re[e]*h-this.B_im[e]*p,d=d+this.B_im[e]*h+this.B_re[e]*p;return t.x=d*this.a+this.x0,t.y=y*this.a+this.y0,t},inverse:function(t){var e,r,n=t.x,o=t.y,i=n-this.x0,a=(o-this.y0)/this.a,s=i/this.a,u=1,l=0,c=0,f=0;for(e=1;e<=6;e++)r=l*a+u*s,u=u*a-l*s,l=r,c=c+this.C_re[e]*u-this.C_im[e]*l,f=f+this.C_im[e]*u+this.C_re[e]*l;for(var h=0;h.999999999999&&(r=.999999999999),e=Math.asin(r);var n=vW(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),r=(2*e+Math.sin(2*e))/Math.PI,Math.abs(r)>1&&(r=1);var o=Math.asin(r);return t.x=n,t.y=o,t},names:["Mollweide","moll"]};var EQ={init:function(){Math.abs(this.lat1+this.lat2)=0?(r=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(r=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var i=0;return 0!==r&&(i=Math.atan2(e*t.x,e*t.y)),this.sphere?(o=vW(this.long0+i/this.ns),n=iQ(this.g-r/this.a),t.x=o,t.y=n,t):(n=aQ(this.g-r/this.a,this.e0,this.e1,this.e2,this.e3),o=vW(this.long0+i/this.ns),t.x=o,t.y=n,t)},names:["Equidistant_Conic","eqdc"]};var TQ={init:function(){this.R=this.a},forward:function(t){var e,r,n=t.x,o=t.y,i=vW(n-this.long0);Math.abs(o)<=FH&&(e=this.x0+this.R*i,r=this.y0);var a=bQ(2*Math.abs(o/Math.PI));(Math.abs(i)<=FH||Math.abs(Math.abs(o)-LH)<=FH)&&(e=this.x0,r=o>=0?this.y0+Math.PI*this.R*Math.tan(.5*a):this.y0+Math.PI*this.R*-Math.tan(.5*a));var s=.5*Math.abs(Math.PI/i-i/Math.PI),u=s*s,l=Math.sin(a),c=Math.cos(a),f=c/(l+c-1),h=f*f,p=f*(2/l-1),y=p*p,d=Math.PI*this.R*(s*(f-y)+Math.sqrt(u*(f-y)*(f-y)-(y+u)*(h-y)))/(y+u);i<0&&(d=-d),e=this.x0+d;var b=u+f;return d=Math.PI*this.R*(p*b-s*Math.sqrt((y+u)*(u+1)-b*b))/(y+u),r=o>=0?this.y0+d:this.y0-d,t.x=e,t.y=r,t},inverse:function(t){var e,r,n,o,i,a,s,u,l,c,f,h;return t.x-=this.x0,t.y-=this.y0,f=Math.PI*this.R,i=(n=t.x/f)*n+(o=t.y/f)*o,f=3*(o*o/(u=-2*(a=-Math.abs(o)*(1+i))+1+2*o*o+i*i)+(2*(s=a-2*o*o+n*n)*s*s/u/u/u-9*a*s/u/u)/27)/(l=(a-s*s/3/u)/u)/(c=2*Math.sqrt(-l/3)),Math.abs(f)>1&&(f=f>=0?1:-1),h=Math.acos(f)/3,r=t.y>=0?(-c*Math.cos(h+Math.PI/3)-s/3/u)*Math.PI:-(-c*Math.cos(h+Math.PI/3)-s/3/u)*Math.PI,e=Math.abs(n)2*LH*this.a)return;return r=e/this.a,n=Math.sin(r),o=Math.cos(r),i=this.long0,Math.abs(e)<=FH?a=this.lat0:(a=bQ(o*this.sin_p12+t.y*n*this.cos_p12/e),s=Math.abs(this.lat0)-LH,i=Math.abs(s)<=FH?this.lat0>=0?vW(this.long0+Math.atan2(t.x,-t.y)):vW(this.long0-Math.atan2(-t.x,t.y)):vW(this.long0+Math.atan2(t.x*n,e*this.cos_p12*o-t.y*this.sin_p12*n))),t.x=i,t.y=a,t}return u=tQ(this.es),l=eQ(this.es),c=rQ(this.es),f=nQ(this.es),Math.abs(this.sin_p12-1)<=FH?(a=aQ(((h=this.a*$Y(u,l,c,f,LH))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,u,l,c,f),i=vW(this.long0+Math.atan2(t.x,-1*t.y)),t.x=i,t.y=a,t):Math.abs(this.sin_p12+1)<=FH?(h=this.a*$Y(u,l,c,f,LH),a=aQ(((e=Math.sqrt(t.x*t.x+t.y*t.y))-h)/this.a,u,l,c,f),i=vW(this.long0+Math.atan2(t.x,t.y)),t.x=i,t.y=a,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),d=Math.atan2(t.x,t.y),p=oQ(this.a,this.e,this.sin_p12),b=Math.cos(d),m=-(v=this.e*this.cos_p12*b)*v/(1-this.es),g=3*this.es*(1-m)*this.sin_p12*this.cos_p12*b/(1-this.es),S=1-m*(O=(w=e/p)-m*(1+m)*Math.pow(w,3)/6-g*(1+3*m)*Math.pow(w,4)/24)*O/2-w*O*O*O/6,y=Math.asin(this.sin_p12*Math.cos(O)+this.cos_p12*Math.sin(O)*b),i=vW(this.long0+Math.asin(Math.sin(d)*Math.sin(O)/Math.cos(y))),_=Math.sin(y),a=Math.atan2((_-this.es*S*this.sin_p12)*Math.tan(y),_*(1-this.es)),t.x=i,t.y=a,t)},names:["Azimuthal_Equidistant","aeqd"]};var RQ={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var e,r,n,o,i,a,s,u=t.x,l=t.y;return n=vW(u-this.long0),e=Math.sin(l),r=Math.cos(l),o=Math.cos(n),((i=this.sin_p14*e+this.cos_p14*r*o)>0||Math.abs(i)<=FH)&&(a=1*this.a*r*Math.sin(n),s=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*r*o)),t.x=a,t.y=s,t},inverse:function(t){var e,r,n,o,i,a,s;return t.x-=this.x0,t.y-=this.y0,r=bQ((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),n=Math.sin(r),o=Math.cos(r),a=this.long0,Math.abs(e)<=FH?(s=this.lat0,t.x=a,t.y=s,t):(s=bQ(o*this.sin_p14+t.y*n*this.cos_p14/e),i=Math.abs(this.lat0)-LH,Math.abs(i)<=FH?(a=this.lat0>=0?vW(this.long0+Math.atan2(t.x,-t.y)):vW(this.long0-Math.atan2(-t.x,t.y)),t.x=a,t.y=s,t):(a=vW(this.long0+Math.atan2(t.x*n,e*this.cos_p14*o-t.y*this.sin_p14*n)),t.x=a,t.y=s,t))},names:["ortho"]},AQ={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},MQ={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function LQ(t,e,r,n){var o;return tUH&&o<=LH+UH?(n.value=MQ.AREA_1,o-=LH):o>LH+UH||o<=-(LH+UH)?(n.value=MQ.AREA_2,o=o>=0?o-JH:o+JH):(n.value=MQ.AREA_3,o+=LH)),o}function NQ(t,e){var r=t+e;return r<-JH?r+=zH:r>+JH&&(r-=zH),r}var IQ={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=LH-UH/2?this.face=AQ.TOP:this.lat0<=-(LH-UH/2)?this.face=AQ.BOTTOM:Math.abs(this.long0)<=UH?this.face=AQ.FRONT:Math.abs(this.long0)<=LH+UH?this.face=this.long0>0?AQ.RIGHT:AQ.LEFT:this.face=AQ.BACK,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,r,n,o,i,a,s={x:0,y:0},u={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,r=t.x,this.face===AQ.TOP)o=LH-e,r>=UH&&r<=LH+UH?(u.value=MQ.AREA_0,n=r-LH):r>LH+UH||r<=-(LH+UH)?(u.value=MQ.AREA_1,n=r>0?r-JH:r+JH):r>-(LH+UH)&&r<=-UH?(u.value=MQ.AREA_2,n=r+LH):(u.value=MQ.AREA_3,n=r);else if(this.face===AQ.BOTTOM)o=LH+e,r>=UH&&r<=LH+UH?(u.value=MQ.AREA_0,n=-r+LH):r=-UH?(u.value=MQ.AREA_1,n=-r):r<-UH&&r>=-(LH+UH)?(u.value=MQ.AREA_2,n=-r-LH):(u.value=MQ.AREA_3,n=r>0?-r+JH:-r-JH);else{var l,c,f,h,p,y;this.face===AQ.RIGHT?r=NQ(r,+LH):this.face===AQ.BACK?r=NQ(r,+JH):this.face===AQ.LEFT&&(r=NQ(r,-LH)),h=Math.sin(e),p=Math.cos(e),y=Math.sin(r),l=p*Math.cos(r),c=p*y,f=h,this.face===AQ.FRONT?n=LQ(o=Math.acos(l),f,c,u):this.face===AQ.RIGHT?n=LQ(o=Math.acos(c),f,-l,u):this.face===AQ.BACK?n=LQ(o=Math.acos(-l),f,-c,u):this.face===AQ.LEFT?n=LQ(o=Math.acos(-c),f,l,u):(o=n=0,u.value=MQ.AREA_0)}return a=Math.atan(12/JH*(n+Math.acos(Math.sin(n)*Math.cos(UH))-LH)),i=Math.sqrt((1-Math.cos(o))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(n))))),u.value===MQ.AREA_1?a+=LH:u.value===MQ.AREA_2?a+=JH:u.value===MQ.AREA_3&&(a+=1.5*JH),s.x=i*Math.cos(a),s.y=i*Math.sin(a),s.x=s.x*this.a+this.x0,s.y=s.y*this.a+this.y0,t.x=s.x,t.y=s.y,t},inverse:function(t){var e,r,n,o,i,a,s,u,l,c,f,h,p={lam:0,phi:0},y={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,r=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?y.value=MQ.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(y.value=MQ.AREA_1,e-=LH):t.x<0&&-t.x>=Math.abs(t.y)?(y.value=MQ.AREA_2,e=e<0?e+JH:e-JH):(y.value=MQ.AREA_3,e+=LH),l=JH/12*Math.tan(e),i=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),a=Math.atan(i),(s=1-(n=Math.cos(e))*n*(o=Math.tan(r))*o*(1-Math.cos(Math.atan(1/Math.cos(a)))))<-1?s=-1:s>1&&(s=1),this.face===AQ.TOP)u=Math.acos(s),p.phi=LH-u,y.value===MQ.AREA_0?p.lam=a+LH:y.value===MQ.AREA_1?p.lam=a<0?a+JH:a-JH:y.value===MQ.AREA_2?p.lam=a-LH:p.lam=a;else if(this.face===AQ.BOTTOM)u=Math.acos(s),p.phi=u-LH,y.value===MQ.AREA_0?p.lam=-a+LH:y.value===MQ.AREA_1?p.lam=-a:y.value===MQ.AREA_2?p.lam=-a-LH:p.lam=a<0?-a-JH:-a+JH;else{var d,b,v;l=(d=s)*d,b=(l+=(v=l>=1?0:Math.sqrt(1-l)*Math.sin(a))*v)>=1?0:Math.sqrt(1-l),y.value===MQ.AREA_1?(l=b,b=-v,v=l):y.value===MQ.AREA_2?(b=-b,v=-v):y.value===MQ.AREA_3&&(l=b,b=v,v=-l),this.face===AQ.RIGHT?(l=d,d=-b,b=l):this.face===AQ.BACK?(d=-d,b=-b):this.face===AQ.LEFT&&(l=d,d=b,b=-l),p.phi=Math.acos(-v)-LH,p.lam=Math.atan2(b,d),this.face===AQ.RIGHT?p.lam=NQ(p.lam,-LH):this.face===AQ.BACK?p.lam=NQ(p.lam,-JH):this.face===AQ.LEFT&&(p.lam=NQ(p.lam,+LH))}return 0!==this.es&&(c=p.phi<0?1:0,f=Math.tan(p.phi),h=this.b/Math.sqrt(f*f+this.one_minus_f_squared),p.phi=Math.atan(Math.sqrt(this.a*this.a-h*h)/(this.one_minus_f*h)),c&&(p.phi=-p.phi)),p.lam+=this.long0,t.x=p.lam,t.y=p.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},DQ=[[1,2.2199e-17,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],FQ=[[-5.20417e-18,.0124,1.21431e-18,-8.45284e-11],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],BQ=.8487,GQ=1.3523,UQ=GH/5,zQ=1/UQ,JQ=18,VQ=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))},qQ=function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])};var HQ={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=vW(t.x-this.long0),r=Math.abs(t.y),n=Math.floor(r*UQ);n<0?n=0:n>=JQ&&(n=JQ-1),r=GH*(r-zQ*n);var o={x:VQ(DQ[n],r)*e,y:VQ(FQ[n],r)};return t.y<0&&(o.y=-o.y),o.x=o.x*this.a*BQ+this.x0,o.y=o.y*this.a*GQ+this.y0,o},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*BQ),y:Math.abs(t.y-this.y0)/(this.a*GQ)};if(e.y>=1)e.x/=DQ[JQ][0],e.y=t.y<0?-LH:LH;else{var r=Math.floor(e.y*JQ);for(r<0?r=0:r>=JQ&&(r=JQ-1);;)if(FQ[r][0]>e.y)--r;else{if(!(FQ[r+1][0]<=e.y))break;++r}var n=FQ[r],o=5*(e.y-n[0])/(FQ[r+1][0]-n[0]);o=function(t,e,r,n){for(var o=e;n;--n){var i=t(o);if(o-=i,Math.abs(i)1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(t){var e,r,n,o,i=t.x,a=t.y;if(i-=this.long0,"ellipse"===this.shape){a=Math.atan(this.radius_p2*Math.tan(a));var s=this.radius_p/DY(this.radius_p*Math.cos(a),Math.sin(a));if(r=s*Math.cos(i)*Math.cos(a),n=s*Math.sin(i)*Math.cos(a),o=s*Math.sin(a),(this.radius_g-r)*r-n*n-o*o*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-r,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/DY(o,e)),t.y=this.radius_g_1*Math.atan(o/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(o/DY(n,e)))}else"sphere"===this.shape&&(e=Math.cos(a),r=Math.cos(i)*e,n=Math.sin(i)*e,o=Math.sin(a),e=this.radius_g-r,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/DY(o,e)),t.y=this.radius_g_1*Math.atan(o/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(o/DY(n,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,r,n,o,i=-1,a=0,s=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(s=Math.tan(t.y/this.radius_g_1),a=Math.tan(t.x/this.radius_g_1)*DY(1,s)):(a=Math.tan(t.x/this.radius_g_1),s=Math.tan(t.y/this.radius_g_1)*DY(1,a));var u=s/this.radius_p;if(e=a*a+u*u+i*i,(n=(r=2*this.radius_g*i)*r-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;o=(-r-Math.sqrt(n))/(2*e),i=this.radius_g+o*i,a*=o,s*=o,t.x=Math.atan2(a,i),t.y=Math.atan(s*Math.cos(t.x)/i),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(s=Math.tan(t.y/this.radius_g_1),a=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+s*s)):(a=Math.tan(t.x/this.radius_g_1),s=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+a*a)),e=a*a+s*s+i*i,(n=(r=2*this.radius_g*i)*r-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;o=(-r-Math.sqrt(n))/(2*e),i=this.radius_g+o*i,a*=o,s*=o,t.x=Math.atan2(a,i),t.y=Math.atan(s*Math.cos(t.x)/i)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};$W.defaultDatum="WGS84",$W.Proj=FW,$W.WGS84=new $W.Proj("WGS84"),$W.Point=mY,$W.toPoint=WW,$W.defs=cW,$W.nadgrid=function(t,e){var r=new DataView(e),n=function(t){var e=t.getInt32(8,!1);return 11!==e&&(11!==(e=t.getInt32(8,!0))&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}(r),o=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:MW(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(r,n);o.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var i={header:o,subgrids:function(t,e,r){for(var n=[],o=0;o=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function eX(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function rX(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},r=new SH(x_,t,e);return r.getMapInfo((n=iX(tX().mark(function n(i,a,s){var u,l,c,f,h,p;return tX().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,"processCompleted"!==i.type){n.next=15;break}if(u=i.result,l=u.dynamicProjection,c=u.prjCoordSys,f=c.epsgCode,!_H(c.type)){n.next=6;break}return s(new Error("mapbox-gl cannot support plane coordinate system.")),n.abrupt("return");case 6:if(3857===f||l||o().CRS){n.next=9;break}return s(new Error("The EPSG code ".concat(f," needs to include mapbox-gl-enhance.js. Refer to the example: https://iclient.supermap.io/examples/mapboxgl/editor.html#mvtVectorTile_2362"))),n.abrupt("return");case 9:return n.next=11,cX(t,i.result,rX(rX({},e),{},{initMapService:r}));case 11:return h=n.sent,p=new(o().Map)(h),h.style&&h.style.layers&&h.style.layers.length>0?p.on("load",function(){a({map:p})}):a({map:p}),n.abrupt("return");case 15:s(new Error("Fetch mapService is failed.")),n.next=21;break;case 18:n.prev=18,n.t0=n.catch(0),s(n.t0);case 21:case"end":return n.stop()}},n,null,[[0,18]])})),function(t,e,r){return n.apply(this,arguments)}));var n},o().supermap.Graphic=Fp,o().supermap.map.getDefaultVectorTileStyle=function(t,e){e=e||{};var r={};r.version=e.version||8,r.layers=e.layers||[],r.light=e.light||{anchor:"viewport",color:"#fcf6ef",intensity:.5,position:[1.15,201,20]};var n={version:r.version,sources:{"vector-tiles":{type:"vector",tiles:[t]}},layers:r.layers,light:r.light};return null!=e.sprite&&(n.sprite=e.sprite),null!=e.glyphs&&(n.glyphs=e.glyphs),n},o().supermap.map.setBackground=function(t,e){e&&t&&t.addLayer({id:"background",type:"background",paint:{"background-color":e}},"background")},o().supermap.map.setPaintProperty=function(t,e,r,n,o,i){if(e&&t){"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]);for(var a=0;a0&&t(i[0])}},l=0;l0;)h.push(u.pop());a.push(h)}}return a};e.detectConnectedComponents=o;var i=function(t){for(var e=t.nodes,r=void 0===e?[]:e,o=t.edges,i=void 0===o?[]:o,a=[],s={},u={},l={},c=[],f=0,h=function t(e){u[e.id]=f,l[e.id]=f,f+=1,a.push(e),s[e.id]=!0;for(var o=(0,n.getNeighbors)(e.id,i,"target").filter(function(t){return r.map(function(t){return t.id}).indexOf(t)>-1}),h=function(n){var i=o[n];if(u[i]||0===u[i])s[i]&&(l[e.id]=Math.min(l[e.id],u[i]));else{var a=r.filter(function(t){return t.id===i});a.length>0&&t(a[0]),l[e.id]=Math.min(l[e.id],l[i])}},p=0;p0;){var y=a.pop();if(s[y.id]=!1,d.push(y),y===e)break}d.length>0&&c.push(d)}},p=0,d=r;p0;)for(var v=p.pop(),g=v.id,m=(0,s.getNeighbors)(g,t.edges),b=function(n){var o,a=m[n],s=t.nodes.find(function(t){return t.id===a});if(a===g)i.push(((o={})[a]=v,o));else if(a in y){if(!y[g].has(s)){for(var u=!0,l=[s,v],c=d[g];y[a].size&&!y[a].has(c)&&(l.push(c),c!==d[c.id]);)c=d[c.id];if(l.push(c),e&&r?(u=!1,l.findIndex(function(t){return e.indexOf(t.id)>-1})>-1&&(u=!0)):e&&!r&&l.findIndex(function(t){return e.indexOf(t.id)>-1})>-1&&(u=!1),u){for(var f={},h=1;h-1)return f;n.push(a),o.add(a);for(var h=c[a.id],p=0;p0;){var r=e.pop();o.has(r)&&(o.delete(r),i[r.id].forEach(function(t){e.push(t)}),i[r.id].clear())}}(a);else for(p=0;p-1});g-1?y[v.id].push(c[b]):u.push(((o={})[v.id]=v,o))}}return{component:d,adjList:y,minIdx:a}},b=0;b=b}),S=(0,a.detectStrongConnectComponents)({nodes:w,edges:t.edges}).filter(function(t){return t.length>1});if(0===S.length)break;var x=m(S),_=x.minIdx,E=x.adjList,O=x.component;if(!(O.length>1))break;O.forEach(function(t){i[t.id]=new Set});var P=l[_];if(e&&r&&-1===e.indexOf(P.id))return u;f(P,P,E),b=_+1}return u};e.detectAllDirectedCycle=c;e.detectAllCycles=function(t,e,r,n){return void 0===n&&(n=!0),e?c(t,r,n):l(t,r,n)};var f=function(t){var e=null,r=t.nodes,n={},o={},a={},s={};(void 0===r?[]:r).forEach(function(t){o[t.id]=t});for(var u={enter:function(t){var r=t.current,i=t.previous;if(a[r]){e={};for(var s=r,u=i;u!==r;)e[s]=u,s=u,u=n[u];e[s]=u}else a[r]=r,delete o[r],n[r]=i},leave:function(t){var e=t.current;s[e]=e,delete a[e]},allowTraversal:function(t){var r=t.next;return!e&&!s[r]}};Object.keys(o).length;){var l=Object.keys(o)[0];(0,i.default)(t,l,u)}return e};e.default=f},8133:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,r,o){void 0===o&&(o=!0);!function t(e,r,o,i,a){void 0===a&&(a=!0);i.enter({current:r,previous:o});var s=e.edges,u=void 0===s?[]:s;(0,n.getNeighbors)(r,u,a?"target":void 0).forEach(function(n){i.allowTraversal({previous:o,current:r,next:n})&&t(e,n,r,i,a)});i.leave({current:r,previous:o})}(t,e,"",function(t){void 0===t&&(t={});var e=t,r=function(){},n=(o={},function(t){var e=t.next;return!o[e]&&(o[e]=!0,!0)});var o;return e.allowTraversal=t.allowTraversal||n,e.enter=t.enter||r,e.leave=t.leave||r,e}(r),o)};var n=r(5696)},7606:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r(1635),o=r(1359),i=r(5696),a=function(t,e,r,n){var o=t.nodes,a=void 0===o?[]:o,u=t.edges,l=void 0===u?[]:u,c=[],f={},h={},p={};a.forEach(function(t,r){var n=t.id;c.push(n),h[n]=1/0,n===e&&(h[n]=0)});for(var d=a.length,y=function(t){var e=function(t,e,r){for(var n,o=1/0,i=0;ih[e.id]+s?(h[a]=h[e.id]+s,p[a]=[e.id]):h[a]===h[e.id]+s&&p[a].push(e.id)})},v=0;v0&&c.length>0;){var p=c[c.length-1];if(p.length){var d=p.shift();if(d&&(u.push(d),l[d]=!0,h=n?(0,i.getNeighbors)(d,s,"target"):(0,i.getNeighbors)(d,s),c.push(h.filter(function(t){return!l[t]}))),u[u.length-1]===r){var y=u.map(function(t){return t});f.push(y),v=u.pop(),l[v]=!1,c.pop()}}else{var v=u.pop();l[v]=!1,c.pop()}}return f}},564:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n,o=(n=r(6018))&&n.__esModule?n:{default:n};var i=function(t,e){for(var r=(0,o.default)(t,e),n=[],i=r.length,a=0;an[a][u]+n[u][s]&&(n[a][s]=n[a][u]+n[u][s]);return n};e.default=i},9233:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r(1359),o=r(9943),i=function(){function t(t,e,r,n,i){this.fromNode=t,this.toNode=e,this.nodeEdgeNodeLabel={nodeLabel1:r||o.VACANT_NODE_LABEL,edgeLabel:n||o.VACANT_EDGE_LABEL,nodeLabel2:i||o.VACANT_NODE_LABEL}}return t.prototype.equalTo=function(t){return this.fromNode===t.formNode&&this.toNode===t.toNode&&this.nodeEdgeNodeLabel===t.nodeEdgeNodeLabel},t.prototype.notEqualTo=function(t){return!this.equalTo(t)},t}(),a=function(){function t(){this.rmpath=[],this.dfsEdgeList=[]}return t.prototype.equalTo=function(t){var e=this.dfsEdgeList.length;if(e!==t.length)return!1;for(var r=0;r=0;e--){var r=this.dfsEdgeList[e],n=r.fromNode,o=r.toNode;nf||n.hasNode(i[c.to])||(e.labelg&&"break"!==m(b);b--);if(y){var w=t.findMinLabel(d);l.dfsEdgeList.push(new i(p,v,o.VACANT_NODE_LABEL,w.edgeLabel,o.VACANT_NODE_LABEL));var S=l.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[S]===l.dfsEdgeList[S]&&a(d[w.edgeLabel].projected)}var x={};y=!1;var _=0;c.forEach(function(e){var r=new s(e),o=t.findForwardPureEdges(n,r.edges[f[0]],h,r);o.length>0&&(y=!0,_=p,o.forEach(function(t){var r="".concat(t.label,"-").concat(u[t.to].label);x[r]||(x[r]={projected:[],edgeLabel:t.label,nodeLabel2:u[t.to].label}),x[r].projected.push({graphId:n.id,edge:t,preNode:e})}))});var E=f.length,O=function(e){if(y)return"break";var r=f[e];c.forEach(function(e){var o=new s(e),i=t.findForwardRmpathEdges(n,o.edges[r],h,o);i.length>0&&(y=!0,_=l.dfsEdgeList[r].fromNode,i.forEach(function(t){var r="".concat(t.label,"-").concat(u[t.to].label);x[r]||(x[r]={projected:[],edgeLabel:t.label,nodeLabel2:u[t.to].label}),x[r].projected.push({graphId:n.id,edge:t,preNode:e})}))})};for(b=0;b=0;h--){var p=e.findBackwardEdge(o,f.edges[n[h]],f.edges[n[0]],f);if(p){var d="".concat(e.dfsCode.dfsEdgeList[n[h]].fromNode,"-").concat(p.label);c[d]||(c[d]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[n[h]].fromNode,edgeLabel:p.label}),c[d].projected.push({graphId:t.graphId,edge:p,preNode:t})}}if(!(r>=e.maxNodeNum)){e.findForwardPureEdges(o,f.edges[n[0]],u,f).forEach(function(e){var r="".concat(a,"-").concat(e.label,"-").concat(i[e.to].label);l[r]||(l[r]={projected:[],fromNodeId:a,edgeLabel:e.label,nodeLabel2:i[e.to].label}),l[r].projected.push({graphId:t.graphId,edge:e,preNode:t})});var y=function(r){e.findForwardRmpathEdges(o,f.edges[n[r]],u,f).forEach(function(o){var a="".concat(e.dfsCode.dfsEdgeList[n[r]].fromNode,"-").concat(o.label,"-").concat(i[o.to].label);l[a]||(l[a]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[n[r]].fromNode,edgeLabel:o.label,nodeLabel2:i[o.to].label}),l[a].projected.push({graphId:t.graphId,edge:o,preNode:t})})};for(h=0;ho){var a=o;o=n,n=a}var c=t.label,f="".concat(r,"-").concat(n,"-").concat(c,"-").concat(o),h="".concat(n,"-").concat(c,"-").concat(o);if(!i[h]){var p=i[h]||0;p++,i[h]=p}s[f]={graphId:r,nodeLabel1:n,edgeLabel:c,nodeLabel2:o}})})}),Object.keys(o).forEach(function(t){if(!(o[t]e&&(s=e);var n=r[t.id].inDegree;u>n&&(u=n);var o=r[t.id].outDegree;l>o&&(l=o)}),t[e]={degree:s,inDegree:u,outDegree:l}),{minPatternNodeLabelDegree:s,minPatternNodeLabelInDegree:u,minPatternNodeLabelOutDegree:l}},m=function(t,e,r,s,u,m,b){var w;if(void 0===r&&(r=!1),void 0===m&&(m="cluster"),void 0===b&&(b="cluster"),t&&t.nodes){var S=t.nodes.length;if(S){var x=(0,o.default)(t,r),_=(0,o.default)(e,r),E=y(t.nodes,x,r),O=y(e.nodes,_,r),P=p(t.nodes,m),k=P.nodeMap,C=P.nodeLabelMap,T=p(e.nodes,m),A=T.nodeMap,M=T.nodeLabelMap;d(t.edges,b,k);var j=d(e.edges,b,A).edgeLabelMap,I=[];null===_||void 0===_||_.forEach(function(t){I=I.concat(t)}),u||(u=Math.max.apply(Math,(0,n.__spreadArray)((0,n.__spreadArray)([],I,!1),[2],!1))),s||(s=u);var N=l(t,x,m,s),L=l(e,_,m,s),R=function(t,e,r,n,o){var i=Math.ceil(r/e),a={},s=0;return n.forEach(function(t,n){for(var u=0,l=0,c=t.nodeIdxs,f=t.neighborNum-1;u2*e)););if(p<2*e&&(a["".concat(n,"-").concat(h)]={start:n,end:h,distance:o[n][h]},u++,++s>=r))return a;if(++l>2*e)break}uX&&(X=r.length,W=r,Y=e,q=t)});var J={},K={},Q={},Z={},$={},tt={};Object.keys(M).forEach(function(n,o){$[n]=[],r&&(tt[n]=[]);var i=-1/0,a={};M[n].forEach(function(t){var e=O["".concat(q.id,"-").concat(t.id)];if(e&&$[n].push(e),i$[n][l]){u=!0;break}if(u)return W.splice(e,1),"continue";var c={};o.neighbors.forEach(function(t){var e=E["".concat(r.id,"-").concat(t.id)];c["".concat(r.id,"-").concat(t.id)]={start:k[r.id].idx,end:k[t.id].idx,distance:e}}),D=f(c,N,t,D);var p=[];Object.keys(c).forEach(function(t){if(H[t])p.push(H[t]);else{var e=D[t];H[t]=h(e,V,m,b),p.push(H[t])}}),p=p.sort(function(t,e){return e-t});var d=!1;for(l=0;l=0;l--)u(l)});var et=[];null===W||void 0===W||W.forEach(function(n){for(var o=k[n.id].idx,i=c(t.nodes,x[o],o,m,u).neighbors,a=!1,s=i.length-1;s>=0;s--){if(i.length+1$[f][d])i.splice(s,1);else{if(r){var y="".concat(l.id,"-").concat(n.id),w=E[y];if(d=tt[f].length-1,w>tt[f][d]){i.splice(s,1);continue}}var S=H[h]?H[h]:v(t,n,l,k,p,N,V,m,b,H,D),_="".concat(q.id,"-").concat(f);if(S=0&&"break"!==w(p);p--);if(v)return et.splice(n,1),"continue";o.edges=l;var S=(0,a.default)(o,o.nodes[0].id,!1).length;if(Object.keys(S).reverse().forEach(function(t){if(t!==o.nodes[0].id&&!v){if(S[t]===1/0){var e=u[t].node[m];if(s[e]--,s[e]nt[n][nt[n].length-1]){if(e=u[t].node[m],s[e]--,s[e]=0;E--){var O=o.nodes[E],P=u[O.id].degree,C=u[O.id].inDegree,T=u[O.id].outDegree,I=O[m],N=g(J,I,A,M),L=N.minPatternNodeLabelDegree,R=N.minPatternNodeLabelInDegree,D=N.minPatternNodeLabelOutDegree;if(r?P=0;B--){var F=l[B];if(!u[F.source]||!u[F.target]){l.splice(B,1);var G=F[b];if(c[G]--,u[F.source]&&(u[F.source].degree--,u[F.source].outDegree--),u[F.target]&&(u[F.target].degree--,u[F.target].inDegree--),j[G]&&c[G]=0&&"break"!==ot(it);it--);var at=et.length,st=function(t){var e={};et[t].edges.forEach(function(t){var r="".concat(t.source,"-").concat(t.target,"-").concat(t.label);e[r]?e[r]++:e[r]=1});for(var r=function(t){var r={};et[t].edges.forEach(function(t){var e="".concat(t.source,"-").concat(t.target,"-").concat(t.label);r[e]?r[e]++:r[e]=1});var n=!0;Object.keys(r).length!==Object.keys(e).length?n=!1:Object.keys(e).forEach(function(t){r[t]!==e[t]&&(n=!1)}),n&&et.splice(t,1)},n=at-1;n>t;n--)r(n);at=et.length};for(it=0;it<=at-1;it++)st(it);return et}}};e.default=m},8683:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n,o=(n=r(6018))&&n.__esModule?n:{default:n},i=r(5696);var a=function(t,e,r,n){void 0===e&&(e=!1),void 0===r&&(r="weight"),void 0===n&&(n=1e3);var a=t.nodes,s=void 0===a?[]:a,u=t.edges,l=void 0===u?[]:u,c={},f={};s.forEach(function(t,e){var r=(0,i.uniqueId)();t.clusterId=r,c[r]={id:r,nodes:[t]},f[t.id]={node:t,idx:e}});var h=[],p={};(0,o.default)(t,e).forEach(function(t,e){var r=0,n=s[e].id;p[n]={},t.forEach(function(t,e){if(t){r+=t;var o=s[e].id;p[n][o]=t}}),h.push(r)});for(var d=0,y=function(){var t=!1;if(s.forEach(function(e){var r={};Object.keys(p[e.id]).forEach(function(t){var n=p[e.id][t],o=f[t].node.clusterId;r[o]||(r[o]=0),r[o]+=n});var n=-1/0,o=[];if(Object.keys(r).forEach(function(t){n=0&&o.splice(i,1),o&&o.length){t=!0;var a=c[e.clusterId],s=a.nodes.indexOf(e);a.nodes.splice(s,1);var u=Math.floor(Math.random()*o.length),l=c[o[u]];l.nodes.push(e),e.clusterId=l.id}}}),!t)return"break";d++};d0&&T>A&&T-AA&&(j=v.map(function(t){return{node:t,clusterId:t.clusterId}}),I=(0,n.clone)(_),A=T),N||M>100)break;M++,Object.keys(_).forEach(function(t){var e=0;m.forEach(function(n){var o=n.source,i=n.target,a=E[o].node.clusterId,s=E[i].node.clusterId;(a===t&&s!==t||s===t&&a!==t)&&(e+=n[r]||1)}),_[t].sumTot=e}),v.forEach(function(t,e){var n,o=_[t.clusterId],i=0,a=P[e]/(2*C),s=0,l=o.nodes;l.forEach(function(t){var r=E[t.id].idx;s+=O[e][r]||0});var f=s-o.sumTot*a,h=l.filter(function(e){return e.id!==t.id}),p=[];h.forEach(function(t,e){p[e]=b[t.originIndex]});var y=c(h,b)*d,v=k[t.id];if(Object.keys(v).forEach(function(r){var o=E[r].node.clusterId;if(o!==t.clusterId){var s=_[o],l=s.nodes;if(l&&l.length){var h=0;l.forEach(function(t){var r=E[t.id].idx;h+=O[e][r]||0});var p=h-s.sumTot*a,v=l.concat([t]),g=[];v.forEach(function(t,e){g[e]=b[t.originIndex]});var m=c(v,b)*d,w=p-f;u&&(w=p+m-(f+y)),w>i&&(i=w,n=s)}}}),i>0){n.nodes.push(t);var g=t.clusterId;t.clusterId=n.id;var w=o.nodes.indexOf(t);o.nodes.splice(w,1);var S=0,x=0;m.forEach(function(t){var e=t.source,o=t.target,i=E[e].node.clusterId,a=E[o].node.clusterId;(i===n.id&&a!==n.id||a===n.id&&i!==n.id)&&(S+=t[r]||1),(i===g&&a!==g||a===g&&i!==g)&&(x+=t[r]||1)}),n.sumTot=S,o.sumTot=x}})}var L={},R=0;Object.keys(I).forEach(function(t){var e=I[t];if(e.nodes&&e.nodes.length){var r=String(R+1);r!==t&&(e.id=r,e.nodes=e.nodes.map(function(t){return{id:t.id,clusterId:r}}),I[r]=e,L[t]=r,delete I[t],R++)}else delete I[t]}),j.forEach(function(t){var e=t.node,r=t.clusterId;e&&(e.clusterId=r,e.clusterId&&L[e.clusterId]&&(e.clusterId=L[e.clusterId]))});var D=[],B={};m.forEach(function(t){var e=t.source,n=t.target,o=t[r]||1,i=E[e].node.clusterId,a=E[n].node.clusterId;if(i&&a){var s="".concat(i,"---").concat(a);if(B[s])B[s].weight+=o,B[s].count++;else{var u={source:i,target:a,weight:o,count:1};B[s]=u,D.push(u)}}});var F=[];return Object.keys(I).forEach(function(t){F.push(I[t])}),{clusters:F,clusterEdges:D}};e.default=f},9324:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=a(r(8882)),o=a(r(4073)),i=r(5696);function a(t){return t&&t.__esModule?t:{default:t}}var s=function(t,e){var r=[],n=t.nodes,a=void 0===n?[]:n,s=t.edges,u=void 0===s?[]:s;if(0===a.length)return r;var l=a[0],c=new Set;c.add(l);var f=new o.default(function(t,r){return e?t.weight-r.weight:0});for((0,i.getEdgesByNodeId)(l.id,u).forEach(function(t){f.insert(t)});!f.isEmpty();){var h=f.delMin(),p=h.source,d=h.target;c.has(p)&&c.has(d)||(r.push(h),c.has(p)||(c.add(p),(0,i.getEdgesByNodeId)(p,u).forEach(function(t){f.insert(t)})),c.has(d)||(c.add(d),(0,i.getEdgesByNodeId)(d,u).forEach(function(t){f.insert(t)})))}return r},u=function(t,e){var r=[],o=t.nodes,i=void 0===o?[]:o,a=t.edges,s=void 0===a?[]:a;if(0===i.length)return r;var u=s.map(function(t){return t});e&&u.sort(function(t,e){return t.weight-e.weight});for(var l=new n.default(i.map(function(t){return t.id}));u.length>0;){var c=u.shift(),f=c.source,h=c.target;l.connected(f,h)||(r.push(c),l.union(f,h))}return r},l=function(t,e,r){return r?{prim:s,kruskal:u}[r](t,e):u(t,e)};e.default=l},2653:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n,o=(n=r(5240))&&n.__esModule?n:{default:n},i=r(5696);var a=function(t,e,r){"number"!=typeof e&&(e=1e-6),"number"!=typeof r&&(r=.85);for(var n,a=1,s=0,u=1e3,l=t.nodes,c=void 0===l?[]:l,f=t.edges,h=void 0===f?[]:f,p=c.length,d={},y={},v=0;v0&&a>e;){for(s=0,v=0;v0&&(n+=y[S]/x)}d[m]=r*n,s+=d[m]}}for(s=(1-s)/p,a=0,v=0;v0&&(this.list[0]=e,this.moveDown(0)),t},t.prototype.insert=function(t){if(null!==t){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},t.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var r=this.list[e];this.list[e]=this.list[t],this.list[t]=r,t=e,e=this.getParent(t)}},t.prototype.moveDown=function(t){var e,r=t,n=this.getLeft(t),o=this.getRight(t),i=this.list.length;null!==n&&n0?r=n:null!==o&&o0&&(r=o),t!==r&&(e=[this.list[r],this.list[t]],this.list[t]=e[0],this.list[r]=e[1],this.moveDown(r))},t}();e.default=n},7875:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.LinkedListNode=void 0;var r=function(t,e){return t===e},n=function(){function t(t,e){void 0===e&&(e=null),this.value=t,this.next=e}return t.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},t}();e.LinkedListNode=n;var o=function(){function t(t){void 0===t&&(t=r),this.head=null,this.tail=null,this.compare=t}return t.prototype.prepend=function(t){var e=new n(t,this.head);return this.head=e,this.tail||(this.tail=e),this},t.prototype.append=function(t){var e=new n(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},t.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var r=this.head;if(null!==r)for(;r.next;)this.compare(r.next.value,t)?(e=r.next,r.next=r.next.next):r=r.next;return this.compare(this.tail.value,t)&&(this.tail=r),e},t.prototype.find=function(t){var e=t.value,r=void 0===e?void 0:e,n=t.callback,o=void 0===n?void 0:n;if(!this.head)return null;for(var i=this.head;i;){if(o&&o(i.value))return i;if(void 0!==r&&this.compare(i.value,r))return i;i=i.next}return null},t.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},t.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},t.prototype.fromArray=function(t){var e=this;return t.forEach(function(t){return e.append(t)}),this},t.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},t.prototype.reverse=function(){for(var t=this.head,e=null,r=null;t;)r=t.next,t.next=e,e=t,t=r;this.tail=this.head,this.head=e},t.prototype.toString=function(t){return void 0===t&&(t=void 0),this.toArray().map(function(e){return e.toString(t)}).toString()},t}();e.default=o},2500:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n,o=(n=r(7875))&&n.__esModule?n:{default:n};var i=function(){function t(){this.linkedList=new o.default}return t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},t.prototype.enqueue=function(t){this.linkedList.append(t)},t.prototype.dequeue=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toString=function(t){return this.linkedList.toString(t)},t}();e.default=i},8882:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function(){function t(t){this.count=t.length,this.parent={};for(var e=0,r=t;e0&&void 0!==o[0]?o[0]:1,!this.dirty){t.next=6;break}return this.compiledBundle.context&&(e>1?this.compiledBundle.context.maxIteration=e:this.compiledBundle.context.maxIteration++),t.next=5,this.compile();case 5:this.dirty=!1;case 6:for(this.engine.beginFrame(),this.engine.clear({}),this.compiledBundle.context&&this.compiledBundle.context.uniforms.filter(function(t){return t.isReferer}).forEach(function(t){var e=t.data,r=t.name;n.model.confirmInput(e.model,r)}),r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r16)throw new Error("invalid data type ".concat(r));o[e]=function(){return t.data}}});var i=this.getOuputDataTexture(),a=i.textureWidth,s=i.texelCount;o.u_OutputTextureSize=[a,a],o.u_OutputTexelCount=s,this.context.output.textureSize=[a,a];var l={attributes:{a_Position:[[-1,1,0],[-1,-1,0],[1,1,0],[1,-1,0]],a_TexCoord:[[0,1],[0,0],[1,1],[1,0]]},frag:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n".concat(this.context.shader),uniforms:o,vert:ht,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(l)}return c(t,[{key:"run",value:function(){var t=this;this.context.maxIteration>1&&this.context.needPingpong&&(this.compiledPingpong=!0),(this.compiledPingpong||this.dynamicPingpong)&&this.swap(),this.texFBO=this.reGl.framebuffer({color:this.getOuputDataTexture().texture}),this.texFBO.use(function(){t.computeCommand()}),dt&&console.log("[".concat(this.entity,"]: output ").concat(this.getOuputDataTexture().id))}},{key:"readData",value:function(){var t=o(m().mark(function t(){var e,r,n,o,i,a,s,u,l=this;return m().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.reGl({framebuffer:this.texFBO})(function(){e=l.reGl.read()}),!e){t.next=6;break}if(r=this.getOuputDataTexture(),n=r.originalDataLength,o=r.elementsPerTexel,i=r.typedArrayConstructor,a=void 0===i?Float32Array:i,s=[],4!==o)for(u=0;u2&&void 0!==arguments[2]&&arguments[2];var r=this.context.uniforms.find(function(e){return e.name===t});if(r){var n=this.calcDataTexture(t,r.type,e),o=n.texture,i=n.data;this.textureCache[t].data=i,this.textureCache[t].texture=o}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var t=this.context.output.name;this.textureCache[t].id=this.getOuputDataTexture().id,this.textureCache[t].texture=this.getOuputDataTexture().texture}var e=this.outputTextureName;this.outputTextureName=this.swapOutputTextureName,this.swapOutputTextureName=e,dt&&console.log("[".concat(this.entity,"]: after swap, output ").concat(this.getOuputDataTexture().id))}},{key:"getOuputDataTexture",value:function(){return this.textureCache[this.outputTextureName]}},{key:"createSwapOutputDataTexture",value:function(){var t=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=t}},{key:"cloneDataTexture",value:function(t){var e=t.data,r=t.textureWidth;return ft(ft({},t),{},{id:pt++,texture:this.reGl.texture({width:r,height:r,data:e,type:"float"})})}},{key:"calcDataTexture",value:function(t,e,r){var n=1;e===x.Vector4FloatArray&&(n=4);for(var o=[],i=0;i0&&void 0!==arguments[0]?arguments[0]:{},r=new t;return r.setConfig(e),r.setEngine(new Ot),r}}]),t}()},288:function(t,e,r){"use strict";r.r(e),r.d(e,{Graph:function(){return w},GraphWithEvent:function(){return k},algorithm:function(){return n},comparision:function(){return i},essence:function(){return o},generate:function(){return s}});var n={};r.r(n),r.d(n,{components:function(){return M},dfs:function(){return j},dijkstra:function(){return D},dijkstraAll:function(){return B},findCycles:function(){return G},floydWarshall:function(){return et},isAcyclic:function(){return Q},postorder:function(){return Z},preorder:function(){return $},prim:function(){return A},tarjan:function(){return F},topsort:function(){return K}});var o={};r.r(o),r.d(o,{hasSelfLoop:function(){return vt},isGraph:function(){return pt},isNullGraph:function(){return yt},isSimpleGraph:function(){return dt}});var i={};r.r(i),r.d(i,{containAllSameEdges:function(){return ut},containAllSameNodes:function(){return st},containSameEdges:function(){return nt},containSameNodes:function(){return rt},getSameEdges:function(){return it},getSameNodes:function(){return ot},isGraphComplement:function(){return gt},isGraphContainsAnother:function(){return ct},isGraphOptionSame:function(){return at},isGraphSame:function(){return lt}});var a,s={};function u(t,e){var r=t.get(e)||0;t.set(e,r+1)}function l(t,e){var r=t.get(e);void 0!==r&&((r-=1)>0?t.set(e,r):t.delete(e))}function c(t,e,r,n){var o=String(e),i=String(r);if(!t&&o>i){var s=o;o=i,i=s}return o+a.EDGE_KEY_DELIM+i+a.EDGE_KEY_DELIM+(void 0===n?a.DEFAULT_EDGE_NAME:n)}function f(t,e,r,n){var o=String(e),i=String(r),a={v:e,w:r};if(!t&&o>i){var s=a.v;a.v=a.w,a.w=s}return void 0!==n&&(a.name=n),a}function h(t,e){return c(t,e.v,e.w,e.name)}function p(t){return"function"==typeof t}r.r(s),r.d(s,{getGraphComplement:function(){return mt}}),function(t){t.DEFAULT_EDGE_NAME="\0",t.GRAPH_NODE="\0",t.EDGE_KEY_DELIM=""}(a||(a={}));var d=function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:function(t){return t.nodes().map(function(e){var r={id:e,value:t.node(e),parent:t.parent(e)};return void 0===r.value&&delete r.value,void 0===r.parent&&delete r.parent,r})}(t),edges:function(t){return t.edges().map(function(e){var r=t.edge(e),n={v:e.v,w:e.w,value:r,name:e.name};return void 0===n.name&&delete n.name,void 0===n.value&&delete n.value,n})}(t),value:t.graph()};return void 0===e.value&&delete e.value,e};function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function v(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=a.GRAPH_NODE,this.label=void 0,this.nodeCountNum=0,this.edgeCountNum=0,this.defaultNodeLabelFn=function(){},this.defaultEdgeLabelFn=function(){},this.parentMap=void 0,this.childrenMap=void 0,this.nodesLabelMap=new Map,this.inEdgesMap=new Map,this.outEdgesMap=new Map,this.predecessorsMap=new Map,this.successorsMap=new Map,this.edgesMap=new Map,this.edgesLabelsMap=new Map,this.isDirected=function(){return e.directed},this.isMultigraph=function(){return e.multigraph},this.isCompound=function(){return e.compound},this.setGraph=function(t){return e.label=t,e},this.graph=function(){return e.label},this.setDefaultNodeLabel=function(t){return p(t)?e.defaultNodeLabelFn=t:e.defaultNodeLabelFn=function(){return t},e},this.nodeCount=function(){return e.nodeCountNum},this.node=function(t){return e.nodesLabelMap.get(t)},this.nodes=function(){return Array.from(e.nodesLabelMap.keys())},this.sources=function(){return e.nodes().filter(function(t){var r;return!(null===(r=e.inEdgesMap.get(t))||void 0===r?void 0:r.size)})},this.sinks=function(){return e.nodes().filter(function(t){var r;return!(null===(r=e.outEdgesMap.get(t))||void 0===r?void 0:r.size)})},this.setNodes=function(t,r){return t.map(function(t){return e.setNode(t,r)}),e},this.hasNode=function(t){return e.nodesLabelMap.has(t)},this.checkCompound=function(){if(!e.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(t){if(e.isCompound()){var r,n=null===(r=e.parentMap)||void 0===r?void 0:r.get(t);if(n!==e.GRAPH_NODE)return n}},this.removeFromParentsChildList=function(t){var r=e.parentMap.get(t);e.childrenMap.get(r).delete(t)},this.setParent=function(t,r){var n,o;e.checkCompound();for(var i=void 0===r?e.GRAPH_NODE:r,a=e.parent(i);a;){if(t===a)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");a=e.parent(a)}r&&e.setNode(r),e.setNode(t),e.removeFromParentsChildList(t),null===(n=e.parentMap)||void 0===n||n.set(t,i);var s=e.childrenMap.get(i);return s.set(t,!0),null===(o=e.childrenMap)||void 0===o||o.set(i,s),e},this.children=function(t){var r=void 0===t?e.GRAPH_NODE:t;if(e.isCompound()){var n,o=null===(n=e.childrenMap)||void 0===n?void 0:n.get(r);return o?Array.from(o.keys()):void 0}return r===e.GRAPH_NODE?e.nodes():t&&e.hasNode(t)?[]:void 0},this.predecessors=function(t){var r=e.predecessorsMap.get(t);return r?Array.from(r.keys()):void 0},this.successors=function(t){var r=e.successorsMap.get(t);return r?Array.from(r.keys()):void 0},this.neighbors=function(t){var r;if(e.hasNode(t))return Array.from(new Set(null===(r=e.predecessors(t))||void 0===r?void 0:r.concat(e.successors(t))))},this.isLeaf=function(t){var r,n;return e.isDirected()?!(null===(n=e.successors(t))||void 0===n?void 0:n.length):!(null===(r=e.neighbors(t))||void 0===r?void 0:r.length)},this.filterNodes=function(r){var n=e.directed,o=e.multigraph,i=e.compound,a=new t({directed:n,multigraph:o,compound:i});if(a.setGraph(e.graph()),e.nodes().forEach(function(t){r(t)&&a.setNode(t,e.node(t))}),e.edges().forEach(function(t){a.hasNode(t.v)&&a.hasNode(t.w)&&a.setEdgeObj(t,e.edge(t))}),i){a.nodes().forEach(function(t){a.setParent(t,function(t){for(var r=e.parent(t);void 0!==r&&!a.hasNode(r);)r=e.parent(r);return r}(t))})}return a},this.setDefaultEdgeLabel=function(t){return p(t)?e.defaultEdgeLabelFn=t:e.defaultEdgeLabelFn=function(){return t},e},this.edgeCount=function(){return e.edgeCountNum},this.setEdgeObj=function(t,r){return e.setEdge(t.v,t.w,r,t.name)},this.setPath=function(t,r){return t.reduce(function(t,n){return e.setEdge(t,n,r),n}),e},this.edgeFromArgs=function(t,r,n){return e.edge({v:t,w:r,name:n})},this.edge=function(t){return e.edgesLabelsMap.get(h(e.isDirected(),t))},this.hasEdge=function(t,r,n){return e.edgesLabelsMap.has(h(e.isDirected(),{v:t,w:r,name:n}))},this.removeEdgeObj=function(t){var r=t.v,n=t.w,o=t.name;return e.removeEdge(r,n,o)},this.edges=function(){return Array.from(e.edgesMap.values())},this.inEdges=function(t,r){var n=e.inEdgesMap.get(t);if(n)return Array.from(n.values()).filter(function(t){return!r||t.v===r})},this.outEdges=function(t,r){var n=e.outEdgesMap.get(t);if(n)return Array.from(n.values()).filter(function(t){return!r||t.w===r})},this.nodeEdges=function(t,r){var n;if(e.hasNode(t))return null===(n=e.inEdges(t,r))||void 0===n?void 0:n.concat(e.outEdges(t,r))},this.toJSON=function(){return d(e)},this.nodeInDegree=function(t){var r=e.inEdgesMap.get(t);return r?r.size:0},this.nodeOutDegree=function(t){var r=e.outEdgesMap.get(t);return r?r.size:0},this.nodeDegree=function(t){return e.nodeInDegree(t)+e.nodeOutDegree(t)},this.source=function(t){return t.v},this.target=function(t){return t.w};var n=v(v({},b),r);this.compound=n.compound,this.directed=n.directed,this.multigraph=n.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}var e,r,n;return e=t,(r=[{key:"setNode",value:function(t,e){var r,n=this.nodesLabelMap,o=this.defaultNodeLabelFn,i=this.isCompound,a=this.parentMap,s=this.childrenMap,u=this.inEdgesMap,l=this.outEdgesMap,c=this.predecessorsMap,f=this.successorsMap;if(n.has(t))return void 0!==e&&n.set(t,e),this;(n.set(t,e||o(t)),i())&&(null===a||void 0===a||a.set(t,this.GRAPH_NODE),null===s||void 0===s||s.set(t,new Map),(null===s||void 0===s?void 0:s.has(this.GRAPH_NODE))||null===s||void 0===s||s.set(this.GRAPH_NODE,new Map),null===s||void 0===s||null===(r=s.get(this.GRAPH_NODE))||void 0===r||r.set(t,!0));return[u,l,c,f].forEach(function(e){return e.set(t,new Map)}),this.nodeCountNum+=1,this}},{key:"removeNode",value:function(t){var e=this;if(this.hasNode(t)){var r,n,o,i=function(t){e.removeEdge(t.v,t.w,t.name)},a=this.inEdgesMap,s=this.outEdgesMap,u=this.predecessorsMap,l=this.successorsMap,c=this.nodesLabelMap;if(this.isCompound())this.removeFromParentsChildList(t),null===(r=this.parentMap)||void 0===r||r.delete(t),null===(n=this.children(t))||void 0===n||n.forEach(function(t){return e.setParent(t)}),null===(o=this.childrenMap)||void 0===o||o.delete(t);var f=a.get(t),h=s.get(t);Array.from(f.values()).forEach(function(t){return i(t)}),Array.from(h.values()).forEach(function(t){return i(t)}),c.delete(t),a.delete(t),s.delete(t),u.delete(t),l.delete(t),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(t,e,r,n){var o,i,a=f(this.isDirected(),t,e,n),s=h(this.isDirected(),a),l=a.v,c=a.w;if(this.edgesLabelsMap.has(s))return this.edgesLabelsMap.set(s,r),this;if(void 0!==n&&!this.isMultigraph())throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(l),this.setNode(c),this.edgesLabelsMap.set(s,r||this.defaultEdgeLabelFn(l,c,n)),Object.freeze(a),this.edgesMap.set(s,a);var p=this.predecessorsMap.get(c),d=this.successorsMap.get(l);return u(p,l),u(d,c),null===(o=this.inEdgesMap.get(c))||void 0===o||o.set(s,a),null===(i=this.outEdgesMap.get(l))||void 0===i||i.set(s,a),this.edgeCountNum+=1,this}},{key:"removeEdge",value:function(t,e,r){var n=c(this.isDirected(),t,e,r);if(this.edgesMap.get(n)){var o=f(this.isDirected(),t,e,r),i=o.v,a=o.w;this.edgesLabelsMap.delete(n),this.edgesMap.delete(n);var s=this.predecessorsMap.get(a),u=this.successorsMap.get(i);l(s,i),l(u,a),this.inEdgesMap.get(a).delete(n),this.outEdgesMap.get(i).delete(n),this.edgeCountNum-=1}return this}}])&&m(e.prototype,r),n&&m(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function S(t){"@babel/helpers - typeof";return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function x(t,e){for(var r=0;r-1&&this.eventPool[t].splice(r,1)}}},{key:"emitEvent",value:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n>1])||void 0===a?void 0:a.priority)e.arr[n].priority)throw new Error("New priority is greater than current priority.Key: ".concat(t," Old: + ").concat(e.arr[n].priority," New: ").concat(r));e.arr[n].priority=r,e.innerDecrease(n)}}),A=function(t,e){var r,n=new w,o=new Map,i=new T;function a(t){var n=t.v===r?t.w:t.v,a=i.priority(n);if(void 0!==a){var s=e(t);s0;){var u;if(r=i.removeMin(),o.has(r))n.setEdge(r,o.get(r));else{if(s)throw new Error("Input graph is not connected: "+t.graph());s=!0}null===(u=t.nodeEdges(r))||void 0===u||u.forEach(a)}return n},M=function(t){var e=new Set,r=[];return t.nodes().forEach(function(n){for(var o=[],i=[n];i.length>0;){var a,s,u=i.pop();e.has(u)||(e.add(u),o.push(u),null===(a=t.successors(u))||void 0===a||a.forEach(function(t){return i.push(t)}),null===(s=t.predecessors(u))||void 0===s||s.forEach(function(t){return i.push(t)}))}o.length&&r.push(o)}),r},j=function(t,e,r){var n=function(e){return t.isDirected()?t.successors(e):t.neighbors(e)},o=[],i=[];return(Array.isArray(e)?e:[e]).forEach(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);!function t(e,r,n,o,i,a){o.includes(r)||(o.push(r),n||a.push(r),i(r).forEach(function(r){return t(e,r,n,o,i,a)}),n&&a.push(r))}(t,e,"post"===r,i,n,o)}),o};function I(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return N(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return N(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&(o=s.removeMin(),!(i=a.get(o))||i.distance!==Number.POSITIVE_INFINITY);)n(o).forEach(u);var l={};return Array.from(a.entries()).forEach(function(t){var e=I(t,2),r=e[0],n=e[1];return l[String(r)]=n,l}),l},D=function(t,e,r,n){return R(t,e,r||L,n||function(e){return t.outEdges(e)})},B=function(t,e,r){var n={};return t.nodes().forEach(function(o){return n[String(o)]=D(t,o,e,r),n}),n},F=function(t){var e=0,r=[],n=new Map,o=[];return t.nodes().forEach(function(i){n.has(i)||function i(a){var s,u={onStack:!0,lowlink:e,index:e};if(n.set(a,u),e+=1,r.push(a),null===(s=t.successors(a))||void 0===s||s.forEach(function(t){var e;if(n.has(t)){if(null===(e=n.get(t))||void 0===e?void 0:e.onStack){var r=n.get(t);u.lowlink=Math.min(u.lowlink,r.index)}}else{i(t);var o=n.get(t);u.lowlink=Math.min(u.lowlink,o.lowlink)}}),u.lowlink===u.index){var l,c=[];do{l=r.pop(),n.get(l).onStack=!1,c.push(l)}while(a!==l);o.push(c)}}(i)}),o},G=function(t){return F(t).filter(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})};function U(t){"@babel/helpers - typeof";return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function z(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);ri&&(i=e.depth);var r=e.children,n=r.length,o=new function(t,e){void 0===t&&(t=0),void 0===e&&(e=[]);var r=this;r.x=r.y=0,r.leftChild=r.rightChild=null,r.height=0,r.children=e}(e.height,[]);return r.forEach(function(e,r){var i=t(e);o.children.push(i),0===r&&(o.leftChild=i),r===n-1&&(o.rightChild=i)}),o.originNode=e,o.isLeaf=e.isLeaf(),o}(t);return function t(e){if(e.isLeaf||0===e.children.length)e.drawingDepth=i;else{var r=e.children.map(function(e){return t(e)}),n=Math.min.apply(null,r);e.drawingDepth=n-1}return e.drawingDepth}(a),function t(n){n.x=n.drawingDepth*e.rankSep,n.isLeaf?(n.y=0,r&&(n.y=r.y+r.height+e.nodeSep,n.originNode.parent!==r.originNode.parent&&(n.y+=e.subTreeSep)),r=n):(n.children.forEach(function(e){t(e)}),n.y=(n.leftChild.y+n.rightChild.y)/2)}(a),function t(e,r,n){n?(r.x=e.x,r.y=e.y):(r.x=e.y,r.y=e.x),e.children.forEach(function(e,o){t(e,r.children[o],n)})}(a,t,e.isHorizontal),t}},8725:function(t,e,r){var n=r(4711),o=["LR","RL","TB","BT","H","V"],i=["LR","RL","H"],a=o[0];t.exports=function(t,e,r){var s=e.direction||a;if(e.isHorizontal=function(t){return i.indexOf(t)>-1}(s),s&&-1===o.indexOf(s))throw new TypeError("Invalid direction: "+s);if(s===o[0])r(t,e);else if(s===o[1])r(t,e),t.right2left();else if(s===o[2])r(t,e);else if(s===o[3])r(t,e),t.bottom2top();else if(s===o[4]||s===o[5]){var u=n(t,e),l=u.left,c=u.right;r(l,e),r(c,e),e.isHorizontal?l.right2left():l.bottom2top(),c.translate(l.x-c.x,l.y-c.y),t.x=l.x,t.y=c.y;var f=t.getBoundingBox();e.isHorizontal?f.top<0&&t.translate(0,-f.top):f.left<0&&t.translate(-f.left,0)}var h=e.fixedRoot;return void 0===h&&(h=!0),h&&t.translate(-(t.x+t.width/2+t.hgap),-(t.y+t.height/2+t.vgap)),t}},3848:function(t,e,r){var n=r(2394),o={getId:function(t){return t.id||t.name},getPreH:function(t){return t.preH||0},getPreV:function(t){return t.preV||0},getHGap:function(t){return t.hgap||18},getVGap:function(t){return t.vgap||18},getChildren:function(t){return t.children},getHeight:function(t){return t.height||36},getWidth:function(t){var e=t.label||" ";return t.width||18*e.split("").length}};function i(t,e){var r=this;if(r.vgap=r.hgap=0,t instanceof i)return t;r.data=t;var n=e.getHGap(t),o=e.getVGap(t);return r.preH=e.getPreH(t),r.preV=e.getPreV(t),r.width=e.getWidth(t),r.height=e.getHeight(t),r.width+=r.preH,r.height+=r.preV,r.id=e.getId(t),r.x=r.y=0,r.depth=0,r.children||(r.children=[]),r.addGap(n,o),r}n.assign(i.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(t,e){this.hgap+=t,this.vgap+=e,this.width+=2*t,this.height+=2*e},eachNode:function(t){for(var e,r=[this];e=r.shift();)t(e),r=e.children.concat(r)},DFTraverse:function(t){this.eachNode(t)},BFTraverse:function(t){for(var e,r=[this];e=r.shift();)t(e),r=r.concat(e.children)},getBoundingBox:function(){var t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(e){t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)}),t},translate:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.eachNode(function(r){r.x+=t,r.y+=e,r.x+=r.preH,r.y+=r.preV})},right2left:function(){var t=this.getBoundingBox();this.eachNode(function(e){e.x=e.x-2*(e.x-t.left)-e.width}),this.translate(t.width,0)},bottom2top:function(){var t=this.getBoundingBox();this.eachNode(function(e){e.y=e.y-2*(e.y-t.top)-e.height}),this.translate(0,t.height)}}),t.exports=function(t,e,r){void 0===e&&(e={});var a,s=new i(t,e=n.assign({},o,e)),u=[s];if(!r&&!t.collapsed)for(;a=u.shift();)if(!a.data.collapsed){var l=e.getChildren(a.data),c=l?l.length:0;if(a.children=new Array(c),l&&c)for(var f=0;ft.y?u:t.y}}else t.y=0}(t,i,e,r,o),i=t})}},6401:function(t,e,r){var n=r(2394);var o={getSubTreeSep:function(){return 0}};t.exports=function(t,e){void 0===e&&(e={}),e=n.assign({},o,e),t.parent={x:0,width:0,height:0,y:0},t.BFTraverse(function(t){t.x=t.parent.x+t.parent.width}),t.parent=null,function t(e,r){var n=0;return e.children.length?e.children.forEach(function(e){n+=t(e,r)}):n=e.height,e._subTreeSep=r.getSubTreeSep(e.data),e.totalHeight=Math.max(e.height,n)+2*e._subTreeSep,e.totalHeight}(t,e),t.startY=0,t.y=t.totalHeight/2-t.height/2,t.eachNode(function(t){var e=t.children,r=e.length;if(r){var n=e[0];if(n.startY=t.startY+t._subTreeSep,1===r)n.y=t.y+t.height/2-n.height/2;else{n.y=n.startY+n.totalHeight/2-n.height/2;for(var o=1;oe.height)e.y=o.y+a/2-e.height/2;else if(1!==r.length||e.height>s){var u=e.y+(e.height-a)/2-o.y;r.forEach(function(t){t.translate(0,u)})}else e.y=(o.y+o.height/2+i.y+i.height/2)/2-e.height/2}}(t)}},514:function(t){function e(t,e,r,n){void 0===n&&(n=[]);var o=this;o.w=t||0,o.h=e||0,o.y=r||0,o.x=0,o.c=n||[],o.cs=n.length,o.prelim=0,o.mod=0,o.shift=0,o.change=0,o.tl=null,o.tr=null,o.el=null,o.er=null,o.msel=0,o.mser=0}function r(t,e){!function t(e,r,n){n?e.y+=r:e.x+=r,e.children.forEach(function(e){t(e,r,n)})}(t,-function t(e,r){var n=r?e.y:e.x;return e.children.forEach(function(e){n=Math.min(t(e,r),n)}),n}(t,e),e)}e.fromNode=function(t,r){if(!t)return null;var n=[];return t.children.forEach(function(t){n.push(e.fromNode(t,r))}),r?new e(t.height,t.width,t.x,n):new e(t.width,t.height,t.y,n)},t.exports=function(t,n){void 0===n&&(n={});var o=n.isHorizontal;function i(t){0===t.cs?(t.el=t,t.er=t,t.msel=t.mser=0):(t.el=t.c[0].el,t.msel=t.c[0].msel,t.er=t.c[t.cs-1].er,t.mser=t.c[t.cs-1].mser)}function a(t,e,r){for(var n=t.c[e-1],o=n.mod,i=t.c[e],a=i.mod;null!==n&&null!==i;){c(n)>r.low&&(r=r.nxt);var f=o+n.prelim+n.w-(a+i.prelim);f>0&&(a+=f,s(t,e,r.index,f));var h=c(n),p=c(i);h<=p&&null!==(n=l(n))&&(o+=n.mod),h>=p&&null!==(i=u(i))&&(a+=i.mod)}!n&&i?function(t,e,r,n){var o=t.c[0].el;o.tl=r;var i=n-r.mod-t.c[0].msel;o.mod+=i,o.prelim-=i,t.c[0].el=t.c[e].el,t.c[0].msel=t.c[e].msel}(t,e,i,a):n&&!i&&function(t,e,r,n){var o=t.c[e].er;o.tr=r;var i=n-r.mod-t.c[e].mser;o.mod+=i,o.prelim-=i,t.c[e].er=t.c[e-1].er,t.c[e].mser=t.c[e-1].mser}(t,e,n,o)}function s(t,e,r,n){t.c[e].mod+=n,t.c[e].msel+=n,t.c[e].mser+=n,function(t,e,r,n){if(r!==e-1){var o=e-r;t.c[r+1].shift+=n/o,t.c[e].shift-=n/o,t.c[e].change-=n-n/o}}(t,e,r,n)}function u(t){return 0===t.cs?t.tl:t.c[0]}function l(t){return 0===t.cs?t.tr:t.c[t.cs-1]}function c(t){return t.y+t.h}function f(t,e,r){for(;null!==r&&t>=r.low;)r=r.nxt;return{low:t,index:e,nxt:r}}!function t(e,r,n){void 0===n&&(n=0),r?(e.x=n,n+=e.width):(e.y=n,n+=e.height),e.children.forEach(function(e){t(e,r,n)})}(t,o);var h=e.fromNode(t,o);return function t(e){if(0!==e.cs){t(e.c[0]);for(var r=f(c(e.c[0].el),0,null),n=1;nn?1:0}var u=function(t){function e(e){var r=t.call(this)||this;return r.radius=null,r.nodeSize=void 0,r.startRadius=null,r.endRadius=null,r.startAngle=0,r.endAngle=2*Math.PI,r.clockwise=!0,r.divisions=1,r.ordering=null,r.angleRatio=1,r.nodes=[],r.edges=[],r.nodeMap={},r.degrees=[],r.width=300,r.height=300,r.updateCfg(e),r}return o(e,t),e.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},e.prototype.execute=function(){var t,e=this.nodes,r=this.edges,n=e.length;if(0!==n){this.width||"undefined"==typeof window||(this.width=window.innerWidth),this.height||"undefined"==typeof window||(this.height=window.innerHeight),this.center||(this.center=[this.width/2,this.height/2]);var o=this.center;if(1===n)return e[0].x=o[0],e[0].y=o[1],void(this.onLayoutEnd&&this.onLayoutEnd());var i=this.radius,s=this.startRadius,u=this.endRadius,l=this.divisions,c=this.startAngle,f=this.endAngle,h=this.angleRatio,p=this.ordering,d=this.clockwise,y=this.nodeSpacing,v=this.nodeSize,g=(f-c)/n,m={};e.forEach(function(t,e){m[t.id]=e}),this.nodeMap=m;var b=(0,a.getDegree)(e.length,m,r);if(this.degrees=b,y){var w=(0,a.getFuncByUnknownType)(10,y),S=(0,a.getFuncByUnknownType)(10,v),x=-1/0;e.forEach(function(t){var e=S(t);xthis.width?this.width/2:this.height/2;var E=g*h,O=[];O="topology"===p?this.topologyOrdering():"topology-directed"===p?this.topologyOrdering(!0):"degree"===p?this.degreeOrdering():e;for(var P=Math.ceil(n/l),k=0;k=0;_--)x(_);return{nodes:e,edges:r,combos:n,comboEdges:o}},e.prototype.getInnerGraphs=function(t){var e=this.comboTrees,r=this.nodeSize,n=this.edges,o=this.comboPadding,a=this.spacing,s={},c=this.innerLayout||new l.ConcentricLayout({type:"concentric",sortBy:"id"});return c.center=[0,0],c.preventOverlap=!0,c.nodeSpacing=a,(e||[]).forEach(function(e){(0,u.traverseTreeUp)(e,function(e){var a,l=(null===o||void 0===o?void 0:o(e))||10;if((0,u.isArray)(l)&&(l=Math.max.apply(Math,l)),null===(a=e.children)||void 0===a?void 0:a.length){var f=e.children.map(function(e){if("combo"===e.itemType)return s[e.id];var r=t[e.id]||{};return i(i({},r),e)}),h=f.map(function(t){return t.id}),p={nodes:f,edges:n.filter(function(t){return h.includes(t.source)&&h.includes(t.target)})},d=1/0;f.forEach(function(t){var e;t.size||(t.size=(null===(e=s[t.id])||void 0===e?void 0:e.size)||(null===r||void 0===r?void 0:r(t))||[30,30]),(0,u.isNumber)(t.size)&&(t.size=[t.size,t.size]),d>t.size[0]&&(d=t.size[0]),d>t.size[1]&&(d=t.size[1])}),c.layout(p);var y=(0,u.getLayoutBBox)(f),v=y.minX,g=y.minY,m=y.maxX,b=y.maxY,w={x:(m+v)/2,y:(b+g)/2};p.nodes.forEach(function(t){t.x-=w.x,t.y-=w.y});var S=Math.max(m-v,d)+2*l,x=Math.max(b-g,d)+2*l;s[e.id]={id:e.id,nodes:f,size:[S,x]}}else if("combo"===e.itemType){var _=l?[2*l,2*l]:[30,30];s[e.id]={id:e.id,nodes:[],size:_}}return!0})}),s},e.prototype.initVals=function(){var t,e,r=this.nodeSize,n=this.spacing;if(e=(0,u.isNumber)(n)?function(){return n}:(0,u.isFunction)(n)?n:function(){return 0},this.spacing=e,r)if((0,u.isFunction)(r))t=function(t){var n=r(t),o=e(t);return(0,u.isArray)(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+o)/2:((n||10)+o)/2};else if((0,u.isArray)(r)){var o=(r[0]>r[1]?r[0]:r[1])/2;t=function(t){return o+e(t)/2}}else{var i=r/2;t=function(t){return i+e(t)/2}}else t=function(t){var r=e(t);return t.size?(0,u.isArray)(t.size)?((t.size[0]>t.size[1]?t.size[0]:t.size[1])+r)/2:(0,u.isObject)(t.size)?((t.size.width>t.size.height?t.size.width:t.size.height)+r)/2:(t.size+r)/2:10+r/2};this.nodeSize=t;var a,s=this.comboPadding;a=(0,u.isNumber)(s)?function(){return s}:(0,u.isArray)(s)?function(){return Math.max.apply(null,s)}:(0,u.isFunction)(s)?s:function(){return 0},this.comboPadding=a},e.prototype.getType=function(){return"comboCombined"},e}(s.Base);e.ComboCombinedLayout=c},5773:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ComboForceLayout=void 0;var i=r(8933),a=r(864),s=function(t){function e(e){var r=t.call(this)||this;return r.center=[0,0],r.maxIteration=100,r.gravity=10,r.comboGravity=10,r.linkDistance=10,r.alpha=1,r.alphaMin=.001,r.alphaDecay=1-Math.pow(r.alphaMin,1/300),r.alphaTarget=0,r.velocityDecay=.6,r.edgeStrength=.6,r.nodeStrength=30,r.preventOverlap=!1,r.preventNodeOverlap=!1,r.preventComboOverlap=!1,r.collideStrength=void 0,r.nodeCollideStrength=.5,r.comboCollideStrength=.5,r.comboSpacing=20,r.comboPadding=10,r.optimizeRangeFactor=1,r.onTick=function(){},r.onLayoutEnd=function(){},r.depthAttractiveForceScale=1,r.depthRepulsiveForceScale=2,r.nodes=[],r.edges=[],r.combos=[],r.comboTrees=[],r.width=300,r.height=300,r.bias=[],r.nodeMap={},r.oriComboMap={},r.indexMap={},r.comboMap={},r.previousLayouted=!1,r.updateCfg(e),r}return o(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:100,center:[0,0],gravity:10,speed:1,comboGravity:30,preventOverlap:!1,preventComboOverlap:!0,preventNodeOverlap:!0,nodeSpacing:void 0,collideStrength:void 0,nodeCollideStrength:.5,comboCollideStrength:.5,comboSpacing:20,comboPadding:10,edgeStrength:.6,nodeStrength:30,linkDistance:10}},e.prototype.execute=function(){var t=this.nodes,e=this.center;if(this.comboTree={id:"comboTreeRoot",depth:-1,children:this.comboTrees},t&&0!==t.length){if(1===t.length)return t[0].x=e[0],t[0].y=e[1],void(this.onLayoutEnd&&this.onLayoutEnd());this.initVals(),this.run(),this.onLayoutEnd&&this.onLayoutEnd()}else this.onLayoutEnd&&this.onLayoutEnd()},e.prototype.run=function(){var t=this,e=t.nodes,r=t.previousLayouted?t.maxIteration/5:t.maxIteration;t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight);var n=t.center,o=t.velocityDecay,i=t.comboMap;t.previousLayouted||t.initPos(i);for(var s=function(r){var n=[];e.forEach(function(t,e){n[e]={x:0,y:0}}),t.applyCalculate(n),t.applyComboCenterForce(n),e.forEach(function(t,e){(0,a.isNumber)(t.x)&&(0,a.isNumber)(t.y)&&(t.x+=n[e].x*o,t.y+=n[e].y*o)}),t.alpha+=(t.alphaTarget-t.alpha)*t.alphaDecay,t.onTick()},u=0;uv[1]?v[0]:v[1])/2;d=function(t){return m}}else{var b=v/2;d=function(t){return b}}else d=function(t){return t.size?(0,a.isArray)(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2:(0,a.isObject)(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2:t.size/2:10};this.nodeSize=d;var w,S=this.comboSpacing;w=(0,a.isNumber)(S)?function(){return S}:(0,a.isFunction)(S)?S:function(){return 0},this.comboSpacing=w;var x,_=this.comboPadding;x=(0,a.isNumber)(_)?function(){return _}:(0,a.isArray)(_)?function(){return Math.max.apply(null,_)}:(0,a.isFunction)(_)?_:function(){return 0},this.comboPadding=x;var E,O=this.linkDistance;O||(O=10),E=(0,a.isNumber)(O)?function(t){return O}:O,this.linkDistance=E;var P,k=this.edgeStrength;k||(k=1),P=(0,a.isNumber)(k)?function(t){return k}:k,this.edgeStrength=P;var C,T=this.nodeStrength;T||(T=30),C=(0,a.isNumber)(T)?function(t){return T}:T,this.nodeStrength=C},e.prototype.initPos=function(t){this.nodes.forEach(function(e,r){var n=e.comboId,o=t[n];n&&o?(e.x=o.cx+100/(r+1),e.y=o.cy+100/(r+1)):(e.x=100/(r+1),e.y=100/(r+1))})},e.prototype.getComboMap=function(){var t=this,e=t.nodeMap,r=t.comboTrees,n=t.oriComboMap,o={};return(r||[]).forEach(function(r){var i=[];(0,a.traverseTreeUp)(r,function(r){if("node"===r.itemType)return!0;if(!n[r.id])return!0;if(void 0===o[r.id]){var s={id:r.id,name:r.id,cx:0,cy:0,count:0,depth:t.oriComboMap[r.id].depth||0,children:[]};o[r.id]=s}var u=r.children;u&&u.forEach(function(t){if(!o[t.id]&&!e[t.id])return!0;i.push(t)});var l=o[r.id];if(l.cx=0,l.cy=0,0===i.length){l.empty=!0;var c=n[r.id];l.cx=c.x,l.cy=c.y}return i.forEach(function(t){if(l.count++,"node"!==t.itemType){var r=o[t.id];return(0,a.isNumber)(r.cx)&&(l.cx+=r.cx),void((0,a.isNumber)(r.cy)&&(l.cy+=r.cy))}var n=e[t.id];n&&((0,a.isNumber)(n.x)&&(l.cx+=n.x),(0,a.isNumber)(n.y)&&(l.cy+=n.y))}),l.cx/=l.count||1,l.cy/=l.count||1,l.children=i,!0})}),o},e.prototype.applyComboCenterForce=function(t){var e=this.gravity,r=this.comboGravity||e,n=this.alpha,o=this.comboTrees,i=this.indexMap,s=this.nodeMap,u=this.comboMap;(o||[]).forEach(function(e){(0,a.traverseTreeUp)(e,function(e){if("node"===e.itemType)return!0;if(!u[e.id])return!0;var o=u[e.id],l=(o.depth+1)/10*.5,c=o.cx,f=o.cy;return o.cx=0,o.cy=0,o.children.forEach(function(e){if("node"!==e.itemType){var h=u[e.id];return h&&(0,a.isNumber)(h.cx)&&(o.cx+=h.cx),void(h&&(0,a.isNumber)(h.cy)&&(o.cy+=h.cy))}var p=s[e.id],d=p.x-c||.005,y=p.y-f||.005,v=Math.sqrt(d*d+y*y),g=i[p.id],m=r*n/v*l;t[g].x-=d*m,t[g].y-=y*m,(0,a.isNumber)(p.x)&&(o.cx+=p.x),(0,a.isNumber)(p.y)&&(o.cy+=p.y)}),o.cx/=o.count||1,o.cy/=o.count||1,!0})})},e.prototype.applyCalculate=function(t){var e=this.comboMap,r=this.nodes,n={};r.forEach(function(t,e){r.forEach(function(r,o){if(!(ei&&(l.minX=i),l.minY>a&&(l.minY=a),l.maxX1&&a.forEach(function(r,s){if("node"===r.itemType)return!1;var u=e[r.id];u&&a.forEach(function(a,l){if(s<=l)return!1;if("node"===a.itemType)return!1;var c=e[a.id];if(!c)return!1;var f=u.cx-c.cx||.005,h=u.cy-c.cy||.005,p=f*f+h*h,d=u.r||1,y=c.r||1,v=d+y,g=y*y,m=d*d;if(po)){var g=e["".concat(p.id,"-").concat(r.id)],m=g.vx,b=g.vy,w=Math.log(Math.abs(r.depth-p.depth)/10)+1||1;w=w<1?1:w,r.comboId!==p.comboId&&(w+=1);var S=w?Math.pow(f,w):1,x=i(r)*a/y*S;if(t[d].x+=m*x,t[d].y+=b*x,d0){var e=Math.abs(g[0][r.sortBy]-t[r.sortBy]);r.maxLevelDiff&&e>=r.maxLevelDiff&&(g=[],v.push(g))}g.push(t)});var m=u+(h||r.minNodeSpacing);if(!r.preventOverlap){var b=v.length>0&&v[0].length>1,w=(Math.min(r.width,r.height)/2-m)/(v.length+(b?1:0));m=Math.min(m,w)}var S=0;if(v.forEach(function(t){var e=r.sweep;void 0===e&&(e=2*Math.PI-2*Math.PI/t.length);var n=t.dTheta=e/Math.max(1,t.length-1);if(t.length>1&&r.preventOverlap){var o=Math.cos(n)-Math.cos(0),i=Math.sin(n)-Math.sin(0),a=Math.sqrt(m*m/(o*o+i*i));S=Math.max(a,S)}t.r=S,S+=m}),r.equidistant){for(var x=0,_=0,E=0;Ee.x&&(I=e.x),N>e.y&&(N=e.y)}),S.edges().forEach(function(t){var e;null===(e=S.edge(t).points)||void 0===e||e.forEach(function(t){I>t.x&&(I=t.x),N>t.y&&(N=t.y)})}),j[0]=d[0]-I,j[1]=d[1]-N}var L="LR"===h||"RL"===h;if(y){var R=this.focusNode,D=this.ranksep,B=this.getRadialPos,F=(0,s.isString)(R)?R:null===R||void 0===R?void 0:R.id,G=F?null===(n=S.node(F))||void 0===n?void 0:n._rank:0,U=[],z=L?"y":"x",V=L?"height":"width",H=1/0,q=-1/0;S.nodes().forEach(function(t){var e=S.node(t);if(i.nodeMap[t]){var r=k(i.nodeMap[t]);if(0===G)U[e._rank]||(U[e._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),U[e._rank].nodes.push(t),U[e._rank].totalWidth+=2*r+e[V],U[e._rank].maxSizeq&&(q=s)}});var W=D||50,Y={},X=(q-H)/.9,J=[.5*(H+q-X),.5*(H+q+X)],K=function(t,e,r,n){void 0===r&&(r=-1/0),void 0===n&&(n=[0,1]);var o=r;return t.forEach(function(t){var r=S.node(t);Y[t]=e;var a=B(r[z],J,X,e,n),s=a.x,u=a.y;if(i.nodeMap[t]){i.nodeMap[t].x=s+j[0],i.nodeMap[t].y=u+j[1],i.nodeMap[t]._order=r._order;var l=P(i.nodeMap[t]);o=o})}:function(t,e,r){var n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter(function(t){return t.x<=n&&t.x>=o})};S.edges().forEach(function(t){var e,r=S.edge(t),n=w.findIndex(function(e){var r=(0,s.getEdgeTerminal)(e,"source"),n=(0,s.getEdgeTerminal)(e,"target");return r===t.v&&n===t.w});if(!(n<=-1)&&i.edgeLabelSpace&&i.controlPoints&&"loop"!==w[n].type){null===(e=null===r||void 0===r?void 0:r.points)||void 0===e||e.forEach(function(t){t.x+=j[0],t.y+=j[1]});var o=i.nodeMap[t.v],a=i.nodeMap[t.w];w[n].controlPoints=f(null===r||void 0===r?void 0:r.points,o,a,tt,L,et,rt)}})}return i.onLayoutEnd&&i.onLayoutEnd(),{nodes:u,edges:w}}},e.prototype.getRadialPos=function(t,e,r,n,o){void 0===o&&(o=[0,1]);var i=(t-e[0])/r,a=2*(i=i*(o[1]-o[0])+o[0])*Math.PI;return{x:Math.cos(a)*n,y:Math.sin(a)*n}},e.prototype.getType=function(){return"dagre"},e}(u.Base);e.DagreLayout=c;var f=function(t,e,r,n,o,i,a){var s=(null===t||void 0===t?void 0:t.slice(1,t.length-1))||[];if(e&&r){var u=e.x,l=e.y,c=r.x,f=r.y;if(o&&(u=e.y,l=e.x,c=r.y,f=r.x),f!==l&&u!==c){var h=n.indexOf(l),p=n[h+1];if(p){var d=s[0],y=o?{x:(l+p)/2,y:(null===d||void 0===d?void 0:d.y)||c}:{x:(null===d||void 0===d?void 0:d.x)||c,y:(l+p)/2};d&&!i(d,y)||s.unshift(y)}var v=n.indexOf(f),g=Math.abs(v-h);if(1===g)(s=a(s,e,r)).length||s.push(o?{x:(l+f)/2,y:u}:{x:u,y:(l+f)/2});else if(g>1){var m=n[v-1];if(m){var b=s[s.length-1],w=o?{x:(f+m)/2,y:(null===b||void 0===b?void 0:b.y)||c}:{x:(null===b||void 0===b?void 0:b.x)||u,y:(f+m)/2};b&&!i(b,w)||s.push(w)}}}}return s}},6006:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;rt.x&&(o=t.x),i>t.y&&(i=t.y)}),e.forEach(function(t){t.points.forEach(function(t){o>t.x&&(o=t.x),i>t.y&&(i=t.y)})}),n[0]=r[0]-o,n[1]=r[1]-i}return n},e.prototype.updateNodePosition=function(t,e){var r=this.combos,n=this.nodes,o=this.edges,i=this.anchorPoint,a=this.graphSettings,s=this.getBegin(t,e);t.forEach(function(t){var l,c=t.x,f=t.y,h=t.id,p=t.type,d=t.coreBox;if(p===u.HierarchyNodeType.META&&h!==u.ROOT_NAME){var y=r.findIndex(function(t){return t.id===h}),v=null===(l=null===a||void 0===a?void 0:a.subScene)||void 0===l?void 0:l.meta;r[y].offsetX=c+s[0],r[y].offsetY=f+s[1],r[y].fixSize=[d.width,d.height],r[y].fixCollapseSize=[d.width,d.height],t.expanded?r[y].padding=[null===v||void 0===v?void 0:v.paddingTop,null===v||void 0===v?void 0:v.paddingRight,null===v||void 0===v?void 0:v.paddingBottom,null===v||void 0===v?void 0:v.paddingLeft]:r[y].padding=[0,0,0,0]}else if(p===u.HierarchyNodeType.OP){y=n.findIndex(function(t){return t.id===h});if(n[y].x=c+s[0],n[y].y=f+s[1],i){var g=[],m=e.filter(function(t){return t.v===h}),b=e.filter(function(t){return t.w===h});m.length>0&&m.forEach(function(e){var r=e.points[0],n=(r.x-c)/t.width+.5,i=(r.y-f)/t.height+.5;g.push([n,i]),e.baseEdgeList.forEach(function(t){var e=o.find(function(e){return e.source===t.v&&e.target===t.w});e&&(e.sourceAnchor=g.length-1)})}),b.length>0&&b.forEach(function(e){var r=e.points[e.points.length-1],n=(r.x-c)/t.width+.5,i=(r.y-f)/t.height+.5;g.push([n,i]),e.baseEdgeList.forEach(function(t){var e=o.find(function(e){return e.source===t.v&&e.target===t.w});e&&(e.targetAnchor=g.length-1)})}),n[y].anchorPoints=g.length>0?g:n[y].anchorPoints||[]}}})},e.prototype.updateEdgePosition=function(t,e){var r=this,n=r.combos,o=r.edges,s=r.controlPoints,l=this.getBegin(t,e);s&&(n.forEach(function(t){t.inEdges=[],t.outEdges=[]}),o.forEach(function(e){var o,s,c,f,h=t.find(function(t){return t.id===e.source}),p=t.find(function(t){return t.id===e.target}),d=[],y=[];if(h&&p)y=(0,u.getEdges)(null===h||void 0===h?void 0:h.id,null===p||void 0===p?void 0:p.id,t);else if(!h||!p){var v=r.getNodePath(e.source),g=r.getNodePath(e.target),m=v.reverse().slice(h?0:1).find(function(e){return t.find(function(t){return t.id===e})}),b=g.reverse().slice(p?0:1).find(function(e){return t.find(function(t){return t.id===e})});h=t.find(function(t){return t.id===m}),p=t.find(function(t){return t.id===b}),y=(0,u.getEdges)(null===h||void 0===h?void 0:h.id,null===p||void 0===p?void 0:p.id,t,{v:e.source,w:e.target})}if(d=(d=y.reduce(function(t,e){return a(a([],t,!0),e.points.map(function(t){return i(i({},t),{x:t.x+l[0],y:t.y+l[1]})}),!0)},[])).slice(1,-1),e.controlPoints=d,(null===p||void 0===p?void 0:p.type)===u.NodeType.META){var w=n.findIndex(function(t){return t.id===(null===p||void 0===p?void 0:p.id)});if(!n[w]||(null===(o=n[w].inEdges)||void 0===o?void 0:o.some(function(t){return t.source===h.id&&t.target===p.id})))return;null===(s=n[w].inEdges)||void 0===s||s.push({source:h.id,target:p.id,controlPoints:d})}if((null===h||void 0===h?void 0:h.type)===u.NodeType.META){w=n.findIndex(function(t){return t.id===(null===h||void 0===h?void 0:h.id)});if(!n[w]||(null===(c=n[w].outEdges)||void 0===c?void 0:c.some(function(t){return t.source===h.id&&t.target===p.id})))return;null===(f=n[w].outEdges)||void 0===f||f.push({source:h.id,target:p.id,controlPoints:d})}}))},e.prototype.getType=function(){return"dagreCompound"},e.prototype.getDataByOrder=function(t){return t.every(function(t){return void 0!==t.layoutOrder})||t.forEach(function(t,e){t.layoutOrder=e}),t.sort(function(t,e){return t.layoutOrder-e.layoutOrder})},e}(s.Base);e.DagreCompoundLayout=c},4804:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Graph=void 0;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r(288).Graph);e.Graph=i},2016:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(2731)),i=r(2929);e.default={layout:o.default,util:{time:i.time,notime:i.notime}}},9441:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(4818)),i=function(t){var e=[],r={},n={};return t.nodes().forEach(function o(i){var a;n[i]||(n[i]=!0,r[i]=!0,null===(a=t.outEdges(i))||void 0===a||a.forEach(function(t){r[t.w]?e.push(t):o(t.w)}),delete r[i])}),e};e.default={run:function(t){var e="greedy"===t.graph().acyclicer?(0,o.default)(t,function(t){return function(e){var r;return(null===(r=t.edge(e))||void 0===r?void 0:r.weight)||1}}(t)):i(t);null===e||void 0===e||e.forEach(function(e){var r=t.edge(e);t.removeEdgeObj(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,"rev-".concat(Math.random()))})},undo:function(t){t.edges().forEach(function(e){var r=t.edge(e);if(r.reversed){t.removeEdgeObj(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}})}}},3868:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(2929),o=function(t,e,r,o,i,a){var s={rank:a,borderType:e,width:0,height:0},u=i[e][a-1],l=(0,n.addDummyNode)(t,"border",s,r);i[e][a]=l,t.setParent(l,o),u&&t.setEdge(u,l,{weight:1})};e.default=function(t){var e;null===(e=t.children())||void 0===e||e.forEach(function(e){return function e(r){var n=t.children(r),i=t.node(r);if((null===n||void 0===n?void 0:n.length)&&n.forEach(function(t){return e(t)}),i.hasOwnProperty("minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a0;--s)if(n=e[s].dequeue()){o=o.concat(h(t,e,r,n,!0));break}}return o},h=function(t,e,r,n,o){var i,a,s=[];return null===(i=t.inEdges(n.v))||void 0===i||i.forEach(function(n){var i=t.edge(n),a=t.node(n.v);o&&s.push({v:n.v,w:n.w,in:0,out:0}),void 0===a.out&&(a.out=0),a.out-=i,d(e,r,a)}),null===(a=t.outEdges(n.v))||void 0===a||a.forEach(function(n){var o=t.edge(n),i=n.w,a=t.node(i);void 0===a.in&&(a.in=0),a.in-=o,d(e,r,a)}),t.removeNode(n.v),o?s:void 0},p=function(t,e){var r=new l,n=0,o=0;t.nodes().forEach(function(t){r.setNode(t,{v:t,in:0,out:0})}),t.edges().forEach(function(t){var i=r.edge(t)||0,a=(null===e||void 0===e?void 0:e(t))||1,s=i+a;r.setEdge(t.v,t.w,s),o=Math.max(o,r.node(t.v).out+=a),n=Math.max(n,r.node(t.w).in+=a)});for(var i=[],a=o+n+3,s=0;s0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;l+=t.weight*r}}),l};e.default=function(t,e){for(var r=0,n=1;n<(null===e||void 0===e?void 0:e.length);n+=1)r+=o(t,e[n-1],e[n]);return r}},1422:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(9987)),i=n(r(1100)),a=n(r(7611)),s=n(r(9285)),u=n(r(5959)),l=r(864),c=r(4804),f=r(2929),h=function(t,e,r){return e.map(function(e){return(0,a.default)(t,e,r)})},p=function(t,e,r,n){var o=new c.Graph;null===t||void 0===t||t.forEach(function(t){for(var i,a=t.graph().root,l=(0,u.default)(t,a,o,e,r,n),c=0;c<(null===(i=l.vs)||void 0===i?void 0:i.length);c++){var f=t.node(l.vs[c]);f&&(f.order=c)}(0,s.default)(t,o,l.vs)})},d=function(t,e){null===e||void 0===e||e.forEach(function(e){null===e||void 0===e||e.forEach(function(e,r){t.node(e).order=r})})};e.default=function(t,e){for(var r=(0,f.maxRank)(t),n=[],a=[],s=1;s-1;s--)a.push(s);var u=h(t,n,"inEdges"),c=h(t,a,"outEdges"),y=(0,o.default)(t);d(t,y);for(var v,g=Number.POSITIVE_INFINITY,m=(s=0,0);m<4;++s,++m)p(s%2?u:c,s%4>=2,!1,e),y=(0,f.buildLayerMatrix)(t),(b=(0,i.default)(t,y))=2,!0,e),y=(0,f.buildLayerMatrix)(t),(b=(0,i.default)(t,y))=e.barycenter)&&n(e,t)})(t);var e}),null===(r=i.out)||void 0===r||r.forEach(function(e){return(r=i,function(e){e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r})};null===t||void 0===t?void 0:t.length;)i();var a=["vs","i","barycenter","weight"];return o.filter(function(t){return!t.merged}).map(function(t){var e={};return null===a||void 0===a||a.forEach(function(r){void 0!==t[r]&&(e[r]=t[r])}),e})},n=function(t,e){var r,n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0};e.default=function(t,e){var n,o,i,a={};null===t||void 0===t||t.forEach(function(t,e){a[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};var r=a[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)}),null===(n=e.edges())||void 0===n||n.forEach(function(t){var e=a[t.v],r=a[t.w];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(a[t.w]))});var s=null===(i=(o=Object.values(a)).filter)||void 0===i?void 0:i.call(o,function(t){return!t.indegree});return r(s)}},5959:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(4561)),i=n(r(7396)),a=n(r(572)),s=function(t,e){null===t||void 0===t||t.forEach(function(t){var r,n=null===(r=t.vs)||void 0===r?void 0:r.map(function(t){return e[t]?e[t].vs:t});t.vs=n.flat()})},u=function(t,e){void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)};e.default=function t(e,r,n,l,c,f){var h,p,d,y,v=e.children(r),g=e.node(r),m=g?g.borderLeft:void 0,b=g?g.borderRight:void 0,w={};m&&(v=null===v||void 0===v?void 0:v.filter(function(t){return t!==m&&t!==b}));var S=(0,o.default)(e,v||[]);null===S||void 0===S||S.forEach(function(r){var o;if(null===(o=e.children(r.v))||void 0===o?void 0:o.length){var i=t(e,r.v,n,l,f);w[r.v]=i,i.hasOwnProperty("barycenter")&&u(r,i)}});var x=(0,i.default)(S,n);s(x,w),null===(h=x.filter(function(t){return t.vs.length>0}))||void 0===h||h.forEach(function(t){var r=e.node(t.vs[0]);r&&(t.fixorder=r.fixorder,t.order=r.order)});var _=(0,a.default)(x,l,c,f);if(m&&(_.vs=[m,_.vs,b].flat(),null===(p=e.predecessors(m))||void 0===p?void 0:p.length)){var E=e.node((null===(d=e.predecessors(m))||void 0===d?void 0:d[0])||""),O=e.node((null===(y=e.predecessors(b))||void 0===y?void 0:y[0])||"");_.hasOwnProperty("barycenter")||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+E.order+O.order)/(_.weight+2),_.weight+=2}return _}},572:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(2929),o=function(t,e,r){for(var n,o=r;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null===t||void 0===t||t.push(n.vs),o++;return o},i=function(t,e){return function(r,n){if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycentern.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.ordern.order)return 1}return t?n.i-r.i:r.i-n.i}};e.default=function(t,e,r,a){var s=(0,n.partition)(t,function(t){var e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return a?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")}),u=s.lhs,l=s.rhs.sort(function(t,e){return-t.i- -e.i}),c=[],f=0,h=0,p=0;null===u||void 0===u||u.sort(i(!!e,!!r)),p=o(c,l,p),null===u||void 0===u||u.forEach(function(t){var e;p+=null===(e=t.vs)||void 0===e?void 0:e.length,c.push(t.vs),f+=t.barycenter*t.weight,h+=t.weight,p=o(c,l,p)});var d={vs:c.flat()};return h&&(d.barycenter=f/h,d.weight=h),d}},8011:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function(t){var e,r=function(t){var e,r={},n=0;return null===(e=t.children())||void 0===e||e.forEach(function e(o){var i,a=n;null===(i=t.children(o))||void 0===i||i.forEach(e),r[o]={low:a,lim:n++}}),r}(t);null===(e=t.graph().dummyChains)||void 0===e||e.forEach(function(e){var n,o,i=e,a=t.node(i),s=a.edgeObj;if(s)for(var u=function(t,e,r,n){var o,i,a=[],s=[],u=Math.min(e[r].low,e[n].low),l=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),a.push(o)}while(o&&(e[o].low>u||l>e[o].lim));for(i=o,o=n;o&&o!==i;)s.push(o),o=t.parent(o);return{lca:i,path:a.concat(s.reverse())}}(t,r,s.v,s.w),l=u.path,c=u.lca,f=0,h=l[f],p=!0;i!==s.w;){if(a=t.node(i),p){for(;h!==c&&(null===(n=t.node(h))||void 0===n?void 0:n.maxRank)s)&&(0,e.addConflict)(n,r,c)}))}.apply(void 0,r),o.set(i,!0))}return(null===r||void 0===r?void 0:r.length)&&r.reduce(function(e,r){var n,i=-1,a=0,s=new Map;return null===r||void 0===r||r.forEach(function(u,l){var c;if("border"===(null===(c=t.node(u))||void 0===c?void 0:c.dummy)){var f=t.predecessors(u)||[];f.length&&(n=t.node(f[0]).order,o([r,a,l,i,n],s),a=l,i=n)}o([r,a,r.length,n,e.length],s)}),r}),n};e.findOtherInnerSegmentNode=function(t,e){var r,n;if(null===(r=t.node(e))||void 0===r?void 0:r.dummy)return null===(n=t.predecessors(e))||void 0===n?void 0:n.find(function(e){return t.node(e).dummy})};e.addConflict=function(t,e,r){var n=e,o=r;if(n>o){var i=n;n=o,o=i}var a=t[n];a||(t[n]=a={}),a[o]=!0};e.hasConflict=function(t,e,r){var n=e;n>r&&(n=r);return!!t[n]};e.verticalAlignment=function(t,r,n,o){var i={},a={},s={};return null===r||void 0===r||r.forEach(function(t){null===t||void 0===t||t.forEach(function(t,e){i[t]=t,a[t]=t,s[t]=e})}),null===r||void 0===r||r.forEach(function(t){var r=-1;null===t||void 0===t||t.forEach(function(t){var u=o(t);if(u.length)for(var l=((u=u.sort(function(t,e){return s[t]-s[e]})).length-1)/2,c=Math.floor(l),f=Math.ceil(l);c<=f;++c){var h=u[c];a[t]===t&&ru.lim&&(l=u,c=!0);var f=e.edges().filter(function(e){return c===p(t,t.node(e.v),l)&&c!==p(t,t.node(e.w),l)});return(0,i.minBy)(f,function(t){return(0,o.slack)(e,t)})};e.exchangeEdges=function(t,r,n,o){var i=n.v,a=n.w;t.removeEdge(i,a),t.setEdge(o.v,o.w,{}),(0,e.initLowLimValues)(t),(0,e.initCutValues)(t,r),f(t,r)};var f=function(t,e){var r=t.nodes().find(function(t){var r;return!(null===(r=e.node(t))||void 0===r?void 0:r.parent)}),n=s(t,r);null===(n=null===n||void 0===n?void 0:n.slice(1))||void 0===n||n.forEach(function(r){var n=t.node(r).parent,o=e.edgeFromArgs(r,n),i=!1;o||(o=e.edgeFromArgs(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)})},h=function(t,e,r){return t.hasEdge(e,r)},p=function(t,e,r){return r.low<=e.lim&&e.lim<=r.lim};e.default=function(t){var r=(0,i.simplify)(t);(0,o.longestPath)(r);var a,s,u=(0,n.feasibleTree)(r);for((0,e.initLowLimValues)(u),(0,e.initCutValues)(u,r);a=(0,e.leaveEdge)(u);)s=(0,e.enterEdge)(u,r,a),(0,e.exchangeEdges)(u,r,a,s)}},4166:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.slack=e.longestPathWithLayer=e.longestPath=void 0;var r=function(t){var e,r={};null===(e=t.sources())||void 0===e||e.forEach(function(e){return function e(n){var o,i,a=t.node(n);return a?r[n]?a.rank:(r[n]=!0,null===(o=t.outEdges(n))||void 0===o||o.forEach(function(r){var n=e(r.w)-t.edge(r).minlen;n&&(void 0===i||nMath.abs(a)*l?(s<0&&(l=-l),r=l*a/s,n=l):(a<0&&(u=-u),r=u,n=u*s/a),{x:o+r,y:i+n}):{x:0,y:0}};e.buildLayerMatrix=function(t){for(var r=[],n=(0,e.maxRank)(t)+1,o=0;oe)&&(e=o)}),e||(e=0),e};e.partition=function(t,e){var r={lhs:[],rhs:[]};return null===t||void 0===t||t.forEach(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)}),r};e.time=function(t,e){var r=Date.now();try{return e()}finally{console.log("".concat(t," time: ").concat(Date.now()-r,"ms"))}};e.notime=function(t,e){return e()};e.minBy=function(t,e){return t.reduce(function(t,r){return e(t)>e(r)?r:t})}},4077:function(t,e,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r1){var e=n({},t);delete e.size,s.push(e)}});var h=[];o.forEach(function(t){var e=s.find(function(e){return e.id===t.source}),r=s.find(function(e){return e.id===t.target});e&&r&&h.push(t)});var p=new f.DagreLayout({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}).layout({nodes:s,edges:h}).nodes;r.forEach(function(t){var e=(p||[]).find(function(e){return e.id===t.id});t.x=(null===e||void 0===e?void 0:e.x)||i/2,t.y=(null===e||void 0===e?void 0:e.y)||a/2});var d=JSON.parse(JSON.stringify(r)),y=JSON.parse(JSON.stringify(o)),v=u.forceSimulation().nodes(d).force("link",u.forceLink(y).id(function(t){return t.id}).distance(function(t){return h.find(function(e){return e.source===t.source&&e.target===t.target})?30:20})).force("charge",u.forceManyBody()).force("center",u.forceCenter(i/2,a/2)).force("x",u.forceX(i/2)).force("y",u.forceY(a/2)).alpha(.3).alphaDecay(.08).alphaMin(.001);return new Promise(function(t){v.on("end",function(){r.forEach(function(t){var e=d.find(function(e){return e.id===t.id});e&&(t.x=e.x,t.y=e.y)});var n=Math.min.apply(Math,r.map(function(t){return t.x})),s=Math.max.apply(Math,r.map(function(t){return t.x})),u=Math.min.apply(Math,r.map(function(t){return t.y})),f=Math.max.apply(Math,r.map(function(t){return t.y})),h=i/(s-n),p=a/(f-u);r.forEach(function(t){void 0!==t.x&&h<1&&(t.x=(t.x-n)*h),void 0!==t.y&&p<1&&(t.y=(t.y-u)*p)}),r.forEach(function(t){t.sizeTemp=t.size,t.size=[10,10]}),(0,c.default)(r,o),r.forEach(function(t){t.size=t.sizeTemp||[],delete t.sizeTemp}),(0,l.default)({nodes:r,edges:o},e),t()})})}},5791:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(2558));e.default=function(t,e){if(!t.nodes||0===t.nodes.length)return t;var r=e.width,n=e.height,i=e.nodeMinGap,a=1e4,s=1e4;t.nodes.forEach(function(t){var e=t.size[0]||50,r=t.size[1]||50;a=Math.min(e,a),s=Math.min(r,s)});var u=new o.default;u.init(r,n,{CELL_H:s,CELL_W:a}),t.nodes.forEach(function(t){var e=u.occupyNearest(t);e&&(e.node={id:t.id,size:t.size},t.x=e.x,t.y=e.y,t.dx=e.dx,t.dy=e.dy)});for(var l=0;la){for(var d=v=Math.ceil((c.size[0]+i)/a)-1,y=0;y-1&&!u.cells[h+y+1][p].node);y++)d--;u.insertColumn(h,d)}if(c.size[1]+i>s){var v;for(d=v=Math.ceil((c.size[1]+i)/s)-1,y=0;y-1&&!u.cells[h][p+y+1].node);y++)d--;u.insertRow(p,d)}}for(l=0;lt;n--)for(o=0;o=t&&(this.additionColumn[o]+=e);for(n=0;nt;n--)this.cells[o][n+e]=r(r({},this.cells[o][n]),{dx:o,dy:n+e,x:o*this.CELL_W,y:(n+e)*this.CELL_H}),this.cells[o][n]={dx:o,dy:n,x:o*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(n=0;n=t&&(this.additionRow[n]+=e);for(o=0;oa?e:t,h=n>a?t:e,p=f.x-f.size[0]/2,d=f.y-f.size[1]/2,y=f.x+f.size[0]/2,v=f.y+f.size[1]/2,g=h.x-h.size[0]/2,m=h.y-h.size[1]/2,b=h.x+h.size[0]/2,w=h.y+h.size[1]/2,S=f.x,x=f.y,_=h.x,E=h.y,O=0,P=0;if(y>=g&&b>=p&&v>=m&&w>=d){0===(P=Math.sqrt(Math.pow(_-S,2)+Math.pow(E-x,2)))&&(P=1e-7),O=1*i/P*100+((yg?p:g))*((vm?d:m)),O*=o}else{var k=!1,C=function(t,e,r){var n=t.x-t.size[0]/2,o=t.y-t.size[1]/2,i=t.x+t.size[0]/2,a=t.y+t.size[1]/2,c=e.x-e.size[0]/2,f=e.y-e.size[1]/2,h=e.x+e.size[0]/2,p=e.y+e.size[1]/2,d=t.x,y=t.y,v=e.x,g=e.y,m=v-d,b=Math.atan2(m,g-y),w=0,S=0,x=0,_=0;b>s?(S=o-p,w=c-i,x=parseFloat(S?(S/Math.cos(b)).toFixed(2):w.toFixed(2)),_=parseFloat(w?(w/Math.sin(b)).toFixed(2):S.toFixed(2))):x=_=0(w=c-i)?parseFloat(S?(S/Math.cos(b)).toFixed(2):w.toFixed(2)):parseFloat(w?(w/Math.sin(b)).toFixed(2):S.toFixed(2)):b<-s?(S=o-p)>(w=-(h-n))?parseFloat(S?(S/Math.cos(b)).toFixed(2):w.toFixed(2)):parseFloat(w?(w/Math.sin(b)).toFixed(2):S.toFixed(2)):(S=f-a)>(w=Math.abs(m)>(i-n)/2?n-h:m)?parseFloat(S?(S/Math.cos(b)).toFixed(2):w.toFixed(2)):parseFloat(w&&0!==b?(w/Math.sin(b)).toFixed(2):S.toFixed(2));var E=parseFloat(b.toFixed(2)),O=r;return r&&(O=ur||i.y>n)&&(e+=1e12);for(var a=o+1;a150)&&!(c<30||c>150)||l*c<0){a=!1;break}if(l>70&&l<110&&!(c>70&&c<110)||l*c<0){a=!1;break}if((u.x-t.x)*(u.x-e.x)<0){a=!1;break}if((u.y-t.y)*(u.y-e.y)<0){a=!1;break}}return a}function b(t,e){for(var r=!1,n=1*f,o=1*h,i=[n,-n,0,0],a=[0,0,o,-o],s=0;sd?(l=v,r=!0):(u.x-=i[c],u.y-=a[c])}}return p>d&&(p*=y),r?g(t):0}function w(t,e){var o=0;(t.x<0||t.y<0||t.x+t.size[0]+20>r||t.y+t.size[1]+20>n)&&(o+=1e12);for(var i=0;i0&&!(++a>=50);){var s=b(t,e);0!==s&&(i=s),o=i-r,r=i,0===o?--n:n=20}return t.forEach(function(t){t.x=t.x-t.size[0]/2,t.y=t.y-t.size[1]/2}),{nodes:t,edges:e}}},7333:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.forceNBody=void 0;var n=r(3487);function o(t){var e=0,r=0,n=0;if(t.length){for(var o=0;o<4;o++){(i=t[o])&&i.weight&&(e+=i.weight,r+=i.x*i.weight,n+=i.y*i.weight)}t.x=r/e,t.y=n/e,t.weight=e}else{var i=t;t.x=i.data.x,t.y=i.data.y,t.weight=i.data.weight}}e.forceNBody=function(t,e,r,a,s){var u=r/a,l=t.map(function(t,r){var n=e[t.id],o=n.data,i=n.x,a=n.y,s=n.size,l=o.layout.force.nodeStrength;return{x:i,y:a,size:s,index:r,vx:0,vy:0,weight:u*l}}),c=(0,n.quadtree)(l,function(t){return t.x},function(t){return t.y}).visitAfter(o);return l.forEach(function(t){!function(t,e){e.visit(function(e,r,n,o,a){return i(e,r,n,o,a,t)})}(t,c)}),l.map(function(r,n){var o=e[t[n].id].data.layout.force.mass,i=void 0===o?1:o;s[2*n]=r.vx/i,s[2*n+1]=r.vy/i}),s};var i=function(t,e,r,n,o,i){var a=i.x-t.x||.1,s=i.y-t.y||.1,u=n-e,l=a*a+s*s,c=Math.sqrt(l)*l;if(u*u*.811&&(i=(0,s.getAvgNodePosition)(l))}else i=void 0;return{x:null===i||void 0===i?void 0:i.x,y:null===i||void 0===i?void 0:i.y}}}}if(n){t||(t=this.getSameTypeLeafMap());var p={};Array.from(new Set(a.map(function(t,e){return t[o]}))).filter(function(t){return void 0!==t}).forEach(function(t){var e=a.filter(function(e){return e[o]===t}).map(function(t){return u[t.id]});p[t]=(0,s.getAvgNodePosition)(e)}),f={single:function(t){return c(t)},leaf:function(t){return c(t)},others:function(t){return c(t)},center:function(t,e,r){var n=p[t[o]];return{x:null===n||void 0===n?void 0:n.x,y:null===n||void 0===n?void 0:n.y}}}}this.centripetalOptions=i(i({},this.centripetalOptions),f);var d=this.centripetalOptions,y=d.leaf,v=d.single,g=d.others;y&&"function"!=typeof y&&(this.centripetalOptions.leaf=function(){return y}),v&&"function"!=typeof v&&(this.centripetalOptions.single=function(){return v}),g&&"function"!=typeof g&&(this.centripetalOptions.others=function(){return g})},e.prototype.updateCfg=function(t){t&&Object.assign(this,t)},e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t=this;t.stop();var e=t.nodes,r=t.edges,n=t.defSpringLen;if(t.judgingDistance=0,e&&0!==e.length){t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var o=t.center;if(1===e.length)return e[0].x=o[0],e[0].y=o[1],void t.onLayoutEnd([i({},e[0])]);t.degreesMap=(0,s.getDegreeMap)(e,r),t.propsGetMass?t.getMass=t.propsGetMass:t.getMass=function(e){var r=1;(0,s.isNumber)(e.mass)&&(r=e.mass);var n=t.degreesMap[e.id].all;return!n||n<5?r:5*n*r};var a,u=t.nodeSize;if(t.preventOverlap){var c,f=t.nodeSpacing;c=(0,s.isNumber)(f)?function(){return f}:(0,s.isFunction)(f)?f:function(){return 0},a=u?(0,s.isArray)(u)?function(t){return Math.max(u[0],u[1])+c(t)}:function(t){return u+c(t)}:function(t){return t.size?(0,s.isArray)(t.size)?Math.max(t.size[0],t.size[1])+c(t):(0,s.isObject)(t.size)?Math.max(t.size.width,t.size.height)+c(t):t.size+c(t):10+c(t)}}t.nodeSize=a,t.linkDistance=l(t.linkDistance,1),t.nodeStrength=l(t.nodeStrength,1),t.edgeStrength=l(t.edgeStrength,1);var h={},p={};e.forEach(function(e,n){(0,s.isNumber)(e.x)||(e.x=Math.random()*t.width),(0,s.isNumber)(e.y)||(e.y=Math.random()*t.height);var o=t.degreesMap[e.id];h[e.id]=i(i({},e),{data:i(i({},e.data),{size:t.nodeSize(e)||30,layout:{inDegree:o.in,outDegree:o.out,degree:o.all,tDegree:o.in,sDegree:o.out,force:{mass:t.getMass(e),nodeStrength:t.nodeStrength(e,r)}}})}),p[e.id]=n}),t.nodeMap=h,t.nodeIdxMap=p,t.edgeInfos=[],null===r||void 0===r||r.forEach(function(e){var r=h[e.source],o=h[e.target];r&&o?t.edgeInfos.push({edgeStrength:t.edgeStrength(e),linkDistance:n?n(i(i({},e),{source:r,target:o}),r,o):t.linkDistance(e,r,o)||1+(u(r)+u(r)||0)/2}):elf.edgeInfos.push({})}),this.getCentripetalOptions(),t.onLayoutEnd=t.onLayoutEnd||function(){},t.run()}else t.onLayoutEnd([])},e.prototype.run=function(){var t=this,e=t.maxIteration,r=t.nodes,n=t.edges,o=t.workerEnabled,i=t.minMovement,a=t.animate,s=t.nodeMap,u=t.height;if(t.currentMinY=0,t.currentMaxY=u,r){var l=[];if(r.forEach(function(t,e){l[2*e]=0,l[2*e+1]=0}),this.defSideCoe&&"function"==typeof this.defSideCoe){var c={};n.forEach(function(t){var e=t.source,r=t.target;c[e]=c[e]||[],c[e].push(t),c[r]=c[r]||[],c[r].push(t)}),this.relatedEdges=c}var f=e;if(o||!a){for(var h=0;(t.judgingDistance>i||h<1)&&h=f||t.judgingDistancei){var c=i/l;s*=c,u*=c}e[2*a]=s,e[2*a+1]=u})},e.prototype.updatePosition=function(t,e){var r=this,n=r.nodes,o=r.distanceThresholdMode,i=r.nodeMap;if(null===n||void 0===n?void 0:n.length){var a=0;"max"===o?r.judgingDistance=-1/0:"min"===o&&(r.judgingDistance=1/0);var u=1/0,l=-1/0;n.forEach(function(n,c){var f=i[n.id];if((0,s.isNumber)(n.fx)&&(0,s.isNumber)(n.fy))return n.x=n.fx,n.y=n.fy,f.x=n.x,void(f.y=n.y);var h=t[2*c]*e,p=t[2*c+1]*e;n.x+=h,n.y+=p,f.x=n.x,f.y=n.y,n.yl&&(l=n.y);var d=Math.sqrt(h*h+p*p);switch(o){case"max":r.judgingDistanced&&(r.judgingDistance=d);break;default:a+=d}}),this.currentMinY=u,this.currentMaxY=l,o&&"mean"!==o||(r.judgingDistance=a/n.length)}else this.judgingDistance=0},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){this.stop(),this.tick=null,this.nodes=null,this.edges=null,this.destroyed=!0},e.prototype.getType=function(){return"force2"},e.prototype.getSameTypeLeafMap=function(){var t=this,e=t.nodeClusterBy,r=t.nodes,n=t.edges,o=t.nodeMap,i=t.degreesMap;if(null===r||void 0===r?void 0:r.length){var a={};return r.forEach(function(t,r){1===i[t.id].all&&(a[t.id]=(0,s.getCoreNodeAndRelativeLeafNodes)("leaf",t,n,e,i,o))}),a}},e}(a.Base);e.Force2Layout=c},5257:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}return t.prototype.distanceTo=function(t){var e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)},t.prototype.setPos=function(t,e){this.rx=t,this.ry=e},t.prototype.resetForce=function(){this.fx=0,this.fy=0},t.prototype.addForce=function(t){var e=t.rx-this.rx,r=t.ry-this.ry,n=Math.hypot(e,r);n=n<1e-4?1e-4:n;var o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n},t.prototype.in=function(t){return t.contains(this.rx,this.ry)},t.prototype.add=function(e){var r=this.mass+e.mass;return new t({rx:(this.rx*this.mass+e.rx*e.mass)/r,ry:(this.ry*this.mass+e.ry*e.mass)/r,mass:r,degree:this.degree+e.degree})},t}();e.default=r},3209:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ForceAtlas2Layout=void 0;var a=r(8933),s=r(864),u=i(r(5257)),l=i(r(5138)),c=i(r(5490)),f=function(t){function e(e){var r=t.call(this)||this;return r.center=[0,0],r.width=300,r.height=300,r.nodes=[],r.edges=[],r.kr=5,r.kg=1,r.mode="normal",r.preventOverlap=!1,r.dissuadeHubs=!1,r.barnesHut=void 0,r.maxIteration=0,r.ks=.1,r.ksmax=10,r.tao=.1,r.onLayoutEnd=function(){},r.prune=void 0,r.updateCfg(e),r}return o(e,t),e.prototype.getDefaultCfg=function(){return{}},e.prototype.execute=function(){var t=this.nodes,e=this.onLayoutEnd,r=this.prune,n=this.maxIteration;this.width||"undefined"==typeof window||(this.width=window.innerWidth),this.height||"undefined"==typeof window||(this.height=window.innerHeight);for(var o=[],i=t.length,a=0;a250&&(this.barnesHut=!0),void 0===this.prune&&i>100&&(this.prune=!0),0!==this.maxIteration||this.prune?0===this.maxIteration&&r&&(n=100,i<=200&&i>100?n=500:i>200&&(n=950),this.maxIteration=n):(n=250,i<=200&&i>100?n=1e3:i>200&&(n=1200),this.maxIteration=n),this.kr||(this.kr=50,i>100&&i<=500?this.kr=20:i>500&&(this.kr=1)),this.kg||(this.kg=20,i>100&&i<=500?this.kg=10:i>500&&(this.kg=1)),this.nodes=this.updateNodesByForces(o),e()},e.prototype.updateNodesByForces=function(t){for(var e=this.edges,r=this.maxIteration,n=this.nodes,o=e.filter(function(t){return(0,s.getEdgeTerminal)(t,"source")!==(0,s.getEdgeTerminal)(t,"target")}),i=n.length,a=o.length,u=[],l={},c={},f=[],h=0;h0;){for(g=0;g50||!l)?this.getOptRepGraForces(d,v,o):this.getRepGraForces(p,50,d,100,i,o);var b=this.updatePos(d,y,h,o);a=b.nodes,h=b.sg,p--,this.tick&&this.tick()}return a},e.prototype.getAttrForces=function(t,e,r,n,o,i,a,s){for(var u=this.nodes,l=this.preventOverlap,c=this.dissuadeHubs,f=this.mode,h=this.prune,p=0;p0&&(w=b,S=b),s[2*n[d.id]]+=w*m[0],s[2*n[v.id]]-=S*m[0],s[2*n[d.id]+1]+=w*m[1],s[2*n[v.id]+1]-=S*m[1]}}return s},e.prototype.getRepGraForces=function(t,e,r,n,o,i){for(var a=this.nodes,s=this.preventOverlap,u=this.kr,l=this.kg,c=this.center,f=this.prune,h=a.length,p=0;p0&&(g=u*(i[p]+1)*(i[d]+1)/v),r[2*p]-=g*y[0],r[2*d]+=g*y[0],r[2*p+1]-=g*y[1],r[2*d+1]+=g*y[1]}var m=[a[p].x-c[0],a[p].y-c[1]],b=Math.hypot(m[0],m[1]);m[0]=m[0]/b,m[1]=m[1]/b;var w=l*(i[p]+1);r[2*p]-=w*m[0],r[2*p+1]-=w*m[1]}return r},e.prototype.getOptRepGraForces=function(t,e,r){for(var n=this.nodes,o=this.kg,i=this.center,a=this.prune,s=n.length,u=9e10,f=-9e10,h=9e10,p=-9e10,d=0;d=f&&(f=n[d].x),n[d].x<=u&&(u=n[d].x),n[d].y>=p&&(p=n[d].y),n[d].y<=h&&(h=n[d].y));var y={xmid:(f+u)/2,ymid:(p+h)/2,length:Math.max(f-u,p-h),massCenter:i,mass:s},v=new l.default(y),g=new c.default(v);for(d=0;d1.5*w?1.5*w:r);for(y=0;y_?_:S)*t[2*y],O=S*t[2*y+1];o[y].x+=E,o[y].y+=O}return{nodes:o,sg:r}},e}(a.Base);e.ForceAtlas2Layout=f},5138:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}return t.prototype.getLength=function(){return this.length},t.prototype.contains=function(t,e){var r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r},t.prototype.NW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.NE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.SW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t.prototype.SE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t}();e.default=r},5490:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}return t.prototype.insert=function(e){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new t(this.quad.NW()),this.NE=new t(this.quad.NE()),this.SW=new t(this.quad.SW()),this.SE=new t(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e)):this.body=e},t.prototype._putBody=function(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))},t.prototype._isExternal=function(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE},t.prototype.updateForce=function(t){null!=this.body&&t!==this.body&&(this._isExternal()?t.addForce(this.body):(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)-1||(e[n]=t[n])}),e}),this.ticking=!1},e.prototype.execute=function(t){var e=this,r=e.nodes,n=e.edges;if(!e.ticking){var o=e.forceSimulation,i=e.alphaMin,a=e.alphaDecay,s=e.alpha;if(o){if(t)if(e.clustering&&e.clusterForce&&(e.clusterForce.nodes(r),e.clusterForce.links(n)),o.nodes(r),n&&e.edgeForce)e.edgeForce.links(n);else if(n&&!e.edgeForce){h=l.forceLink().id(function(t){return t.id}).links(n);e.edgeStrength&&h.strength(e.edgeStrength),e.linkDistance&&h.distance(e.linkDistance),e.edgeForce=h,o.force("link",h)}e.preventOverlap&&e.overlapProcess(o),o.alpha(s).restart(),this.ticking=!0}else try{var u=l.forceManyBody();if(e.nodeStrength&&u.strength(e.nodeStrength),o=l.forceSimulation().nodes(r),e.clustering){var f=(0,c.default)();f.centerX(e.center[0]).centerY(e.center[1]).template("force").strength(e.clusterFociStrength),n&&f.links(n),r&&f.nodes(r),f.forceLinkDistance(e.clusterEdgeDistance).forceLinkStrength(e.clusterEdgeStrength).forceCharge(e.clusterNodeStrength).forceNodeSize(e.clusterNodeSize),e.clusterForce=f,o.force("group",f)}if(o.force("center",l.forceCenter(e.center[0],e.center[1])).force("charge",u).alpha(s).alphaDecay(a).alphaMin(i),e.preventOverlap&&e.overlapProcess(o),n){var h=l.forceLink().id(function(t){return t.id}).links(n);e.edgeStrength&&h.strength(e.edgeStrength),e.linkDistance&&h.distance(e.linkDistance),e.edgeForce=h,o.force("link",h)}if(e.workerEnabled&&!y()&&(e.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),e.workerEnabled){o.stop();for(var d=function(t){var e=t.alphaMin(),r=t.alphaTarget(),n=t.alpha(),o=Math.log((e-r)/(n-r))/Math.log(1-t.alphaDecay());return Math.ceil(o)}(o),v=1;v<=d;v++)o.tick(),postMessage({nodes:r,currentTick:v,totalTicks:d,type:p.LAYOUT_MESSAGE.TICK},void 0);e.ticking=!1}else o.on("tick",function(){e.tick()}).on("end",function(){e.ticking=!1,e.onLayoutEnd&&e.onLayoutEnd()}),e.ticking=!0;e.forceSimulation=o,e.ticking=!0}catch(t){e.ticking=!1,console.warn(t)}}},e.prototype.overlapProcess=function(t){var e,r,n=this.nodeSize,o=this.nodeSpacing,i=this.collideStrength;if(r=(0,f.isNumber)(o)?function(){return o}:(0,f.isFunction)(o)?o:function(){return 0},n)if((0,f.isFunction)(n))e=function(t){return n(t)+r(t)};else if((0,f.isArray)(n)){var a=(n[0]>n[1]?n[0]:n[1])/2;e=function(t){return a+r(t)}}else if((0,f.isNumber)(n)){var s=n/2;e=function(t){return s+r(t)}}else e=function(){return 10};else e=function(t){return t.size?(0,f.isArray)(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2+r(t):(0,f.isObject)(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2+r(t):t.size/2+r(t):10+r(t)};t.force("collisionForce",l.forceCollide(e).strength(i))},e.prototype.updateCfg=function(t){this.ticking&&(this.forceSimulation.stop(),this.ticking=!1),this.forceSimulation=null,Object.assign(this,t)},e.prototype.destroy=function(){this.ticking&&(this.forceSimulation.stop(),this.ticking=!1),this.nodes=null,this.edges=null,this.destroyed=!0},e}(h.Base);function y(){return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope}e.ForceLayout=d},574:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&("get"in o?e.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(5989),e)},6983:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.FruchtermanLayout=void 0;var i=r(8933),a=r(864),s=function(t){function e(e){var r=t.call(this)||this;return r.maxIteration=1e3,r.workerEnabled=!1,r.gravity=10,r.speed=5,r.clustering=!1,r.clusterGravity=10,r.nodes=[],r.edges=[],r.width=300,r.height=300,r.nodeMap={},r.nodeIdxMap={},r.onLayoutEnd=function(){},r.tick=function(){},r.animate=!0,r.updateCfg(e),r}return o(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},e.prototype.execute=function(){var t,e,r=this,n=this.nodes;if(void 0!==this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),n&&0!==n.length){this.width||"undefined"==typeof window||(this.width=window.innerWidth),this.height||"undefined"==typeof window||(this.height=window.innerHeight),this.center||(this.center=[this.width/2,this.height/2]);var o=this.center;if(1===n.length)return n[0].x=o[0],n[0].y=o[1],void(null===(e=this.onLayoutEnd)||void 0===e||e.call(this));var i={},s={};return n.forEach(function(t,e){(0,a.isNumber)(t.x)||(t.x=Math.random()*r.width),(0,a.isNumber)(t.y)||(t.y=Math.random()*r.height),i[t.id]=t,s[t.id]=e}),this.nodeMap=i,this.nodeIdxMap=s,this.run()}null===(t=this.onLayoutEnd)||void 0===t||t.call(this)},e.prototype.run=function(){var t,e=this,r=e.nodes;if(r){var n=e.edges,o=e.maxIteration,i=e.workerEnabled,a=e.clustering,s=e.animate,u={};if(a&&r.forEach(function(t){void 0===u[t.cluster]&&(u[t.cluster]={name:t.cluster,cx:0,cy:0,count:0})}),i||!s){for(var l=0;l=o&&(null===(t=e.onLayoutEnd)||void 0===t||t.call(e),window.clearInterval(e.timeInterval))},0)}return{nodes:r,edges:n}}},e.prototype.runOneStep=function(t){var e,r=this.nodes;if(r){var n=this.edges,o=this.center,i=this.gravity,s=this.speed,u=this.clustering,l=this.height*this.width,c=Math.sqrt(l)/10,f=l/(r.length+1),h=Math.sqrt(f),p=[];if(r.forEach(function(t,e){p[e]={x:0,y:0}}),this.applyCalculate(r,n,p,h,f),u){for(var d in t)t[d].cx=0,t[d].cy=0,t[d].count=0;for(var d in r.forEach(function(e){var r=t[e.cluster];(0,a.isNumber)(e.x)&&(r.cx+=e.x),(0,a.isNumber)(e.y)&&(r.cy+=e.y),r.count++}),t)t[d].cx/=t[d].count,t[d].cy/=t[d].count;var y=this.clusterGravity||i;r.forEach(function(e,r){if((0,a.isNumber)(e.x)&&(0,a.isNumber)(e.y)){var n=t[e.cluster],o=Math.sqrt((e.x-n.cx)*(e.x-n.cx)+(e.y-n.cy)*(e.y-n.cy)),i=h*y;p[r].x-=i*(e.x-n.cx)/o,p[r].y-=i*(e.y-n.cy)/o}})}r.forEach(function(t,e){if((0,a.isNumber)(t.x)&&(0,a.isNumber)(t.y)){var r=.01*h*i;p[e].x-=r*(t.x-o[0]),p[e].y-=r*(t.y-o[1])}}),r.forEach(function(t,e){if((0,a.isNumber)(t.fx)&&(0,a.isNumber)(t.fy))return t.x=t.fx,void(t.y=t.fy);if((0,a.isNumber)(t.x)&&(0,a.isNumber)(t.y)){var r=Math.sqrt(p[e].x*p[e].x+p[e].y*p[e].y);if(r>0){var n=Math.min(c*(s/800),r);t.x+=p[e].x/r*n,t.y+=p[e].y/r*n}}}),null===(e=this.tick)||void 0===e||e.call(this)}},e.prototype.applyCalculate=function(t,e,r,n,o){this.calRepulsive(t,r,o),e&&this.calAttractive(e,r,n)},e.prototype.calRepulsive=function(t,e,r){t.forEach(function(n,o){e[o]={x:0,y:0},t.forEach(function(t,i){if(o!==i&&(0,a.isNumber)(n.x)&&(0,a.isNumber)(t.x)&&(0,a.isNumber)(n.y)&&(0,a.isNumber)(t.y)){var s=n.x-t.x,u=n.y-t.y,l=s*s+u*u;if(0===l){l=1;var c=o>i?1:-1;s=.01*c,u=.01*c}var f=r/l;e[o].x+=s*f,e[o].y+=u*f}})})},e.prototype.calAttractive=function(t,e,r){var n=this;t.forEach(function(t){var o=(0,a.getEdgeTerminal)(t,"source"),i=(0,a.getEdgeTerminal)(t,"target");if(o&&i){var s=n.nodeIdxMap[o],u=n.nodeIdxMap[i];if(s!==u){var l=n.nodeMap[o],c=n.nodeMap[i];if((0,a.isNumber)(c.x)&&(0,a.isNumber)(l.x)&&(0,a.isNumber)(c.y)&&(0,a.isNumber)(l.y)){var f=c.x-l.x,h=c.y-l.y,p=Math.sqrt(f*f+h*h),d=p*p/r;e[u].x-=f/p*d,e[u].y-=h/p*d,e[s].x+=f/p*d,e[s].y+=h/p*d}}}})},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){this.stop(),this.tick=null,this.nodes=null,this.edges=null,this.destroyed=!0},e.prototype.getType=function(){return"fruchterman"},e}(i.Base);e.FruchtermanLayout=s},4600:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.GForceLayout=void 0;var i=r(8933),a=r(864),s=function(t,e){return t?(0,a.isNumber)(t)?function(e){return t}:t:function(t){return e||1}},u=function(t){function e(e){var r=t.call(this)||this;return r.maxIteration=500,r.workerEnabled=!1,r.edgeStrength=200,r.nodeStrength=1e3,r.coulombDisScale=.005,r.damping=.9,r.maxSpeed=1e3,r.minMovement=.5,r.interval=.02,r.factor=1,r.linkDistance=1,r.gravity=10,r.preventOverlap=!0,r.collideStrength=1,r.tick=function(){},r.nodes=[],r.edges=[],r.width=300,r.height=300,r.nodeMap={},r.nodeIdxMap={},r.animate=!0,r.updateCfg(e),r}return o(e,t),e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t,e,r=this,n=r.nodes;if(void 0!==r.timeInterval&&"undefined"!=typeof window&&window.clearInterval(r.timeInterval),n&&0!==n.length){r.width||"undefined"==typeof window||(r.width=window.innerWidth),r.height||"undefined"==typeof window||(r.height=window.innerHeight),r.center||(r.center=[r.width/2,r.height/2]);var o=r.center;if(1===n.length)return n[0].x=o[0],n[0].y=o[1],void(null===(e=r.onLayoutEnd)||void 0===e||e.call(r));var i={},u={};n.forEach(function(t,e){(0,a.isNumber)(t.x)||(t.x=Math.random()*r.width),(0,a.isNumber)(t.y)||(t.y=Math.random()*r.height),i[t.id]=t,u[t.id]=e}),r.nodeMap=i,r.nodeIdxMap=u,r.linkDistance=s(r.linkDistance,1),r.nodeStrength=s(r.nodeStrength,1),r.edgeStrength=s(r.edgeStrength,1);var l,c=r.nodeSize;if(r.preventOverlap){var f,h=r.nodeSpacing;f=(0,a.isNumber)(h)?function(){return h}:(0,a.isFunction)(h)?h:function(){return 0},l=c?(0,a.isArray)(c)?function(t){return Math.max(c[0],c[1])+f(t)}:function(t){return c+f(t)}:function(t){return t.size?(0,a.isArray)(t.size)?Math.max(t.size[0],t.size[1])+f(t):(0,a.isObject)(t.size)?Math.max(t.size.width,t.size.height)+f(t):t.size+f(t):10+f(t)}}r.nodeSize=l;var p=r.edges;r.degrees=(0,a.getDegree)(n.length,r.nodeIdxMap,p),r.getMass||(r.getMass=function(t){return t.mass||r.degrees[r.nodeIdxMap[t.id]].all||1}),r.run()}else null===(t=r.onLayoutEnd)||void 0===t||t.call(r)},e.prototype.run=function(){var t,e=this,r=e.maxIteration,n=e.nodes,o=e.workerEnabled,i=e.minMovement,a=e.animate;if(n)if(o||!a){for(var s=0;s=r&&(null===(o=e.onLayoutEnd)||void 0===o||o.call(e),window.clearInterval(e.timeInterval))}},0)}},e.prototype.reachMoveThreshold=function(t,e,r){var n=0;return t.forEach(function(t,r){var o=t.x-e[r].x,i=t.y-e[r].y;n+=Math.sqrt(o*o+i*i)}),(n/=t.length)=h)){var p=a.x-e.x,d=a.y-e.y;0===p&&0===d&&(p=.01*Math.random(),d=.01*Math.random());var y=p*p+d*d,v=Math.sqrt(y),g=(v+.1)*o,m=p/v,b=d/v,w=.5*(u(a)+u(e))*n/(g*g),S=r?r(e):1;if(t[2*c]+=m*w,t[2*c+1]+=b*w,t[2*h]-=m*w,t[2*h+1]-=b*w,i&&(l(a)+l(e))/2>v){var x=s*(u(a)+u(e))*.5/y;t[2*c]+=m*x/f,t[2*c+1]+=b*x/f,t[2*h]-=m*x/S,t[2*h+1]-=b*x/S}}})})},e.prototype.calAttractive=function(t,e){var r=this.nodeMap,n=this.nodeIdxMap,o=this.linkDistance,i=this.edgeStrength,s=this.nodeSize,u=this.getMass;e.forEach(function(e,l){var c=(0,a.getEdgeTerminal)(e,"source"),f=(0,a.getEdgeTerminal)(e,"target"),h=r[c],p=r[f],d=p.x-h.x,y=p.y-h.y;0===d&&0===y&&(d=.01*Math.random(),y=.01*Math.random());var v=Math.sqrt(d*d+y*y),g=d/v,m=y/v,b=((o(e,h,p)||1+(s(h)+s(p)||0)/2)-v)*i(e),w=n[c],S=n[f],x=u?u(h):1,_=u?u(p):1;t[2*w]-=g*b/x,t[2*w+1]-=m*b/x,t[2*S]+=g*b/_,t[2*S+1]+=m*b/_})},e.prototype.calGravity=function(t,e){for(var r=this.center,n=this.gravity,o=this.degrees,i=e.length,s=0;so.maxSpeed){var l=o.maxSpeed/u;a*=l,s*=l}e[2*n]=a,e[2*n+1]=s})},e.prototype.updatePosition=function(t,e,r){r.forEach(function(r,n){if((0,a.isNumber)(r.fx)&&(0,a.isNumber)(r.fy))return r.x=r.fx,void(r.y=r.fy);var o=t[2*n]*e,i=t[2*n+1]*e;r.x+=o,r.y+=i})},e.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){this.stop(),this.tick=null,this.nodes=null,this.edges=null,this.destroyed=!0},e.prototype.getType=function(){return"gForce"},e}(i.Base);e.GForceLayout=u},8834:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,s)}u((n=n.apply(t,e||[])).next())})},a=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]t.cells)((w=t.small())-1)*(b=t.large())>=t.cells?t.small(w-1):(b-1)*w>=t.cells&&t.large(b-1);else for(;t.cols*t.rows=t.cells?t.large(b+1):t.small(w+1)}if(t.cellWidth=s/t.cols,t.cellHeight=u/t.rows,l&&(t.cellWidth=0,t.cellHeight=0),f||h){var S=(0,i.getFuncByUnknownType)(10,h),x=(0,i.getFuncByUnknownType)(30,p,!1);d.forEach(function(e){e.x&&e.y||(e.x=0,e.y=0);var r,n,o=x(e)||30;(0,i.isArray)(o)?(r=o[0],n=o[1]):(r=o,n=o);var a=void 0!==S?S(e):c,s=r+a,u=n+a;t.cellWidth=Math.max(t.cellWidth,s),t.cellHeight=Math.max(t.cellHeight,u)})}t.cellUsed={},t.row=0,t.col=0,t.id2manPos={};for(var _=0;_=t&&(this.col=0,this.row++)},e.prototype.getPos=function(t){var e,r,n=this.begin,o=this.cellWidth,i=this.cellHeight,a=this.id2manPos[t.id];if(a)e=a.col*o+o/2+n[0],r=a.row*i+i/2+n[1];else{for(;this.used(this.row,this.col);)this.moveToNextCell();e=this.col*o+o/2+n[0],r=this.row*i+i/2+n[1],this.use(this.row,this.col),this.moveToNextCell()}t.x=e,t.y=r},e.prototype.getType=function(){return"grid"},e}(r(8933).Base);e.GridLayout=a},9390:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&("get"in o?e.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.ERLayout=e.ForceAtlas2Layout=e.ComboCombinedLayout=e.ComboForceLayout=e.GForceGPULayout=e.FruchtermanGPULayout=e.FruchtermanLayout=e.MDSLayout=e.ConcentricLayout=e.RadialLayout=e.DagreCompoundLayout=e.DagreLayout=e.CircularLayout=e.ForceLayout=e.Force2Layout=e.GForceLayout=e.RandomLayout=e.GridLayout=e.Layouts=e.Layout=void 0;var i=r(7808);Object.defineProperty(e,"GridLayout",{enumerable:!0,get:function(){return i.GridLayout}});var a=r(1783);Object.defineProperty(e,"RandomLayout",{enumerable:!0,get:function(){return a.RandomLayout}});var s=r(4600);Object.defineProperty(e,"GForceLayout",{enumerable:!0,get:function(){return s.GForceLayout}});var u=r(8944);Object.defineProperty(e,"Force2Layout",{enumerable:!0,get:function(){return u.Force2Layout}});var l=r(574);Object.defineProperty(e,"ForceLayout",{enumerable:!0,get:function(){return l.ForceLayout}});var c=r(2381);Object.defineProperty(e,"CircularLayout",{enumerable:!0,get:function(){return c.CircularLayout}});var f=r(4855);Object.defineProperty(e,"DagreLayout",{enumerable:!0,get:function(){return f.DagreLayout}});var h=r(6006);Object.defineProperty(e,"DagreCompoundLayout",{enumerable:!0,get:function(){return h.DagreCompoundLayout}});var p=r(1884);Object.defineProperty(e,"RadialLayout",{enumerable:!0,get:function(){return p.RadialLayout}});var d=r(3080);Object.defineProperty(e,"ConcentricLayout",{enumerable:!0,get:function(){return d.ConcentricLayout}});var y=r(5084);Object.defineProperty(e,"MDSLayout",{enumerable:!0,get:function(){return y.MDSLayout}});var v=r(6983);Object.defineProperty(e,"FruchtermanLayout",{enumerable:!0,get:function(){return v.FruchtermanLayout}});var g=r(8834);Object.defineProperty(e,"FruchtermanGPULayout",{enumerable:!0,get:function(){return g.FruchtermanGPULayout}});var m=r(1011);Object.defineProperty(e,"GForceGPULayout",{enumerable:!0,get:function(){return m.GForceGPULayout}});var b=r(5773);Object.defineProperty(e,"ComboForceLayout",{enumerable:!0,get:function(){return b.ComboForceLayout}});var w=r(995);Object.defineProperty(e,"ComboCombinedLayout",{enumerable:!0,get:function(){return w.ComboCombinedLayout}});var S=r(3209);Object.defineProperty(e,"ForceAtlas2Layout",{enumerable:!0,get:function(){return S.ForceAtlas2Layout}});var x=r(6244);Object.defineProperty(e,"ERLayout",{enumerable:!0,get:function(){return x.ERLayout}});var _=r(2766);Object.defineProperty(e,"Layout",{enumerable:!0,get:function(){return _.Layout}}),Object.defineProperty(e,"Layouts",{enumerable:!0,get:function(){return _.Layouts}}),o(r(6451),e)},2766:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Layouts=e.Layout=void 0;var n=r(521),o=r(7808),i=r(1783),a=r(8944),s=r(4600),u=r(574),l=r(2381),c=r(4855),f=r(1884),h=r(3080),p=r(5084),d=r(6983),y=r(8834),v=r(1011),g=r(5773),m=r(995),b=r(3209),w=r(6244),S=r(6006),x=r(864),_=function(){function t(t){var e=(0,n.getLayoutByName)(t.type);this.layoutInstance=new e(t)}return t.prototype.layout=function(t){return this.layoutInstance.layout(t)},t.prototype.updateCfg=function(t){this.layoutInstance.updateCfg(t)},t.prototype.init=function(t){this.correctLayers(t.nodes),this.layoutInstance.init(t)},t.prototype.correctLayers=function(t){if(null===t||void 0===t?void 0:t.length){var e=1/0,r=[];if(t.forEach(function(t){(0,x.isString)(t.layer)&&(t.layer=parseInt(t.layer,10)),void 0===t.layer||isNaN(t.layer)||(r.push(t),t.layern[0]?n[0]:b-n[0],x=w-n[1]>n[1]?n[1]:w-n[1];0===S&&(S=b/2),0===x&&(x=w/2);var _=x>S?S:x,E=Math.max.apply(Math,m),O=[];m.forEach(function(e,r){t.unitRadius||(t.unitRadius=_/E),O[r]=e*t.unitRadius}),t.radii=O;var P=t.eIdealDisMatrix();t.eIdealDistances=P;var k=function(t){for(var e=t.length,r=t[0].length,n=[],o=0;oM[1]?M[0]:M[1])+I(t)}:function(t){return M+I(t)}:function(t){return t.size?(0,a.isArray)(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])+I(t):(0,a.isObject)(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)+I(t):t.size+I(t):10+I(t)};var L={nodes:e,nodeSizeFunc:T,adjMatrix:y,positions:C,radii:O,height:w,width:b,strictRadial:j,focusID:d,iterations:t.maxPreventOverlapIteration||200,k:C.length/4.5},R=new l.default(L);C=R.layout()}return C.forEach(function(t,r){e[r].x=t[0]+n[0],e[r].y=t[1]+n[1]}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:r}}t.onLayoutEnd&&t.onLayoutEnd()},e.prototype.run=function(){for(var t=this.maxIteration,e=this.positions||[],r=this.weights||[],n=this.eIdealDistances||[],o=this.radii||[],i=0;i<=t;i++){var a=i/t;this.oneIteration(a,e,o,n,r)}},e.prototype.oneIteration=function(t,e,r,n,o){var i=1-t,a=this.focusIndex;e.forEach(function(s,u){var l=c(s,[0,0]),f=0===l?0:1/l;if(u!==a){var h=0,p=0,d=0;e.forEach(function(t,e){if(u!==e){var r=c(s,t),i=0===r?0:1/r,a=n[e][u];d+=o[u][e],h+=o[u][e]*(t[0]+a*(s[0]-t[0])*i),p+=o[u][e]*(t[1]+a*(s[1]-t[1])*i)}});var y=0===r[u]?0:1/r[u];d*=i,d+=t*y*y,h*=i,h+=t*y*s[0]*f,s[0]=h/d,p*=i,p+=t*y*s[1]*f,s[1]=p/d}})},e.prototype.eIdealDisMatrix=function(){var t=this,e=t.nodes;if(!e)return[];var r=t.distances,n=t.linkDistance,o=t.radii||[],i=t.unitRadius||50,s=[];return r&&r.forEach(function(r,u){var l=[];r.forEach(function(r,s){if(u===s)l.push(0);else if(o[u]===o[s])if("data"===t.sortBy)l.push(r*(Math.abs(u-s)*t.sortStrength)/(o[u]/i));else if(t.sortBy){var c=e[u][t.sortBy]||0,f=e[s][t.sortBy]||0;(0,a.isString)(c)&&(c=c.charCodeAt(0)),(0,a.isString)(f)&&(f=f.charCodeAt(0)),l.push(r*(Math.abs(c-f)*t.sortStrength)/(o[u]/i))}else l.push(r*n/(o[u]/i));else{var h=(n+i)/2;l.push(r*h)}}),s.push(l)}),s},e.prototype.handleInfinity=function(t,e,r){for(var n=t.length,o=0;or?t[e][n]:r);return r},e.prototype.getType=function(){return"radial"},e}(s.Base);e.RadialLayout=f},9088:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.disp=[],this.positions=t.positions,this.adjMatrix=t.adjMatrix,this.focusID=t.focusID,this.radii=t.radii,this.iterations=t.iterations||10,this.height=t.height||10,this.width=t.width||10,this.speed=t.speed||100,this.gravity=t.gravity||10,this.nodeSizeFunc=t.nodeSizeFunc,this.k=t.k||5,this.strictRadial=t.strictRadial,this.nodes=t.nodes}return t.prototype.layout=function(){var t=this.positions,e=[],r=this.iterations,n=this.width/10;this.maxDisplace=n,this.disp=e;for(var o=0;ou?1:-1;l=.01*h,c=.01*h}if(fMath.PI/2&&(c-=Math.PI/2,s*=-1,u*=-1);var f=Math.cos(c)*l;e.x=s*f,e.y=u*f});var a=this.radii;t.forEach(function(s,u){if(u!==o){var l=Math.sqrt(e[u].x*e[u].x+e[u].y*e[u].y);if(l>0&&u!==o){var c=Math.min(i*(r/800),l);if(s[0]+=e[u].x/l*c,s[1]+=e[u].y/l*c,n){var f=s[0]-t[o][0],h=s[1]-t[o][1],p=Math.sqrt(f*f+h*h);f=f/p*a[u],h=h/p*a[u],s[0]=t[o][0]+f,s[1]=t[o][1]+h}}}})},t}();e.default=r},1783:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.RandomLayout=void 0;var i=function(t){function e(e){var r=t.call(this)||this;return r.center=[0,0],r.width=300,r.height=300,r.nodes=[],r.edges=[],r.onLayoutEnd=function(){},r.updateCfg(e),r}return o(e,t),e.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},e.prototype.execute=function(){var t=this,e=t.nodes,r=t.center;return t.width||"undefined"==typeof window||(t.width=window.innerWidth),t.height||"undefined"==typeof window||(t.height=window.innerHeight),e&&e.forEach(function(e){e.x=.9*(Math.random()-.5)*t.width+r[0],e.y=.9*(Math.random()-.5)*t.height+r[1]}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:this.edges}},e.prototype.getType=function(){return"random"},e}(r(8933).Base);e.RandomLayout=i},6451:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},521:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.getLayoutByName=e.unRegisterLayout=e.registerLayout=void 0;var i=r(8933),a=r(864),s=new Map;e.registerLayout=function(t,e){if(s.get(t)&&console.warn("The layout with the name ".concat(t," exists already, it will be overridden")),(0,a.isObject)(e)){var r=function(t){function r(r){var n,o,i=n=t.call(this)||this,a={},s=Object.assign({},i.getDefaultCfg(),(null===(o=e.getDefaultCfg)||void 0===o?void 0:o.call(e))||{});return Object.assign(a,s,e,r),Object.keys(a).forEach(function(t){var e=a[t];i[t]=e}),n}return o(r,t),r}(i.Base);s.set(t,r)}else s.set(t,e);return s.get(t)};e.unRegisterLayout=function(t){s.has(t)&&s.delete(t)};e.getLayoutByName=function(t){return s.has(t)?s.get(t):null}},1049:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isArray=void 0,e.isArray=Array.isArray},8514:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getFuncByUnknownType=e.getFunc=e.isFunction=void 0;var n=r(864),o=r(9759);e.isFunction=function(t){return"function"==typeof t};e.getFunc=function(t,e,r){return r||((0,o.isNumber)(t)?function(){return t}:function(){return e})};e.getFuncByUnknownType=function(t,r,i){return void 0===i&&(i=!0),r||0===r?(0,e.isFunction)(r)?r:(0,o.isNumber)(r)?function(){return r}:(0,n.isArray)(r)?function(){if(i){var e=Math.max.apply(Math,r);return isNaN(e)?t:e}return r}:(0,n.isObject)(r)?function(){if(i){var e=Math.max(r.width,r.height);return isNaN(e)?t:e}return[r.width,r.height]}:function(){return t}:function(e){return e.size?(0,n.isArray)(e.size)?e.size[0]>e.size[1]?e.size[0]:e.size[1]:(0,n.isObject)(e.size)?e.size.width>e.size.height?e.size.width:e.size.height:e.size:t}}},2590:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.arrayToTextureData=e.attributesToTextureData=e.buildTextureDataWithTwoEdgeAttr=e.buildTextureData=e.proccessToFunc=void 0;var n=r(864),o=r(6268);e.proccessToFunc=function(t,e){return t?(0,n.isNumber)(t)?function(){return t}:t:function(){return e||1}};e.buildTextureData=function(t,e){var r=[],n=[],i={},a=0;for(a=0;ae[n][i]+e[i][o]&&(e[n][o]=e[n][i]+e[i][o]);return e};e.getAdjMatrix=function(t,r){var n=t.nodes,o=t.edges,i=[],a={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(t,e){a[t.id]=e,i.push([])}),null===o||void 0===o||o.forEach(function(t){var n=(0,e.getEdgeTerminal)(t,"source"),o=(0,e.getEdgeTerminal)(t,"target"),s=a[n],u=a[o];void 0!==s&&void 0!==u&&(i[s][u]=1,r||(i[u][s]=1))}),i};e.scaleMatrix=function(t,e){var r=[];return t.forEach(function(t){var n=[];t.forEach(function(t){n.push(t*e)}),r.push(n)}),r};e.traverseTreeUp=function(t,e){"function"==typeof e&&function t(e,r){if(e&&e.children)for(var n=e.children.length-1;n>=0;n--)if(!t(e.children[n],r))return;return!!r(e)}(t,e)};e.getLayoutBBox=function(t){var e=1/0,r=1/0,i=-1/0,a=-1/0;return t.forEach(function(t){var s=t.size;(0,n.isArray)(s)?1===s.length&&(s=[s[0],s[0]]):(0,o.isNumber)(s)?s=[s,s]:(void 0===s||isNaN(s))&&(s=[30,30]);var u=[s[0]/2,s[1]/2],l=t.x-u[0],c=t.x+u[0],f=t.y-u[1],h=t.y+u[1];e>l&&(e=l),r>f&&(r=f),io&&(n=r,a(1),++e),r[t]=i}function a(t){e=0,r=Object.create(null),t||(n=Object.create(null))}return a(),{clear:a,has:function(t){return void 0!==r[t]||void 0!==n[t]},get:function(t){var e=r[t];return void 0!==e?e:void 0!==(e=n[t])?(i(t,e),e):void 0},set:function(t,e){void 0!==r[t]?r[t]=e:i(t,e)}}}(r),n},l=/rgba?\(([\s.,0-9]+)\)/;var c=u(function(t){if("#"===t[0]&&7===t.length)return t;var e;s||((e=document.createElement("i")).title="Web Colour Picker",e.style.display="none",document.body.appendChild(e),s=e),s.style.color=t;var r=document.defaultView.getComputedStyle(s,"").getPropertyValue("color");return r=i(l.exec(r)[1].split(/\s*,\s*/).map(function(t){return Number(t)}))},function(t){return t},256);function f(t,e,r,n){return t[n]+(e[n]-t[n])*r}function h(t){var e=("string"==typeof t?t.split("-"):t).map(function(t){return n(-1===t.indexOf("#")?c(t):t)});return function(t){return function(t,e){var r=isNaN(Number(e))||e<0?0:e>1?1:Number(e),n=t.length-1,o=Math.floor(n*r),a=n*r-o,s=t[o],u=o===n?s:t[o+1];return i([f(s,u,a,0),f(s,u,a,1),f(s,u,a,2)])}(e,t)}}var p=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,d=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,y=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function v(t){if(/^[r,R,L,l]{1}[\s]*\(/.test(t)){var e,r=void 0;if("l"===t[0]){var n=+(o=p.exec(t))[1]+90;r=o[2],e="linear-gradient("+n+"deg, "}else if("r"===t[0]){var o;e="radial-gradient(",r=(o=d.exec(t))[4]}var i=r.match(y);return i.forEach(function(t,r){var n=t.split(":");e+=n[1]+" "+100*Number(n[0])+"%",r!==i.length-1&&(e+=", ")}),e+=")"}return t}var g=r(9019);function m(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return g.fromRotation(n,r),g.multiply(t,n,e)}function b(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return g.fromScaling(n,r),g.multiply(t,n,e)}function w(t,e,r){return g.multiply(t,r,e)}function S(t,e){for(var r,n,o,i,a=t?[].concat(t):[1,0,0,0,1,0,0,0,1],s=0,u=e.length;s=0;return r?o?2*Math.PI-n:n:o?n:2*Math.PI-n}function O(t,e,r){return r?(t[0]=e[1],t[1]=-1*e[0]):(t[0]=-1*e[1],t[1]=e[0]),t}function P(t,e){return void 0===e&&(e="off"),function(t,e){if("off"===e)return[].concat(t);var r="number"==typeof e&&e>=1?Math.pow(10,e):1;return t.map(function(t){var n=t.slice(1).map(Number).map(function(t){return e?Math.round(t*r)/r:Math.round(t)});return[t[0]].concat(n)})}(t,e).map(function(t){return t[0]+t.slice(1).join(" ")}).join("")}var k=r(1635),C={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function T(t,e,r){if(t[r].length>7){t[r].shift();for(var n=t[r],o=r;n.length;)e[r]="A",t.splice(o+=1,0,["C"].concat(n.splice(0,6)));t.splice(r,1)}}var A={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function M(t){return Array.isArray(t)&&t.every(function(t){var e=t[0].toLowerCase();return A[e]===t.length-1&&"achlmqstvz".includes(e)})}function j(t){return M(t)&&t.every(function(t){var e=t[0];return e===e.toUpperCase()})}function I(t){return j(t)&&t.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}function N(t){for(var e=t.pathValue[t.segmentStart],r=e.toLowerCase(),n=t.data;n.length>=A[r]&&("m"===r&&n.length>2?(t.segments.push([e].concat(n.splice(0,2))),r="l",e="m"===e?"l":"L"):t.segments.push([e].concat(n.splice(0,A[r]))),A[r]););}function L(t){var e=t.index,r=t.pathValue,n=r.charCodeAt(e);return 48===n?(t.param=0,void(t.index+=1)):49===n?(t.param=1,void(t.index+=1)):void(t.err='[path-util]: invalid Arc flag "'+r[e]+'", expecting 0 or 1 at index '+e)}function R(t){return t>=48&&t<=57||43===t||45===t||46===t}function D(t){return t>=48&&t<=57}function B(t){var e,r=t.max,n=t.pathValue,o=t.index,i=o,a=!1,s=!1,u=!1,l=!1;if(i>=r)t.err="[path-util]: Invalid path value at index "+i+', "pathValue" is missing param';else if(43!==(e=n.charCodeAt(i))&&45!==e||(i+=1,e=n.charCodeAt(i)),D(e)||46===e){if(46!==e){if(a=48===e,i+=1,e=n.charCodeAt(i),a&&i=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function G(t){var e=t.max,r=t.pathValue,n=t.index,o=r.charCodeAt(n),i=A[r[n].toLowerCase()];if(t.segmentStart=n,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(o))if(t.index+=1,F(t),t.data=[],i){for(;;){for(var a=i;a>0;a-=1){if(97!=(32|o)||3!==a&&4!==a?B(t):L(t),t.err.length)return;t.data.push(t.param),F(t),t.index=t.max)break;if(!R(r.charCodeAt(t.index)))break}N(t)}else N(t);else t.err='[path-util]: Invalid path value "'+r[n]+'" is not a path command'}var U=function(){return function(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}}();function z(t){if(M(t))return[].concat(t);var e=new U(t);for(F(e);e.index1&&(g*=P=Math.sqrt(P),m*=P);var k=g*g,C=m*m,T=(i===a?-1:1)*Math.sqrt(Math.abs((k*C-k*O*O-C*E*E)/(k*O*O+C*E*E)));p=T*g*O/m+(y+b)/2,d=T*-m*E/g+(v+w)/2,f=Math.asin(((v-d)/m*Math.pow(10,9)>>0)/Math.pow(10,9)),h=Math.asin(((w-d)/m*Math.pow(10,9)>>0)/Math.pow(10,9)),f=yh&&(f-=2*Math.PI),!a&&h>f&&(h-=2*Math.PI)}var A=h-f;if(Math.abs(A)>S){var M=h,j=b,I=w;h=f+S*(a&&h>f?1:-1),_=Y(b=p+g*Math.cos(h),w=d+m*Math.sin(h),g,m,o,0,a,j,I,[h,M,p,d])}A=h-f;var N=Math.cos(f),L=Math.sin(f),R=Math.cos(h),D=Math.sin(h),B=Math.tan(A/4),F=4/3*g*B,G=4/3*m*B,U=[y,v],z=[y+F*L,v-G*N],V=[b+F*D,w-G*R],H=[b,w];if(z[0]=2*U[0]-z[0],z[1]=2*U[1]-z[1],l)return z.concat(V,H,_);for(var q=[],X=0,J=(_=z.concat(V,H,_)).length;X=i)a={x:r,y:n};else{var s=X([t,e],[r,n],o/i);a={x:s[0],y:s[1]}}return{length:i,point:a,min:{x:Math.min(t,r),y:Math.min(e,n)},max:{x:Math.max(t,r),y:Math.max(e,n)}}}function nt(t,e){var r=t.x,n=t.y,o=e.x,i=e.y,a=r*o+n*i,s=Math.sqrt((Math.pow(r,2)+Math.pow(n,2))*(Math.pow(o,2)+Math.pow(i,2)));return(r*i-n*o<0?-1:1)*Math.acos(a/s)}function ot(t,e,r,n,o,i,a,s,u,l){var c=Math.abs,f=Math.sin,h=Math.cos,p=Math.sqrt,d=Math.PI,y=c(r),v=c(n),g=(o%360+360)%360*(d/180);if(t===s&&e===u)return{x:t,y:e};if(0===y||0===v)return rt(t,e,s,u,l).point;var m=(t-s)/2,b=(e-u)/2,w={x:h(g)*m+f(g)*b,y:-f(g)*m+h(g)*b},S=Math.pow(w.x,2)/Math.pow(y,2)+Math.pow(w.y,2)/Math.pow(v,2);S>1&&(y*=p(S),v*=p(S));var x=(Math.pow(y,2)*Math.pow(v,2)-Math.pow(y,2)*Math.pow(w.y,2)-Math.pow(v,2)*Math.pow(w.x,2))/(Math.pow(y,2)*Math.pow(w.y,2)+Math.pow(v,2)*Math.pow(w.x,2));x=x<0?0:x;var _=(i!==a?1:-1)*p(x),E=_*(y*w.y/v),O=_*(-v*w.x/y),P=h(g)*E-f(g)*O+(t+s)/2,k=f(g)*E+h(g)*O+(e+u)/2,C={x:(w.x-E)/y,y:(w.y-O)/v},T=nt({x:1,y:0},C),A=nt(C,{x:(-w.x-E)/y,y:(-w.y-O)/v});!a&&A>0?A-=2*d:a&&A<0&&(A+=2*d);var M=T+(A%=2*d)*l,j=y*h(M),I=v*f(M);return{x:h(g)*j-f(g)*I+P,y:f(g)*j+h(g)*I+k}}function it(t,e,r,n,o,i,a,s,u,l,c){var f,h=c.bbox,p=void 0===h||h,d=c.length,y=void 0===d||d,v=c.sampleSize,g=void 0===v?30:v,m="number"==typeof l,b=t,w=e,S=0,x=[b,w,S],_=[b,w],E={x:0,y:0},O=[{x:b,y:w}];m&&l<=0&&(E={x:b,y:w});for(var P=0;P<=g;P+=1){if(b=(f=ot(t,e,r,n,o,i,a,s,u,P/g)).x,w=f.y,p&&O.push({x:b,y:w}),y&&(S+=et(_,[b,w])),_=[b,w],m&&S>=l&&l>x[2]){var k=(S-l)/(S-x[2]);E={x:_[0]*(1-k)+x[0]*k,y:_[1]*(1-k)+x[1]*k}}x=[b,w,S]}return m&&l>=S&&(E={x:s,y:u}),{length:S,point:E,min:{x:Math.min.apply(null,O.map(function(t){return t.x})),y:Math.min.apply(null,O.map(function(t){return t.y}))},max:{x:Math.max.apply(null,O.map(function(t){return t.x})),y:Math.max.apply(null,O.map(function(t){return t.y}))}}}function at(t,e,r,n,o,i,a,s,u){var l=1-u;return{x:Math.pow(l,3)*t+3*Math.pow(l,2)*u*r+3*l*Math.pow(u,2)*o+Math.pow(u,3)*a,y:Math.pow(l,3)*e+3*Math.pow(l,2)*u*n+3*l*Math.pow(u,2)*i+Math.pow(u,3)*s}}function st(t,e,r,n,o,i,a,s,u,l){var c,f=l.bbox,h=void 0===f||f,p=l.length,d=void 0===p||p,y=l.sampleSize,v=void 0===y?10:y,g="number"==typeof u,m=t,b=e,w=0,S=[m,b,w],x=[m,b],_={x:0,y:0},E=[{x:m,y:b}];g&&u<=0&&(_={x:m,y:b});for(var O=0;O<=v;O+=1){if(m=(c=at(t,e,r,n,o,i,a,s,O/v)).x,b=c.y,h&&E.push({x:m,y:b}),d&&(w+=et(x,[m,b])),x=[m,b],g&&w>=u&&u>S[2]){var P=(w-u)/(w-S[2]);_={x:x[0]*(1-P)+S[0]*P,y:x[1]*(1-P)+S[1]*P}}S=[m,b,w]}return g&&u>=w&&(_={x:a,y:s}),{length:w,point:_,min:{x:Math.min.apply(null,E.map(function(t){return t.x})),y:Math.min.apply(null,E.map(function(t){return t.y}))},max:{x:Math.max.apply(null,E.map(function(t){return t.x})),y:Math.max.apply(null,E.map(function(t){return t.y}))}}}function ut(t,e,r,n,o,i,a){var s=1-a;return{x:Math.pow(s,2)*t+2*s*a*r+Math.pow(a,2)*o,y:Math.pow(s,2)*e+2*s*a*n+Math.pow(a,2)*i}}function lt(t,e,r,n,o,i,a,s){var u,l=s.bbox,c=void 0===l||l,f=s.length,h=void 0===f||f,p=s.sampleSize,d=void 0===p?10:p,y="number"==typeof a,v=t,g=e,m=0,b=[v,g,m],w=[v,g],S={x:0,y:0},x=[{x:v,y:g}];y&&a<=0&&(S={x:v,y:g});for(var _=0;_<=d;_+=1){if(v=(u=ut(t,e,r,n,o,i,_/d)).x,g=u.y,c&&x.push({x:v,y:g}),h&&(m+=et(w,[v,g])),w=[v,g],y&&m>=a&&a>b[2]){var E=(m-a)/(m-b[2]);S={x:w[0]*(1-E)+b[0]*E,y:w[1]*(1-E)+b[1]*E}}b=[v,g,m]}return y&&a>=m&&(S={x:o,y:i}),{length:m,point:S,min:{x:Math.min.apply(null,x.map(function(t){return t.x})),y:Math.min.apply(null,x.map(function(t){return t.y}))},max:{x:Math.max.apply(null,x.map(function(t){return t.x})),y:Math.max.apply(null,x.map(function(t){return t.y}))}}}function ct(t,e,r){for(var n,o,i,a,s,u,l,c,f,h=q(t),p="number"==typeof e,d=[],y=0,v=0,g=0,m=0,b=[],w=[],S=0,x={x:0,y:0},_=x,E=x,O=x,P=0,k=0,C=h.length;k=e&&(O=E),w.push(_),b.push(x),P+=S,y=(u="Z"!==c?f.slice(-2):[g,m])[0],v=u[1];return p&&e>=P&&(O={x:y,y:v}),{length:P,point:O,min:{x:Math.min.apply(null,b.map(function(t){return t.x})),y:Math.min.apply(null,b.map(function(t){return t.y}))},max:{x:Math.max.apply(null,w.map(function(t){return t.x})),y:Math.max.apply(null,w.map(function(t){return t.y}))}}}function ft(t,e){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var r=ct(t,void 0,(0,k.__assign)((0,k.__assign)({},e),{length:!1})),n=r.min,o=n.x,i=n.y,a=r.max,s=a.x,u=a.y,l=s-o,c=u-i;return{width:l,height:c,x:o,y:i,x2:s,y2:u,cx:o+l/2,cy:i+c/2,cz:Math.max(l,c)+Math.min(l,c)/2}}function ht(t,e){return ct(t,void 0,(0,k.__assign)((0,k.__assign)({},e),{bbox:!1,length:!0})).length}function pt(t,e){if(!t)return{length:0,x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var r=ct(t,void 0,(0,k.__assign)((0,k.__assign)({},e),{bbox:!0,length:!0})),n=r.length,o=r.min,i=o.x,a=o.y,s=r.max,u=s.x,l=s.y,c=u-i,f=l-a;return{length:n,width:c,height:f,x:i,y:a,x2:u,y2:l,cx:i+c/2,cy:a+f/2,cz:Math.max(c,f)+Math.min(c,f)/2}}function dt(t,e){var r=t.length-1,n=[],o=0,i=function(t){var e=t.length,r=e-1;return t.map(function(n,o){return t.map(function(n,i){var a,s=o+i;return 0===i||t[s]&&"M"===t[s][0]?(a=t[s],["M"].concat(a.slice(-2))):(s>=e&&(s-=r),t[s])})})}(t);return i.forEach(function(i,a){t.slice(1).forEach(function(n,i){o+=et(t[(a+i)%r].slice(-2),e[i%r].slice(-2))}),n[a]=o,o=0}),i[n.indexOf(Math.min.apply(null,n))]}function yt(t){var e=0,r=0,n=0;return Q(t).map(function(t){var o;switch(t[0]){case"M":return e=t[1],r=t[2],0;default:var i=t.slice(1),a=i[0],s=i[1],u=i[2],l=i[3],c=i[4],f=i[5];return n=function(t,e,r,n,o,i,a,s){return 3*((s-e)*(r+o)-(a-t)*(n+i)+n*(t-o)-r*(e-i)+s*(o+t/3)-a*(i+e/3))/20}(e,r,a,s,u,l,c,f),o=t.slice(-2),e=o[0],r=o[1],n}}).reduce(function(t,e){return t+e},0)}function vt(t){return yt(t)>=0}function gt(t,e,r){return ct(t,e,(0,k.__assign)((0,k.__assign)({},r),{bbox:!1,length:!0})).point}function mt(t,e){for(var r,n,o,i,a=z(t),s=q(a),u=ht(a),l=function(t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},c=8,f=0,h=0,p=1/0,d=0;d<=u;d+=c)(f=l(r=gt(s,d))).5;)g=l(o=gt(s,y=h-c)),m=l(i=gt(s,v=h+c)),y>=0&&g=o)return s=o-(a=ht(n=r.slice(0,-1))),{segment:r[i],index:i,length:s,lengthAtSegment:a};for(var f=[];i>0;)u=n[i],s=o-(a=ht(n=n.slice(0,-1))),o=a,f.push({segment:u,index:i,length:s,lengthAtSegment:a}),i-=1;return f.find(function(t){return t.lengthAtSegment<=e})}(a,h);return{closest:n,distance:Math.sqrt(p),segment:b}}function bt(t,e){var r=mt(t,e).distance;return Math.abs(r)<.001}function wt(t){return t.map(function(t,e,r){var n=e&&r[e-1].slice(-2).concat(t.slice(1)),o=e?st(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],{bbox:!1}).length:0;return{s:t,ss:e?o?function(t,e){void 0===e&&(e=.5);var r=t.slice(0,2),n=t.slice(2,4),o=t.slice(4,6),i=t.slice(6,8),a=X(r,n,e),s=X(n,o,e),u=X(o,i,e),l=X(a,s,e),c=X(s,u,e),f=X(l,c,e);return[["C"].concat(a,l,f),["C"].concat(c,u,i)]}(n):[t,t]:[t],l:o}})}function St(t,e,r){var n=wt(t),o=wt(e),i=n.length,a=o.length,s=n.filter(function(t){return t.l}).length,u=o.filter(function(t){return t.l}).length,l=n.filter(function(t){return t.l}).reduce(function(t,e){return t+e.l},0)/s||0,c=o.filter(function(t){return t.l}).reduce(function(t,e){return t+e.l},0)/u||0,f=r||Math.max(i,a),h=[l,c],p=[f-i,f-a],d=0,y=[n,o].map(function(t,e){return t.l===f?t.map(function(t){return t.s}):t.map(function(t,r){return d=r&&p[e]&&t.l>=h[e],p[e]-=d?1:0,d?t.ss:[t.s]}).flat()});return y[0].length===y[1].length?y:St(y[0],y[1],f)}var xt=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},_t=function(t,e){return!!xt(t)&&t.indexOf(e)>-1},Et=function(t,e){if(!xt(t))return t;for(var r=[],n=0;n-1;)Yt.call(t,i,1);return t},Kt=Array.prototype.splice,Qt=function(t,e){if(!xt(t))return[];for(var r=t?e.length:0,n=r-1;r--;){var o=void 0,i=e[r];r!==n&&i===o||(o=i,Kt.call(t,i,1))}return t},Zt=function(t,e,r){if(!Tt(t)&&!Dt(t))return t;var n=r;return jt(t,function(t,r){n=e(n,t,r)}),n},$t=function(t,e){var r=[];if(!xt(t))return r;for(var n=-1,o=[],i=t.length;++ne[o])return 1;if(t[o]r?r:t},Se=function(t,e){var r=e.toString(),n=r.indexOf(".");if(-1===n)return Math.round(t);var o=r.substr(n+1).length;return o>20&&(o=20),parseFloat(t.toFixed(o))},xe=function(t){return Ct(t,"Number")},_e=function(t){return xe(t)&&t%1!=0},Ee=function(t){return xe(t)&&t%2==0},Oe=Number.isInteger?Number.isInteger:function(t){return xe(t)&&t%1==0},Pe=function(t){return xe(t)&&t<0},ke=1e-5;function Ce(t,e,r){return void 0===r&&(r=ke),Math.abs(t-e)0},Me=function(t,e){if(Tt(t)){for(var r,n=-1/0,o=0;on&&(r=i,n=s)}return r}},je=function(t,e){if(Tt(t)){for(var r,n=1/0,o=0;oe?(n&&(clearTimeout(n),n=null),s=l,a=t.apply(o,i),n||(o=i=null)):n||!1===r.trailing||(n=setTimeout(u,c)),a};return l.cancel=function(){clearTimeout(n),s=0,n=o=i=null},l},Rr=function(t){return xt(t)?Array.prototype.slice.call(t):[]},Dr={},Br=function(t){return Dr[t=t||"g"]?Dr[t]+=1:Dr[t]=1,t+Dr[t]},Fr=function(){},Gr=function(t){return t};function Ur(t){return Pt(t)?0:xt(t)?t.length:Object.keys(t).length}var zr=function(){function t(){this.map={}}return t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,e){var r=this.map[t];return void 0===r?e:r},t.prototype.set=function(t,e){this.map[t]=e},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length},t}(),Vr=1e-6;function Hr(t){return Math.abs(t)0!=Hr(s[1]-r)>0&&Hr(e-(r-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])<0&&(n=!n)}return n}var Yr=function(t,e,r){return t>=e&&t<=r};function Xr(t){for(var e=[],r=t.length,n=0;n1){var a=t[0],s=t[r-1];e.push({from:{x:s[0],y:s[1]},to:{x:a[0],y:a[1]}})}return e}function Jr(t,e){var r=!1;return t.forEach(function(t){if(function(t,e,r,n){var o=r.x-t.x,i=r.y-t.y,a=e.x-t.x,s=e.y-t.y,u=n.x-r.x,l=n.y-r.y,c=a*l-s*u,f=null;if(c*c>.001*(a*a+s*s)*(u*u+l*l)){var h=(o*l-i*u)/c,p=(o*s-i*a)/c;Yr(h,0,1)&&Yr(p,0,1)&&(f={x:t.x+h*a,y:t.y+h*s})}return f}(t.from,t.to,e.from,e.to))return r=!0,!1}),r}function Kr(t){var e=t.map(function(t){return t[0]}),r=t.map(function(t){return t[1]});return{minX:Math.min.apply(null,e),maxX:Math.max.apply(null,e),minY:Math.min.apply(null,r),maxY:Math.max.apply(null,r)}}function Qr(t,e){if(t.length<2||e.length<2)return!1;var r,n,o=Kr(t),i=Kr(e);if(r=o,(n=i).minX>r.maxX||n.maxXr.maxY||n.maxY1&&void 0!==arguments[1]?arguments[1]:{};if(!o(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!o(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!o(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,i=e.toIndex,a=void 0===i?t.length:i;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>t.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[n],u=n+1;u1&&void 0!==arguments[1]?arguments[1]:{};if(!o(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,i=e.toIndex,a=void 0===i?t.length:i;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>t.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[n],u=n+1;us&&(s=t[u]);return s}(t);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=r.min,s=void 0===a?r.autoMinMax?n:0:a,u=r.max,l=void 0===u?r.autoMinMax?i:1:u;if(s>=l)throw new RangeError("min option must be smaller than max option");for(var c=(l-s)/(i-n),f=0;f1&&void 0!==arguments[1]?arguments[1]:{},r=e.maxRows,n=void 0===r?15:r,o=e.maxColumns,i=void 0===o?10:o,u=e.maxNumSize,c=void 0===u?8:u;return"".concat(t.constructor.name," {\n").concat(a,"[\n").concat(s).concat(function(t,e,r,n){for(var o=t.rows,i=t.columns,a=Math.min(o,e),u=Math.min(i,r),c=[],f=0;fn)throw new RangeError("Row index out of range")}function h(t,e,r){var n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function p(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function d(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function y(t,e,r){return{row:v(t,e),column:g(t,r)}}function v(t,e){if("object"!==c(e))throw new TypeError("unexpected type for row indices");if(e.some(function(e){return e<0||e>=t.rows}))throw new RangeError("row indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function g(t,e){if("object"!==c(e))throw new TypeError("unexpected type for column indices");if(e.some(function(e){return e<0||e>=t.columns}))throw new RangeError("column indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function m(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(w("startRow",e),w("endRow",r),w("startColumn",n),w("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function b(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=0;nr?(o=!0,r=e):(n=!1,o=!0);t++}return n}},{key:"isReducedEchelonForm",value:function(){for(var t=0,e=0,r=-1,n=!0,o=!1;tr?(o=!0,r=e):(n=!1,o=!0);for(var i=e+1;it.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);for(var i=t.get(e,r),a=r;a=0;)if(0===t.maxRow(n))n--;else{for(var o=0,i=!1;o0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==P(t))throw new TypeError("options must be an object");var e=t.rows,r=void 0===e?1:e,n=t.columns,o=void 0===n?1:n;if(!Number.isInteger(r)||r<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(o)||o<=0)throw new TypeError("columns must be a positive integer");for(var i=new I(this.rows*r,this.columns*o),a=0;at&&(t=this.get(e,r));return t}},{key:"maxIndex",value:function(){for(var t=this.get(0,0),e=[0,0],r=0;rt&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}},{key:"min",value:function(){for(var t=this.get(0,0),e=0;ee&&(e=this.get(t,r));return e}},{key:"maxRowIndex",value:function(t){f(this,t);for(var e=this.get(t,0),r=[t,0],n=1;ne&&(e=this.get(t,n),r[1]=n);return r}},{key:"minRow",value:function(t){f(this,t);for(var e=this.get(t,0),r=1;re&&(e=this.get(r,t));return e}},{key:"maxColumnIndex",value:function(t){h(this,t);for(var e=this.get(0,t),r=[0,t],n=1;ne&&(e=this.get(n,t),r[0]=n);return r}},{key:"minColumn",value:function(t){h(this,t);for(var e=this.get(0,t),r=1;r0&&void 0!==arguments[0]?arguments[0]:"frobenius",e=0;if("max"===t)return this.max();if("frobenius"===t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==P(t))throw new TypeError("options must be an object");var e=t.min,r=void 0===e?0:e,n=t.max,o=void 0===n?1:n;if(!Number.isFinite(r))throw new TypeError("min must be a number");if(!Number.isFinite(o))throw new TypeError("max must be a number");if(r>=o)throw new RangeError("min must be smaller than max");for(var a=new I(this.rows,this.columns),s=0;s0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==P(t))throw new TypeError("options must be an object");var e=t.min,r=void 0===e?0:e,n=t.max,o=void 0===n?1:n;if(!Number.isFinite(r))throw new TypeError("min must be a number");if(!Number.isFinite(o))throw new TypeError("max must be a number");if(r>=o)throw new RangeError("min must be smaller than max");for(var a=new I(this.rows,this.columns),s=0;s0&&void 0!==arguments[0]?arguments[0]:j,e=0;e0&&void 0!==arguments[0]?arguments[0]:j,e=0;er||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");for(var n=new I(t.length,r-e+1),o=0;o=this.rows)throw new RangeError("Row index out of range: ".concat(t[o]));n.set(o,i-e,this.get(t[o],i))}return n}},{key:"subMatrixColumn",value:function(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");for(var n=new I(r-e+1,t.length),o=0;o=this.columns)throw new RangeError("Column index out of range: ".concat(t[o]));n.set(i-e,o,this.get(i,t[o]))}return n}},{key:"setSubMatrix",value:function(t,e,r){m(this,e,e+(t=I.checkMatrix(t)).rows-1,r,r+t.columns-1);for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if("object"===P(t)&&(e=t,t=void 0),"object"!==P(e))throw new TypeError("options must be an object");var r=e,n=r.unbiased,o=void 0===n||n,i=r.mean,a=void 0===i?this.mean(t):i;if("boolean"!=typeof o)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!Array.isArray(a))throw new TypeError("mean must be an array");return function(t,e,r){for(var n=t.rows,o=t.columns,i=[],a=0;a1&&void 0!==arguments[1]?arguments[1]:{};if("object"===P(t)&&(e=t,t=void 0),"object"!==P(e))throw new TypeError("options must be an object");var r=e.center,n=void 0===r?this.mean(t):r;switch(t){case"row":if(!Array.isArray(n))throw new TypeError("center must be an array");return function(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{};if("object"===P(t)&&(e=t,t=void 0),"object"!==P(e))throw new TypeError("options must be an object");var r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){for(var e=[],r=0;r2&&void 0!==arguments[2]?arguments[2]:{};if("object"!==P(r))throw new TypeError("options must be an object");for(var n=r.random,o=void 0===n?Math.random:n,i=new I(t,e),a=0;a2&&void 0!==arguments[2]?arguments[2]:{};if("object"!==P(r))throw new TypeError("options must be an object");var n=r.min,o=void 0===n?0:n,i=r.max,a=void 0===i?1e3:i,s=r.random,u=void 0===s?Math.random:s;if(!Number.isInteger(o))throw new TypeError("min must be an integer");if(!Number.isInteger(a))throw new TypeError("max must be an integer");if(o>=a)throw new RangeError("min must be smaller than max");for(var l=a-o,c=new I(t,e),f=0;f0){if(n.data=[],!(Number.isInteger(r)&&r>0))throw new TypeError("nColumns must be a positive integer");for(var o=0;o>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r>t.get(r,n));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(var e=0;e>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r>>t.get(r,n));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=n.rows,i=void 0===o?1:o;if(t.length%i!=0)throw new Error("the data length is not divisible by the number of rows");return(r=$t(this,e)).rows=i,r.columns=t.length/i,r.data=t,r}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ee(t,e)}(e,M),r=e,(n=[{key:"set",value:function(t,e,r){var n=this._calculateIndex(t,e);return this.data[n]=r,this}},{key:"get",value:function(t,e){var r=this._calculateIndex(t,e);return this.data[r]}},{key:"_calculateIndex",value:function(t,e){return t*this.columns+e}}])&&Qt(r.prototype,n),o&&Qt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function ne(t){"@babel/helpers - typeof";return(ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oe(t,e){for(var r=0;rMath.abs(l[i])&&(i=r);if(i!==n){for(o=0;o=0;o--){for(n=0;ni?n.set(o,i,t.get(o,i)):o===i?n.set(o,i,1):n.set(o,i,0);return n}},{key:"upperTriangularMatrix",get:function(){for(var t=this.LU,e=t.rows,r=t.columns,n=new I(e,r),o=0;oMath.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}function ve(t){"@babel/helpers - typeof";return(ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ge(t,e){for(var r=0;r=0;i--){for(o=0;o=0;r--){for(t=0;t1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n,o=(e=le.checkMatrix(e)).rows,i=e.columns,a=r.computeLeftSingularVectors,s=void 0===a||a,u=r.computeRightSingularVectors,l=void 0===u||u,c=r.autoTranspose,f=void 0!==c&&c,h=Boolean(s),p=Boolean(l),d=!1;if(o=0;J--)if(0!==m[J]){for(var K=J+1;K=0;nt--){if(nt0;){var ft=void 0,ht=void 0;for(ft=W-2;ft>=-1&&-1!==ft;ft--){var pt=Number.MIN_VALUE+ct*Math.abs(m[ft]+Math.abs(m[ft+1]));if(Math.abs(S[ft])<=pt||Number.isNaN(S[ft])){S[ft]=0;break}}if(ft===W-2)ht=4;else{var dt=void 0;for(dt=W-1;dt>=ft&&dt!==ft;dt--){var yt=(dt!==W?Math.abs(S[dt]):0)+(dt!==ft+1?Math.abs(S[dt-1]):0);if(Math.abs(m[dt])<=ct*yt){m[dt]=0;break}}dt===ft?ht=3:dt===W-1?ht=1:(ht=2,ft=dt)}switch(ft++,ht){case 1:var vt=S[W-2];S[W-2]=0;for(var gt=W-2;gt>=ft;gt--){var mt=ye(m[gt],vt),bt=m[gt]/mt,wt=vt/mt;if(m[gt]=mt,gt!==ft&&(vt=-wt*S[gt-1],S[gt-1]=bt*S[gt-1]),p)for(var St=0;St=m[ft+1]);){var Wt=m[ft];if(m[ft]=m[ft+1],m[ft+1]=Wt,p&&fte&&o.set(i,a,t.get(i,a)/this.s[a]);for(var s=this.U,u=s.rows,l=s.columns,c=new I(r,u),f=0;ft&&e++;return e}},{key:"diagonal",get:function(){return Array.from(this.s)}},{key:"threshold",get:function(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}},{key:"leftSingularVectors",get:function(){return this.U}},{key:"rightSingularVectors",get:function(){return this.V}},{key:"diagonalMatrix",get:function(){return I.diag(this.s)}}])&&Se(e.prototype,r),n&&Se(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ee(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t=le.checkMatrix(t),e?new _e(t).inverse():Oe(t,I.eye(t.rows))}function Oe(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t=le.checkMatrix(t),e=le.checkMatrix(e),r?new _e(t).solve(e):t.isSquare()?new de(t).solve(e):new be(t).solve(e)}function Pe(t){var e,r,n,o,i,a;if((t=I.checkMatrix(t)).isSquare())return 2===t.columns?(e=t.get(0,0),r=t.get(0,1),n=t.get(1,0),e*t.get(1,1)-r*n):3===t.columns?(o=new Lt(t,[1,2],[1,2]),i=new Lt(t,[1,2],[0,2]),a=new Lt(t,[1,2],[0,1]),e=t.get(0,0),r=t.get(0,1),n=t.get(0,2),e*Pe(o)-r*Pe(i)+n*Pe(a)):new de(t).determinant;throw Error("determinant can only be calculated for a square matrix")}function ke(t,e){for(var r=[],n=0;n3&&void 0!==arguments[3]?arguments[3]:1e-9;if(t>(arguments.length>4&&void 0!==arguments[4]?arguments[4]:1e-9))return new Array(e.rows+1).fill(0);for(var o=e.addRow(r,[0]),i=0;i1&&void 0!==arguments[1]?arguments[1]:{},r=e.thresholdValue,n=void 0===r?1e-9:r,o=e.thresholdError,i=void 0===o?1e-9:o,a=(t=I.checkMatrix(t)).rows,s=new I(a,a),u=0;u1&&void 0!==arguments[1]?arguments[1]:Number.EPSILON;t=I.checkMatrix(t);for(var r=new _e(t,{autoTranspose:!0}),n=r.leftSingularVectors,o=r.rightSingularVectors,i=r.diagonal,a=0;ae?i[a]=1/i[a]:i[a]=0;return o.mmul(I.diag(i).mmul(n.transpose()))}function Me(t){"@babel/helpers - typeof";return(Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function je(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=new I(t);var n=!1;if("object"!==Me(e)||I.isMatrix(e)||Array.isArray(e)?e=new I(e):(r=e,e=t,n=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");var o=r.center;(void 0===o||o)&&(t=t.center("column"),n||(e=e.center("column")));for(var i=t.transpose().mmul(e),a=0;a1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=new I(t);var n=!1;if("object"!==Ie(e)||I.isMatrix(e)||Array.isArray(e)?e=new I(e):(r=e,e=t,n=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");var o=r,i=o.center,a=void 0===i||i,s=o.scale,u=void 0===s||s;a&&(t.center("column"),n||e.center("column")),u&&(t.scale("column"),n||e.scale("column"));for(var l=t.standardDeviation("column",{unbiased:!0}),c=n?l:e.standardDeviation("column",{unbiased:!0}),f=t.transpose().mmul(e),h=0;h1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=r.assumeSymmetric,o=void 0!==n&&n;if(!(e=le.checkMatrix(e)).isSquare())throw new Error("Matrix is not a square matrix");var i,a,s=e.columns,u=new I(s,s),l=new Float64Array(s),c=new Float64Array(s),f=e;if(!!o||e.isSymmetric()){for(i=0;i0;s--){for(f=0,a=0,l=0;l0&&(i=-i),e[s]=f*i,a-=o*i,r[s-1]=o-i,u=0;ul){0;do{for(1,o=r[l],f=(r[l+1]-o)/(2*e[l]),h=ye(f,1),f<0&&(h=-h),r[l]=e[l]/(f+h),r[l+1]=e[l]*(f+h),p=r[l+1],i=o-r[l],a=l+2;a=l;a--)for(v=y,y=d,b=m,o=d*e[a],i=d*f,h=ye(f,e[a]),e[a+1]=m*h,m=e[a]/h,f=(d=f/h)*r[a]-m*o,r[a+1]=i+m*(d*o+m*r[a]),u=0;ux*S)}r[l]=r[l]+w,e[l]=0}for(a=0;a=l;s--)r[s]=e.get(s,l-1)/c,a+=r[s]*r[s];for(i=Math.sqrt(a),r[l]>0&&(i=-i),a-=r[l]*i,r[l]=r[l]-i,u=l;u=l;s--)o+=r[s]*e.get(s,u);for(o/=a,s=l;s<=f;s++)e.set(s,u,e.get(s,u)-o*r[s])}for(s=0;s<=f;s++){for(o=0,u=f;u>=l;u--)o+=r[u]*e.get(s,u);for(o/=a,u=l;u<=f;u++)e.set(s,u,e.get(s,u)-o*r[u])}r[l]=c*r[l],e.set(l,l-1,c*i)}}for(s=0;s=1;l--)if(0!==e.get(l,l-1)){for(s=l+1;s<=f;s++)r[s]=e.get(s,l-1);for(u=l;u<=f;u++){for(i=0,s=l;s<=f;s++)i+=r[s]*n.get(s,u);for(i=i/r[l]/e.get(l,l-1),s=l;s<=f;s++)n.set(s,u,n.get(s,u)+i*r[s])}}}(s,h,p,u),function(t,e,r,n,o){var i,a,s,u,l,c,f,h,p,d,y,v,g,m,b,w=t-1,S=t-1,x=Number.EPSILON,_=0,E=0,O=0,P=0,k=0,C=0,T=0,A=0;for(i=0;iS)&&(r[i]=o.get(i,i),e[i]=0),a=Math.max(i-1,0);a=0;){for(u=w;u>0&&(0===(C=Math.abs(o.get(u-1,u-1))+Math.abs(o.get(u,u)))&&(C=E),!(Math.abs(o.get(u,u-1))=0){for(T=O>=0?O+T:O-T,r[w-1]=h+T,r[w]=r[w-1],0!==T&&(r[w]=h-f/T),e[w-1]=0,e[w]=0,h=o.get(w,w-1),C=Math.abs(h)+Math.abs(T),O=h/C,P=T/C,k=Math.sqrt(O*O+P*P),O/=k,P/=k,a=w-1;a0){for(C=Math.sqrt(C),p=u&&(T=o.get(l,l),O=((k=h-T)*(C=p-T)-f)/o.get(l+1,l)+o.get(l,l+1),P=o.get(l+1,l+1)-T-k-C,k=o.get(l+2,l+1),C=Math.abs(O)+Math.abs(P)+Math.abs(k),O/=C,P/=C,k/=C,l!==u)&&!(Math.abs(o.get(l,l-1))*(Math.abs(P)+Math.abs(k))l+2&&o.set(i,i-3,0);for(s=l;s<=w-1&&(m=s!==w-1,s!==l&&(O=o.get(s,s-1),P=o.get(s+1,s-1),k=m?o.get(s+2,s-1):0,0!==(h=Math.abs(O)+Math.abs(P)+Math.abs(k))&&(O/=h,P/=h,k/=h)),0!==h);s++)if(C=Math.sqrt(O*O+P*P+k*k),O<0&&(C=-C),0!==C){for(s!==l?o.set(s,s-1,-C*h):u!==l&&o.set(s,s-1,-o.get(s,s-1)),h=(O+=C)/C,p=P/C,T=k/C,P/=O,k/=O,a=s;a=0;w--)if(O=r[w],0===(P=e[w]))for(u=w,o.set(w,w,1),i=w-1;i>=0;i--){for(f=o.get(i,i)-O,k=0,a=u;a<=w;a++)k+=o.get(i,a)*o.get(a,w);if(e[i]<0)T=f,C=k;else if(u=i,0===e[i]?o.set(i,w,0!==f?-k/f:-k/(x*E)):(h=o.get(i,i+1),p=o.get(i+1,i),P=(r[i]-O)*(r[i]-O)+e[i]*e[i],c=(h*C-T*k)/P,o.set(i,w,c),o.set(i+1,w,Math.abs(h)>Math.abs(T)?(-k-f*c)/h:(-C-p*c)/T)),c=Math.abs(o.get(i,w)),x*c*c>1)for(a=i;a<=w;a++)o.set(a,w,o.get(a,w)/c)}else if(P<0)for(u=w-1,Math.abs(o.get(w,w-1))>Math.abs(o.get(w-1,w))?(o.set(w-1,w-1,P/o.get(w,w-1)),o.set(w-1,w,-(o.get(w,w)-O)/o.get(w,w-1))):(b=Fe(0,-o.get(w-1,w),o.get(w-1,w-1)-O,P),o.set(w-1,w-1,b[0]),o.set(w-1,w,b[1])),o.set(w,w-1,0),o.set(w,w,1),i=w-2;i>=0;i--){for(d=0,y=0,a=u;a<=w;a++)d+=o.get(i,a)*o.get(a,w-1),y+=o.get(i,a)*o.get(a,w);if(f=o.get(i,i)-O,e[i]<0)T=f,k=d,C=y;else if(u=i,0===e[i]?(b=Fe(-d,-y,f,P),o.set(i,w-1,b[0]),o.set(i,w,b[1])):(h=o.get(i,i+1),p=o.get(i+1,i),v=(r[i]-O)*(r[i]-O)+e[i]*e[i]-P*P,g=2*(r[i]-O)*P,0===v&&0===g&&(v=x*E*(Math.abs(f)+Math.abs(P)+Math.abs(h)+Math.abs(p)+Math.abs(T))),b=Fe(h*k-T*d+P*y,h*C-T*y-P*d,v,g),o.set(i,w-1,b[0]),o.set(i,w,b[1]),Math.abs(h)>Math.abs(T)+Math.abs(P)?(o.set(i+1,w-1,(-d-f*o.get(i,w-1)+P*o.get(i,w))/h),o.set(i+1,w,(-y-f*o.get(i,w)-P*o.get(i,w-1))/h)):(b=Fe(-k-p*o.get(i,w-1),-C-p*o.get(i,w),T,P),o.set(i+1,w-1,b[0]),o.set(i+1,w,b[1]))),c=Math.max(Math.abs(o.get(i,w-1)),Math.abs(o.get(i,w))),x*c*c>1)for(a=i;a<=w;a++)o.set(a,w-1,o.get(a,w-1)/c),o.set(a,w,o.get(a,w)/c)}for(i=0;iS)for(a=i;a=0;a--)for(i=0;i<=S;i++){for(T=0,s=0;s<=Math.min(a,S);s++)T+=n.get(i,s)*o.get(s,a);n.set(i,a,T)}}(s,c,l,u,h)}this.n=s,this.e=c,this.d=l,this.V=u}var e,r,n;return e=t,(r=[{key:"realEigenvalues",get:function(){return Array.from(this.d)}},{key:"imaginaryEigenvalues",get:function(){return Array.from(this.e)}},{key:"eigenvectorMatrix",get:function(){return this.V}},{key:"diagonalMatrix",get:function(){var t,e,r=this.n,n=this.e,o=this.d,i=new I(r,r);for(t=0;t0?i.set(t,t+1,n[t]):n[t]<0&&i.set(t,t-1,n[t])}return i}}])&&Re(e.prototype,r),n&&Re(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Fe(t,e,r,n){var o,i;return Math.abs(r)>Math.abs(n)?[(t+(o=n/r)*e)/(i=r+o*n),(e-o*t)/i]:[((o=r/n)*t+e)/(i=n+o*r),(o*e-t)/i]}function Ge(t){"@babel/helpers - typeof";return(Ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ue(t,e){for(var r=0;r0,s.set(n,n,Math.sqrt(Math.max(l,0))),o=n+1;o=0;i--)for(o=0;o1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=le.checkMatrix(e);var n,o=r.Y,i=r.scaleScores,a=void 0!==i&&i,s=r.maxIterations,u=void 0===s?1e3:s,l=r.terminationCriteria,c=void 0===l?1e-10:l;if(o){if(!(o=Array.isArray(o)&&"number"==typeof o[0]?I.columnVector(o):le.checkMatrix(o)).isColumnVector()||o.rows!==e.rows)throw new Error("Y must be a column vector of length X.rows");n=o}else n=e.getColumnVector(0);for(var f,h,p,d,y=1,v=0;vc;v++)p=(p=e.transpose().mmul(n).div(n.transpose().mmul(n).get(0,0))).div(p.norm()),f=e.mmul(p).div(p.transpose().mmul(p).get(0,0)),v>0&&(y=f.clone().sub(d).pow(2).sum()),d=f.clone(),o?(h=(h=o.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0))).div(h.norm()),n=o.mmul(h).div(h.transpose().mmul(h).get(0,0))):n=f;if(o){var g=e.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0));g=g.div(g.norm());var m=e.clone().sub(f.clone().mmul(g.transpose())),b=n.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0)),w=o.clone().sub(f.clone().mulS(b.get(0,0)).mmul(h.transpose()));this.t=f,this.p=g.transpose(),this.w=p.transpose(),this.q=h,this.u=n,this.s=f.transpose().mmul(f),this.xResidual=m,this.yResidual=w,this.betas=b}else this.w=p.transpose(),this.s=f.transpose().mmul(f).sqrt(),this.t=a?f.clone().div(this.s.get(0,0)):f,this.xResidual=e.sub(f.mmul(p.transpose()))})},2596:function(t,e,r){"use strict";var n=r(621);function o(t,e,r){var o=[0,0,0,0,0,0,0,0,0];return n.mat3.fromTranslation(o,r),n.mat3.multiply(t,o,e)}function i(t,e,r){var o=[0,0,0,0,0,0,0,0,0];return n.mat3.fromRotation(o,r),n.mat3.multiply(t,o,e)}function a(t,e,r){var o=[0,0,0,0,0,0,0,0,0];return n.mat3.fromScaling(o,r),n.mat3.multiply(t,o,e)}function s(t,e){return t[0]*e[1]-e[0]*t[1]}e.pd=function(t,e){for(var r,s,u,l=t?[].concat(t):[1,0,0,0,1,0,0,0,1],c=0,f=e.length;c-1},i=function(t,e){if(!n(t))return t;for(var r=[],o=0;o-1;)T.call(t,i,1);return t},j=Array.prototype.splice,I=function(t,e){if(!n(t))return[];for(var r=t?e.length:0,o=r-1;r--;){var i=void 0,a=e[r];r!==o&&a===i||(i=a,j.call(t,a,1))}return t},N=function(t,e,r){if(!f(t)&&!b(t))return t;var n=r;return d(t,function(t,r){n=e(n,t,r)}),n},L=function(t,e){var r=[];if(!n(t))return r;for(var o=-1,i=[],a=t.length;++oe[o])return 1;if(t[o]r?r:t},nt=function(t,e){var r=e.toString(),n=r.indexOf(".");if(-1===n)return Math.round(t);var o=r.substr(n+1).length;return o>20&&(o=20),parseFloat(t.toFixed(o))},ot=function(t){return u(t,"Number")},it=function(t){return ot(t)&&t%1!=0},at=function(t){return ot(t)&&t%2==0},st=Number.isInteger?Number.isInteger:function(t){return ot(t)&&t%1==0},ut=function(t){return ot(t)&&t<0},lt=1e-5;function ct(t,e,r){return void 0===r&&(r=lt),Math.abs(t-e)0},pt=function(t,e){if(f(t)){for(var r,n=-1/0,o=0;on&&(r=i,n=a)}return r}},dt=function(t,e){if(f(t)){for(var r,n=1/0,o=0;oe?(n&&(clearTimeout(n),n=null),s=l,a=t.apply(o,i),n||(o=i=null)):n||!1===r.trailing||(n=setTimeout(u,c)),a};return l.cancel=function(){clearTimeout(n),s=0,n=o=i=null},l},me=function(t){return n(t)?Array.prototype.slice.call(t):[]},be={},we=function(t){return be[t=t||"g"]?be[t]+=1:be[t]=1,t+be[t]},Se=function(){},xe=function(t){return t};function _e(t){return c(t)?0:n(t)?t.length:Object.keys(t).length}var Ee,Oe=r(1635),Pe=$t(function(t,e){void 0===e&&(e={});var r=e.fontSize,n=e.fontFamily,o=e.fontWeight,i=e.fontStyle,a=e.fontVariant;return Ee||(Ee=document.createElement("canvas").getContext("2d")),Ee.font=[i,a,o,r+"px",n].join(" "),Ee.measureText(R(t)?t:"").width},function(t,e){return void 0===e&&(e={}),(0,Oe.__spreadArrays)([t],Et(e)).join("")}),ke=function(t,e,r,n){void 0===n&&(n="...");var o,i,a=Pe(n,r),s=R(t)?t:Pt(t),u=e,l=[];if(Pe(t,r)<=e)return t;for(;o=s.substr(0,16),!((i=Pe(o,r))+a>u&&i>u);)if(l.push(o),u-=i,!(s=s.substr(16)))return l.join("");for(;o=s.substr(0,1),!((i=Pe(o,r))+a>u);)if(l.push(o),u-=i,!(s=s.substr(1)))return l.join("");return""+l.join("")+n},Ce=function(){function t(){this.map={}}return t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,e){var r=this.map[t];return void 0===r?e:r},t.prototype.set=function(t,e){this.map[t]=e},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length},t}()},3970:function(t){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},1288:function(t,e,r){var n=r(3970),o=r(7742),i=Object.hasOwnProperty,a=Object.create(null);for(var s in n)i.call(n,s)&&(a[n[s]]=s);var u=t.exports={to:{},get:{}};function l(t,e,r){return Math.min(Math.max(e,t),r)}function c(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}u.get=function(t){var e,r;switch(t.substring(0,3).toLowerCase()){case"hsl":e=u.get.hsl(t),r="hsl";break;case"hwb":e=u.get.hwb(t),r="hwb";break;default:e=u.get.rgb(t),r="rgb"}return e?{model:r,value:e}:null},u.get.rgb=function(t){if(!t)return null;var e,r,o,a=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(o=e[2],e=e[1],r=0;r<3;r++){var s=2*r;a[r]=parseInt(e.slice(s,s+2),16)}o&&(a[3]=parseInt(o,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(o=(e=e[1])[3],r=0;r<3;r++)a[r]=parseInt(e[r]+e[r],16);o&&(a[3]=parseInt(o+o,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(r=0;r<3;r++)a[r]=parseInt(e[r+1],0);e[4]&&(e[5]?a[3]=.01*parseFloat(e[4]):a[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:i.call(n,e[1])?((a=n[e[1]])[3]=1,a):null:null;for(r=0;r<3;r++)a[r]=Math.round(2.55*parseFloat(e[r+1]));e[4]&&(e[5]?a[3]=.01*parseFloat(e[4]):a[3]=parseFloat(e[4]))}for(r=0;r<3;r++)a[r]=l(a[r],0,255);return a[3]=l(a[3],0,1),a},u.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var r=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,l(parseFloat(e[2]),0,100),l(parseFloat(e[3]),0,100),l(isNaN(r)?1:r,0,1)]}return null},u.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var r=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,l(parseFloat(e[2]),0,100),l(parseFloat(e[3]),0,100),l(isNaN(r)?1:r,0,1)]}return null},u.to.hex=function(){var t=o(arguments);return"#"+c(t[0])+c(t[1])+c(t[2])+(t[3]<1?c(Math.round(255*t[3])):"")},u.to.rgb=function(){var t=o(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},u.to.rgb.percent=function(){var t=o(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"},u.to.hsl=function(){var t=o(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},u.to.hwb=function(){var t=o(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},u.to.keyword=function(t){return a[t.slice(0,3)]}},2630:function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(1288),i=r(779),a=[].slice,s=["keyword","gray","hex"],u={};Object.keys(i).forEach(function(t){u[a.call(i[t].labels).sort().join("")]=t});var l={};function c(t,e){if(!(this instanceof c))return new c(t,e);if(e&&e in s&&(e=null),e&&!(e in i))throw new Error("Unknown model: "+e);var r,n;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof c)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var f=o.get(t);if(null===f)throw new Error("Unable to parse color from string: "+t);this.model=f.model,n=i[this.model].channels,this.color=f.value.slice(0,n),this.valpha="number"==typeof f.value[n]?f.value[n]:1}else if(t.length){this.model=e||"rgb",n=i[this.model].channels;var h=a.call(t,0,n);this.color=p(h,n),this.valpha="number"==typeof t[n]?t[n]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var d=Object.keys(t);"alpha"in t&&(d.splice(d.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var y=d.sort().join("");if(!(y in u))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=u[y];var v=i[this.model].labels,g=[];for(r=0;rr?(e+.05)/(r+.05):(r+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten:function(t){var e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken:function(t){var e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate:function(t){var e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate:function(t){var e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten:function(t){var e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken:function(t){var e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale:function(){var t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return c.rgb(e,e,e)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var e=this.hsl(),r=e.color[0];return r=(r=(r+t)%360)<0?360+r:r,e.color[0]=r,e},mix:function(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+n(t));var r=t.rgb(),o=this.rgb(),i=void 0===e?.5:e,a=2*i-1,s=r.alpha()-o.alpha(),u=((a*s==-1?a:(a+s)/(1+a*s))+1)/2,l=1-u;return c.rgb(u*r.red()+l*o.red(),u*r.green()+l*o.green(),u*r.blue()+l*o.blue(),r.alpha()*i+o.alpha()*(1-i))}},Object.keys(i).forEach(function(t){if(-1===s.indexOf(t)){var e=i[t].channels;c.prototype[t]=function(){if(this.model===t)return new c(this);if(arguments.length)return new c(arguments,t);var r,n="number"==typeof arguments[e]?e:this.valpha;return new c((r=i[this.model][t].raw(this.color),Array.isArray(r)?r:[r]).concat(n),t)},c[t]=function(r){return"number"==typeof r&&(r=p(a.call(arguments),e)),new c(r,t)}}}),t.exports=c},2410:function(t,e,r){var n=r(8623),o={};for(var i in n)n.hasOwnProperty(i)&&(o[n[i]]=i);var a=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var s in a)if(a.hasOwnProperty(s)){if(!("channels"in a[s]))throw new Error("missing channels property: "+s);if(!("labels"in a[s]))throw new Error("missing channel labels property: "+s);if(a[s].labels.length!==a[s].channels)throw new Error("channel and label counts mismatch: "+s);var u=a[s].channels,l=a[s].labels;delete a[s].channels,delete a[s].labels,Object.defineProperty(a[s],"channels",{value:u}),Object.defineProperty(a[s],"labels",{value:l})}a.rgb.hsl=function(t){var e,r,n=t[0]/255,o=t[1]/255,i=t[2]/255,a=Math.min(n,o,i),s=Math.max(n,o,i),u=s-a;return s===a?e=0:n===s?e=(o-i)/u:o===s?e=2+(i-n)/u:i===s&&(e=4+(n-o)/u),(e=Math.min(60*e,360))<0&&(e+=360),r=(a+s)/2,[e,100*(s===a?0:r<=.5?u/(s+a):u/(2-s-a)),100*r]},a.rgb.hsv=function(t){var e,r,n,o,i,a=t[0]/255,s=t[1]/255,u=t[2]/255,l=Math.max(a,s,u),c=l-Math.min(a,s,u),f=function(t){return(l-t)/6/c+.5};return 0===c?o=i=0:(i=c/l,e=f(a),r=f(s),n=f(u),a===l?o=n-r:s===l?o=1/3+e-n:u===l&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[360*o,100*i,100*l]},a.rgb.hwb=function(t){var e=t[0],r=t[1],n=t[2];return[a.rgb.hsl(t)[0],100*(1/255*Math.min(e,Math.min(r,n))),100*(n=1-1/255*Math.max(e,Math.max(r,n)))]},a.rgb.cmyk=function(t){var e,r=t[0]/255,n=t[1]/255,o=t[2]/255;return[100*((1-r-(e=Math.min(1-r,1-n,1-o)))/(1-e)||0),100*((1-n-e)/(1-e)||0),100*((1-o-e)/(1-e)||0),100*e]},a.rgb.keyword=function(t){var e=o[t];if(e)return e;var r,i,a,s=1/0;for(var u in n)if(n.hasOwnProperty(u)){var l=n[u],c=(i=t,a=l,Math.pow(i[0]-a[0],2)+Math.pow(i[1]-a[1],2)+Math.pow(i[2]-a[2],2));c.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*e+.7152*r+.0722*n),100*(.0193*e+.1192*r+.9505*n)]},a.rgb.lab=function(t){var e=a.rgb.xyz(t),r=e[0],n=e[1],o=e[2];return n/=100,o/=108.883,r=(r/=95.047)>.008856?Math.pow(r,1/3):7.787*r+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(r-n),200*(n-(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116))]},a.hsl.rgb=function(t){var e,r,n,o,i,a=t[0]/360,s=t[1]/100,u=t[2]/100;if(0===s)return[i=255*u,i,i];e=2*u-(r=u<.5?u*(1+s):u+s-u*s),o=[0,0,0];for(var l=0;l<3;l++)(n=a+1/3*-(l-1))<0&&n++,n>1&&n--,i=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,o[l]=255*i;return o},a.hsl.hsv=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,o=r,i=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,o*=i<=1?i:2-i,[e,100*(0===n?2*o/(i+o):2*r/(n+r)),100*((n+r)/2)]},a.hsv.rgb=function(t){var e=t[0]/60,r=t[1]/100,n=t[2]/100,o=Math.floor(e)%6,i=e-Math.floor(e),a=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,a];case 1:return[s,n,a];case 2:return[a,n,u];case 3:return[a,s,n];case 4:return[u,a,n];case 5:return[n,a,s]}},a.hsv.hsl=function(t){var e,r,n,o=t[0],i=t[1]/100,a=t[2]/100,s=Math.max(a,.01);return n=(2-i)*a,r=i*s,[o,100*(r=(r/=(e=(2-i)*s)<=1?e:2-e)||0),100*(n/=2)]},a.hwb.rgb=function(t){var e,r,n,o,i,a,s,u=t[0]/360,l=t[1]/100,c=t[2]/100,f=l+c;switch(f>1&&(l/=f,c/=f),r=1-c,n=6*u-(e=Math.floor(6*u)),0!=(1&e)&&(n=1-n),o=l+n*(r-l),e){default:case 6:case 0:i=r,a=o,s=l;break;case 1:i=o,a=r,s=l;break;case 2:i=l,a=r,s=o;break;case 3:i=l,a=o,s=r;break;case 4:i=o,a=l,s=r;break;case 5:i=r,a=l,s=o}return[255*i,255*a,255*s]},a.cmyk.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100;return[255*(1-Math.min(1,e*(1-o)+o)),255*(1-Math.min(1,r*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o))]},a.xyz.rgb=function(t){var e,r,n,o=t[0]/100,i=t[1]/100,a=t[2]/100;return r=-.9689*o+1.8758*i+.0415*a,n=.0557*o+-.204*i+1.057*a,e=(e=3.2406*o+-1.5372*i+-.4986*a)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(e=Math.min(Math.max(0,e),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]},a.xyz.lab=function(t){var e=t[0],r=t[1],n=t[2];return r/=100,n/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(e-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},a.lab.xyz=function(t){var e,r,n,o=t[0],i=t[1],a=t[2];e=i/500+(r=(o+16)/116),n=r-a/200;var s=Math.pow(r,3),u=Math.pow(e,3),l=Math.pow(n,3);return r=s>.008856?s:(r-16/116)/7.787,e=u>.008856?u:(e-16/116)/7.787,n=l>.008856?l:(n-16/116)/7.787,[e*=95.047,r*=100,n*=108.883]},a.lab.lch=function(t){var e,r=t[0],n=t[1],o=t[2];return(e=360*Math.atan2(o,n)/2/Math.PI)<0&&(e+=360),[r,Math.sqrt(n*n+o*o),e]},a.lch.lab=function(t){var e,r=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[r,n*Math.cos(e),n*Math.sin(e)]},a.rgb.ansi16=function(t){var e=t[0],r=t[1],n=t[2],o=1 in arguments?arguments[1]:a.rgb.hsv(t)[2];if(0===(o=Math.round(o/50)))return 30;var i=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(e/255));return 2===o&&(i+=60),i},a.hsv.ansi16=function(t){return a.rgb.ansi16(a.hsv.rgb(t),t[2])},a.rgb.ansi256=function(t){var e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},a.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),[e=e/10.5*255,e,e];var r=.5*(1+~~(t>50));return[(1&e)*r*255,(e>>1&1)*r*255,(e>>2&1)*r*255]},a.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var r;return t-=16,[Math.floor(t/36)/5*255,Math.floor((r=t%36)/6)/5*255,r%6/5*255]},a.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},a.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var r=e[0];3===e[0].length&&(r=r.split("").map(function(t){return t+t}).join(""));var n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},a.rgb.hcg=function(t){var e,r,n=t[0]/255,o=t[1]/255,i=t[2]/255,a=Math.max(Math.max(n,o),i),s=Math.min(Math.min(n,o),i),u=a-s;return e=u<1?s/(1-u):0,r=u<=0?0:a===n?(o-i)/u%6:a===o?2+(i-n)/u:4+(n-o)/u+4,r/=6,[360*(r%=1),100*u,100*e]},a.hsl.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1,o=0;return(n=r<.5?2*e*r:2*e*(1-r))<1&&(o=(r-.5*n)/(1-n)),[t[0],100*n,100*o]},a.hsv.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=e*r,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],100*n,100*o]},a.hcg.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100;if(0===r)return[255*n,255*n,255*n];var o,i=[0,0,0],a=e%1*6,s=a%1,u=1-s;switch(Math.floor(a)){case 0:i[0]=1,i[1]=s,i[2]=0;break;case 1:i[0]=u,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=s;break;case 3:i[0]=0,i[1]=u,i[2]=1;break;case 4:i[0]=s,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=u}return o=(1-r)*n,[255*(r*i[0]+o),255*(r*i[1]+o),255*(r*i[2]+o)]},a.hcg.hsv=function(t){var e=t[1]/100,r=e+t[2]/100*(1-e),n=0;return r>0&&(n=e/r),[t[0],100*n,100*r]},a.hcg.hsl=function(t){var e=t[1]/100,r=t[2]/100*(1-e)+.5*e,n=0;return r>0&&r<.5?n=e/(2*r):r>=.5&&r<1&&(n=e/(2*(1-r))),[t[0],100*n,100*r]},a.hcg.hwb=function(t){var e=t[1]/100,r=e+t[2]/100*(1-e);return[t[0],100*(r-e),100*(1-r)]},a.hwb.hcg=function(t){var e=t[1]/100,r=1-t[2]/100,n=r-e,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],100*n,100*o]},a.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},a.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},a.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},a.gray.hsl=a.gray.hsv=function(t){return[0,0,t[0]]},a.gray.hwb=function(t){return[0,100,t[0]]},a.gray.cmyk=function(t){return[0,0,0,t[0]]},a.gray.lab=function(t){return[t[0],0,0]},a.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),r=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(r.length)+r},a.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}},779:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(2410),i=r(4798),a={};Object.keys(o).forEach(function(t){a[t]={},Object.defineProperty(a[t],"channels",{value:o[t].channels}),Object.defineProperty(a[t],"labels",{value:o[t].labels});var e=i(t);Object.keys(e).forEach(function(r){var o=e[r];a[t][r]=function(t){var e=function(e){if(void 0===e||null===e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var r=t(e);if("object"===n(r))for(var o=r.length,i=0;i1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(o)})}),t.exports=a},4798:function(t,e,r){var n=r(2410);function o(t){var e=function(){for(var t={},e=Object.keys(n),r=e.length,o=0;op+c||od+c||if.index){var h=p-s.x-s.vx,g=d-s.y-s.vy,m=h*h+g*g;mt.r&&(t.r=t[e].r)}function p(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var r,n,o=new Array(r),i=0;i1?(null==r?u.delete(t):u.set(t,y(r)),e):u.get(t)},find:function(e,r,n){var o,i,a,s,u,l=0,c=t.length;for(null==n?n=1/0:n*=n,l=0;l1?(c.on(t,r),e):c.on(t)}}}function T(){var t,e,r,n,s,u=i(-30),l=1,c=1/0,f=.81;function h(r){var i,a=t.length,s=(0,o.A)(t,E,O).visitAfter(d);for(n=r,i=0;i=c)){(t.data!==e||t.next)&&(0===h&&(y+=(h=a(r))*h),0===p&&(y+=(p=a(r))*p),y=(i=(y+g)/2))?y=i:g=i,(c=r>=(a=(v+m)/2))?v=a:m=a,o=p,!(p=p[f=c<<1|l]))return o[f]=d,t;if(s=+t._x.call(null,p.data),u=+t._y.call(null,p.data),e===s&&r===u)return d.next=p,o?o[f]=d:t._root=d,t;do{o=o?o[f]=new Array(4):t._root=new Array(4),(l=e>=(i=(y+g)/2))?y=i:g=i,(c=r>=(a=(v+m)/2))?v=a:m=a}while((f=c<<1|l)==(h=(u>=a)<<1|s>=i));return o[h]=p,o[f]=d,t}function o(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function i(t){return t[0]}function a(t){return t[1]}function s(t,e,r){var n=new u(null==e?i:e,null==r?a:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function u(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function l(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}r.d(e,{A:function(){return s}});var c=s.prototype=u.prototype;c.copy=function(){var t,e,r=new u(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=l(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=l(e));return r},c.add=function(t){var e=+this._x.call(null,t),r=+this._y.call(null,t);return n(this.cover(e,r),e,r,t)},c.addAll=function(t){var e,r,o,i,a=t.length,s=new Array(a),u=new Array(a),l=1/0,c=1/0,f=-1/0,h=-1/0;for(r=0;rf&&(f=o),ih&&(h=i));if(l>f||c>h)return this;for(this.cover(l,c).cover(f,h),r=0;rt||t>=o||n>e||e>=i;)switch(s=(ep||(a=l.y0)>d||(s=l.x1)=m)<<1|t>=g)&&(l=y[y.length-1],y[y.length-1]=y[y.length-1-c],y[y.length-1-c]=l)}else{var b=t-+this._x.call(null,v.data),w=e-+this._y.call(null,v.data),S=b*b+w*w;if(S=(s=(d+v)/2))?d=s:v=s,(c=a>=(u=(y+g)/2))?y=u:g=u,e=p,!(p=p[f=c<<1|l]))return this;if(!p.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(r=e,h=f)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(o=p.next)&&delete p.next,n?(o?n.next=o:delete n.next,this):e?(o?e[f]=o:delete e[f],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(r?r[h]=p:this._root=p),this):(this._root=o,this)},c.removeAll=function(t){for(var e=0,r=t.length;e=0&&e._call.call(null,t),e=e._next;--a}()}finally{a=0,function(){var t,e,r=o,n=1/0;for(;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:o=e);i=t,S(n)}(),f=0}}function w(){var t=p.now(),e=t-c;e>l&&(h-=e,c=t)}function S(t){a||(s&&(s=clearTimeout(s)),t-f>24?(t<1/0&&(s=setTimeout(b,t-p.now()-h)),u&&(u=clearInterval(u))):(u||(c=p.now(),u=setInterval(w,l)),a=1,d(b)))}g.prototype=m.prototype={constructor:g,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?y():+r)+(null==e?0:+e),this._next||i===this||(i?i._next=this:o=this,i=this),this._call=t,this._time=r,S()},stop:function(){this._call&&(this._call=null,this._time=1/0,S())}}},3963:function(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=l(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function o(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||l(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e,r){return e=a(e),function(t,e){if(e&&("object"===y(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,r||[],a(t).constructor):e.apply(t,r))}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||l(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){if(t){if("string"==typeof t)return c(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(t,e):void 0}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v,a=JSON.parse(JSON.stringify(i)),s=(null===(t=null==o?void 0:o.graph)||void 0===t?void 0:t.meta)||{},u=(null===(e=null==o?void 0:o.subScene)||void 0===e?void 0:e.meta)||{},l=(null===(r=null==o?void 0:o.nodeSize)||void 0===r?void 0:r.meta)||{},c=(null===(n=null==o?void 0:o.nodeSize)||void 0===n?void 0:n.node)||{},f=a.nodeSize.bridge;return{graph:{meta:Object.assign(a.graph.meta,s)},subScene:{meta:Object.assign(a.subScene.meta,u)},nodeSize:{meta:Object.assign(a.nodeSize.meta,l),node:Object.assign(a.nodeSize.node,c),bridge:f}}}function m(t){return"◬".concat(t,"◬")}var b,w,S,x,_=m("ROOT"),E=m("BRIDGE_GRAPH");!function(t){t[t.META=0]="META",t[t.NODE=1]="NODE",t[t.BRIDGE=2]="BRIDGE"}(b||(b={})),function(t){t[t.INCLUDE=0]="INCLUDE",t[t.EXCLUDE=1]="EXCLUDE",t[t.UNSPECIFIED=2]="UNSPECIFIED"}(w||(w={})),function(t){t[t.META=0]="META",t[t.CORE=1]="CORE",t[t.BRIDGE=2]="BRIDGE"}(S||(S={})),function(t){t[t.META=0]="META",t[t.OP=1]="OP",t[t.SERIES=2]="SERIES"}(x||(x={}));var O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{};function P(t,e){return t(e={exports:{}},e.exports),e.exports}var k=function(t,e){return t===e||t!=t&&e!=e},C=function(t,e){for(var r=t.length;r--;)if(k(t[r][0],e))return r;return-1},T=Array.prototype.splice;function A(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e-1},A.prototype.set=function(t,e){var r=this.__data__,n=C(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var M,j=A,I="object"==y(O)&&O&&O.Object===Object&&O,N="object"==("undefined"==typeof self?"undefined":y(self))&&self&&self.Object===Object&&self,L=I||N||Function("return this")(),R=L.Symbol,D=Object.prototype,B=D.hasOwnProperty,F=D.toString,G=R?R.toStringTag:void 0,U=Object.prototype.toString,z=R?R.toStringTag:void 0,V=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":z&&z in Object(t)?function(t){var e=B.call(t,G),r=t[G];try{t[G]=void 0;var n=!0}catch(t){}var o=F.call(t);return n&&(e?t[G]=r:delete t[G]),o}(t):function(t){return U.call(t)}(t)},H=function(t){var e=y(t);return null!=t&&("object"==e||"function"==e)},q=function(t){if(!H(t))return!1;var e=V(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},W=L["__core-js_shared__"],Y=(M=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||""))?"Symbol(src)_1."+M:"",X=Function.prototype.toString,J=function(t){if(null!=t){try{return X.call(t)}catch(t){}try{return t+""}catch(t){}}return""},K=/^\[object .+?Constructor\]$/,Q=Function.prototype,Z=Object.prototype,$=Q.toString,tt=Z.hasOwnProperty,et=RegExp("^"+$.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=function(t){return!(!H(t)||function(t){return!!Y&&Y in t}(t))&&(q(t)?et:K).test(J(t))},nt=function(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return rt(r)?r:void 0},ot=nt(L,"Map"),it=nt(Object,"create"),at=Object.prototype.hasOwnProperty,st=Object.prototype.hasOwnProperty;function ut(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991},It={};It["[object Float32Array]"]=It["[object Float64Array]"]=It["[object Int8Array]"]=It["[object Int16Array]"]=It["[object Int32Array]"]=It["[object Uint8Array]"]=It["[object Uint8ClampedArray]"]=It["[object Uint16Array]"]=It["[object Uint32Array]"]=!0,It["[object Arguments]"]=It["[object Array]"]=It["[object ArrayBuffer]"]=It["[object Boolean]"]=It["[object DataView]"]=It["[object Date]"]=It["[object Error]"]=It["[object Function]"]=It["[object Map]"]=It["[object Number]"]=It["[object Object]"]=It["[object RegExp]"]=It["[object Set]"]=It["[object String]"]=It["[object WeakMap]"]=!1;var Nt=function(t){return function(e){return t(e)}},Lt=P(function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&I.process,i=function(){try{return n&&n.require&&n.require("util").types||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i}),Rt=Lt&&Lt.isTypedArray,Dt=Rt?Nt(Rt):function(t){return St(t)&&jt(t.length)&&!!It[V(t)]},Bt=Object.prototype.hasOwnProperty,Ft=function(t,e){var r=kt(t),n=!r&&Pt(t),o=!r&&!n&&Tt(t),i=!r&&!n&&!o&&Dt(t),a=r||n||o||i,s=a?function(t,e){for(var r=-1,n=Array(t);++rs))return!1;var l=i.get(t),c=i.get(e);if(l&&c)return l==e&&c==t;var f=-1,h=!0,p=2&r?new We:void 0;for(i.set(t,e),i.set(e,t);++f0&&n(u)?r>1?t(u,r-1,n,o,i):oe(i,u):o||(i[i.length]=u)}return i},on=Math.max,an=function(t,e,r){return e=on(void 0===e?t.length-1:e,0),function(){for(var n=arguments,o=-1,i=on(n.length-e,0),a=Array(i);++o0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(sn),cn=function(t,e){return ln(an(t,e,Ue),t+"")},fn=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i-1},dn=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n=200){var l=e?null:yn(t);if(l)return Qe(l);a=!1,o=Xe,u=new We}else u=e?[]:s;t:for(;++ni){var a=o;o=i,i=a}return o+""+i+""+(bn.isUndefined(n)?"\0":n)}function On(t,e){return En(t,e.v,e.w,e.name)}Sn.prototype._nodeCount=0,Sn.prototype._edgeCount=0,Sn.prototype.isDirected=function(){return this._isDirected},Sn.prototype.isMultigraph=function(){return this._isMultigraph},Sn.prototype.isCompound=function(){return this._isCompound},Sn.prototype.setGraph=function(t){return this._label=t,this},Sn.prototype.graph=function(){return this._label},Sn.prototype.setDefaultNodeLabel=function(t){return bn.isFunction(t)||(t=bn.constant(t)),this._defaultNodeLabelFn=t,this},Sn.prototype.nodeCount=function(){return this._nodeCount},Sn.prototype.nodes=function(){return bn.keys(this._nodes)},Sn.prototype.sources=function(){var t=this;return bn.filter(this.nodes(),function(e){return bn.isEmpty(t._in[e])})},Sn.prototype.sinks=function(){var t=this;return bn.filter(this.nodes(),function(e){return bn.isEmpty(t._out[e])})},Sn.prototype.setNodes=function(t,e){var r=arguments,n=this;return bn.each(t,function(t){r.length>1?n.setNode(t,e):n.setNode(t)}),this},Sn.prototype.setNode=function(t,e){return bn.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},Sn.prototype.node=function(t){return this._nodes[t]},Sn.prototype.hasNode=function(t){return bn.has(this._nodes,t)},Sn.prototype.removeNode=function(t){var e=this;if(bn.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],bn.each(this.children(t),function(t){e.setParent(t)}),delete this._children[t]),bn.each(bn.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],bn.each(bn.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},Sn.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(bn.isUndefined(e))e="\0";else{for(var r=e+="";!bn.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},Sn.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},Sn.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if("\0"!==e)return e}},Sn.prototype.children=function(t){if(bn.isUndefined(t)&&(t="\0"),this._isCompound){var e=this._children[t];if(e)return bn.keys(e)}else{if("\0"===t)return this.nodes();if(this.hasNode(t))return[]}},Sn.prototype.predecessors=function(t){var e=this._preds[t];if(e)return bn.keys(e)},Sn.prototype.successors=function(t){var e=this._sucs[t];if(e)return bn.keys(e)},Sn.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return bn.union(e,this.successors(t))},Sn.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},Sn.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;bn.each(this._nodes,function(r,n){t(n)&&e.setNode(n,r)}),bn.each(this._edgeObjs,function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))});var n={};return this._isCompound&&bn.each(e.nodes(),function(t){e.setParent(t,function t(o){var i=r.parent(o);return void 0===i||e.hasNode(i)?(n[o]=i,i):i in n?n[i]:t(i)}(t))}),e},Sn.prototype.setDefaultEdgeLabel=function(t){return bn.isFunction(t)||(t=bn.constant(t)),this._defaultEdgeLabelFn=t,this},Sn.prototype.edgeCount=function(){return this._edgeCount},Sn.prototype.edges=function(){return bn.values(this._edgeObjs)},Sn.prototype.setPath=function(t,e){var r=this,n=arguments;return bn.reduce(t,function(t,o){return n.length>1?r.setEdge(t,o,e):r.setEdge(t,o),o}),this},Sn.prototype.setEdge=function(){var t,e,r,n,o=!1,i=arguments[0];"object"==y(i)&&null!==i&&"v"in i?(t=i.v,e=i.w,r=i.name,2===arguments.length&&(n=arguments[1],o=!0)):(t=i,e=arguments[1],r=arguments[3],arguments.length>2&&(n=arguments[2],o=!0)),t=""+t,e=""+e,bn.isUndefined(r)||(r=""+r);var a=En(this._isDirected,t,e,r);if(bn.has(this._edgeLabels,a))return o&&(this._edgeLabels[a]=n),this;if(!bn.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=o?n:this._defaultEdgeLabelFn(t,e,r);var s=function(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var a=o;o=i,i=a}var s={v:o,w:i};return n&&(s.name=n),s}(this._isDirected,t,e,r);return t=s.v,e=s.w,Object.freeze(s),this._edgeObjs[a]=s,xn(this._preds[e],t),xn(this._sucs[t],e),this._in[e][a]=s,this._out[t][a]=s,this._edgeCount++,this},Sn.prototype.edge=function(t,e,r){var n=1===arguments.length?On(this._isDirected,arguments[0]):En(this._isDirected,t,e,r);return this._edgeLabels[n]},Sn.prototype.hasEdge=function(t,e,r){var n=1===arguments.length?On(this._isDirected,arguments[0]):En(this._isDirected,t,e,r);return bn.has(this._edgeLabels,n)},Sn.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?On(this._isDirected,arguments[0]):En(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],_n(this._preds[e],t),_n(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},Sn.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var n=bn.values(r);return e?bn.filter(n,function(t){return t.v===e}):n}},Sn.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var n=bn.values(r);return e?bn.filter(n,function(t){return t.w===e}):n}},Sn.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))};var Pn={Graph:wn,version:"2.1.8"},kn={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:function(t){return bn.map(t.nodes(),function(e){var r=t.node(e),n=t.parent(e),o={v:e};return bn.isUndefined(r)||(o.value=r),bn.isUndefined(n)||(o.parent=n),o})}(t),edges:function(t){return bn.map(t.edges(),function(e){var r=t.edge(e),n={v:e.v,w:e.w};return bn.isUndefined(e.name)||(n.name=e.name),bn.isUndefined(r)||(n.value=r),n})}(t)};return bn.isUndefined(t.graph())||(e.value=bn.clone(t.graph())),e},read:function(t){var e=new wn(t.options).setGraph(t.value);return bn.each(t.nodes,function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),bn.each(t.edges,function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}};var Cn=Tn;function Tn(){this._arr=[],this._keyIndices={}}Tn.prototype.size=function(){return this._arr.length},Tn.prototype.keys=function(){return this._arr.map(function(t){return t.key})},Tn.prototype.has=function(t){return bn.has(this._keyIndices,t)},Tn.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},Tn.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},Tn.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!bn.has(r,t)){var n=this._arr,o=n.length;return r[t]=o,n.push({key:t,priority:e}),this._decrease(o),!0}return!1},Tn.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},Tn.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},Tn.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r>1].priority0&&(o=s.removeMin(),(i=a[o]).distance!==Number.POSITIVE_INFINITY);)n(o).forEach(u);return a}(t,String(e),r||Mn,n||function(e){return t.outEdges(e)})},Mn=bn.constant(1),jn=function(t){var e=0,r=[],n={},o=[];function i(a){var s=n[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach(function(t){bn.has(n,t)?n[t].onStack&&(s.lowlink=Math.min(s.lowlink,n[t].index)):(i(t),s.lowlink=Math.min(s.lowlink,n[t].lowlink))}),s.lowlink===s.index){var u,l=[];do{u=r.pop(),n[u].onStack=!1,l.push(u)}while(a!==u);o.push(l)}}return t.nodes().forEach(function(t){bn.has(n,t)||i(t)}),o},In=bn.constant(1),Nn=Ln;function Ln(t){var e={},r={},n=[];if(bn.each(t.sinks(),function o(i){if(bn.has(r,i))throw new Rn;bn.has(e,i)||(r[i]=!0,e[i]=!0,bn.each(t.predecessors(i),o),delete r[i],n.push(i))}),bn.size(e)!==t.nodeCount())throw new Rn;return n}function Rn(){}Ln.CycleException=Rn,Rn.prototype=new Error;var Dn=function(t,e,r){bn.isArray(e)||(e=[e]);var n=(t.isDirected()?t.successors:t.neighbors).bind(t),o=[],i={};return bn.each(e,function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);!function t(e,r,n,o,i,a){bn.has(o,r)||(o[r]=!0,n||a.push(r),bn.each(i(r),function(r){t(e,r,n,o,i,a)}),n&&a.push(r))}(t,e,"post"===r,i,n,o)}),o};var Bn,Fn={Graph:Pn.Graph,json:kn,alg:{components:function(t){var e,r={},n=[];function o(n){bn.has(r,n)||(r[n]=!0,e.push(n),bn.each(t.successors(n),o),bn.each(t.predecessors(n),o))}return bn.each(t.nodes(),function(t){e=[],o(t),e.length&&n.push(e)}),n},dijkstra:An,dijkstraAll:function(t,e,r){return bn.transform(t.nodes(),function(n,o){n[o]=An(t,o,e,r)},{})},findCycles:function(t){return bn.filter(jn(t),function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})},floydWarshall:function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach(function(t){n[t]={},n[t][t]={distance:0},o.forEach(function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})}),r(t).forEach(function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}})}),o.forEach(function(t){var e=n[t];o.forEach(function(r){var i=n[r];o.forEach(function(r){var n=i[t],o=e[r],a=i[r],s=n.distance+o.distance;s0;){if(r=i.removeMin(),bn.has(o,r))n.setEdge(r,o[r]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(r).forEach(a)}return n},tarjan:jn,topsort:Nn},version:Pn.version};try{Bn=Fn}catch(v){}Bn||(Bn=window.graphlib);var Gn,Un=Bn,zn=function(t,e,r){if(!H(r))return!1;var n=y(e);return!!("number"==n?Wt(r)&&Mt(e,r.length):"string"==n&&e in r)&&k(r[e],t)},Vn=Object.prototype,Hn=Vn.hasOwnProperty,qn=cn(function(t,e){t=Object(t);var r=-1,n=e.length,o=n>2?e[2]:void 0;for(o&&zn(e[0],e[1],o)&&(n=1);++r-1?o[i?e[a]:a]:void 0}}(function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=null==r?0:function(t){var e=Qn(t),r=e%1;return e==e?r?e-r:e:0}(r);return o<0&&(o=Zn(n+o,0)),fn(t,Mr(e),o)}),to=function(t){return null!=t&&t.length?nn(t,1):[]},eo=function(t,e,r){for(var n=-1,o=t.length;++ne},no=function(t,e,r){(void 0!==r&&!k(t[e],r)||void 0===r&&!(e in t))&>(t,e,r)},oo=Function.prototype,io=Object.prototype,ao=oo.toString,so=io.hasOwnProperty,uo=ao.call(Object),lo=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},co=function(t,e,r,n,o,i,a){var s=lo(t,r),u=lo(e,r),l=a.get(u);if(l)no(t,r,l);else{var c=i?i(s,u,r+"",t,e,a):void 0,f=void 0===c;if(f){var h=kt(u),p=!h&&Tt(u),d=!h&&!p&&Dt(u);c=u,h||p||d?kt(s)?c=s:vn(s)?c=Zt(s):p?(f=!1,c=Qt(u,!0)):d?(f=!1,c=Pe(u,!0)):c=[]:function(t){if(!St(t)||"[object Object]"!=V(t))return!1;var e=ie(t);if(null===e)return!0;var r=so.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&ao.call(r)==uo}(u)||Pt(u)?(c=s,Pt(s)?c=function(t){return wt(t,Kt(t))}(s):H(s)&&!q(s)||(c=Ae(u))):f=!1}f&&(a.set(u,c),o(c,u,n,i,a),a.delete(u)),no(t,r,c)}},fo=function(t){return cn(function(e,r){var n=-1,o=r.length,i=o>1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,a&&zn(r[0],r[1],a)&&(i=o<3?void 0:i,o=1),e=Object(e);++ne||i&&a&&u&&!s&&!l||n&&a&&u||!r&&u||!o)return 1;if(!n&&!i&&!l&&t=s?u:u*("desc"==r[n]?-1:1)}return t.index-e.index}(t,e,r)})},xo=cn(function(t,e){if(null==t)return[];var r=e.length;return r>1&&zn(t,e[0],e[1])?e=[]:r>2&&zn(e[0],e[1],e[2])&&(e=[e[0]]),So(t,nn(e,1),[])}),_o=0;try{Gn={cloneDeep:function(t){return Re(t,5)},constant:De,defaults:qn,each:He,filter:jr,find:$n,flatten:to,forEach:Ve,forIn:function(t,e){return null==t?t:Be(t,ze(e),Kt)},has:Lr,isUndefined:Dr,last:function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0},map:Fr,mapValues:function(t,e){var r={};return e=Mr(e),Fe(t,function(t,n,o){gt(r,n,e(t,n,o))}),r},max:function(t){return t&&t.length?eo(t,Ue,ro):void 0},merge:fo,min:function(t){return t&&t.length?eo(t,Ue,ho):void 0},minBy:function(t,e){return t&&t.length?eo(t,Mr(e),ho):void 0},now:function(){return L.Date.now()},pick:vo,range:bo,reduce:zr,sortBy:xo,uniqueId:function(t){var e=++_o;return Sr(t)+e},values:mn,zipObject:function(t,e){return function(t,e,r){for(var n=-1,o=t.length,i=e.length,a={};++n0;--s)if(n=e[s].dequeue()){o=o.concat(Mo(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return Eo.flatten(Eo.map(n,function(e){return t.outEdges(e.v,e.w)}),!0)}(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},n={};return Eo.forEach(t.nodes(),function o(i){Eo.has(n,i)||(n[i]=!0,r[i]=!0,Eo.forEach(t.outEdges(i),function(t){Eo.has(r,t.w)?e.push(t):o(t.w)}),delete r[i])}),e}(t);Eo.forEach(e,function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,Eo.uniqueId("rev"))})},No=function(t){Eo.forEach(t.edges(),function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}})},Lo=Un.Graph,Ro={addDummyNode:Do,simplify:function(t){var e=(new Lo).setGraph(t.graph());return Eo.forEach(t.nodes(),function(r){e.setNode(r,t.node(r))}),Eo.forEach(t.edges(),function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})}),e},asNonCompoundGraph:function(t){var e=new Lo({multigraph:t.isMultigraph()}).setGraph(t.graph());return Eo.forEach(t.nodes(),function(r){t.children(r).length||e.setNode(r,t.node(r))}),Eo.forEach(t.edges(),function(r){e.setEdge(r,t.edge(r))}),e},successorWeights:function(t){var e=Eo.map(t.nodes(),function(e){var r={};return Eo.forEach(t.outEdges(e),function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight}),r});return Eo.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=Eo.map(t.nodes(),function(e){var r={};return Eo.forEach(t.inEdges(e),function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight}),r});return Eo.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,a=e.x-o,s=e.y-i,u=t.width/2,l=t.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*u>Math.abs(a)*l?(s<0&&(l=-l),r=l*a/s,n=l):(a<0&&(u=-u),r=u,n=u*s/a),{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=Eo.map(Eo.range(Bo(t)+1),function(){return[]});return Eo.forEach(t.nodes(),function(r){var n=t.node(r),o=n.rank;Eo.isUndefined(o)||(e[o][n.order]=r)}),e},normalizeRanks:function(t){var e=Eo.min(Eo.map(t.nodes(),function(e){return t.node(e).rank}));Eo.forEach(t.nodes(),function(r){var n=t.node(r);Eo.has(n,"rank")&&(n.rank-=e)})},removeEmptyRanks:function(t){var e=Eo.min(Eo.map(t.nodes(),function(e){return t.node(e).rank})),r=[];Eo.forEach(t.nodes(),function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)});var n=0,o=t.graph().nodeRankFactor;Eo.forEach(r,function(e,r){Eo.isUndefined(e)&&r%o!=0?--n:n&&Eo.forEach(e,function(e){t.node(e).rank+=n})})},addBorderNode:function(t,e,r,n){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),Do(t,"border",o,e)},maxRank:Bo,partition:function(t,e){var r={lhs:[],rhs:[]};return Eo.forEach(t,function(t){e(t)?r.lhs.push(t):r.rhs.push(t)}),r},time:function(t,e){var r=Eo.now();try{return e()}finally{console.log(t+" time: "+(Eo.now()-r)+"ms")}},notime:function(t,e){return e()}};function Do(t,e,r,n){var o;do{o=Eo.uniqueId(n)}while(t.hasNode(o));return r.dummy=e,t.setNode(o,r),o}function Bo(t){return Eo.max(Eo.map(t.nodes(),function(e){var r=t.node(e).rank;if(!Eo.isUndefined(r))return r}))}var Fo=function(t){t.graph().dummyChains=[],Eo.forEach(t.edges(),function(e){!function(t,e){var r,n,o,i=e.v,a=t.node(i).rank,s=e.w,u=t.node(s).rank,l=e.name,c=t.edge(e),f=c.labelRank;if(u!==a+1){for(t.removeEdge(e),o=0,++a;aa.lim&&(s=a,u=!0);var l=Eo.filter(e.edges(),function(e){return u===ui(t,t.node(e.v),s)&&u!==ui(t,t.node(e.w),s)});return Eo.minBy(l,function(t){return Jo(e,t)})}function si(t,e,r,n){var o=r.v,i=r.w;t.removeEdge(o,i),t.setEdge(n.v,n.w,{}),oi(t),ri(t,e),function(t,e){var r=Eo.find(t.nodes(),function(t){return!e.node(t).parent}),n=Qo(t,r);n=n.slice(1),Eo.forEach(n,function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)})}(t,e)}function ui(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}ei.initLowLimValues=oi,ei.initCutValues=ri,ei.calcCutValue=ni,ei.leaveEdge=ii,ei.enterEdge=ai,ei.exchangeEdges=si;var li=Uo,ci=li;function fi(t){ti(t)}var hi=function(t){var e=Ro.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(n,o){var i=t.children(n);i&&i.length&&Eo.forEach(i,function(t){r(t,o+1)}),e[n]=o}return Eo.forEach(t.children(),function(t){r(t,1)}),e}(t),n=Eo.max(Eo.values(r))-1,o=2*n+1;t.graph().nestingRoot=e,Eo.forEach(t.edges(),function(e){t.edge(e).minlen*=o});var i=function(t){return Eo.reduce(t.edges(),function(e,r){return e+t.edge(r).weight},0)}(t)+1;Eo.forEach(t.children(),function(a){!function t(e,r,n,o,i,a,s){var u=e.children(s);if(u.length){var l=Ro.addBorderNode(e,"_bt"),c=Ro.addBorderNode(e,"_bb"),f=e.node(s);e.setParent(l,s),f.borderTop=l,e.setParent(c,s),f.borderBottom=c,Eo.forEach(u,function(u){t(e,r,n,o,i,a,u);var f=e.node(u),h=f.borderTop?f.borderTop:u,p=f.borderBottom?f.borderBottom:u,d=f.borderTop?o:2*o,y=h!==p?1:i-a[s]+1;e.setEdge(l,h,{weight:d,minlen:y,nestingEdge:!0}),e.setEdge(p,c,{weight:d,minlen:y,nestingEdge:!0})}),e.parent(s)||e.setEdge(r,l,{weight:0,minlen:i+a[s]})}else s!==r&&e.setEdge(r,s,{weight:0,minlen:n})}(t,e,o,i,n,r,a)}),t.graph().nodeRankFactor=o},pi=function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,Eo.forEach(t.edges(),function(e){t.edge(e).nestingEdge&&t.removeEdge(e)})};function di(t,e,r,n,o,i){var a={width:0,height:0,rank:i,borderType:e},s=o[e][i-1],u=Ro.addDummyNode(t,"border",a,r);o[e][i]=u,t.setParent(u,n),s&&t.setEdge(s,u,{weight:1})}var yi=function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||gi(t)},vi=function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){Eo.forEach(t.nodes(),function(e){bi(t.node(e))}),Eo.forEach(t.edges(),function(e){var r=t.edge(e);Eo.forEach(r.points,bi),Eo.has(r,"y")&&bi(r)})}(t),"lr"!==e&&"rl"!==e||(function(t){Eo.forEach(t.nodes(),function(e){wi(t.node(e))}),Eo.forEach(t.edges(),function(e){var r=t.edge(e);Eo.forEach(r.points,wi),Eo.has(r,"x")&&wi(r)})}(t),gi(t))};function gi(t){Eo.forEach(t.nodes(),function(e){mi(t.node(e))}),Eo.forEach(t.edges(),function(e){mi(t.edge(e))})}function mi(t){var e=t.width;t.width=t.height,t.height=e}function bi(t){t.y=-t.y}function wi(t){var e=t.x;t.x=t.y,t.y=e}var Si=function(t,e){for(var r=0,n=1;n0;)e%2&&(r+=s[e+1]),s[e=e-1>>1]+=t.weight;u+=t.weight*r})),u}function _i(t,e,r){for(var n;e.length&&(n=Eo.last(e)).i<=r;)e.pop(),t.push(n.vs),r++;return r}var Ei=function t(e,r,n,o){var i=e.children(r),a=e.node(r),s=a?a.borderLeft:void 0,u=a?a.borderRight:void 0,l={};s&&(i=Eo.filter(i,function(t){return t!==s&&t!==u}));var c=function(t,e){return Eo.map(e,function(e){var r=t.inEdges(e);if(r.length){var n=Eo.reduce(r,function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}},{sum:0,weight:0});return{v:e,barycenter:n.sum/n.weight,weight:n.weight}}return{v:e}})}(e,i);Eo.forEach(c,function(r){if(e.children(r.v).length){var i=t(e,r.v,n,o);l[r.v]=i,Eo.has(i,"barycenter")&&(a=r,s=i,Eo.isUndefined(a.barycenter)?(a.barycenter=s.barycenter,a.weight=s.weight):(a.barycenter=(a.barycenter*a.weight+s.barycenter*s.weight)/(a.weight+s.weight),a.weight+=s.weight))}var a,s});var f=function(t,e){var r={};return Eo.forEach(t,function(t,e){var n=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};Eo.isUndefined(t.barycenter)||(n.barycenter=t.barycenter,n.weight=t.weight)}),Eo.forEach(e.edges(),function(t){var e=r[t.v],n=r[t.w];Eo.isUndefined(e)||Eo.isUndefined(n)||(n.indegree++,e.out.push(r[t.w]))}),function(t){var e=[];function r(t){return function(e){e.merged||(Eo.isUndefined(e.barycenter)||Eo.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&function(t,e){var r=0,n=0;t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=r/n,t.weight=n,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function n(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var o=t.pop();e.push(o),Eo.forEach(o.in.reverse(),r(o)),Eo.forEach(o.out,n(o))}return Eo.map(Eo.filter(e,function(t){return!t.merged}),function(t){return Eo.pick(t,["vs","i","barycenter","weight"])})}(Eo.filter(r,function(t){return!t.indegree}))}(c,n);!function(t,e){Eo.forEach(t,function(t){t.vs=Eo.flatten(t.vs.map(function(t){return e[t]?e[t].vs:t}),!0)})}(f,l);var h=function(t,e){var r,n=Ro.partition(t,function(t){return Eo.has(t,"barycenter")}),o=n.lhs,i=Eo.sortBy(n.rhs,function(t){return-t.i}),a=[],s=0,u=0,l=0;o.sort((r=!!e,function(t,e){return t.barycentere.barycenter?1:r?e.i-t.i:t.i-e.i})),l=_i(a,i,l),Eo.forEach(o,function(t){l+=t.vs.length,a.push(t.vs),s+=t.barycenter*t.weight,u+=t.weight,l=_i(a,i,l)});var c={vs:Eo.flatten(a,!0)};return u&&(c.barycenter=s/u,c.weight=u),c}(f,o);if(s&&(h.vs=Eo.flatten([s,h.vs,u],!0),e.predecessors(s).length)){var p=e.node(e.predecessors(s)[0]),d=e.node(e.predecessors(u)[0]);Eo.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+p.order+d.order)/(h.weight+2),h.weight+=2}return h},Oi=Un.Graph,Pi=function(t,e,r){var n=function(t){for(var e;t.hasNode(e=Eo.uniqueId("_root")););return e}(t),o=new Oi({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(e){return t.node(e)});return Eo.forEach(t.nodes(),function(i){var a=t.node(i),s=t.parent(i);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(o.setNode(i),o.setParent(i,s||n),Eo.forEach(t[r](i),function(e){var r=e.v===i?e.w:e.v,n=o.edge(r,i),a=Eo.isUndefined(n)?0:n.weight;o.setEdge(r,i,{weight:t.edge(e).weight+a})}),Eo.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),o},ki=function(t,e,r){var n,o={};Eo.forEach(r,function(r){for(var i,a,s=t.parent(r);s;){if((i=t.parent(s))?(a=o[i],o[i]=s):(a=n,n=s),a&&a!==s)return void e.setEdge(a,s);s=i}})},Ci=Un.Graph,Ti=function(t){var e=Ro.maxRank(t),r=Ai(t,Eo.range(1,e+1),"inEdges"),n=Ai(t,Eo.range(e-1,-1,-1),"outEdges"),o=function(t){var e={},r=Eo.filter(t.nodes(),function(e){return!t.children(e).length}),n=Eo.max(Eo.map(r,function(e){return t.node(e).rank})),o=Eo.map(Eo.range(n+1),function(){return[]});var i=Eo.sortBy(r,function(e){return t.node(e).rank});return Eo.forEach(i,function r(n){if(!Eo.has(e,n)){e[n]=!0;var i=t.node(n);o[i.rank].push(n),Eo.forEach(t.successors(n),r)}}),o}(t);ji(t,o);for(var i,a=Number.POSITIVE_INFINITY,s=0,u=0;u<4;++s,++u){Mi(s%2?r:n,s%4>=2),o=Ro.buildLayerMatrix(t);var l=Si(t,o);lr){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function Li(t,e,r){if(e>r){var n=e;e=r,r=n}return Eo.has(t[e],r)}var Ri=function(t){var e,r=Ro.buildLayerMatrix(t),n=Eo.merge(function(t,e){var r={};return Eo.reduce(e,function(e,n){var o=0,i=0,a=e.length,s=Eo.last(n);return Eo.forEach(n,function(e,u){var l=function(t,e){if(t.node(e).dummy)return Eo.find(t.predecessors(e),function(e){return t.node(e).dummy})}(t,e),c=l?t.node(l).order:a;(l||e===s)&&(Eo.forEach(n.slice(i,u+1),function(e){Eo.forEach(t.predecessors(e),function(n){var i=t.node(n),a=i.order;!(aa)&&Ni(r,e,s)})})}return Eo.reduce(e,function(e,r){var o,i=-1,a=0;return Eo.forEach(r,function(s,u){if("border"===t.node(s).dummy){var l=t.predecessors(s);l.length&&(o=t.node(l[0]).order,n(r,a,u,i,o),a=u,i=o)}n(r,a,r.length,o,e.length)}),r}),r}(t,r)),o={};Eo.forEach(["u","d"],function(i){e="u"===i?r:Eo.values(r).reverse(),Eo.forEach(["l","r"],function(r){"r"===r&&(e=Eo.map(e,function(t){return Eo.values(t).reverse()}));var a=("u"===i?t.predecessors:t.successors).bind(t),s=function(t,e,r,n){var o={},i={},a={};return Eo.forEach(e,function(t){Eo.forEach(t,function(t,e){o[t]=t,i[t]=t,a[t]=e})}),Eo.forEach(e,function(t){var e=-1;Eo.forEach(t,function(t){var s=n(t);if(s.length)for(var u=((s=Eo.sortBy(s,function(t){return a[t]})).length-1)/2,l=Math.floor(u),c=Math.ceil(u);l<=c;++l){var f=s[l];i[t]===t&&eu||l>e[o].lim));for(i=o,o=n;(o=t.parent(o))!==i;)s.push(o);return{path:a.concat(s.reverse()),lca:i}}(t,e,o.v,o.w),a=i.path,s=i.lca,u=0,l=a[u],c=!0;r!==o.w;){if(n=t.node(r),c){for(;(l=a[u])!==s&&t.node(l).maxRank1&&void 0!==arguments[1]?arguments[1]:{};d(this,t),this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=w.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=b.META,this.path=[],this.name=e,this.metaGraph=sa(e,S.META,r)}return h(t,[{key:"getFirstChild",value:function(){return this.metaGraph.node(this.metaGraph.nodes()[0])}},{key:"getChildren",value:function(){var t=this;return this.metaGraph.nodes().map(function(e){return t.metaGraph.node(e)})}},{key:"leaves",value:function(){for(var t,e=[],r=[this];r.length;){var n=r.shift();n.isGroupNode?(t=n.metaGraph).nodes().forEach(function(e){return r.push(t.node(e))}):e.push(n.name)}return e}}]),t}(),oa=function(){function t(e,r){d(this,t),this.v=e,this.w=r,this.baseEdgeList=[],this.inbound=null,this.name=null}return h(t,[{key:"addBaseEdge",value:function(t,e){this.baseEdgeList.push(t)}}]),t}();function ia(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new na(t,e)}function aa(t,e){return new oa(t,e)}function sa(t,e,r){var n=r||{},o=new $i.Graph(n);return o.setGraph({name:t,rankdir:n.rankdir,type:e,align:n.align}),o}var ua=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d(this,t),this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=ia(_,this.graphOptions),this.index[_]=this.root}return h(t,[{key:"getNodeMap",value:function(){return this.index}},{key:"node",value:function(t){return this.index[t]}},{key:"setNode",value:function(t,e){this.index[t]=e}},{key:"getBridgeGraph",value:function(t){var e=this,r=this.index[t];if(!r)throw Error("Could not find node in hierarchy: "+t);if(!("metaGraph"in r))return null;var n=r;if(n.bridgeGraph)return n.bridgeGraph;var o=sa(E,S.BRIDGE,this.graphOptions);if(n.bridgeGraph=o,!(r.parentNode&&"metaGraph"in r.parentNode))return o;var i=r.parentNode;return[i.metaGraph,this.getBridgeGraph(i.name)].forEach(function(r){r.edges().filter(function(e){return e.v===t||e.w===t}).forEach(function(n){var i=n.w===t;r.edge(n).baseEdgeList.forEach(function(r){var a=u(i?[r.w,n.v]:[r.v,n.w],2),s=a[0],l=a[1],c=e.getChildName(t,s),f={v:i?l:c,w:i?c:l},h=o.edge(f);h||((h=aa(f.v,f.w)).inbound=i,o.setEdge(f.v,f.w,h)),h.addBaseEdge(r,e)})})}),o}},{key:"getChildName",value:function(t,e){for(var r=this.index[e];r;){if(r.parentNode&&r.parentNode.name===t)return r.name;r=r.parentNode}throw Error("Could not find immediate child for descendant: "+e)}},{key:"getPredecessors",value:function(t){var e=this.index[t];if(!e)throw Error("Could not find node with name: "+t);return this.getOneWayEdges(e,!0)}},{key:"getSuccessors",value:function(t){var e=this.index[t];if(!e)throw Error("Could not find node with name: "+t);return this.getOneWayEdges(e,!1)}},{key:"getOneWayEdges",value:function(t,e){var r=[];if(!t.parentNode||!t.parentNode.isGroupNode)return r;var n=t.parentNode,o=n.metaGraph,i=this.getBridgeGraph(n.name);return la(o,t,e,r),la(i,t,e,r),r}}]),t}();function la(t,e,r,n){(r?t.inEdges(e.name):t.outEdges(e.name)).forEach(function(e){var r=t.edge(e);n.push(r)})}var ca=function(){function t(e){d(this,t),this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new pa(this.hierarchy.root,this.hierarchy.graphOptions),this.index[e.root.name]=this.root,this.buildSubHierarchy(e.root.name),this.root.expanded=!0}return h(t,[{key:"getRenderInfoNodes",value:function(){return Object.values(this.index)}},{key:"getSubHierarchy",value:function(){return this.hasSubHierarchy}},{key:"buildSubHierarchy",value:function(t){var e=this;if(!(t in this.hasSubHierarchy)){this.hasSubHierarchy[t]=!0;var r=this.index[t];if(r.node.type===b.META){var n=r,o=n.node.metaGraph,i=n.coreGraph;o.nodes().forEach(function(t){var r=e.getOrCreateRenderNodeByName(t);i.setNode(t,r)}),o.edges().forEach(function(t){var e=o.edge(t),r=new ha(e);i.setEdge(t.v,t.w,r)});var a=n.node.parentNode;if(a){var s=this.getRenderNodeByName(a.name),l=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n1&&void 0!==arguments[1]&&arguments[1];if(t.coreBox.width=t.width,t.coreBox.height=t.height,!e){var r="".concat(t.displayName).length;t.width=Math.max(t.coreBox.width,3*r)}}(t,e&&(0===t.node.type&&!!(null===(o=null===(n=null==e?void 0:e.nodeSize)||void 0===n?void 0:n.meta)||void 0===o?void 0:o.width)||1===t.node.type&&(!!(null===(a=null===(i=null==e?void 0:e.nodeSize)||void 0===i?void 0:i.node)||void 0===a?void 0:a.width)||!!f.width)||2===t.node.type&&!!(null===(u=null===(s=null==e?void 0:e.nodeSize)||void 0===s?void 0:s.bridge)||void 0===u?void 0:u.width)))}})}(t,e),t.node.type===b.META&&function(t,e){var r=g(e),n=r.subScene.meta;Object.assign(t,n);var o=r.graph.meta,i={nodesep:o.nodeSep,ranksep:o.rankSep,edgesep:o.edgeSep,align:o.align};Object.assign(t.coreBox,function(t,e){var r=e.ranksep,n=e.nodesep,o=e.edgesep,i=e.align;Object.assign(t.graph(),{ranksep:r,nodesep:n,edgesep:o,align:i});var a=[];if(t.nodes().forEach(function(e){t.node(e).node.type!==b.BRIDGE&&a.push(e)}),!a.length)return{width:0,height:0};ta(t);var s=1/0,u=1/0,l=-1/0,c=-1/0;return a.forEach(function(e){var r=t.node(e),n=.5*r.width,o=r.x-n,i=r.x+n;s=ol?i:l;var a=.5*r.height,f=r.y-a,h=r.y+a;u=fc?h:c}),t.edges().forEach(function(e){var r=t.edge(e),n=t.node(r.metaEdge.v),o=t.node(r.metaEdge.w);if(3===r.points.length&&function(t){for(var e=ya(t[0],t[1]),r=1;r1)return!1;e=n}return!0}(r.points)){if(null!=n){var i=n.expanded?n.x:va(n);r.points[0].x=i}if(null!=o){var a=o.expanded?o.x:va(o);r.points[2].x=a}r.points=[r.points[0],r.points[1]]}var f=r.points[r.points.length-2];null!=o&&(r.points[r.points.length-1]=ga(f,o));var h=r.points[1];null!=n&&(r.points[0]=ga(h,n)),r.points.forEach(function(t){s=t.xl?t.x:l,u=t.yc?t.y:c})}),t.nodes().forEach(function(e){var r=t.node(e);r.x-=s,r.y-=u}),t.edges().forEach(function(e){t.edge(e).points.forEach(function(t){t.x-=s,t.y-=u})}),{width:l-s,height:c-u}}(t.coreGraph,i));var a=0;t.coreGraph.nodeCount()>0&&a++;var s=a<=1?0:a;t.coreBox.width+=s+s,t.coreBox.height=n.labelHeight+t.coreBox.height,t.width=t.coreBox.width+n.paddingLeft+n.paddingRight,t.height=t.paddingTop+t.coreBox.height+t.paddingBottom}(t,e)}function ya(t,e){var r=e.x-t.x,n=e.y-t.y;return 180*Math.atan(n/r)/Math.PI}function va(t){return t.expanded?t.x:t.x-t.width/2+0+t.coreBox.width/2}function ga(t,e){var r,n,o=e.expanded?e.x:va(e),i=e.y,a=t.x-o,s=t.y-i,u=e.expanded?e.width:e.coreBox.width,l=e.expanded?e.height:e.coreBox.height;return Math.abs(s)*u/2>Math.abs(a)*l/2?(s<0&&(l=-l),r=0===s?0:l/2*a/s,n=l/2):(a<0&&(u=-u),r=u/2,n=0===a?0:u/2*s/a),{x:o+r,y:i+n}}function ma(t,e,r){var i,a,s,l,c=t.nodes.filter(function(t,e,r){return r.findIndex(function(e){return e.id===t.id})!==e}).map(function(t){return t.id});if(c.length)throw new Error("Duplicated ids found: ".concat(c.join(", ")));var f=function(t){var e={nodes:[]},r=t.compound,n=Object.keys(r||{}),i=new Map,a=function t(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(i.has(e))return i.get(e);for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:[];if(0===Object.keys(e).length)return o(new Set(i));var a,s=new Map(Object.keys(e).map(function(t){return[t,e[t]]})),l={},c=n(s);try{for(c.s();!(a=c.n()).done;){var f=u(a.value,2),h=f[0],p=f[1];r(h,s)?l[h]=p:i=i.concat(h,p)}}catch(t){c.e(t)}finally{c.f()}return t(l,i)}(t).filter(function(t){return e.includes(t)})}(t.compound||{},(null==e?void 0:e.expanded)||[]),p=function(t,e){return function(t){return new ca(t)}(function(t,e){var r=e.rankDirection,n=e.align,o=new ua({rankdir:r,align:n});return function(t,e){Object.keys(e.nodes).forEach(function(r){var n=e.nodes[r],o=n.path,i=t.root;i.depth=Math.max(o.length,i.depth);for(var a=0;a1&&void 0!==arguments[1]&&arguments[1],r=JSON.parse(JSON.stringify(t)),n={nodes:[r],edges:o(r.edges)};return r.nodes.forEach(function t(e){(0===e.type||1===e.type)&&n.nodes.push(e),0===e.type&&(n.edges=n.edges.concat(e.edges)),Array.isArray(e.nodes)&&e.nodes.forEach(t)}),e&&n.nodes.forEach(function(t){var e=n.nodes.find(function(e){return e.id===t.parentNodeName});if(e){var r=e.x-e.width/2+e.paddingLeft,o=e.y-e.height/2+e.labelHeight+e.paddingTop;e.id!==_&&(t.x+=r,t.y+=o),0===t.type&&t.edges.forEach(function(e){e.points.forEach(function(e){e.x+=t.x-t.width/2+t.paddingLeft,e.y+=t.y-t.height/2+t.labelHeight+t.paddingTop})})}}),n}function wa(t,e,r,n){var i,a,s=[],u=(null===(i=r.find(function(e){return e.id===t}))||void 0===i?void 0:i.path)||[],l=(null===(a=r.find(function(t){return t.id===e}))||void 0===a?void 0:a.path)||[],c=[_].concat(o(u)).slice(0,u.length).reverse(),f=[_].concat(o(l)).slice(0,l.length);return c.forEach(function(o){var i=r.find(function(t){return t.id===o});s=s.concat(i.edges.filter(function(r){return r.baseEdgeList.some(function(r){return r.v===((null==n?void 0:n.v)||t)&&r.w===((null==n?void 0:n.w)||e)})}))}),f.filter(function(t){return!c.includes(t)}).forEach(function(o){var i=r.find(function(t){return t.id===o});s=s.concat(i.edges.filter(function(r){return r.baseEdgeList.some(function(r){return r.v===((null==n?void 0:n.v)||t)&&r.w===((null==n?void 0:n.w)||e)})}))}),s}function Sa(t){var e,r=t.coreGraph.nodes().map(function(e){return t.coreGraph.node(e)});return Object.assign(Object.assign({},xa(t)),{expanded:t.expanded,nodes:t.expanded?(e=r,e.map(function(t){return t.node.type===b.META?Sa(t):xa(t)})):[],edges:t.expanded?function(t){return t.coreGraph.edges().map(function(e){return{renderInfoEdge:t.coreGraph.edge(e),edge:e}}).filter(function(t){var e=t.renderInfoEdge;return e.metaEdge}).map(function(e){var r=e.edge,n=e.renderInfoEdge,o=function(t,e){var r=e.points.map(function(t){return Object.assign({},t)});if(e.adjoiningMetaEdge){var n=e.adjoiningMetaEdge.points,o=e.metaEdge.inbound,i=o?n[n.length-1]:n[0],a=r[o?0:r.length-1],s=t.x-t.width/2,u=t.y-t.height/2,l=i.x-s,c=i.y-u,f=-t.paddingLeft,h=-(t.paddingTop+t.labelHeight);a.x=l+f,a.y=c+h}return r}(t,n);return{adjoiningEdge:n.adjoiningMetaEdge?{w:n.adjoiningMetaEdge.metaEdge.w,v:n.adjoiningMetaEdge.metaEdge.v}:null,inbound:n.metaEdge.inbound,w:r.w,v:r.v,points:o,weight:n.weight,baseEdgeList:n.metaEdge.baseEdgeList,parentNodeName:t.node.name}})}(t):[]})}function xa(t){return{id:t.node.name,name:t.node.name,type:t.node.type,cardinality:t.node.cardinality,attr:t.attr,parentNodeName:t.node.parentNode?t.node.parentNode.name:null,coreBox:Object.assign({},t.coreBox),x:t.x,y:t.y,width:t.width,height:t.height,radius:t.radius,labelHeight:t.labelHeight,labelOffset:t.labelOffset,outboxWidth:t.outboxWidth,paddingLeft:t.paddingLeft,paddingTop:t.paddingTop,paddingRight:t.paddingRight,paddingBottom:t.paddingBottom,path:t.node.path}}},304:function(t,e,r){"use strict";var n=r(2651),o=r(5045),i=r(3174);t.exports={XMLParser:o,XMLValidator:n,XMLBuilder:i}},6392:function(t,e){"use strict";var r=":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",n="["+r+"][: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\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",o=new RegExp("^"+n+"$");e.isExist=function(t){return void 0!==t},e.isEmptyObject=function(t){return 0===Object.keys(t).length},e.merge=function(t,e,r){if(e)for(var n=Object.keys(e),o=n.length,i=0;i5&&"xml"===n)return d("InvalidXml","XML declaration allowed only at the start of the document.",v(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function s(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){var r=1;for(e+=8;e"===t[e]&&0===--r)break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e"===t[e+2]){e+=2;break}return e}e.validate=function(t,e){e=Object.assign({},o,e);var r,u=[],l=!1,f=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(var y=0;y"!==t[y]&&" "!==t[y]&&"\t"!==t[y]&&"\n"!==t[y]&&"\r"!==t[y];y++)b+=t[y];if("/"===(b=b.trim())[b.length-1]&&(b=b.substring(0,b.length-1),y--),r=b,!n.isName(r)){return d("InvalidTag",0===b.trim().length?"Invalid space after '<'.":"Tag '"+b+"' is an invalid name.",v(t,y))}var w=c(t,y);if(!1===w)return d("InvalidAttr","Attributes for '"+b+"' have open quote.",v(t,y));var S=w.value;if(y=w.index,"/"===S[S.length-1]){var x=y-S.length,_=h(S=S.substring(0,S.length-1),e);if(!0!==_)return d(_.err.code,_.err.msg,v(t,x+_.err.line));l=!0}else if(m){if(!w.tagClosed)return d("InvalidTag","Closing tag '"+b+"' doesn't have proper closing.",v(t,y));if(S.trim().length>0)return d("InvalidTag","Closing tag '"+b+"' can't have attributes or invalid starting.",v(t,g));var E=u.pop();if(b!==E.tagName){var O=v(t,E.tagStartPos);return d("InvalidTag","Expected closing tag '"+E.tagName+"' (opened in line "+O.line+", col "+O.col+") instead of closing tag '"+b+"'.",v(t,g))}0==u.length&&(f=!0)}else{var P=h(S,e);if(!0!==P)return d(P.err.code,P.err.msg,v(t,y-S.length+P.err.line));if(!0===f)return d("InvalidXml","Multiple possible root nodes found.",v(t,y));-1!==e.unpairedTags.indexOf(b)||u.push({tagName:b,tagStartPos:g}),l=!0}for(y++;y0)||d("InvalidXml","Invalid '"+JSON.stringify(u.map(function(t){return t.tagName}),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):d("InvalidXml","Start tag expected.",1)};var u='"',l="'";function c(t,e){for(var r="",n="",o=!1;e"===t[e]&&""===n){o=!0;break}r+=t[e]}return""===n&&{value:r,index:e,tagClosed:o}}var f=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function h(t,e){for(var r=n.getAllMatches(t,f),o={},i=0;i","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function s(t){this.options=Object.assign({},a,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=c),this.processTextOrObjNode=u,this.options.format?(this.indentate=l,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function u(t,e,r){var n=this.j2x(t,r+1);return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}function l(t){return this.options.indentBy.repeat(t)}function c(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}s.prototype.build=function(t){return this.options.preserveOrder?i(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t=o({},this.options.arrayNodeName,t)),this.j2x(t,0).val)},s.prototype.j2x=function(t,e){var r="",o="";for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))if(void 0===t[i])this.isAttribute(i)&&(o+="");else if(null===t[i])this.isAttribute(i)?o+="":"?"===i[0]?o+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:o+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(t[i]instanceof Date)o+=this.buildTextValNode(t[i],i,"",e);else if("object"!==n(t[i])){var a=this.isAttribute(i);if(a)r+=this.buildAttrPairStr(a,""+t[i]);else if(i===this.options.textNodeName){var s=this.options.tagValueProcessor(i,""+t[i]);o+=this.replaceEntitiesValue(s)}else o+=this.buildTextValNode(t[i],i,"",e)}else if(Array.isArray(t[i])){for(var u=t[i].length,l="",c=0;c"+t+o},s.prototype.closeTag=function(t){var e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":">")+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(n)+"\x3c!--".concat(t,"--\x3e")+this.newLine;if("?"===e[0])return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;var o=this.options.tagValueProcessor(e,t);return""===(o=this.replaceEntitiesValue(o))?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+o+"0&&this.options.processEntities)for(var e=0;e0&&e.processEntities)for(var r=0;r0&&(s=e),function t(e,a,s,u){for(var l="",c=!1,f=0;f":l+=g+"/>":m&&0!==m.length||!a.suppressEmptyNode?m&&m.endsWith(">")?l+=g+">".concat(m).concat(u,""):(l+=g+">",m&&""!==u&&(m.includes("/>")||m.includes("")):l+=g+"/>",c=!0}else{var b=n(h[":@"],a),w="?xml"===p?"":u,S=h[p][0][a.textNodeName];S=0!==S.length?" "+S:"",l+=w+"<".concat(p).concat(S).concat(b,"?>"),c=!0}else l+=u+"\x3c!--".concat(h[p][0][a.textNodeName],"--\x3e"),c=!0;else c&&(l+=u),l+=""),c=!1;else{var x=h[p];o(d,a)||(x=i(x=a.tagValueProcessor(p,x),a)),c&&(l+=u),l+=x,c=!1}}}return l}(t,a,"",s)}},3214:function(t,e,r){function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r"===t[e]){if(p?"-"===t[e-1]&&"-"===t[e-2]&&(p=!1,o--):o--,0===o)break}else"["===t[e]?i=!0:t[e];else{if(i&&u(t,e)){var d=n(a(t,(e+=7)+1),3);entityName=d[0],val=d[1],e=d[2],-1===val.indexOf("&")&&(r[h(entityName)]={regx:RegExp("&".concat(entityName,";"),"g"),val:val})}else if(i&&l(t,e))e+=8;else if(i&&c(t,e))e+=8;else if(i&&f(t,e))e+=9;else{if(!s)throw new Error("Invalid DOCTYPE");p=!0}o++}if(0!==o)throw new Error("Unclosed DOCTYPE");return{entities:r,i:e}}},3070:function(t,e){var r={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:function(){return!1},commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}};e.buildOptions=function(t){return Object.assign({},r,t)},e.defaultOptions=r},2246:function(t,e,r){"use strict";function n(t,e,r){return(e=a(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){"@babel/helpers - typeof";return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"}},this.addExternalEntities=h,this.parseXml=g,this.parseTextData=p,this.resolveNameSpace=d,this.buildAttributesMap=v,this.isItStopNode=S,this.replaceEntitiesValue=b,this.readStopNodeData=E,this.saveTextToParentTag=w,this.addChild=m});function h(t){for(var e=Object.keys(t),r=0;r0)){s||(t=this.replaceEntitiesValue(t));var u=this.options.tagValueProcessor(e,t,r,i,a);return null===u||void 0===u?t:o(u)!==o(t)||u!==t?u:this.options.trimValues?O(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?O(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function d(t){if(this.options.removeNSPrefix){var e=t.split(":"),r="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=r+e[1])}return t}var y=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function v(t,e,r){if(!this.options.ignoreAttributes&&"string"==typeof t){for(var n=s.getAllMatches(t,y),i=n.length,a={},u=0;u",a,"Closing Tag is not closed."),c=t.substring(a+2,s).trim();if(this.options.removeNSPrefix){var f=c.indexOf(":");-1!==f&&(c=c.substr(f+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&(o=this.saveTextToParentTag(o,r,i));var h=i.substring(i.lastIndexOf(".")+1);if(c&&-1!==this.options.unpairedTags.indexOf(c))throw new Error("Unpaired tag can not be used as closing tag: "));var p=0;h&&-1!==this.options.unpairedTags.indexOf(h)?(p=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=i.lastIndexOf("."),i=i.substring(0,p),r=this.tagsNodeStack.pop(),o="",a=s}else if("?"===t[a+1]){var d=_(t,a,!1,"?>");if(!d)throw new Error("Pi Tag is not closed.");if(o=this.saveTextToParentTag(o,r,i),this.options.ignoreDeclaration&&"?xml"===d.tagName||this.options.ignorePiTags);else{var y=new u(d.tagName);y.add(this.options.textNodeName,""),d.tagName!==d.tagExp&&d.attrExpPresent&&(y[":@"]=this.buildAttributesMap(d.tagExp,i,d.tagName)),this.addChild(r,y,i)}a=d.closeIndex+1}else if("!--"===t.substr(a+1,3)){var v=x(t,"--\x3e",a+4,"Comment is not closed.");if(this.options.commentPropName){var g=t.substring(a+4,v-2);o=this.saveTextToParentTag(o,r,i),r.add(this.options.commentPropName,[n({},this.options.textNodeName,g)])}a=v}else if("!D"===t.substr(a+1,2)){var m=l(t,a);this.docTypeEntities=m.entities,a=m.i}else if("!["===t.substr(a+1,2)){var b=x(t,"]]>",a,"CDATA is not closed.")-2,w=t.substring(a+9,b);o=this.saveTextToParentTag(o,r,i);var S=this.parseTextData(w,r.tagname,i,!0,!1,!0,!0);void 0==S&&(S=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[n({},this.options.textNodeName,w)]):r.add(this.options.textNodeName,S),a=b+2}else{var E=_(t,a,this.options.removeNSPrefix),O=E.tagName,P=E.rawTagName,k=E.tagExp,C=E.attrExpPresent,T=E.closeIndex;this.options.transformTagName&&(O=this.options.transformTagName(O)),r&&o&&"!xml"!==r.tagname&&(o=this.saveTextToParentTag(o,r,i,!1));var A=r;if(A&&-1!==this.options.unpairedTags.indexOf(A.tagname)&&(r=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),O!==e.tagname&&(i+=i?"."+O:O),this.isItStopNode(this.options.stopNodes,i,O)){var M="";if(k.length>0&&k.lastIndexOf("/")===k.length-1)a=E.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(O))a=E.closeIndex;else{var j=this.readStopNodeData(t,P,T+1);if(!j)throw new Error("Unexpected end of ".concat(P));a=j.i,M=j.tagContent}var I=new u(O);O!==k&&C&&(I[":@"]=this.buildAttributesMap(k,i,O)),M&&(M=this.parseTextData(M,O,i,!0,C,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),I.add(this.options.textNodeName,M),this.addChild(r,I,i)}else{if(k.length>0&&k.lastIndexOf("/")===k.length-1){"/"===O[O.length-1]?(O=O.substr(0,O.length-1),i=i.substr(0,i.length-1),k=O):k=k.substr(0,k.length-1),this.options.transformTagName&&(O=this.options.transformTagName(O));var N=new u(O);O!==k&&C&&(N[":@"]=this.buildAttributesMap(k,i,O)),this.addChild(r,N,i),i=i.substr(0,i.lastIndexOf("."))}else{var L=new u(O);this.tagsNodeStack.push(r),O!==k&&C&&(L[":@"]=this.buildAttributesMap(k,i,O)),this.addChild(r,L,i),r=L}o="",a=T}}else o+=t[a]}return e.child};function m(t,e,r){var n=this.options.updateTag(e.tagname,r,e[":@"]);!1===n||("string"==typeof n?(e.tagname=n,t.addChild(e)):t.addChild(e))}var b=function(t){if(this.options.processEntities){for(var e in this.docTypeEntities){var r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(var n in this.lastEntities){var o=this.lastEntities[n];t=t.replace(o.regex,o.val)}if(this.options.htmlEntities)for(var i in this.htmlEntities){var a=this.htmlEntities[i];t=t.replace(a.regex,a.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function w(t,e,r,n){return t&&(void 0===n&&(n=0===Object.keys(e.child).length),void 0!==(t=this.parseTextData(t,e.tagname,r,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,n))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function S(t,e,r){var n="*."+r;for(var o in t){var i=t[o];if(n===i||e===i)return!0}return!1}function x(t,e,r,n){var o=t.indexOf(e,r);if(-1===o)throw new Error(n);return o+e.length-1}function _(t,e,r){var n=function(t,e){for(var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",o="",i=e;i3&&void 0!==arguments[3]?arguments[3]:">");if(n){var o=n.data,i=n.index,a=o.search(/\s/),s=o,u=!0;-1!==a&&(s=o.substring(0,a),o=o.substring(a+1).trimStart());var l=s;if(r){var c=s.indexOf(":");-1!==c&&(u=(s=s.substr(c+1))!==n.data.substr(c+1))}return{tagName:s,tagExp:o,closeIndex:i,attrExpPresent:u,rawTagName:l}}}function E(t,e,r){for(var n=r,o=1;r",r,"".concat(e," is not closed"));if(t.substring(r+2,i).trim()===e&&0===--o)return{tagContent:t.substring(n,r),i:i};r=i}else if("?"===t[r+1]){r=x(t,"?>",r+1,"StopNode is not closed.")}else if("!--"===t.substr(r+1,3)){r=x(t,"--\x3e",r+3,"StopNode is not closed.")}else if("!["===t.substr(r+1,2)){r=x(t,"]]>",r,"StopNode is not closed.")-2}else{var a=_(t,r,">");if(a)(a&&a.tagName)===e&&"/"!==a.tagExp[a.tagExp.length-1]&&o++,r=a.closeIndex}}function O(t,e,r){if(e&&"string"==typeof t){var n=t.trim();return"true"===n||"false"!==n&&c(t,r)}return s.isExist(t)?t:""}t.exports=f},5045:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r0&&(u[i.textNodeName]=s):void 0!==s&&(u[i.textNodeName]=s),u}(t,e)}},4670:function(t){"use strict";function e(t){"@babel/helpers - typeof";return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e,r){return(e=o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(t,e){for(var r=0;r0?this.child.push(r(r({},t.tagname,t.child),":@",t[":@"])):this.child.push(r({},t.tagname,t.child))}}])&&n(e.prototype,o),i&&n(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();t.exports=i},1358:function(t){!function(e){"use strict";if(e.__disableNativeFetch||!e.fetch){s.prototype.append=function(t,e){t=i(t),e=a(e);var r=this.map[t];r||(r=[],this.map[t]=r),r.push(e)},s.prototype.delete=function(t){delete this.map[i(t)]},s.prototype.get=function(t){var e=this.map[i(t)];return e?e[0]:null},s.prototype.getAll=function(t){return this.map[i(t)]||[]},s.prototype.has=function(t){return this.map.hasOwnProperty(i(t))},s.prototype.set=function(t,e){this.map[i(t)]=[a(e)]},s.prototype.forEach=function(t,e){Object.getOwnPropertyNames(this.map).forEach(function(r){this.map[r].forEach(function(n){t.call(e,n,r,this)},this)},this)};var r={blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e},n=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];h.prototype.clone=function(){return new h(this)},f.call(h.prototype),f.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new s(this.headers),url:this.url})},d.error=function(){var t=new d(null,{status:0,statusText:""});return t.type="error",t};var o=[301,302,303,307,308];d.redirect=function(t,e){if(-1===o.indexOf(e))throw new RangeError("Invalid status code");return new d(null,{status:e,headers:{location:t}})},e.Headers=s,e.Request=h,e.Response=d,e.fetch=function(t,e){return new Promise(function(n,o){var i;i=h.prototype.isPrototypeOf(t)&&!e?t:new h(t,e);var a=new XMLHttpRequest;var u=!1;function l(){if(4===a.readyState){var t=1223===a.status?204:a.status;if(t<100||t>599){if(u)return;return u=!0,void o(new TypeError("Network request failed"))}var e={status:t,statusText:a.statusText,headers:function(t){var e=new s;return t.getAllResponseHeaders().trim().split("\n").forEach(function(t){var r=t.trim().split(":"),n=r.shift().trim(),o=r.join(":").trim();e.append(n,o)}),e}(a),url:"responseURL"in a?a.responseURL:/^X-Request-URL:/m.test(a.getAllResponseHeaders())?a.getResponseHeader("X-Request-URL"):void 0},r="response"in a?a.response:a.responseText;u||(u=!0,n(new d(r,e)))}}a.onreadystatechange=l,a.onload=l,a.onerror=function(){u||(u=!0,o(new TypeError("Network request failed")))},a.open(i.method,i.url,!0);try{"include"===i.credentials&&("withCredentials"in a?a.withCredentials=!0:console&&console.warn&&console.warn("withCredentials is not supported, you can ignore this warning"))}catch(t){console&&console.warn&&console.warn("set withCredentials error:"+t)}"responseType"in a&&r.blob&&(a.responseType="blob"),i.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),a.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0,t.exports&&(t.exports=e.fetch)}function i(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){this.map={},t instanceof s?t.forEach(function(t,e){this.append(e,t)},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function u(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function c(t){var e=new FileReader;return e.readAsArrayBuffer(t),l(e)}function f(){return this.bodyUsed=!1,this._initBody=function(t,e){if(this._bodyInit=t,"string"==typeof t)this._bodyText=t;else if(r.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t,this._options=e;else if(r.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(t){if(!r.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t))throw new Error("unsupported BodyInit type")}else this._bodyText=""},r.blob?(this.blob=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(c)},this.text=function(){var t,e,r,n,o,i,a,s=u(this);if(s)return s;if(this._bodyBlob)return t=this._bodyBlob,e=this._options,r=new FileReader,n=e.headers.map["content-type"]?e.headers.map["content-type"].toString():"",o=/charset\=[0-9a-zA-Z\-\_]*;?/,i=t.type.match(o)||n.match(o),a=[t],i&&a.push(i[0].replace(/^charset\=/,"").replace(/;$/,"")),r.readAsText.apply(r,a),l(r);if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)}):this.text=function(){var t=u(this);return t||Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(p)}),this.json=function(){return this.text().then(JSON.parse)},this}function h(t,e){var r,o,i=(e=e||{}).body;if(h.prototype.isPrototypeOf(t)){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new s(t.headers)),this.method=t.method,this.mode=t.mode,i||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=t;if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new s(e.headers)),this.method=(r=e.method||this.method||"GET",o=r.toUpperCase(),n.indexOf(o)>-1?o:r),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i,e)}function p(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function d(t,e){e||(e={}),this._initBody(t,e),this.type="default",this.status=e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText,this.headers=e.headers instanceof s?e.headers:new s(e.headers),this.url=e.url||""}}("undefined"!=typeof self?self:this)},3678:function(t,e){var r,n,o;n=[e,t],void 0===(o="function"==typeof(r=function(t,e){"use strict";var r={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function n(t){try{delete window[t]}catch(e){window[t]=void 0}}function o(t){var e=document.getElementById(t);e&&document.getElementsByTagName("head")[0].removeChild(e)}e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t,a=e.timeout||r.timeout,s=e.jsonpCallback||r.jsonpCallback,u=void 0;return new Promise(function(r,l){var c=e.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),f=s+"_"+c;window[c]=function(t){r({ok:!0,json:function(){return Promise.resolve(t)}}),u&&clearTimeout(u),o(f),n(c)},i+=-1===i.indexOf("?")?"?":"&";var h=document.createElement("script");h.setAttribute("src",""+i+s+"="+c),e.charset&&h.setAttribute("charset",e.charset),h.id=f,document.getElementsByTagName("head")[0].appendChild(h),u=setTimeout(function(){l(new Error("JSONP request to "+t+" timed out")),n(c),o(f),window[c]=function(){n(c)}},a),h.onerror=function(){l(new Error("JSONP request to "+t+" failed")),n(c),o(f),u&&clearTimeout(u)}})}})?r.apply(e,n):r)||(t.exports=o)},5629:function(t,e,r){"use strict";r.r(e),r.d(e,{ARRAY_TYPE:function(){return o},EPSILON:function(){return n},RANDOM:function(){return i},equals:function(){return l},setMatrixArrayType:function(){return a},toRadian:function(){return u}});var n=1e-6,o="undefined"!=typeof Float32Array?Float32Array:Array,i=Math.random;function a(t){o=t}var s=Math.PI/180;function u(t){return t*s}function l(t,e){return Math.abs(t-e)<=n*Math.max(1,Math.abs(t),Math.abs(e))}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)})},621:function(t,e,r){"use strict";r.r(e),r.d(e,{glMatrix:function(){return l},mat2:function(){return n},mat2d:function(){return o},mat3:function(){return st},mat4:function(){return i},quat:function(){return s},quat2:function(){return u},vec2:function(){return On},vec3:function(){return ie},vec4:function(){return a}});var n={};r.r(n),r.d(n,{LDU:function(){return k},add:function(){return C},adjoint:function(){return m},clone:function(){return f},copy:function(){return h},create:function(){return c},determinant:function(){return b},equals:function(){return M},exactEquals:function(){return A},frob:function(){return P},fromRotation:function(){return _},fromScaling:function(){return E},fromValues:function(){return d},identity:function(){return p},invert:function(){return g},mul:function(){return N},multiply:function(){return w},multiplyScalar:function(){return j},multiplyScalarAndAdd:function(){return I},rotate:function(){return S},scale:function(){return x},set:function(){return y},str:function(){return O},sub:function(){return L},subtract:function(){return T},transpose:function(){return v}});var o={};r.r(o),r.d(o,{add:function(){return $},clone:function(){return D},copy:function(){return B},create:function(){return R},determinant:function(){return V},equals:function(){return ot},exactEquals:function(){return nt},frob:function(){return Z},fromRotation:function(){return X},fromScaling:function(){return J},fromTranslation:function(){return K},fromValues:function(){return G},identity:function(){return F},invert:function(){return z},mul:function(){return it},multiply:function(){return H},multiplyScalar:function(){return et},multiplyScalarAndAdd:function(){return rt},rotate:function(){return q},scale:function(){return W},set:function(){return U},str:function(){return Q},sub:function(){return at},subtract:function(){return tt},translate:function(){return Y}});var i={};r.r(i),r.d(i,{add:function(){return Qt},adjoint:function(){return vt},clone:function(){return lt},copy:function(){return ct},create:function(){return ut},determinant:function(){return gt},equals:function(){return re},exactEquals:function(){return ee},frob:function(){return Kt},fromQuat:function(){return Bt},fromQuat2:function(){return jt},fromRotation:function(){return kt},fromRotationTranslation:function(){return Mt},fromRotationTranslationScale:function(){return Rt},fromRotationTranslationScaleOrigin:function(){return Dt},fromScaling:function(){return Pt},fromTranslation:function(){return Ot},fromValues:function(){return ft},fromXRotation:function(){return Ct},fromYRotation:function(){return Tt},fromZRotation:function(){return At},frustum:function(){return Ft},getRotation:function(){return Lt},getScaling:function(){return Nt},getTranslation:function(){return It},identity:function(){return pt},invert:function(){return yt},lookAt:function(){return Yt},mul:function(){return ne},multiply:function(){return mt},multiplyScalar:function(){return $t},multiplyScalarAndAdd:function(){return te},ortho:function(){return qt},orthoNO:function(){return Ht},orthoZO:function(){return Wt},perspective:function(){return Ut},perspectiveFromFieldOfView:function(){return Vt},perspectiveNO:function(){return Gt},perspectiveZO:function(){return zt},rotate:function(){return St},rotateX:function(){return xt},rotateY:function(){return _t},rotateZ:function(){return Et},scale:function(){return wt},set:function(){return ht},str:function(){return Jt},sub:function(){return oe},subtract:function(){return Zt},targetTo:function(){return Xt},translate:function(){return bt},transpose:function(){return dt}});var a={};r.r(a),r.d(a,{add:function(){return fe},ceil:function(){return ye},clone:function(){return se},copy:function(){return le},create:function(){return ae},cross:function(){return Ae},dist:function(){return Ve},distance:function(){return xe},div:function(){return ze},divide:function(){return de},dot:function(){return Te},equals:function(){return Be},exactEquals:function(){return De},floor:function(){return ve},forEach:function(){return Ye},fromValues:function(){return ue},inverse:function(){return ke},len:function(){return qe},length:function(){return Ee},lerp:function(){return Me},max:function(){return me},min:function(){return ge},mul:function(){return Ue},multiply:function(){return pe},negate:function(){return Pe},normalize:function(){return Ce},random:function(){return je},round:function(){return be},scale:function(){return we},scaleAndAdd:function(){return Se},set:function(){return ce},sqrDist:function(){return He},sqrLen:function(){return We},squaredDistance:function(){return _e},squaredLength:function(){return Oe},str:function(){return Re},sub:function(){return Ge},subtract:function(){return he},transformMat4:function(){return Ie},transformQuat:function(){return Ne},zero:function(){return Le}});var s={};r.r(s),r.d(s,{add:function(){return Er},calculateW:function(){return nr},clone:function(){return wr},conjugate:function(){return cr},copy:function(){return xr},create:function(){return Xe},dot:function(){return kr},equals:function(){return Lr},exactEquals:function(){return Nr},exp:function(){return or},fromEuler:function(){return hr},fromMat3:function(){return fr},fromValues:function(){return Sr},getAngle:function(){return Ze},getAxisAngle:function(){return Qe},identity:function(){return Je},invert:function(){return lr},len:function(){return Ar},length:function(){return Tr},lerp:function(){return Cr},ln:function(){return ir},mul:function(){return Or},multiply:function(){return $e},normalize:function(){return Ir},pow:function(){return ar},random:function(){return ur},rotateX:function(){return tr},rotateY:function(){return er},rotateZ:function(){return rr},rotationTo:function(){return Rr},scale:function(){return Pr},set:function(){return _r},setAxes:function(){return Br},setAxisAngle:function(){return Ke},slerp:function(){return sr},sqlerp:function(){return Dr},sqrLen:function(){return jr},squaredLength:function(){return Mr},str:function(){return pr}});var u={};r.r(u),r.d(u,{add:function(){return ln},clone:function(){return Gr},conjugate:function(){return vn},copy:function(){return Yr},create:function(){return Fr},dot:function(){return pn},equals:function(){return En},exactEquals:function(){return _n},fromMat4:function(){return Wr},fromRotation:function(){return qr},fromRotationTranslation:function(){return Vr},fromRotationTranslationValues:function(){return zr},fromTranslation:function(){return Hr},fromValues:function(){return Ur},getDual:function(){return Qr},getReal:function(){return Kr},getTranslation:function(){return tn},identity:function(){return Xr},invert:function(){return yn},len:function(){return mn},length:function(){return gn},lerp:function(){return dn},mul:function(){return fn},multiply:function(){return cn},normalize:function(){return Sn},rotateAroundAxis:function(){return un},rotateByQuatAppend:function(){return an},rotateByQuatPrepend:function(){return sn},rotateX:function(){return rn},rotateY:function(){return nn},rotateZ:function(){return on},scale:function(){return hn},set:function(){return Jr},setDual:function(){return $r},setReal:function(){return Zr},sqrLen:function(){return wn},squaredLength:function(){return bn},str:function(){return xn},translate:function(){return en}});var l=r(5629);function c(){var t=new l.ARRAY_TYPE(4);return l.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function f(t){var e=new l.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function h(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function p(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function d(t,e,r,n){var o=new l.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=r,o[3]=n,o}function y(t,e,r,n,o){return t[0]=e,t[1]=r,t[2]=n,t[3]=o,t}function v(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function g(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=r*i-o*n;return a?(a=1/a,t[0]=i*a,t[1]=-n*a,t[2]=-o*a,t[3]=r*a,t):null}function m(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t}function b(t){return t[0]*t[3]-t[2]*t[1]}function w(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=r[0],u=r[1],l=r[2],c=r[3];return t[0]=n*s+i*u,t[1]=o*s+a*u,t[2]=n*l+i*c,t[3]=o*l+a*c,t}function S(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+i*s,t[1]=o*u+a*s,t[2]=n*-s+i*u,t[3]=o*-s+a*u,t}function x(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=r[0],u=r[1];return t[0]=n*s,t[1]=o*s,t[2]=i*u,t[3]=a*u,t}function _(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t}function E(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function O(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function P(t){return Math.hypot(t[0],t[1],t[2],t[3])}function k(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]}function C(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function T(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function A(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function M(t,e){var r=t[0],n=t[1],o=t[2],i=t[3],a=e[0],s=e[1],u=e[2],c=e[3];return Math.abs(r-a)<=l.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=l.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(o-u)<=l.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(i-c)<=l.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))}function j(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function I(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}var N=w,L=T;function R(){var t=new l.ARRAY_TYPE(6);return l.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function D(t){var e=new l.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function B(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function F(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function G(t,e,r,n,o,i){var a=new l.ARRAY_TYPE(6);return a[0]=t,a[1]=e,a[2]=r,a[3]=n,a[4]=o,a[5]=i,a}function U(t,e,r,n,o,i,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=o,t[4]=i,t[5]=a,t}function z(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=r*i-n*o;return u?(u=1/u,t[0]=i*u,t[1]=-n*u,t[2]=-o*u,t[3]=r*u,t[4]=(o*s-i*a)*u,t[5]=(n*a-r*s)*u,t):null}function V(t){return t[0]*t[3]-t[1]*t[2]}function H(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],l=r[0],c=r[1],f=r[2],h=r[3],p=r[4],d=r[5];return t[0]=n*l+i*c,t[1]=o*l+a*c,t[2]=n*f+i*h,t[3]=o*f+a*h,t[4]=n*p+i*d+s,t[5]=o*p+a*d+u,t}function q(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],l=Math.sin(r),c=Math.cos(r);return t[0]=n*c+i*l,t[1]=o*c+a*l,t[2]=n*-l+i*c,t[3]=o*-l+a*c,t[4]=s,t[5]=u,t}function W(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],l=r[0],c=r[1];return t[0]=n*l,t[1]=o*l,t[2]=i*c,t[3]=a*c,t[4]=s,t[5]=u,t}function Y(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],l=r[0],c=r[1];return t[0]=n,t[1]=o,t[2]=i,t[3]=a,t[4]=n*l+i*c+s,t[5]=o*l+a*c+u,t}function X(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=0,t[5]=0,t}function J(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function K(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function Q(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function Z(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)}function $(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t}function tt(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t}function et(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t}function rt(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t}function nt(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function ot(t,e){var r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],s=t[5],u=e[0],c=e[1],f=e[2],h=e[3],p=e[4],d=e[5];return Math.abs(r-u)<=l.EPSILON*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(n-c)<=l.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(o-f)<=l.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(i-h)<=l.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-p)<=l.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(s-d)<=l.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))}var it=H,at=tt,st=r(9019);function ut(){var t=new l.ARRAY_TYPE(16);return l.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function lt(t){var e=new l.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ct(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function ft(t,e,r,n,o,i,a,s,u,c,f,h,p,d,y,v){var g=new l.ARRAY_TYPE(16);return g[0]=t,g[1]=e,g[2]=r,g[3]=n,g[4]=o,g[5]=i,g[6]=a,g[7]=s,g[8]=u,g[9]=c,g[10]=f,g[11]=h,g[12]=p,g[13]=d,g[14]=y,g[15]=v,g}function ht(t,e,r,n,o,i,a,s,u,l,c,f,h,p,d,y,v){return t[0]=e,t[1]=r,t[2]=n,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t[8]=l,t[9]=c,t[10]=f,t[11]=h,t[12]=p,t[13]=d,t[14]=y,t[15]=v,t}function pt(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function dt(t,e){if(t===e){var r=e[1],n=e[2],o=e[3],i=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[11]=e[14],t[12]=o,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function yt(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],h=e[10],p=e[11],d=e[12],y=e[13],v=e[14],g=e[15],m=r*s-n*a,b=r*u-o*a,w=r*l-i*a,S=n*u-o*s,x=n*l-i*s,_=o*l-i*u,E=c*y-f*d,O=c*v-h*d,P=c*g-p*d,k=f*v-h*y,C=f*g-p*y,T=h*g-p*v,A=m*T-b*C+w*k+S*P-x*O+_*E;return A?(A=1/A,t[0]=(s*T-u*C+l*k)*A,t[1]=(o*C-n*T-i*k)*A,t[2]=(y*_-v*x+g*S)*A,t[3]=(h*x-f*_-p*S)*A,t[4]=(u*P-a*T-l*O)*A,t[5]=(r*T-o*P+i*O)*A,t[6]=(v*w-d*_-g*b)*A,t[7]=(c*_-h*w+p*b)*A,t[8]=(a*C-s*P+l*E)*A,t[9]=(n*P-r*C-i*E)*A,t[10]=(d*x-y*w+g*m)*A,t[11]=(f*w-c*x-p*m)*A,t[12]=(s*O-a*k-u*E)*A,t[13]=(r*k-n*O+o*E)*A,t[14]=(y*b-d*S-v*m)*A,t[15]=(c*S-f*b+h*m)*A,t):null}function vt(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],h=e[10],p=e[11],d=e[12],y=e[13],v=e[14],g=e[15];return t[0]=s*(h*g-p*v)-f*(u*g-l*v)+y*(u*p-l*h),t[1]=-(n*(h*g-p*v)-f*(o*g-i*v)+y*(o*p-i*h)),t[2]=n*(u*g-l*v)-s*(o*g-i*v)+y*(o*l-i*u),t[3]=-(n*(u*p-l*h)-s*(o*p-i*h)+f*(o*l-i*u)),t[4]=-(a*(h*g-p*v)-c*(u*g-l*v)+d*(u*p-l*h)),t[5]=r*(h*g-p*v)-c*(o*g-i*v)+d*(o*p-i*h),t[6]=-(r*(u*g-l*v)-a*(o*g-i*v)+d*(o*l-i*u)),t[7]=r*(u*p-l*h)-a*(o*p-i*h)+c*(o*l-i*u),t[8]=a*(f*g-p*y)-c*(s*g-l*y)+d*(s*p-l*f),t[9]=-(r*(f*g-p*y)-c*(n*g-i*y)+d*(n*p-i*f)),t[10]=r*(s*g-l*y)-a*(n*g-i*y)+d*(n*l-i*s),t[11]=-(r*(s*p-l*f)-a*(n*p-i*f)+c*(n*l-i*s)),t[12]=-(a*(f*v-h*y)-c*(s*v-u*y)+d*(s*h-u*f)),t[13]=r*(f*v-h*y)-c*(n*v-o*y)+d*(n*h-o*f),t[14]=-(r*(s*v-u*y)-a*(n*v-o*y)+d*(n*u-o*s)),t[15]=r*(s*h-u*f)-a*(n*h-o*f)+c*(n*u-o*s),t}function gt(t){var e=t[0],r=t[1],n=t[2],o=t[3],i=t[4],a=t[5],s=t[6],u=t[7],l=t[8],c=t[9],f=t[10],h=t[11],p=t[12],d=t[13],y=t[14],v=t[15];return(e*a-r*i)*(f*v-h*y)-(e*s-n*i)*(c*v-h*d)+(e*u-o*i)*(c*y-f*d)+(r*s-n*a)*(l*v-h*p)-(r*u-o*a)*(l*y-f*p)+(n*u-o*s)*(l*d-c*p)}function mt(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],h=e[9],p=e[10],d=e[11],y=e[12],v=e[13],g=e[14],m=e[15],b=r[0],w=r[1],S=r[2],x=r[3];return t[0]=b*n+w*s+S*f+x*y,t[1]=b*o+w*u+S*h+x*v,t[2]=b*i+w*l+S*p+x*g,t[3]=b*a+w*c+S*d+x*m,b=r[4],w=r[5],S=r[6],x=r[7],t[4]=b*n+w*s+S*f+x*y,t[5]=b*o+w*u+S*h+x*v,t[6]=b*i+w*l+S*p+x*g,t[7]=b*a+w*c+S*d+x*m,b=r[8],w=r[9],S=r[10],x=r[11],t[8]=b*n+w*s+S*f+x*y,t[9]=b*o+w*u+S*h+x*v,t[10]=b*i+w*l+S*p+x*g,t[11]=b*a+w*c+S*d+x*m,b=r[12],w=r[13],S=r[14],x=r[15],t[12]=b*n+w*s+S*f+x*y,t[13]=b*o+w*u+S*h+x*v,t[14]=b*i+w*l+S*p+x*g,t[15]=b*a+w*c+S*d+x*m,t}function bt(t,e,r){var n,o,i,a,s,u,l,c,f,h,p,d,y=r[0],v=r[1],g=r[2];return e===t?(t[12]=e[0]*y+e[4]*v+e[8]*g+e[12],t[13]=e[1]*y+e[5]*v+e[9]*g+e[13],t[14]=e[2]*y+e[6]*v+e[10]*g+e[14],t[15]=e[3]*y+e[7]*v+e[11]*g+e[15]):(n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],h=e[9],p=e[10],d=e[11],t[0]=n,t[1]=o,t[2]=i,t[3]=a,t[4]=s,t[5]=u,t[6]=l,t[7]=c,t[8]=f,t[9]=h,t[10]=p,t[11]=d,t[12]=n*y+s*v+f*g+e[12],t[13]=o*y+u*v+h*g+e[13],t[14]=i*y+l*v+p*g+e[14],t[15]=a*y+c*v+d*g+e[15]),t}function wt(t,e,r){var n=r[0],o=r[1],i=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function St(t,e,r,n){var o,i,a,s,u,c,f,h,p,d,y,v,g,m,b,w,S,x,_,E,O,P,k,C,T=n[0],A=n[1],M=n[2],j=Math.hypot(T,A,M);return j0?(r[0]=2*(s*a+f*n+u*i-c*o)/h,r[1]=2*(u*a+f*o+c*n-s*i)/h,r[2]=2*(c*a+f*i+s*o-u*n)/h):(r[0]=2*(s*a+f*n+u*i-c*o),r[1]=2*(u*a+f*o+c*n-s*i),r[2]=2*(c*a+f*i+s*o-u*n)),Mt(t,e,r),t}function It(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Nt(t,e){var r=e[0],n=e[1],o=e[2],i=e[4],a=e[5],s=e[6],u=e[8],l=e[9],c=e[10];return t[0]=Math.hypot(r,n,o),t[1]=Math.hypot(i,a,s),t[2]=Math.hypot(u,l,c),t}function Lt(t,e){var r=new l.ARRAY_TYPE(3);Nt(r,e);var n=1/r[0],o=1/r[1],i=1/r[2],a=e[0]*n,s=e[1]*o,u=e[2]*i,c=e[4]*n,f=e[5]*o,h=e[6]*i,p=e[8]*n,d=e[9]*o,y=e[10]*i,v=a+f+y,g=0;return v>0?(g=2*Math.sqrt(v+1),t[3]=.25*g,t[0]=(h-d)/g,t[1]=(p-u)/g,t[2]=(s-c)/g):a>f&&a>y?(g=2*Math.sqrt(1+a-f-y),t[3]=(h-d)/g,t[0]=.25*g,t[1]=(s+c)/g,t[2]=(p+u)/g):f>y?(g=2*Math.sqrt(1+f-a-y),t[3]=(p-u)/g,t[0]=(s+c)/g,t[1]=.25*g,t[2]=(h+d)/g):(g=2*Math.sqrt(1+y-a-f),t[3]=(s-c)/g,t[0]=(p+u)/g,t[1]=(h+d)/g,t[2]=.25*g),t}function Rt(t,e,r,n){var o=e[0],i=e[1],a=e[2],s=e[3],u=o+o,l=i+i,c=a+a,f=o*u,h=o*l,p=o*c,d=i*l,y=i*c,v=a*c,g=s*u,m=s*l,b=s*c,w=n[0],S=n[1],x=n[2];return t[0]=(1-(d+v))*w,t[1]=(h+b)*w,t[2]=(p-m)*w,t[3]=0,t[4]=(h-b)*S,t[5]=(1-(f+v))*S,t[6]=(y+g)*S,t[7]=0,t[8]=(p+m)*x,t[9]=(y-g)*x,t[10]=(1-(f+d))*x,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Dt(t,e,r,n,o){var i=e[0],a=e[1],s=e[2],u=e[3],l=i+i,c=a+a,f=s+s,h=i*l,p=i*c,d=i*f,y=a*c,v=a*f,g=s*f,m=u*l,b=u*c,w=u*f,S=n[0],x=n[1],_=n[2],E=o[0],O=o[1],P=o[2],k=(1-(y+g))*S,C=(p+w)*S,T=(d-b)*S,A=(p-w)*x,M=(1-(h+g))*x,j=(v+m)*x,I=(d+b)*_,N=(v-m)*_,L=(1-(h+y))*_;return t[0]=k,t[1]=C,t[2]=T,t[3]=0,t[4]=A,t[5]=M,t[6]=j,t[7]=0,t[8]=I,t[9]=N,t[10]=L,t[11]=0,t[12]=r[0]+E-(k*E+A*O+I*P),t[13]=r[1]+O-(C*E+M*O+N*P),t[14]=r[2]+P-(T*E+j*O+L*P),t[15]=1,t}function Bt(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=r+r,s=n+n,u=o+o,l=r*a,c=n*a,f=n*s,h=o*a,p=o*s,d=o*u,y=i*a,v=i*s,g=i*u;return t[0]=1-f-d,t[1]=c+g,t[2]=h-v,t[3]=0,t[4]=c-g,t[5]=1-l-d,t[6]=p+y,t[7]=0,t[8]=h+v,t[9]=p-y,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ft(t,e,r,n,o,i,a){var s=1/(r-e),u=1/(o-n),l=1/(i-a);return t[0]=2*i*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*i*u,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(o+n)*u,t[10]=(a+i)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*i*2*l,t[15]=0,t}function Gt(t,e,r,n,o){var i,a=1/Math.tan(e/2);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(i=1/(n-o),t[10]=(o+n)*i,t[14]=2*o*n*i):(t[10]=-1,t[14]=-2*n),t}var Ut=Gt;function zt(t,e,r,n,o){var i,a=1/Math.tan(e/2);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(i=1/(n-o),t[10]=o*i,t[14]=o*n*i):(t[10]=-1,t[14]=-n),t}function Vt(t,e,r,n){var o=Math.tan(e.upDegrees*Math.PI/180),i=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(a+s),l=2/(o+i);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-(a-s)*u*.5,t[9]=(o-i)*l*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function Ht(t,e,r,n,o,i,a){var s=1/(e-r),u=1/(n-o),l=1/(i-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*s,t[13]=(o+n)*u,t[14]=(a+i)*l,t[15]=1,t}var qt=Ht;function Wt(t,e,r,n,o,i,a){var s=1/(e-r),u=1/(n-o),l=1/(i-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=l,t[11]=0,t[12]=(e+r)*s,t[13]=(o+n)*u,t[14]=i*l,t[15]=1,t}function Yt(t,e,r,n){var o,i,a,s,u,c,f,h,p,d,y=e[0],v=e[1],g=e[2],m=n[0],b=n[1],w=n[2],S=r[0],x=r[1],_=r[2];return Math.abs(y-S)0&&(c*=p=1/Math.sqrt(p),f*=p,h*=p);var d=u*h-l*f,y=l*c-s*h,v=s*f-u*c;return(p=d*d+y*y+v*v)>0&&(d*=p=1/Math.sqrt(p),y*=p,v*=p),t[0]=d,t[1]=y,t[2]=v,t[3]=0,t[4]=f*v-h*y,t[5]=h*d-c*v,t[6]=c*y-f*d,t[7]=0,t[8]=c,t[9]=f,t[10]=h,t[11]=0,t[12]=o,t[13]=i,t[14]=a,t[15]=1,t}function Jt(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function Kt(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function Qt(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function Zt(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function $t(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function te(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function ee(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function re(t,e){var r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],s=t[5],u=t[6],c=t[7],f=t[8],h=t[9],p=t[10],d=t[11],y=t[12],v=t[13],g=t[14],m=t[15],b=e[0],w=e[1],S=e[2],x=e[3],_=e[4],E=e[5],O=e[6],P=e[7],k=e[8],C=e[9],T=e[10],A=e[11],M=e[12],j=e[13],I=e[14],N=e[15];return Math.abs(r-b)<=l.EPSILON*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(n-w)<=l.EPSILON*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(o-S)<=l.EPSILON*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(i-x)<=l.EPSILON*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-_)<=l.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(s-E)<=l.EPSILON*Math.max(1,Math.abs(s),Math.abs(E))&&Math.abs(u-O)<=l.EPSILON*Math.max(1,Math.abs(u),Math.abs(O))&&Math.abs(c-P)<=l.EPSILON*Math.max(1,Math.abs(c),Math.abs(P))&&Math.abs(f-k)<=l.EPSILON*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(h-C)<=l.EPSILON*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(p-T)<=l.EPSILON*Math.max(1,Math.abs(p),Math.abs(T))&&Math.abs(d-A)<=l.EPSILON*Math.max(1,Math.abs(d),Math.abs(A))&&Math.abs(y-M)<=l.EPSILON*Math.max(1,Math.abs(y),Math.abs(M))&&Math.abs(v-j)<=l.EPSILON*Math.max(1,Math.abs(v),Math.abs(j))&&Math.abs(g-I)<=l.EPSILON*Math.max(1,Math.abs(g),Math.abs(I))&&Math.abs(m-N)<=l.EPSILON*Math.max(1,Math.abs(m),Math.abs(N))}var ne=mt,oe=Zt,ie=r(4995);function ae(){var t=new l.ARRAY_TYPE(4);return l.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function se(t){var e=new l.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function ue(t,e,r,n){var o=new l.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=r,o[3]=n,o}function le(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function ce(t,e,r,n,o){return t[0]=e,t[1]=r,t[2]=n,t[3]=o,t}function fe(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function he(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function pe(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function de(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function ye(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function ve(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function ge(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function me(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function be(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function we(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function Se(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}function xe(t,e){var r=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2],i=e[3]-t[3];return Math.hypot(r,n,o,i)}function _e(t,e){var r=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2],i=e[3]-t[3];return r*r+n*n+o*o+i*i}function Ee(t){var e=t[0],r=t[1],n=t[2],o=t[3];return Math.hypot(e,r,n,o)}function Oe(t){var e=t[0],r=t[1],n=t[2],o=t[3];return e*e+r*r+n*n+o*o}function Pe(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function ke(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function Ce(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=r*r+n*n+o*o+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=o*a,t[3]=i*a,t}function Te(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Ae(t,e,r,n){var o=r[0]*n[1]-r[1]*n[0],i=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],u=r[1]*n[3]-r[3]*n[1],l=r[2]*n[3]-r[3]*n[2],c=e[0],f=e[1],h=e[2],p=e[3];return t[0]=f*l-h*u+p*s,t[1]=-c*l+h*a-p*i,t[2]=c*u-f*a+p*o,t[3]=-c*s+f*i-h*o,t}function Me(t,e,r,n){var o=e[0],i=e[1],a=e[2],s=e[3];return t[0]=o+n*(r[0]-o),t[1]=i+n*(r[1]-i),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t}function je(t,e){var r,n,o,i,a,s;e=e||1;do{a=(r=2*l.RANDOM()-1)*r+(n=2*l.RANDOM()-1)*n}while(a>=1);do{s=(o=2*l.RANDOM()-1)*o+(i=2*l.RANDOM()-1)*i}while(s>=1);var u=Math.sqrt((1-a)/s);return t[0]=e*r,t[1]=e*n,t[2]=e*o*u,t[3]=e*i*u,t}function Ie(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3];return t[0]=r[0]*n+r[4]*o+r[8]*i+r[12]*a,t[1]=r[1]*n+r[5]*o+r[9]*i+r[13]*a,t[2]=r[2]*n+r[6]*o+r[10]*i+r[14]*a,t[3]=r[3]*n+r[7]*o+r[11]*i+r[15]*a,t}function Ne(t,e,r){var n=e[0],o=e[1],i=e[2],a=r[0],s=r[1],u=r[2],l=r[3],c=l*n+s*i-u*o,f=l*o+u*n-a*i,h=l*i+a*o-s*n,p=-a*n-s*o-u*i;return t[0]=c*l+p*-a+f*-u-h*-s,t[1]=f*l+p*-s+h*-a-c*-u,t[2]=h*l+p*-u+c*-s-f*-a,t[3]=e[3],t}function Le(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function Re(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function De(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function Be(t,e){var r=t[0],n=t[1],o=t[2],i=t[3],a=e[0],s=e[1],u=e[2],c=e[3];return Math.abs(r-a)<=l.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=l.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(o-u)<=l.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(i-c)<=l.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))}var Fe,Ge=he,Ue=pe,ze=de,Ve=xe,He=_e,qe=Ee,We=Oe,Ye=(Fe=ae(),function(t,e,r,n,o,i){var a,s;for(e||(e=4),r||(r=0),s=n?Math.min(n*e+r,t.length):t.length,a=r;al.EPSILON?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r}function Ze(t,e){var r=kr(t,e);return Math.acos(2*r*r-1)}function $e(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=r[0],u=r[1],l=r[2],c=r[3];return t[0]=n*c+a*s+o*l-i*u,t[1]=o*c+a*u+i*s-n*l,t[2]=i*c+a*l+n*u-o*s,t[3]=a*c-n*s-o*u-i*l,t}function tr(t,e,r){r*=.5;var n=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+a*s,t[1]=o*u+i*s,t[2]=i*u-o*s,t[3]=a*u-n*s,t}function er(t,e,r){r*=.5;var n=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u-i*s,t[1]=o*u+a*s,t[2]=i*u+n*s,t[3]=a*u-o*s,t}function rr(t,e,r){r*=.5;var n=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+o*s,t[1]=o*u-n*s,t[2]=i*u+a*s,t[3]=a*u-i*s,t}function nr(t,e){var r=e[0],n=e[1],o=e[2];return t[0]=r,t[1]=n,t[2]=o,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-o*o)),t}function or(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=Math.sqrt(r*r+n*n+o*o),s=Math.exp(i),u=a>0?s*Math.sin(a)/a:0;return t[0]=r*u,t[1]=n*u,t[2]=o*u,t[3]=s*Math.cos(a),t}function ir(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=Math.sqrt(r*r+n*n+o*o),s=a>0?Math.atan2(a,i)/a:0;return t[0]=r*s,t[1]=n*s,t[2]=o*s,t[3]=.5*Math.log(r*r+n*n+o*o+i*i),t}function ar(t,e,r){return ir(t,e),Pr(t,t,r),or(t,t),t}function sr(t,e,r,n){var o,i,a,s,u,c=e[0],f=e[1],h=e[2],p=e[3],d=r[0],y=r[1],v=r[2],g=r[3];return(i=c*d+f*y+h*v+p*g)<0&&(i=-i,d=-d,y=-y,v=-v,g=-g),1-i>l.EPSILON?(o=Math.acos(i),a=Math.sin(o),s=Math.sin((1-n)*o)/a,u=Math.sin(n*o)/a):(s=1-n,u=n),t[0]=s*c+u*d,t[1]=s*f+u*y,t[2]=s*h+u*v,t[3]=s*p+u*g,t}function ur(t){var e=l.RANDOM(),r=l.RANDOM(),n=l.RANDOM(),o=Math.sqrt(1-e),i=Math.sqrt(e);return t[0]=o*Math.sin(2*Math.PI*r),t[1]=o*Math.cos(2*Math.PI*r),t[2]=i*Math.sin(2*Math.PI*n),t[3]=i*Math.cos(2*Math.PI*n),t}function lr(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=r*r+n*n+o*o+i*i,s=a?1/a:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-o*s,t[3]=i*s,t}function cr(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function fr(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var o=0;e[4]>e[0]&&(o=1),e[8]>e[3*o+o]&&(o=2);var i=(o+1)%3,a=(o+2)%3;r=Math.sqrt(e[3*o+o]-e[3*i+i]-e[3*a+a]+1),t[o]=.5*r,r=.5/r,t[3]=(e[3*i+a]-e[3*a+i])*r,t[i]=(e[3*i+o]+e[3*o+i])*r,t[a]=(e[3*a+o]+e[3*o+a])*r}return t}function hr(t,e,r,n){var o=.5*Math.PI/180;e*=o,r*=o,n*=o;var i=Math.sin(e),a=Math.cos(e),s=Math.sin(r),u=Math.cos(r),l=Math.sin(n),c=Math.cos(n);return t[0]=i*u*c-a*s*l,t[1]=a*s*c+i*u*l,t[2]=a*u*l-i*s*c,t[3]=a*u*c+i*s*l,t}function pr(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var dr,yr,vr,gr,mr,br,wr=se,Sr=ue,xr=le,_r=ce,Er=fe,Or=$e,Pr=we,kr=Te,Cr=Me,Tr=Ee,Ar=Tr,Mr=Oe,jr=Mr,Ir=Ce,Nr=De,Lr=Be,Rr=(dr=ie.create(),yr=ie.fromValues(1,0,0),vr=ie.fromValues(0,1,0),function(t,e,r){var n=ie.dot(e,r);return n<-.999999?(ie.cross(dr,yr,e),ie.len(dr)<1e-6&&ie.cross(dr,vr,e),ie.normalize(dr,dr),Ke(t,dr,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(ie.cross(dr,e,r),t[0]=dr[0],t[1]=dr[1],t[2]=dr[2],t[3]=1+n,Ir(t,t))}),Dr=(gr=Xe(),mr=Xe(),function(t,e,r,n,o,i){return sr(gr,e,o,i),sr(mr,r,n,i),sr(t,gr,mr,2*i*(1-i)),t}),Br=(br=st.create(),function(t,e,r,n){return br[0]=r[0],br[3]=r[1],br[6]=r[2],br[1]=n[0],br[4]=n[1],br[7]=n[2],br[2]=-e[0],br[5]=-e[1],br[8]=-e[2],Ir(t,fr(t,br))});function Fr(){var t=new l.ARRAY_TYPE(8);return l.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function Gr(t){var e=new l.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function Ur(t,e,r,n,o,i,a,s){var u=new l.ARRAY_TYPE(8);return u[0]=t,u[1]=e,u[2]=r,u[3]=n,u[4]=o,u[5]=i,u[6]=a,u[7]=s,u}function zr(t,e,r,n,o,i,a){var s=new l.ARRAY_TYPE(8);s[0]=t,s[1]=e,s[2]=r,s[3]=n;var u=.5*o,c=.5*i,f=.5*a;return s[4]=u*n+c*r-f*e,s[5]=c*n+f*t-u*r,s[6]=f*n+u*e-c*t,s[7]=-u*t-c*e-f*r,s}function Vr(t,e,r){var n=.5*r[0],o=.5*r[1],i=.5*r[2],a=e[0],s=e[1],u=e[2],l=e[3];return t[0]=a,t[1]=s,t[2]=u,t[3]=l,t[4]=n*l+o*u-i*s,t[5]=o*l+i*a-n*u,t[6]=i*l+n*s-o*a,t[7]=-n*a-o*s-i*u,t}function Hr(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t}function qr(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function Wr(t,e){var r=Xe();Lt(r,e);var n=new l.ARRAY_TYPE(3);return It(n,e),Vr(t,r,n),t}function Yr(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function Xr(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function Jr(t,e,r,n,o,i,a,s,u){return t[0]=e,t[1]=r,t[2]=n,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t}var Kr=xr;function Qr(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}var Zr=xr;function $r(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function tn(t,e){var r=e[4],n=e[5],o=e[6],i=e[7],a=-e[0],s=-e[1],u=-e[2],l=e[3];return t[0]=2*(r*l+i*a+n*u-o*s),t[1]=2*(n*l+i*s+o*a-r*u),t[2]=2*(o*l+i*u+r*s-n*a),t}function en(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=.5*r[0],u=.5*r[1],l=.5*r[2],c=e[4],f=e[5],h=e[6],p=e[7];return t[0]=n,t[1]=o,t[2]=i,t[3]=a,t[4]=a*s+o*l-i*u+c,t[5]=a*u+i*s-n*l+f,t[6]=a*l+n*u-o*s+h,t[7]=-n*s-o*u-i*l+p,t}function rn(t,e,r){var n=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=s*a+c*n+u*i-l*o,h=u*a+c*o+l*n-s*i,p=l*a+c*i+s*o-u*n,d=c*a-s*n-u*o-l*i;return tr(t,e,r),n=t[0],o=t[1],i=t[2],a=t[3],t[4]=f*a+d*n+h*i-p*o,t[5]=h*a+d*o+p*n-f*i,t[6]=p*a+d*i+f*o-h*n,t[7]=d*a-f*n-h*o-p*i,t}function nn(t,e,r){var n=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=s*a+c*n+u*i-l*o,h=u*a+c*o+l*n-s*i,p=l*a+c*i+s*o-u*n,d=c*a-s*n-u*o-l*i;return er(t,e,r),n=t[0],o=t[1],i=t[2],a=t[3],t[4]=f*a+d*n+h*i-p*o,t[5]=h*a+d*o+p*n-f*i,t[6]=p*a+d*i+f*o-h*n,t[7]=d*a-f*n-h*o-p*i,t}function on(t,e,r){var n=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=s*a+c*n+u*i-l*o,h=u*a+c*o+l*n-s*i,p=l*a+c*i+s*o-u*n,d=c*a-s*n-u*o-l*i;return rr(t,e,r),n=t[0],o=t[1],i=t[2],a=t[3],t[4]=f*a+d*n+h*i-p*o,t[5]=h*a+d*o+p*n-f*i,t[6]=p*a+d*i+f*o-h*n,t[7]=d*a-f*n-h*o-p*i,t}function an(t,e,r){var n=r[0],o=r[1],i=r[2],a=r[3],s=e[0],u=e[1],l=e[2],c=e[3];return t[0]=s*a+c*n+u*i-l*o,t[1]=u*a+c*o+l*n-s*i,t[2]=l*a+c*i+s*o-u*n,t[3]=c*a-s*n-u*o-l*i,s=e[4],u=e[5],l=e[6],c=e[7],t[4]=s*a+c*n+u*i-l*o,t[5]=u*a+c*o+l*n-s*i,t[6]=l*a+c*i+s*o-u*n,t[7]=c*a-s*n-u*o-l*i,t}function sn(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=r[0],u=r[1],l=r[2],c=r[3];return t[0]=n*c+a*s+o*l-i*u,t[1]=o*c+a*u+i*s-n*l,t[2]=i*c+a*l+n*u-o*s,t[3]=a*c-n*s-o*u-i*l,s=r[4],u=r[5],l=r[6],c=r[7],t[4]=n*c+a*s+o*l-i*u,t[5]=o*c+a*u+i*s-n*l,t[6]=i*c+a*l+n*u-o*s,t[7]=a*c-n*s-o*u-i*l,t}function un(t,e,r,n){if(Math.abs(n)0){r=Math.sqrt(r);var n=e[0]/r,o=e[1]/r,i=e[2]/r,a=e[3]/r,s=e[4],u=e[5],l=e[6],c=e[7],f=n*s+o*u+i*l+a*c;t[0]=n,t[1]=o,t[2]=i,t[3]=a,t[4]=(s-n*f)/r,t[5]=(u-o*f)/r,t[6]=(l-i*f)/r,t[7]=(c-a*f)/r}return t}function xn(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function _n(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]}function En(t,e){var r=t[0],n=t[1],o=t[2],i=t[3],a=t[4],s=t[5],u=t[6],c=t[7],f=e[0],h=e[1],p=e[2],d=e[3],y=e[4],v=e[5],g=e[6],m=e[7];return Math.abs(r-f)<=l.EPSILON*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(n-h)<=l.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(o-p)<=l.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(i-d)<=l.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-y)<=l.EPSILON*Math.max(1,Math.abs(a),Math.abs(y))&&Math.abs(s-v)<=l.EPSILON*Math.max(1,Math.abs(s),Math.abs(v))&&Math.abs(u-g)<=l.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(c-m)<=l.EPSILON*Math.max(1,Math.abs(c),Math.abs(m))}var On=r(4732)},9019:function(t,e,r){"use strict";r.r(e),r.d(e,{add:function(){return C},adjoint:function(){return p},clone:function(){return a},copy:function(){return s},create:function(){return o},determinant:function(){return d},equals:function(){return I},exactEquals:function(){return j},frob:function(){return k},fromMat2d:function(){return x},fromMat4:function(){return i},fromQuat:function(){return _},fromRotation:function(){return w},fromScaling:function(){return S},fromTranslation:function(){return b},fromValues:function(){return u},identity:function(){return c},invert:function(){return h},mul:function(){return N},multiply:function(){return y},multiplyScalar:function(){return A},multiplyScalarAndAdd:function(){return M},normalFromMat4:function(){return E},projection:function(){return O},rotate:function(){return g},scale:function(){return m},set:function(){return l},str:function(){return P},sub:function(){return L},subtract:function(){return T},translate:function(){return v},transpose:function(){return f}});var n=r(5629);function o(){var t=new n.ARRAY_TYPE(9);return n.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function a(t){var e=new n.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function s(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function u(t,e,r,o,i,a,s,u,l){var c=new n.ARRAY_TYPE(9);return c[0]=t,c[1]=e,c[2]=r,c[3]=o,c[4]=i,c[5]=a,c[6]=s,c[7]=u,c[8]=l,c}function l(t,e,r,n,o,i,a,s,u,l){return t[0]=e,t[1]=r,t[2]=n,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t[8]=l,t}function c(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function f(t,e){if(t===e){var r=e[1],n=e[2],o=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=o}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function h(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=c*a-s*l,h=-c*i+s*u,p=l*i-a*u,d=r*f+n*h+o*p;return d?(d=1/d,t[0]=f*d,t[1]=(-c*n+o*l)*d,t[2]=(s*n-o*a)*d,t[3]=h*d,t[4]=(c*r-o*u)*d,t[5]=(-s*r+o*i)*d,t[6]=p*d,t[7]=(-l*r+n*u)*d,t[8]=(a*r-n*i)*d,t):null}function p(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],l=e[7],c=e[8];return t[0]=a*c-s*l,t[1]=o*l-n*c,t[2]=n*s-o*a,t[3]=s*u-i*c,t[4]=r*c-o*u,t[5]=o*i-r*s,t[6]=i*l-a*u,t[7]=n*u-r*l,t[8]=r*a-n*i,t}function d(t){var e=t[0],r=t[1],n=t[2],o=t[3],i=t[4],a=t[5],s=t[6],u=t[7],l=t[8];return e*(l*i-a*u)+r*(-l*o+a*s)+n*(u*o-i*s)}function y(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],h=r[0],p=r[1],d=r[2],y=r[3],v=r[4],g=r[5],m=r[6],b=r[7],w=r[8];return t[0]=h*n+p*a+d*l,t[1]=h*o+p*s+d*c,t[2]=h*i+p*u+d*f,t[3]=y*n+v*a+g*l,t[4]=y*o+v*s+g*c,t[5]=y*i+v*u+g*f,t[6]=m*n+b*a+w*l,t[7]=m*o+b*s+w*c,t[8]=m*i+b*u+w*f,t}function v(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],h=r[0],p=r[1];return t[0]=n,t[1]=o,t[2]=i,t[3]=a,t[4]=s,t[5]=u,t[6]=h*n+p*a+l,t[7]=h*o+p*s+c,t[8]=h*i+p*u+f,t}function g(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],f=e[8],h=Math.sin(r),p=Math.cos(r);return t[0]=p*n+h*a,t[1]=p*o+h*s,t[2]=p*i+h*u,t[3]=p*a-h*n,t[4]=p*s-h*o,t[5]=p*u-h*i,t[6]=l,t[7]=c,t[8]=f,t}function m(t,e,r){var n=r[0],o=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=o*e[3],t[4]=o*e[4],t[5]=o*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function b(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function w(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function S(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function x(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function _(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=r+r,s=n+n,u=o+o,l=r*a,c=n*a,f=n*s,h=o*a,p=o*s,d=o*u,y=i*a,v=i*s,g=i*u;return t[0]=1-f-d,t[3]=c-g,t[6]=h+v,t[1]=c+g,t[4]=1-l-d,t[7]=p-y,t[2]=h-v,t[5]=p+y,t[8]=1-l-f,t}function E(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],l=e[7],c=e[8],f=e[9],h=e[10],p=e[11],d=e[12],y=e[13],v=e[14],g=e[15],m=r*s-n*a,b=r*u-o*a,w=r*l-i*a,S=n*u-o*s,x=n*l-i*s,_=o*l-i*u,E=c*y-f*d,O=c*v-h*d,P=c*g-p*d,k=f*v-h*y,C=f*g-p*y,T=h*g-p*v,A=m*T-b*C+w*k+S*P-x*O+_*E;return A?(A=1/A,t[0]=(s*T-u*C+l*k)*A,t[1]=(u*P-a*T-l*O)*A,t[2]=(a*C-s*P+l*E)*A,t[3]=(o*C-n*T-i*k)*A,t[4]=(r*T-o*P+i*O)*A,t[5]=(n*P-r*C-i*E)*A,t[6]=(y*_-v*x+g*S)*A,t[7]=(v*w-d*_-g*b)*A,t[8]=(d*x-y*w+g*m)*A,t):null}function O(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function P(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function k(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function C(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t}function T(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t}function A(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t}function M(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t}function j(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function I(t,e){var r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=t[7],f=t[8],h=e[0],p=e[1],d=e[2],y=e[3],v=e[4],g=e[5],m=e[6],b=e[7],w=e[8];return Math.abs(r-h)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(o-p)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(i-d)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-y)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(y))&&Math.abs(s-v)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(v))&&Math.abs(u-g)<=n.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(l-m)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(m))&&Math.abs(c-b)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(f-w)<=n.EPSILON*Math.max(1,Math.abs(f),Math.abs(w))}var N=y,L=T},4732:function(t,e,r){"use strict";r.r(e),r.d(e,{add:function(){return l},angle:function(){return R},ceil:function(){return p},clone:function(){return i},copy:function(){return s},create:function(){return o},cross:function(){return C},dist:function(){return W},distance:function(){return w},div:function(){return q},divide:function(){return h},dot:function(){return k},equals:function(){return G},exactEquals:function(){return F},floor:function(){return d},forEach:function(){return J},fromValues:function(){return a},inverse:function(){return O},len:function(){return z},length:function(){return x},lerp:function(){return T},max:function(){return v},min:function(){return y},mul:function(){return H},multiply:function(){return f},negate:function(){return E},normalize:function(){return P},random:function(){return A},rotate:function(){return L},round:function(){return g},scale:function(){return m},scaleAndAdd:function(){return b},set:function(){return u},sqrDist:function(){return Y},sqrLen:function(){return X},squaredDistance:function(){return S},squaredLength:function(){return _},str:function(){return B},sub:function(){return V},subtract:function(){return c},transformMat2:function(){return M},transformMat2d:function(){return j},transformMat3:function(){return I},transformMat4:function(){return N},zero:function(){return D}});var n=r(5629);function o(){var t=new n.ARRAY_TYPE(2);return n.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function i(t){var e=new n.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e}function a(t,e){var r=new n.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r}function s(t,e){return t[0]=e[0],t[1]=e[1],t}function u(t,e,r){return t[0]=e,t[1]=r,t}function l(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function c(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function f(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function h(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function p(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function d(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function y(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function v(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function g(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function m(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function b(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t}function w(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.hypot(r,n)}function S(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n}function x(t){var e=t[0],r=t[1];return Math.hypot(e,r)}function _(t){var e=t[0],r=t[1];return e*e+r*r}function E(t,e){return t[0]=-e[0],t[1]=-e[1],t}function O(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function P(t,e){var r=e[0],n=e[1],o=r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t}function k(t,e){return t[0]*e[0]+t[1]*e[1]}function C(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t}function T(t,e,r,n){var o=e[0],i=e[1];return t[0]=o+n*(r[0]-o),t[1]=i+n*(r[1]-i),t}function A(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function M(t,e,r){var n=e[0],o=e[1];return t[0]=r[0]*n+r[2]*o,t[1]=r[1]*n+r[3]*o,t}function j(t,e,r){var n=e[0],o=e[1];return t[0]=r[0]*n+r[2]*o+r[4],t[1]=r[1]*n+r[3]*o+r[5],t}function I(t,e,r){var n=e[0],o=e[1];return t[0]=r[0]*n+r[3]*o+r[6],t[1]=r[1]*n+r[4]*o+r[7],t}function N(t,e,r){var n=e[0],o=e[1];return t[0]=r[0]*n+r[4]*o+r[12],t[1]=r[1]*n+r[5]*o+r[13],t}function L(t,e,r,n){var o=e[0]-r[0],i=e[1]-r[1],a=Math.sin(n),s=Math.cos(n);return t[0]=o*s-i*a+r[0],t[1]=o*a+i*s+r[1],t}function R(t,e){var r=t[0],n=t[1],o=e[0],i=e[1],a=Math.sqrt(r*r+n*n)*Math.sqrt(o*o+i*i),s=a&&(r*o+n*i)/a;return Math.acos(Math.min(Math.max(s,-1),1))}function D(t){return t[0]=0,t[1]=0,t}function B(t){return"vec2("+t[0]+", "+t[1]+")"}function F(t,e){return t[0]===e[0]&&t[1]===e[1]}function G(t,e){var r=t[0],o=t[1],i=e[0],a=e[1];return Math.abs(r-i)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(o-a)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(a))}var U,z=x,V=c,H=f,q=h,W=w,Y=S,X=_,J=(U=o(),function(t,e,r,n,o,i){var a,s;for(e||(e=2),r||(r=0),s=n?Math.min(n*e+r,t.length):t.length,a=r;a0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function k(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function C(t,e,r){var n=e[0],o=e[1],i=e[2],a=r[0],s=r[1],u=r[2];return t[0]=o*u-i*s,t[1]=i*a-n*u,t[2]=n*s-o*a,t}function T(t,e,r,n){var o=e[0],i=e[1],a=e[2];return t[0]=o+n*(r[0]-o),t[1]=i+n*(r[1]-i),t[2]=a+n*(r[2]-a),t}function A(t,e,r,n,o,i){var a=i*i,s=a*(2*i-3)+1,u=a*(i-2)+i,l=a*(i-1),c=a*(3-2*i);return t[0]=e[0]*s+r[0]*u+n[0]*l+o[0]*c,t[1]=e[1]*s+r[1]*u+n[1]*l+o[1]*c,t[2]=e[2]*s+r[2]*u+n[2]*l+o[2]*c,t}function M(t,e,r,n,o,i){var a=1-i,s=a*a,u=i*i,l=s*a,c=3*i*s,f=3*u*a,h=u*i;return t[0]=e[0]*l+r[0]*c+n[0]*f+o[0]*h,t[1]=e[1]*l+r[1]*c+n[1]*f+o[1]*h,t[2]=e[2]*l+r[2]*c+n[2]*f+o[2]*h,t}function j(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI,o=2*n.RANDOM()-1,i=Math.sqrt(1-o*o)*e;return t[0]=Math.cos(r)*i,t[1]=Math.sin(r)*i,t[2]=o*e,t}function I(t,e,r){var n=e[0],o=e[1],i=e[2],a=r[3]*n+r[7]*o+r[11]*i+r[15];return a=a||1,t[0]=(r[0]*n+r[4]*o+r[8]*i+r[12])/a,t[1]=(r[1]*n+r[5]*o+r[9]*i+r[13])/a,t[2]=(r[2]*n+r[6]*o+r[10]*i+r[14])/a,t}function N(t,e,r){var n=e[0],o=e[1],i=e[2];return t[0]=n*r[0]+o*r[3]+i*r[6],t[1]=n*r[1]+o*r[4]+i*r[7],t[2]=n*r[2]+o*r[5]+i*r[8],t}function L(t,e,r){var n=r[0],o=r[1],i=r[2],a=r[3],s=e[0],u=e[1],l=e[2],c=o*l-i*u,f=i*s-n*l,h=n*u-o*s,p=o*h-i*f,d=i*c-n*h,y=n*f-o*c,v=2*a;return c*=v,f*=v,h*=v,p*=2,d*=2,y*=2,t[0]=s+c+p,t[1]=u+f+d,t[2]=l+h+y,t}function R(t,e,r,n){var o=[],i=[];return o[0]=e[0]-r[0],o[1]=e[1]-r[1],o[2]=e[2]-r[2],i[0]=o[0],i[1]=o[1]*Math.cos(n)-o[2]*Math.sin(n),i[2]=o[1]*Math.sin(n)+o[2]*Math.cos(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function D(t,e,r,n){var o=[],i=[];return o[0]=e[0]-r[0],o[1]=e[1]-r[1],o[2]=e[2]-r[2],i[0]=o[2]*Math.sin(n)+o[0]*Math.cos(n),i[1]=o[1],i[2]=o[2]*Math.cos(n)-o[0]*Math.sin(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function B(t,e,r,n){var o=[],i=[];return o[0]=e[0]-r[0],o[1]=e[1]-r[1],o[2]=e[2]-r[2],i[0]=o[0]*Math.cos(n)-o[1]*Math.sin(n),i[1]=o[0]*Math.sin(n)+o[1]*Math.cos(n),i[2]=o[2],t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function F(t,e){var r=t[0],n=t[1],o=t[2],i=e[0],a=e[1],s=e[2],u=Math.sqrt(r*r+n*n+o*o)*Math.sqrt(i*i+a*a+s*s),l=u&&k(t,e)/u;return Math.acos(Math.min(Math.max(l,-1),1))}function G(t){return t[0]=0,t[1]=0,t[2]=0,t}function U(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function z(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function V(t,e){var r=t[0],o=t[1],i=t[2],a=e[0],s=e[1],u=e[2];return Math.abs(r-a)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(o-s)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(s))&&Math.abs(i-u)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))}var H,q=f,W=h,Y=p,X=S,J=x,K=a,Q=_,Z=(H=o(),function(t,e,r,n,o,i){var a,s;for(e||(e=3),r||(r=0),s=n?Math.min(n*e+r,t.length):t.length,a=r;a=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))}},5611:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t=r.nmd(t);var o=200,i="__lodash_hash_undefined__",a=9007199254740991,s="[object Arguments]",u="[object Boolean]",l="[object Date]",c="[object Function]",f="[object GeneratorFunction]",h="[object Map]",p="[object Number]",d="[object Object]",y="[object RegExp]",v="[object Set]",g="[object String]",m="[object Symbol]",b="[object ArrayBuffer]",w="[object DataView]",S="[object Float32Array]",x="[object Float64Array]",_="[object Int8Array]",E="[object Int16Array]",O="[object Int32Array]",P="[object Uint8Array]",k="[object Uint8ClampedArray]",C="[object Uint16Array]",T="[object Uint32Array]",A=/\w*$/,M=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,I={};I[s]=I["[object Array]"]=I[b]=I[w]=I[u]=I[l]=I[S]=I[x]=I[_]=I[E]=I[O]=I[h]=I[p]=I[d]=I[y]=I[v]=I[g]=I[m]=I[P]=I[k]=I[C]=I[T]=!0,I["[object Error]"]=I[c]=I["[object WeakMap]"]=!1;var N="object"==(void 0===r.g?"undefined":n(r.g))&&r.g&&r.g.Object===Object&&r.g,L="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self,R=N||L||Function("return this")(),D="object"==n(e)&&e&&!e.nodeType&&e,B=D&&"object"==n(t)&&t&&!t.nodeType&&t,F=B&&B.exports===D;function G(t,e){return t.set(e[0],e[1]),t}function U(t,e){return t.add(e),t}function z(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o-1},kt.prototype.set=function(t,e){var r=this.__data__,n=jt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},Ct.prototype.clear=function(){this.__data__={hash:new Pt,map:new(dt||kt),string:new Pt}},Ct.prototype.delete=function(t){return Dt(this,t).delete(t)},Ct.prototype.get=function(t){return Dt(this,t).get(t)},Ct.prototype.has=function(t){return Dt(this,t).has(t)},Ct.prototype.set=function(t,e){return Dt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new kt},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof kt){var n=r.__data__;if(!dt||n.length-1&&t%1==0&&t-1&&t%1==0&&t<=a}(t.length)&&!Xt(t)}var Yt=ft||function(){return!1};function Xt(t){var e=Jt(t)?et.call(t):"";return e==c||e==f}function Jt(t){var e=n(t);return!!t&&("object"==e||"function"==e)}function Kt(t){return Wt(t)?At(t):function(t){if(!zt(t))return ht(t);var e=[];for(var r in Object(t))tt.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return It(t,!0,!0)}},8518:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=9007199254740991,i="[object Arguments]",a="[object Function]",s="[object GeneratorFunction]",u="[object Map]",l="[object Set]",c=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,h="object"==(void 0===r.g?"undefined":n(r.g))&&r.g&&r.g.Object===Object&&r.g,p="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self,d=h||p||Function("return this")();function y(t,e){return function(t,e){for(var r=-1,n=t?t.length:0,o=Array(n);++r-1&&t%1==0&&t-1&&t%1==0&&t<=o}(t.length)&&!X(t)}function X(t){var e=J(t)?O.call(t):"";return e==a||e==s}function J(t){var e=n(t);return!!t&&("object"==e||"function"==e)}var K,Q=(K=function(t){return Y(t)?F(t):U(t)},function(t){var e,r,n,o=V(t);return o==u?(e=t,r=-1,n=Array(e.size),e.forEach(function(t,e){n[++r]=[e,t]}),n):o==l?function(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=[t,t]}),r}(t):y(t,K(t))});t.exports=Q},44:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t=r.nmd(t);var o=200,i="Expected a function",a="__lodash_hash_undefined__",s=1,u=2,l=1/0,c=9007199254740991,f="[object Arguments]",h="[object Array]",p="[object Boolean]",d="[object Date]",y="[object Error]",v="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",w="[object Object]",S="[object RegExp]",x="[object Set]",_="[object String]",E="[object Symbol]",O="[object ArrayBuffer]",P="[object DataView]",k=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,C=/^\w*$/,T=/^\./,A=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,M=/\\(\\)?/g,j=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,N={};N["[object Float32Array]"]=N["[object Float64Array]"]=N["[object Int8Array]"]=N["[object Int16Array]"]=N["[object Int32Array]"]=N["[object Uint8Array]"]=N["[object Uint8ClampedArray]"]=N["[object Uint16Array]"]=N["[object Uint32Array]"]=!0,N[f]=N[h]=N[O]=N[p]=N[P]=N[d]=N[y]=N[v]=N[m]=N[b]=N[w]=N[S]=N[x]=N[_]=N["[object WeakMap]"]=!1;var L="object"==(void 0===r.g?"undefined":n(r.g))&&r.g&&r.g.Object===Object&&r.g,R="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self,D=L||R||Function("return this")(),B="object"==n(e)&&e&&!e.nodeType&&e,F=B&&"object"==n(t)&&t&&!t.nodeType&&t,G=F&&F.exports===B&&L.process,U=function(){try{return G&&G.binding("util")}catch(t){}}(),z=U&&U.isTypedArray;function V(t,e){return!!(t?t.length:0)&&function(t,e,r){if(e!=e)return function(t,e,r,n){var o=t.length,i=r+(n?1:-1);for(;n?i--:++i-1}function H(t,e,r){for(var n=-1,o=t?t.length:0;++n-1},Tt.prototype.set=function(t,e){var r=this.__data__,n=Nt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},At.prototype.clear=function(){this.__data__={hash:new Ct,map:new(yt||Tt),string:new Ct}},At.prototype.delete=function(t){return Ht(this,t).delete(t)},At.prototype.get=function(t){return Ht(this,t).get(t)},At.prototype.has=function(t){return Ht(this,t).has(t)},At.prototype.set=function(t,e){return Ht(this,t).set(t,e),this},Mt.prototype.add=Mt.prototype.push=function(t){return this.__data__.set(t,a),this},Mt.prototype.has=function(t){return this.__data__.has(t)},jt.prototype.clear=function(){this.__data__=new Tt},jt.prototype.delete=function(t){return this.__data__.delete(t)},jt.prototype.get=function(t){return this.__data__.get(t)},jt.prototype.has=function(t){return this.__data__.has(t)},jt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Tt){var n=r.__data__;if(!yt||n.lengthl))return!1;var f=i.get(t);if(f&&i.get(e))return f==e;var h=-1,p=!0,d=o&s?new Mt:void 0;for(i.set(t,e),i.set(e,t);++h-1&&t%1==0&&t-1&&t%1==0&&t<=c}function se(t){var e=n(t);return!!t&&("object"==e||"function"==e)}function ue(t){return!!t&&"object"==n(t)}function le(t){return"symbol"==n(t)||ue(t)&&st.call(t)==E}var ce=z?function(t){return function(e){return t(e)}}(z):function(t){return ue(t)&&ae(t.length)&&!!N[st.call(t)]};function fe(t){return oe(t)?It(t):Gt(t)}function he(t){return t}t.exports=function(t,e){return t&&t.length?function(t,e,r){var n=-1,i=V,a=t.length,s=!0,u=[],l=u;if(r)s=!1,i=H;else if(a>=o){var c=e?null:zt(t);if(c)return K(c);s=!1,i=Y,l=new Mt}else l=e?[]:u;t:for(;++n-1&&t%1==0&&t<=e}},7473:function(t,e,r){var n=r(522),o=r(9484),i="[object Number]";t.exports=function(t){return"number"==typeof t||o(t)&&n(t)==i}},9484:function(t){function e(t){"@babel/helpers - typeof";return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){return null!=t&&"object"==e(t)}},6601:function(t,e,r){var n=r(522),o=r(7969),i=r(9484),a="[object Object]",s=Function.prototype,u=Object.prototype,l=s.toString,c=u.hasOwnProperty,f=l.call(Object);t.exports=function(t){if(!i(t)||n(t)!=a)return!1;var e=o(t);if(null===e)return!0;var r=c.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&l.call(r)==f}},2021:function(t,e,r){var n=r(6171),o=r(6683),i=r(4123),a=i&&i.isTypedArray,s=a?o(a):n;t.exports=s},7915:function(t,e,r){var n,o,i,a;function s(t){"@babel/helpers - typeof";return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t=r.nmd(t),window,a=function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==s(t)&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=32)}([function(t,e){t.exports={options:{usePureJavaScript:!1}}},function(t,e,r){(function(e){var n=r(0),o=r(35),i=t.exports=n.util=n.util||{};function a(t){if(8!==t&&16!==t&&24!==t&&32!==t)throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}function u(t){if(this.data="",this.read=0,"string"==typeof t)this.data=t;else if(i.isArrayBuffer(t)||i.isArrayBufferView(t))if("undefined"!=typeof Buffer&&t instanceof Buffer)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch(t){for(var r=0;r15?(r=Date.now(),a(t)):(e.push(t),1===e.length&&o.setAttribute("a",n=!n))}}i.nextTick=i.setImmediate}(),i.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,i.globalScope=i.isNodejs?e:"undefined"==typeof self?window:self,i.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},i.isArrayBuffer=function(t){return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer},i.isArrayBufferView=function(t){return t&&i.isArrayBuffer(t.buffer)&&void 0!==t.byteLength},i.ByteBuffer=u,i.ByteStringBuffer=u,i.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},i.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},i.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},i.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))},i.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this},i.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this},i.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(i.encodeUtf8(t))},i.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},i.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},i.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},i.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255))},i.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))},i.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))},i.ByteStringBuffer.prototype.putInt=function(t,e){a(e);var r="";do{e-=8,r+=String.fromCharCode(t>>e&255)}while(e>0);return this.putBytes(r)},i.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<0);return e},i.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e},i.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},i.ByteStringBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},i.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)},i.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this},i.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},i.ByteStringBuffer.prototype.copy=function(){var t=i.createBuffer(this.data);return t.read=this.read,t},i.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},i.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},i.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this},i.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(r),this.data=new DataView(n.buffer),this},i.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this},i.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this},i.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this},i.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this},i.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this},i.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this},i.DataBuffer.prototype.putInt=function(t,e){a(e),this.accommodate(e/8);do{e-=8,this.data.setInt8(this.write++,t>>e&255)}while(e>0);return this},i.DataBuffer.prototype.putSignedInt=function(t,e){return a(e),this.accommodate(e/8),t<0&&(t+=2<0);return e},i.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e},i.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},i.DataBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},i.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)},i.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this},i.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},i.DataBuffer.prototype.copy=function(){return new i.DataBuffer(this)},i.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this},i.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},i.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this},i.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return r},i.xorBytes=function(t,e,r){for(var n="",o="",i="",a=0,s=0;r>0;--r,++a)o=t.charCodeAt(a)^e.charCodeAt(a),s>=10&&(n+=i,i="",s=0),i+=String.fromCharCode(o),++s;return n+i},i.hexToBytes=function(t){var e="",r=0;for(!0&t.length&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)};var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],f="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";i.encode64=function(t,e){for(var r,n,o,i="",a="",s=0;s>2),i+=l.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=l.charAt((15&n)<<2|o>>6),i+=isNaN(o)?"=":l.charAt(63&o)),e&&i.length>e&&(a+=i.substr(0,e)+"\r\n",i=i.substr(e));return a+i},i.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e,r,n,o,i="",a=0;a>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==o&&(i+=String.fromCharCode((3&n)<<6|o)));return i},i.encodeUtf8=function(t){return unescape(encodeURIComponent(t))},i.decodeUtf8=function(t){return decodeURIComponent(escape(t))},i.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},i.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)},i.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length));for(var o=r=r||0,i=0;i>2),i+=l.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=l.charAt((15&n)<<2|o>>6),i+=isNaN(o)?"=":l.charAt(63&o)),e&&i.length>e&&(a+=i.substr(0,e)+"\r\n",i=i.substr(e));return a+i},i.binary.base64.decode=function(t,e,r){var n,o,i,a,s=e;s||(s=new Uint8Array(3*Math.ceil(t.length/4))),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,l=r=r||0;u>4,64!==i&&(s[l++]=(15&o)<<4|i>>2,64!==a&&(s[l++]=(3&i)<<6|a));return e?l-r:s.subarray(0,l)},i.binary.base58.encode=function(t,e){return i.binary.baseN.encode(t,f,e)},i.binary.base58.decode=function(t,e){return i.binary.baseN.decode(t,f,e)},i.text={utf8:{},utf16:{}},i.text.utf8.encode=function(t,e,r){t=i.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length));for(var o=r=r||0,a=0;a0&&i.push(r),a=n.lastIndex;var s=e[0][1];switch(s){case"s":case"o":o");break;case"%":i.push("%");break;default:i.push("<%"+s+"?>")}}return i.push(t.substring(a)),i.join("")},i.formatNumber=function(t,e,r,n){var o=t,i=isNaN(e=Math.abs(e))?2:e,a=void 0===r?",":r,s=void 0===n?".":n,u=o<0?"-":"",l=parseInt(o=Math.abs(+o||0).toFixed(i),10)+"",c=l.length>3?l.length%3:0;return u+(c?l.substr(0,c)+s:"")+l.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+s)+(i?a+Math.abs(o-l).toFixed(i).slice(2):"")},i.formatSize=function(t){return t>=1073741824?i.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?i.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?i.formatNumber(t/1024,0)+" KiB":i.formatNumber(t,0)+" bytes"},i.bytesFromIP=function(t){return-1!==t.indexOf(".")?i.bytesFromIPv4(t):-1!==t.indexOf(":")?i.bytesFromIPv6(t):null},i.bytesFromIPv4=function(t){if(4!==(t=t.split(".")).length)return null;for(var e=i.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}e.push(a)}if(r.length>0){var l=r[n];l.end-l.start>0&&(e.splice(l.start,l.end-l.start+1,""),0===l.start&&e.unshift(""),7===l.end&&e.push(""))}return e.join(":")},i.estimateCores=function(t,e){if("function"==typeof t&&(e=t,t={}),t=t||{},"cores"in i&&!t.update)return e(null,i.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return i.cores=navigator.hardwareConcurrency,e(null,i.cores);if("undefined"==typeof Worker)return i.cores=1,e(null,i.cores);if("undefined"==typeof Blob)return i.cores=2,e(null,i.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(t){for(var e=Date.now(),r=e+4;Date.now()s.st&&o.sto.st&&s.ste){var n=new Error("Too few bytes to parse DER.");throw n.available=t.length(),n.remaining=e,n.requested=r,n}}o.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},o.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},o.create=function(t,e,r,i,a){if(n.util.isArray(i)){for(var s=[],u=0;ur){if(a.strict){var d=new Error("Too few bytes to read ASN.1 value.");throw d.available=e.length(),d.remaining=r,d.requested=p,d}p=r}var y=32==(32&u);if(y)if(f=[],void 0===p)for(;;){if(i(e,r,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),r-=2;break}s=e.length(),f.push(t(e,r,n+1,a)),r-=s-e.length()}else for(;p>0;)s=e.length(),f.push(t(e,p,n+1,a)),r-=s-e.length(),p-=s-e.length();if(void 0===f&&l===o.Class.UNIVERSAL&&c===o.Type.BITSTRING&&(h=e.bytes(p)),void 0===f&&a.decodeBitStrings&&l===o.Class.UNIVERSAL&&c===o.Type.BITSTRING&&p>1){var v=e.read,g=r,m=0;if(c===o.Type.BITSTRING&&(i(e,r,1),m=e.getByte(),r--),0===m)try{s=e.length();var b=t(e,r,n+1,{strict:!0,decodeBitStrings:!0}),w=s-e.length();r-=w,c==o.Type.BITSTRING&&w++;var S=b.tagClass;w!==p||S!==o.Class.UNIVERSAL&&S!==o.Class.CONTEXT_SPECIFIC||(f=[b])}catch(t){}void 0===f&&(e.read=v,r=g)}if(void 0===f){if(void 0===p){if(a.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=r}if(c===o.Type.BMPSTRING)for(f="";p>0;p-=2)i(e,r,2),f+=String.fromCharCode(e.getInt16()),r-=2;else f=e.getBytes(p),r-=p}var x=void 0===h?null:{bitStringContents:h};return o.create(l,c,y,f,x)}(t,t.length(),0,e);if(e.parseAllBytes&&0!==t.length()){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=r,s.remaining=t.length(),s}return a},o.toDer=function(t){var e=n.util.createBuffer(),r=t.tagClass|t.type,i=n.util.createBuffer(),a=!1;if("bitStringContents"in t&&(a=!0,t.original&&(a=o.equals(t,t.original))),a)i.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:i.putByte(0);for(var s=0;s1&&(0===t.value.charCodeAt(0)&&0==(128&t.value.charCodeAt(1))||255===t.value.charCodeAt(0)&&128==(128&t.value.charCodeAt(1)))?i.putBytes(t.value.substr(1)):i.putBytes(t.value);if(e.putByte(r),i.length()<=127)e.putByte(127&i.length());else{var u=i.length(),l="";do{l+=String.fromCharCode(255&u),u>>>=8}while(u>0);for(e.putByte(128|l.length),s=l.length-1;s>=0;--s)e.putByte(l.charCodeAt(s))}return e.putBuffer(i),e},o.oidToDer=function(t){var e,r,o,i,a=t.split("."),s=n.util.createBuffer();s.putByte(40*parseInt(a[0],10)+parseInt(a[1],10));for(var u=2;u>>=7,e||(i|=128),r.push(i),e=!1}while(o>0);for(var l=r.length-1;l>=0;--l)s.putByte(r[l])}return s},o.derToOid=function(t){var e;"string"==typeof t&&(t=n.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var o=0;t.length()>0;)o<<=7,128&(r=t.getByte())?o+=127&r:(e+="."+(o+r),o=0);return e},o.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(t.substr(2,2),10)-1,o=parseInt(t.substr(4,2),10),i=parseInt(t.substr(6,2),10),a=parseInt(t.substr(8,2),10),s=0;if(t.length>11){var u=t.charAt(10),l=10;"+"!==u&&"-"!==u&&(s=parseInt(t.substr(10,2),10),l+=2)}if(e.setUTCFullYear(r,n,o),e.setUTCHours(i,a,s,0),l&&("+"===(u=t.charAt(l))||"-"===u)){var c=60*parseInt(t.substr(l+1,2),10)+parseInt(t.substr(l+4,2),10);c*=6e4,"+"===u?e.setTime(+e-c):e.setTime(+e+c)}return e},o.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),n=parseInt(t.substr(4,2),10)-1,o=parseInt(t.substr(6,2),10),i=parseInt(t.substr(8,2),10),a=parseInt(t.substr(10,2),10),s=parseInt(t.substr(12,2),10),u=0,l=0,c=!1;"Z"===t.charAt(t.length-1)&&(c=!0);var f=t.length-5,h=t.charAt(f);return"+"!==h&&"-"!==h||(l=60*parseInt(t.substr(f+1,2),10)+parseInt(t.substr(f+4,2),10),l*=6e4,"+"===h&&(l*=-1),c=!0),"."===t.charAt(14)&&(u=1e3*parseFloat(t.substr(14),10)),c?(e.setUTCFullYear(r,n,o),e.setUTCHours(i,a,s,u),e.setTime(+e+l)):(e.setFullYear(r,n,o),e.setHours(i,a,s,u)),e},o.dateToUtcTime=function(t){if("string"==typeof t)return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var n=0;n=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r},o.derToInteger=function(t){"string"==typeof t&&(t=n.util.createBuffer(t));var e=8*t.length();if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)},o.validate=function(t,e,r,i){var a=!1;if(t.tagClass!==e.tagClass&&void 0!==e.tagClass||t.type!==e.type&&void 0!==e.type)i&&(t.tagClass!==e.tagClass&&i.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+t.tagClass+'"'),t.type!==e.type&&i.push("["+e.name+'] Expected type "'+e.type+'", got "'+t.type+'"'));else if(t.constructed===e.constructed||void 0===e.constructed){if(a=!0,e.value&&n.util.isArray(e.value))for(var s=0,u=0;a&&u0&&(i+="\n");for(var s="",u=0;u1?i+="0x"+n.util.bytesToHex(t.value.slice(1)):i+="(none)",t.value.length>0){var h=t.value.charCodeAt(0);1==h?i+=" (1 unused bit shown)":h>1&&(i+=" ("+h+" unused bits shown)")}}else if(t.type===o.Type.OCTETSTRING)a.test(t.value)||(i+="("+t.value+") "),i+="0x"+n.util.bytesToHex(t.value);else if(t.type===o.Type.UTF8)try{i+=n.util.decodeUtf8(t.value)}catch(e){if("URI malformed"!==e.message)throw e;i+="0x"+n.util.bytesToHex(t.value)+" (malformed UTF8)"}else t.type===o.Type.PRINTABLESTRING||t.type===o.Type.IA5String?i+=t.value:a.test(t.value)?i+="0x"+n.util.bytesToHex(t.value):0===t.value.length?i+="[null]":i+=t.value}return i}},function(t,e,r){var n=r(0);t.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(t,e,r){var n=r(0);function o(t,e){n.cipher.registerAlgorithm(t,function(){return new n.aes.Algorithm(t,e)})}r(13),r(19),r(1),t.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(t,e,r,n){var o=d({key:t,output:r,decrypt:!1,mode:n});return o.start(e),o},n.aes.createEncryptionCipher=function(t,e){return d({key:t,output:null,decrypt:!1,mode:e})},n.aes.startDecrypting=function(t,e,r,n){var o=d({key:t,output:r,decrypt:!0,mode:n});return o.start(e),o},n.aes.createDecryptionCipher=function(t,e){return d({key:t,output:null,decrypt:!0,mode:e})},n.aes.Algorithm=function(t,e){c||f();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(t,e){return p(r._w,t,e,!1)},decrypt:function(t,e){return p(r._w,t,e,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var e,r=t.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){e=r,r=n.util.createBuffer();for(var o=0;o>>=2,o=0;o>8^255&f^99,i[y]=f,a[f]=y,p=(h=t[f])<<24^f<<16^f<<8^f^h,d=((r=t[y])^(n=t[r])^(o=t[n]))<<24^(y^o)<<16^(y^n^o)<<8^y^r^o;for(var g=0;g<4;++g)u[g][y]=p,l[g][f]=d,p=p<<24|p>>>8,d=d<<24|d>>>8;0===y?y=v=1:(y=r^t[t[t[r^o]]],v^=t[t[v]])}}function h(t,e){for(var r,n=t.slice(0),o=1,a=n.length,u=4*(a+6+1),c=a;c>>16&255]<<24^i[r>>>8&255]<<16^i[255&r]<<8^i[r>>>24]^s[o]<<24,o++):a>6&&c%a==4&&(r=i[r>>>24]<<24^i[r>>>16&255]<<16^i[r>>>8&255]<<8^i[255&r]),n[c]=n[c-a]^r;if(e){for(var f,h=l[0],p=l[1],d=l[2],y=l[3],v=n.slice(0),g=(c=0,(u=n.length)-4);c>>24]]^p[i[f>>>16&255]]^d[i[f>>>8&255]]^y[i[255&f]];n=v}return n}function p(t,e,r,n){var o,s,c,f,h,p,d,y,v,g,m,b,w=t.length/4-1;n?(o=l[0],s=l[1],c=l[2],f=l[3],h=a):(o=u[0],s=u[1],c=u[2],f=u[3],h=i),p=e[0]^t[0],d=e[n?3:1]^t[1],y=e[2]^t[2],v=e[n?1:3]^t[3];for(var S=3,x=1;x>>24]^s[d>>>16&255]^c[y>>>8&255]^f[255&v]^t[++S],m=o[d>>>24]^s[y>>>16&255]^c[v>>>8&255]^f[255&p]^t[++S],b=o[y>>>24]^s[v>>>16&255]^c[p>>>8&255]^f[255&d]^t[++S],v=o[v>>>24]^s[p>>>16&255]^c[d>>>8&255]^f[255&y]^t[++S],p=g,d=m,y=b;r[0]=h[p>>>24]<<24^h[d>>>16&255]<<16^h[y>>>8&255]<<8^h[255&v]^t[++S],r[n?3:1]=h[d>>>24]<<24^h[y>>>16&255]<<16^h[v>>>8&255]<<8^h[255&p]^t[++S],r[2]=h[y>>>24]<<24^h[v>>>16&255]<<16^h[p>>>8&255]<<8^h[255&d]^t[++S],r[n?1:3]=h[v>>>24]<<24^h[p>>>16&255]<<16^h[d>>>8&255]<<8^h[255&y]^t[++S]}function d(t){var e,r="AES-"+((t=t||{}).mode||"CBC").toUpperCase(),o=(e=t.decrypt?n.cipher.createDecipher(r,t.key):n.cipher.createCipher(r,t.key)).start;return e.start=function(t,r){var i=null;r instanceof n.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=t,o.call(e,r)},e}},function(t,e,r){var n=r(0);n.pki=n.pki||{};var o=t.exports=n.pki.oids=n.oids=n.oids||{};function i(t,e){o[t]=e,o[e]=t}function a(t,e){o[t]=e}i("1.2.840.113549.1.1.1","rsaEncryption"),i("1.2.840.113549.1.1.4","md5WithRSAEncryption"),i("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),i("1.2.840.113549.1.1.7","RSAES-OAEP"),i("1.2.840.113549.1.1.8","mgf1"),i("1.2.840.113549.1.1.9","pSpecified"),i("1.2.840.113549.1.1.10","RSASSA-PSS"),i("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),i("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),i("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),i("1.3.101.112","EdDSA25519"),i("1.2.840.10040.4.3","dsa-with-sha1"),i("1.3.14.3.2.7","desCBC"),i("1.3.14.3.2.26","sha1"),i("1.3.14.3.2.29","sha1WithRSASignature"),i("2.16.840.1.101.3.4.2.1","sha256"),i("2.16.840.1.101.3.4.2.2","sha384"),i("2.16.840.1.101.3.4.2.3","sha512"),i("2.16.840.1.101.3.4.2.4","sha224"),i("2.16.840.1.101.3.4.2.5","sha512-224"),i("2.16.840.1.101.3.4.2.6","sha512-256"),i("1.2.840.113549.2.2","md2"),i("1.2.840.113549.2.5","md5"),i("1.2.840.113549.1.7.1","data"),i("1.2.840.113549.1.7.2","signedData"),i("1.2.840.113549.1.7.3","envelopedData"),i("1.2.840.113549.1.7.4","signedAndEnvelopedData"),i("1.2.840.113549.1.7.5","digestedData"),i("1.2.840.113549.1.7.6","encryptedData"),i("1.2.840.113549.1.9.1","emailAddress"),i("1.2.840.113549.1.9.2","unstructuredName"),i("1.2.840.113549.1.9.3","contentType"),i("1.2.840.113549.1.9.4","messageDigest"),i("1.2.840.113549.1.9.5","signingTime"),i("1.2.840.113549.1.9.6","counterSignature"),i("1.2.840.113549.1.9.7","challengePassword"),i("1.2.840.113549.1.9.8","unstructuredAddress"),i("1.2.840.113549.1.9.14","extensionRequest"),i("1.2.840.113549.1.9.20","friendlyName"),i("1.2.840.113549.1.9.21","localKeyId"),i("1.2.840.113549.1.9.22.1","x509Certificate"),i("1.2.840.113549.1.12.10.1.1","keyBag"),i("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),i("1.2.840.113549.1.12.10.1.3","certBag"),i("1.2.840.113549.1.12.10.1.4","crlBag"),i("1.2.840.113549.1.12.10.1.5","secretBag"),i("1.2.840.113549.1.12.10.1.6","safeContentsBag"),i("1.2.840.113549.1.5.13","pkcs5PBES2"),i("1.2.840.113549.1.5.12","pkcs5PBKDF2"),i("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),i("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),i("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),i("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),i("1.2.840.113549.2.7","hmacWithSHA1"),i("1.2.840.113549.2.8","hmacWithSHA224"),i("1.2.840.113549.2.9","hmacWithSHA256"),i("1.2.840.113549.2.10","hmacWithSHA384"),i("1.2.840.113549.2.11","hmacWithSHA512"),i("1.2.840.113549.3.7","des-EDE3-CBC"),i("2.16.840.1.101.3.4.1.2","aes128-CBC"),i("2.16.840.1.101.3.4.1.22","aes192-CBC"),i("2.16.840.1.101.3.4.1.42","aes256-CBC"),i("2.5.4.3","commonName"),i("2.5.4.4","surname"),i("2.5.4.5","serialNumber"),i("2.5.4.6","countryName"),i("2.5.4.7","localityName"),i("2.5.4.8","stateOrProvinceName"),i("2.5.4.9","streetAddress"),i("2.5.4.10","organizationName"),i("2.5.4.11","organizationalUnitName"),i("2.5.4.12","title"),i("2.5.4.13","description"),i("2.5.4.15","businessCategory"),i("2.5.4.17","postalCode"),i("2.5.4.42","givenName"),i("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),i("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),i("2.16.840.1.113730.1.1","nsCertType"),i("2.16.840.1.113730.1.13","nsComment"),a("2.5.29.1","authorityKeyIdentifier"),a("2.5.29.2","keyAttributes"),a("2.5.29.3","certificatePolicies"),a("2.5.29.4","keyUsageRestriction"),a("2.5.29.5","policyMapping"),a("2.5.29.6","subtreesConstraint"),a("2.5.29.7","subjectAltName"),a("2.5.29.8","issuerAltName"),a("2.5.29.9","subjectDirectoryAttributes"),a("2.5.29.10","basicConstraints"),a("2.5.29.11","nameConstraints"),a("2.5.29.12","policyConstraints"),a("2.5.29.13","basicConstraints"),i("2.5.29.14","subjectKeyIdentifier"),i("2.5.29.15","keyUsage"),a("2.5.29.16","privateKeyUsagePeriod"),i("2.5.29.17","subjectAltName"),i("2.5.29.18","issuerAltName"),i("2.5.29.19","basicConstraints"),a("2.5.29.20","cRLNumber"),a("2.5.29.21","cRLReason"),a("2.5.29.22","expirationDate"),a("2.5.29.23","instructionCode"),a("2.5.29.24","invalidityDate"),a("2.5.29.25","cRLDistributionPoints"),a("2.5.29.26","issuingDistributionPoint"),a("2.5.29.27","deltaCRLIndicator"),a("2.5.29.28","issuingDistributionPoint"),a("2.5.29.29","certificateIssuer"),a("2.5.29.30","nameConstraints"),i("2.5.29.31","cRLDistributionPoints"),i("2.5.29.32","certificatePolicies"),a("2.5.29.33","policyMappings"),a("2.5.29.34","policyConstraints"),i("2.5.29.35","authorityKeyIdentifier"),a("2.5.29.36","policyConstraints"),i("2.5.29.37","extKeyUsage"),a("2.5.29.46","freshestCRL"),a("2.5.29.54","inhibitAnyPolicy"),i("1.3.6.1.4.1.11129.2.4.2","timestampList"),i("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),i("1.3.6.1.5.5.7.3.1","serverAuth"),i("1.3.6.1.5.5.7.3.2","clientAuth"),i("1.3.6.1.5.5.7.3.3","codeSigning"),i("1.3.6.1.5.5.7.3.4","emailProtection"),i("1.3.6.1.5.5.7.3.8","timeStamping")},function(t,e,r){var n=r(0);r(1);var o=t.exports=n.pem=n.pem||{};function i(t){for(var e=t.name+": ",r=[],n=function(t,e){return" "+e},o=0;o65&&-1!==a){var s=e[a];","===s?(++a,e=e.substr(0,a)+"\r\n "+e.substr(a)):e=e.substr(0,a)+"\r\n"+s+e.substr(a+1),i=o-a-1,a=-1,++o}else" "!==e[o]&&"\t"!==e[o]&&","!==e[o]||(a=o);return e}function a(t){return t.replace(/^\s+/,"")}o.encode=function(t,e){e=e||{};var r,o="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(o+=i(r={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(o+=i(r={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(r={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&r.values.push(t.dekInfo.parameters),o+=i(r)),t.headers)for(var a=0;ae.blockLength&&(e.start(),e.update(a.bytes()),a=e.digest()),r=n.util.createBuffer(),o=n.util.createBuffer(),l=a.length(),u=0;u>>0,u>>>0];for(var l=o.fullMessageLength.length-1;l>=0;--l)o.fullMessageLength[l]+=u[1],u[1]=u[0]+(o.fullMessageLength[l]/4294967296>>>0),o.fullMessageLength[l]=o.fullMessageLength[l]>>>0,u[0]=u[1]/4294967296>>>0;return e.putBytes(i),s(t,r,e),(e.read>2048||0===e.length())&&e.compact(),o},o.digest=function(){var a=n.util.createBuffer();a.putBytes(e.bytes());var u,l=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize&o.blockLength-1;a.putBytes(i.substr(0,o.blockLength-l));for(var c=8*o.fullMessageLength[0],f=0;f>>0,a.putInt32(c>>>0),c=u>>>0;a.putInt32(c);var h={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};s(h,r,a);var p=n.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p},o};var i=null,a=!1;function s(t,e,r){for(var n,o,i,a,s,u,l,c=r.length();c>=64;){for(o=t.h0,i=t.h1,a=t.h2,s=t.h3,u=t.h4,l=0;l<16;++l)n=r.getInt32(),e[l]=n,n=(o<<5|o>>>27)+(s^i&(a^s))+u+1518500249+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<20;++l)n=(n=e[l-3]^e[l-8]^e[l-14]^e[l-16])<<1|n>>>31,e[l]=n,n=(o<<5|o>>>27)+(s^i&(a^s))+u+1518500249+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<32;++l)n=(n=e[l-3]^e[l-8]^e[l-14]^e[l-16])<<1|n>>>31,e[l]=n,n=(o<<5|o>>>27)+(i^a^s)+u+1859775393+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<40;++l)n=(n=e[l-6]^e[l-16]^e[l-28]^e[l-32])<<2|n>>>30,e[l]=n,n=(o<<5|o>>>27)+(i^a^s)+u+1859775393+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<60;++l)n=(n=e[l-6]^e[l-16]^e[l-28]^e[l-32])<<2|n>>>30,e[l]=n,n=(o<<5|o>>>27)+(i&a|s&(i^a))+u+2400959708+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<80;++l)n=(n=e[l-6]^e[l-16]^e[l-28]^e[l-32])<<2|n>>>30,e[l]=n,n=(o<<5|o>>>27)+(i^a^s)+u+3395469782+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;t.h0=t.h0+o|0,t.h1=t.h1+i|0,t.h2=t.h2+a|0,t.h3=t.h3+s|0,t.h4=t.h4+u|0,c-=64}}},function(t,e,r){var n=r(0);function o(t,e){n.cipher.registerAlgorithm(t,function(){return new n.des.Algorithm(t,e)})}r(13),r(19),r(1),t.exports=n.des=n.des||{},n.des.startEncrypting=function(t,e,r,n){var o=d({key:t,output:r,decrypt:!1,mode:n||(null===e?"ECB":"CBC")});return o.start(e),o},n.des.createEncryptionCipher=function(t,e){return d({key:t,output:null,decrypt:!1,mode:e})},n.des.startDecrypting=function(t,e,r,n){var o=d({key:t,output:r,decrypt:!0,mode:n||(null===e?"ECB":"CBC")});return o.start(e),o},n.des.createDecryptionCipher=function(t,e){return d({key:t,output:null,decrypt:!0,mode:e})},n.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(t,e){return p(r._keys,t,e,!1)},decrypt:function(t,e){return p(r._keys,t,e,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=n.util.createBuffer(t.key);if(0===this.name.indexOf("3DES")&&24!==e.length())throw new Error("Invalid Triple-DES key size: "+8*e.length());this._keys=function(t){for(var e,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],o=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],a=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],v=t.length()>8?3:1,g=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w>>4^x))<<4,S^=e=65535&((x^=e)>>>-16^S),S^=(e=858993459&(S>>>2^(x^=e<<-16)))<<2,S^=e=65535&((x^=e)>>>-16^S),S^=(e=1431655765&(S>>>1^(x^=e<<-16)))<<1,S^=e=16711935&((x^=e)>>>8^S),e=(S^=(e=1431655765&(S>>>1^(x^=e<<8)))<<1)<<8|(x^=e)>>>20&240,S=x<<24|x<<8&16711680|x>>>8&65280|x>>>24&240,x=e;for(var _=0;_>>26,x=x<<2|x>>>26):(S=S<<1|S>>>27,x=x<<1|x>>>27);var E=r[(S&=-15)>>>28]|n[S>>>24&15]|o[S>>>20&15]|i[S>>>16&15]|a[S>>>12&15]|s[S>>>8&15]|u[S>>>4&15],O=l[(x&=-15)>>>28]|c[x>>>24&15]|f[x>>>20&15]|h[x>>>16&15]|p[x>>>12&15]|d[x>>>8&15]|y[x>>>4&15];e=65535&(O>>>16^E),g[b++]=E^e,g[b++]=O^e<<16}}return g}(e),this._init=!0}},o("DES-ECB",n.cipher.modes.ecb),o("DES-CBC",n.cipher.modes.cbc),o("DES-CFB",n.cipher.modes.cfb),o("DES-OFB",n.cipher.modes.ofb),o("DES-CTR",n.cipher.modes.ctr),o("3DES-ECB",n.cipher.modes.ecb),o("3DES-CBC",n.cipher.modes.cbc),o("3DES-CFB",n.cipher.modes.cfb),o("3DES-OFB",n.cipher.modes.ofb),o("3DES-CTR",n.cipher.modes.ctr);var i=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],a=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],s=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],u=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],l=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],c=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],f=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function p(t,e,r,n){var o,p,d=32===t.length?3:9;o=3===d?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=e[0],v=e[1];y^=(p=252645135&(y>>>4^v))<<4,y^=(p=65535&(y>>>16^(v^=p)))<<16,y^=p=858993459&((v^=p)>>>2^y),y^=p=16711935&((v^=p<<2)>>>8^y),y=(y^=(p=1431655765&(y>>>1^(v^=p<<8)))<<1)<<1|y>>>31,v=(v^=p)<<1|v>>>31;for(var g=0;g>>4|v<<28)^t[w+1];p=y,y=v,v=p^(a[S>>>24&63]|u[S>>>16&63]|c[S>>>8&63]|h[63&S]|i[x>>>24&63]|s[x>>>16&63]|l[x>>>8&63]|f[63&x])}p=y,y=v,v=p}v=v>>>1|v<<31,v^=p=1431655765&((y=y>>>1|y<<31)>>>1^v),v^=(p=16711935&(v>>>8^(y^=p<<1)))<<8,v^=(p=858993459&(v>>>2^(y^=p)))<<2,v^=p=65535&((y^=p)>>>16^v),v^=p=252645135&((y^=p<<16)>>>4^v),y^=p<<4,r[0]=y,r[1]=v}function d(t){var e,r="DES-"+((t=t||{}).mode||"CBC").toUpperCase(),o=(e=t.decrypt?n.cipher.createDecipher(r,t.key):n.cipher.createCipher(r,t.key)).start;return e.start=function(t,r){var i=null;r instanceof n.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=t,o.call(e,r)},e}},function(t,e,r){var n=r(0);if(r(3),r(12),r(6),r(26),r(27),r(2),r(1),void 0===o)var o=n.jsbn.BigInteger;var i=n.util.isNodejs?r(16):null,a=n.asn1,u=n.util;n.pki=n.pki||{},t.exports=n.pki.rsa=n.rsa=n.rsa||{};var l=n.pki,c=[6,4,2,4,2,4,6,2],f={name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},p={name:"RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},d=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y={name:"DigestInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},v=function(t){var e;if(!(t.algorithm in l.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}e=l.oids[t.algorithm];var n=a.oidToDer(e).getBytes(),o=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),i=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);i.value.push(a.create(a.Class.UNIVERSAL,a.Type.OID,!1,n)),i.value.push(a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,""));var s=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,t.digest().getBytes());return o.value.push(i),o.value.push(s),a.toDer(o).getBytes()},g=function(t,e,r){if(r)return t.modPow(e.e,e.n);if(!e.p||!e.q)return t.modPow(e.d,e.n);var i;e.dP||(e.dP=e.d.mod(e.p.subtract(o.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(o.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));do{i=new o(n.util.bytesToHex(n.random.getBytes(e.n.bitLength()/8)),16)}while(i.compareTo(e.n)>=0||!i.gcd(e.n).equals(o.ONE));for(var a=(t=t.multiply(i.modPow(e.e,e.n)).mod(e.n)).mod(e.p).modPow(e.dP,e.p),s=t.mod(e.q).modPow(e.dQ,e.q);a.compareTo(s)<0;)a=a.add(e.p);var u=a.subtract(s).multiply(e.qInv).mod(e.p).multiply(e.q).add(s);return u.multiply(i.modInverse(e.n)).mod(e.n)};function m(t,e,r){var o=n.util.createBuffer(),i=Math.ceil(e.n.bitLength()/8);if(t.length>i-11){var a=new Error("Message is too long for PKCS#1 v1.5 padding.");throw a.length=t.length,a.max=i-11,a}o.putByte(0),o.putByte(r);var s,u=i-3-t.length;if(0===r||1===r){s=0===r?0:255;for(var l=0;l0;){var c=0,f=n.random.getBytes(u);for(l=0;l1;){if(255!==a.getByte()){--a.read;break}++l}else if(2===u)for(l=0;a.length()>1;){if(0===a.getByte()){--a.read;break}++l}if(0!==a.getByte()||l!==i-3-a.length())throw new Error("Encryption block is invalid.");return a.getBytes()}function w(t,e,r){"function"==typeof e&&(r=e,e={});var i={algorithm:{name:(e=e||{}).algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};function a(){s(t.pBits,function(e,n){return e?r(e):(t.p=n,null!==t.q?u(e,t.q):void s(t.qBits,u))})}function s(t,e){n.prime.generateProbablePrime(t,i,e)}function u(e,n){if(e)return r(e);if(t.q=n,t.p.compareTo(t.q)<0){var i=t.p;t.p=t.q,t.q=i}if(0!==t.p.subtract(o.ONE).gcd(t.e).compareTo(o.ONE))return t.p=null,void a();if(0!==t.q.subtract(o.ONE).gcd(t.e).compareTo(o.ONE))return t.q=null,void s(t.qBits,u);if(t.p1=t.p.subtract(o.ONE),t.q1=t.q.subtract(o.ONE),t.phi=t.p1.multiply(t.q1),0!==t.phi.gcd(t.e).compareTo(o.ONE))return t.p=t.q=null,void a();if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits)return t.q=null,void s(t.qBits,u);var c=t.e.modInverse(t.phi);t.keys={privateKey:l.rsa.setPrivateKey(t.n,t.e,c,t.p,t.q,c.mod(t.p1),c.mod(t.q1),t.q.modInverse(t.p)),publicKey:l.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}"prng"in e&&(i.prng=e.prng),a()}function S(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=n.util.hexToBytes(e);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function x(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}function _(t){return n.util.isNodejs&&"function"==typeof i[t]}function E(t){return void 0!==u.globalScope&&"object"==s(u.globalScope.crypto)&&"object"==s(u.globalScope.crypto.subtle)&&"function"==typeof u.globalScope.crypto.subtle[t]}function O(t){return void 0!==u.globalScope&&"object"==s(u.globalScope.msCrypto)&&"object"==s(u.globalScope.msCrypto.subtle)&&"function"==typeof u.globalScope.msCrypto.subtle[t]}function P(t){for(var e=n.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),o=0;o0;)c.putByte(0),--f;return c.putBytes(n.util.hexToBytes(l)),c.getBytes()},l.rsa.decrypt=function(t,e,r,i){var a=Math.ceil(e.n.bitLength()/8);if(t.length!==a){var s=new Error("Encrypted message length is invalid.");throw s.length=t.length,s.expected=a,s}var u=new o(n.util.createBuffer(t).toHex(),16);if(u.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=g(u,e,r).toString(16),c=n.util.createBuffer(),f=a-Math.ceil(l.length/2);f>0;)c.putByte(0),--f;return c.putBytes(n.util.hexToBytes(l)),!1!==i?b(c.getBytes(),e,r):c.getBytes()},l.rsa.createKeyPairGenerationState=function(t,e,r){"string"==typeof t&&(t=parseInt(t,10)),t=t||2048;var i,a=(r=r||{}).prng||n.random,s={nextBytes:function(t){for(var e=a.getBytesSync(t.length),r=0;r>1,pBits:t-(t>>1),pqState:0,num:null,keys:null}).e.fromInt(i.eInt),i},l.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new o(null);r.fromInt(30);for(var n,i=0,a=function(t,e){return t|e},s=+new Date,u=0;null===t.keys&&(e<=0||uf?t.pqState=0:t.num.isProbablePrime(x(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(c[i++%8],0):2===t.pqState?t.pqState=0===t.num.subtract(o.ONE).gcd(t.e).compareTo(o.ONE)?3:0:3===t.pqState&&(t.pqState=0,null===t.p?t.p=t.num:t.q=t.num,null!==t.p&&null!==t.q&&++t.state,t.num=null)}else if(1===t.state)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(2===t.state)t.p1=t.p.subtract(o.ONE),t.q1=t.q.subtract(o.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(3===t.state)0===t.phi.gcd(t.e).compareTo(o.ONE)?++t.state:(t.p=null,t.q=null,t.state=0);else if(4===t.state)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(5===t.state){var p=t.e.modInverse(t.phi);t.keys={privateKey:l.rsa.setPrivateKey(t.n,t.e,p,t.p,t.q,p.mod(t.p1),p.mod(t.q1),t.q.modInverse(t.p)),publicKey:l.rsa.setPublicKey(t.n,t.e)}}u+=(n=+new Date)-s,s=n}return null!==t.keys},l.rsa.generateKeyPair=function(t,e,r,o){if(1===arguments.length?"object"==s(t)?(r=t,t=void 0):"function"==typeof t&&(o=t,t=void 0):2===arguments.length?"number"==typeof t?"function"==typeof e?(o=e,e=void 0):"number"!=typeof e&&(r=e,e=void 0):(r=t,o=e,t=void 0,e=void 0):3===arguments.length&&("number"==typeof e?"function"==typeof r&&(o=r,r=void 0):(o=r,r=e,e=void 0)),r=r||{},void 0===t&&(t=r.bits||2048),void 0===e&&(e=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(65537===e||3===e))if(o){if(_("generateKeyPair"))return i.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(t,e,r){if(t)return o(t);o(null,{privateKey:l.privateKeyFromPem(r),publicKey:l.publicKeyFromPem(e)})});if(E("generateKey")&&E("exportKey"))return u.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:P(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(t){return u.globalScope.crypto.subtle.exportKey("pkcs8",t.privateKey)}).then(void 0,function(t){o(t)}).then(function(t){if(t){var e=l.privateKeyFromAsn1(a.fromDer(n.util.createBuffer(t)));o(null,{privateKey:e,publicKey:l.setRsaPublicKey(e.n,e.e)})}});if(O("generateKey")&&O("exportKey")){var c=u.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:P(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);return c.oncomplete=function(t){var e=t.target.result,r=u.globalScope.msCrypto.subtle.exportKey("pkcs8",e.privateKey);r.oncomplete=function(t){var e=t.target.result,r=l.privateKeyFromAsn1(a.fromDer(n.util.createBuffer(e)));o(null,{privateKey:r,publicKey:l.setRsaPublicKey(r.n,r.e)})},r.onerror=function(t){o(t)}},void(c.onerror=function(t){o(t)})}}else if(_("generateKeyPairSync")){var f=i.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:l.privateKeyFromPem(f.privateKey),publicKey:l.publicKeyFromPem(f.publicKey)}}var h=l.rsa.createKeyPairGenerationState(t,e,r);if(!o)return l.rsa.stepKeyPairGenerationState(h,0),h.keys;w(h,r,o)},l.setRsaPublicKey=l.rsa.setPublicKey=function(t,e){var r={n:t,e:e,encrypt:function(t,e,o){if("string"==typeof e?e=e.toUpperCase():void 0===e&&(e="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===e)e={encode:function(t,e,r){return m(t,e,2).getBytes()}};else if("RSA-OAEP"===e||"RSAES-OAEP"===e)e={encode:function(t,e){return n.pkcs1.encode_rsa_oaep(e,t,o)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(e))e={encode:function(t){return t}};else if("string"==typeof e)throw new Error('Unsupported encryption scheme: "'+e+'".');var i=e.encode(t,r,!0);return l.rsa.encrypt(i,r,!0)},verify:function(t,e,o,i){"string"==typeof o?o=o.toUpperCase():void 0===o&&(o="RSASSA-PKCS1-V1_5"),void 0===i&&(i={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in i||(i._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===o?o={verify:function(t,e){e=b(e,r,!0);var o=a.fromDer(e,{parseAllBytes:i._parseAllDigestBytes}),s={},u=[];if(!a.validate(o,y,s,u))throw(l=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=u,l;var l,c=a.derToOid(s.algorithmIdentifier);if(c!==n.oids.md2&&c!==n.oids.md5&&c!==n.oids.sha1&&c!==n.oids.sha224&&c!==n.oids.sha256&&c!==n.oids.sha384&&c!==n.oids.sha512&&c!==n.oids["sha512-224"]&&c!==n.oids["sha512-256"])throw(l=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=c,l;if(!(c!==n.oids.md2&&c!==n.oids.md5||"parameters"in s))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return t===s.digest}}:"NONE"!==o&&"NULL"!==o&&null!==o||(o={verify:function(t,e){return t===b(e,r,!0)}});var s=l.rsa.decrypt(e,r,!0,!1);return o.verify(t,s,r.n.bitLength())}};return r},l.setRsaPrivateKey=l.rsa.setPrivateKey=function(t,e,r,o,i,a,s,u){var c={n:t,e:e,d:r,p:o,q:i,dP:a,dQ:s,qInv:u,decrypt:function(t,e,r){"string"==typeof e?e=e.toUpperCase():void 0===e&&(e="RSAES-PKCS1-V1_5");var o=l.rsa.decrypt(t,c,!1,!1);if("RSAES-PKCS1-V1_5"===e)e={decode:b};else if("RSA-OAEP"===e||"RSAES-OAEP"===e)e={decode:function(t,e){return n.pkcs1.decode_rsa_oaep(e,t,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(e))throw new Error('Unsupported encryption scheme: "'+e+'".');e={decode:function(t){return t}}}return e.decode(o,c,!1)},sign:function(t,e){var r=!1;"string"==typeof e&&(e=e.toUpperCase()),void 0===e||"RSASSA-PKCS1-V1_5"===e?(e={encode:v},r=1):"NONE"!==e&&"NULL"!==e&&null!==e||(e={encode:function(){return t}},r=1);var n=e.encode(t,c.n.bitLength());return l.rsa.encrypt(n,c,r)}};return c},l.wrapRsaPrivateKey=function(t){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(l.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(t).getBytes())])},l.privateKeyFromAsn1=function(t){var e,r,i,s,u,c,p,d,y={},v=[];if(a.validate(t,f,y,v)&&(t=a.fromDer(n.util.createBuffer(y.privateKey))),y={},v=[],!a.validate(t,h,y,v)){var g=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw g.errors=v,g}return e=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),i=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),s=n.util.createBuffer(y.privateKeyPrime1).toHex(),u=n.util.createBuffer(y.privateKeyPrime2).toHex(),c=n.util.createBuffer(y.privateKeyExponent1).toHex(),p=n.util.createBuffer(y.privateKeyExponent2).toHex(),d=n.util.createBuffer(y.privateKeyCoefficient).toHex(),l.setRsaPrivateKey(new o(e,16),new o(r,16),new o(i,16),new o(s,16),new o(u,16),new o(c,16),new o(p,16),new o(d,16))},l.privateKeyToAsn1=l.privateKeyToRSAPrivateKey=function(t){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(t.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(t.e)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(t.d)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(t.p)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(t.q)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(t.dP)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(t.dQ)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(t.qInv))])},l.publicKeyFromAsn1=function(t){var e={},r=[];if(a.validate(t,d,e,r)){var i,s=a.derToOid(e.publicKeyOid);if(s!==l.oids.rsaEncryption)throw(i=new Error("Cannot read public key. Unknown OID.")).oid=s,i;t=e.rsaPublicKey}if(r=[],!a.validate(t,p,e,r))throw(i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,i;var u=n.util.createBuffer(e.publicKeyModulus).toHex(),c=n.util.createBuffer(e.publicKeyExponent).toHex();return l.setRsaPublicKey(new o(u,16),new o(c,16))},l.publicKeyToAsn1=l.publicKeyToSubjectPublicKeyInfo=function(t){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(l.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,[l.publicKeyToRSAPublicKey(t)])])},l.publicKeyToRSAPublicKey=function(t){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(t.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(t.e))])}},function(t,e,r){var n,o=r(0);function i(t,e,r){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function a(){return new i(null)}function s(t,e,r,n,o,i){for(var a=16383&e,s=e>>14;--i>=0;){var u=16383&this.data[t],l=this.data[t++]>>14,c=s*u+l*a;o=((u=a*u+((16383&c)<<14)+r.data[n]+o)>>28)+(c>>14)+s*l,r.data[n++]=268435455&u}return o}t.exports=o.jsbn=o.jsbn||{},o.jsbn.BigInteger=i,"undefined"==typeof navigator?(i.prototype.am=s,n=28):"Microsoft Internet Explorer"==navigator.appName?(i.prototype.am=function(t,e,r,n,o,i){for(var a=32767&e,s=e>>15;--i>=0;){var u=32767&this.data[t],l=this.data[t++]>>15,c=s*u+l*a;o=((u=a*u+((32767&c)<<15)+r.data[n]+(1073741823&o))>>>30)+(c>>>15)+s*l+(o>>>30),r.data[n++]=1073741823&u}return o},n=30):"Netscape"!=navigator.appName?(i.prototype.am=function(t,e,r,n,o,i){for(;--i>=0;){var a=e*this.data[t++]+r.data[n]+o;o=Math.floor(a/67108864),r.data[n++]=67108863&a}return o},n=26):(i.prototype.am=s,n=28),i.prototype.DB=n,i.prototype.DM=(1<>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function y(t){this.m=t}function v(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function x(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function _(){}function E(t){return t}function O(t){this.r2=a(),this.q3=a(),i.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}y.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},y.prototype.revert=function(t){return t},y.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},y.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},y.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},v.prototype.convert=function(t){var e=a();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(i.ZERO)>0&&this.m.subTo(e,e),e},v.prototype.revert=function(t){var e=a();return t.copyTo(e),this.reduce(e),e},v.prototype.reduce=function(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,n,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},v.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},v.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},i.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s},i.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0},i.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,o=!1,a=0;--n>=0;){var s=8==r?255&t[n]:h(t,n);s<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0==a?this.data[this.t++]=s:a+r>this.DB?(this.data[this.t-1]|=(s&(1<>this.DB-a):this.data[this.t-1]|=s<=this.DB&&(a-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,a>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==t;)--this.t},i.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s},i.prototype.drShiftTo=function(t,e){for(var r=t;r=0;--r)e.data[r+a+1]=this.data[r]>>o|s,s=(this.data[r]&i)<=0;--r)e.data[r]=0;e.data[a]=s,e.t=this.t+a+1,e.s=this.s,e.clamp()},i.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,o=this.DB-n,i=(1<>n;for(var a=r+1;a>n;n>0&&(e.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e.data[r++]=this.DV+n:n>0&&(e.data[r++]=n),e.t=r,e.clamp()},i.prototype.multiplyTo=function(t,e){var r=this.abs(),n=t.abs(),o=r.t;for(e.t=o+n.t;--o>=0;)e.data[o]=0;for(o=0;o=0;)t.data[r]=0;for(r=0;r=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()},i.prototype.divRemTo=function(t,e,r){var n=t.abs();if(!(n.t<=0)){var o=this.abs();if(o.t0?(n.lShiftTo(c,s),o.lShiftTo(c,r)):(n.copyTo(s),o.copyTo(r));var f=s.t,h=s.data[f-1];if(0!=h){var p=h*(1<1?s.data[f-2]>>this.F2:0),y=this.FV/p,v=(1<=0&&(r.data[r.t++]=1,r.subTo(w,r)),i.ONE.dlShiftTo(f,w),w.subTo(s,s);s.t=0;){var S=r.data[--m]==h?this.DM:Math.floor(r.data[m]*y+(r.data[m-1]+g)*v);if((r.data[m]+=s.am(0,S,r,b,0,f))0&&r.rShiftTo(c,r),u<0&&i.ZERO.subTo(r,r)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},i.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},i.prototype.exp=function(t,e){if(t>4294967295||t<1)return i.ONE;var r=a(),n=a(),o=e.convert(this),s=d(t)-1;for(o.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,o,r);else{var u=r;r=n,n=u}return e.revert(r)},i.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<0)for(s>s)>0&&(o=!0,i=f(r));a>=0;)s>(s+=this.DB-e)):(r=this.data[a]>>(s-=e)&n,s<=0&&(s+=this.DB,--a)),r>0&&(o=!0),o&&(i+=f(r));return o?i:"0"},i.prototype.negate=function(){var t=a();return i.ZERO.subTo(this,t),t},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this.data[r]-t.data[r]))return e;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+d(this.data[this.t-1]^this.s&this.DM)},i.prototype.mod=function(t){var e=a();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&t.subTo(e,e),e},i.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new y(e):new v(e),this.exp(t,r)},i.ZERO=p(0),i.ONE=p(1),_.prototype.convert=E,_.prototype.revert=E,_.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},_.prototype.sqrTo=function(t,e){t.squareTo(e)},O.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=a();return t.copyTo(e),this.reduce(e),e},O.prototype.revert=function(t){return t},O.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},O.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},O.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],k=(1<<26)/P[P.length-1];i.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},i.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=p(r),o=a(),i=a(),s="";for(this.divRemTo(n,o,i);o.signum()>0;)s=(r+i.intValue()).toString(t).substr(1)+s,o.divRemTo(n,o,i);return i.intValue().toString(t)+s},i.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),o=!1,a=0,s=0,u=0;u=r&&(this.dMultiply(n),this.dAddOffset(s,0),a=0,s=0))}a>0&&(this.dMultiply(Math.pow(e,a)),this.dAddOffset(s,0)),o&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(i.ONE.shiftLeft(t-1),m,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(i.ONE.shiftLeft(t-1),this);else{var n=new Array,o=7&t;n.length=1+(t>>3),e.nextBytes(n),o>0?n[0]&=(1<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e.data[r++]=n:n<-1&&(e.data[r++]=this.DV+n),e.t=r,e.clamp()},i.prototype.dMultiply=function(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}},i.prototype.multiplyLowerTo=function(t,e,r){var n,o=Math.min(this.t+t.t,e);for(r.s=0,r.t=o;o>0;)r.data[--o]=0;for(n=r.t-this.t;o=0;)r.data[n]=0;for(n=Math.max(e-this.t,0);n0)if(0==e)r=this.data[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this.data[n])%t;return r},i.prototype.millerRabin=function(t){var e=this.subtract(i.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var n,o=e.shiftRight(r),a={nextBytes:function(t){for(var e=0;e=0);var u=n.modPow(o,this);if(0!=u.compareTo(i.ONE)&&0!=u.compareTo(e)){for(var l=1;l++>24},i.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},i.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,n=this.DB-t*this.DB%8,o=0;if(t-- >0)for(n>n)!=(this.s&this.DM)>>n&&(e[o++]=r|this.s<=0;)n<8?(r=(this.data[t]&(1<>(n+=this.DB-8)):(r=this.data[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(e[o++]=r);return e},i.prototype.equals=function(t){return 0==this.compareTo(t)},i.prototype.min=function(t){return this.compareTo(t)<0?this:t},i.prototype.max=function(t){return this.compareTo(t)>0?this:t},i.prototype.and=function(t){var e=a();return this.bitwiseTo(t,g,e),e},i.prototype.or=function(t){var e=a();return this.bitwiseTo(t,m,e),e},i.prototype.xor=function(t){var e=a();return this.bitwiseTo(t,b,e),e},i.prototype.andNot=function(t){var e=a();return this.bitwiseTo(t,w,e),e},i.prototype.not=function(){for(var t=a(),e=0;e=this.t?0!=this.s:0!=(this.data[e]&1<1){var f=a();for(n.sqrTo(s[1],f);u<=c;)s[u]=a(),n.mulTo(f,s[u-2],s[u]),u+=2}var h,g,m=t.t-1,b=!0,w=a();for(o=d(t.data[m])-1;m>=0;){for(o>=l?h=t.data[m]>>o-l&c:(h=(t.data[m]&(1<0&&(h|=t.data[m-1]>>this.DB+o-l)),u=r;0==(1&h);)h>>=1,--u;if((o-=u)<0&&(o+=this.DB,--m),b)s[h].copyTo(i),b=!1;else{for(;u>1;)n.sqrTo(i,w),n.sqrTo(w,i),u-=2;u>0?n.sqrTo(i,w):(g=i,i=w,w=g),n.mulTo(w,s[h],i)}for(;m>=0&&0==(t.data[m]&1<=0?(r.subTo(n,r),e&&o.subTo(s,o),a.subTo(u,a)):(n.subTo(r,n),e&&s.subTo(o,s),u.subTo(a,u))}return 0!=n.compareTo(i.ONE)?i.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},i.prototype.pow=function(t){return this.exp(t,new _)},i.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var o=e.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return e;for(o0&&(e.rShiftTo(i,e),r.rShiftTo(i,r));e.signum()>0;)(o=e.getLowestSetBit())>0&&e.rShiftTo(o,e),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r},i.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r.data[0]<=P[P.length-1]){for(e=0;e>>0,s>>>0];for(var u=o.fullMessageLength.length-1;u>=0;--u)o.fullMessageLength[u]+=s[1],s[1]=s[0]+(o.fullMessageLength[u]/4294967296>>>0),o.fullMessageLength[u]=o.fullMessageLength[u]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(i),c(t,r,e),(e.read>2048||0===e.length())&&e.compact(),o},o.digest=function(){var a=n.util.createBuffer();a.putBytes(e.bytes());var s=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize&o.blockLength-1;a.putBytes(i.substr(0,o.blockLength-s));for(var u,l=0,f=o.fullMessageLength.length-1;f>=0;--f)l=(u=8*o.fullMessageLength[f]+l)/4294967296>>>0,a.putInt32Le(u>>>0);var h={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3};c(h,r,a);var p=n.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},o};var i=null,a=null,s=null,u=null,l=!1;function c(t,e,r){for(var n,o,i,l,c,f,h,p=r.length();p>=64;){for(o=t.h0,i=t.h1,l=t.h2,c=t.h3,h=0;h<16;++h)e[h]=r.getInt32Le(),n=o+(c^i&(l^c))+u[h]+e[h],o=c,c=l,l=i,i+=n<<(f=s[h])|n>>>32-f;for(;h<32;++h)n=o+(l^c&(i^l))+u[h]+e[a[h]],o=c,c=l,l=i,i+=n<<(f=s[h])|n>>>32-f;for(;h<48;++h)n=o+(i^l^c)+u[h]+e[a[h]],o=c,c=l,l=i,i+=n<<(f=s[h])|n>>>32-f;for(;h<64;++h)n=o+(l^(i|~c))+u[h]+e[a[h]],o=c,c=l,l=i,i+=n<<(f=s[h])|n>>>32-f;t.h0=t.h0+o|0,t.h1=t.h1+i|0,t.h2=t.h2+l|0,t.h3=t.h3+c|0,p-=64}}},function(t,e,r){var n=r(0);r(8),r(4),r(1);var o,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(o=r(16)),t.exports=n.pbkdf2=i.pbkdf2=function(t,e,r,i,a,u){if("function"==typeof a&&(u=a,a=null),n.util.isNodejs&&!n.options.usePureJavaScript&&o.pbkdf2&&(null===a||"object"!=s(a))&&(o.pbkdf2Sync.length>4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),u?4===o.pbkdf2Sync.length?o.pbkdf2(t,e,r,i,function(t,e){if(t)return u(t);u(null,e.toString("binary"))}):o.pbkdf2(t,e,r,i,a,function(t,e){if(t)return u(t);u(null,e.toString("binary"))}):4===o.pbkdf2Sync.length?o.pbkdf2Sync(t,e,r,i).toString("binary"):o.pbkdf2Sync(t,e,r,i,a).toString("binary");if(null==a&&(a="sha1"),"string"==typeof a){if(!(a in n.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=n.md[a].create()}var l=a.digestLength;if(i>4294967295*l){var c=new Error("Derived key is too long.");if(u)return u(c);throw c}var f=Math.ceil(i/l),h=i-(f-1)*l,p=n.hmac.create();p.start(a,t);var d,y,v,g="";if(!u){for(var m=1;m<=f;++m){p.start(null,null),p.update(e),p.update(n.util.int32ToBytes(m)),d=v=p.digest().getBytes();for(var b=2;b<=r;++b)p.start(null,null),p.update(v),y=p.digest().getBytes(),d=n.util.xorBytes(d,y,l),v=y;g+=mf)return u(null,g);p.start(null,null),p.update(e),p.update(n.util.int32ToBytes(m)),d=v=p.digest().getBytes(),b=2,S()}function S(){if(b<=r)return p.start(null,null),p.update(v),y=p.digest().getBytes(),d=n.util.xorBytes(d,y,l),v=y,++b,n.util.setImmediate(S);g+=m128)throw new Error('Invalid "nsComment" content.');t.value=o.create(o.Class.UNIVERSAL,o.Type.IA5STRING,!1,t.comment)}else if("subjectKeyIdentifier"===t.name&&e.cert){var p=e.cert.generateSubjectKeyIdentifier();t.subjectKeyIdentifier=p.toHex(),t.value=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===t.name&&e.cert){if(t.value=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),c=t.value.value,t.keyIdentifier){var d=!0===t.keyIdentifier?e.cert.generateSubjectKeyIdentifier().getBytes():t.keyIdentifier;c.push(o.create(o.Class.CONTEXT_SPECIFIC,0,!1,d))}if(t.authorityCertIssuer){var y=[o.create(o.Class.CONTEXT_SPECIFIC,4,!0,[m(!0===t.authorityCertIssuer?e.cert.issuer:t.authorityCertIssuer)])];c.push(o.create(o.Class.CONTEXT_SPECIFIC,1,!0,y))}if(t.serialNumber){var v=n.util.hexToBytes(!0===t.serialNumber?e.cert.serialNumber:t.serialNumber);c.push(o.create(o.Class.CONTEXT_SPECIFIC,2,!1,v))}}else if("cRLDistributionPoints"===t.name){t.value=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),c=t.value.value;var g,b=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),w=o.create(o.Class.CONTEXT_SPECIFIC,0,!0,[]);for(h=0;h2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=f[0],u.validity.notAfter=f[1],u.tbsCertificate=r.tbsCertificate,e){u.md=v({signatureOid:u.signatureOid,type:"certificate"});var h=o.toDer(u.tbsCertificate);u.md.update(h.getBytes())}var p=n.md.sha1.create(),g=o.toDer(r.certIssuer);p.update(g.getBytes()),u.issuer.getField=function(t){return d(u.issuer,t)},u.issuer.addField=function(t){b([t]),u.issuer.attributes.push(t)},u.issuer.attributes=i.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(u.issuer.uniqueId=r.certIssuerUniqueId),u.issuer.hash=p.digest().toHex();var m=n.md.sha1.create(),w=o.toDer(r.certSubject);return m.update(w.getBytes()),u.subject.getField=function(t){return d(u.subject,t)},u.subject.addField=function(t){b([t]),u.subject.attributes.push(t)},u.subject.attributes=i.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(u.subject.uniqueId=r.certSubjectUniqueId),u.subject.hash=m.digest().toHex(),r.certExtensions?u.extensions=i.certificateExtensionsFromAsn1(r.certExtensions):u.extensions=[],u.publicKey=i.publicKeyFromAsn1(r.subjectPublicKeyInfo),u},i.certificateExtensionsFromAsn1=function(t){for(var e=[],r=0;r1&&(r=u.value.charCodeAt(1),i=u.value.length>2?u.value.charCodeAt(2):0),e.digitalSignature=128==(128&r),e.nonRepudiation=64==(64&r),e.keyEncipherment=32==(32&r),e.dataEncipherment=16==(16&r),e.keyAgreement=8==(8&r),e.keyCertSign=4==(4&r),e.cRLSign=2==(2&r),e.encipherOnly=1==(1&r),e.decipherOnly=128==(128&i)}else if("basicConstraints"===e.name){(u=o.fromDer(e.value)).value.length>0&&u.value[0].type===o.Type.BOOLEAN?e.cA=0!==u.value[0].value.charCodeAt(0):e.cA=!1;var s=null;u.value.length>0&&u.value[0].type===o.Type.INTEGER?s=u.value[0].value:u.value.length>1&&(s=u.value[1].value),null!==s&&(e.pathLenConstraint=o.derToInteger(s))}else if("extKeyUsage"===e.name)for(var u=o.fromDer(e.value),l=0;l1&&(r=u.value.charCodeAt(1)),e.client=128==(128&r),e.server=64==(64&r),e.email=32==(32&r),e.objsign=16==(16&r),e.reserved=8==(8&r),e.sslCA=4==(4&r),e.emailCA=2==(2&r),e.objCA=1==(1&r);else if("subjectAltName"===e.name||"issuerAltName"===e.name){var f;e.altNames=[],u=o.fromDer(e.value);for(var h=0;h=x&&t<_?o.create(o.Class.UNIVERSAL,o.Type.UTCTIME,!1,o.dateToUtcTime(t)):o.create(o.Class.UNIVERSAL,o.Type.GENERALIZEDTIME,!1,o.dateToGeneralizedTime(t))}i.getTBSCertificate=function(t){var e=E(t.validity.notBefore),r=E(t.validity.notAfter),a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.CONTEXT_SPECIFIC,0,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(t.version).getBytes())]),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,n.util.hexToBytes(t.serialNumber)),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(t.siginfo.algorithmOid).getBytes()),S(t.siginfo.algorithmOid,t.siginfo.parameters)]),m(t.issuer),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[e,r]),m(t.subject),i.publicKeyToAsn1(t.publicKey)]);return t.issuer.uniqueId&&a.value.push(o.create(o.Class.CONTEXT_SPECIFIC,1,!0,[o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,String.fromCharCode(0)+t.issuer.uniqueId)])),t.subject.uniqueId&&a.value.push(o.create(o.Class.CONTEXT_SPECIFIC,2,!0,[o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,String.fromCharCode(0)+t.subject.uniqueId)])),t.extensions.length>0&&a.value.push(i.certificateExtensionsToAsn1(t.extensions)),a},i.getCertificationRequestInfo=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(t.version).getBytes()),m(t.subject),i.publicKeyToAsn1(t.publicKey),function(t){var e=o.create(o.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===t.attributes.length)return e;for(var r=t.attributes,i=0;if.validity.notAfter)&&(l={message:"Certificate is not valid yet or has expired.",error:i.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:a}),null===l){if(null===(h=e[0]||t.getIssuer(f))&&f.isIssuer(f)&&(p=!0,h=f),h){var d=h;n.util.isArray(d)||(d=[d]);for(var y=!1;!y&&d.length>0;){h=d.shift();try{y=h.verify(f)}catch(t){}}y||(l={message:"Certificate signature is invalid.",error:i.certificateError.bad_certificate})}null!==l||h&&!p||t.hasCertificate(f)||(l={message:"Certificate is not trusted.",error:i.certificateError.unknown_ca})}if(null===l&&h&&!f.isIssuer(h)&&(l={message:"Certificate issuer is invalid.",error:i.certificateError.bad_certificate}),null===l)for(var v={keyUsage:!0,basicConstraints:!0},g=0;null===l&&gb.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:i.certificateError.bad_certificate})}var S=null===l||l.error,x=r.verify?r.verify(S,c,o):S;if(!0!==x)throw!0===S&&(l={message:"The application rejected the certificate.",error:i.certificateError.bad_certificate}),(x||0===x)&&("object"!=s(x)||n.util.isArray(x)?"string"==typeof x&&(l.error=x):(x.message&&(l.message=x.message),x.error&&(l.error=x.error))),l;l=null,u=!1,++c}while(e.length>0);return!0}},function(t,e,r){var n=r(0);r(2),r(1),(t.exports=n.pss=n.pss||{}).create=function(t){3===arguments.length&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e,r=t.md,o=t.mgf,i=r.digestLength,a=t.salt||null;if("string"==typeof a&&(a=n.util.createBuffer(a)),"saltLength"in t)e=t.saltLength;else{if(null===a)throw new Error("Salt length not specified or specific salt not given.");e=a.length()}if(null!==a&&a.length()!==e)throw new Error("Given salt length does not match length of given salt.");var s=t.prng||n.random;return{encode:function(t,u){var l,c,f=u-1,h=Math.ceil(f/8),p=t.digest().getBytes();if(h>8*h-f&255;return(w=String.fromCharCode(w.charCodeAt(0)&~S)+w.substr(1))+y+String.fromCharCode(188)},verify:function(t,a,s){var u,l=s-1,c=Math.ceil(l/8);if(a=a.substr(-c),c>8*c-l&255;if(0!=(h.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=o.generate(p,f),v="";for(u=0;u4){var r=t;t=n.util.createBuffer();for(var o=0;o0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=t.length(),n=t.at(r-1);return!(n>this.blockSize<<2||(t.truncate(n),0))},o.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},o.cbc.prototype.start=function(t){if(null===t.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=i(t.iv,this.blockSize),this._prev=this._iv.slice(0)}},o.cbc.prototype.encrypt=function(t,e,r){if(t.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=t.length(),n=t.at(r-1);return!(n>this.blockSize<<2||(t.truncate(n),0))},o.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},o.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=i(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},o.cfb.prototype.encrypt=function(t,e,r){var n=t.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o0&&(i=this.blockSize-i),this._partialOutput.clear(),o=0;o0)t.read-=this.blockSize;else for(o=0;o0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},o.cfb.prototype.decrypt=function(t,e,r){var n=t.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o0&&(i=this.blockSize-i),this._partialOutput.clear(),o=0;o0)t.read-=this.blockSize;else for(o=0;o0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},o.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},o.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=i(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},o.ofb.prototype.encrypt=function(t,e,r){var n=t.length();if(0===t.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o0&&(i=this.blockSize-i),this._partialOutput.clear(),o=0;o0)t.read-=this.blockSize;else for(o=0;o0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},o.ofb.prototype.decrypt=o.ofb.prototype.encrypt,o.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},o.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=i(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},o.ctr.prototype.encrypt=function(t,e,r){var n=t.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o0&&(i=this.blockSize-i),this._partialOutput.clear(),o=0;o0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},o.ctr.prototype.decrypt=o.ctr.prototype.encrypt,o.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},o.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e,r=n.util.createBuffer(t.iv);if(this._cipherLength=0,e="additionalData"in t?n.util.createBuffer(t.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in t?t.tagLength:128,this._tag=null,t.decrypt&&(this._tag=n.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var o=r.length();if(12===o)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(s(8*o)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,e=n.util.createBuffer(e),this._aDataLength=s(8*e.length());var i=e.length()%this.blockSize;for(i&&e.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];e.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()])},o.gcm.prototype.encrypt=function(t,e,r){var n=t.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var o=0;o0&&(i=this.blockSize-i),this._partialOutput.clear(),o=0;o0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},o.gcm.prototype.decrypt=function(t,e,r){var n=t.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var o=0;o0;--n)e[n]=t[n]>>>1|(1&t[n-1])<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)},o.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var n=t[r/8|0]>>>4*(7-r%8)&15,o=this._m[r][n];e[0]^=o[0],e[1]^=o[1],e[2]^=o[2],e[3]^=o[3]}return e},o.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)},o.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,n=4*r,o=16*r,i=new Array(o),a=0;a>>1,o=new Array(r);o[n]=t.slice(0);for(var i=n>>>1;i>0;)this.pow(o[2*i],o[i]=[]),i>>=1;for(i=2;i>1,s=a+(1&t.length),u=t.substr(0,s),l=t.substr(a,s),c=n.util.createBuffer(),f=n.hmac.create();r=e+r;var h=Math.ceil(o/16),p=Math.ceil(o/20);f.start("MD5",u);var d=n.util.createBuffer();c.putBytes(r);for(var y=0;y0&&(c.queue(t,c.createAlert(t,{level:c.Alert.Level.warning,description:c.Alert.Description.no_renegotiation})),c.flush(t)),t.process()},c.parseHelloMessage=function(t,e,r){var o=null,i=t.entity===c.ConnectionEnd.client;if(r<38)t.error(t,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});else{var a=e.fragment,s=a.length();if(o={version:{major:a.getByte(),minor:a.getByte()},random:n.util.createBuffer(a.getBytes(32)),session_id:u(a,1),extensions:[]},i?(o.cipher_suite=a.getBytes(2),o.compression_method=a.getByte()):(o.cipher_suites=u(a,2),o.compression_methods=u(a,1)),(s=r-(s-a.length()))>0){for(var l=u(a,2);l.length()>0;)o.extensions.push({type:[l.getByte(),l.getByte()],data:u(l,2)});if(!i)for(var f=0;f0&&0===p.getByte();)t.session.extensions.server_name.serverNameList.push(u(p,2).getBytes())}}if(t.session.version&&(o.version.major!==t.session.version.major||o.version.minor!==t.session.version.minor))return t.error(t,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}});if(i)t.session.cipherSuite=c.getCipherSuite(o.cipher_suite);else for(var d=n.util.createBuffer(o.cipher_suites.bytes());d.length()>0&&(t.session.cipherSuite=c.getCipherSuite(d.getBytes(2)),null===t.session.cipherSuite););if(null===t.session.cipherSuite)return t.error(t,{message:"No cipher suites in common.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(o.cipher_suite)});t.session.compressionMethod=i?o.compression_method:c.CompressionMethod.none}return o},c.createSecurityParameters=function(t,e){var r=t.entity===c.ConnectionEnd.client,n=e.random.bytes(),o=r?t.session.sp.client_random:n,i=r?n:c.createRandom().getBytes();t.session.sp={entity:t.entity,prf_algorithm:c.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:t.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:o,server_random:i}},c.handleServerHello=function(t,e,r){var n=c.parseHelloMessage(t,e,r);if(!t.fail){if(!(n.version.minor<=t.version.minor))return t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}});t.version.minor=n.version.minor,t.session.version=t.version;var o=n.session_id.bytes();o.length>0&&o===t.session.id?(t.expect=y,t.session.resuming=!0,t.session.sp.server_random=n.random.bytes()):(t.expect=f,t.session.resuming=!1,c.createSecurityParameters(t,n)),t.session.id=o,t.process()}},c.handleClientHello=function(t,e,r){var o=c.parseHelloMessage(t,e,r);if(!t.fail){var i=o.session_id.bytes(),a=null;if(t.sessionCache&&(null===(a=t.sessionCache.getSession(i))?i="":(a.version.major!==o.version.major||a.version.minor>o.version.minor)&&(a=null,i="")),0===i.length&&(i=n.random.getBytes(32)),t.session.id=i,t.session.clientHelloVersion=o.version,t.session.sp={},a)t.version=t.session.version=a.version,t.session.sp=a.sp;else{for(var s,u=1;u0;)o=u(s.certificate_list,3),i=n.asn1.fromDer(o),o=n.pki.certificateFromAsn1(i,!0),l.push(o)}catch(e){return t.error(t,{message:"Could not parse certificate list.",cause:e,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate}})}var f=t.entity===c.ConnectionEnd.client;!f&&!0!==t.verifyClient||0!==l.length?0===l.length?t.expect=f?h:w:(f?t.session.serverCertificate=l[0]:t.session.clientCertificate=l[0],c.verifyCertificateChain(t,l)&&(t.expect=f?h:w)):t.error(t,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}}),t.process()},c.handleServerKeyExchange=function(t,e,r){if(r>0)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unsupported_certificate}});t.expect=p,t.process()},c.handleClientKeyExchange=function(t,e,r){if(r<48)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unsupported_certificate}});var o=e.fragment,i={enc_pre_master_secret:u(o,2).getBytes()},a=null;if(t.getPrivateKey)try{a=t.getPrivateKey(t,t.session.serverCertificate),a=n.pki.privateKeyFromPem(a)}catch(e){t.error(t,{message:"Could not get private key.",cause:e,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}})}if(null===a)return t.error(t,{message:"No private key set.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}});try{var s=t.session.sp;s.pre_master_secret=a.decrypt(i.enc_pre_master_secret);var l=t.session.clientHelloVersion;if(l.major!==s.pre_master_secret.charCodeAt(0)||l.minor!==s.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(t){s.pre_master_secret=n.random.getBytes(48)}t.expect=x,null!==t.session.clientCertificate&&(t.expect=S),t.process()},c.handleCertificateRequest=function(t,e,r){if(r<3)return t.error(t,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var n=e.fragment,o={certificate_types:u(n,1),certificate_authorities:u(n,2)};t.session.certificateRequest=o,t.expect=d,t.process()},c.handleCertificateVerify=function(t,e,r){if(r<2)return t.error(t,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var o=e.fragment;o.read-=4;var i=o.bytes();o.read+=4;var a={signature:u(o,2).getBytes()},s=n.util.createBuffer();s.putBuffer(t.session.md5.digest()),s.putBuffer(t.session.sha1.digest()),s=s.getBytes();try{if(!t.session.clientCertificate.publicKey.verify(s,a.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");t.session.md5.update(i),t.session.sha1.update(i)}catch(e){return t.error(t,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.handshake_failure}})}t.expect=x,t.process()},c.handleServerHelloDone=function(t,e,r){if(r>0)return t.error(t,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.record_overflow}});if(null===t.serverCertificate){var o={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.insufficient_security}},i=t.verify(t,o.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=s(i)||n.util.isArray(i)?"number"==typeof i&&(o.alert.description=i):(i.message&&(o.message=i.message),i.alert&&(o.alert.description=i.alert))),t.error(t,o)}null!==t.session.certificateRequest&&(e=c.createRecord(t,{type:c.ContentType.handshake,data:c.createCertificate(t)}),c.queue(t,e)),e=c.createRecord(t,{type:c.ContentType.handshake,data:c.createClientKeyExchange(t)}),c.queue(t,e),t.expect=m;var a=function(t,e){null!==t.session.certificateRequest&&null!==t.session.clientCertificate&&c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createCertificateVerify(t,e)})),c.queue(t,c.createRecord(t,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),t.state.pending=c.createConnectionState(t),t.state.current.write=t.state.pending.write,c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createFinished(t)})),t.expect=y,c.flush(t),t.process()};if(null===t.session.certificateRequest||null===t.session.clientCertificate)return a(t,null);c.getClientSignature(t,a)},c.handleChangeCipherSpec=function(t,e){if(1!==e.fragment.getByte())return t.error(t,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var r=t.entity===c.ConnectionEnd.client;(t.session.resuming&&r||!t.session.resuming&&!r)&&(t.state.pending=c.createConnectionState(t)),t.state.current.read=t.state.pending.read,(!t.session.resuming&&r||t.session.resuming&&!r)&&(t.state.pending=null),t.expect=r?v:_,t.process()},c.handleFinished=function(t,e,r){var i=e.fragment;i.read-=4;var a=i.bytes();i.read+=4;var s=e.fragment.getBytes();(i=n.util.createBuffer()).putBuffer(t.session.md5.digest()),i.putBuffer(t.session.sha1.digest());var u=t.entity===c.ConnectionEnd.client,l=u?"server finished":"client finished",f=t.session.sp;if((i=o(f.master_secret,l,i.getBytes(),12)).getBytes()!==s)return t.error(t,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.decrypt_error}});t.session.md5.update(a),t.session.sha1.update(a),(t.session.resuming&&u||!t.session.resuming&&!u)&&(c.queue(t,c.createRecord(t,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),t.state.current.write=t.state.pending.write,t.state.pending=null,c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createFinished(t)}))),t.expect=u?g:E,t.handshaking=!1,++t.handshakes,t.peerCertificate=u?t.session.serverCertificate:t.session.clientCertificate,c.flush(t),t.isConnected=!0,t.connected(t),t.process()},c.handleAlert=function(t,e){var r,n=e.fragment,o={level:n.getByte(),description:n.getByte()};switch(o.description){case c.Alert.Description.close_notify:r="Connection closed.";break;case c.Alert.Description.unexpected_message:r="Unexpected message.";break;case c.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case c.Alert.Description.decryption_failed:r="Decryption failed.";break;case c.Alert.Description.record_overflow:r="Record overflow.";break;case c.Alert.Description.decompression_failure:r="Decompression failed.";break;case c.Alert.Description.handshake_failure:r="Handshake failure.";break;case c.Alert.Description.bad_certificate:r="Bad certificate.";break;case c.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case c.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case c.Alert.Description.certificate_expired:r="Certificate expired.";break;case c.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case c.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case c.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case c.Alert.Description.access_denied:r="Access denied.";break;case c.Alert.Description.decode_error:r="Decode error.";break;case c.Alert.Description.decrypt_error:r="Decrypt error.";break;case c.Alert.Description.export_restriction:r="Export restriction.";break;case c.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case c.Alert.Description.insufficient_security:r="Insufficient security.";break;case c.Alert.Description.internal_error:r="Internal error.";break;case c.Alert.Description.user_canceled:r="User canceled.";break;case c.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(o.description===c.Alert.Description.close_notify)return t.close();t.error(t,{message:r,send:!1,origin:t.entity===c.ConnectionEnd.client?"server":"client",alert:o}),t.process()},c.handleHandshake=function(t,e){var r=e.fragment,o=r.getByte(),i=r.getInt24();if(i>r.length())return t.fragmented=e,e.fragment=n.util.createBuffer(),r.read-=4,t.process();t.fragmented=null,r.read-=4;var a=r.bytes(i+4);r.read+=4,o in F[t.entity][t.expect]?(t.entity!==c.ConnectionEnd.server||t.open||t.fail||(t.handshaking=!0,t.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),o!==c.HandshakeType.hello_request&&o!==c.HandshakeType.certificate_verify&&o!==c.HandshakeType.finished&&(t.session.md5.update(a),t.session.sha1.update(a)),F[t.entity][t.expect][o](t,e,i)):c.handleUnexpected(t,e)},c.handleApplicationData=function(t,e){t.data.putBuffer(e.fragment),t.dataReady(t),t.process()},c.handleHeartbeat=function(t,e){var r=e.fragment,o=r.getByte(),i=r.getInt16(),a=r.getBytes(i);if(o===c.HeartbeatMessageType.heartbeat_request){if(t.handshaking||i>a.length)return t.process();c.queue(t,c.createRecord(t,{type:c.ContentType.heartbeat,data:c.createHeartbeat(c.HeartbeatMessageType.heartbeat_response,a)})),c.flush(t)}else if(o===c.HeartbeatMessageType.heartbeat_response){if(a!==t.expectedHeartbeatPayload)return t.process();t.heartbeatReceived&&t.heartbeatReceived(t,n.util.createBuffer(a))}t.process()};var f=1,h=2,p=3,d=4,y=5,v=6,g=7,m=8,b=1,w=2,S=3,x=4,_=5,E=6,O=c.handleUnexpected,P=c.handleChangeCipherSpec,k=c.handleAlert,C=c.handleHandshake,T=c.handleApplicationData,A=c.handleHeartbeat,M=[];M[c.ConnectionEnd.client]=[[O,k,C,O,A],[O,k,C,O,A],[O,k,C,O,A],[O,k,C,O,A],[O,k,C,O,A],[P,k,O,O,A],[O,k,C,O,A],[O,k,C,T,A],[O,k,C,O,A]],M[c.ConnectionEnd.server]=[[O,k,C,O,A],[O,k,C,O,A],[O,k,C,O,A],[O,k,C,O,A],[P,k,O,O,A],[O,k,C,O,A],[O,k,C,T,A],[O,k,C,O,A]];var j=c.handleHelloRequest,I=c.handleServerHello,N=c.handleCertificate,L=c.handleServerKeyExchange,R=c.handleCertificateRequest,D=c.handleServerHelloDone,B=c.handleFinished,F=[];F[c.ConnectionEnd.client]=[[O,O,I,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O],[j,O,O,O,O,O,O,O,O,O,O,N,L,R,D,O,O,O,O,O,O],[j,O,O,O,O,O,O,O,O,O,O,O,L,R,D,O,O,O,O,O,O],[j,O,O,O,O,O,O,O,O,O,O,O,O,R,D,O,O,O,O,O,O],[j,O,O,O,O,O,O,O,O,O,O,O,O,O,D,O,O,O,O,O,O],[j,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O],[j,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,B],[j,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O],[j,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O]];var G=c.handleClientHello,U=c.handleClientKeyExchange,z=c.handleCertificateVerify;F[c.ConnectionEnd.server]=[[O,G,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O],[O,O,O,O,O,O,O,O,O,O,O,N,O,O,O,O,O,O,O,O,O],[O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,U,O,O,O,O],[O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,z,O,O,O,O,O],[O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O],[O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,B],[O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O],[O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O]],c.generateKeys=function(t,e){var r=o,n=e.client_random+e.server_random;t.session.resuming||(e.master_secret=r(e.pre_master_secret,"master secret",n,48).bytes(),e.pre_master_secret=null),n=e.server_random+e.client_random;var i=2*e.mac_key_length+2*e.enc_key_length,a=t.version.major===c.Versions.TLS_1_0.major&&t.version.minor===c.Versions.TLS_1_0.minor;a&&(i+=2*e.fixed_iv_length);var s=r(e.master_secret,"key expansion",n,i),u={client_write_MAC_key:s.getBytes(e.mac_key_length),server_write_MAC_key:s.getBytes(e.mac_key_length),client_write_key:s.getBytes(e.enc_key_length),server_write_key:s.getBytes(e.enc_key_length)};return a&&(u.client_write_IV=s.getBytes(e.fixed_iv_length),u.server_write_IV=s.getBytes(e.fixed_iv_length)),u},c.createConnectionState=function(t){var e=t.entity===c.ConnectionEnd.client,r=function(){var t={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(t){return!0},compressionState:null,compressFunction:function(t){return!0},updateSequenceNumber:function(){4294967295===t.sequenceNumber[1]?(t.sequenceNumber[1]=0,++t.sequenceNumber[0]):++t.sequenceNumber[1]}};return t},n={read:r(),write:r()};if(n.read.update=function(t,e){return n.read.cipherFunction(e,n.read)?n.read.compressFunction(t,e,n.read)||t.error(t,{message:"Could not decompress record.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.decompression_failure}}):t.error(t,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_record_mac}}),!t.fail},n.write.update=function(t,e){return n.write.compressFunction(t,e,n.write)?n.write.cipherFunction(e,n.write)||t.error(t,{message:"Could not encrypt record.",send:!1,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}):t.error(t,{message:"Could not compress record.",send:!1,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}),!t.fail},t.session){var o=t.session.sp;switch(t.session.cipherSuite.initSecurityParameters(o),o.keys=c.generateKeys(t,o),n.read.macKey=e?o.keys.server_write_MAC_key:o.keys.client_write_MAC_key,n.write.macKey=e?o.keys.client_write_MAC_key:o.keys.server_write_MAC_key,t.session.cipherSuite.initConnectionState(n,t,o),o.compression_algorithm){case c.CompressionMethod.none:break;case c.CompressionMethod.deflate:n.read.compressFunction=a,n.write.compressFunction=i;break;default:throw new Error("Unsupported compression algorithm.")}}return n},c.createRandom=function(){var t=new Date,e=+t+6e4*t.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(e),r.putBytes(n.random.getBytes(28)),r},c.createRecord=function(t,e){return e.data?{type:e.type,version:{major:t.version.major,minor:t.version.minor},length:e.data.length(),fragment:e.data}:null},c.createAlert=function(t,e){var r=n.util.createBuffer();return r.putByte(e.level),r.putByte(e.description),c.createRecord(t,{type:c.ContentType.alert,data:r})},c.createClientHello=function(t){t.session.clientHelloVersion={major:t.version.major,minor:t.version.minor};for(var e=n.util.createBuffer(),r=0;r0&&(d+=2);var y=t.session.id,v=y.length+1+2+4+28+2+i+1+s+d,g=n.util.createBuffer();return g.putByte(c.HandshakeType.client_hello),g.putInt24(v),g.putByte(t.version.major),g.putByte(t.version.minor),g.putBytes(t.session.sp.client_random),l(g,1,n.util.createBuffer(y)),l(g,2,e),l(g,1,a),d>0&&l(g,2,u),g},c.createServerHello=function(t){var e=t.session.id,r=e.length+1+2+4+28+2+1,o=n.util.createBuffer();return o.putByte(c.HandshakeType.server_hello),o.putInt24(r),o.putByte(t.version.major),o.putByte(t.version.minor),o.putBytes(t.session.sp.server_random),l(o,1,n.util.createBuffer(e)),o.putByte(t.session.cipherSuite.id[0]),o.putByte(t.session.cipherSuite.id[1]),o.putByte(t.session.compressionMethod),o},c.createCertificate=function(t){var e,r=t.entity===c.ConnectionEnd.client,o=null;t.getCertificate&&(e=r?t.session.certificateRequest:t.session.extensions.server_name.serverNameList,o=t.getCertificate(t,e));var i=n.util.createBuffer();if(null!==o)try{n.util.isArray(o)||(o=[o]);for(var a=null,s=0;sc.MaxFragment;)o.push(c.createRecord(t,{type:e.type,data:n.util.createBuffer(i.slice(0,c.MaxFragment))})),i=i.slice(c.MaxFragment);i.length>0&&o.push(c.createRecord(t,{type:e.type,data:n.util.createBuffer(i)}))}for(var a=0;a0&&(o=r.order[0]),null!==o&&o in r.cache)for(var i in e=r.cache[o],delete r.cache[o],r.order)if(r.order[i]===o){r.order.splice(i,1);break}return e},r.setSession=function(t,e){if(r.order.length===r.capacity){var o=r.order.shift();delete r.cache[o]}o=n.util.bytesToHex(t),r.order.push(o),r.cache[o]=e}}return r},c.createConnection=function(t){var e;e=t.caStore?n.util.isArray(t.caStore)?n.pki.createCaStore(t.caStore):t.caStore:n.pki.createCaStore();var r=t.cipherSuites||null;if(null===r)for(var o in r=[],c.CipherSuites)r.push(c.CipherSuites[o]);var i=t.server?c.ConnectionEnd.server:c.ConnectionEnd.client,a=t.sessionCache?c.createSessionCache(t.sessionCache):null,s={version:{major:c.Version.major,minor:c.Version.minor},entity:i,sessionId:t.sessionId,caStore:e,sessionCache:a,cipherSuites:r,connected:t.connected,virtualHost:t.virtualHost||null,verifyClient:t.verifyClient||!1,verify:t.verify||function(t,e,r,n){return e},verifyOptions:t.verifyOptions||{},getCertificate:t.getCertificate||null,getPrivateKey:t.getPrivateKey||null,getSignature:t.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:t.tlsDataReady,dataReady:t.dataReady,heartbeatReceived:t.heartbeatReceived,closed:t.closed,error:function(e,r){r.origin=r.origin||(e.entity===c.ConnectionEnd.client?"client":"server"),r.send&&(c.queue(e,c.createAlert(e,r.alert)),c.flush(e));var n=!1!==r.fatal;n&&(e.fail=!0),t.error(e,r),n&&e.close(!1)},deflate:t.deflate||null,inflate:t.inflate||null,reset:function(t){s.version={major:c.Version.major,minor:c.Version.minor},s.record=null,s.session=null,s.peerCertificate=null,s.state={pending:null,current:null},s.expect=(s.entity,c.ConnectionEnd.client,0),s.fragmented=null,s.records=[],s.open=!1,s.handshakes=0,s.handshaking=!1,s.isConnected=!1,s.fail=!(t||void 0===t),s.input.clear(),s.tlsData.clear(),s.data.clear(),s.state.current=c.createConnectionState(s)}};return s.reset(),s.handshake=function(t){if(s.entity!==c.ConnectionEnd.client)s.error(s,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(s.handshaking)s.error(s,{message:"Handshake already in progress.",fatal:!1});else{s.fail&&!s.open&&0===s.handshakes&&(s.fail=!1),s.handshaking=!0;var e=null;(t=t||"").length>0&&(s.sessionCache&&(e=s.sessionCache.getSession(t)),null===e&&(t="")),0===t.length&&s.sessionCache&&null!==(e=s.sessionCache.getSession())&&(t=e.id),s.session={id:t,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},e&&(s.version=e.version,s.session.sp=e.sp),s.session.sp.client_random=c.createRandom().getBytes(),s.open=!0,c.queue(s,c.createRecord(s,{type:c.ContentType.handshake,data:c.createClientHello(s)})),c.flush(s)}},s.process=function(t){var e=0;return t&&s.input.putBytes(t),s.fail||(null!==s.record&&s.record.ready&&s.record.fragment.isEmpty()&&(s.record=null),null===s.record&&(e=function(t){var e=0,r=t.input,o=r.length();if(o<5)e=5-o;else{t.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var i=t.record.version.major===t.version.major;i&&t.session&&t.session.version&&(i=t.record.version.minor===t.version.minor),i||t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}})}return e}(s)),s.fail||null===s.record||s.record.ready||(e=function(t){var e=0,r=t.input,n=r.length();return n=0;u--)T>>=8,T+=O.at(u)+C.at(u),C.setAt(u,255&T);k.putBuffer(C)}w=k,f.putBuffer(_)}return f.truncate(f.length()-i),f},a.pbe.getCipher=function(t,e,r){switch(t){case a.oids.pkcs5PBES2:return a.pbe.getCipherForPBES2(t,e,r);case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case a.oids["pbewithSHAAnd40BitRC2-CBC"]:return a.pbe.getCipherForPKCS12PBE(t,e,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=t,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},a.pbe.getCipherForPBES2=function(t,e,r){var o,s={},u=[];if(!i.validate(e,l,s,u))throw(o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=u,o;if((t=i.derToOid(s.kdfOid))!==a.oids.pkcs5PBKDF2)throw(o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,o.supportedOids=["pkcs5PBKDF2"],o;if((t=i.derToOid(s.encOid))!==a.oids["aes128-CBC"]&&t!==a.oids["aes192-CBC"]&&t!==a.oids["aes256-CBC"]&&t!==a.oids["des-EDE3-CBC"]&&t!==a.oids.desCBC)throw(o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o;var c,f,p=s.kdfSalt,d=n.util.createBuffer(s.kdfIterationCount);switch(d=d.getInt(d.length()<<3),a.oids[t]){case"aes128-CBC":c=16,f=n.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,f=n.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,f=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,f=n.des.createDecryptionCipher;break;case"desCBC":c=8,f=n.des.createDecryptionCipher}var y=h(s.prfOid),v=n.pkcs5.pbkdf2(r,p,d,c,y),g=s.encIv,m=f(v);return m.start(g),m},a.pbe.getCipherForPKCS12PBE=function(t,e,r){var o={},s=[];if(!i.validate(e,c,o,s))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=s,y;var u,l,f,p=n.util.createBuffer(o.salt),d=n.util.createBuffer(o.iterations);switch(d=d.getInt(d.length()<<3),t){case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,l=8,f=n.des.startDecrypting;break;case a.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,l=8,f=function(t,e){var r=n.rc2.createDecryptionCipher(t,40);return r.start(e,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,y}var v=h(o.prfOid),g=a.pbe.generatePkcs12Key(r,p,1,d,u,v);return v.start(),f(g,a.pbe.generatePkcs12Key(r,p,2,d,l,v))},a.pbe.opensslDeriveBytes=function(t,e,r,o){if(null==o){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');o=n.md.md5.create()}null===e&&(e="");for(var i=[f(o,t+e)],a=16,s=1;a>>0,s>>>0];for(var l=o.fullMessageLength.length-1;l>=0;--l)o.fullMessageLength[l]+=s[1],s[1]=s[0]+(o.fullMessageLength[l]/4294967296>>>0),o.fullMessageLength[l]=o.fullMessageLength[l]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(i),u(t,r,e),(e.read>2048||0===e.length())&&e.compact(),o},o.digest=function(){var a=n.util.createBuffer();a.putBytes(e.bytes());var s,l=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize&o.blockLength-1;a.putBytes(i.substr(0,o.blockLength-l));for(var c=8*o.fullMessageLength[0],f=0;f>>0,a.putInt32(c>>>0),c=s>>>0;a.putInt32(c);var h={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};u(h,r,a);var p=n.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p.putInt32(h.h5),p.putInt32(h.h6),p.putInt32(h.h7),p},o};var i=null,a=!1,s=null;function u(t,e,r){for(var n,o,i,a,u,l,c,f,h,p,d,y,v,g=r.length();g>=64;){for(u=0;u<16;++u)e[u]=r.getInt32();for(;u<64;++u)n=((n=e[u-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,o=((o=e[u-15])>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,e[u]=n+e[u-7]+o+e[u-16]|0;for(l=t.h0,c=t.h1,f=t.h2,h=t.h3,p=t.h4,d=t.h5,y=t.h6,v=t.h7,u=0;u<64;++u)i=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),a=l&c|f&(l^c),n=v+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(y^p&(d^y))+s[u]+e[u],v=y,y=d,d=p,p=h+n>>>0,h=f,f=c,c=l,l=n+(o=i+a)>>>0;t.h0=t.h0+l|0,t.h1=t.h1+c|0,t.h2=t.h2+f|0,t.h3=t.h3+h|0,t.h4=t.h4+p|0,t.h5=t.h5+d|0,t.h6=t.h6+y|0,t.h7=t.h7+v|0,g-=64}}},function(t,e,r){var n=r(0);r(1);var o=null;!n.util.isNodejs||n.options.usePureJavaScript||process.versions["node-webkit"]||(o=r(16)),(t.exports=n.prng=n.prng||{}).create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,i=new Array(32),a=0;a<32;++a)i[a]=r.create();function s(){if(e.pools[0].messageLength>=32)return u();var t=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(t)),u()}function u(){e.reseeds=4294967295===e.reseeds?0:e.reseeds+1;var t=e.plugin.md.create();t.update(e.keyBytes);for(var r=1,n=0;n<32;++n)e.reseeds%r==0&&(t.update(e.pools[n].digest().getBytes()),e.pools[n].start()),r<<=1;e.keyBytes=t.digest().getBytes(),t.start(),t.update(e.keyBytes);var o=t.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(o),e.generated=0}function l(t){var e=null,r=n.util.globalScope,o=r.crypto||r.msCrypto;o&&o.getRandomValues&&(e=function(t){return o.getRandomValues(t)});var i=n.util.createBuffer();if(e)for(;i.length()>16)))<<16,h=4294967295&(c=(2147483647&(c+=l>>15))+(c>>31)),u=0;u<3;++u)f=h>>>(u<<3),f^=Math.floor(256*Math.random()),i.putByte(255&f);return i.getBytes(t)}return e.pools=i,e.pool=0,e.generate=function(t,r){if(!r)return e.generateSync(t);var o=e.plugin.cipher,i=e.plugin.increment,a=e.plugin.formatKey,s=e.plugin.formatSeed,l=n.util.createBuffer();e.key=null,function c(f){if(f)return r(f);if(l.length()>=t)return r(null,l.getBytes(t));if(e.generated>1048575&&(e.key=null),null===e.key)return n.util.nextTick(function(){!function(t){if(e.pools[0].messageLength>=32)return u(),t();var r=32-e.pools[0].messageLength<<5;e.seedFile(r,function(r,n){if(r)return t(r);e.collect(n),u(),t()})}(c)});var h=o(e.key,e.seed);e.generated+=h.length,l.putBytes(h),e.key=a(o(e.key,i(e.seed))),e.seed=s(o(e.key,e.seed)),n.util.setImmediate(c)}()},e.generateSync=function(t){var r=e.plugin.cipher,o=e.plugin.increment,i=e.plugin.formatKey,a=e.plugin.formatSeed;e.key=null;for(var u=n.util.createBuffer();u.length()1048575&&(e.key=null),null===e.key&&s();var l=r(e.key,e.seed);e.generated+=l.length,u.putBytes(l),e.key=i(r(e.key,o(e.seed))),e.seed=a(r(e.key,e.seed))}return u.getBytes(t)},o?(e.seedFile=function(t,e){o.randomBytes(t,function(t,r){if(t)return e(t);e(null,r.toString())})},e.seedFileSync=function(t){return o.randomBytes(t).toString()}):(e.seedFile=function(t,e){try{e(null,l(t))}catch(t){e(t)}},e.seedFileSync=l),e.collect=function(t){for(var r=t.length,n=0;n>o&255);e.collect(n)},e.registerWorker=function(t){t===self?e.seedFile=function(t,e){self.addEventListener("message",function t(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",t),e(n.forge.prng.err,n.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:t}}})}:t.addEventListener("message",function(r){var n=r.data;n.forge&&n.forge.prng&&e.seedFile(n.forge.prng.needed,function(e,r){t.postMessage({forge:{prng:{err:e,bytes:r}}})})})},e}},function(t,e,r){var n=r(0);r(1);var o=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],a=function(t,e){return t<>16-e},s=function(t,e){return(65535&t)>>e|t<<16-e&65535};t.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(t,e){"string"==typeof t&&(t=n.util.createBuffer(t)),e=e||128;var r,i=t,a=t.length(),s=e,u=Math.ceil(s/8),l=255>>(7&s);for(r=a;r<128;r++)i.putByte(o[i.at(r-1)+i.at(r-a)&255]);for(i.setAt(128-u,o[i.at(128-u)&l]),r=127-u;r>=0;r--)i.setAt(r,o[i.at(r+1)^i.at(r+u)]);return i};var u=function(t,e,r){var o,u,l,c,f=!1,h=null,p=null,d=null,y=[];for(t=n.rc2.expandKey(t,e),l=0;l<64;l++)y.push(t.getInt16Le());r?(o=function(t){for(l=0;l<4;l++)t[l]+=y[c]+(t[(l+3)%4]&t[(l+2)%4])+(~t[(l+3)%4]&t[(l+1)%4]),t[l]=a(t[l],i[l]),c++},u=function(t){for(l=0;l<4;l++)t[l]+=y[63&t[(l+3)%4]]}):(o=function(t){for(l=3;l>=0;l--)t[l]=s(t[l],i[l]),t[l]-=y[c]+(t[(l+3)%4]&t[(l+2)%4])+(~t[(l+3)%4]&t[(l+1)%4]),c--},u=function(t){for(l=3;l>=0;l--)t[l]-=y[63&t[(l+3)%4]]});var v=function(t){var e=[];for(l=0;l<4;l++){var n=h.getInt16Le();null!==d&&(r?n^=d.getInt16Le():d.putInt16Le(n)),e.push(65535&n)}c=r?0:63;for(var o=0;o=8;)v([[5,o],[1,u],[6,o],[1,u],[5,o]])},finish:function(t){var e=!0;if(r)if(t)e=t(8,h,!r);else{var n=8===h.length()?8:8-h.length();h.fillWithByte(n,n)}if(e&&(f=!0,g.update()),!r&&(e=0===h.length()))if(t)e=t(8,p,!r);else{var o=p.length(),i=p.at(o-1);i>o?e=!1:p.truncate(i)}return e}}};n.rc2.startEncrypting=function(t,e,r){var o=n.rc2.createEncryptionCipher(t,128);return o.start(e,r),o},n.rc2.createEncryptionCipher=function(t,e){return u(t,e,!0)},n.rc2.startDecrypting=function(t,e,r){var o=n.rc2.createDecryptionCipher(t,128);return o.start(e,r),o},n.rc2.createDecryptionCipher=function(t,e){return u(t,e,!1)}},function(t,e,r){var n=r(0);r(1),r(2),r(9);var o=t.exports=n.pkcs1=n.pkcs1||{};function i(t,e,r){r||(r=n.md.sha1.create());for(var o="",i=Math.ceil(e/r.digestLength),a=0;a>24&255,a>>16&255,a>>8&255,255&a);r.start(),r.update(t+s),o+=r.digest().getBytes()}return o.substring(0,e)}o.encode_rsa_oaep=function(t,e,r){var o,a,s,u;"string"==typeof r?(o=r,a=arguments[3]||void 0,s=arguments[4]||void 0):r&&(o=r.label||void 0,a=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(u=r.mgf1.md)),s?s.start():s=n.md.sha1.create(),u||(u=s);var l=Math.ceil(t.n.bitLength()/8),c=l-2*s.digestLength-2;if(e.length>c)throw(y=new Error("RSAES-OAEP input message length is too long.")).length=e.length,y.maxLength=c,y;o||(o=""),s.update(o,"raw");for(var f=s.digest(),h="",p=c-e.length,d=0;dt&&(a=u(t,e));var p=a.toString(16);o.target.postMessage({hex:p,workLoad:c}),a.dAddOffset(f,0)}}}p()}(t,e,o,i):s(t,e,o,i)}(t,l,i.options,o);throw new Error("Invalid prime generation algorithm: "+i.name)}}function s(t,e,r,i){var a=u(t,e),s=function(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}(a.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var l=10;"maxBlockTime"in r&&(l=r.maxBlockTime),function t(e,r,i,a,s,l,c){var f=+new Date;do{if(e.bitLength()>r&&(e=u(r,i)),e.isProbablePrime(s))return c(null,e);e.dAddOffset(o[a++%8],0)}while(l<0||+new Date-f=0&&o.push(s):o.push(s))}return o}function p(t){if(t.composed||t.constructed){for(var e=n.util.createBuffer(),r=0;r0&&(u=o.create(o.Class.UNIVERSAL,o.Type.SET,!0,f));var h=[],p=[];null!==e&&(p=n.util.isArray(e)?e:[e]);for(var d=[],y=0;y0){var b=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,d),w=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(i.oids.data).getBytes()),o.create(o.Class.CONTEXT_SPECIFIC,0,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(b).getBytes())])]);h.push(w)}var S=null;if(null!==t){var x=i.wrapRsaPrivateKey(i.privateKeyToAsn1(t));S=null===r?o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(i.oids.keyBag).getBytes()),o.create(o.Class.CONTEXT_SPECIFIC,0,!0,[x]),u]):o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(i.oids.pkcs8ShroudedKeyBag).getBytes()),o.create(o.Class.CONTEXT_SPECIFIC,0,!0,[i.encryptPrivateKeyInfo(x,r,s)]),u]);var _=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[S]),E=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(i.oids.data).getBytes()),o.create(o.Class.CONTEXT_SPECIFIC,0,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(_).getBytes())])]);h.push(E)}var O,P=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,h);if(s.useMac){var k=n.md.sha1.create(),C=new n.util.ByteBuffer(n.random.getBytes(s.saltSize)),T=s.count,A=(t=a.generateKey(r,C,3,T,20),n.hmac.create());A.start(k,t),A.update(o.toDer(P).getBytes());var M=A.getMac();O=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(i.oids.sha1).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,M.getBytes())]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,C.getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(T).getBytes())])}return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(3).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(i.oids.data).getBytes()),o.create(o.Class.CONTEXT_SPECIFIC,0,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(P).getBytes())])]),O])},a.generateKey=n.pbe.generatePkcs12Key},function(t,e,r){var n=r(0);r(3),r(1);var o=n.asn1,i=t.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=i;var a={name:"ContentInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=a;var s={name:"EncryptedContentInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:o.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:o.Class.UNIVERSAL,type:o.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(s)},i.encryptedDataValidator={name:"EncryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"}].concat(s)};var u={name:"SignerInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:o.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:o.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:o.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:o.Class.UNIVERSAL,type:o.Type.SET,capture:"signerInfos",optional:!0,value:[u]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:o.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(t,e,r){var n=r(0);r(1),n.mgf=n.mgf||{},(t.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(t){return{generate:function(e,r){for(var o=new n.util.ByteBuffer,i=Math.ceil(r/t.digestLength),a=0;a>>0,a>>>0];for(var s=p.fullMessageLength.length-1;s>=0;--s)p.fullMessageLength[s]+=a[1],a[1]=a[0]+(p.fullMessageLength[s]/4294967296>>>0),p.fullMessageLength[s]=p.fullMessageLength[s]>>>0,a[0]=a[1]/4294967296>>>0;return o.putBytes(t),c(r,i,o),(o.read>2048||0===o.length())&&o.compact(),p},p.digest=function(){var e=n.util.createBuffer();e.putBytes(o.bytes());var s,u=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize&p.blockLength-1;e.putBytes(a.substr(0,p.blockLength-u));for(var l=8*p.fullMessageLength[0],f=0;f>>0,e.putInt32(l>>>0),l=s>>>0;e.putInt32(l);var h=new Array(r.length);for(f=0;f=128;){for(A=0;A<16;++A)e[A][0]=r.getInt32()>>>0,e[A][1]=r.getInt32()>>>0;for(;A<80;++A)n=(((M=(I=e[A-2])[0])>>>19|(j=I[1])<<13)^(j>>>29|M<<3)^M>>>6)>>>0,o=((M<<13|j>>>19)^(j<<3|M>>>29)^(M<<26|j>>>6))>>>0,i=(((M=(L=e[A-15])[0])>>>1|(j=L[1])<<31)^(M>>>8|j<<24)^M>>>7)>>>0,a=((M<<31|j>>>1)^(M<<24|j>>>8)^(M<<25|j>>>7))>>>0,N=e[A-7],R=e[A-16],j=o+N[1]+a+R[1],e[A][0]=n+N[0]+i+R[0]+(j/4294967296>>>0)>>>0,e[A][1]=j>>>0;for(d=t[0][0],y=t[0][1],v=t[1][0],g=t[1][1],m=t[2][0],b=t[2][1],w=t[3][0],S=t[3][1],x=t[4][0],_=t[4][1],E=t[5][0],O=t[5][1],P=t[6][0],k=t[6][1],C=t[7][0],T=t[7][1],A=0;A<80;++A)c=((x>>>14|_<<18)^(x>>>18|_<<14)^(_>>>9|x<<23))>>>0,f=(P^x&(E^P))>>>0,s=((d>>>28|y<<4)^(y>>>2|d<<30)^(y>>>7|d<<25))>>>0,l=((d<<4|y>>>28)^(y<<30|d>>>2)^(y<<25|d>>>7))>>>0,h=(d&v|m&(d^v))>>>0,p=(y&g|b&(y^g))>>>0,j=T+(((x<<18|_>>>14)^(x<<14|_>>>18)^(_<<23|x>>>9))>>>0)+((k^_&(O^k))>>>0)+u[A][1]+e[A][1],n=C+c+f+u[A][0]+e[A][0]+(j/4294967296>>>0)>>>0,o=j>>>0,i=s+h+((j=l+p)/4294967296>>>0)>>>0,a=j>>>0,C=P,T=k,P=E,k=O,E=x,O=_,x=w+n+((j=S+o)/4294967296>>>0)>>>0,_=j>>>0,w=m,S=b,m=v,b=g,v=d,g=y,d=n+i+((j=o+a)/4294967296>>>0)>>>0,y=j>>>0;j=t[0][1]+y,t[0][0]=t[0][0]+d+(j/4294967296>>>0)>>>0,t[0][1]=j>>>0,j=t[1][1]+g,t[1][0]=t[1][0]+v+(j/4294967296>>>0)>>>0,t[1][1]=j>>>0,j=t[2][1]+b,t[2][0]=t[2][0]+m+(j/4294967296>>>0)>>>0,t[2][1]=j>>>0,j=t[3][1]+S,t[3][0]=t[3][0]+w+(j/4294967296>>>0)>>>0,t[3][1]=j>>>0,j=t[4][1]+_,t[4][0]=t[4][0]+x+(j/4294967296>>>0)>>>0,t[4][1]=j>>>0,j=t[5][1]+O,t[5][0]=t[5][0]+E+(j/4294967296>>>0)>>>0,t[5][1]=j>>>0,j=t[6][1]+k,t[6][0]=t[6][0]+P+(j/4294967296>>>0)>>>0,t[6][1]=j>>>0,j=t[7][1]+T,t[7][0]=t[7][0]+C+(j/4294967296>>>0)>>>0,t[7][1]=j>>>0,D-=128}}},function(t,e,r){t.exports=r(33)},function(t,e,r){t.exports=r(0),r(5),r(36),r(3),r(13),r(10),r(38),r(8),r(40),r(41),r(42),r(30),r(15),r(7),r(26),r(28),r(43),r(21),r(27),r(24),r(18),r(2),r(25),r(44),r(20),r(1)},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==("undefined"==typeof window?"undefined":s(window))&&(r=window)}t.exports=r},function(t,e){var r={};t.exports=r;var n={};r.encode=function(t,e,r){if("string"!=typeof e)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(t instanceof Uint8Array){var o=0,i=e.length,a=e.charAt(0),s=[0];for(o=0;o0;)s.push(l%i),l=l/i|0}for(o=0;0===t[o]&&o=0;--o)n+=e[s[o]]}else n=function(t,e){var r=0,n=e.length,o=e.charAt(0),i=[0];for(r=0;r0;)i.push(s%n),s=s/n|0}var u="";for(r=0;0===t.at(r)&&r=0;--r)u+=e[i[r]];return u}(t,e);if(r){var c=new RegExp(".{1,"+r+"}","g");n=n.match(c).join("\r\n")}return n},r.decode=function(t,e){if("string"!=typeof t)throw new TypeError('"input" must be a string.');if("string"!=typeof e)throw new TypeError('"alphabet" must be a string.');var r=n[e];if(!r){r=n[e]=[];for(var o=0;o>=8;for(;c>0;)s.push(255&c),c>>=8}for(var f=0;t[f]===a&&f=o.Versions.TLS_1_1.minor&&u.output.putBytes(r),u.update(t.fragment),u.finish(s)&&(t.fragment=u.output,t.length=t.fragment.length(),i=!0),i}function s(t,e,r){if(!r){var n=t-e.length()%t;e.fillWithByte(n-1,n)}return!0}function u(t,e,r){var n=!0;if(r){for(var o=e.length(),i=e.last(),a=o-1-i;a=s?(t.fragment=a.output.getBytes(c-s),l=a.output.getBytes(s)):t.fragment=a.output.getBytes(),t.fragment=n.util.createBuffer(t.fragment),t.length=t.fragment.length();var f=e.macFunction(e.macKey,e.sequenceNumber,t);return e.updateSequenceNumber(),function(t,e,r){var o=n.hmac.create();return o.start("SHA1",t),o.update(e),e=o.digest().getBytes(),o.start(null,null),o.update(r),e===(r=o.digest().getBytes())}(e.macKey,l,f)&&i}o.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(t){t.bulk_cipher_algorithm=o.BulkCipherAlgorithm.aes,t.cipher_type=o.CipherType.block,t.enc_key_length=16,t.block_length=16,t.fixed_iv_length=16,t.record_iv_length=16,t.mac_algorithm=o.MACAlgorithm.hmac_sha1,t.mac_length=20,t.mac_key_length=20},initConnectionState:i},o.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(t){t.bulk_cipher_algorithm=o.BulkCipherAlgorithm.aes,t.cipher_type=o.CipherType.block,t.enc_key_length=32,t.block_length=16,t.fixed_iv_length=16,t.record_iv_length=16,t.mac_algorithm=o.MACAlgorithm.hmac_sha1,t.mac_length=20,t.mac_key_length=20},initConnectionState:i}},function(t,e,r){var n=r(0);r(30),t.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(t,e,r){var n=r(0);r(12),r(2),r(31),r(1);var o=r(39),i=o.publicKeyValidator,a=o.privateKeyValidator;if(void 0===s)var s=n.jsbn.BigInteger;var u=n.util.ByteBuffer,l="undefined"==typeof Buffer?Uint8Array:Buffer;n.pki=n.pki||{},t.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var c=n.ed25519;function f(t){var e=t.message;if(e instanceof Uint8Array||e instanceof l)return e;var r=t.encoding;if(void 0===e){if(!t.md)throw new TypeError('"options.message" or "options.md" not specified.');e=t.md.digest().getBytes(),r="binary"}if("string"==typeof e&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof e){if("undefined"!=typeof Buffer)return Buffer.from(e,r);e=new u(e,r)}else if(!(e instanceof u))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new l(e.length()),o=0;o=0;--r)B(n,n),1!==r&&F(n,n,e);for(r=0;r<16;++r)t[r]=n[r]}(r,r),F(r,r,o),F(r,r,i),F(r,r,i),F(t[0],r,i),B(n,t[0]),F(n,n,i),k(n,o)&&F(t[0],t[0],b),B(n,t[0]),F(n,n,i),k(n,o)?-1:(T(t[0])===e[31]>>7&&D(t[0],h,t[0]),F(t[3],t[0],t[1]),0)}(s,n))return-1;for(o=0;o=0};var h=L(),p=L([1]),d=L([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=L([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),v=L([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),g=L([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),m=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),b=L([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(t,e){var r=n.md.sha512.create(),o=new u(t);r.update(o.getBytes(e),"binary");var i=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(i,"binary");for(var a=new l(c.constants.HASH_BYTE_LENGTH),s=0;s<64;++s)a[s]=i.charCodeAt(s);return a}function S(t,e){var r,n,o,i;for(n=63;n>=32;--n){for(r=0,o=n-32,i=n-12;o>8,e[o]-=256*r;e[o]+=r,e[n]=0}for(r=0,o=0;o<32;++o)e[o]+=r-(e[31]>>4)*m[o],r=e[o]>>8,e[o]&=255;for(o=0;o<32;++o)e[o]-=r*m[o];for(n=0;n<32;++n)e[n+1]+=e[n]>>8,t[n]=255&e[n]}function x(t){for(var e=new Float64Array(64),r=0;r<64;++r)e[r]=t[r],t[r]=0;S(t,e)}function _(t,e){var r=L(),n=L(),o=L(),i=L(),a=L(),s=L(),u=L(),l=L(),c=L();D(r,t[1],t[0]),D(c,e[1],e[0]),F(r,r,c),R(n,t[0],t[1]),R(c,e[0],e[1]),F(n,n,c),F(o,t[3],e[3]),F(o,o,y),F(i,t[2],e[2]),R(i,i,i),D(a,n,r),D(s,i,o),R(u,i,o),R(l,n,r),F(t[0],a,s),F(t[1],l,u),F(t[2],u,s),F(t[3],a,l)}function E(t,e,r){for(var n=0;n<4;++n)N(t[n],e[n],r)}function O(t,e){var r=L(),n=L(),o=L();!function(t,e){var r,n=L();for(r=0;r<16;++r)n[r]=e[r];for(r=253;r>=0;--r)B(n,n),2!==r&&4!==r&&F(n,n,e);for(r=0;r<16;++r)t[r]=n[r]}(o,e[2]),F(r,e[0],o),F(n,e[1],o),P(t,n),t[31]^=T(r)<<7}function P(t,e){var r,n,o,i=L(),a=L();for(r=0;r<16;++r)a[r]=e[r];for(I(a),I(a),I(a),n=0;n<2;++n){for(i[0]=a[0]-65517,r=1;r<15;++r)i[r]=a[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=a[15]-32767-(i[14]>>16&1),o=i[15]>>16&1,i[14]&=65535,N(a,i,1-o)}for(r=0;r<16;r++)t[2*r]=255&a[r],t[2*r+1]=a[r]>>8}function k(t,e){var r=new l(32),n=new l(32);return P(r,t),P(n,e),C(r,0,n,0)}function C(t,e,r,n){return function(t,e,r,n,o){var i,a=0;for(i=0;i<32;++i)a|=t[e+i]^r[n+i];return(1&a-1>>>8)-1}(t,e,r,n)}function T(t){var e=new l(32);return P(e,t),1&e[0]}function A(t,e,r){var n,o;for(j(t[0],h),j(t[1],p),j(t[2],p),j(t[3],h),o=255;o>=0;--o)E(t,e,n=r[o/8|0]>>(7&o)&1),_(e,t),_(t,t),E(t,e,n)}function M(t,e){var r=[L(),L(),L(),L()];j(r[0],v),j(r[1],g),j(r[2],p),F(r[3],v,g),A(t,r,e)}function j(t,e){var r;for(r=0;r<16;r++)t[r]=0|e[r]}function I(t){var e,r,n=1;for(e=0;e<16;++e)r=t[e]+n+65535,n=Math.floor(r/65536),t[e]=r-65536*n;t[0]+=n-1+37*(n-1)}function N(t,e,r){for(var n,o=~(r-1),i=0;i<16;++i)n=o&(t[i]^e[i]),t[i]^=n,e[i]^=n}function L(t){var e,r=new Float64Array(16);if(t)for(e=0;e0&&(a=n.util.fillString(String.fromCharCode(0),u)+a),{encapsulation:e.encrypt(a,"NONE"),key:t.generate(a,i)}},decrypt:function(e,r,n){var o=e.decrypt(r,"NONE");return t.generate(o,n)}}},n.kem.kdf1=function(t,e){i(this,t,0,e||t.digestLength)},n.kem.kdf2=function(t,e){i(this,t,1,e||t.digestLength)}},function(t,e,r){var n=r(0);r(1),t.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var o={},i=[],a=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var s=0;s0){for(var r=o.create(o.Class.CONTEXT_SPECIFIC,1,!0,[]),i=0;i=r&&a0&&a.value[0].value.push(o.create(o.Class.CONTEXT_SPECIFIC,0,!0,e)),i.length>0&&a.value[0].value.push(o.create(o.Class.CONTEXT_SPECIFIC,1,!0,i)),a.value[0].value.push(o.create(o.Class.UNIVERSAL,o.Type.SET,!0,t.signerInfos)),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(t.type).getBytes()),a])},addSigner:function(e){var r=e.issuer,o=e.serialNumber;if(e.certificate){var i=e.certificate;"string"==typeof i&&(i=n.pki.certificateFromPem(i)),r=i.issuer.attributes,o=i.serialNumber}var a=e.key;if(!a)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof a&&(a=n.pki.privateKeyFromPem(a));var s=e.digestAlgorithm||n.pki.oids.sha1;switch(s){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+s)}var u=e.authenticatedAttributes||[];if(u.length>0){for(var l=!1,c=!1,f=0;f="8"&&(r="00"+r);var o=n.util.hexToBytes(r);t.putInt32(o.length),t.putBytes(o)}function a(t,e){t.putInt32(e.length),t.putString(e)}function s(){for(var t=n.md.sha1.create(),e=arguments.length,r=0;r=t.minX&&e.maxY>=t.minY}function y(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function v(t,e,r,o,i){for(var a,s=[e,r];s.length;)(r=s.pop())-(e=s.pop())<=o||(a=e+Math.ceil((r-e)/o/2)*o,n(t,a,e,r,i),s.push(e,a,a,r))}o.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,r=[],n=this.toBBox;if(!d(t,e))return r;for(var o,i,a,s,u=[];e;){for(o=0,i=e.children.length;o=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(o,i,e)},_split:function(t,e){var r=t[e],n=r.children.length,o=this._minEntries;this._chooseSplitAxis(r,o,n);var i=this._chooseSplitIndex(r,o,n),s=y(r.children.splice(i,r.children.length-i));s.height=r.height,s.leaf=r.leaf,a(r,this.toBBox),a(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(r,s)},_splitRoot:function(t,e){this.data=y([t,e]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,r){var n,o,i,a,u,l,c,h,p,d,y,v,g,m;for(l=c=1/0,n=e;n<=r-e;n++)o=s(t,0,n,this.toBBox),i=s(t,n,r,this.toBBox),p=o,d=i,void 0,void 0,void 0,void 0,y=Math.max(p.minX,d.minX),v=Math.max(p.minY,d.minY),g=Math.min(p.maxX,d.maxX),m=Math.min(p.maxY,d.maxY),a=Math.max(0,g-y)*Math.max(0,m-v),u=f(o)+f(i),a=e;o--)i=t.children[o],u(c,t.leaf?a(i):i),f+=h(c);return f},_adjustParentBBoxes:function(t,e,r){for(var n=r;n>=0;n--)u(e[n],t)},_condense:function(t){for(var e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children).splice(e.indexOf(t[r]),1):this.clear():a(t[r],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}},2299:function(t,e,r){var n,o,i;function a(t){"@babel/helpers - typeof";return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}i=function(){"use strict";function t(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function e(t,e){return te?1:0}return function(r,n,o,i,a){!function e(r,n,o,i,a){for(;i>o;){if(i-o>600){var s=i-o+1,u=n-o+1,l=Math.log(s),c=.5*Math.exp(2*l/3),f=.5*Math.sqrt(l*c*(s-c)/s)*(u-s/2<0?-1:1),h=Math.max(o,Math.floor(n-u*c/s+f)),p=Math.min(i,Math.floor(n+(s-u)*c/s+f));e(r,n,h,p,a)}var d=r[n],y=o,v=i;for(t(r,o,n),a(r[i],d)>0&&t(r,o,i);y0;)v--}0===a(r[o],d)?t(r,o,v):t(r,++v,i),v<=n&&(o=v+1),n<=v&&(i=v-1)}}(r,n,o||0,i||r.length-1,a||e)}},"object"===a(e)?t.exports=i():void 0===(o="function"==typeof(n=i)?n.call(e,r,e,t):n)||(t.exports=o)},7058:function(t,e,r){var n,o,i;function a(t){"@babel/helpers - typeof";return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}i=function(){"use strict";var t=function(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array||t instanceof Uint8ClampedArray},e=function(t,e){for(var r=Object.keys(e),n=0;n=0&&(0|t)===t||n("invalid parameter type, ("+t+")"+i(e)+". must be a nonnegative integer")},oneOf:u,shaderError:function(t,e,n,i,a){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var s=t.getShaderInfoLog(e),u=i===t.FRAGMENT_SHADER?"fragment":"vertex";b(n,"string",u+" shader source must be a string",a);var l=v(n,a),f=function(t){var e=[];return t.split("\n").forEach(function(t){if(!(t.length<5)){var r=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(t);r?e.push(new p(0|r[1],0|r[2],r[3].trim())):t.length>0&&e.push(new p("unknown",0,t))}}),e}(s);!function(t,e){e.forEach(function(e){var r=t[e.file];if(r){var n=r.index[e.line];if(n)return n.errors.push(e),void(r.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)})}(l,f),Object.keys(l).forEach(function(t){var e=l[t];if(e.hasErrors){var n=[""],o=[""];i("file number "+t+": "+e.name+"\n","color:red;text-decoration:underline;font-weight:bold"),e.lines.forEach(function(t){if(t.errors.length>0){i(c(t.number,4)+"| ","background-color:yellow; font-weight:bold"),i(t.line+r,"color:red; background-color:yellow; font-weight:bold");var e=0;t.errors.forEach(function(n){var o=n.message,a=/^\s*'(.*)'\s*:\s*(.*)$/.exec(o);if(a){var s=a[1];switch(o=a[2],s){case"assign":s="="}e=Math.max(t.line.indexOf(s,e),0)}else e=0;i(c("| ",6)),i(c("^^^",e+3)+r,"font-weight:bold"),i(c("| ",6)),i(o+r,"font-weight:bold")}),i(c("| ",6)+r)}else i(c(t.number,4)+"| "),i(t.line+r,"color:red")}),"undefined"==typeof document||window.chrome?console.log(n.join("")):(o[0]=n.join("%c"),console.log.apply(console,o))}function i(t,e){n.push(t),o.push(e||"")}}),o.raise("Error compiling "+u+" shader, "+l[0].name)}},linkError:function(t,e,n,i,a){if(!t.getProgramParameter(e,t.LINK_STATUS)){var s=t.getProgramInfoLog(e),u=v(n,a),l='Error linking program with vertex shader, "'+v(i,a)[0].name+'", and fragment shader "'+u[0].name+'"';"undefined"!=typeof document?console.log("%c"+l+r+"%c"+s,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(l+r+s),o.raise(l)}},callSite:y,saveCommandRef:g,saveDrawInfo:function(t,e,r,n){function o(t){return t?n.id(t):0}function i(t,e){Object.keys(e).forEach(function(e){t[n.id(e)]=!0})}g(t),t._fragId=o(t.static.frag),t._vertId=o(t.static.vert);var a=t._uniformSet={};i(a,e.static),i(a,e.dynamic);var s=t._attributeSet={};i(s,r.static),i(s,r.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic},framebufferFormat:function(t,e,r){t.texture?u(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):u(t.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")},guessCommand:d,texture2D:function(t,e,r){var n,i=e.width,a=e.height,s=e.channels;o(i>0&&i<=r.maxTextureSize&&a>0&&a<=r.maxTextureSize,"invalid texture shape"),t.wrapS===w&&t.wrapT===w||o(I(i)&&I(a),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==i&&1!==a&&o(t.minFilter!==x&&t.minFilter!==E&&t.minFilter!==_&&t.minFilter!==O,"min filter requires mipmap"):(o(I(i)&&I(a),"texture must be a square power of 2 to support mipmapping"),o(e.mipmask===(i<<1)-1,"missing or incomplete mipmap data")),e.type===P&&(r.extensions.indexOf("oes_texture_float_linear")<0&&o(t.minFilter===S&&t.magFilter===S,"filter not supported, must enable oes_texture_float_linear"),o(!t.genMipmaps,"mipmap generation not supported with float textures"));var u=e.images;for(n=0;n<16;++n)if(u[n]){var l=i>>n,c=a>>n;o(e.mipmask&1<0&&i<=n.maxTextureSize&&a>0&&a<=n.maxTextureSize,"invalid texture shape"),o(i===a,"cube map must be square"),o(e.wrapS===w&&e.wrapT===w,"wrap mode not supported by cube map");for(var u=0;u>f,d=a>>f;o(l.mipmask&1<1&&r===n&&('"'===r||"'"===r))return['"'+G(e.substr(1,e.length-2))+'"'];var o=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(e);if(o)return t(e.substr(0,o.index)).concat(t(o[1])).concat(t(e.substr(o.index+o[0].length)));var i=e.split(".");if(1===i.length)return['"'+G(e)+'"'];for(var a=[],s=0;s0,"invalid pixel ratio"))):o=(i=u).canvas:N.raise("invalid arguments to regl"),r&&("canvas"===r.nodeName.toLowerCase()?o=r:n=r),!i){if(!o){N("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var v=function(t,r,n){var o,i=document.createElement("canvas");function a(){var r=window.innerWidth,o=window.innerHeight;if(t!==document.body){var a=t.getBoundingClientRect();r=a.right-a.left,o=a.bottom-a.top}i.width=n*r,i.height=n*o,e(i.style,{width:r+"px",height:o+"px"})}return e(i.style,{border:0,margin:0,padding:0,top:0,left:0}),t.appendChild(i),t===document.body&&(i.style.position="absolute",e(t.style,{margin:0,padding:0})),t!==document.body&&"function"==typeof ResizeObserver?(o=new ResizeObserver(function(){setTimeout(a)})).observe(t):window.addEventListener("resize",a,!1),a(),{canvas:i,onDestroy:function(){o?o.disconnect():window.removeEventListener("resize",a),t.removeChild(i)}}}(n||document.body,0,h);if(!v)return null;o=v.canvas,y=v.onDestroy}void 0===l.premultipliedAlpha&&(l.premultipliedAlpha=!0),i=function(t,e){function r(r){try{return t.getContext(r,e)}catch(t){return null}}return r("webgl")||r("experimental-webgl")||r("webgl-experimental")}(o,l)}return i?{gl:i,canvas:o,container:n,extensions:c,optionalExtensions:f,pixelRatio:h,profile:p,onDone:d,onDestroy:y}:(y(),d("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function X(t,e){for(var r=Array(t),n=0;n65535)<<4,e|=r=((t>>>=e)>255)<<3,e|=r=((t>>>=r)>15)<<2,(e|=r=((t>>>=r)>3)<<1)|(t>>>=r)>>1}function nt(){var t=X(8,function(){return[]});function e(e){var r=function(t){for(var e=16;e<=1<<28;e*=16)if(t<=e)return e;return 0}(e),n=t[rt(r)>>2];return n.length>0?n.pop():new ArrayBuffer(r)}function r(e){t[rt(e.byteLength)>>2].push(e)}return{alloc:e,free:r,allocType:function(t,r){var n=null;switch(t){case J:n=new Int8Array(e(r),0,r);break;case K:n=new Uint8Array(e(r),0,r);break;case Q:n=new Int16Array(e(2*r),0,r);break;case Z:n=new Uint16Array(e(2*r),0,r);break;case $:n=new Int32Array(e(4*r),0,r);break;case tt:n=new Uint32Array(e(4*r),0,r);break;case et:n=new Float32Array(e(4*r),0,r);break;default:return null}return n.length!==r?n.subarray(0,r):n},freeType:function(t){r(t.buffer)}}}var ot=nt();ot.zero=nt();var it=function(t,e){var r=1;e.ext_texture_filter_anisotropic&&(r=t.getParameter(34047));var n=1,o=1;e.webgl_draw_buffers&&(n=t.getParameter(34852),o=t.getParameter(36063));var i=!!e.oes_texture_float;if(i){var a=t.createTexture();t.bindTexture(3553,a),t.texImage2D(3553,0,6408,1,1,0,6408,5126,null);var s=t.createFramebuffer();if(t.bindFramebuffer(36160,s),t.framebufferTexture2D(36160,36064,3553,a,0),t.bindTexture(3553,null),36053!==t.checkFramebufferStatus(36160))i=!1;else{t.viewport(0,0,1,1),t.clearColor(1,0,0,1),t.clear(16384);var u=ot.allocType(5126,4);t.readPixels(0,0,1,1,6408,5126,u),t.getError()?i=!1:(t.deleteFramebuffer(s),t.deleteTexture(a),i=1===u[0]),ot.freeType(u)}}var l=!0;if(!("undefined"!=typeof navigator&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)))){var c=t.createTexture(),f=ot.allocType(5121,36);t.activeTexture(33984),t.bindTexture(34067,c),t.texImage2D(34069,0,6408,3,3,0,6408,5121,f),ot.freeType(f),t.bindTexture(34067,null),t.deleteTexture(c),l=!t.getError()}return{colorBits:[t.getParameter(3410),t.getParameter(3411),t.getParameter(3412),t.getParameter(3413)],depthBits:t.getParameter(3414),stencilBits:t.getParameter(3415),subpixelBits:t.getParameter(3408),extensions:Object.keys(e).filter(function(t){return!!e[t]}),maxAnisotropic:r,maxDrawbuffers:n,maxColorAttachments:o,pointSizeDims:t.getParameter(33901),lineWidthDims:t.getParameter(33902),maxViewportDims:t.getParameter(3386),maxCombinedTextureUnits:t.getParameter(35661),maxCubeMapSize:t.getParameter(34076),maxRenderbufferSize:t.getParameter(34024),maxTextureUnits:t.getParameter(34930),maxTextureSize:t.getParameter(3379),maxAttributes:t.getParameter(34921),maxVertexUniforms:t.getParameter(36347),maxVertexTextureUnits:t.getParameter(35660),maxVaryingVectors:t.getParameter(36348),maxFragmentUniforms:t.getParameter(36349),glsl:t.getParameter(35724),renderer:t.getParameter(7937),vendor:t.getParameter(7936),version:t.getParameter(7938),readFloat:i,npotTextureCube:l}};function at(e){return!!e&&"object"===a(e)&&Array.isArray(e.shape)&&Array.isArray(e.stride)&&"number"==typeof e.offset&&e.shape.length===e.stride.length&&(Array.isArray(e.data)||t(e.data))}var st=function(t){return Object.keys(t).map(function(e){return t[e]})},ut={shape:function(t){for(var e=[],r=t;r.length;r=r[0])e.push(r.length);return e},flatten:function(t,e,r,n){var o=1;if(e.length)for(var i=0;i>>31<<15,i=(n<<1>>>24)-127,a=n>>13&1023;if(i<-24)e[r]=o;else if(i<-14){var s=-14-i;e[r]=o+(a+1024>>s)}else e[r]=i>15?o+31744:o+(i+15<<10)+a}return e}function Gt(e){return Array.isArray(e)||t(e)}var Ut=function(t){return!(t&t-1||!t)},zt=34467,Vt=3553,Ht=34067,qt=34069,Wt=6408,Yt=6406,Xt=6407,Jt=6409,Kt=6410,Qt=32854,Zt=32855,$t=36194,te=32819,ee=32820,re=33635,ne=34042,oe=6402,ie=34041,ae=35904,se=35906,ue=36193,le=33776,ce=33777,fe=33778,he=33779,pe=35986,de=35987,ye=34798,ve=35840,ge=35841,me=35842,be=35843,we=36196,Se=5121,xe=5123,_e=5125,Ee=5126,Oe=10242,Pe=10243,ke=10497,Ce=33071,Te=33648,Ae=10240,Me=10241,je=9728,Ie=9729,Ne=9984,Le=9985,Re=9986,De=9987,Be=33170,Fe=4352,Ge=4353,Ue=4354,ze=34046,Ve=3317,He=37440,qe=37441,We=37443,Ye=37444,Xe=33984,Je=[Ne,Re,Le,De],Ke=[0,Jt,Kt,Xt,Wt],Qe={};function Ze(t){return"[object "+t+"]"}Qe[Jt]=Qe[Yt]=Qe[oe]=1,Qe[ie]=Qe[Kt]=2,Qe[Xt]=Qe[ae]=3,Qe[Wt]=Qe[se]=4;var $e=Ze("HTMLCanvasElement"),tr=Ze("OffscreenCanvas"),er=Ze("CanvasRenderingContext2D"),rr=Ze("ImageBitmap"),nr=Ze("HTMLImageElement"),or=Ze("HTMLVideoElement"),ir=Object.keys(ct).concat([$e,tr,er,rr,nr,or]),ar=[];ar[Se]=1,ar[Ee]=4,ar[ue]=2,ar[xe]=2,ar[_e]=4;var sr=[];function ur(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function lr(t){return!!Array.isArray(t)&&!(0===t.length||!Gt(t[0]))}function cr(t){return Object.prototype.toString.call(t)}function fr(t){return cr(t)===$e}function hr(t){return cr(t)===tr}function pr(t){if(!t)return!1;var e=cr(t);return ir.indexOf(e)>=0||(ur(t)||lr(t)||at(t))}function dr(t){return 0|ct[Object.prototype.toString.call(t)]}function yr(t,e){return ot.allocType(t.type===ue?Ee:t.type,e)}function vr(t,e){t.type===ue?(t.data=Ft(e),ot.freeType(e)):t.data=e}function gr(t,e,r,n,o,i){var a;if(a=void 0!==sr[t]?sr[t]:Qe[t]*ar[e],i&&(a*=6),o){for(var s=0,u=r;u>=1;)s+=a*u*u,u/=2;return s}return a*r*n}function mr(r,n,o,i,s,u,l){var c={"don't care":Fe,"dont care":Fe,nice:Ue,fast:Ge},f={repeat:ke,clamp:Ce,mirror:Te},h={nearest:je,linear:Ie},p=e({mipmap:De,"nearest mipmap nearest":Ne,"linear mipmap nearest":Le,"nearest mipmap linear":Re,"linear mipmap linear":De},h),d={none:0,browser:Ye},y={uint8:Se,rgba4:te,rgb565:re,"rgb5 a1":ee},v={alpha:Yt,luminance:Jt,"luminance alpha":Kt,rgb:Xt,rgba:Wt,rgba4:Qt,"rgb5 a1":Zt,rgb565:$t},g={};n.ext_srgb&&(v.srgb=ae,v.srgba=se),n.oes_texture_float&&(y.float32=y.float=Ee),n.oes_texture_half_float&&(y.float16=y["half float"]=ue),n.webgl_depth_texture&&(e(v,{depth:oe,"depth stencil":ie}),e(y,{uint16:xe,uint32:_e,"depth stencil":ne})),n.webgl_compressed_texture_s3tc&&e(g,{"rgb s3tc dxt1":le,"rgba s3tc dxt1":ce,"rgba s3tc dxt3":fe,"rgba s3tc dxt5":he}),n.webgl_compressed_texture_atc&&e(g,{"rgb atc":pe,"rgba atc explicit alpha":de,"rgba atc interpolated alpha":ye}),n.webgl_compressed_texture_pvrtc&&e(g,{"rgb pvrtc 4bppv1":ve,"rgb pvrtc 2bppv1":ge,"rgba pvrtc 4bppv1":me,"rgba pvrtc 2bppv1":be}),n.webgl_compressed_texture_etc1&&(g["rgb etc1"]=we);var m=Array.prototype.slice.call(r.getParameter(zt));Object.keys(g).forEach(function(t){var e=g[t];m.indexOf(e)>=0&&(v[t]=e)});var b=Object.keys(v);o.textureFormats=b;var w=[];Object.keys(v).forEach(function(t){var e=v[t];w[e]=t});var S=[];Object.keys(y).forEach(function(t){var e=y[t];S[e]=t});var x=[];Object.keys(h).forEach(function(t){var e=h[t];x[e]=t});var _=[];Object.keys(p).forEach(function(t){var e=p[t];_[e]=t});var E=[];Object.keys(f).forEach(function(t){var e=f[t];E[e]=t});var O=b.reduce(function(t,e){var r=v[e];return r===Jt||r===Yt||r===Jt||r===Kt||r===oe||r===ie||n.ext_srgb&&(r===ae||r===se)?t[r]=r:r===Zt||e.indexOf("rgba")>=0?t[r]=Wt:t[r]=Xt,t},{});function P(){this.internalformat=Wt,this.format=Wt,this.type=Se,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=Ye,this.width=0,this.height=0,this.channels=0}function k(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function C(t,e){if("object"===a(e)&&e){if("premultiplyAlpha"in e&&(N.type(e.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=e.premultiplyAlpha),"flipY"in e&&(N.type(e.flipY,"boolean","invalid texture flip"),t.flipY=e.flipY),"alignment"in e&&(N.oneOf(e.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=e.alignment),"colorSpace"in e&&(N.parameter(e.colorSpace,d,"invalid colorSpace"),t.colorSpace=d[e.colorSpace]),"type"in e){var r=e.type;N(n.oes_texture_float||!("float"===r||"float32"===r),"you must enable the OES_texture_float extension in order to use floating point textures."),N(n.oes_texture_half_float||!("half float"===r||"float16"===r),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),N(n.webgl_depth_texture||!("uint16"===r||"uint32"===r||"depth stencil"===r),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),N.parameter(r,y,"invalid texture type"),t.type=y[r]}var i=t.width,s=t.height,u=t.channels,l=!1;"shape"in e?(N(Array.isArray(e.shape)&&e.shape.length>=2,"shape must be an array"),i=e.shape[0],s=e.shape[1],3===e.shape.length&&(u=e.shape[2],N(u>0&&u<=4,"invalid number of channels"),l=!0),N(i>=0&&i<=o.maxTextureSize,"invalid width"),N(s>=0&&s<=o.maxTextureSize,"invalid height")):("radius"in e&&(i=s=e.radius,N(i>=0&&i<=o.maxTextureSize,"invalid radius")),"width"in e&&(i=e.width,N(i>=0&&i<=o.maxTextureSize,"invalid width")),"height"in e&&(s=e.height,N(s>=0&&s<=o.maxTextureSize,"invalid height")),"channels"in e&&(u=e.channels,N(u>0&&u<=4,"invalid number of channels"),l=!0)),t.width=0|i,t.height=0|s,t.channels=0|u;var c=!1;if("format"in e){var f=e.format;N(n.webgl_depth_texture||!("depth"===f||"depth stencil"===f),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),N.parameter(f,v,"invalid texture format");var h=t.internalformat=v[f];t.format=O[h],f in y&&("type"in e||(t.type=y[f])),f in g&&(t.compressed=!0),c=!0}!l&&c?t.channels=Qe[t.format]:l&&!c?t.channels!==Ke[t.format]&&(t.format=t.internalformat=Ke[t.channels]):c&&l&&N(t.channels===Qe[t.format],"number of channels inconsistent with specified format")}}function T(t){r.pixelStorei(He,t.flipY),r.pixelStorei(qe,t.premultiplyAlpha),r.pixelStorei(We,t.colorSpace),r.pixelStorei(Ve,t.unpackAlignment)}function A(){P.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function M(e,r){var n=null;if(pr(r)?n=r:r&&(N.type(r,"object","invalid pixel data type"),C(e,r),"x"in r&&(e.xOffset=0|r.x),"y"in r&&(e.yOffset=0|r.y),pr(r.data)&&(n=r.data)),N(!e.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),r.copy){N(!n,"can not specify copy and data field for the same texture");var i=s.viewportWidth,a=s.viewportHeight;e.width=e.width||i-e.xOffset,e.height=e.height||a-e.yOffset,e.needsCopy=!0,N(e.xOffset>=0&&e.xOffset=0&&e.yOffset0&&e.width<=i&&e.height>0&&e.height<=a,"copy texture read out of bounds")}else if(n){if(t(n))e.channels=e.channels||4,e.data=n,"type"in r||e.type!==Se||(e.type=dr(n));else if(ur(n))e.channels=e.channels||4,function(t,e){var r=e.length;switch(t.type){case Se:case xe:case _e:case Ee:var n=ot.allocType(t.type,r);n.set(e),t.data=n;break;case ue:t.data=Ft(e);break;default:N.raise("unsupported texture type, must specify a typed array")}}(e,n),e.alignment=1,e.needsFree=!0;else if(at(n)){var u=n.data;Array.isArray(u)||e.type!==Se||(e.type=dr(u));var l,c,f,h,p,d,y=n.shape,v=n.stride;3===y.length?(f=y[2],d=v[2]):(N(2===y.length,"invalid ndarray pixel data, must be 2 or 3D"),f=1,d=1),l=y[0],c=y[1],h=v[0],p=v[1],e.alignment=1,e.width=l,e.height=c,e.channels=f,e.format=e.internalformat=Ke[f],e.needsFree=!0,function(t,e,r,n,o,i){for(var a=t.width,s=t.height,u=t.channels,l=yr(t,a*s*u),c=0,f=0;f=0,"oes_texture_float extension not enabled"):e.type===ue&&N(o.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function j(t,e,n){var o=t.element,a=t.data,s=t.internalformat,u=t.format,l=t.type,c=t.width,f=t.height;T(t),o?r.texImage2D(e,n,u,u,l,o):t.compressed?r.compressedTexImage2D(e,n,s,c,f,0,a):t.needsCopy?(i(),r.copyTexImage2D(e,n,u,t.xOffset,t.yOffset,c,f,0)):r.texImage2D(e,n,u,c,f,0,u,l,a||null)}function I(t,e,n,o,a){var s=t.element,u=t.data,l=t.internalformat,c=t.format,f=t.type,h=t.width,p=t.height;T(t),s?r.texSubImage2D(e,a,n,o,c,f,s):t.compressed?r.compressedTexSubImage2D(e,a,n,o,l,h,p,u):t.needsCopy?(i(),r.copyTexSubImage2D(e,a,n,o,t.xOffset,t.yOffset,h,p)):r.texSubImage2D(e,a,n,o,h,p,c,f,u)}var L=[];function R(){return L.pop()||new A}function D(t){t.needsFree&&ot.freeType(t.data),A.call(t),L.push(t)}function B(t,e,r){var n=t.images[0]=R();t.mipmask=1,n.width=t.width=e,n.height=t.height=r,n.channels=t.channels=4}function F(t,e){var r=null;if(pr(e))k(r=t.images[0]=R(),t),M(r,e),t.mipmask=1;else if(C(t,e),Array.isArray(e.mipmap))for(var n=e.mipmap,o=0;o>=o,r.height>>=o,M(r,n[o]),t.mipmask|=1<=0&&!("faces"in e)&&(t.genMipmaps=!0)}if("mag"in e){var n=e.mag;N.parameter(n,h),t.magFilter=h[n]}var i=t.wrapS,s=t.wrapT;if("wrap"in e){var u=e.wrap;"string"==typeof u?(N.parameter(u,f),i=s=f[u]):Array.isArray(u)&&(N.parameter(u[0],f),N.parameter(u[1],f),i=f[u[0]],s=f[u[1]])}else{if("wrapS"in e){var l=e.wrapS;N.parameter(l,f),i=f[l]}if("wrapT"in e){var d=e.wrapT;N.parameter(d,f),s=f[d]}}if(t.wrapS=i,t.wrapT=s,"anisotropic"in e){var y=e.anisotropic;N("number"==typeof y&&y>=1&&y<=o.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var v=!1;switch(a(e.mipmap)){case"string":N.parameter(e.mipmap,c,"invalid mipmap hint"),t.mipmapHint=c[e.mipmap],t.genMipmaps=!0,v=!0;break;case"boolean":v=t.genMipmaps=e.mipmap;break;case"object":N(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,v=!0;break;default:N.raise("invalid mipmap type")}!v||"min"in e||(t.minFilter=Ne)}}function W(t,e){r.texParameteri(e,Me,t.minFilter),r.texParameteri(e,Ae,t.magFilter),r.texParameteri(e,Oe,t.wrapS),r.texParameteri(e,Pe,t.wrapT),n.ext_texture_filter_anisotropic&&r.texParameteri(e,ze,t.anisotropic),t.genMipmaps&&(r.hint(Be,t.mipmapHint),r.generateMipmap(e))}var Y=0,X={},J=o.maxTextureUnits,K=Array(J).map(function(){return null});function Q(t){P.call(this),this.mipmask=0,this.internalformat=Wt,this.id=Y++,this.refCount=1,this.target=t,this.texture=r.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new H,l.profile&&(this.stats={size:0})}function Z(t){r.activeTexture(Xe),r.bindTexture(t.target,t.texture)}function $(){var t=K[0];t?r.bindTexture(t.target,t.texture):r.bindTexture(Vt,null)}function tt(t){var e=t.texture;N(e,"must not double destroy texture");var n=t.unit,o=t.target;n>=0&&(r.activeTexture(Xe+n),r.bindTexture(o,null),K[n]=null),r.deleteTexture(e),t.texture=null,t.params=null,t.pixels=null,t.refCount=0,delete X[t.id],u.textureCount--}return e(Q.prototype,{bind:function(){this.bindCount+=1;var t=this.unit;if(t<0){for(var e=0;e0)continue;n.unit=-1}K[e]=this,t=e;break}t>=J&&N.raise("insufficient number of texture units"),l.profile&&u.maxTextureUnits>u)-a,l.height=l.height||(n.height>>u)-s,N(n.type===l.type&&n.format===l.format&&n.internalformat===l.internalformat,"incompatible format for texture.subimage"),N(a>=0&&s>=0&&a+l.width<=n.width&&s+l.height<=n.height,"texture.subimage write out of bounds"),N(n.mipmask&1<>s;++s){var u=o>>s,c=a>>s;if(!u||!c)break;r.texImage2D(Vt,s,n.format,u,c,0,n.format,n.type,null)}return $(),l.profile&&(n.stats.size=gr(n.internalformat,n.type,o,a,!1,!1)),i},i._reglType="texture2d",i._texture=n,l.profile&&(i.stats=n.stats),i.destroy=function(){n.decRef()},i},createCube:function(t,e,n,i,s,c){var f=new Q(Ht);X[f.id]=f,u.cubeCount++;var h=new Array(6);function p(t,e,r,n,i,s){var u,c=f.texInfo;for(H.call(c),u=0;u<6;++u)h[u]=z();if("number"!=typeof t&&t)if("object"===a(t))if(e)F(h[0],t),F(h[1],e),F(h[2],r),F(h[3],n),F(h[4],i),F(h[5],s);else if(q(c,t),C(f,t),"faces"in t){var d=t.faces;for(N(Array.isArray(d)&&6===d.length,"cube faces must be a length 6 array"),u=0;u<6;++u)N("object"===a(d[u])&&!!d[u],"invalid input for cube map face"),k(h[u],f),F(h[u],d[u])}else for(u=0;u<6;++u)F(h[u],t);else N.raise("invalid arguments to cube map");else{var y=0|t||1;for(u=0;u<6;++u)B(h[u],y,y)}for(k(f,h[0]),o.npotTextureCube||N(Ut(f.width)&&Ut(f.height),"your browser does not support non power or two texture dimensions"),c.genMipmaps?f.mipmask=(h[0].width<<1)-1:f.mipmask=h[0].mipmask,N.textureCube(f,c,h,o),f.internalformat=h[0].internalformat,p.width=h[0].width,p.height=h[0].height,Z(f),u=0;u<6;++u)G(h[u],qt+u);for(W(c,Ht),$(),l.profile&&(f.stats.size=gr(f.internalformat,f.type,p.width,p.height,c.genMipmaps,!0)),p.format=w[f.internalformat],p.type=S[f.type],p.mag=x[c.magFilter],p.min=_[c.minFilter],p.wrapS=E[c.wrapS],p.wrapT=E[c.wrapT],u=0;u<6;++u)V(h[u]);return p}return p(t,e,n,i,s,c),p.subimage=function(t,e,r,n,o){N(!!e,"must specify image data"),N("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var i=0|r,a=0|n,s=0|o,u=R();return k(u,f),u.width=0,u.height=0,M(u,e),u.width=u.width||(f.width>>s)-i,u.height=u.height||(f.height>>s)-a,N(f.type===u.type&&f.format===u.format&&f.internalformat===u.internalformat,"incompatible format for texture.subimage"),N(i>=0&&a>=0&&i+u.width<=f.width&&a+u.height<=f.height,"texture.subimage write out of bounds"),N(f.mipmask&1<>o;++o)r.texImage2D(qt+n,o,f.format,e>>o,e>>o,0,f.format,f.type,null);return $(),l.profile&&(f.stats.size=gr(f.internalformat,f.type,p.width,p.height,!1,!0)),p}},p._reglType="textureCube",p._texture=f,l.profile&&(p.stats=f.stats),p.destroy=function(){f.decRef()},p},clear:function(){for(var t=0;t>e,t.height>>e,0,t.internalformat,t.type,null);else for(var n=0;n<6;++n)r.texImage2D(qt+n,e,t.internalformat,t.width>>e,t.height>>e,0,t.internalformat,t.type,null);W(t.texInfo,t.target)})},refresh:function(){for(var t=0;t=2,"invalid renderbuffer shape"),u=0|d[0],l=0|d[1]}else"radius"in p&&(u=l=0|p.radius),"width"in p&&(u=0|p.width),"height"in p&&(l=0|p.height);"format"in p&&(N.parameter(p.format,i,"invalid renderbuffer format"),c=i[p.format])}else"number"==typeof e?(u=0|e,l="number"==typeof n?0|n:u):e?N.raise("invalid arguments to renderbuffer constructor"):u=l=1;if(N(u>0&&l>0&&u<=r.maxRenderbufferSize&&l<=r.maxRenderbufferSize,"invalid renderbuffer size"),u!==f.width||l!==f.height||c!==f.format)return h.width=f.width=u,h.height=f.height=l,f.format=c,t.bindRenderbuffer(br,f.renderbuffer),t.renderbufferStorage(br,c,u,l),N(0===t.getError(),"invalid render buffer format"),o.profile&&(f.stats.size=xr(f.format,f.width,f.height)),h.format=s[f.format],h}return l[f.id]=f,n.renderbufferCount++,h(e,u),h.resize=function(e,n){var i=0|e,a=0|n||i;return i===f.width&&a===f.height?h:(N(i>0&&a>0&&i<=r.maxRenderbufferSize&&a<=r.maxRenderbufferSize,"invalid renderbuffer size"),h.width=f.width=i,h.height=f.height=a,t.bindRenderbuffer(br,f.renderbuffer),t.renderbufferStorage(br,f.format,i,a),N(0===t.getError(),"invalid render buffer format"),o.profile&&(f.stats.size=xr(f.format,f.width,f.height)),h)},h._reglType="renderbuffer",h._renderbuffer=f,o.profile&&(h.stats=f.stats),h.destroy=function(){f.decRef()},h},clear:function(){st(l).forEach(f)},restore:function(){st(l).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(br,e.renderbuffer),t.renderbufferStorage(br,e.format,e.width,e.height)}),t.bindRenderbuffer(br,null)}}},Er=36160,Or=36161,Pr=3553,kr=34069,Cr=36064,Tr=36096,Ar=36128,Mr=33306,jr=36053,Ir=6402,Nr=[6407,6408],Lr=[];Lr[6408]=4,Lr[6407]=3;var Rr=[];Rr[5121]=1,Rr[5126]=4,Rr[36193]=2;var Dr=33189,Br=36168,Fr=34041,Gr=[32854,32855,36194,35907,34842,34843,34836],Ur={};Ur[jr]="complete",Ur[36054]="incomplete attachment",Ur[36057]="incomplete dimensions",Ur[36055]="incomplete, missing attachment",Ur[36061]="unsupported";var zr=5126,Vr=34962;function Hr(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=zr,this.offset=0,this.stride=0,this.divisor=0}var qr=35632,Wr=35633,Yr=35718,Xr=35721;function Jr(t,r,n,o){var i={},a={};function s(t,e,r,n){this.name=t,this.id=e,this.location=r,this.info=n}function u(t,e){for(var r=0;r1)for(var g=0;gt&&(t=e.stats.uniformsCount)}),t},n.getMaxAttributesCount=function(){var t=0;return f.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);st(i).forEach(e),i={},st(a).forEach(e),a={},f.forEach(function(e){t.deleteProgram(e.program)}),f.length=0,c={},n.shaderCount=0},program:function(r,s,u,l){N.command(r>=0,"missing vertex shader",u),N.command(s>=0,"missing fragment shader",u);var d=c[s];d||(d=c[s]={});var y=d[r];if(y&&(y.refCount++,!l))return y;var v=new function(t,e){this.id=h++,this.fragId=t,this.vertId=e,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,o.profile&&(this.stats={uniformsCount:0,attributesCount:0})}(s,r);return n.shaderCount++,p(v,u,l),y||(d[r]=v),f.push(v),e(v,{destroy:function(){if(v.refCount--,v.refCount<=0){t.deleteProgram(v.program);var e=f.indexOf(v);f.splice(e,1),n.shaderCount--}d[v.vertId].refCount<=0&&(t.deleteShader(a[v.vertId]),delete a[v.vertId],delete c[v.fragId][v.vertId]),Object.keys(c[v.fragId]).length||(t.deleteShader(i[v.fragId]),delete i[v.fragId],delete c[v.fragId])}})},restore:function(){i={},a={};for(var t=0;t=0&&c=0&&f0&&h+c<=o.framebufferWidth,"invalid width for read pixels"),N(p>0&&p+f<=o.framebufferHeight,"invalid height for read pixels"),n();var y=h*p*4;return d||(l===Qr?d=new Uint8Array(y):l===$r&&(d=d||new Float32Array(y))),N.isTypedArray(d,"data buffer for regl.read() must be a typedarray"),N(d.byteLength>=y,"data buffer for regl.read() too small"),e.pixelStorei(Zr,4),e.readPixels(c,f,h,p,Kr,l,d),d}return function(t){return t&&"framebuffer"in t?function(t){var e;return r.setFBO({framebuffer:t.framebuffer},function(){e=u(t)}),e}(t):u(t)}}function en(t){return Array.prototype.slice.call(t)}function rn(t){return en(t).join("")}var nn="xyzw".split(""),on=5121,an=1,sn=2,un=0,ln=1,cn=2,fn=3,hn=4,pn=5,dn=6,yn="dither",vn="blend.enable",gn="blend.color",mn="blend.equation",bn="blend.func",wn="depth.enable",Sn="depth.func",xn="depth.range",_n="depth.mask",En="colorMask",On="cull.enable",Pn="cull.face",kn="frontFace",Cn="lineWidth",Tn="polygonOffset.enable",An="polygonOffset.offset",Mn="sample.alpha",jn="sample.enable",In="sample.coverage",Nn="stencil.enable",Ln="stencil.mask",Rn="stencil.func",Dn="stencil.opFront",Bn="stencil.opBack",Fn="scissor.enable",Gn="scissor.box",Un="viewport",zn="profile",Vn="framebuffer",Hn="vert",qn="frag",Wn="elements",Yn="primitive",Xn="count",Jn="offset",Kn="instances",Qn="vao",Zn=Vn+"Width",$n=Vn+"Height",to=Un+"Width",eo=Un+"Height",ro="drawingBufferWidth",no="drawingBufferHeight",oo=[bn,mn,Rn,Dn,Bn,In,Un,Gn,An],io=34962,ao=34963,so=3553,uo=34067,lo=2884,co=3042,fo=3024,ho=2960,po=2929,yo=3089,vo=32823,go=32926,mo=32928,bo=5126,wo=35664,So=35665,xo=35666,_o=5124,Eo=35667,Oo=35668,Po=35669,ko=35670,Co=35671,To=35672,Ao=35673,Mo=35674,jo=35675,Io=35676,No=35678,Lo=35680,Ro=4,Do=1028,Bo=1029,Fo=2304,Go=2305,Uo=32775,zo=32776,Vo=519,Ho=7680,qo=0,Wo=1,Yo=32774,Xo=513,Jo=36160,Ko=36064,Qo={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Zo=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],$o={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},ti={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},ei={frag:35632,vert:35633},ri={cw:Fo,ccw:Go};function ni(e){return Array.isArray(e)||t(e)||at(e)}function oi(t){return t.sort(function(t,e){return t===Un?-1:e===Un?1:t=1,n>=2,e)}if(r===hn){var o=t.data;return new ii(o.thisDep,o.contextDep,o.propDep,e)}if(r===pn)return new ii(!1,!1,!1,e);if(r===dn){for(var i=!1,a=!1,s=!1,u=0;u=1&&(a=!0),c>=2&&(s=!0)}else l.type===hn&&(i=i||l.data.thisDep,a=a||l.data.contextDep,s=s||l.data.propDep)}return new ii(i,a,s,e)}return new ii(r===fn,r===cn,r===ln,e)}var li=new ii(!1,!1,!1,function(){});function ci(t,r,n,o,i,s,u,l,c,f,h,p,d,y,v){var g=f.Record,m={add:32774,subtract:32778,"reverse subtract":32779};n.ext_blend_minmax&&(m.min=Uo,m.max=zo);var b=n.angle_instanced_arrays,w=n.webgl_draw_buffers,S={dirty:!0,profile:v.profile},x={},_=[],E={},O={};function P(t){return t.replace(".","_")}function k(t,e,r){var n=P(t);_.push(t),x[n]=S[n]=!!r,E[n]=e}function C(t,e,r){var n=P(t);_.push(t),Array.isArray(r)?(S[n]=r.slice(),x[n]=r.slice()):S[n]=x[n]=r,O[n]=e}k(yn,fo),k(vn,co),C(gn,"blendColor",[0,0,0,0]),C(mn,"blendEquationSeparate",[Yo,Yo]),C(bn,"blendFuncSeparate",[Wo,qo,Wo,qo]),k(wn,po,!0),C(Sn,"depthFunc",Xo),C(xn,"depthRange",[0,1]),C(_n,"depthMask",!0),C(En,En,[!0,!0,!0,!0]),k(On,lo),C(Pn,"cullFace",Bo),C(kn,kn,Go),C(Cn,Cn,1),k(Tn,vo),C(An,"polygonOffset",[0,0]),k(Mn,go),k(jn,mo),C(In,"sampleCoverage",[1,!1]),k(Nn,ho),C(Ln,"stencilMask",-1),C(Rn,"stencilFunc",[Vo,0,-1]),C(Dn,"stencilOpSeparate",[Do,Ho,Ho,Ho]),C(Bn,"stencilOpSeparate",[Bo,Ho,Ho,Ho]),k(Fn,yo),C(Gn,"scissor",[0,0,t.drawingBufferWidth,t.drawingBufferHeight]),C(Un,Un,[0,0,t.drawingBufferWidth,t.drawingBufferHeight]);var T={gl:t,context:d,strings:r,next:x,current:S,draw:p,elements:s,buffer:i,shader:h,attributes:f.state,vao:f,uniforms:c,framebuffer:l,extensions:n,timer:y,isBufferArgs:ni},A={primTypes:_t,compareFuncs:$o,blendFuncs:Qo,blendEquations:m,stencilOps:ti,glTypes:ft,orientationType:ri};N.optional(function(){T.isArrayLike=Gt}),w&&(A.backBuffer=[Bo],A.drawBuffer=X(o.maxDrawbuffers,function(t){return 0===t?[0]:X(t,function(t){return Ko+t})}));var M=0;function j(){var t=function(){var t=0,r=[],n=[];function o(){var r=[],n=[];return e(function(){r.push.apply(r,en(arguments))},{def:function(){var e="v"+t++;return n.push(e),arguments.length>0&&(r.push(e,"="),r.push.apply(r,en(arguments)),r.push(";")),e},toString:function(){return rn([n.length>0?"var "+n.join(",")+";":"",rn(r)])}})}function i(){var t=o(),r=o(),n=t.toString,i=r.toString;function a(e,n){r(e,n,"=",t.def(e,n),";")}return e(function(){t.apply(t,en(arguments))},{def:t.def,entry:t,exit:r,save:a,set:function(e,r,n){a(e,r),t(e,r,"=",n,";")},toString:function(){return n()+i()}})}var a=o(),s={};return{global:a,link:function(e){for(var o=0;o=0,'unknown parameter "'+e+'"',p.commandStr)})}e(d),e(y)});var v=function(t,e){var r=t.static;if("string"==typeof r[qn]&&"string"==typeof r[Hn]){if(Object.keys(e.dynamic).length>0)return null;var n=e.static,o=Object.keys(n);if(o.length>0&&"number"==typeof n[o[0]]){for(var i=[],a=0;a=0,"invalid "+t,r.commandStr)):u=!1,"height"in i?(s=0|i.height,N.command(s>=0,"invalid "+t,r.commandStr)):u=!1,new ii(!u&&e&&e.thisDep,!u&&e&&e.contextDep,!u&&e&&e.propDep,function(t,e){var r=t.shared.context,n=a;"width"in i||(n=e.def(r,".",Zn,"-",l));var o=s;return"height"in i||(o=e.def(r,".",$n,"-",c)),[l,c,n,o]})}if(t in o){var f=o[t],h=ui(f,function(e,r){var n=e.invoke(r,f);N.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)});var o=e.shared.context,i=r.def(n,".x|0"),a=r.def(n,".y|0"),s=r.def('"width" in ',n,"?",n,".width|0:","(",o,".",Zn,"-",i,")"),u=r.def('"height" in ',n,"?",n,".height|0:","(",o,".",$n,"-",a,")");return N.optional(function(){e.assert(r,s+">=0&&"+u+">=0","invalid "+t)}),[i,a,s,u]});return e&&(h.thisDep=h.thisDep||e.thisDep,h.contextDep=h.contextDep||e.contextDep,h.propDep=h.propDep||e.propDep),h}return e?new ii(e.thisDep,e.contextDep,e.propDep,function(t,e){var r=t.shared.context;return[0,0,e.def(r,".",Zn),e.def(r,".",$n)]}):null}var a=i(Un);if(a){var s=a;a=new ii(a.thisDep,a.contextDep,a.propDep,function(t,e){var r=s.append(t,e),n=t.shared.context;return e.set(n,"."+to,r[2]),e.set(n,"."+eo,r[3]),r})}return{viewport:a,scissor_box:i(Gn)}}(t,w,p),x=function(t,e){var r=t.static,n=t.dynamic,o=function(){if(Wn in r){var t=r[Wn];ni(t)?t=s.getElements(s.create(t,!0)):t&&(t=s.getElements(t),N.command(t,"invalid elements",e.commandStr));var o=si(function(e,r){if(t){var n=e.link(t);return e.ELEMENTS=n,n}return e.ELEMENTS=null,null});return o.value=t,o}if(Wn in n){var i=n[Wn];return ui(i,function(t,e){var r=t.shared,n=r.isBufferArgs,o=r.elements,a=t.invoke(e,i),s=e.def("null"),u=e.def(n,"(",a,")"),l=t.cond(u).then(s,"=",o,".createStream(",a,");").else(s,"=",o,".getElements(",a,");");return N.optional(function(){t.assert(l.else,"!"+a+"||"+s,"invalid elements")}),e.entry(l),e.exit(t.cond(u).then(o,".destroyStream(",s,");")),t.ELEMENTS=s,s})}return null}();function i(t,i){if(t in r){var a=0|r[t];return N.command(!i||a>=0,"invalid "+t,e.commandStr),si(function(t,e){return i&&(t.OFFSET=a),a})}if(t in n){var s=n[t];return ui(s,function(e,r){var n=e.invoke(r,s);return i&&(e.OFFSET=n,N.optional(function(){e.assert(r,n+">=0","invalid "+t)})),n})}return i&&o?si(function(t,e){return t.OFFSET="0",0}):null}var a=i(Jn,!0);return{elements:o,primitive:function(){if(Yn in r){var t=r[Yn];return N.commandParameter(t,_t,"invalid primitve",e.commandStr),si(function(e,r){return _t[t]})}if(Yn in n){var i=n[Yn];return ui(i,function(t,e){var r=t.constants.primTypes,n=t.invoke(e,i);return N.optional(function(){t.assert(e,n+" in "+r,"invalid primitive, must be one of "+Object.keys(_t))}),e.def(r,"[",n,"]")})}return o?ai(o)?o.value?si(function(t,e){return e.def(t.ELEMENTS,".primType")}):si(function(){return Ro}):new ii(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=t.ELEMENTS;return e.def(r,"?",r,".primType:",Ro)}):null}(),count:function(){if(Xn in r){var t=0|r[Xn];return N.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),si(function(){return t})}if(Xn in n){var i=n[Xn];return ui(i,function(t,e){var r=t.invoke(e,i);return N.optional(function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">=0&&"+r+"===("+r+"|0)","invalid vertex count")}),r})}if(o){if(ai(o)){if(o)return a?new ii(a.thisDep,a.contextDep,a.propDep,function(t,e){var r=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return N.optional(function(){t.assert(e,r+">=0","invalid vertex offset/element buffer too small")}),r}):si(function(t,e){return e.def(t.ELEMENTS,".vertCount")});var s=si(function(){return-1});return N.optional(function(){s.MISSING=!0}),s}var u=new ii(o.thisDep||a.thisDep,o.contextDep||a.contextDep,o.propDep||a.propDep,function(t,e){var r=t.ELEMENTS;return t.OFFSET?e.def(r,"?",r,".vertCount-",t.OFFSET,":-1"):e.def(r,"?",r,".vertCount:-1")});return N.optional(function(){u.DYNAMIC=!0}),u}return null}(),instances:i(Kn,!1),offset:a}}(t,p),E=function(t,e){var r=t.static,n=t.dynamic,i={};return _.forEach(function(t){var s=P(t);function u(e,o){if(t in r){var a=e(r[t]);i[s]=si(function(){return a})}else if(t in n){var u=n[t];i[s]=ui(u,function(t,e){return o(t,e,t.invoke(e,u))})}}switch(t){case On:case vn:case yn:case Nn:case wn:case Fn:case Tn:case Mn:case jn:case _n:return u(function(r){return N.commandType(r,"boolean",t,e.commandStr),r},function(e,r,n){return N.optional(function(){e.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+t,e.commandStr)}),n});case Sn:return u(function(r){return N.commandParameter(r,$o,"invalid "+t,e.commandStr),$o[r]},function(e,r,n){var o=e.constants.compareFuncs;return N.optional(function(){e.assert(r,n+" in "+o,"invalid "+t+", must be one of "+Object.keys($o))}),r.def(o,"[",n,"]")});case xn:return u(function(t){return N.command(Gt(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t},function(t,e,r){return N.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[e.def("+",r,"[0]"),e.def("+",r,"[1]")]});case bn:return u(function(t){N.commandType(t,"object","blend.func",e.commandStr);var r="srcRGB"in t?t.srcRGB:t.src,n="srcAlpha"in t?t.srcAlpha:t.src,o="dstRGB"in t?t.dstRGB:t.dst,i="dstAlpha"in t?t.dstAlpha:t.dst;return N.commandParameter(r,Qo,s+".srcRGB",e.commandStr),N.commandParameter(n,Qo,s+".srcAlpha",e.commandStr),N.commandParameter(o,Qo,s+".dstRGB",e.commandStr),N.commandParameter(i,Qo,s+".dstAlpha",e.commandStr),N.command(-1===Zo.indexOf(r+", "+o),"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+o+")",e.commandStr),[Qo[r],Qo[o],Qo[n],Qo[i]]},function(e,r,n){var o=e.constants.blendFuncs;function i(i,a){var s=r.def('"',i,a,'" in ',n,"?",n,".",i,a,":",n,".",i);return N.optional(function(){e.assert(r,s+" in "+o,"invalid "+t+"."+i+a+", must be one of "+Object.keys(Qo))}),s}N.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var a=i("src","RGB"),s=i("dst","RGB");N.optional(function(){var t=e.constants.invalidBlendCombinations;e.assert(r,t+".indexOf("+a+'+", "+'+s+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var u=r.def(o,"[",a,"]"),l=r.def(o,"[",i("src","Alpha"),"]");return[u,r.def(o,"[",s,"]"),l,r.def(o,"[",i("dst","Alpha"),"]")]});case mn:return u(function(r){return"string"==typeof r?(N.commandParameter(r,m,"invalid "+t,e.commandStr),[m[r],m[r]]):"object"===a(r)?(N.commandParameter(r.rgb,m,t+".rgb",e.commandStr),N.commandParameter(r.alpha,m,t+".alpha",e.commandStr),[m[r.rgb],m[r.alpha]]):void N.commandRaise("invalid blend.equation",e.commandStr)},function(e,r,n){var o=e.constants.blendEquations,i=r.def(),a=r.def(),s=e.cond("typeof ",n,'==="string"');return N.optional(function(){function r(t,r,n){e.assert(t,n+" in "+o,"invalid "+r+", must be one of "+Object.keys(m))}r(s.then,t,n),e.assert(s.else,n+"&&typeof "+n+'==="object"',"invalid "+t),r(s.else,t+".rgb",n+".rgb"),r(s.else,t+".alpha",n+".alpha")}),s.then(i,"=",a,"=",o,"[",n,"];"),s.else(i,"=",o,"[",n,".rgb];",a,"=",o,"[",n,".alpha];"),r(s),[i,a]});case gn:return u(function(t){return N.command(Gt(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),X(4,function(e){return+t[e]})},function(t,e,r){return N.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),X(4,function(t){return e.def("+",r,"[",t,"]")})});case Ln:return u(function(t){return N.commandType(t,"number",s,e.commandStr),0|t},function(t,e,r){return N.optional(function(){t.assert(e,"typeof "+r+'==="number"',"invalid stencil.mask")}),e.def(r,"|0")});case Rn:return u(function(r){N.commandType(r,"object",s,e.commandStr);var n=r.cmp||"keep",o=r.ref||0,i="mask"in r?r.mask:-1;return N.commandParameter(n,$o,t+".cmp",e.commandStr),N.commandType(o,"number",t+".ref",e.commandStr),N.commandType(i,"number",t+".mask",e.commandStr),[$o[n],o,i]},function(t,e,r){var n=t.constants.compareFuncs;return N.optional(function(){function o(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}o(r+"&&typeof ",r,'==="object"'),o('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[e.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Ho),e.def(r,".ref|0"),e.def('"mask" in ',r,"?",r,".mask|0:-1")]});case Dn:case Bn:return u(function(r){N.commandType(r,"object",s,e.commandStr);var n=r.fail||"keep",o=r.zfail||"keep",i=r.zpass||"keep";return N.commandParameter(n,ti,t+".fail",e.commandStr),N.commandParameter(o,ti,t+".zfail",e.commandStr),N.commandParameter(i,ti,t+".zpass",e.commandStr),[t===Bn?Bo:Do,ti[n],ti[o],ti[i]]},function(e,r,n){var o=e.constants.stencilOps;function i(i){return N.optional(function(){e.assert(r,'!("'+i+'" in '+n+")||("+n+"."+i+" in "+o+")","invalid "+t+"."+i+", must be one of "+Object.keys(ti))}),r.def('"',i,'" in ',n,"?",o,"[",n,".",i,"]:",Ho)}return N.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[t===Bn?Bo:Do,i("fail"),i("zfail"),i("zpass")]});case An:return u(function(t){N.commandType(t,"object",s,e.commandStr);var r=0|t.factor,n=0|t.units;return N.commandType(r,"number",s+".factor",e.commandStr),N.commandType(n,"number",s+".units",e.commandStr),[r,n]},function(e,r,n){return N.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case Pn:return u(function(t){var r=0;return"front"===t?r=Do:"back"===t&&(r=Bo),N.command(!!r,s,e.commandStr),r},function(t,e,r){return N.optional(function(){t.assert(e,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),e.def(r,'==="front"?',Do,":",Bo)});case Cn:return u(function(t){return N.command("number"==typeof t&&t>=o.lineWidthDims[0]&&t<=o.lineWidthDims[1],"invalid line width, must be a positive number between "+o.lineWidthDims[0]+" and "+o.lineWidthDims[1],e.commandStr),t},function(t,e,r){return N.optional(function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">="+o.lineWidthDims[0]+"&&"+r+"<="+o.lineWidthDims[1],"invalid line width")}),r});case kn:return u(function(t){return N.commandParameter(t,ri,s,e.commandStr),ri[t]},function(t,e,r){return N.optional(function(){t.assert(e,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),e.def(r+'==="cw"?'+Fo+":"+Go)});case En:return u(function(t){return N.command(Gt(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map(function(t){return!!t})},function(t,e,r){return N.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),X(4,function(t){return"!!"+r+"["+t+"]"})});case In:return u(function(t){N.command("object"===a(t)&&t,s,e.commandStr);var r="value"in t?t.value:1,n=!!t.invert;return N.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[r,n]},function(t,e,r){return N.optional(function(){t.assert(e,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[e.def('"value" in ',r,"?+",r,".value:1"),e.def("!!",r,".invert")]})}}),i}(t,p),O=function(t,e,n){var o=t.static,i=t.dynamic;function a(t){if(t in o){var e=r.id(o[t]);N.optional(function(){h.shader(ei[t],e,N.guessCommand())});var n=si(function(){return e});return n.id=e,n}if(t in i){var a=i[t];return ui(a,function(e,r){var n=e.invoke(r,a),o=r.def(e.shared.strings,".id(",n,")");return N.optional(function(){r(e.shared.shader,".shader(",ei[t],",",o,",",e.command,");")}),o})}return null}var s,u=a(qn),l=a(Hn),c=null;return ai(u)&&ai(l)?(c=h.program(l.id,u.id,null,n),s=si(function(t,e){return t.link(c)})):s=new ii(u&&u.thisDep||l&&l.thisDep,u&&u.contextDep||l&&l.contextDep,u&&u.propDep||l&&l.propDep,function(t,e){var r,n=t.shared.shader;r=u?u.append(t,e):e.def(n,".",qn);var o=n+".program("+(l?l.append(t,e):e.def(n,".",Hn))+","+r;return N.optional(function(){o+=","+t.command}),e.def(o+")")}),{frag:u,vert:l,progVar:s,program:c}}(t,0,v);function k(t){var e=S[t];e&&(E[t]=e)}k(Un),k(P(Gn));var C=Object.keys(E).length>0,T={framebuffer:w,draw:x,shader:O,state:E,dirty:C,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(T.profile=function(t){var e,r=t.static,n=t.dynamic;if(zn in r){var o=!!r[zn];(e=si(function(t,e){return o})).enable=o}else if(zn in n){var i=n[zn];e=ui(i,function(t,e){return t.invoke(e,i)})}return e}(t),T.uniforms=function(t,e){var r=t.static,n=t.dynamic,o={};return Object.keys(r).forEach(function(t){var n,i=r[t];if("number"==typeof i||"boolean"==typeof i)n=si(function(){return i});else if("function"==typeof i){var a=i._reglType;"texture2d"===a||"textureCube"===a?n=si(function(t){return t.link(i)}):"framebuffer"===a||"framebufferCube"===a?(N.command(i.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),n=si(function(t){return t.link(i.color[0])})):N.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else Gt(i)?n=si(function(e){return e.global.def("[",X(i.length,function(r){return N.command("number"==typeof i[r]||"boolean"==typeof i[r],"invalid uniform "+t,e.commandStr),i[r]}),"]")}):N.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);n.value=i,o[t]=n}),Object.keys(n).forEach(function(t){var e=n[t];o[t]=ui(e,function(t,r){return t.invoke(r,e)})}),o}(u,p),T.drawVAO=T.scopeVAO=function(t,e){var r=t.static,n=t.dynamic;if(Qn in r){var o=r[Qn];return null!==o&&null===f.getVAO(o)&&(o=f.createVAO(o)),si(function(t){return t.link(f.getVAO(o))})}if(Qn in n){var i=n[Qn];return ui(i,function(t,e){var r=t.invoke(e,i);return e.def(t.shared.vao+".getVAO("+r+")")})}return null}(t),!T.drawVAO&&O.program&&!v&&n.angle_instanced_arrays){var A=!0,M=O.program.attributes.map(function(t){var r=e.static[t];return A=A&&!!r,r});if(A&&M.length>0){var j=f.getVAO(f.createVAO(M));T.drawVAO=new ii(null,null,null,function(t,e){return t.link(j)}),T.useVAO=!0}}return v?T.useVAO=!0:T.attributes=function(t,e){var n=t.static,o=t.dynamic,s={};return Object.keys(n).forEach(function(t){var o=n[t],u=r.id(t),l=new g;if(ni(o))l.state=an,l.buffer=i.getBuffer(i.create(o,io,!1,!0)),l.type=0;else{var c=i.getBuffer(o);if(c)l.state=an,l.buffer=c,l.type=0;else if(N.command("object"===a(o)&&o,"invalid data for attribute "+t,e.commandStr),"constant"in o){var f=o.constant;l.buffer="null",l.state=sn,"number"==typeof f?l.x=f:(N.command(Gt(f)&&f.length>0&&f.length<=4,"invalid constant for attribute "+t,e.commandStr),nn.forEach(function(t,e){e=0,'invalid offset for attribute "'+t+'"',e.commandStr);var p=0|o.stride;N.command(p>=0&&p<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',e.commandStr);var d=0|o.size;N.command(!("size"in o)||d>0&&d<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',e.commandStr);var y=!!o.normalized,v=0;"type"in o&&(N.commandParameter(o.type,ft,"invalid type for attribute "+t,e.commandStr),v=ft[o.type]);var m=0|o.divisor;"divisor"in o&&(N.command(0===m||b,'cannot specify divisor for attribute "'+t+'", instancing not supported',e.commandStr),N.command(m>=0,'invalid divisor for attribute "'+t+'"',e.commandStr)),N.optional(function(){var r=e.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(o).forEach(function(e){N.command(n.indexOf(e)>=0,'unknown parameter "'+e+'" for attribute pointer "'+t+'" (valid parameters are '+n+")",r)})}),l.buffer=c,l.state=an,l.size=d,l.normalized=y,l.type=v||c.dtype,l.offset=h,l.stride=p,l.divisor=m}}s[t]=si(function(t,e){var r=t.attribCache;if(u in r)return r[u];var n={isStream:!1};return Object.keys(l).forEach(function(t){n[t]=l[t]}),l.buffer&&(n.buffer=t.link(l.buffer),n.type=n.type||n.buffer+".dtype"),r[u]=n,n})}),Object.keys(o).forEach(function(t){var e=o[t];s[t]=ui(e,function(r,n){var o=r.invoke(n,e),i=r.shared,a=r.constants,s=i.isBufferArgs,u=i.buffer;N.optional(function(){r.assert(n,o+"&&(typeof "+o+'==="object"||typeof '+o+'==="function")&&('+s+"("+o+")||"+u+".getBuffer("+o+")||"+u+".getBuffer("+o+".buffer)||"+s+"("+o+'.buffer)||("constant" in '+o+"&&(typeof "+o+'.constant==="number"||'+i.isArrayLike+"("+o+".constant))))",'invalid dynamic attribute "'+t+'"')});var l={isStream:n.def(!1)},c=new g;c.state=an,Object.keys(c).forEach(function(t){l[t]=n.def(""+c[t])});var f=l.buffer,h=l.type;function p(t){n(l[t],"=",o,".",t,"|0;")}return n("if(",s,"(",o,")){",l.isStream,"=true;",f,"=",u,".createStream(",io,",",o,");",h,"=",f,".dtype;","}else{",f,"=",u,".getBuffer(",o,");","if(",f,"){",h,"=",f,".dtype;",'}else if("constant" in ',o,"){",l.state,"=",sn,";","if(typeof "+o+'.constant === "number"){',l[nn[0]],"=",o,".constant;",nn.slice(1).map(function(t){return l[t]}).join("="),"=0;","}else{",nn.map(function(t,e){return l[t]+"="+o+".constant.length>"+e+"?"+o+".constant["+e+"]:0;"}).join(""),"}}else{","if(",s,"(",o,".buffer)){",f,"=",u,".createStream(",io,",",o,".buffer);","}else{",f,"=",u,".getBuffer(",o,".buffer);","}",h,'="type" in ',o,"?",a.glTypes,"[",o,".type]:",f,".dtype;",l.normalized,"=!!",o,".normalized;"),p("size"),p("offset"),p("stride"),p("divisor"),n("}}"),n.exit("if(",l.isStream,"){",u,".destroyStream(",f,");","}"),l})}),s}(e,p),T.context=function(t){var e=t.static,r=t.dynamic,n={};return Object.keys(e).forEach(function(t){var r=e[t];n[t]=si(function(t,e){return"number"==typeof r||"boolean"==typeof r?""+r:t.link(r)})}),Object.keys(r).forEach(function(t){var e=r[t];n[t]=ui(e,function(t,r){return t.invoke(r,e)})}),n}(c),T}function L(t,e,r){var n=t.shared.context,o=t.scope();Object.keys(r).forEach(function(i){e.save(n,"."+i);var a=r[i].append(t,e);Array.isArray(a)?o(n,".",i,"=[",a.join(),"];"):o(n,".",i,"=",a,";")}),e(o)}function R(t,e,r,n){var o,i=t.shared,a=i.gl,s=i.framebuffer;w&&(o=e.def(i.extensions,".webgl_draw_buffers"));var u,l=t.constants,c=l.drawBuffer,f=l.backBuffer;u=r?r.append(t,e):e.def(s,".next"),n||e("if(",u,"!==",s,".cur){"),e("if(",u,"){",a,".bindFramebuffer(",Jo,",",u,".framebuffer);"),w&&e(o,".drawBuffersWEBGL(",c,"[",u,".colorAttachments.length]);"),e("}else{",a,".bindFramebuffer(",Jo,",null);"),w&&e(o,".drawBuffersWEBGL(",f,");"),e("}",s,".cur=",u,";"),n||e("}")}function D(t,e,r){var n=t.shared,o=n.gl,i=t.current,a=t.next,s=n.current,u=n.next,l=t.cond(s,".dirty");_.forEach(function(e){var n,c,f=P(e);if(!(f in r.state))if(f in a){n=a[f],c=i[f];var h=X(S[f].length,function(t){return l.def(n,"[",t,"]")});l(t.cond(h.map(function(t,e){return t+"!=="+c+"["+e+"]"}).join("||")).then(o,".",O[f],"(",h,");",h.map(function(t,e){return c+"["+e+"]="+t}).join(";"),";"))}else{n=l.def(u,".",f);var p=t.cond(n,"!==",s,".",f);l(p),f in E?p(t.cond(n).then(o,".enable(",E[f],");").else(o,".disable(",E[f],");"),s,".",f,"=",n,";"):p(o,".",O[f],"(",n,");",s,".",f,"=",n,";")}}),0===Object.keys(r.state).length&&l(s,".dirty=false;"),e(l)}function B(t,e,r,n){var o=t.shared,i=t.current,a=o.current,s=o.gl;oi(Object.keys(r)).forEach(function(o){var u=r[o];if(!n||n(u)){var l=u.append(t,e);if(E[o]){var c=E[o];ai(u)?e(s,l?".enable(":".disable(",c,");"):e(t.cond(l).then(s,".enable(",c,");").else(s,".disable(",c,");")),e(a,".",o,"=",l,";")}else if(Gt(l)){var f=i[o];e(s,".",O[o],"(",l,");",l.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";")}else e(s,".",O[o],"(",l,");",a,".",o,"=",l,";")}})}function F(t,e){b&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function G(t,e,r,n,o){var i,a,s,u=t.shared,l=t.stats,c=u.current,f=u.timer,h=r.profile;function p(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function d(t){t(i=e.def(),"=",p(),";"),"string"==typeof o?t(l,".count+=",o,";"):t(l,".count++;"),y&&(n?t(a=e.def(),"=",f,".getNumPendingQueries();"):t(f,".beginQuery(",l,");"))}function v(t){t(l,".cpuTime+=",p(),"-",i,";"),y&&(n?t(f,".pushScopeStats(",a,",",f,".getNumPendingQueries(),",l,");"):t(f,".endQuery();"))}function g(t){var r=e.def(c,".profile");e(c,".profile=",t,";"),e.exit(c,".profile=",r,";")}if(h){if(ai(h))return void(h.enable?(d(e),v(e.exit),g("true")):g("false"));g(s=h.append(t,e))}else s=e.def(c,".profile");var m=t.block();d(m),e("if(",s,"){",m,"}");var b=t.block();v(b),e.exit("if(",s,"){",b,"}")}function U(t,e,r,n,o){var i=t.shared;n.forEach(function(n){var a,s=n.name,u=r.attributes[s];if(u){if(!o(u))return;a=u.append(t,e)}else{if(!o(li))return;var l=t.scopeAttrib(s);N.optional(function(){t.assert(e,l+".state","missing attribute "+s)}),a={},Object.keys(new g).forEach(function(t){a[t]=e.def(l,".",t)})}!function(r,n,o){var a=i.gl,s=e.def(r,".location"),u=e.def(i.attributes,"[",s,"]"),l=o.state,c=o.buffer,f=[o.x,o.y,o.z,o.w],h=["buffer","normalized","offset","stride"];function p(){e("if(!",u,".buffer){",a,".enableVertexAttribArray(",s,");}");var r,i=o.type;if(r=o.size?e.def(o.size,"||",n):n,e("if(",u,".type!==",i,"||",u,".size!==",r,"||",h.map(function(t){return u+"."+t+"!=="+o[t]}).join("||"),"){",a,".bindBuffer(",io,",",c,".buffer);",a,".vertexAttribPointer(",[s,r,i,o.normalized,o.stride,o.offset],");",u,".type=",i,";",u,".size=",r,";",h.map(function(t){return u+"."+t+"="+o[t]+";"}).join(""),"}"),b){var l=o.divisor;e("if(",u,".divisor!==",l,"){",t.instancing,".vertexAttribDivisorANGLE(",[s,l],");",u,".divisor=",l,";}")}}function d(){e("if(",u,".buffer){",a,".disableVertexAttribArray(",s,");",u,".buffer=null;","}if(",nn.map(function(t,e){return u+"."+t+"!=="+f[e]}).join("||"),"){",a,".vertexAttrib4f(",s,",",f,");",nn.map(function(t,e){return u+"."+t+"="+f[e]+";"}).join(""),"}")}l===an?p():l===sn?d():(e("if(",l,"===",an,"){"),p(),e("}else{"),d(),e("}"))}(t.link(n),function(t){switch(t){case wo:case Eo:case Co:return 2;case So:case Oo:case To:return 3;case xo:case Po:case Ao:return 4;default:return 1}}(n.info.type),a)})}function V(t,e,n,o,i){for(var a,s=t.shared,u=s.gl,l=0;l1?e(X(w,function(t){return Array.isArray(c)?c[t]:c+"["+t+"]"})):(N(!Array.isArray(c),"uniform value must not be an array"),e(c));e(");")}}function H(t,e,r,n){var o=t.shared,i=o.gl,a=o.draw,s=n.draw;var u=function(){var o,u=s.elements,l=e;return u?((u.contextDep&&n.contextDynamic||u.propDep)&&(l=r),o=u.append(t,l)):o=l.def(a,".",Wn),o&&l("if("+o+")"+i+".bindBuffer("+ao+","+o+".buffer.buffer);"),o}();function l(o){var i=s[o];return i?i.contextDep&&n.contextDynamic||i.propDep?i.append(t,r):i.append(t,e):e.def(a,".",o)}var c,f,h=l(Yn),p=l(Jn),d=function(){var o,i=s.count,u=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(u=r),o=i.append(t,u),N.optional(function(){i.MISSING&&t.assert(e,"false","missing vertex count"),i.DYNAMIC&&t.assert(u,o+">=0","missing vertex count")})):(o=u.def(a,".",Xn),N.optional(function(){t.assert(u,o+">=0","missing vertex count")})),o}();if("number"==typeof d){if(0===d)return}else r("if(",d,"){"),r.exit("}");b&&(c=l(Kn),f=t.instancing);var y=u+".type",v=s.elements&&ai(s.elements);function g(){function t(){r(f,".drawElementsInstancedANGLE(",[h,d,y,p+"<<(("+y+"-"+on+")>>1)",c],");")}function e(){r(f,".drawArraysInstancedANGLE(",[h,p,d,c],");")}u?v?t():(r("if(",u,"){"),t(),r("}else{"),e(),r("}")):e()}function m(){function t(){r(i+".drawElements("+[h,d,y,p+"<<(("+y+"-"+on+")>>1)"]+");")}function e(){r(i+".drawArrays("+[h,p,d]+");")}u?v?t():(r("if(",u,"){"),t(),r("}else{"),e(),r("}")):e()}b&&("number"!=typeof c||c>=0)?"string"==typeof c?(r("if(",c,">0){"),g(),r("}else if(",c,"<0){"),m(),r("}")):g():m()}function q(t,e,r,n,o){var i=j(),a=i.proc("body",o);return N.optional(function(){i.commandStr=e.commandStr,i.command=i.link(e.commandStr)}),b&&(i.instancing=a.def(i.shared.extensions,".angle_instanced_arrays")),t(i,a,r,n),i.compile().body}function W(t,e,r,n){F(t,e),r.useVAO?r.drawVAO?e(t.shared.vao,".setVAO(",r.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),U(t,e,r,n.attributes,function(){return!0})),V(t,e,r,n.uniforms,function(){return!0}),H(t,e,e,r)}function Y(t,e,r,n){function o(){return!0}t.batchId="a1",F(t,e),U(t,e,r,n.attributes,o),V(t,e,r,n.uniforms,o),H(t,e,e,r)}function J(t,e,r,n){F(t,e);var o=r.contextDep,i=e.def(),a=e.def();t.shared.props=a,t.batchId=i;var s=t.scope(),u=t.scope();function l(t){return t.contextDep&&o||t.propDep}function c(t){return!l(t)}if(e(s.entry,"for(",i,"=0;",i,"<","a1",";++",i,"){",a,"=","a0","[",i,"];",u,"}",s.exit),r.needsContext&&L(t,u,r.context),r.needsFramebuffer&&R(t,u,r.framebuffer),B(t,u,r.state,l),r.profile&&l(r.profile)&&G(t,u,r,!1,!0),n)r.useVAO?r.drawVAO?l(r.drawVAO)?u(t.shared.vao,".setVAO(",r.drawVAO.append(t,u),");"):s(t.shared.vao,".setVAO(",r.drawVAO.append(t,s),");"):s(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(s(t.shared.vao,".setVAO(null);"),U(t,s,r,n.attributes,c),U(t,u,r,n.attributes,l)),V(t,s,r,n.uniforms,c),V(t,u,r,n.uniforms,l),H(t,s,u,r);else{var f=t.global.def("{}"),h=r.shader.progVar.append(t,u),p=u.def(h,".id"),d=u.def(f,"[",p,"]");u(t.shared.gl,".useProgram(",h,".program);","if(!",d,"){",d,"=",f,"[",p,"]=",t.link(function(e){return q(Y,t,r,e,2)}),"(",h,");}",d,".call(this,a0[",i,"],",i,");")}}function K(t,e,r){var n=e.static[r];if(n&&function(t){if("object"===a(t)&&!Gt(t)){for(var e=Object.keys(t),r=0;r0&&r(t.shared.current,".dirty=true;")}(s,u),function(t,e){var n=t.proc("scope",3);t.batchId="a2";var o=t.shared,i=o.current;function a(r){var i=e.shader[r];i&&n.set(o.shader,"."+r,i.append(t,n))}L(t,n,e.context),e.framebuffer&&e.framebuffer.append(t,n),oi(Object.keys(e.state)).forEach(function(r){var i=e.state[r].append(t,n);Gt(i)?i.forEach(function(e,o){n.set(t.next[r],"["+o+"]",e)}):n.set(o.next,"."+r,i)}),G(t,n,e,!0,!0),[Wn,Jn,Xn,Kn,Yn].forEach(function(r){var i=e.draw[r];i&&n.set(o.draw,"."+r,""+i.append(t,n))}),Object.keys(e.uniforms).forEach(function(i){var a=e.uniforms[i].append(t,n);Array.isArray(a)&&(a="["+a.join()+"]"),n.set(o.uniforms,"["+r.id(i)+"]",a)}),Object.keys(e.attributes).forEach(function(r){var o=e.attributes[r].append(t,n),i=t.scopeAttrib(r);Object.keys(new g).forEach(function(t){n.set(i,"."+t,o[t])})}),e.scopeVAO&&n.set(o.vao,".targetVAO",e.scopeVAO.append(t,n)),a(Hn),a(qn),Object.keys(e.state).length>0&&(n(i,".dirty=true;"),n.exit(i,".dirty=true;")),n("a1(",t.shared.context,",a0,",t.batchId,");")}(s,u),function(t,e){var r=t.proc("batch",2);t.batchId="0",F(t,r);var n=!1,o=!0;Object.keys(e.context).forEach(function(t){n=n||e.context[t].propDep}),n||(L(t,r,e.context),o=!1);var i=e.framebuffer,a=!1;function s(t){return t.contextDep&&n||t.propDep}i?(i.propDep?n=a=!0:i.contextDep&&n&&(a=!0),a||R(t,r,i)):R(t,r,null),e.state.viewport&&e.state.viewport.propDep&&(n=!0),D(t,r,e),B(t,r,e.state,function(t){return!s(t)}),e.profile&&s(e.profile)||G(t,r,e,!1,"a1"),e.contextDep=n,e.needsContext=o,e.needsFramebuffer=a;var u=e.shader.progVar;if(u.contextDep&&n||u.propDep)J(t,r,e,null);else{var l=u.append(t,r);if(r(t.shared.gl,".useProgram(",l,".program);"),e.shader.program)J(t,r,e,e.shader.program);else{r(t.shared.vao,".setVAO(null);");var c=t.global.def("{}"),f=r.def(l,".id"),h=r.def(c,"[",f,"]");r(t.cond(h).then(h,".call(this,a0,a1);").else(h,"=",c,"[",f,"]=",t.link(function(r){return q(J,t,e,r,2)}),"(",l,");",h,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&r(t.shared.current,".dirty=true;")}(s,u),e(s.compile(),{destroy:function(){u.shader.program.destroy()}})}}}var fi=34918,hi=34919,pi=35007,di=function(t,e){if(!e.ext_disjoint_timer_query)return null;var r=[];function n(t){r.push(t)}var o=[];var i=[];function a(t){i.push(t)}var s=[];function u(t,e,r){var n=i.pop()||new function(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null};n.startQueryIndex=t,n.endQueryIndex=e,n.sum=0,n.stats=r,s.push(n)}var l=[],c=[];return{beginQuery:function(t){var n=r.pop()||e.ext_disjoint_timer_query.createQueryEXT();e.ext_disjoint_timer_query.beginQueryEXT(pi,n),o.push(n),u(o.length-1,o.length,t)},endQuery:function(){e.ext_disjoint_timer_query.endQueryEXT(pi)},pushScopeStats:u,update:function(){var t,r,i=o.length;if(0!==i){c.length=Math.max(c.length,i+1),l.length=Math.max(l.length,i+1),l[0]=0,c[0]=0;var u=0;for(t=0,r=0;r0)if(Array.isArray(r[0])){s=dt(r);for(var c=1,f=1;f0)if("number"==typeof e[0]){var i=ot.allocType(h.dtype,e.length);St(i,e),d(i,o),ot.freeType(i)}else if(Array.isArray(e[0])||t(e[0])){n=dt(e);var a=pt(e,n,h.dtype);d(a,o),ot.freeType(a)}else N.raise("invalid buffer data")}else if(at(e)){n=e.shape;var s=e.stride,u=0,l=0,c=0,f=0;1===n.length?(u=n[0],l=1,c=s[0],f=0):2===n.length?(u=n[0],l=n[1],c=s[0],f=s[1]):N.raise("invalid shape");var y=Array.isArray(e.data)?h.dtype:wt(e.data),v=ot.allocType(y,u*l);xt(v,e.data,u,l,c,f,e.offset),d(v,o),ot.freeType(v)}else N.raise("invalid data for buffer subdata");return p},n.profile&&(p.stats=h.stats),p.destroy=function(){f(h)},p},createStream:function(t,e){var r=u.pop();return r||(r=new s(t)),r.bind(),c(r,e,vt,0,1,!1),r},destroyStream:function(t){u.push(t)},clear:function(){st(a).forEach(f),u.forEach(f)},getBuffer:function(t){return t&&t._buffer instanceof s?t._buffer:null},restore:function(){st(a).forEach(function(t){t.buffer=e.createBuffer(),e.bindBuffer(t.type,t.buffer),e.bufferData(t.type,t.persistentData||t.byteLength,t.usage)})},_initBuffer:c}}(o,h,n,function(t){return S.destroyBuffer(t)}),S=function(e,r,n,o,i){for(var a=n.maxAttributes,s=new Array(a),u=0;u0,"must specify at least one attribute");var o={},u=n.attributes;u.length=e.length;for(var l=0;l=p.byteLength?c.subdata(p):(c.destroy(),n.buffers[l]=null)),n.buffers[l]||(c=n.buffers[l]=i.create(f,Vr,!1,!0)),h.buffer=i.getBuffer(c),h.size=0|h.buffer.dimension,h.normalized=!1,h.type=h.buffer.dtype,h.offset=0,h.stride=0,h.divisor=0,h.state=1,o[l]=1):i.getBuffer(f)?(h.buffer=i.getBuffer(f),h.size=0|h.buffer.dimension,h.normalized=!1,h.type=h.buffer.dtype,h.offset=0,h.stride=0,h.divisor=0,h.state=1):i.getBuffer(f.buffer)?(h.buffer=i.getBuffer(f.buffer),h.size=0|(+f.size||h.buffer.dimension),h.normalized=!!f.normalized||!1,"type"in f?(N.parameter(f.type,ft,"invalid buffer type"),h.type=ft[f.type]):h.type=h.buffer.dtype,h.offset=0|(f.offset||0),h.stride=0|(f.stride||0),h.divisor=0|(f.divisor||0),h.state=1,N(h.size>=1&&h.size<=4,"size must be between 1 and 4"),N(h.offset>=0,"invalid offset"),N(h.stride>=0&&h.stride<=255,"stride must be between 0 and 255"),N(h.divisor>=0,"divisor must be positive"),N(!h.divisor||!!r.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in f?(N(l>0,"first attribute must not be a constant"),h.x=+f.x||0,h.y=+f.y||0,h.z=+f.z||0,h.w=+f.w||0,h.state=2):N(!1,"invalid attribute spec for location "+l)}for(var d=0;d>=1:f===jt&&(p>>=2)),o.vertCount=p;var d=s;if(s<0){d=Pt;var y=o.buffer.dimension;1===y&&(d=Et),2===y&&(d=Ot),3===y&&(d=Pt)}o.primType=d}function f(t){o.elementsCount--,N(null!==t.buffer,"must not double destroy elements"),delete i[t.id],t.buffer.destroy(),t.buffer=null}return{create:function(e,r){var i=n.create(null,It,!0),a=new u(i._buffer);function l(e){if(e)if("number"==typeof e)i(e),a.primType=Pt,a.vertCount=0|e,a.type=Ct;else{var r=null,n=Lt,o=-1,u=-1,f=0,h=0;Array.isArray(e)||t(e)||at(e)?r=e:(N.type(e,"object","invalid arguments for elements"),"data"in e&&(r=e.data,N(Array.isArray(r)||t(r)||at(r),"invalid data for element buffer")),"usage"in e&&(N.parameter(e.usage,ht,"invalid element buffer usage"),n=ht[e.usage]),"primitive"in e&&(N.parameter(e.primitive,_t,"invalid element buffer primitive"),o=_t[e.primitive]),"count"in e&&(N("number"==typeof e.count&&e.count>=0,"invalid vertex count for elements"),u=0|e.count),"type"in e&&(N.parameter(e.type,s,"invalid buffer type"),h=s[e.type]),"length"in e?f=0|e.length:(f=u,h===At||h===Tt?f*=2:h!==jt&&h!==Mt||(f*=4))),c(a,r,n,o,u,f,h)}else i(),a.primType=Pt,a.vertCount=0,a.type=Ct;return l}return o.elementsCount++,l(e),l._reglType="elements",l._elements=a,l.subdata=function(t,e){return i.subdata(t,e),l},l.destroy=function(){f(a)},l},createStream:function(t){var e=l.pop();return e||(e=new u(n.create(null,It,!0,!1)._buffer)),c(e,t,Nt,-1,-1,0,0),e},destroyStream:function(t){l.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof u?t._elements:null},clear:function(){st(i).forEach(f)}}}(o,p,w,h),_=Jr(o,f,h,n),E=mr(o,p,b,function(){k.procs.poll()},m,h,n),O=_r(o,p,b,h,n),P=function(t,r,n,o,i,s){var u={cur:null,next:null,dirty:!1,setFBO:null},l=["rgba"],c=["rgba4","rgb565","rgb5 a1"];r.ext_srgb&&c.push("srgba"),r.ext_color_buffer_half_float&&c.push("rgba16f","rgb16f"),r.webgl_color_buffer_float&&c.push("rgba32f");var f=["uint8"];function h(t,e,r){this.target=t,this.texture=e,this.renderbuffer=r;var n=0,o=0;e?(n=e.width,o=e.height):r&&(n=r.width,o=r.height),this.width=n,this.height=o}function p(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function d(t,e,r){if(t)if(t.texture){var n=t.texture._texture,o=Math.max(1,n.width),i=Math.max(1,n.height);N(o===e&&i===r,"inconsistent width/height for supplied texture"),n.refCount+=1}else{var a=t.renderbuffer._renderbuffer;N(a.width===e&&a.height===r,"inconsistent width/height for renderbuffer"),a.refCount+=1}}function y(e,r){r&&(r.texture?t.framebufferTexture2D(Er,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(Er,e,Or,r.renderbuffer._renderbuffer.renderbuffer))}function v(t){var e=Pr,r=null,n=null,o=t;"object"===a(t)&&(o=t.data,"target"in t&&(e=0|t.target)),N.type(o,"function","invalid attachment data");var i=o._reglType;return"texture2d"===i?(r=o,N(e===Pr)):"textureCube"===i?(r=o,N(e>=kr&&e=2,"invalid shape for framebuffer"),s=M[0],h=M[1]}else"radius"in A&&(s=h=A.radius),"width"in A&&(s=A.width),"height"in A&&(h=A.height);("color"in A||"colors"in A)&&(b=A.color||A.colors,Array.isArray(b)&&N(1===b.length||r.webgl_draw_buffers,"multiple render targets not supported")),b||("colorCount"in A&&(E=0|A.colorCount,N(E>0,"invalid color buffer count")),"colorTexture"in A&&(w=!!A.colorTexture,S="rgba4"),"colorType"in A&&(x=A.colorType,w?(N(r.oes_texture_float||!("float"===x||"float32"===x),"you must enable OES_texture_float in order to use floating point framebuffer objects"),N(r.oes_texture_half_float||!("half float"===x||"float16"===x),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===x||"float16"===x?(N(r.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),S="rgba16f"):"float"!==x&&"float32"!==x||(N(r.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),S="rgba32f"),N.oneOf(x,f,"invalid color type")),"colorFormat"in A&&(S=A.colorFormat,l.indexOf(S)>=0?w=!0:c.indexOf(S)>=0?w=!1:w?N.oneOf(A.colorFormat,l,"invalid color format for texture"):N.oneOf(A.colorFormat,c,"invalid color format for renderbuffer"))),("depthTexture"in A||"depthStencilTexture"in A)&&(T=!(!A.depthTexture&&!A.depthStencilTexture),N(!T||r.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in A&&("boolean"==typeof A.depth?p=A.depth:(P=A.depth,y=!1)),"stencil"in A&&("boolean"==typeof A.stencil?y=A.stencil:(k=A.stencil,p=!1)),"depthStencil"in A&&("boolean"==typeof A.depthStencil?p=y=A.depthStencil:(C=A.depthStencil,p=!1,y=!1))}else s=h=1;var j=null,I=null,L=null,R=null;if(Array.isArray(b))j=b.map(v);else if(b)j=[v(b)];else for(j=new Array(E),o=0;o=0||j[o].renderbuffer&&Gr.indexOf(j[o].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+o+" is invalid"),j[o]&&j[o].texture){var B=Lr[j[o].texture._texture.format]*Rr[j[o].texture._texture.type];null===D?D=B:N(D===B,"all color attachments much have the same number of bits per pixel.")}return d(I,s,h),N(!I||I.texture&&I.texture._texture.format===Ir||I.renderbuffer&&I.renderbuffer._renderbuffer.format===Dr,"invalid depth attachment for framebuffer object"),d(L,s,h),N(!L||L.renderbuffer&&L.renderbuffer._renderbuffer.format===Br,"invalid stencil attachment for framebuffer object"),d(R,s,h),N(!R||R.texture&&R.texture._texture.format===Fr||R.renderbuffer&&R.renderbuffer._renderbuffer.format===Fr,"invalid depth-stencil attachment for framebuffer object"),_(i),i.width=s,i.height=h,i.colorAttachments=j,i.depthAttachment=I,i.stencilAttachment=L,i.depthStencilAttachment=R,a.color=j.map(m),a.depth=m(I),a.stencil=m(L),a.depthStencil=m(R),a.width=i.width,a.height=i.height,O(i),a}return s.framebufferCount++,a(t,o),e(a,{resize:function(t,e){N(u.next!==i,"can not resize a framebuffer which is currently in use");var r=Math.max(0|t,1),n=Math.max(0|e||r,1);if(r===i.width&&n===i.height)return a;for(var o=i.colorAttachments,s=0;s=2,"invalid shape for framebuffer"),N(m[0]===m[1],"cube framebuffer must be square"),h=m[0]}else"radius"in g&&(h=0|g.radius),"width"in g?(h=0|g.width,"height"in g&&N(g.height===h,"must be square")):"height"in g&&(h=0|g.height);("color"in g||"colors"in g)&&(p=g.color||g.colors,Array.isArray(p)&&N(1===p.length||r.webgl_draw_buffers,"multiple render targets not supported")),p||("colorCount"in g&&(v=0|g.colorCount,N(v>0,"invalid color buffer count")),"colorType"in g&&(N.oneOf(g.colorType,f,"invalid color type"),y=g.colorType),"colorFormat"in g&&(d=g.colorFormat,N.oneOf(g.colorFormat,l,"invalid color format for texture"))),"depth"in g&&(c.depth=g.depth),"stencil"in g&&(c.stencil=g.stencil),"depthStencil"in g&&(c.depthStencil=g.depthStencil)}else h=1;if(p)if(Array.isArray(p))for(s=[],n=0;n0&&(c.depth=i[0].depth,c.stencil=i[0].stencil,c.depthStencil=i[0].depthStencil),i[n]?i[n](c):i[n]=P(c)}return e(a,{width:h,height:h,color:s})}return a(t),e(a,{faces:i,resize:function(t){var e,r=0|t;if(N(r>0&&r<=n.maxCubeMapSize,"invalid radius for cube fbo"),r===a.width)return a;var o=a.color;for(e=0;e=0;--t){var e=M[t];e&&e(m,null,0)}o.flush(),d&&d.update()}function B(){!R&&M.length>0&&(R=V.next(D))}function F(){R&&(V.cancel(D),R=null)}function G(t){t.preventDefault(),s=!0,F(),j.forEach(function(t){t()})}function U(t){o.getError(),s=!1,u.restore(),_.restore(),w.restore(),E.restore(),O.restore(),P.restore(),S.restore(),d&&d.restore(),k.procs.refresh(),B(),I.forEach(function(t){t()})}function q(t){function r(t,e){var r={},n={};return Object.keys(t).forEach(function(o){var i=t[o];if(z.isDynamic(i))n[o]=z.unbox(i,o);else{if(e&&Array.isArray(i))for(var a=0;a0)return f.call(this,function(t){for(;p.length=0,"cannot cancel a frame twice"),M[e]=function t(){var e=Ei(M,t);M[e]=M[M.length-1],M.length-=1,M.length<=0&&F()}}}}function K(){var t=T.viewport,e=T.scissor_box;t[0]=t[1]=e[0]=e[1]=0,m.viewportWidth=m.framebufferWidth=m.drawingBufferWidth=t[2]=e[2]=o.drawingBufferWidth,m.viewportHeight=m.framebufferHeight=m.drawingBufferHeight=t[3]=e[3]=o.drawingBufferHeight}function Q(){m.tick+=1,m.time=$(),K(),k.procs.poll()}function Z(){E.refresh(),K(),k.procs.refresh(),d&&d.update()}function $(){return(H()-y)/1e3}Z();var tt=e(q,{clear:function(t){if(N("object"===a(t)&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var r=0;r<6;++r)W(e({framebuffer:t.framebuffer.faces[r]},t),X);else W(t,X);else X(0,t)},prop:z.define.bind(null,Si),context:z.define.bind(null,xi),this:z.define.bind(null,_i),draw:q({}),buffer:function(t){return w.create(t,mi,!1,!1)},elements:function(t){return x.create(t,!1)},texture:E.create2D,cube:E.createCube,renderbuffer:O.create,framebuffer:P.create,framebufferCube:P.createCube,vao:S.createVAO,attributes:i,frame:J,on:function(t,e){var r;switch(N.type(e,"function","listener callback must be a function"),t){case"frame":return J(e);case"lost":r=j;break;case"restore":r=I;break;case"destroy":r=L;break;default:N.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(e),{cancel:function(){for(var t=0;t=0},read:C,destroy:function(){M.length=0,F(),A&&(A.removeEventListener(bi,G),A.removeEventListener(wi,U)),_.clear(),P.clear(),O.clear(),E.clear(),x.clear(),w.clear(),S.clear(),d&&d.clear(),L.forEach(function(t){t()})},_gl:o,_refresh:Z,poll:function(){Q(),d&&d.update()},now:$,stats:h});return n.onDone(null,tt),tt}},"object"===a(e)?t.exports=i():void 0===(o="function"==typeof(n=i)?n.call(e,r,e,t):n)||(t.exports=o)},7742:function(t,e,r){"use strict";var n=r(1897),o=Array.prototype.concat,i=Array.prototype.slice,a=t.exports=function(t){for(var e=[],r=0,a=t.length;r1&&void 0!==arguments[1]?arguments[1]:{};if(o=Object.assign({},n,o),!t||"string"!=typeof t)return t;var i=t.trim();if(void 0!==o.skipLike&&o.skipLike.test(i))return t;if(o.hex&&e.test(i))return Number.parseInt(i,16);var a=r.exec(i);if(a){var s=a[1],u=a[2],l=function(t){return t&&-1!==t.indexOf(".")?("."===(t=t.replace(/0+$/,""))?t="0":"."===t[0]?t="0"+t:"."===t[t.length-1]&&(t=t.substr(0,t.length-1)),t):t}(a[3]),c=a[4]||a[6];if(!o.leadingZeros&&u.length>0&&s&&"."!==i[2])return t;if(!o.leadingZeros&&u.length>0&&!s&&"."!==i[1])return t;var f=Number(i),h=""+f;return-1!==h.search(/[eE]/)?o.eNotation?f:t:c?o.eNotation?f:t:-1!==i.indexOf(".")?"0"===h&&""===l?f:h===l?f:s&&h==="-"+l?f:t:u?l===h?f:s+l===h?f:t:i===h?f:i===s+h?f:t}return t}},5400:function(t,e,r){var n,o;function i(t){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t=r.nmd(t),function(a,s){"use strict";"object"===i(t)&&t.exports?t.exports=s():void 0===(o="function"==typeof(n=s)?n.call(e,r,e,t):n)||(t.exports=o)}(0,function(t){"use strict";var e=t&&t.IPv6;return{best:function(t){var e,r,n=t.toLowerCase().split(":"),o=n.length,i=8;for(""===n[0]&&""===n[1]&&""===n[2]?(n.shift(),n.shift()):""===n[0]&&""===n[1]?n.shift():""===n[o-1]&&""===n[o-2]&&n.pop(),-1!==n[(o=n.length)-1].indexOf(".")&&(i=7),e=0;e1;s++)r.splice(0,1);n[a]=r.join("")}var u=-1,l=0,c=0,f=-1,h=!1;for(a=0;al&&(u=f,l=c)):"0"===n[a]&&(h=!0,f=a,c=1);c>l&&(u=f,l=c),l>1&&n.splice(u,l,""),o=n.length;var p="";for(""===n[0]&&(p=":"),a=0;a=t.length-1)return!1;var n=t.lastIndexOf(".",e-1);if(n<=0||n>=e-1)return!1;var o=r.list[t.slice(e+1)];return!!o&&o.indexOf(" "+t.slice(n+1,e)+" ")>=0},is:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;if(t.lastIndexOf(".",e-1)>=0)return!1;var n=r.list[t.slice(e+1)];return!!n&&n.indexOf(" "+t.slice(0,e)+" ")>=0},get:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return null;var n=t.lastIndexOf(".",e-1);if(n<=0||n>=e-1)return null;var o=r.list[t.slice(e+1)];return o?o.indexOf(" "+t.slice(n+1,e)+" ")<0?null:t.slice(n+1):null},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=e),this}};return r})},7411:function(t,e,r){var n,o,i;function a(t){"@babel/helpers - typeof";return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t=r.nmd(t),function(s,u){"use strict";"object"===a(t)&&t.exports?t.exports=u(r(9018),r(5400),r(2714)):(o=[r(9018),r(5400),r(2714)],void 0===(i="function"==typeof(n=u)?n.apply(e,o):n)||(t.exports=i))}(0,function(t,e,r,n){"use strict";var o=n&&n.URI;function i(t,e){var r=arguments.length>=1,n=arguments.length>=2;if(!(this instanceof i))return r?n?new i(t,e):new i(t):new i;if(void 0===t){if(r)throw new TypeError("undefined is not a valid argument for URI");t="undefined"!=typeof location?location.href+"":""}if(null===t&&r)throw new TypeError("null is not a valid argument for URI");return this.href(t),void 0!==e?this.absoluteTo(e):this}i.version="1.19.11";var s=i.prototype,u=Object.prototype.hasOwnProperty;function l(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function c(t){return void 0===t?"Undefined":String(Object.prototype.toString.call(t)).slice(8,-1)}function f(t){return"Array"===c(t)}function h(t,e){var r,n,o={};if("RegExp"===c(e))o=null;else if(f(e))for(r=0,n=e.length;r]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,i.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},i.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,i.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,i.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},i.hostProtocols=["http","https"],i.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,i.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},i.getDomAttribute=function(t){if(t&&t.nodeName){var e=t.nodeName.toLowerCase();if("input"!==e||"image"===t.type)return i.domAttributes[e]}},i.encode=g,i.decode=decodeURIComponent,i.iso8859=function(){i.encode=escape,i.decode=unescape},i.unicode=function(){i.encode=g,i.decode=decodeURIComponent},i.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},i.encodeQuery=function(t,e){var r=i.encode(t+"");return void 0===e&&(e=i.escapeQuerySpace),e?r.replace(/%20/g,"+"):r},i.decodeQuery=function(t,e){t+="",void 0===e&&(e=i.escapeQuerySpace);try{return i.decode(e?t.replace(/\+/g,"%20"):t)}catch(e){return t}};var m,b={encode:"encode",decode:"decode"},w=function(t,e){return function(r){try{return i[e](r+"").replace(i.characters[t][e].expression,function(r){return i.characters[t][e].map[r]})}catch(t){return r}}};for(m in b)i[m+"PathSegment"]=w("pathname",b[m]),i[m+"UrnPathSegment"]=w("urnpath",b[m]);var S=function(t,e,r){return function(n){var o;o=r?function(t){return i[e](i[r](t))}:i[e];for(var a=(n+"").split(t),s=0,u=a.length;s-1&&(e.fragment=t.substring(r+1)||null,t=t.substring(0,r)),(r=t.indexOf("?"))>-1&&(e.query=t.substring(r+1)||null,t=t.substring(0,r)),"//"===(t=(t=t.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://")).replace(/^[/\\]{2,}/i,"//")).substring(0,2)?(e.protocol=null,t=t.substring(2),t=i.parseAuthority(t,e)):(r=t.indexOf(":"))>-1&&(e.protocol=t.substring(0,r)||null,e.protocol&&!e.protocol.match(i.protocol_expression)?e.protocol=void 0:"//"===t.substring(r+1,r+3).replace(/\\/g,"/")?(t=t.substring(r+3),t=i.parseAuthority(t,e)):(t=t.substring(r+1),e.urn=!0)),e.path=t,e},i.parseHost=function(t,e){t||(t="");var r,n,o=(t=t.replace(/\\/g,"/")).indexOf("/");if(-1===o&&(o=t.length),"["===t.charAt(0))r=t.indexOf("]"),e.hostname=t.substring(1,r)||null,e.port=t.substring(r+2,o)||null,"/"===e.port&&(e.port=null);else{var a=t.indexOf(":"),s=t.indexOf("/"),u=t.indexOf(":",a+1);-1!==u&&(-1===s||u-1?o:t.length-1);return a>-1&&(-1===o||a-1?p.slice(0,d)+p.slice(d).replace(a,""):p.replace(a,"")).length<=l[0].length||r.ignore&&r.ignore.test(p))){var g=e(p,c,h=c+p.length,t);void 0!==g?(g=String(g),t=t.slice(0,c)+g+t.slice(h),n.lastIndex=c+g.length):n.lastIndex=h}}return n.lastIndex=0,t},i.ensureValidHostname=function(e,r){var n=!!e,o=!1;if(!!r&&(o=p(i.hostProtocols,r)),o&&!n)throw new TypeError("Hostname cannot be empty, if protocol is "+r);if(e&&e.match(i.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(e).match(i.invalid_hostname_characters))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-:_]')}},i.ensureValidPort=function(t){if(t){var e=Number(t);if(!(/^[0-9]+$/.test(e)&&e>0&&e<65536))throw new TypeError('Port "'+t+'" is not a valid port')}},i.noConflict=function(t){if(t){var e={URI:this.noConflict()};return n.URITemplate&&"function"==typeof n.URITemplate.noConflict&&(e.URITemplate=n.URITemplate.noConflict()),n.IPv6&&"function"==typeof n.IPv6.noConflict&&(e.IPv6=n.IPv6.noConflict()),n.SecondLevelDomains&&"function"==typeof n.SecondLevelDomains.noConflict&&(e.SecondLevelDomains=n.SecondLevelDomains.noConflict()),e}return n.URI===this&&(n.URI=o),this},s.build=function(t){return!0===t?this._deferred_build=!0:(void 0===t||this._deferred_build)&&(this._string=i.build(this._parts),this._deferred_build=!1),this},s.clone=function(){return new i(this)},s.valueOf=s.toString=function(){return this.build(!1)._string},s.protocol=x("protocol"),s.username=x("username"),s.password=x("password"),s.hostname=x("hostname"),s.port=x("port"),s.query=_("query","?"),s.fragment=_("fragment","#"),s.search=function(t,e){var r=this.query(t,e);return"string"==typeof r&&r.length?"?"+r:r},s.hash=function(t,e){var r=this.fragment(t,e);return"string"==typeof r&&r.length?"#"+r:r},s.pathname=function(t,e){if(void 0===t||!0===t){var r=this._parts.path||(this._parts.hostname?"/":"");return t?(this._parts.urn?i.decodeUrnPath:i.decodePath)(r):r}return this._parts.urn?this._parts.path=t?i.recodeUrnPath(t):"":this._parts.path=t?i.recodePath(t):"/",this.build(!e),this},s.path=s.pathname,s.href=function(t,e){var r;if(void 0===t)return this.toString();this._string="",this._parts=i._parts();var n=t instanceof i,o="object"===a(t)&&(t.hostname||t.path||t.pathname);t.nodeName&&(t=t[i.getDomAttribute(t)]||"",o=!1);if(!n&&o&&void 0!==t.pathname&&(t=t.toString()),"string"==typeof t||t instanceof String)this._parts=i.parse(String(t),this._parts);else{if(!n&&!o)throw new TypeError("invalid input");var s=n?t._parts:t;for(r in s)"query"!==r&&u.call(this._parts,r)&&(this._parts[r]=s[r]);s.query&&this.query(s.query,!1)}return this.build(!e),this},s.is=function(t){var e=!1,n=!1,o=!1,a=!1,s=!1,u=!1,l=!1,c=!this._parts.urn;switch(this._parts.hostname&&(c=!1,n=i.ip4_expression.test(this._parts.hostname),o=i.ip6_expression.test(this._parts.hostname),s=(a=!(e=n||o))&&r&&r.has(this._parts.hostname),u=a&&i.idn_expression.test(this._parts.hostname),l=a&&i.punycode_expression.test(this._parts.hostname)),t.toLowerCase()){case"relative":return c;case"absolute":return!c;case"domain":case"name":return a;case"sld":return s;case"ip":return e;case"ip4":case"ipv4":case"inet4":return n;case"ip6":case"ipv6":case"inet6":return o;case"idn":return u;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return l}return null};var E=s.protocol,O=s.port,P=s.hostname;s.protocol=function(t,e){if(t&&!(t=t.replace(/:(\/\/)?$/,"")).match(i.protocol_expression))throw new TypeError('Protocol "'+t+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return E.call(this,t,e)},s.scheme=s.protocol,s.port=function(t,e){return this._parts.urn?void 0===t?"":this:(void 0!==t&&(0===t&&(t=null),t&&(":"===(t+="").charAt(0)&&(t=t.substring(1)),i.ensureValidPort(t))),O.call(this,t,e))},s.hostname=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0!==t){var r={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==i.parseHost(t,r))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');t=r.hostname,this._parts.preventInvalidHostname&&i.ensureValidHostname(t,this._parts.protocol)}return P.call(this,t,e)},s.origin=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){var r=this.protocol();return this.authority()?(r?r+"://":"")+this.authority():""}var n=i(t);return this.protocol(n.protocol()).authority(n.authority()).build(!e),this},s.host=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t)return this._parts.hostname?i.buildHost(this._parts):"";if("/"!==i.parseHost(t,this._parts))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');return this.build(!e),this},s.authority=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t)return this._parts.hostname?i.buildAuthority(this._parts):"";if("/"!==i.parseAuthority(t,this._parts))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-]');return this.build(!e),this},s.userinfo=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){var r=i.buildUserinfo(this._parts);return r?r.substring(0,r.length-1):r}return"@"!==t[t.length-1]&&(t+="@"),i.parseUserinfo(t,this._parts),this.build(!e),this},s.resource=function(t,e){var r;return void 0===t?this.path()+this.search()+this.hash():(r=i.parse(t),this._parts.path=r.path,this._parts.query=r.query,this._parts.fragment=r.fragment,this.build(!e),this)},s.subdomain=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,r)||""}var n=this._parts.hostname.length-this.domain().length,o=this._parts.hostname.substring(0,n),a=new RegExp("^"+l(o));if(t&&"."!==t.charAt(t.length-1)&&(t+="."),-1!==t.indexOf(":"))throw new TypeError("Domains cannot contain colons");return t&&i.ensureValidHostname(t,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(a,t),this.build(!e),this},s.domain=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("boolean"==typeof t&&(e=t,t=void 0),void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.match(/\./g);if(r&&r.length<2)return this._parts.hostname;var n=this._parts.hostname.length-this.tld(e).length-1;return n=this._parts.hostname.lastIndexOf(".",n-1)+1,this._parts.hostname.substring(n)||""}if(!t)throw new TypeError("cannot set domain empty");if(-1!==t.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(i.ensureValidHostname(t,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=t;else{var o=new RegExp(l(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(o,t)}return this.build(!e),this},s.tld=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("boolean"==typeof t&&(e=t,t=void 0),void 0===t){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.lastIndexOf("."),o=this._parts.hostname.substring(n+1);return!0!==e&&r&&r.list[o.toLowerCase()]&&r.get(this._parts.hostname)||o}var i;if(!t)throw new TypeError("cannot set TLD empty");if(t.match(/[^a-zA-Z0-9-]/)){if(!r||!r.is(t))throw new TypeError('TLD "'+t+'" contains characters other than [A-Z0-9]');i=new RegExp(l(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(i,t)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");i=new RegExp(l(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(i,t)}return this.build(!e),this},s.directory=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t||!0===t){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var r=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,r)||(this._parts.hostname?"/":"");return t?i.decodePath(n):n}var o=this._parts.path.length-this.filename().length,a=this._parts.path.substring(0,o),s=new RegExp("^"+l(a));return this.is("relative")||(t||(t="/"),"/"!==t.charAt(0)&&(t="/"+t)),t&&"/"!==t.charAt(t.length-1)&&(t+="/"),t=i.recodePath(t),this._parts.path=this._parts.path.replace(s,t),this.build(!e),this},s.filename=function(t,e){if(this._parts.urn)return void 0===t?"":this;if("string"!=typeof t){if(!this._parts.path||"/"===this._parts.path)return"";var r=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(r+1);return t?i.decodePathSegment(n):n}var o=!1;"/"===t.charAt(0)&&(t=t.substring(1)),t.match(/\.?\//)&&(o=!0);var a=new RegExp(l(this.filename())+"$");return t=i.recodePath(t),this._parts.path=this._parts.path.replace(a,t),o?this.normalizePath(e):this.build(!e),this},s.suffix=function(t,e){if(this._parts.urn)return void 0===t?"":this;if(void 0===t||!0===t){if(!this._parts.path||"/"===this._parts.path)return"";var r,n,o=this.filename(),a=o.lastIndexOf(".");return-1===a?"":(r=o.substring(a+1),n=/^[a-z0-9%]+$/i.test(r)?r:"",t?i.decodePathSegment(n):n)}"."===t.charAt(0)&&(t=t.substring(1));var s,u=this.suffix();if(u)s=t?new RegExp(l(u)+"$"):new RegExp(l("."+u)+"$");else{if(!t)return this;this._parts.path+="."+i.recodePath(t)}return s&&(t=i.recodePath(t),this._parts.path=this._parts.path.replace(s,t)),this.build(!e),this},s.segment=function(t,e,r){var n=this._parts.urn?":":"/",o=this.path(),i="/"===o.substring(0,1),a=o.split(n);if(void 0!==t&&"number"!=typeof t&&(r=e,e=t,t=void 0),void 0!==t&&"number"!=typeof t)throw new Error('Bad segment "'+t+'", must be 0-based integer');if(i&&a.shift(),t<0&&(t=Math.max(a.length+t,0)),void 0===e)return void 0===t?a:a[t];if(null===t||void 0===a[t])if(f(e)){a=[];for(var s=0,u=e.length;s= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=h-p,O=Math.floor,P=String.fromCharCode;function k(t){throw new RangeError(_[t])}function C(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function T(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+C((t=t.replace(x,".")).split("."),e).join(".")}function A(t){for(var e,r,n=[],o=0,i=t.length;o=55296&&e<=56319&&o65535&&(e+=P((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=P(t)}).join("")}function j(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function I(t,e,r){var n=0;for(t=r?O(t/v):t>>1,t+=O(t/e);t>E*d>>1;n+=h)t=O(t/E);return O(n+(E+1)*t/(t+y))}function N(t){var e,r,n,o,i,a,s,u,l,c,y,v=[],w=t.length,S=0,x=m,_=g;for((r=t.lastIndexOf(b))<0&&(r=0),n=0;n=128&&k("not-basic"),v.push(t.charCodeAt(n));for(o=r>0?r+1:0;o=w&&k("invalid-input"),((u=(y=t.charCodeAt(o++))-48<10?y-22:y-65<26?y-65:y-97<26?y-97:h)>=h||u>O((f-S)/a))&&k("overflow"),S+=u*a,!(u<(l=s<=_?p:s>=_+d?d:s-_));s+=h)a>O(f/(c=h-l))&&k("overflow"),a*=c;_=I(S-i,e=v.length+1,0==i),O(S/e)>f-x&&k("overflow"),x+=O(S/e),S%=e,v.splice(S++,0,x)}return M(v)}function L(t){var e,r,n,o,i,a,s,u,l,c,y,v,w,S,x,_=[];for(v=(t=A(t)).length,e=m,r=0,i=g,a=0;a=e&&yO((f-r)/(w=n+1))&&k("overflow"),r+=(s-e)*w,e=s,a=0;af&&k("overflow"),y==e){for(u=r,l=h;!(u<(c=l<=i?p:l>=i+d?d:l-i));l+=h)x=u-c,S=h-c,_.push(P(j(c+x%S,0))),u=O(x/S);_.push(P(j(u,0))),i=I(r,w,n==o),r=0,++n}++r,++e}return _.join("")}if(l={version:"1.3.2",ucs2:{decode:A,encode:M},decode:N,encode:L,toASCII:function(t){return T(t,function(t){return S.test(t)?"xn--"+L(t):t})},toUnicode:function(t){return T(t,function(t){return w.test(t)?N(t.slice(4).toLowerCase()):t})}},"object"==o(r.amdO)&&r.amdO)void 0===(n=function(){return l}.call(e,r,e,t))||(t.exports=n);else if(a&&s)if(t.exports==a)s.exports=l;else for(c in l)l.hasOwnProperty(c)&&(a[c]=l[c]);else i.punycode=l}(this)},4539:function(){"use strict"},5417:function(t,e,r){"use strict";var n={};r.r(n),r.d(n,{GADDI:function(){return Cm},Stack:function(){return Tm},breadthFirstSearch:function(){return wg},connectedComponent:function(){return _g},cosineSimilarity:function(){return Zg},default:function(){return Mm},depthFirstSearch:function(){return Cg},detectAllCycles:function(){return Mg},detectAllDirectedCycle:function(){return Ag},detectAllUndirectedCycle:function(){return Tg},detectCycle:function(){return jg},detectDirectedCycle:function(){return Am},dijkstra:function(){return Ig},findAllPath:function(){return Dg},findShortestPath:function(){return Rg},floydWarshall:function(){return Bg},getAdjMatrix:function(){return hg},getDegree:function(){return Og},getInDegree:function(){return Pg},getNeighbors:function(){return gg},getOutDegree:function(){return kg},iLouvain:function(){return Xg},kCore:function(){return Jg},kMeans:function(){return Qg},labelPropagation:function(){return Fg},louvain:function(){return Yg},minimumSpanningTree:function(){return im},nodesCosineSimilarity:function(){return $g},pageRank:function(){return am}});var o={};r.r(o),r.d(o,{Line:function(){return nb},applyMatrix:function(){return Um},compare:function(){return Lm},distance:function(){return Hm},floydWarshall:function(){return Wm},fractionToLine:function(){return sb},getAdjMatrix:function(){return Ym},getBBoxBoundLine:function(){return ob},getCircleCenterByPoints:function(){return Vm},getCircleIntersectByPoint:function(){return Fm},getDegree:function(){return Zm},getEllipseIntersectByPoint:function(){return Gm},getLineIntersect:function(){return Dm},getPointsCenter:function(){return ub},getRectIntersectByPoint:function(){return Bm},intersectBBox:function(){return eb},invertMatrix:function(){return zm},isPointInPolygon:function(){return tb},isPointsOverlap:function(){return fb},isPolygonsIntersect:function(){return rb},itemIntersectByLine:function(){return ab},lerp:function(){return db},lerpArray:function(){return yb},move:function(){return Jm},pointLineDistance:function(){return pb},pointLineSquareDist:function(){return cb},pointRectSquareDist:function(){return hb},rotate:function(){return Qm},scale:function(){return Km},scaleMatrix:function(){return qm},squareDist:function(){return lb},translate:function(){return Xm}});var i={};r.r(i),r.d(i,{cloneBesidesImg:function(){return Gb},getAnimateCfgWithCallback:function(){return Ub},getBBox:function(){return Cb},getComboBBox:function(){return Bb},getLabelPosition:function(){return Ab},getLetterWidth:function(){return Ib},getLoopCfgs:function(){return Tb},getTextSize:function(){return Nb},plainCombosToTrees:function(){return Rb},reconstructTree:function(){return Db},shouldRefreshEdge:function(){return Fb},traverseTree:function(){return Mb},traverseTreeUp:function(){return jb},truncateLabelByLength:function(){return Lb}});var a={};r.r(a),r.d(a,{catmullRomToBezier:function(){return Xb},fillPath:function(){return dw},fillPathByDiff:function(){return gw},formatPath:function(){return ww},intersection:function(){return fw},parsePathArray:function(){return ew},parsePathString:function(){return Yb},pathToAbsolute:function(){return Kb},pathToCurve:function(){return $b},rectPath:function(){return aw}});var s={};r.r(s),r.d(s,{easeBack:function(){return Cx},easeBackIn:function(){return Px},easeBackInOut:function(){return Cx},easeBackOut:function(){return kx},easeBounce:function(){return Ex},easeBounceIn:function(){return _x},easeBounceInOut:function(){return Ox},easeBounceOut:function(){return Ex},easeCircle:function(){return hx},easeCircleIn:function(){return cx},easeCircleInOut:function(){return hx},easeCircleOut:function(){return fx},easeCubic:function(){return QS},easeCubicIn:function(){return JS},easeCubicInOut:function(){return QS},easeCubicOut:function(){return KS},easeElastic:function(){return Mx},easeElasticIn:function(){return Ax},easeElasticInOut:function(){return jx},easeElasticOut:function(){return Mx},easeExp:function(){return lx},easeExpIn:function(){return sx},easeExpInOut:function(){return lx},easeExpOut:function(){return ux},easeLinear:function(){return qS},easePoly:function(){return tx},easePolyIn:function(){return ZS},easePolyInOut:function(){return tx},easePolyOut:function(){return $S},easeQuad:function(){return XS},easeQuadIn:function(){return WS},easeQuadInOut:function(){return XS},easeQuadOut:function(){return YS},easeSin:function(){return ix},easeSinIn:function(){return nx},easeSinInOut:function(){return ix},easeSinOut:function(){return ox}});var u={};r.r(u),r.d(u,{calculationItemsBBox:function(){return nE},cloneEvent:function(){return tE},formatPadding:function(){return $_},isNaN:function(){return rE},isViewportChanged:function(){return eE},processParallelEdges:function(){return oE},uniqueId:function(){return Z_}});var l={};r.r(l),r.d(l,{getClosedSpline:function(){return ME},getControlPoint:function(){return CE},getSpline:function(){return kE},getStarPath:function(){return DE},paddedHull:function(){return RE},pathToPoints:function(){return AE},pointsToPolygon:function(){return TE},roundedHull:function(){return LE}});var c={};r.r(c),r.d(c,{defaultSubjectColors:function(){return hO}});var f={};r.r(f),r.d(f,{isForce:function(){return pO}});var h={};r.r(h),r.d(h,{Base:function(){return oP},Circle:function(){return iP},Ellipse:function(){return sP},Image:function(){return lP},Line:function(){return fP},Marker:function(){return pP},Path:function(){return _P},Polygon:function(){return OP},Polyline:function(){return PP},Rect:function(){return kP},Text:function(){return CP}});var p={};r.r(p),r.d(p,{Base:function(){return zP},Circle:function(){return VP},Dom:function(){return HP},Ellipse:function(){return qP},Image:function(){return WP},Line:function(){return YP},Marker:function(){return KP},Path:function(){return QP},Polygon:function(){return ZP},Polyline:function(){return $P},Rect:function(){return tk},Text:function(){return ok}});var d={};r.r(d),r.d(d,{getColorSetsBySubjectColors:function(){return EC},getColorsWithSubjectColor:function(){return _C},mixColor:function(){return xC}});var y={};r.r(y),r.d(y,{arrayToTextureData:function(){return UC},attributesToTextureData:function(){return GC},buildTextureData:function(){return DC},buildTextureDataWithOneEdgeAttr:function(){return BC},buildTextureDataWithTwoEdgeAttr:function(){return FC},proccessToFunc:function(){return RC},radialLayout:function(){return zC}});var v={};r.r(v),r.d(v,{gpuDetector:function(){return VC}});var g={};r.r(g),r.d(g,{getBrowserName:function(){return HC}});var m={};r.r(m),r.d(m,{assign:function(){return bA},default:function(){return FA},defaultI18n:function(){return _A},format:function(){return DA},parse:function(){return BA},setGlobalDateI18n:function(){return OA},setGlobalDateMasks:function(){return RA}});var b=mapboxgl,w=r.n(b),S={values:[],set:function(t){return this.values=t,this.values},add:function(t){return this.values.push(t),this.values}},x=(r(5246),r(1358),r(3678)),_=r.n(x);function E(t){"@babel/helpers - typeof";return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function O(t,e){for(var r=0;r0&&(r=parseFloat(t.toPrecision(e))),r},format:function(t,e,r,n){e=void 0!==e?e:0,r=void 0!==r?r:T.thousandsSeparator,n=void 0!==n?n:T.decimalSeparator,null!=e&&(t=parseFloat(t.toFixed(e)));var o=t.toString().split(".");1===o.length&&null==e&&(e=0);var i,a=o[0];if(r)for(var s=/(-?[0-9]+)([0-9]{3})/;s.test(a);)a=a.replace(s,"$1"+r+"$2");if(0==e)i=a;else{var u=o.length>1?o[1]:"0";null!=e&&(u+=new Array(e-u.length+1).join("0")),i=a+n+u}return i}};Number.prototype.limitSigDigs||(Number.prototype.limitSigDigs=function(t){return T.limitSigDigs(this,t)});var A={bind:function(t,e){var r=Array.prototype.slice.apply(arguments,[2]);return function(){var n=r.concat(Array.prototype.slice.apply(arguments,[0]));return t.apply(e,n)}},bindAsEventListener:function(t,e){return function(r){return t.call(e,r||window.event)}},False:function(){return!1},True:function(){return!0},Void:function(){}},M={filter:function(t,e,r){var n=[];if(Array.prototype.filter)n=t.filter(e,r);else{var o=t.length;if("function"!=typeof e)throw new TypeError;for(var i=0;i-1||o.indexOf("trident")>-1&&o.indexOf("rv")>-1?(e="msie",t=o.match(/msie ([\d.]+)/)||o.match(/rv:([\d.]+)/)):o.indexOf("chrome")>-1?(e="chrome",t=o.match(/chrome\/([\d.]+)/)):o.indexOf("firefox")>-1?(e="firefox",t=o.match(/firefox\/([\d.]+)/)):o.indexOf("opera")>-1?(e="opera",t=o.match(/version\/([\d.]+)/)):o.indexOf("safari")>-1&&(e="safari",t=o.match(/version\/([\d.]+)/)),r=t?t[1]:"",o.indexOf("ipad")>-1||o.indexOf("ipod")>-1||o.indexOf("iphone")>-1?n="apple":o.indexOf("android")>-1&&(r=(t=o.match(/version\/([\d.]+)/))?t[1]:"",n="android"),{name:e,version:r,device:n}}(),V=(F=!0,G=z,document.createElement("canvas").getContext?("firefox"===G.name&&parseFloat(G.version)<5&&(F=!1),"safari"===G.name&&parseFloat(G.version)<4&&(F=!1),"opera"===G.name&&parseFloat(G.version)<10&&(F=!1),"msie"===G.name&&parseFloat(G.version)<9&&(F=!1)):F=!1,F),H=-1===(U=navigator.userAgent.toLowerCase()).indexOf("webkit")&&-1!==U.indexOf("gecko"),q={assign:function(t){for(var e=0;e=0;r--)t[r]===e&&t.splice(r,1);return t},indexOf:function(t,e){if(null==t)return-1;if("function"==typeof t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r=0&&parseFloat(s)<1?(t.style.filter="alpha(opacity="+100*s+")",t.style.opacity=s):1===parseFloat(s)&&(t.style.filter="",t.style.opacity="")},applyDefaults:function(t,e){t=t||{};var r="function"==typeof window.Event&&e instanceof window.Event;for(var n in e)(void 0===t[n]||!r&&e.hasOwnProperty&&e.hasOwnProperty(n)&&!t.hasOwnProperty(n))&&(t[n]=e[n]);return!r&&e&&e.hasOwnProperty&&e.hasOwnProperty("toString")&&!t.hasOwnProperty("toString")&&(t.toString=e.toString),t},getParameterString:function(t){var e=[];for(var r in t){var n,o=t[r];if(null!=o&&"function"!=typeof o)n=Array.isArray(o)||"[object Object]"===o.toString()?encodeURIComponent(JSON.stringify(o)):encodeURIComponent(o),e.push(encodeURIComponent(r)+"="+n)}return e.join("&")},urlAppend:function(t,e){var r=t;if(e){0===e.indexOf("?")&&(e=e.substring(1));var n=(t+" ").split(/[?&]/);r+=" "===n.pop()?e:n.length?"&"+e:"?"+e}return r},urlPathAppend:function(t,e){var r=t;if(!e)return r;0===e.indexOf("/")&&(e=e.substring(1));var n=t.split("?");return n[0].indexOf("/",n[0].length-1)<0&&(n[0]+="/"),r="".concat(n[0]).concat(e).concat(n.length>1?"?".concat(n[1]):"")},DEFAULT_PRECISION:14,toFloat:function(t,e){return null==e&&(e=q.DEFAULT_PRECISION),"number"!=typeof t&&(t=parseFloat(t)),0===e?t:parseFloat(t.toPrecision(e))},rad:function(t){return t*Math.PI/180},getParameters:function(t){t=null===t||void 0===t?window.location.href:t;var e="";if(C.contains(t,"?")){var r=t.indexOf("?")+1,n=C.contains(t,"#")?t.indexOf("#"):t.length;e=t.substring(r,n)}for(var o={},i=e.split(/[&;]/),a=0,s=i.length;a1?1/t:t},getResolutionFromScale:function(t,e){var r;t&&(null==e&&(e="degrees"),r=1/(q.normalizeScale(t)*W[e]*96));return r},getScaleFromResolution:function(t,e){return null==e&&(e="degrees"),t*W[e]*96},getBrowser:function(){return z},isSupportCanvas:V,supportCanvas:function(){return q.isSupportCanvas},isInTheSameDomain:function(t){return!t||(-1===t.indexOf("//")||q.isSameDomain(t,document.location.toString()))},isSameDomain:function(t,e){return new(D())(t).normalize().origin()===new(D())(e).normalize().origin()},calculateDpi:function(t,e,r,n,o){if(t&&e&&r){var i,a=t.getWidth(),s=t.getHeight(),u=e.w,l=e.h;if(o=o||6378137,"degree"===(n=n||"degrees").toLowerCase()||"degrees"===n.toLowerCase()||"dd"===n.toLowerCase()){var c=a/u,f=s/l;i=254/(c>f?c:f)/r/(2*Math.PI*o/360)/1e4}else{i=254/(a/u)/r/1e4}return i}},toJSON:function(t){var e=t;if(null==e)return null;switch(e.constructor){case String:return e=(e=(e=(e=(e=(e=(e='"'+e.replace(/(["\\])/g,"\\$1")+'"').replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace("<","<")).replace(">",">")).replace(/%/g,"%25")).replace(/&/g,"%26");case Array:for(var r="",n=0,o=e.length;n0?"{"+u.join(",")+"}":"{}"}return e.toString()}},getResolutionFromScaleDpi:function(t,e,r,n){return n=n||6378137,r=r||"",t>0&&e>0?(t=q.normalizeScale(t),"degree"===r.toLowerCase()||"degrees"===r.toLowerCase()||"dd"===r.toLowerCase()?254/e/t/(2*Math.PI*n/360)/1e4:254/e/t/1e4):-1},getScaleFromResolutionDpi:function(t,e,r,n){return n=n||6378137,r=r||"",t>0&&e>0?"degree"===r.toLowerCase()||"degrees"===r.toLowerCase()||"dd"===r.toLowerCase()?254/e/t/(2*Math.PI*n/360)/1e4:254/e/t/1e4:-1},transformResult:function(t){return t.responseText&&"string"==typeof t.responseText&&(t=JSON.parse(t.responseText)),t},copyAttributes:function(t,e){if(t=t||{},e)for(var r in e){var n=e[r];void 0!==n&&"CLASS_NAME"!==r&&"function"!=typeof n&&(t[r]=n)}return t},copyAttributesWithClip:function(t,e,r){if(t=t||{},e)for(var n in e){var o=!1;if(r&&r.length)for(var i=0,a=r.length;i=0&&i<=1&&o<=1&&i>=0?new L.Point(t.x+o*(e.x-t.x),t.y+o*(e.y-t.y)):"No Intersection";else if(0==s&&0==u){var c=Math.max(t.y,e.y),f=Math.min(t.y,e.y),h=Math.max(t.x,e.x),p=Math.min(t.x,e.x);a=(r.y>=f&&r.y<=c||n.y>=f&&n.y<=c)&&r.x>=p&&r.x<=h||n.x>=p&&n.x<=h?"Coincident":"Parallel"}else a="Parallel";return a},getTextBounds:function(t,e,r){document.body.appendChild(r),r.style.width="auto",r.style.height="auto",t.fontSize&&(r.style.fontSize=t.fontSize),t.fontFamily&&(r.style.fontFamily=t.fontFamily),t.fontWeight&&(r.style.fontWeight=t.fontWeight),r.style.position="relative",r.style.visibility="hidden",r.style.display="inline-block",r.innerHTML=e;var n=r.clientWidth,o=r.clientHeight;return document.body.removeChild(r),{textWidth:n,textHeight:o}},convertPath:function(t,e){return e?t.replace(/\{([\w-\.]+)\}/g,function(t,r){var n;return n=e.hasOwnProperty(r)?function(t){if(void 0==t||null==t)return"";if(t instanceof Date)return t.toJSON();if(function(t){if("string"!=typeof t&&"object"!==B(t))return!1;try{var e=t.toString();return"[object Object]"===e||"[object Array]"===e}catch(t){return!1}}(t))return JSON.stringify(t);return t.toString()}(e[r]):t,encodeURIComponent(n)}):t}},W={inches:1,ft:12,mi:63360,m:39.3701,km:39370.1,dd:4374754,yd:36};W.in=W.inches,W.degrees=W.dd,W.nmi=1852*W.m;var Y=.0254000508001016;q.extend(W,{Inch:W.inches,Meter:39.37,Foot:12,IFoot:11.999976,ClarkeFoot:11.999868327581488,SearsFoot:11.999955194477684,GoldCoastFoot:11.999964589846002,IInch:.9999979999999999,MicroInch:999998e-9,Mil:9.99998e-7,Centimeter:.3937,Kilometer:39370,Yard:36,SearsYard:35.99986558343306,IndianYard:35.99987015540864,IndianYd37:35.999740205100004,IndianYd62:35.999880755999996,IndianYd75:35.999868945,IndianFoot:11.9999567087,IndianFt37:11.9999134017,IndianFt62:11.999960252000001,IndianFt75:11.999956315,Mile:63360,IYard:35.999928,IMile:63359.87328,NautM:72913.24,"Lat-66":4367838.370169282,"Lat-83":4367954.152606599,Decimeter:3.9370000000000003,Millimeter:.03937,Dekameter:393.7,Decameter:393.7,Hectometer:3937,GermanMeter:39.370535294205006,CaGrid:39.359685060000004,ClarkeChain:791.991309620512,GunterChain:792.0000000000001,BenoitChain:791.9977268035781,SearsChain:791.9970428354235,ClarkeLink:7.91991309620512,GunterLink:7.920000000000001,BenoitLink:7.919977268035781,SearsLink:7.919970428354236,Rod:198.00000000000014,IntnlChain:791.998416,IntnlLink:7.91998416,Perch:198.00000000000014,Pole:198.00000000000014,Furlong:7919.999999999997,Rood:148.75036777426,CapeFoot:11.999868185255002,Brealey:14763.75,ModAmFt:12.000458400000001,Fathom:71.999856,"NautM-UK":72959.85408,"50kilometers":1968500,"150kilometers":5905500}),q.extend(W,{mm:W.Meter/1e3,cm:W.Meter/100,dm:100*W.Meter,km:1e3*W.Meter,kmi:W.nmi,fath:W.Fathom,ch:W.IntnlChain,link:W.IntnlLink,"us-in":W.inches,"us-ft":W.Foot,"us-yd":W.Yard,"us-ch":W.GunterChain,"us-mi":W.Mile,"ind-yd":W.IndianYd37,"ind-ft":W.IndianFt37,"ind-ch":791.9942845122}),W.degree=W.dd,W.meter=W.m,W.foot=W.ft,W.inch=W.inches,W.mile=W.mi,W.kilometer=W.km,W.yard=W.yd;var X,J,K=window.fetch,Q={limitLength:1500,queryKeys:[],queryValues:[],supermap_callbacks:{},addQueryStrings:function(t){for(var e in t){this.queryKeys.push(e),"string"!=typeof t[e]&&(t[e]=q.toJSON(t[e]));var r=encodeURIComponent(t[e]);this.queryValues.push(r)}},issue:function(t){for(var e=this,r=e.getUid(),n=t.url,o=[],i=n,a=0,s=e.queryKeys?e.queryKeys.length:0,u=0;u=e.limitLength){if(0==a)return!1;o.push(i),i=n,a=0,u--}else if(i.length+e.queryKeys[u].length+2+e.queryValues[u].length>e.limitLength)for(var l=e.queryValues[u];l.length>0;){var c=e.limitLength-i.length-e.queryKeys[u].length-2;i.indexOf("?")>-1?i+="&":i+="?";var f=l.substring(0,c);"%"===f.substring(c-1,c)?(c-=1,f=l.substring(0,c)):"%"===f.substring(c-2,c-1)&&(c-=2,f=l.substring(0,c)),i+=e.queryKeys[u]+"="+f,l=l.substring(c),f.length>0&&(o.push(i),i=n,a=0)}else a++,i.indexOf("?")>-1?i+="&":i+="?",i+=e.queryKeys[u]+"="+e.queryValues[u];return o.push(i),e.send(o,"SuperMapJSONPCallbacks_"+r,t&&t.proxy)},getUid:function(){return 1e3*(new Date).getTime()+Math.floor(1e17*Math.random())},send:function(t,e,r){var n=t.length;if(n>0)return new Promise(function(o){for(var i=(new Date).getTime(),a=0;a-1?s+="&":s+="?",s+="sectionCount="+n,s+="§ionIndex="+a,s+="&jsonpUserID="+i,r&&(s=decodeURIComponent(s),s=r+encodeURIComponent(s)),_()(s,{jsonpCallbackFunction:e,timeout:3e4}).then(function(t){o(t.json())})}})},GET:function(t){return this.queryKeys.length=0,this.queryValues.length=0,this.addQueryStrings(t.params),this.issue(t)},POST:function(t){return this.queryKeys.length=0,this.queryValues.length=0,this.addQueryStrings({requestEntity:t.data}),this.issue(t)},PUT:function(t){return this.queryKeys.length=0,this.queryValues.length=0,this.addQueryStrings({requestEntity:t.data}),this.issue(t)},DELETE:function(t){return this.queryKeys.length=0,this.queryValues.length=0,this.addQueryStrings({requestEntity:t.data}),this.issue(t)}},Z=function(){return void 0!=X?X:window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest},$=function(){return J||45e3},tt={commit:function(t,e,r,n){switch(t=t?t.toUpperCase():t){case"GET":return this.get(e,r,n);case"POST":return this.post(e,r,n);case"PUT":return this.put(e,r,n);case"DELETE":return this.delete(e,r,n);default:return this.get(e,r,n)}},supportDirectRequest:function(t,e){return!!q.isInTheSameDomain(t)||(void 0!=e.crossOrigin?e.crossOrigin:Z()||e.proxy)},get:function(t,e,r){r=r||{};if(t=q.urlAppend(t,this._getParameterString(e||{})),t=this._processUrl(t,r),!this.supportDirectRequest(t,r)){var n={url:t=t.replace(".json",".jsonp"),data:e};return Q.GET(n)}return this.urlIsLong(t)?this._postSimulatie("GET",t.substring(0,t.indexOf("?")),e,r):this._fetch(t,e,r,"GET")},delete:function(t,e,r){r=r||{};if(t=q.urlAppend(t,this._getParameterString(e||{})),t=this._processUrl(t,r),!this.supportDirectRequest(t,r)){t=t.replace(".json",".jsonp");var n={url:t+="&_method=DELETE",data:e};return Q.DELETE(n)}return this.urlIsLong(t)?this._postSimulatie("DELETE",t.substring(0,t.indexOf("?")),e,r):this._fetch(t,e,r,"DELETE")},post:function(t,e,r){if(r=r||{},t=this._processUrl(t,r),!this.supportDirectRequest(t,r)){t=t.replace(".json",".jsonp");var n={url:q.urlAppend(t,"_method=POST"),data:e};return Q.POST(n)}return this._fetch(t,e,r,"POST")},put:function(t,e,r){if(r=r||{},t=this._processUrl(t,r),!this.supportDirectRequest(t,r)){t=t.replace(".json",".jsonp");var n={url:t+="&_method=PUT",data:e};return Q.PUT(n)}return this._fetch(t,e,r,"PUT")},urlIsLong:function(t){for(var e=0,r=null,n=0,o=t.length;n-1?"&":"?")+"_method="+t,"string"!=typeof r&&(r=JSON.stringify(r)),this.post(e,r,n)},_processUrl:function(t,e){if(this._isMVTRequest(t))return t;if(-1===t.indexOf(".json")&&!e.withoutFormatSuffix)if(t.indexOf("?")<0)t+=".json";else{var r=t.split("?");2===r.length&&(t=r[0]+".json?"+r[1])}return e&&e.proxy&&("function"==typeof e.proxy?t=e.proxy(t):(t=decodeURIComponent(t),t=e.proxy+encodeURIComponent(t))),t},_fetch:function(t,e,r,n){return(r=r||{}).headers=r.headers||{},r.headers["Content-Type"]||FormData.prototype.isPrototypeOf(e)||(r.headers["Content-Type"]="application/x-www-form-urlencoded;charset=UTF-8"),r.timeout?this._timeout(r.timeout,K(t,{method:n,headers:r.headers,body:"PUT"===n||"POST"===n?e:void 0,credentials:this._getWithCredentials(r),mode:"cors",timeout:$()}).then(function(t){return t})):K(t,{method:n,body:"PUT"===n||"POST"===n?e:void 0,headers:r.headers,credentials:this._getWithCredentials(r),mode:"cors",timeout:$()}).then(function(t){return t})},_getWithCredentials:function(t){return!0===t.withCredentials?"include":!1===t.withCredentials?"omit":"same-origin"},_fetchJsonp:function(t,e){return e=e||{},_()(t,{method:"GET",timeout:e.timeout}).then(function(t){return t})},_timeout:function(t,e){return new Promise(function(r,n){setTimeout(function(){n(new Error("timeout"))},t),e.then(r,n)})},_getParameterString:function(t){var e=[];for(var r in t){var n,o=t[r];if(null!=o&&"function"!=typeof o)n=Array.isArray(o)||"[object Object]"===o.toString()?encodeURIComponent(JSON.stringify(o)):encodeURIComponent(o),e.push(encodeURIComponent(r)+"="+n)}return e.join("&")},_isMVTRequest:function(t){return t.indexOf(".mvt")>-1||t.indexOf(".pbf")>-1}},et=r(7915);function rt(t,e){t&&-1===t.indexOf("BEGIN PUBLIC KEY")&&(t="-----BEGIN PUBLIC KEY-----\n".concat(t,"\n-----END PUBLIC KEY-----"));var r=et.pki.publicKeyFromPem(t),n={md:et.md.sha256.create(),mgf1:{md:et.md.sha1.create()}},o=r.encrypt(e,"RSA-OAEP",n);return!!o&&window.btoa(o)}function nt(t,e,r){r=et.util.encodeUtf8(r);var n=et.cipher.createCipher("AES-GCM",t);if(n.start({iv:e,additionalData:"",tagLength:128}),n.update(et.util.createBuffer(r)),n.finish()){var o=n.output,i=n.mode.tag;return window.btoa(o.data+i.data)}return!1}function ot(t){for(var e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",r="",n=t;n>0;--n)r+=e[Math.floor(Math.random()*e.length)];return r}function it(t){"@babel/helpers - typeof";return(it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function at(){at=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new A(n||[]);return o(a,"_invoke",{value:P(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={};function g(){}function m(){}function b(){}var w={};l(w,a,function(){return this});var S=Object.getPrototypeOf,x=S&&S(S(M([])));x&&x!==r&&n.call(x,a)&&(w=x);var _=b.prototype=g.prototype=Object.create(w);function E(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function O(t,e){function r(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==it(c)&&n.call(c,"__await")?e.resolve(c.__await).then(function(t){r("next",t,a,s)},function(t){r("throw",t,a,s)}):e.resolve(c).then(function(t){l.value=t,a(l)},function(t){return r("throw",t,a,s)})}s(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e(function(e,o){r(t,n,e,o)})}return i=i?i.then(o,o):o()}})}function P(e,r,n){var o=h;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=k(s,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function M(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function st(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return ut(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ut(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function mt(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}!function(){w().VectorTileSource&&void 0===w().VectorTileSource.prototype.beforeLoadBak&&(w().VectorTileSource.prototype.beforeLoadBak=w().VectorTileSource.prototype.beforeLoad,w().VectorTileSource.prototype.beforeLoad=function(){var t,e=(t=gt().mark(function t(e,r){var n,o;return gt().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r&&r.tiles&&r.tiles[0],!S.values.includes(e)||!n){t.next=6;break}return t.next=4,dt(n);case 4:o=t.sent,this.decryptKey=o;case 6:this.beforeLoadBak(e,r);case 7:case"end":return t.stop()}},t,this)}),function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){mt(i,n,o,a,s,"next",t)}function s(t){mt(i,n,o,a,s,"throw",t)}a(void 0)})});return function(t,r){return e.apply(this,arguments)}}()),w().Map.prototype.overlayLayersManager={},void 0===w().Map.prototype.addLayerBak&&(w().Map.prototype.addLayerBak=w().Map.prototype.addLayer,w().Map.prototype.addLayer=function(t,e){return t.source||"custom"===t.type||"background"===t.type?(this.addLayerBak(t,e),t.overlay&&!this.overlayLayersManager[t.id]&&(this.overlayLayersManager[t.id]=t),this):this.overlayLayersManager[t.id]||this.style._layers[t.id]?void this.fire("error",{error:new Error("A layer with this id already exists.")}):(function(t,e){t.onAdd&&t.onAdd(e)}(t,this),this.overlayLayersManager[t.id]=t,this)}),w().Map.prototype.getLayer=function(t){return this.overlayLayersManager[t]?this.overlayLayersManager[t]:this.style.getLayer(t)},w().Map.prototype.moveLayer=function(t,e){return this.overlayLayersManager[t]?(this.overlayLayersManager[t].moveLayer?this.overlayLayersManager[t].moveLayer(t,e):function(t,e){var r=document.getElementById(t);if(e){var n=document.getElementById(e);n||w().Evented.prototype.fire("error",{error:new Error('Layer with id "'.concat(e,'" does not exist on this document.'))})}r&&n?n.parentNode.insertBefore(r,n):r.parentNode.appendChild(r)}(t,e),this):this.style._layers[t]?(this.style.moveLayer(t,e),this._update(!0),this):void 0},w().Map.prototype.removeLayer=function(t){return this.overlayLayersManager[t]&&delete this.overlayLayersManager[t],this.style.removeLayer(t),this._update(!0),this},w().Map.prototype.setLayoutProperty=function(t,e,r){return this.overlayLayersManager[t]?("visibility"===e&&(r="visible"===r,n=this.overlayLayersManager[t],o=r,n.setVisibility&&n.setVisibility(o),this.style.fire("data",{dataType:"style"})),this):(this.style.setLayoutProperty(t,e,r),this._update(!0),this);var n,o},w().Map.prototype.updateTransform=function(t,e,r,n,o,i,a){this.transform.units=t;var s=this.mercatorZfromAltitude;w().MercatorCoordinate.fromLngLat=function(t,n){n=n||0;var o=w().LngLat.convert(t);return new(w().MercatorCoordinate)((o.lng-e)/i,(r-o.lat)/a,s(n,o.lat))},w().MercatorCoordinate.prototype.toLngLat=function(){return new(w().LngLat)(this.x*i+e,r-this.y*a)},this.customConvertPoint=window.URL.createObjectURL(new Blob(["customConvertPoint = {projectX:function(x){return (x - "+n+") / "+i+" + 0.5},projectY:function(y){y = 0.5 - ((y - "+o+") / "+a+");return y < 0 ? 0 : y > 1 ? 1 : y;},toY:function(y){return (0.5-y)*"+a+"+"+o+";}}"],{type:"text/javascript"}))}}();function bt(t){"@babel/helpers - typeof";return(bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function wt(t,e){for(var r=0;r"+r+"",this._createStyleSheet(),this._container}},{key:"_createStyleSheet",value:function(){var t=document.createElement("style");t.type="text/css",t.innerHTML=".iclient-logo{margin:0 !important;}.iclient-logo a{border: none;display: block;height:31px;}.iclient-logo img{border: none;white-space: nowrap}",document.getElementsByTagName("head")[0].appendChild(t)}},{key:"_extend",value:function(t){for(var e=0;et.right;)e.lon-=t.getWidth()}return e}},{key:"destroy",value:function(){this.lon=null,this.lat=null}}])&&jt(e.prototype,r),n&&jt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Lt(t){"@babel/helpers - typeof";return(Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Rt(t,e){for(var r=0;rthis.right)&&(this.right=r.right),(null==this.top||r.top>this.top)&&(this.top=r.top))}}},{key:"containsLonLat",value:function(t,e){"boolean"==typeof e&&(e={inclusive:e}),e=e||{};var r=this.contains(t.lon,t.lat,e.inclusive),n=e.worldBounds;if(n&&!r){var o=n.getWidth(),i=(n.left+n.right)/2,a=Math.round((t.lon-i)/o);r=this.containsLonLat({lon:t.lon-a*o,lat:t.lat},{inclusive:e.inclusive})}return r}},{key:"containsPixel",value:function(t,e){return this.contains(t.x,t.y,e)}},{key:"contains",value:function(t,e,r){if(null==r&&(r=!0),null==t||null==e)return!1;var n=!1;return n=r?t>=this.left&&t<=this.right&&e>=this.bottom&&e<=this.top:t>this.left&&tthis.bottom&&e=r.bottom&&t.bottom<=r.top||r.bottom>=t.bottom&&r.bottom<=t.top,a=t.top>=r.bottom&&t.top<=r.top||r.top>t.bottom&&r.top=r.left&&t.left<=r.right||r.left>=t.left&&r.left<=t.right,u=t.right>=r.left&&t.right<=r.right||r.right>=t.left&&r.right<=t.right;n=(i||a)&&(s||u)}if(e.worldBounds&&!n){var l=e.worldBounds,c=l.getWidth(),f=!l.containsBounds(r),h=!l.containsBounds(t);f&&!h?(t=t.add(-c,0),n=r.intersectsBounds(t,{inclusive:e.inclusive})):h&&!f&&(r=r.add(-c,0),n=t.intersectsBounds(r,{inclusive:e.inclusive}))}return n}},{key:"containsBounds",value:function(t,e,r){null==e&&(e=!1),null==r&&(r=!0);var n=this.contains(t.left,t.bottom,r),o=this.contains(t.right,t.bottom,r),i=this.contains(t.left,t.top,r),a=this.contains(t.right,t.top,r);return e?n||o||i||a:n&&o&&i&&a}},{key:"determineQuadrant",value:function(t){var e="",r=this.getCenterLonLat();return e+=t.lat=t.right&&o.right>t.right;)o=o.add(-i,0);var a=o.left+r;at.left&&o.right-n>t.right&&(o=o.add(-i,0))}return o}},{key:"toServerJSONObject",value:function(){return{rightTop:{x:this.right,y:this.top},leftBottom:{x:this.left,y:this.bottom},left:this.left,right:this.right,top:this.top,bottom:this.bottom}}},{key:"destroy",value:function(){this.left=null,this.right=null,this.top=null,this.bottom=null,this.centerLonLat=null}}])&&Rt(e.prototype,r),n&&Rt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Ft(t){"@babel/helpers - typeof";return(Ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Gt(t,e){for(var r=0;r-1)){if(null!=e&&e=0;--r)e=this.removeComponent(t[r])||e;return e}},{key:"removeComponent",value:function(t){return q.removeItem(this.components,t),this.clearBounds(),!0}},{key:"getArea",value:function(){for(var t=0,e=0,r=this.components.length;e=1?1:g)<=-1?-1:g,c=180*Math.acos(g)/Math.PI,a=(c=o.x==r.x?e.x>r.x&&n.x>r.x||e.xh*e.x+p&&n.y>h*n.x+p||e.yr.y?n.xr.x&&(s=!1):o.xh*n.x+p&&(s=!1):o.x>r.x?n.y>r.y&&(s=!1):n.y=0?180*Math.atan(m)/Math.PI:Math.abs(180*Math.atan(m)/Math.PI)+90,w=Math.abs(e.y);r.y==w&&w==o.y&&r.x=0?m>=0?l+=u:l=180-(l-90)+u:l=m>0?l-180+u:90-l+u:S>=0?m>=0?l-=u:l=180-(l-90)-u:l=m>=0?l-180-u:90-l-u,l=l*Math.PI/180;var _=e.x+i*Math.cos(l),E=e.y+i*Math.sin(l);f.push(new Wt(_,E))}f.push(o)}return f}},{key:"createLineEPS",value:function(t){var r=[],n=t.length;if(n<2)return t;for(var o=0;o2;return r&&be(we(e.prototype),"removeComponent",this).apply(this,arguments),r}},{key:"getSortedSegments",value:function(){for(var t,e,r=this.components.length-1,n=new Array(r),o=0;o3;if(r){this.components.pop(),ke(Ce(e.prototype),"removeComponent",this).apply(this,arguments);var n=this.components[0];ke(Ce(e.prototype),"addComponent",this).apply(this,[n])}return r}},{key:"getArea",value:function(){var t=0;if(this.components&&this.components.length>2){for(var e=0,r=0,n=this.components.length;r0){t+=Math.abs(this.components[0].getArea());for(var e=1,r=this.components.length;e0&&r.push(","),r.push(this.writeNewline(),this.writeIndent(),e));return this.level-=1,r.push(this.writeNewline(),this.writeIndent(),"]"),r.join("")},string:function(t){var e={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return/["\\\x00-\x1f]/.test(t)?'"'+t.replace(/([\x00-\x1f\\"])/g,function(t,r){var n=e[r];return n||(n=r.charCodeAt(),"\\u00"+Math.floor(n/16).toString(16)+(n%16).toString(16))})+'"':'"'+t+'"'},number:function(t){return isFinite(t)?String(t):"null"},boolean:function(t){return String(t)},date:function(t){function e(t){return t<10?"0"+t:t}return'"'+t.getFullYear()+"-"+e(t.getMonth()+1)+"-"+e(t.getDate())+"T"+e(t.getHours())+":"+e(t.getMinutes())+":"+e(t.getSeconds())+'"'}},r}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&lr(t,e)}(e,nr),r=e,(n=[{key:"read",value:function(t,e){var r;if(this.nativeJSON)try{r=JSON.parse(t,e)}catch(e){return{data:t}}return this.keepData&&(this.data=r),r}},{key:"write",value:function(t,e){this.pretty=!!e;var r=null,n=or(t);if(this.serialize[n])try{r=!this.pretty&&this.nativeJSON?JSON.stringify(t):this.serialize[n].apply(this,[t])}catch(t){}return r}},{key:"writeIndent",value:function(){var t=[];if(this.pretty)for(var e=0;e0))return null;for(var a=0,s=0,u=[];a0){t+='"points":[';for(var r=0,n=this.components.length;rt[i]){var a=t[i];t[i]=t[o],t[o]=a;var s=e[i];if(e[i]=e[o],e[o]=s,r&&r.length>0){var u=r[i];r[i]=r[o],r[o]=u}if(n&&n.length>0){var l=n[i];n[i]=n[o],n[o]=l}}}}],(r=[{key:"destroy",value:function(){var t=this;t.id=null,t.style=null,t.parts=null,t.partTopo=null,t.points=null,t.type=null,t.prjCoordSys=null}},{key:"toGeometry",value:function(){var t=this;switch(t.type.toUpperCase()){case Qr.POINT:return t.toGeoPoint();case Qr.LINE:return t.toGeoLine();case Qr.LINEM:return t.toGeoLinem();case Qr.REGION:return t.toGeoRegion();case Qr.POINTEPS:return t.toGeoPoint();case Qr.LINEEPS:return t.toGeoLineEPS();case Qr.REGIONEPS:return t.toGeoRegionEPS();case Qr.GEOCOMPOUND:return t.transformGeoCompound()}}},{key:"toGeoPoint",value:function(){var t=this.parts||[],e=this.points||[],r=t.length;if(r>0){if(1===r)return new Wt(e[0].x,e[0].y);for(var n=[],o=0;o0){if(1===r){for(var n=[],o=0;o0){if(1===s){for(t=0,r=[];t=0;b--)if(g[m]=-1,f[b].containsBounds(f[m])){h[m]=-1*h[b],h[m]<0&&(g[m]=b);break}for(var w=0;w0?i.push(c[w]):(i[g[w]].components=i[g[w]].components.concat(c[w].components),i.push(""))}else{i=new Array;for(var S=0;S0&&i.length>0&&(i[i.length-1].components=i[i.length-1].components.concat(u),u=[]),i.push(c[S])),S==o-1){var x=i.length;if(x)i[x-1].components=i[x-1].components.concat(u);else for(var _=0,E=u.length;_=0;w--)if(m[b]=-1,h[w].containsBounds(h[b])){p[b]=-1*p[w],p[b]<0&&(m[b]=w);break}for(var S=0;S0?a.push(f[S]):(a[m[S]].components=a[m[S]].components.concat(f[S].components),a.push(""))}else{a=new Array;for(var x=0;x0&&a.length>0&&(a[a.length-1].components=a[a.length-1].components.concat(l),l=[]),a.push(f[x])),x==o-1){var _=a.length;if(_)a[_-1].components=a[_-1].components.concat(l);else for(var E=0,O=l.length;E-1||(e[n]=t[n]);return e}}])&&Hn(r.prototype,n),o&&Hn(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(),Qn=function(t){return"[object Array]"==Object.prototype.toString.call(t)},Zn=function(t){return"string"==typeof t&&t.constructor===String},$n={toSuperMapGeometry:function(t){if(t&&t.type)return(new Kn).read(t,"FeatureCollection")[0].geometry},toSuperMapBounds:function(t){return Qn(t)?new Bt(t[0],t[1],t[2],t[3]):t instanceof w().LngLatBounds?new Bt(t.getWest(),t.getSouth(),t.getEast(),t.getNorth()):t},toSuperMapPoint:function(t){return Qn(t)?new Wt(t[0],t[1]):t.lng&&t.lat?new Wt(t.lng,t.lat):new Wt(t.geometry.coordinates[0],t.geometry.coordinates[1])},toSuperMapPolygon:function(t){var e=t.getWest(),r=t.getEast(),n=t.getSouth(),o=t.getNorth();return new De([new Ae([new Wt(e,n),new Wt(r,n),new Wt(r,o),new Wt(e,o)])])},isArray:Qn,toGeoJSON:function(t){if(t)return(new Kn).toGeoJSON(t)},toProcessingParam:function(t){var e={};if(t.length<1)e="";else{for(var r=[],n=0;n1e-7;a++)e=1,i+=s=Math.PI/2-2*Math.atan(o*e)-i;return new(w().LngLat)(t[0]*r/n,i*r)},transformUrl:function(t){var e=t.url,r=t.server,n=t.excludePortalProxyUrl,o=t.credentialValue,i=t.credentialKey,a=-1===e.indexOf(".json")?"".concat(e,".json"):e,s="getUrlResource.json?url=";if(n&&r.indexOf(s)>-1){var u=r.split(s);u.length>1&&(a=u[0]+s+a)}return o&&i&&(a+="?"+i+"="+o),a}};function to(t){"@babel/helpers - typeof";return(to="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function eo(t,e){for(var r=0;r1&&(r=parseFloat(r)*l),n.labelAlign&&"cm"!==n.labelAlign)switch(n.labelAlign){case"lt":u.x+=e/2,u.y+=r/2;break;case"lm":u.x+=e/2;break;case"lb":u.x+=e/2,u.y-=r/2;break;case"ct":u.y+=r/2;break;case"cb":u.y-=r/2;break;case"rt":u.x-=e/2,u.y+=r/2;break;case"rm":u.x-=e/2;break;case"rb":u.x-=e/2,u.y-=r/2}return this.bsInfo.h=r,this.bsInfo.w=e,o=u.x-parseFloat(e)/2,i=u.y+parseFloat(r)/2,s=u.x+parseFloat(e)/2,a=u.y-parseFloat(r)/2,new Bt(o,i,s,a)}},{key:"getLabelPxBoundsByText",value:function(t,e){var r,n,o,i,a=this.getLabelPxSize(e),s=q.cloneObject(t);if(e.labelAlign&&"cm"!==e.labelAlign)switch(e.labelAlign){case"lt":s.x+=a.w/2,s.y+=a.h/2;break;case"lm":s.x+=a.w/2;break;case"lb":s.x+=a.w/2,s.y-=a.h/2;break;case"ct":s.y+=a.h/2;break;case"cb":s.y-=a.h/2;break;case"rt":s.x-=a.w/2,s.y+=a.h/2;break;case"rm":s.x-=a.w/2;break;case"rb":s.x-=a.w/2,s.y-=a.h/2}return this.bsInfo.h=a.h,this.bsInfo.w=a.w,r=s.x-a.w/2,n=s.y+a.h/2,i=e.fontStyle&&"italic"===e.fontStyle?s.x+a.w/2+parseInt(parseFloat(e.fontSize)/2):s.x+a.w/2,o=s.y-a.h/2,new Bt(r,n,i,o)}},{key:"getLabelPxSize",value:function(t){var e,r,n,o,i=parseFloat(t.strokeWidth);e=t.label||this.text,r=t.fontSize?parseFloat(t.fontSize):parseFloat("12px");var a=e.split("\n"),s=a.length;o=s>1?r*s+s+i+.2*r:r+i+.2*r+1,n=0,this.labelWTmp&&n255?r++:n++;return e.cnC=r,e.enC=n,e.textC=t.length,e}}])&&eo(r.prototype,n),o&&eo(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function uo(t){"@babel/helpers - typeof";return(uo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function lo(t,e){for(var r=0;r1&&(t=new Wt(e[0],e[1])),new $e(t,this.attributes)}}])&&po(e.prototype,r),n&&po(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function go(t){"@babel/helpers - typeof";return(go="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function mo(t,e){for(var r=0;ri&&(i=t+s+100,n.width=i,r=!0),e+u>a&&(a=e+u+100,n.height=a,r=!0),t<-s&&(i+=s=100*Math.ceil(-t/100),n.width=i,r=!0),e<-u&&(a+=u=100*Math.ceil(-e/100),n.height=a,r=!0),r&&o.translate(s,u)}},{key:"getPixelOffset",value:function(){return{x:this._offsetX,y:this._offsetY}}},{key:"indexOf",value:function(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r3&&(e=Array.prototype.slice.call(e,1));for(var n=this._handlers[t],o=n.length,i=0;i4&&(e=Array.prototype.slice.call(e,1,e.length-1));for(var n=e[e.length-1],o=this._handlers[t],i=o.length,a=0;a-this.EPSILON&&tthis.EPSILON||t<-this.EPSILON}},{key:"cubicAt",value:function(t,e,r,n,o){var i=1-o;return i*i*(i*t+3*o*e)+o*o*(o*n+3*i*r)}},{key:"cubicDerivativeAt",value:function(t,e,r,n,o){var i=1-o;return 3*(((e-t)*i+2*(r-e)*o)*i+(n-r)*o*o)}},{key:"cubicRootAt",value:function(t,e,r,n,o,i){var a=n+3*(e-r)-t,s=3*(r-2*e+t),u=3*(e-t),l=t-o,c=s*s-3*a*u,f=s*u-9*a*l,h=u*u-3*s*l,p=0;if(this.isAroundZero(c)&&this.isAroundZero(f))if(this.isAroundZero(s))i[0]=0;else{var d=-u/s;d>=0&&d<=1&&(i[p++]=d)}else{var y=f*f-4*c*h;if(this.isAroundZero(y)){var v=f/c,g=-s/a+v,m=-v/2;g>=0&&g<=1&&(i[p++]=g),m>=0&&m<=1&&(i[p++]=m)}else if(y>0){var b=Math.sqrt(y),w=c*s+1.5*a*(-f+b),S=c*s+1.5*a*(-f-b),x=(-s-((w=w<0?-Math.pow(-w,this.ONE_THIRD):Math.pow(w,this.ONE_THIRD))+(S=S<0?-Math.pow(-S,this.ONE_THIRD):Math.pow(S,this.ONE_THIRD))))/(3*a);x>=0&&x<=1&&(i[p++]=x)}else{var _=(2*c*s-3*a*f)/(2*Math.sqrt(c*c*c)),E=Math.acos(_)/3,O=Math.sqrt(c),P=Math.cos(E),k=(-s-2*O*P)/(3*a),C=(-s+O*(P+this.THREE_SQRT*Math.sin(E)))/(3*a),T=(-s+O*(P-this.THREE_SQRT*Math.sin(E)))/(3*a);k>=0&&k<=1&&(i[p++]=k),C>=0&&C<=1&&(i[p++]=C),T>=0&&T<=1&&(i[p++]=T)}}return p}},{key:"cubicExtrema",value:function(t,e,r,n,o){var i=6*r-12*e+6*t,a=9*e+3*n-3*t-9*r,s=3*e-3*t,u=0;if(this.isAroundZero(a)){if(this.isNotAroundZero(i)){var l=-s/i;l>=0&&l<=1&&(o[u++]=l)}}else{var c=i*i-4*a*s;if(this.isAroundZero(c))o[0]=-i/(2*a);else if(c>0){var f=Math.sqrt(c),h=(-i+f)/(2*a),p=(-i-f)/(2*a);h>=0&&h<=1&&(o[u++]=h),p>=0&&p<=1&&(o[u++]=p)}}return u}},{key:"cubicSubdivide",value:function(t,e,r,n,o,i){var a=(e-t)*o+t,s=(r-e)*o+e,u=(n-r)*o+r,l=(s-a)*o+a,c=(u-s)*o+s,f=(c-l)*o+l;i[0]=t,i[1]=a,i[2]=l,i[3]=f,i[4]=f,i[5]=c,i[6]=u,i[7]=n}},{key:"cubicProjectPoint",value:function(t,e,r,n,o,i,a,s,u,l,c){var f,h=this.vector.create(),p=this.vector.create(),d=this.vector.create(),y=.005,v=1/0;h[0]=u,h[1]=l;for(var g=0;g<1;g+=.05){p[0]=this.cubicAt(t,r,o,a,g),p[1]=this.cubicAt(e,n,i,s,g);var m=this.vector.distSquare(h,p);m=0&&x=0&&l<=1&&(o[u++]=l)}}else{var c=a*a-4*i*s;if(this.isAroundZero(c)){var f=-a/(2*i);f>=0&&f<=1&&(o[u++]=f)}else if(c>0){var h=Math.sqrt(c),p=(-a+h)/(2*i),d=(-a-h)/(2*i);p>=0&&p<=1&&(o[u++]=p),d>=0&&d<=1&&(o[u++]=d)}}return u}},{key:"quadraticExtremum",value:function(t,e,r){var n=t+r-2*e;return 0===n?.5:(t-e)/n}},{key:"quadraticProjectPoint",value:function(t,e,r,n,o,i,a,s,u){var l,c=this.vector.create(),f=this.vector.create(),h=this.vector.create(),p=.005,d=1/0;c[0]=a,c[1]=s;for(var y=0;y<1;y+=.05){f[0]=this.quadraticAt(t,r,o,y),f[1]=this.quadraticAt(e,n,i,y);var v=this.vector.distSquare(c,f);v=0&&w0){for(var m=this.isInsidePolygon(e.pointList,v,g),b=t.holePolygonPointLists,w=!1,S=0,x=b.length;Se+s&&a>n+s||at+s&&i>r+s||ie+f&&c>n+f&&c>i+f&&c>s+f||ct+f&&l>r+f&&l>o+f&&l>a+f||le+l&&u>n+l&&u>i+l||ut+l&&s>r+l&&s>o+l||sr||f+c=l)return!0;if(i){var h=n;n=this.normalizeRadian(o),o=this.normalizeRadian(h)}else n=this.normalizeRadian(n),o=this.normalizeRadian(o);n>o&&(o+=l);var p=Math.atan2(u,s);return p<0&&(p+=l),p>=n&&p<=o||p+l>=n&&p+l<=o}},{key:"isInsideBrokenLine",value:function(t,e,r,n){for(var o=Math.max(e,10),i=0,a=t.length-1;ir*r}},{key:"isInsideRect",value:function(t,e,r,n,o,i){return o>=t&&o<=t+r&&i>=e&&i<=e+n}},{key:"isInsideCircle",value:function(t,e,r,n,o){return(n-t)*(n-t)+(o-e)*(o-e)e&&i>n||io?ne&&l>n&&l>i&&l>s||l1&&this.swapExtrema(),d=c.cubicAt(e,n,i,s,h[0]),g>1&&(y=c.cubicAt(e,n,i,s,h[1]))),2==g?be&&s>n&&s>i||s=0&&f<=1){for(var h=0,p=u.quadraticAt(e,n,i,f),d=0;da||(l[d]a?0:ir||s<-r)return 0;var c=Math.sqrt(r*r-s*s);if(u[0]=-c,u[1]=c,Math.abs(n-o)>=l){n=0,o=l;var f=i?1:-1;return a>=u[0]+t&&a<=u[1]+t?f:0}if(i){var h=n;n=this.normalizeRadian(o),o=this.normalizeRadian(h)}else n=this.normalizeRadian(n),o=this.normalizeRadian(o);n>o&&(o+=l);for(var p=0,d=0;d<2;d++){var y=u[d];if(y+t>a){var v=Math.atan2(s,y),g=i?1:-1;v<0&&(v=l+v),(v>=n&&v<=o||v+l>=n&&v+l<=o)&&(v>Math.PI/2&&v<1.5*Math.PI&&(g=-g),p+=g)}}return p}},{key:"isInsidePath",value:function(t,e,r,n,o){for(var i=0,a=0,s=0,u=0,l=0,c=!0,f=!0,h="stroke"===(r=r||"fill")||"both"===r,p="fill"===r||"both"===r,d=0;d0&&(p&&(i+=this.windingLine(a,s,u,l,n,o)),0!==i))return!0;u=v[v.length-2],l=v[v.length-1],c=!1,f&&"A"!==y.command&&(f=!1,a=u,s=l)}switch(y.command){case"M":a=v[0],s=v[1];break;case"L":if(h&&this.isInsideLine(a,s,v[0],v[1],e,n,o))return!0;p&&(i+=this.windingLine(a,s,v[0],v[1],n,o)),a=v[0],s=v[1];break;case"C":if(h&&this.isInsideCubicStroke(a,s,v[0],v[1],v[2],v[3],v[4],v[5],e,n,o))return!0;p&&(i+=this.windingCubic(a,s,v[0],v[1],v[2],v[3],v[4],v[5],n,o)),a=v[4],s=v[5];break;case"Q":if(h&&this.isInsideQuadraticStroke(a,s,v[0],v[1],v[2],v[3],e,n,o))return!0;p&&(i+=this.windingQuadratic(a,s,v[0],v[1],v[2],v[3],n,o)),a=v[2],s=v[3];break;case"A":var g=v[0],m=v[1],b=v[2],w=v[3],S=v[4],x=v[5],_=Math.cos(S)*b+g,E=Math.sin(S)*w+m;f?(f=!1,u=_,l=E):i+=this.windingLine(a,s,_,E);var O=(n-g)*w/b+g;if(h&&this.isInsideArcStroke(g,m,w,S,S+x,1-v[7],e,O,o))return!0;p&&(i+=this.windingArc(g,m,w,S,S+x,1-v[7],O,o)),a=Math.cos(S+x)*b+g,s=Math.sin(S+x)*w+m;break;case"z":if(h&&this.isInsideLine(a,s,u,l,e,n,o))return!0;c=!0}}return p&&(i+=this.windingLine(a,s,u,l,n,o)),0!==i}},{key:"getTextWidth",value:function(t,e){var r=t+":"+e;if(this._textWidthCache[r])return this._textWidthCache[r];this._ctx=this._ctx||this.util.getContext(),this._ctx.save(),e&&(this._ctx.font=e);for(var n=0,o=0,i=(t=(t+"").split("\n")).length;othis.TEXT_CACHE_MAX&&(this._textWidthCacheCounter=0,this._textWidthCache={}),n}},{key:"getTextHeight",value:function(t,e){var r=t+":"+e;if(this._textHeightCache[r])return this._textHeightCache[r];this._ctx=this._ctx||this.util.getContext(),this._ctx.save(),e&&(this._ctx.font=e),t=(t+"").split("\n");var n=(this._ctx.measureText("ZH").width+2)*t.length;return this._ctx.restore(),this._textHeightCache[r]=n,++this._textHeightCacheCounter>this.TEXT_CACHE_MAX&&(this._textHeightCacheCounter=0,this._textHeightCache={}),n}}])&&No(e.prototype,r),n&&No(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Do(t){"@babel/helpers - typeof";return(Do="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Bo(t,e){for(var r=0;r1)for(var o=0,i=n-1;o1?Math.ceil(t):t}),e.indexOf("hex")>-1)return"#"+((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1);if(e.indexOf("hs")>-1){var r=this.map(t.slice(1,3),function(t){return t+"%"});t[1]=r[0],t[2]=r[1]}return e.indexOf("a")>-1?(3===t.length&&t.push(1),t[3]=this.adjust(t[3],[0,1]),e+"("+t.slice(0,4).join(",")+")"):e+"("+t.slice(0,3).join(",")+")"}}},{key:"toArray",value:function(t){(t=this.trim(t)).indexOf("rgba")<0&&(t=this.toRGBA(t));var e=[],r=0;return t.replace(/[\d.]+/g,function(t){r<3?t|=0:t=+t,e[r++]=t}),e}},{key:"convert",value:function(t,e){if(!this.isCalculableColor(t))return t;var r=this.getData(t),n=r[3];return void 0===n&&(n=1),t.indexOf("hsb")>-1?r=this._HSV_2_RGB(r):t.indexOf("hsl")>-1&&(r=this._HSL_2_RGB(r)),e.indexOf("hsb")>-1||e.indexOf("hsv")>-1?r=this._RGB_2_HSB(r):e.indexOf("hsl")>-1&&(r=this._RGB_2_HSL(r)),r[3]=n,this.toColor(r,e)}},{key:"toRGBA",value:function(t){return this.convert(t,"rgba")}},{key:"toRGB",value:function(t){return this.convert(t,"rgb")}},{key:"toHex",value:function(t){return this.convert(t,"hex")}},{key:"toHSVA",value:function(t){return this.convert(t,"hsva")}},{key:"toHSV",value:function(t){return this.convert(t,"hsv")}},{key:"toHSBA",value:function(t){return this.convert(t,"hsba")}},{key:"toHSB",value:function(t){return this.convert(t,"hsb")}},{key:"toHSLA",value:function(t){return this.convert(t,"hsla")}},{key:"toHSL",value:function(t){return this.convert(t,"hsl")}},{key:"toName",value:function(t){for(var e in this._nameColors)if(this.toHex(this._nameColors[e])===this.toHex(t))return e;return null}},{key:"trim",value:function(t){return String(t).replace(/\s+/g,"")}},{key:"normalize",value:function(t){if(this._nameColors[t]&&(t=this._nameColors[t]),t=(t=this.trim(t)).replace(/hsv/i,"hsb"),/^#[\da-f]{3}$/i.test(t)){var e=(3840&(t=parseInt(t.slice(1),16)))<<8,r=(240&t)<<4,n=15&t;t="#"+((1<<24)+(e<<4)+e+(r<<4)+r+(n<<4)+n).toString(16).slice(1)}return t}},{key:"lift",value:function(t,e){if(!this.isCalculableColor(t))return t;var r=e>0?1:-1;void 0===e&&(e=0),e=Math.abs(e)>1?1:Math.abs(e),t=this.toRGB(t);for(var n=this.getData(t),o=0;o<3;o++)n[o]=1===r?n[o]*(1-e)|0:(255-n[o])*e+n[o]|0;return"rgb("+n.join(",")+")"}},{key:"reverse",value:function(t){if(!this.isCalculableColor(t))return t;var e=this.getData(this.toRGBA(t));return e=this.map(e,function(t){return 255-t}),this.toColor(e,"rgb")}},{key:"mix",value:function(t,e,r){if(!this.isCalculableColor(t)||!this.isCalculableColor(e))return t;void 0===r&&(r=.5);for(var n=2*(r=1-this.adjust(r,[0,1]))-1,o=this.getData(this.toRGBA(t)),i=this.getData(this.toRGBA(e)),a=o[3]-i[3],s=((n*a==-1?n:(n+a)/(1+n*a))+1)/2,u=1-s,l=[],c=0;c<3;c++)l[c]=o[c]*s+i[c]*u;var f=o[3]*r+i[3]*(1-r);return f=Math.max(0,Math.min(1,f)),1===o[3]&&1===i[3]?this.toColor(l,"rgb"):(l[3]=f,this.toColor(l,"rgba"))}},{key:"random",value:function(){return"#"+Math.random().toString(16).slice(2,8)}},{key:"getData",value:function(e){var r,n,o=(e=this.normalize(e)).match(this.colorRegExp);if(null===o)throw new Error("The color format error");var i,a=[];if(o[2])i=[(r=o[2].replace("#","").split(""))[0]+r[1],r[2]+r[3],r[4]+r[5]],a=this.map(i,function(e){return t.prototype.adjust.call(this,parseInt(e,16),[0,255])});else if(o[4]){var s=o[4].split(",");n=s[3],i=s.slice(0,3),a=this.map(i,function(e){return e=Math.floor(e.indexOf("%")>0?2.55*parseInt(e,0):e),t.prototype.adjust.call(this,e,[0,255])}),void 0!==n&&a.push(this.adjust(parseFloat(n),[0,1]))}else if(o[5]||o[6]){var u=(o[5]||o[6]).split(","),l=parseInt(u[0],0)/360,c=u[1],f=u[2];n=u[3],(a=this.map([c,f],function(e){return t.prototype.adjust.call(this,parseFloat(e)/100,[0,1])})).unshift(l),void 0!==n&&a.push(this.adjust(parseFloat(n),[0,1]))}return a}},{key:"alpha",value:function(t,e){if(!this.isCalculableColor(t))return t;null===e&&(e=1);var r=this.getData(this.toRGBA(t));return r[3]=this.adjust(Number(e).toFixed(4),[0,1]),this.toColor(r,"rgba")}},{key:"map",value:function(t,e){if("function"!=typeof e)throw new TypeError;for(var r=t?t.length:0,n=0;n=e[1]&&(t=e[1]),t}},{key:"isCalculableColor",value:function(t){return t instanceof Array||"string"==typeof t}},{key:"_HSV_2_RGB",value:function(t){var e,r,n,o=t[0],i=t[1],a=t[2];if(0===i)e=255*a,r=255*a,n=255*a;else{var s=6*o;6===s&&(s=0);var u=0|s,l=a*(1-i),c=a*(1-i*(s-u)),f=a*(1-i*(1-(s-u))),h=0,p=0,d=0;0===u?(h=a,p=f,d=l):1===u?(h=c,p=a,d=l):2===u?(h=l,p=a,d=f):3===u?(h=l,p=c,d=a):4===u?(h=f,p=l,d=a):(h=a,p=l,d=c),e=255*h,r=255*p,n=255*d}return[e,r,n]}},{key:"_HSL_2_RGB",value:function(t){var e,r,n,o=t[0],i=t[1],a=t[2];if(0===i)e=255*a,r=255*a,n=255*a;else{var s,u=2*a-(s=a<.5?a*(1+i):a+i-i*a);e=255*this._HUE_2_RGB(u,s,o+1/3),r=255*this._HUE_2_RGB(u,s,o),n=255*this._HUE_2_RGB(u,s,o-1/3)}return[e,r,n]}},{key:"_HUE_2_RGB",value:function(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),6*r<1?t+6*(e-t)*r:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}},{key:"_RGB_2_HSB",value:function(t){var e,r,n=t[0]/255,o=t[1]/255,i=t[2]/255,a=Math.min(n,o,i),s=Math.max(n,o,i),u=s-a,l=s;if(0===u)e=0,r=0;else{r=u/s;var c=((s-n)/6+u/2)/u,f=((s-o)/6+u/2)/u,h=((s-i)/6+u/2)/u;n===s?e=h-f:o===s?e=1/3+c-h:i===s&&(e=2/3+f-c),e<0&&(e+=1),e>1&&(e-=1)}return[e*=360,r*=100,l*=100]}},{key:"_RGB_2_HSL",value:function(t){var e,r,n=t[0]/255,o=t[1]/255,i=t[2]/255,a=Math.min(n,o,i),s=Math.max(n,o,i),u=s-a,l=(s+a)/2;if(0===u)e=0,r=0;else{r=l<.5?u/(s+a):u/(2-s-a);var c=((s-n)/6+u/2)/u,f=((s-o)/6+u/2)/u,h=((s-i)/6+u/2)/u;n===s?e=h-f:o===s?e=1/3+c-h:i===s&&(e=2/3+f-c),e<0&&(e+=1),e>1&&(e-=1)}return[e*=360,r*=100,l*=100]}}])&&Bo(e.prototype,r),n&&Bo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Uo(t){"@babel/helpers - typeof";return(Uo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zo(t,e){for(var r=0;ro&&(o=u[0]),u[1]a&&(a=u[1])}e[0]=n,e[1]=i,r[0]=o,r[1]=a}}},{key:"cubeBezier",value:function(t,e,r,n,o,i){var a=new jo,s=[];a.cubicExtrema(t[0],e[0],r[0],n[0],s);for(var u=0;uo&&!i?o+=2*Math.PI:nn&&(f[0]=Math.cos(p)*r+t,f[1]=Math.sin(p)*r+e,u.min(a,f,a),u.max(s,f,s))}}])&&zo(e.prototype,r),n&&zo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function qo(t){"@babel/helpers - typeof";return(qo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Wo(t,e){for(var r=0;r=200&&o.status<300||304===o.status?e&&e(o.responseText):r&&r(),o.onreadystatechange=new Function,o=null)},o.send(null)}}])&&ti(e.prototype,r),n&&ti(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ni(t){"@babel/helpers - typeof";return(ni="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oi(t,e){for(var r=0;r1)for(var e in arguments)console.log(arguments[e])}}var e,r,n;return e=t,(r=[{key:"destory",value:function(){return!0}}])&&ui(e.prototype,r),n&&ui(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function fi(t){"@babel/helpers - typeof";return(fi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function hi(t,e){for(var r=0;ra-2?a-1:p+1][0]+i[0],e[p>a-2?a-1:p+1][1]+i[1]],m=[e[p>a-3?a-1:p+2][0]+i[0],e[p>a-3?a-1:p+2][1]+i[1]]);var b=d*d,w=d*b;s.push([S(y[0],v[0],g[0],m[0],d,b,w),S(y[1],v[1],g[1],m[1],d,b,w)])}return s;function S(t,e,r,n,o,i,a){var s=.5*(r-t),u=.5*(n-e);return(2*(e-r)+s+u)*a+(-3*(e-r)-2*s-u)*i+s*o+e}}},{key:"SUtil_dashedLineTo",value:function(t,e,r,n,o,i,a){var s=[5,5];if(i="number"!=typeof i?5:i,t.setLineDash)return s[0]=i,s[1]=i,a&&a instanceof Array?t.setLineDash(a):t.setLineDash(s),t.moveTo(e,r),void t.lineTo(n,o);var u=n-e,l=o-r,c=Math.floor(Math.sqrt(u*u+l*l)/i);u/=c,l/=c;for(var f=!0,h=0;h-5e-5&&t<5e-5}xi.Util_vector.sub(e,t,this.position),n(e[0])&&n(e[1])||(xi.Util_vector.normalize(e,e),r[2]=e[0]*this.scale[1],r[3]=e[1]*this.scale[1],r[0]=e[1]*this.scale[0],r[1]=-e[0]*this.scale[0],r[4]=this.position[0],r[5]=this.position[1],this.decomposeTransform())})}var e,r,n;return e=t,(r=[{key:"destroy",value:function(){this.position=null,this.rotation=null,this.scale=null,this.needLocalTransform=null,this.needTransform=null}},{key:"updateNeedTransform",value:function(){function t(t){return t>5e-5||t<-5e-5}this.needLocalTransform=t(this.rotation[0])||t(this.position[0])||t(this.position[1])||t(this.scale[0]-1)||t(this.scale[1]-1)}},{key:"updateTransform",value:function(){if(this.updateNeedTransform(),this.parent?this.needTransform=this.needLocalTransform||this.parent.needTransform:this.needTransform=this.needLocalTransform,this.needTransform){var t=[0,0],e=this.transform||xi.Util_matrix.create();if(xi.Util_matrix.identity(e),this.needLocalTransform){if(o(this.scale[0])||o(this.scale[1])){t[0]=-this.scale[2]||0,t[1]=-this.scale[3]||0;var r=o(t[0])||o(t[1]);r&&xi.Util_matrix.translate(e,e,t),xi.Util_matrix.scale(e,e,this.scale),r&&(t[0]=-t[0],t[1]=-t[1],xi.Util_matrix.translate(e,e,t))}if(this.rotation instanceof Array){if(0!==this.rotation[0]){t[0]=-this.rotation[1]||0,t[1]=-this.rotation[2]||0;var n=o(t[0])||o(t[1]);n&&xi.Util_matrix.translate(e,e,t),xi.Util_matrix.rotate(e,e,this.rotation[0]),n&&(t[0]=-t[0],t[1]=-t[1],xi.Util_matrix.translate(e,e,t))}}else 0!=+this.rotation&&xi.Util_matrix.rotate(e,e,this.rotation);(o(this.position[0])||o(this.position[1]))&&xi.Util_matrix.translate(e,e,this.position)}this.transform=e,this.parent&&this.parent.needTransform&&(this.needLocalTransform?xi.Util_matrix.mul(this.transform,this.parent.transform,this.transform):xi.Util_matrix.copy(this.transform,this.parent.transform))}function o(t){return t>5e-5||t<-5e-5}}},{key:"setTransform",value:function(t){if(this.needTransform){var e=this.transform;t.transform(e[0],e[1],e[2],e[3],e[4],e[5])}}},{key:"decomposeTransform",value:function(){if(this.transform){var t=this.transform,e=t[0]*t[0]+t[1]*t[1],r=this.position,n=this.scale,o=this.rotation;a(e-1)&&(e=Math.sqrt(e));var i=t[2]*t[2]+t[3]*t[3];a(i-1)&&(i=Math.sqrt(i)),r[0]=t[4],r[1]=t[5],n[0]=e,n[1]=i,n[2]=n[3]=0,o[0]=Math.atan2(-t[1]/i,t[0]/e),o[1]=o[2]=0}function a(t){return t>5e-5||t<-5e-5}}}])&&Ei(e.prototype,r),n&&Ei(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ki(t){"@babel/helpers - typeof";return(ki="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ci(t,e){for(var r=0;r0}},{key:"addRoot",value:function(t){t instanceof Li&&t.addChildrenToStorage(this),this.addToMap(t),this._roots.push(t)}},{key:"delRoot",value:function(t){if(void 0===t){for(var e=0;e=0&&(this.delFromMap(i.id),this._roots.splice(a,1),i instanceof Li&&i.delChildrenFromStorage(this))}}},{key:"addToMap",value:function(t){return t instanceof Li&&(t._storage=this),t.modSelf(),this._elements[t.id]=t,this}},{key:"get",value:function(t){return this._elements[t]}},{key:"delFromMap",value:function(t){var e=this._elements[t];return e&&(delete this._elements[t],e instanceof Li&&(e._storage=null)),this}},{key:"dispose",value:function(){this._elements=null,this._roots=null,this._hoverElements=null}}])&&Di(e.prototype,r),n&&Di(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Gi(t){"@babel/helpers - typeof";return(Gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ui(t,e){for(var r=0;r1},isLeftClick:function(t){return t.which&&1===t.which||t.button&&1===t.button},isRightClick:function(t){return t.which&&3===t.which||t.button&&2===t.button},stop:function(t,e){e||(t.preventDefault?t.preventDefault():t.returnValue=!1),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},findElement:function(t,e){for(var r=Zi.element(t);r.parentNode&&(!r.tagName||r.tagName.toUpperCase()!=e.toUpperCase());)r=r.parentNode;return r},observe:function(t,e,r,n){var o=q.getElement(t);if(n=n||!1,"keypress"===e&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||o.attachEvent)&&(e="keydown"),this.observers||(this.observers={}),!o._eventCacheID){var i="eventCacheID_";o.id&&(i=o.id+"_"+i),o._eventCacheID=q.createUniqueID(i)}var a=o._eventCacheID;this.observers[a]||(this.observers[a]=[]),this.observers[a].push({element:o,name:e,observer:r,useCapture:n}),o.addEventListener?"mousewheel"===e?o.addEventListener(e,r,{useCapture:n,passive:!1}):o.addEventListener(e,r,n):o.attachEvent&&o.attachEvent("on"+e,r)},stopObservingElement:function(t){var e=q.getElement(t)._eventCacheID;this._removeElementObservers(Zi.observers[e])},_removeElementObservers:function(t){if(t)for(var e=t.length-1;e>=0;e--){var r=t[e],n=new Array(r.element,r.name,r.observer,r.useCapture);Zi.stopObserving.apply(this,n)}},stopObserving:function(t,e,r,n){n=n||!1;var o=q.getElement(t),i=o._eventCacheID;"keypress"===e&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||o.detachEvent)&&(e="keydown");var a=!1,s=Zi.observers[i];if(s)for(var u=0;!a&&u0&&(this.setCtxGlobalAlpha(t,"stroke",r),t.stroke()),this.setCtxGlobalAlpha(t,"reset",r);break;case"stroke":this.setCtxGlobalAlpha(t,"stroke",r),r.lineWidth>0&&t.stroke(),this.setCtxGlobalAlpha(t,"reset",r);break;default:this.setCtxGlobalAlpha(t,"fill",r),t.fill(),this.setCtxGlobalAlpha(t,"reset",r)}this.drawText(t,r,this.style),this.afterBrush(t)}},{key:"beforeBrush",value:function(t,e){var r=this.style;return this.brushTypeOnly&&(r.brushType=this.brushTypeOnly),e&&(r=this.getHighlightStyle(r,this.highlightStyle||{},this.brushTypeOnly)),"stroke"==this.brushTypeOnly&&(r.strokeColor=r.strokeColor||r.color),t.save(),this.doClip(t),this.setContext(t,r),this.setTransform(t),r}},{key:"afterBrush",value:function(t){t.restore()}},{key:"setContext",value:function(t,e){for(var r=[["color","fillStyle"],["strokeColor","strokeStyle"],["opacity","globalAlpha"],["lineCap","lineCap"],["lineJoin","lineJoin"],["miterLimit","miterLimit"],["lineWidth","lineWidth"],["shadowBlur","shadowBlur"],["shadowColor","shadowColor"],["shadowOffsetX","shadowOffsetX"],["shadowOffsetY","shadowOffsetY"]],n=0,o=r.length;n=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height&&xi.Util_area.isInside(this,this.style,t,e)}},{key:"drawText",value:function(t,r,n){if(void 0!==r.text&&!1!==r.text){var o=r.textColor||r.color||r.strokeColor;t.fillStyle=o;var i,a,s,u,l=10,c=r.textPosition||this.textPosition||"top",f=[];switch(f=this.refOriginalPosition&&2===this.refOriginalPosition.length?this.refOriginalPosition:[0,0],c){case"inside":case"top":case"bottom":case"left":case"right":if(this.getRect){var h=(n||r).__rect||this.getRect(n||r);switch(c){case"inside":s=h.x+h.width/2,u=h.y+h.height/2,i="center",a="middle","stroke"!=r.brushType&&o==r.color&&(t.fillStyle="#fff");break;case"left":s=h.x-l,u=h.y+h.height/2,i="end",a="middle";break;case"right":s=h.x+h.width+l,u=h.y+h.height/2,i="start",a="middle";break;case"top":s=h.x+h.width/2,u=h.y-l,i="center",a="bottom";break;case"bottom":s=h.x+h.width/2,u=h.y+h.height+l,i="center",a="top"}}break;case"start":case"end":var p=0,d=0,y=0,v=0;if(void 0!==r.pointList){var g=r.pointList;if(g.length<2)return;var m=g.length;switch(c){case"start":p=g[0][0]+f[0],d=g[1][0]+f[0],y=g[0][1]+f[1],v=g[1][1]+f[1];break;case"end":p=g[m-2][0]+f[0],d=g[m-1][0]+f[0],y=g[m-2][1]+f[1],v=g[m-1][1]+f[1]}}else p=r.xStart+f[0]||0,d=r.xEnd+f[0]||0,y=r.yStart+f[1]||0,v=r.yEnd+f[1]||0;switch(c){case"start":i=p0&&t>this._zlevelList[0]){for(o=0;ot);o++);n=this._layers[this._zlevelList[o]]}this._zlevelList.splice(o+1,0,t),e=new Da(q.createUniqueID("_levelLayer_"+t),this);var i=n?n.dom:this._bgDom;i.nextSibling?i.parentNode.insertBefore(e.dom,i.nextSibling):i.parentNode.appendChild(e.dom),e.initContext(),this._layers[t]=e,this._layerConfig[t]&&(new wo).merge(e,this._layerConfig[t],!0),e.updateTransform()}return e}},{key:"getLayers",value:function(){return this._layers}},{key:"_updateLayerStatus",value:function(t){var e=this._layers,r={};for(var n in e)"hover"!==n&&(r[n]=e[n].elCount,e[n].elCount=0);for(var o=0;o0?1.1:1/1.1,r=this.painter.getLayers(),n=!1;for(var o in r)if("hover"!==o){var i=r[o],a=i.position;if(i.zoomable){i.__zoom=i.__zoom||1;var s=i.__zoom;s*=e,e=(s=Math.max(Math.min(i.maxZoom,s),i.minZoom))/i.__zoom,i.__zoom=s,a[0]-=(this._mouseX-a[0])*(e-1),a[1]-=(this._mouseY-a[1])*(e-1),i.scale[0]*=e,i.scale[1]*=e,i.dirty=!0,n=!0}}n&&this.painter.refresh(),this._dispatchAgency(this._lastHover,ai.EVENT.MOUSEWHEEL,t),this._mousemoveHandler(t)},mousemove:function(t){this._clickThreshold++,t=this._zrenderEventFixed(t),this._lastX=this._mouseX,this._lastY=this._mouseY,this._mouseX=xi.Util_event.getX(t),this._mouseY=xi.Util_event.getY(t);var e=this._mouseX-this._lastX,r=this._mouseY-this._lastY;this._processDragStart(t),this._hasfound=0,this._event=t,this._iterateAndFindHover(),this._hasfound||((!this._draggingTarget||this._lastHover&&this._lastHover!=this._draggingTarget)&&(this._processOutShape(t),this._processDragLeave(t)),this._lastHover=null,this.storage.delHover(),this.painter.clearHover());var n="";if(this._draggingTarget)this.storage.drift(this._draggingTarget.id,e,r),this._draggingTarget.modSelf(),this.storage.addHover(this._draggingTarget);else if(this._isMouseDown){var o=this.painter.getLayers(),i=!1;for(var a in o)if("hover"!==a){var s=o[a];s.panable&&(n="move",s.position[0]+=e,s.position[1]+=r,i=!0,s.dirty=!0)}i&&this.painter.refresh()}this._draggingTarget||this._hasfound&&this._lastHover.draggable?n="move":this._hasfound&&this._lastHover.clickable&&(n="pointer"),this.root.style.cursor=n,this._dispatchAgency(this._lastHover,ai.EVENT.MOUSEMOVE,t),(this._draggingTarget||this._hasfound||this.storage.hasHoverShape())&&this.painter.refreshHover()},mouseout:function(t){var e=(t=this._zrenderEventFixed(t)).toElement||t.relatedTarget;if(e!=this.root)for(;e&&9!=e.nodeType;){if(e==this.root)return void this._mousemoveHandler(t);e=e.parentNode}t.zrenderX=this._lastX,t.zrenderY=this._lastY,this.root.style.cursor="",this._isMouseDown=0,this._processOutShape(t),this._processDrop(t),this._processDragEnd(t),this.painter.refreshHover(),this.dispatch(ai.EVENT.GLOBALOUT,t)},mousedown:function(t){if(this._clickThreshold=0,2==this._lastDownButton)return this._lastDownButton=t.button,void(this._mouseDownTarget=null);this._lastMouseDownMoment=new Date,t=this._zrenderEventFixed(t),this._isMouseDown=1,this._mouseDownTarget=this._lastHover,this._dispatchAgency(this._lastHover,ai.EVENT.MOUSEDOWN,t),this._lastDownButton=t.button},mouseup:function(t){t=this._zrenderEventFixed(t),this.root.style.cursor="",this._isMouseDown=0,this._mouseDownTarget=null,this._dispatchAgency(this._lastHover,ai.EVENT.MOUSEUP,t),this._processDrop(t),this._processDragEnd(t)},touchstart:function(t){t=this._zrenderEventFixed(t,!0),this._lastTouchMoment=new Date,this._mobildFindFixed(t),this._mousedownHandler(t)},touchmove:function(t){t=this._zrenderEventFixed(t,!0),this._mousemoveHandler(t),this._isDragging&&xi.Util_event.stop(t)},touchend:function(t){t=this._zrenderEventFixed(t,!0),this._mouseupHandler(t);var e=new Date;e-this._lastTouchMoment=0;o--){var i=r[o];if(void 0!==i.zlevel&&(t=this.painter.getLayer(i.zlevel,t),n[0]=this._mouseX,n[1]=this._mouseY,t.needTransform&&(xi.Util_matrix.invert(e,t.transform),xi.Util_vector.applyTransform(n,n,e))),this._findHover(i,n[0],n[1]))break}}},{key:"_mobildFindFixed",value:function(t){var e=[{x:10},{x:-20},{x:10,y:10},{y:-20}];this._lastHover=null,this._mouseX=t.zrenderX,this._mouseY=t.zrenderY,this._event=t,this._iterateAndFindHover();for(var r=0;!this._lastHover&&r=0&&this._clips.splice(e,1)}},{key:"_update",value:function(){for(var t=(new Date).getTime(),e=t-this._time,r=this._clips,n=r.length,o=[],i=[],a=0;a=0&&!(y[w]<=a);w--);w=Math.min(w,l-2)}else{for(w=P;wa);w++);w=Math.min(w-1,l-2)}P=w,k=a;var s=y[w+1]-y[w];if(0!==s){var c,d;for(S=(a-y[w])/s,i?(_=v[w],x=v[0===w?w:w-1],E=v[w>l-2?l-1:w+1],O=v[w>l-3?l-1:w+2],f?ls._catmullRomInterpolateArray(x,_,E,O,S,S*S,S*S*S,n(t,u),p):(c=h?ls.rgba2String(C):ls._catmullRomInterpolate(x,_,E,O,S,S*S,S*S*S),r(t,u,c))):f?ls._interpolateArray(v[w],v[w+1],S,n(t,u),p):(h?(ls._interpolateArray(v[w],v[w+1],S,C,1),d=ls.rgba2String(C)):d=ls._interpolateNumber(v[w],v[w+1],S),r(t,u,d)),w=0;w=0;e--)t[e].destroy()}}},{key:"setVisibility",value:function(t){t!==this.visibility&&(this.visibility=t,this.display(t),this.redrawThematicFeatures(this.map.getBounds()))}},{key:"display",value:function(t){this.div.style.display=t?"block":"none"}},{key:"setOpacity",value:function(t){if(t!==this.opacity){this.opacity=t;var e=this.div;q.modifyDOMElement(e,null,null,null,null,null,null,t),null!==this.map&&w().Evented.prototype.fire("changelayer",{layer:this,property:"opacity"})}}},{key:"addFeatures",value:function(t){}},{key:"removeFeatures",value:function(t){var e=this;if(t){if(t===e.features)return e.removeAllFeatures();q.isArray(t)||"function"==typeof t||(t=[t]);for(var r=[],n=0;n=r.left&&a.x<=r.right&&a.y>=r.top&&a.y<=r.bottom){n=!0;break}}return n}},{key:"clearCache",value:function(){this.cache={},this.charts=[]}},{key:"removeFeatures",value:function(t){this.clearCache(),Ms(js(e.prototype),"removeFeatures",this).call(this,t)}},{key:"removeAllFeatures",value:function(){this.clearCache(),Ms(js(e.prototype),"removeAllFeatures",this).call(this)}},{key:"redraw",value:function(){return this.clearCache(),!!this.renderer&&(this.redrawThematicFeatures(this.map.getBounds()),!0)}},{key:"clear",value:function(){this.renderer&&(this.renderer.clearAll(),this.renderer.refresh()),this.removeAllFeatures(),this.clearCache()}}])&&Cs(r.prototype,n),o&&Cs(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function Ls(t){"@babel/helpers - typeof";return(Ls="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Rs(t,e){for(var r=0;rn&&(n=u[0]),u[1]o&&(o=u[1]))}return t.__rect={x:e,y:r,width:n-e,height:o-r},t.__rect}},{key:"getRectNoRotation",value:function(t){this.refOriginalPosition&&2===this.refOriginalPosition.length||(this.refOriginalPosition=[0,0]);var e,r=this.refOriginalPosition,n=xi.Util_area.getTextHeight("ZH",t.textFont),o=xi.Util_area.getTextWidth(t.text,t.textFont),i=xi.Util_area.getTextHeight(t.text,t.textFont),a=t.x+r[0];"end"==t.textAlign||"right"==t.textAlign?a-=o:"center"==t.textAlign&&(a-=o/2),e="top"==t.textBaseline?t.y+r[1]:"bottom"==t.textBaseline?t.y+r[1]-i:t.y+r[1]-i/2;var s,u=!1;if(t.maxWidth){var l=parseInt(t.maxWidth);l-1&&(o+=!0===u?n/3*(o/s):n/3));return{x:a,y:e,width:o,height:i}}},{key:"getTextBackground",value:function(t,e){this.refOriginalPosition&&2===this.refOriginalPosition.length||(this.refOriginalPosition=[0,0]);var r=this.refOriginalPosition;if(!e&&t.__textBackground)return t.__textBackground;var n=this.getRectNoRotation(t),o=t.x+r[0],i=t.y+r[1],a=[];if(t.textRotation&&0!==t.textRotation){var s=t.textRotation,u=this.getRotatedLocation(n.x,n.y,o,i,s),l=this.getRotatedLocation(n.x+n.width,n.y,o,i,s),c=this.getRotatedLocation(n.x+n.width,n.y+n.height,o,i,s),f=this.getRotatedLocation(n.x,n.y+n.height,o,i,s);a.push(u),a.push(l),a.push(c),a.push(f)}else{var h=[n.x,n.y],p=[n.x+n.width,n.y],d=[n.x+n.width,n.y+n.height],y=[n.x,n.y+n.height];a.push(h),a.push(p),a.push(d),a.push(y)}return t.__textBackground=a,t.__textBackground}},{key:"getRotatedLocation",value:function(t,e,r,n,o){var i,a,s=new Array;return e=-e,n=-n,o=-o,i=(t-r)*Math.cos(o/180*Math.PI)-(e-n)*Math.sin(o/180*Math.PI)+r,a=(t-r)*Math.sin(o/180*Math.PI)+(e-n)*Math.cos(o/180*Math.PI)+n,s[0]=i,s[1]=-a,s}}])&&ol(r.prototype,n),o&&ol(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function fl(t){"@babel/helpers - typeof";return(fl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function hl(t,e){for(var r=0;r0&&("stroke"==r.brushType||"both"==r.brushType)&&(n||(t.beginPath(),this.buildPath(t,r)),this.setCtxGlobalAlpha(t,"stroke",r),t.stroke(),this.setCtxGlobalAlpha(t,"reset",r)),this.drawText(t,r,this.style);var o=q.cloneObject(r);if(o.pointList&&this.holePolygonPointLists&&this.holePolygonPointLists.length>0)for(var i=this.holePolygonPointLists,a=i.length,s=0;s0&&("stroke"==o.brushType||"both"==o.brushType)?(n||(t.beginPath(),this.buildPath(t,o)),t.globalCompositeOperation="source-over",this.setCtxGlobalAlpha(t,"stroke",o),t.stroke(),this.setCtxGlobalAlpha(t,"reset",o)):t.globalCompositeOperation="source-over"}t.restore()}},{key:"buildPath",value:function(t,e){e.showShadow&&(t.shadowBlur=e.shadowBlur,t.shadowColor=e.shadowColor,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY),this.refOriginalPosition&&2===this.refOriginalPosition.length||(this.refOriginalPosition=[0,0]);var r=this.refOriginalPosition,n=e.pointList;if(!(n.length<2))if(e.smooth&&"spline"!==e.smooth){var o,i,a,s=xi.SUtil_smoothBezier(n,e.smooth,!0,e.smoothConstraint,r);t.moveTo(n[0][0]+r[0],n[0][1]+r[1]);for(var u=n.length,l=0;li&&(i=u[l][0]+r[0]),u[l][1]+r[1]s&&(s=u[l][1]+r[1]);return n="stroke"==t.brushType||"fill"==t.brushType?t.lineWidth||1:0,t.__rect={x:Math.round(o-n/2),y:Math.round(a-n/2),width:i-o+n,height:s-a+n},t.__rect}}])&&wl(r.prototype,n),o&&wl(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function kl(t){"@babel/helpers - typeof";return(kl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Cl(t,e){for(var r=0;rc&&(r*=c/(a=r+n),n*=c/a),o+i>c&&(o*=c/(a=o+i),i*=c/a),n+o>f&&(n*=f/(a=n+o),o*=f/a),r+i>f&&(r*=f/(a=r+i),i*=f/a),t.moveTo(u+r,l),t.lineTo(u+c-n,l),0!==n&&t.quadraticCurveTo(u+c,l,u+c,l+n),t.lineTo(u+c,l+f-o),0!==o&&t.quadraticCurveTo(u+c,l+f,u+c-o,l+f),t.lineTo(u+i,l+f),0!==i&&t.quadraticCurveTo(u,l+f,u,l+f-i),t.lineTo(u,l+r),0!==r&&t.quadraticCurveTo(u,l,u+r,l)}},{key:"buildPath",value:function(t,e){this.refOriginalPosition&&2===this.refOriginalPosition.length||(this.refOriginalPosition=[0,0]);var r=this.refOriginalPosition;e.radius?this._buildRadiusPath(t,e):(t.moveTo(e.x+r[0],e.y+r[1]),t.lineTo(e.x+r[0]+e.width,e.y+r[1]),t.lineTo(e.x+r[0]+e.width,e.y+r[1]+e.height),t.lineTo(e.x+r[0],e.y+r[1]+e.height),t.lineTo(e.x+r[0],e.y+r[1])),t.closePath()}},{key:"getRect",value:function(t){this.refOriginalPosition&&2===this.refOriginalPosition.length||(this.refOriginalPosition=[0,0]);var e,r=this.refOriginalPosition;return t.__rect?t.__rect:(e="stroke"==t.brushType||"fill"==t.brushType?t.lineWidth||1:0,t.__rect={x:Math.round(t.x+r[0]-e/2),y:Math.round(t.y+r[1]-e/2),width:t.width+e,height:t.height+e},t.__rect)}}])&&Rl(r.prototype,n),o&&Rl(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function Vl(t){"@babel/helpers - typeof";return(Vl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Hl(t,e){for(var r=0;r1?xi.Util_computeBoundingBox.arc(a,s,u,c,f,!h,r,o):(r[0]=o[0]=a,r[1]=o[1]=s),xi.Util_computeBoundingBox.arc(a,s,l,c,f,!h,n,i),xi.Util_vector.min(r,r,n),xi.Util_vector.max(o,o,i),t.__rect={x:r[0],y:r[1],width:o[0]-r[0],height:o[1]-r[1]},t.__rect}}])&&Hl(r.prototype,n),o&&Hl(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function Ql(t){"@babel/helpers - typeof";return(Ql="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Zl(t,e){for(var r=0;r=15){var h=parseInt(i.axis3DParameter),p=[o[0]-h,o[1]+h];i.axisUseArrow?(c.push([p[0]+1.5,p[1]-7.5]),c.push([p[0]-1,p[1]+1]),c.push([p[0]+7.5,p[1]-1.5]),f.push([p[0],p[1]])):f.push([p[0],p[1]]),f.push([o[0],o[1]])}f.push([o[2]+5,o[1]])}else{var d=Math.abs(o[1]-o[3])/l,y=o[3];f.push([o[0],y-5]);for(var v=0;v=15){var m=parseInt(i.axis3DParameter),b=[o[0]-m,o[1]+m];i.axisUseArrow?(c.push([b[0]+1.5,b[1]-7.5]),c.push([b[0]-1,b[1]+1]),c.push([b[0]+7.5,b[1]-1.5]),f.push([b[0],b[1]])):f.push([b[0],b[1]]),f.push([o[0],o[1]])}f.push([o[2]+5,o[1]])}if(i.axisUseArrow){var w=[[o[2]+5,o[1]+4],[o[2]+13,o[1]],[o[2]+5,o[1]-4]],S=[[o[0]-4,o[3]-5],[o[0],o[3]-13],[o[0]+4,o[3]-5]],x=new uu(w);x.style={fillColor:"#008acd"},q.copyAttributesWithClip(x.style,i.axisStyle),s.push(t.createShape(x));var _=new uu(S);if(_.style={fillColor:"#008acd"},q.copyAttributesWithClip(_.style,i.axisStyle),s.push(t.createShape(_)),i.axis3DParameter&&!isNaN(i.axis3DParameter)&&i.axis3DParameter>=15){var E=new uu(c);E.style={fillColor:"#008acd"},q.copyAttributesWithClip(E.style,i.axisStyle),s.push(t.createShape(E))}}var O=new tu(f);O.style={strokeLinecap:"butt",strokeLineJoin:"round",strokeColor:"#008acd",strokeWidth:1},i.axisStyle&&q.copyAttributesWithClip(O.style,i.axisStyle),O.clickable=!1,O.hoverable=!1;var P=[t.createShape(O)],k=[];if(i.axisYLabels&&i.axisYLabels.length&&i.axisYLabels.length>0){var C=i.axisYLabels,T=C.length,A=[0,0];if(i.axisYLabelsOffset&&i.axisYLabelsOffset.length&&(A=i.axisYLabelsOffset),1==T){var M=new ju(o[0]-5+A[0],o[3]+A[1],C[0]);M.style={labelAlign:"right"},i.axisYLabelsStyle&&q.copyAttributesWithClip(M.style,i.axisYLabelsStyle),M.clickable=!1,M.hoverable=!1,k.push(t.createShape(M))}else for(var j=o[3],I=Math.abs(o[1]-o[3])/(T-1),N=0;N0){var D=i.axisXLabels,B=D.length,F=[0,0];if(i.axisXLabelsOffset&&i.axisXLabelsOffset.length&&(F=i.axisXLabelsOffset),n&&n.xPositions&&n.xPositions.length&&n.xPositions.length==B)for(var G=n.xPositions,U=0;U=0&&r[o]&&q.copyAttributesWithClip(a,r[o]),n&&n.length&&void 0!==i)for(var s=n,u=s.length,l=parseFloat(i),c=0;c0){var l=i[i.length-1];if(Math.abs(l[0]-n[0])<=a&&Math.abs(l[1]-n[1])<=a)continue}i.push(n)}if(i.length<2)return null;var c=new Object;(c=q.copyAttributesWithClip(c,this.style,["pointList"])).pointList=i;var f=new Nl({style:c,clickable:this.isClickAble,hoverable:this.isHoverAble});this.highlightStyle&&(f.highlightStyle=this.highlightStyle),f.refOriginalPosition=this.location,f.refDataID=this.data.id,f.isHoverByRefDataID=this.isMultiHover,this.shapeOptions&&q.copyAttributesWithClip(f,this.shapeOptions),this.shapes.push(f)}},{key:"multiPointToTF",value:function(t){for(var e=t.components,r=[],n=[],o=this.location,i=[],a=this.nodesClipPixel,s=0;s0){var l=i[i.length-1];if(Math.abs(l[0]-n[0])<=a&&Math.abs(l[1]-n[1])<=a)continue}i.push(n);var c=new Object;c.r=6,(c=q.copyAttributesWithClip(c,this.style)).x=n[0],c.y=n[1];var f=new rl({style:c,clickable:this.isClickAble,hoverable:this.isHoverAble});this.highlightStyle&&(f.highlightStyle=this.highlightStyle),f.refOriginalPosition=o,f.refDataID=this.data.id,f.isHoverByRefDataID=this.isMultiHover,this.shapeOptions&&q.copyAttributesWithClip(f,this.shapeOptions),this.shapes.push(f)}}},{key:"multiLineStringToTF",value:function(t){for(var e=t.components,r=0;r0){var h=i[i.length-1];if(Math.abs(h[0]-n[0])<=u&&Math.abs(h[1]-n[1])<=u)continue}i.push(n)}}else{a=[];for(var p=0;p0){var d=a[a.length-1];if(Math.abs(d[0]-n[0])<=u&&Math.abs(d[1]-n[1])<=u)continue}a.push(n)}}a.length<2||s.push(a)}if(!(i.length<2)){var y={};(y=q.copyAttributesWithClip(y,this.style,["pointList"])).pointList=i;var v=new Pl({style:y,clickable:this.isClickAble,hoverable:this.isHoverAble});this.highlightStyle&&(v.highlightStyle=this.highlightStyle),v.refOriginalPosition=this.location,v.refDataID=this.data.id,v.isHoverByRefDataID=this.isMultiHover,s.length>0&&(v.holePolygonPointLists=s),this.shapeOptions&&q.copyAttributesWithClip(v,this.shapeOptions),this.shapes.push(v)}}},{key:"rectangleToTF",value:function(t){var e=this.location,r=new Nt(t.x,t.y),n=this.layer.map.getResolution(),o=this.getLocalXY(r),i=new Object;i.r=6,(i=q.copyAttributesWithClip(i,this.style)).x=o[0]-e[0],i.y=o[1]-e[1]-2*t.width/n,i.width=t.width/n,i.height=t.height/n;var a=new zl({style:i,clickable:this.isClickAble,hoverable:this.isHoverAble});this.highlightStyle&&(a.highlightStyle=this.highlightStyle),a.refOriginalPosition=e,a.refDataID=this.data.id,a.isHoverByRefDataID=this.isMultiHover,this.shapeOptions&&q.copyAttributesWithClip(a,this.shapeOptions),this.shapes.push(a)}},{key:"geoTextToTF",value:function(t){var e=this.location,r=this.getLocalXY(t),n=new Object;n.r=6,(n=q.copyAttributesWithClip(n,this.style,["x","y","text"])).x=r[0]-e[0],n.y=r[1]-e[1],n.text=t.text;var o=new cl({style:n,clickable:this.isClickAble,hoverable:this.isHoverAble});this.highlightStyle&&(o.highlightStyle=this.highlightStyle),o.refOriginalPosition=e,o.refDataID=this.data.id,o.isHoverByRefDataID=this.isMultiHover,this.shapeOptions&&q.copyAttributesWithClip(o,this.shapeOptions),this.shapes.push(o)}},{key:"updateAndAddShapes",value:function(){var t=this.getLocalXY(this.lonlat);this.location=t;for(var e=this.layer.renderer,r=0,n=this.shapes.length;rs){var h=i[0];i.splice(0,1),delete o[h]}}}if(this.renderer.render(),r&&this.isHoverAble&&this.isMultiHover){var p=this.getShapesByFeatureID(r);this.renderer.updateHoverShapes(p)}}},{key:"createThematicFeature",value:function(t){var e=q.copyAttributesWithClip(this.style);t.style&&!0===this.isAllowFeatureStyle&&(e=q.copyAttributesWithClip(t.style));var r={};r.nodesClipPixel=this.nodesClipPixel,r.isHoverAble=this.isHoverAble,r.isMultiHover=this.isMultiHover,r.isClickAble=this.isClickAble,r.highlightStyle=tc.transformStyle(this.highlightStyle);for(var n=new cc(t,this,tc.transformStyle(e),r),o=0;o0&&0==this.labelFeatures.length)for(var r=this.setLabelsStyle(this.features),n=0,o=r.length;n=0&&d.x<=f.x&&d.y>=0&&d.y<=f.y){if(r.style.minZoomLevel>-1&&l<=r.style.minZoomLevel)continue;if(r.style.maxZoomLevel>-1&&l>r.style.maxZoomLevel)continue;var y=null;r.isStyleChange?(r.isStyleChange=null,y=this.calculateLabelBounds(r,d)):y=r.geometry.bsInfo.w&&r.geometry.bsInfo.h?this.calculateLabelBounds2(r,d):this.calculateLabelBounds(r,d);var v=new Bt(0,f.y,f.x,0),g=y.length;if(this.isAvoid){var m=this.getAvoidInfo(v,y);if(m){if("left"===m.aspectW){r.style.labelXOffset+=m.offsetX;for(var b=0;b=o[u].start&&a=o[u].start&&as&&(s=r,u="top")}if(e.y>t.bottom){var n=Math.abs(e.y-t.bottom);n>s&&(s=n,u="bottom")}if(e.xa&&(a=o,l="left")}if(e.x>t.right){var i=Math.abs(e.x-t.right);i>a&&(a=i,l="right")}}}}},{key:"isQuadrilateralOverLap",value:function(t,e){var r=t.length,n=e.length;if(5!==r||5!==n)return null;for(var o=!1,i=0;it-n&&r.time1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[-180,180],o=n[1],i=n[0],a=o-i;return t===o&&e?t:t===i&&r?t:0===((t-i)%a+a)%a&&e?o:((t-i)%a+a)%a+i}function zc(t){var e=parseInt(t),r=parseInt(60*(t-e)),n=parseInt(60*(60*(t-e)-r));return r=0===parseInt(r/10)?"0".concat(r):r,n=0===parseInt(n/10)?"0".concat(n):n,"".concat(e,"°").concat(r,"'").concat(n)}function Vc(t,e,r){return 1/(t*e*(1/.0254)*Gc(r))}function Hc(t){"@babel/helpers - typeof";return(Hc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function qc(t,e){for(var r=0;rthis.mapVOptions.maxZoom)}},{key:"_getResolution",value:function(){var t=this.map.getBounds(),e=(t.getEast()-t.getWest())/this.map.getCanvas().getBoundingClientRect().width;return Gc("DEGREE")*e}},{key:"_getCenterPixel",value:function(){return this.map.project(new(w().LngLat)(0,0))}},{key:"addData",value:function(t,e){this.renderer.addData(t,e)}},{key:"update",value:function(t){this.renderer.update(t)}},{key:"getData",value:function(){return this.renderer&&(this.dataSet=this.renderer.getData()),this.dataSet}},{key:"removeData",value:function(t){this.renderer&&this.renderer.removeData(t)}},{key:"clearData",value:function(){this.renderer.clearData()}},{key:"show",value:function(){return this.renderer&&this.renderer.show(),this}},{key:"hide",value:function(){return this.renderer&&this.renderer.hide(),this}},{key:"getTopLeft",value:function(){var t,e=this.map;e&&(t=e.getBounds().getNorthWest());return t}},{key:"bindEvent",value:function(){var t=this.map;this.mapVOptions.methods&&(this.mapVOptions.methods.click&&t.on("click",this.renderer.clickEvent),this.mapVOptions.methods.mousemove&&t.on("mousemove",this.renderer.mousemoveEvent))}},{key:"unbindEvent",value:function(){var t=this.map;this.mapvOptions.methods&&(this.mapvOptions.methods.click&&t.off("click",this.clickEvent),this.mapvOptions.methods.mousemove&&t.off("mousemove",this.mousemoveEvent))}},{key:"setVisibility",value:function(t){t!==this.visibility&&(this.visibility=t,t?this.show():this.hide())}},{key:"setZIndex",value:function(t){this.renderer.setZIndex(t)}}])&&qc(e.prototype,r),n&&qc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Xc(t){"@babel/helpers - typeof";return(Xc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Jc(t,e){for(var r=0;r",a="
    "+(e._createLegendElement.call(e)||"")+"
    ";this._container.innerHTML=i+a}return e._appendLegendCSSStyle(),this._container},r.prototype.onRemove=function(){this._container.parentNode.removeChild(this._container),this._map=void 0},new r}},{key:"_createLegendElement",value:function(){}},{key:"_addLayer",value:function(){var t=this.getLayerStyleOptions(),e=this.id?this.id:"theme3DLayer",r=this.sourceId=e+"Source";this.map.getSource(r)?(this.map.removeSource(r),this.map.addSource(r,{type:"geojson",data:this.data})):this.map.addSource(r,{type:"geojson",data:this.data}),this.map.addLayer({id:e,type:"fill-extrusion",source:r,paint:t}),this.map.moveLayer(e)}},{key:"_addHighLightLayer",value:function(){if(this.map){var t=this.map;t.addLayer({id:this._highlightLayerId,type:"fill-extrusion",source:this.sourceId,paint:this.getHighlightStyleOptions(),filter:["in","$id",""]}),this._selectFeatureId=null,t.on("mousemove",this.id,this._onMouseMove.bind(this)),t.on("mouseout",this.id,this._onMouseMove.bind(this))}}},{key:"_onMouseMove",value:function(t){var e=this,r=this.map,n=r.queryRenderedFeatures(t.point,{layers:[e.id]});if(e.highlight&&e.highlight.callback&&e.highlight.callback(n,t),!n||n.length<1)return e._clearHighlight.call(e),void(e._selectFeatureId=null);var o=n[0].id;e._selectFeatureId!==o&&(e._selectFeatureId=o,r.setFilter(e._highlightLayerId,["==","$id",e._selectFeatureId]))}},{key:"_clearHighlight",value:function(){this.map&&this.map.setFilter(this._highlightLayerId,["in","$id",""])}},{key:"_appendLegendCSSStyle",value:function(){var t=document.createElement("style");t.type="text/css";t.innerHTML="\n .legend {\n display: inline-block;\n border-radius: 2px;\n -moz-border-radius: 2px;\n -webkit-border-radius: 2px;\n font-size: 12px;\n color: rgba(0, 0, 0, 0.8);\n background-color: rgb(255, 255, 255);\n }\n .legend-light {\n color: rgba(0, 0, 0, 0.8);\n background-color: rgb(255, 255, 255);\n box-shadow: 0px 0px 6px #bbbbbb;\n -moz-box-shadow: 0px 6px 10px #bbbbbb;\n -webkit-box-shadow: 0px 0px 6px #bbbbbb;\n }\n .legend-dark {\n color: rgba(255, 255, 255, 0.8);\n background-color: rgb(64, 64, 64);\n }\n .legend .legend-title {\n min-height: 14px;\n max-width: 500px;\n padding:6px 10px;\n }\n .legend-light .legend-title {\n color: rgba(0, 0, 0, 0.8);\n }\n .legend-dark .legend-title {\n color: rgba(255, 255, 255, 0.8);\n }\n .legend-content{\n padding:6px 10px;\n }\n "+this._legendCSSStyle(),document.getElementsByTagName("head")[0].appendChild(t)}},{key:"_legendCSSStyle",value:function(){return"\n .legend ul {\n padding: 0;\n margin: 0 16px;\n height: 100%;\n display: block;\n list-style: none;\n }\n\n .legend li {\n vertical-align: middle;\n }\n\n .legend li span:first-child {\n vertical-align: middle;\n }\n\n .legend li span:last-child {\n line-height: 28px;\n max-width: 200px;\n vertical-align: middle;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n -ms-text-overflow: ellipsis;\n }\n\n .legend-vertical li {\n height: 28px;\n }\n\n .legend-vertical li span:first-child {\n display: inline-block;\n width: 60px;\n height: 100%;\n }\n\n .legend-vertical li span:last-child {\n display: inline-block;\n margin-left: 16px;\n height: 100%;\n }\n\n .legend-horizontal li {\n height: 56px;\n float: left;\n }\n\n .legend-horizontal li span:first-child {\n display: block;\n width: 100%;\n height: 50%;\n }\n\n .legend-horizontal li span:last-child {\n display: block;\n vertical-align: middle;\n width: 60px;\n height: 50%;\n text-align: center;\n }\n "}},{key:"_extend",value:function(t){for(var e=0;e";for(t=0;t "+o;else o=o+"-"+this._getWrapperText(this.colorStops[t+1][0]);r+="
  • "+o+"
  • "}return r+=""}},{key:"_getWrapperText",value:function(t){var e=t*(null==this.legendRatio?1:parseFloat(this.legendRatio)),r=parseFloat(e);return r%1e6<=1e6?r.toString():parseInt(r/1e3)+"k"}}])&&$c(r.prototype,n),o&&$c(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function sf(t){"@babel/helpers - typeof";return(sf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function uf(t,e){for(var r=0;r0&&r.attributes){var n=this.themeField,o=r.attributes,i=this.styleGroups,a=!1,s=null;for(var u in o)if(n===u){a=!0,s=o[u];break}if(a)for(var l=0,c=i.length;l=i[l].start&&s"+n+""}return t+=""}}])&&xf(r.prototype,n),o&&xf(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function Tf(t){"@babel/helpers - typeof";return(Tf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Af(t,e){for(var r=0;r0&&r.attributes){var n=this.themeField,o=r.attributes,i=this.styleGroups,a=!1,s=null;for(var u in o)if(n===u){a=!0,s=o[u];break}if(a)for(var l=0,c=i.length;l0&&void 0!==arguments[0]?arguments[0]:null;if(!t||0===t.length||t===this.graphics)return this.graphics.length=0,this.layer.props.data&&(this.layer.props.data.length=0),void this.update();q.isArray(t)||(t=[t]);for(var e=t.length-1;e>=0;e--){var r=t[e],n=q.indexOf(this.graphics,r);-1!==n&&this.graphics.splice(n,1)}this.update()}},{key:"update",value:function(){if("Awaiting state"!==this.layer.lifecycle){this.layer.setChangeFlags({dataChanged:!0,propsChanged:!0,viewportChanged:!0,updateTriggersChanged:!0});var t=this.getState(),e=parseInt(this.canvas.style.width),r=parseInt(this.canvas.style.height);t.width=e,t.height=r,this.layer.setState(t)}}},{key:"clear",value:function(){this.removeGraphics(),this.deckGL.finalize()}},{key:"remove",value:function(){this.mapOptions.targetElement.removeChild(this.canvas)}},{key:"destroy",value:function(){this.remove(),this.clear()}},{key:"moveTo",value:function(t,e){var r=document.getElementById(this.id);if(e=void 0===e||e){var n=document.getElementById(t);r&&n&&n.parentNode.insertBefore(r,n)}else{var o=document.getElementById(t);if(r){if(o.nextSibling)return void o.parentNode.insertBefore(r,o.nextSibling);o.parentNode.appendChild(r)}}}},{key:"setVisibility",value:function(t){this.canvas&&t!==this.visibility&&(this.visibility=t,this.canvas.style.display=t?"block":"none")}},{key:"draw",value:function(){var t=this.getState(),e={};for(var r in t)e[r]=t[r];var n=parseInt(this.canvas.style.width),o=parseInt(this.canvas.style.height);e.width=n,e.height=o,e.layers=[this.layer],e.canvas=this.canvas,this.deckGL.setProps(e)}},{key:"_initContainer",value:function(){this.canvas=this._createCanvas(this.mapOptions.mapElement),this.mapOptions.targetElement.appendChild(this.canvas)}},{key:"_createCanvas",value:function(t){var e=document.createElement("canvas");return this.id&&(e.id=this.id),e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.cursor="",e.width=parseInt(t.style.width),e.height=parseInt(t.style.height),e.style.width=t.style.width,e.style.height=t.style.height,e}},{key:"getState",value:function(){var t=this.functions.getMapState();return function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:null;this.renderer&&this.renderer.removeGraphics(t)}},{key:"clear",value:function(){this.renderer&&this.renderer.clear()}},{key:"remove",value:function(){this.renderer&&this.renderer.remove()}},{key:"moveTo",value:function(t,e){this.renderer.moveTo(t,e)}},{key:"setVisibility",value:function(t){this.renderer.setVisibility(t)}},{key:"getState",value:function(){return this.renderer.getState()}},{key:"getMapState",value:function(){var t={},e=this.map.getCenter(),r={longitude:e.lng,latitude:e.lat,zoom:this.map.getZoom(),maxZoom:this.map.getMaxZoom(),pitch:this.map.getPitch(),bearing:this.map.getBearing()};for(var n in r)t[n]=r[n];return this.map.getCRS&&this.map.getCRS()!==w().CRS.EPSG3857&&(t.coordinateSystem=this.coordinateSystem,t.isGeographicCoordinateSystem=this.isGeographicCoordinateSystem),t}}])&&Vf(e.prototype,r),n&&Vf(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Wf=function(){try{return THREE}catch(t){return{}}}();function Yf(t,e,r){if(t===r||t===e)return t;var n=r-e;return((t-e)%n+n)%n+e}function Xf(t){return t*Math.PI/180}var Jf={matrix:[1,-1,0,0],projection:{R:6378137,minZoom:0,maxZoom:22,nativeMaxZoom:19,RAD:Math.PI/180,METERS_PER_DEGREE:6378137*Math.PI/180,MAX_LATITUDE:85.0511287798,project:function(t){var e=this.RAD,r=this.METERS_PER_DEGREE,n=this.MAX_LATITUDE,o=t instanceof Array?{lng:t[0],lat:t[1]}:{lng:t.lng,lat:t.lat},i=o.lng,a=Math.max(Math.min(n,o.lat),-n);return{x:i*r,y:(0===a?0:Math.log(Math.tan((90+a)*e/2))/e)*r}},unproject:function(t){var e,r=t.x,n=t.y,o=this.RAD,i=this.METERS_PER_DEGREE;return 0===n?e=0:(e=n/i,e=(2*Math.atan(Math.exp(e*o))-Math.PI/2)/o),{lng:Yf(r/i,-180,180),lat:Yf(e,-this.MAX_LATITUDE,this.MAX_LATITUDE)}},locate:function(t,e,r){if(!t)return null;if(e=e||0,r=r||0,!e&&!r)return t;var n=t.lng;if(0!==e){var o=Math.abs(e),i=Xf(t.lng);n=Yf(180*(i+=2*Math.sqrt(Math.pow(Math.sin(o/(2*this.R)),2)/Math.pow(Math.cos(i),2))*(o>0?1:-1))/Math.PI,-180,180)}var a=t.lat;if(0!==r){var s=Math.abs(r),u=Xf(t.lat);a=Yf(180*(u+=2*Math.sin(s/(2*this.R))*(s>0?1:-1))/Math.PI,-90,90)}return{lng:n,lat:a}},getResolution:function(t){if(!this.resolutions){for(var e=[],r=12756274*Math.PI,n=0;n<=this.maxZoom;n++)e[n]=r/(256*Math.pow(2,n));this.resolutions=e}var o=0|t,i=this.resolutions.length;o=o<0?0:o>i-1?i-1:o;var a=this.resolutions[o];return(0|t)!==t&&o!==i-1?a+(this.resolutions[o+1]-a)*(t-o):a}},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},lngLatToPoint:function(t,e){var r=this.project(t);return this.transform(r,this.projection.getResolution(e))},locate:function(t,e,r){return this.projection.locate(t,e,r)},transform:function(t,e){return{x:this.matrix[0]*(t.x-this.matrix[2])/e,y:this.matrix[1]*(t.y-this.matrix[3])/e}}};function Kf(t){"@babel/helpers - typeof";return(Kf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Qf(t,e){for(var r=0;r=0;e--)t.children[e]instanceof Wf.Mesh&&t.remove(t.children[e]);return this}},{key:"clearAll",value:function(t){var e=this.scene;if(!e)return this;for(var r=e.children.length-1;r>=0;r--)!t&&e.children[r]instanceof Wf.Camera||e.remove(e.children[r]);return this}},{key:"setPosition",value:function(t,e){if(!t||!e)return this;var r=this.lngLatToPosition(e);return t.position.set(r.x,r.y,r.z),this}},{key:"lngLatToPosition",value:function(t){var e=Jf.projection.nativeMaxZoom,r=Jf.lngLatToPoint(t,e);return new oh(r.x,r.y,-0)}},{key:"distanceToThreeVector3",value:function(t,e,r){var n=this.map,o=r||n.getCenter(),i=Jf.projection.nativeMaxZoom,a=Jf.locate(o,t,e),s=Jf.lngLatToPoint(o,i),u=Jf.lngLatToPoint(a,i),l=Math.abs(u.x-s.x)*Math.sign(t),c=Math.abs(u.y-s.y)*Math.sign(e);return new oh(l,c,0)}},{key:"removeDuplicatedCoordinates",value:function(t){function e(t,e){return t[0]===e[0]&&t[1]===e[1]}for(var r=[].concat(t),n=r.length-1;n>=1;n--)e(r[n],r[n-1])&&r.splice(n,1);return e(r[0],r[r.length-1])&&r.splice(r.length-1,1),r}},{key:"getCoordinatesCenter",value:function(t){for(var e=0,r=0,n=0,o=0,i=t.length;o0?this.convertFastToPixelPoints(t):this.canvasContext.clearRect(0,0,this.maxWidth,this.maxWidth)}},{key:"convertFastToPixelPoints",value:function(t){var e,r,n,o,i,a,s,u=[],l=t.getEast()-t.getWest(),c=t.getNorth()-t.getSouth(),f=this.mapElement;o=l/f.width>c/f.height?l/f.width:c/f.height,this.useRadius=this.useGeoUnit?parseInt(this.radius/o):this.radius;for(var h=0;h0&&this.maxWidth>0))return!1;var r=this.canvasContext;r.setTransform(1,0,0,1,0,0),this.canvasContext.clearRect(0,0,this.maxWidth,this.maxHeight),this.drawCircle(this.useRadius),this.createGradient();for(var n=0;nt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:this.options;(t=t||{}).strokeStyle=Object.assign({},Zh,t.strokeStyle||{}),t.lngLabelStyle=Object.assign({},Qh,t.lngLabelStyle||{}),t.latLabelStyle=Object.assign({},Qh,t.latLabelStyle||{}),this.options=Object.assign({},$h,t,{extent:this.getDefaultExtent(t.extent),wrapX:t.wrapX}),this.oldExtent=this.options.extent,this._calcInterval(),this.isRotate=!1,this.visible=!0,this.features=this._getGraticuleFeatures()}},{key:"_createCanvas",value:function(){if(!this.canvas){var t=this.mapElement;this.canvas=document.createElement("canvas"),this.canvas.id=this.canvasId,this.canvas.style.position="absolute",this.canvas.style.top="0px",this.canvas.style.left="0px";var e=("undefined"==typeof window?{}:window).devicePixelRatio||1;this.canvas.width=parseInt(t.style.width)*e,this.canvas.height=parseInt(t.style.height)*e,this.canvas.style.width=t.style.width,this.canvas.style.height=t.style.height,this.canvas.globalAlpha=this.options.opacity,this.targetElement.appendChild(this.canvas)}}},{key:"_drawCanvas",value:function(){this.canvas||this._createCanvas(),this.setVisibility(),this._reset()}},{key:"_resizeCallback",value:function(){this.targetElement&&this.targetElement.removeChild(this.canvas),this.canvas=null,this._drawCanvas()}},{key:"_reset",value:function(){this._updateRotate(),this._updateExtent(),this._calcInterval(),this._drawLabel()}},{key:"_updateRotate",value:function(){var t=this.getMapStateByKey("getBearing");this.isRotate=t>-180&&t<=-90||t>=90&&t<180}},{key:"_updateExtent",value:function(){if(this.options.wrapX&&!this.oldExtent){var t=this.getMapStateByKey("getBounds"),e=t._ne,r=t._sw;this.options.extent=[r.lng,r.lat,e.lng,e.lat]}}},{key:"_calcInterval",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.interval;"function"==typeof t?(t=t(this.map),this._currLngInterval=t,this._currLatInterval=t):(this._currLngInterval=t,this._currLatInterval=t)}},{key:"_formatLat",value:function(t){return this.options.latFormatTickLabel?this.options.latLabelFormatter(t):t<0?zc(-1*t)+"S":t>0?zc(t)+"N":""+zc(t)}},{key:"_formatLng",value:function(t){return this.options.lngLabelFormatter?this.options.lngLabelFormatter(t):(t=Uc(t))>0&&t<=180?zc(t)+"E":t<0&&t>=-180?zc(-1*t)+"W":""+zc(t)}},{key:"_parsePxToInt",value:function(t){t.length>2&&"p"===t.charAt(t.length-2)&&(t=t.substr(0,t.length-2));try{return parseInt(t,10)}catch(t){console.log(t)}return 0}},{key:"_drawLabel",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.visible,r=this.canvas,n=r.getContext("2d");if(e&&this.options.showLabel){if(this.mapElement){this._currLngInterval&&this._currLatInterval||this._calcInterval(),n.clearRect(0,0,r.width,r.height);var o=this.options,i=o.lngLabelStyle,a=o.latLabelStyle,s=this._getGridiculePoints(),u=s.lngPoints,l=s.latPonits;u.forEach(function(e){t._drawLng(n,e[0],e[1],e[2],i)}),l.forEach(function(e){t._drawLat(n,e[0],e[1],e[2],a)})}}else n.clearRect(0,0,r.width,r.height)}},{key:"_drawLat",value:function(t,e,r,n,o){t=this._setLabelStyle(t,o);var i=this.canvas.width,a=12;try{var s=t.font.split(" ")[0];a=this._parsePxToInt(s)}catch(t){console.log(t)}if(!n){var u=e;e=r,r=this.getMapStateByKey("project",[u,e])}var l=this._formatLat(e),c=t.measureText(l).width;t.strokeText(l,(n?i:r.x)-c,(n?r:r.y)+a/2),t.fillText(l,(n?i:r.x)-c,(n?r:r.y)+a/2)}},{key:"_drawLng",value:function(t,e,r,n,o){t=this._setLabelStyle(t,o);var i=this.canvas.height;if(!n){var a=r;r=this.getMapStateByKey("project",[e,a])}var s=this._formatLng(e),u=t.measureText(s).width;t.strokeText(s,(n?r:r.x)-u/2,n?i:r.y),t.fillText(s,(n?r:r.x)-u/2,n?i:r.y)}},{key:"_getLatPoints",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-180,180],r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.features;if(o){if(this.options.wrapX&&-180===e[0]&&180===e[1])return[];var i=[];return o.forEach(function(o){var a=o.geometry.coordinates[0][1];if(o.geometry.coordinates[1][1]===a){var s="number"==typeof n?n:e[1];t.isRotate&&(s="number"==typeof r?r:e[0]),t.options.wrapX&&(i=i.concat(t._getWrapPoints(s,a,[s,s]))),i.push([s,a])}}),i}}},{key:"_getLngPoints",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-90,90],r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.features;if(o){var i="number"==typeof r?r:e[0];this.isRotate&&(i="number"==typeof n?n:e[1]);var a=[];return o.forEach(function(e){var r=e.geometry.coordinates[0][0];e.geometry.coordinates[1][0]===r&&(a.push([r,i]),t.options.wrapX&&(a=a.concat(t._getWrapPoints(r,i))))}),a}}},{key:"_getWrapPoints",value:function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.oldExtent,n=[],o=this.getMapStateByKey("getBounds"),i=o._ne,a=o._sw,s=r.length>2?r[2]:r[1];t>=a.lng;){var u=Uc(t,180===s,-180===r[0]);(!r||u>=r[0]&&u<=s)&&n.push([t,e]),t-=360}for(;t<=i.lng;){var l=Uc(t,180===s,-180===r[0]);(!r||l>=r[0]&&l<=s)&&n.push([t,e]),t+=360}return n}},{key:"_getGridiculePoints",value:function(){var t=this._getEdgeLat(),e=this._getEdgeLng(),r=this._getRange(),n=r.latRange,o=r.lngRange,i=r.firstLat,a=r.firstLng,s=r.lastLat,u=r.lastLng;return{latPonits:this._getUniquePoint(this._getLatPoints(o,a,u),t,1),lngPoints:this._getUniquePoint(this._getLngPoints(n,i,s),e,0)}}},{key:"_getEdgeLat",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._currLatInterval,r=[],n=[],o=this.canvas.width,i=this.canvas.height,a=this._getRange().extent,s=this.getMapStateByKey("getBounds")._ne;if(this.options.wrapX&&Uc(s.lng)>a[2])return[];for(var u=this._countDecimals(e),l=0;l<=i;l++){var c=this.getMapStateByKey("unproject",[o,l]),f=Uc(c.lng);(this.options.wrapX?f>=a[0]&&f<=a[2]:c.lng>=a[0]&&c.lng<=a[2])&&c.lat>=a[1]&&c.lat<=a[3]&&(r.push([c.lat,l]),n.push(c.lat),void 0===t&&c.lat.toFixed(u)%e==0&&(t=Number(c.lat.toFixed(u))))}var h=this._getIntersectRange(t,n,r,e),p=h.first,d=h.last,y=h.coordinates,v=h.points;t=Math.min(Math.max(p,-90),90);var g=Math.max(Math.min(Math.round(d),90),-90);return-90!==t||-90!==g?this._getClosestCoordinate(t,g,y,v,e):[]}},{key:"_getEdgeLng",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._currLngInterval,r=[],n=[],o=this.canvas.width,i=this.canvas.height,a=this.options.extent,s=this._countDecimals(e),u=this.getMapStateByKey("getBounds")._sw;if(this.options.wrapX&&Uc(u.lat)>a[3])return[];for(var l=0;l<=o;l++){var c=this.getMapStateByKey("unproject",[l,i]),f=Uc(c.lng);(this.options.wrapX?f>=a[0]&&f<=a[2]:c.lng>=a[0]&&c.lng<=a[2])&&c.lat>=a[1]&&c.lat<=a[3]&&(r.push([c.lng,l]),n.push(c.lng),void 0===t&&c.lng.toFixed(s)%e==0&&(t=Number(c.lng.toFixed(s))))}var h=this._getIntersectRange(t,n,r,e),p=h.first,d=h.last,y=h.coordinates,v=h.points;return t=p,this._getClosestCoordinate(t,d,y,v,e)}},{key:"_getIntersectRange",value:function(t,e,r,n){var o=e[e.length-1];if(t>o){o=t,e.reverse(),r.reverse();for(var i=this._countDecimals(n),a=0;a<=e.length;a++){var s=e[a];if(s.toFixed(i)%n==0){t=Number(s.toFixed(i));break}}}return{first:t,last:o,coordinates:e,points:r}}},{key:"_getClosestCoordinate",value:function(t,e,r,n,o){for(var i=[],a=t;a<=e;){var s=this._getClosestNumberIndex(a,r),u=n[s];i.push([Math.round(u[0]),u[1],!0]),a+=o,r=r.slice(s),n=n.slice(s)}return i}},{key:"_getClosestNumberIndex",value:function(t,e){for(var r=0,n=Number.MAX_VALUE,o=0;o2&&void 0!==arguments[2]?arguments[2]:0;if(this.options.wrapX)return t.concat(e);if(!e||0===e.length)return t;var n=e,o=this.canvas.width,i=this.canvas.height;for(var a in t){var s=this.getMapStateByKey("project",t[a]),u=n.findIndex(function(e){return e[0]===t[a][r]});u<=-1?n.push(t[a]):s&&s.x>=0&&s.x<=o&&s.y>=0&&s.y<=i&&(n[u]=t[a])}return n}},{key:"_countDecimals",value:function(t){return Math.floor(t)!==t&&t.toString().split(".")[1].length||0}},{key:"_getGraticuleFeatures",value:function(){var t=this._currLngInterval||10,e=this._currLatInterval||10,r=[],n=this._getRange(),o=n.latRange,i=n.lngRange,a=n.firstLat,s=n.firstLng,u=n.lastLat,l=n.lastLng;this.options.wrapX&&!this.oldExtent&&(o=[-90,90],i=[-180,180],a=s=u=l=null),"number"==typeof s&&r.unshift(this._makeLineFeature(this._makeLineCoords(s,o,a,u))),"number"==typeof l&&r.unshift(this._makeLineFeature(this._makeLineCoords(l,o,a,u)));for(var c=i[0];c<=i[1];c+=t)r.unshift(this._makeLineFeature(this._makeLineCoords(c,o,a,u)));"number"==typeof a&&r.unshift(this._makeLineFeature(this._makeLineCoords(a,i,s,l,"lat"))),"number"==typeof u&&r.unshift(this._makeLineFeature(this._makeLineCoords(u,i,s,l,"lat")));for(var f=o[0];f<=o[1];f+=e)r.unshift(this._makeLineFeature(this._makeLineCoords(f,i,s,l,"lat")));return r}},{key:"_getRange",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.extent&&Yh(this.options.extent);t&&0!==t.length||(t=this.getDefaultExtent());var e={};if((t=t.map(function(t){return Number(t.toFixed(6))}))[1]%this._currLatInterval!=0){e.firstLat=t[1];var r=Math.ceil(t[1]/this._currLatInterval);t[1]=r*this._currLatInterval}if(t[3]%this._currLatInterval!=0){e.lastLat=t[3];var n=Math.floor(t[3]/this._currLatInterval);t[3]=n*this._currLatInterval}if(t[0]%this._currLngInterval!=0){e.firstLng=t[0];var o=Math.ceil(t[0]/this._currLngInterval);t[0]=o*this._currLngInterval}if(t[2]%this._currLngInterval!=0){e.lastLng=t[2];var i=Math.floor(t[2]/this._currLngInterval);t[2]=i*this._currLngInterval}return Object.assign({latRange:[t[1],t[3]],lngRange:[t[0],t[2]],extent:t},e)}},{key:"_makeLineCoords",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[-90,90],r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"lng";t="lng"===o?this._lngFix(t):t,r="number"==typeof r?r:e[0],n="number"==typeof n?n:e[1];for(var i=Math.abs(r-n),a=[],s=r;s<=n;s+=i)"lng"===o?a.push([t,s]):a.push([s,t]);return a}},{key:"_makeLineFeature",value:function(t){return{type:"Feature",geometry:{type:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"LineString",coordinates:t}}}},{key:"_lngFix",value:function(t){return t>=180?180:t<=-180?-180:t}},{key:"_transformStrokeStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.strokeStyle;if(!t||"string"==typeof t)return{paint:{"line-color":t||"rgba(0,0,0,0.2)"}};var e={visibility:this.visible?"visible":"none","line-join":t.lineJoin||"round","line-cap":t.lineCap||"round"},r={"line-color":t.lineColor||"rgba(0,0,0,0.2)","line-width":t.lineWidth||1,"line-offset":t.lineDashOffset||0,"line-translate-anchor":"viewport"};return t.lineWidth&&("function"==typeof t.lineWidth?r["line-width"]=t.lineWidth(this.map):r["line-width"]=t.lineWidth),t.lindDasharray&&("function"==typeof t.lindDasharray?r["line-dasharray"]=t.lindDasharray(this.map):r["line-dasharray"]=t.lindDasharray),{layout:e,paint:r}}},{key:"_setLabelStyle",value:function(t,e){return e.textColor&&(t.fillStyle=e.textColor),e.textSize&&(t.font=e.textSize+" "+(e.textFont||["Calibri","sans-serif"]).join(",")),e.textHaloColor&&(t.strokeStyle=e.textHaloColor,t.lineWidth=e.textHaloWidth||1),e.textAnchor&&(t.textBaseline=this._getTxetBaseline(e.textAnchor),t.textAligin=this._getTxetAlign(e.textAligin)),t}},{key:"_getTxetBaseline",value:function(t){if(!t)return"bottom";var e=t.split("-");return e.includes("bottom")?"bottom":e.includes("top")?"top":e.includes("center")?"middle":void 0}},{key:"_getTxetAlign",value:function(t){if(!t)return"center";var e=t.split("-");return e.includes("left")?"left":e.includes("right")?"right":e.includes("center")?"center":void 0}}])&&Jh(e.prototype,r),n&&Jh(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ep(t){"@babel/helpers - typeof";return(ep="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function rp(t,e){for(var r=0;r=this.options.minZoom&&e<=this.options.maxZoom,this.renderer&&(this.renderer.visible=this.visible),this.map.getLayer(this.sourceId)&&this.map.setLayoutProperty(this.sourceId,"visibility",this.visible?"visible":"none"),this.renderer&&this.renderer._drawLabel()}},{key:"setMinZoom",value:function(t){this.options.minZoom=t,this.setVisibility()}},{key:"setMaxZoom",value:function(t){this.options.maxZoom=t,this.setVisibility()}},{key:"setShowLabel",value:function(t){this.options.showLabel=t,this.renderer._drawLabel()}},{key:"setExtent",value:function(t){this.options.extent=this.getDefaultExtent(t,this.map),this.updateGraticuleLayer(),this.renderer._drawLabel()}},{key:"setStrokeStyle",value:function(t){if(this.map&&this.map.getLayer(this.sourceId)){this.options.strokeStyle=t;var e=this.renderer._transformStrokeStyle(t),r=e.layout,n=e.paint;for(var o in r)this.map.setLayoutProperty(this.sourceId,o,r[o]);for(var i in n)this.map.setPaintProperty(this.sourceId,i,n[i])}}},{key:"setLngLabelStyle",value:function(t){this.options.lngLabelStyle=t,this.renderer._drawLabel()}},{key:"setLatLabelStyle",value:function(t){this.options.latLabelStyle=t,this.renderer._drawLabel()}},{key:"setIntervals",value:function(t){this.renderer&&this.renderer.setIntervals(t)}},{key:"getDefaultExtent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.map,r=(e.getCRS&&e.getCRS()||{}).extent;if(r||(r=[-180,-85.05119,180,85.05119]),!t||0===t.length)return r;var n=w().LngLatBounds.convert(t),o=n._sw,i=n._ne;return t=[o.lng,o.lat,i.lng,i.lat],t=[Math.max(r[0],t[0]),Math.max(r[1],t[1]),Math.min(r[2],t[2]),Math.min(r[3],t[3])]}},{key:"addGraticuleLayer",value:function(){if(!this.map.getSource(this.sourceId)){var t={type:"geojson",data:{type:"FeatureCollection",features:this.renderer.features}};this.map.addSource(this.sourceId,t)}if(!this.map.getLayer(this.sourceId)){var e=Object.assign({id:this.sourceId,type:"line",source:this.sourceId},this.renderer._transformStrokeStyle());this.map.addLayer(e)}}},{key:"_getLatPoints",value:function(t,e,r,n){return this.renderer._getLatPoints(t,e,r,n)}},{key:"_bindEvent",value:function(){this.map.on("styledata",this.styleDataEevent),this.map.on("resize",this.resizeEvent),this.map.on("zoomend",this.zoomendEvent)}},{key:"_unbindEvent",value:function(){this.map.off("styledata",this.styleDataEevent),this.map.off("resize",this.resizeEvent),this.map.off("zoomend",this.zoomendEvent)}},{key:"_setLayerTop",value:function(){var t=this,e=this.map;if(e){var r=e.getStyle&&e.getStyle().layers;r&&r.length&&r.findIndex(function(e){return e.id===t.sourceId})!==r.length-1&&e.getLayer(this.sourceId)&&(e.removeLayer(this.sourceId),this.addGraticuleLayer())}}},{key:"updateGraticuleLayer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.features;if(this.map.getSource(this.sourceId)){var e={type:"FeatureCollection",features:t};this.map.getSource(this.sourceId).setData(e)}this.addGraticuleLayer()}}])&&rp(e.prototype,r),n&&rp(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();!function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon",t[t.MultiPoint=4]="MultiPoint",t[t.MultiLineString=5]="MultiLineString",t[t.MultiPolygon=6]="MultiPolygon",t[t.GeometryCollection=7]="GeometryCollection",t[t.CircularString=8]="CircularString",t[t.CompoundCurve=9]="CompoundCurve",t[t.CurvePolygon=10]="CurvePolygon",t[t.MultiCurve=11]="MultiCurve",t[t.MultiSurface=12]="MultiSurface",t[t.Curve=13]="Curve",t[t.Surface=14]="Surface",t[t.PolyhedralSurface=15]="PolyhedralSurface",t[t.TIN=16]="TIN",t[t.Triangle=17]="Triangle"}(op||(op={}));var lp,cp=new Int32Array(2),fp=new Float32Array(cp.buffer),hp=new Float64Array(cp.buffer),pp=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];function dp(t){"@babel/helpers - typeof";return(dp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function yp(t,e){for(var r=0;r>24}},{key:"readUint8",value:function(t){return this.bytes_[t]}},{key:"readInt16",value:function(t){return this.readUint16(t)<<16>>16}},{key:"readUint16",value:function(t){return this.bytes_[t]|this.bytes_[t+1]<<8}},{key:"readInt32",value:function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}},{key:"readUint32",value:function(t){return this.readInt32(t)>>>0}},{key:"readInt64",value:function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<>8}},{key:"writeUint16",value:function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}},{key:"writeInt32",value:function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}},{key:"writeUint32",value:function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}},{key:"writeInt64",value:function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}},{key:"writeUint64",value:function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}},{key:"writeFloat32",value:function(t,e){fp[0]=e,this.writeInt32(t,cp[0])}},{key:"writeFloat64",value:function(t,e){hp[0]=e,this.writeInt32(t,cp[pp?0:1]),this.writeInt32(t+4,cp[pp?1:0])}},{key:"getBufferIdentifier",value:function(){if(this.bytes_.length>10),56320+(1023&i)))}return n}},{key:"__union_with_string",value:function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)}},{key:"__indirect",value:function(t){return t+this.readInt32(t)}},{key:"__vector",value:function(t){return t+this.readInt32(t)+4}},{key:"__vector_len",value:function(t){return this.readInt32(t+this.readInt32(t))}},{key:"__has_identifier",value:function(t){if(4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}},{key:"createScalarList",value:function(t,e){for(var r=[],n=0;n=0;r--)t.addInt32(e[r]);return t.endVector()}},{key:"startEndsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"addXy",value:function(t,e){t.addFieldOffset(1,e,0)}},{key:"createXyVector",value:function(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}},{key:"startXyVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addZ",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"createZVector",value:function(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}},{key:"startZVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addM",value:function(t,e){t.addFieldOffset(3,e,0)}},{key:"createMVector",value:function(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}},{key:"startMVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addT",value:function(t,e){t.addFieldOffset(4,e,0)}},{key:"createTVector",value:function(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addFloat64(e[r]);return t.endVector()}},{key:"startTVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addTm",value:function(t,e){t.addFieldOffset(5,e,0)}},{key:"createTmVector",value:function(t,e){t.startVector(8,e.length,8);for(var r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}},{key:"startTmVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addType",value:function(t,e){t.addFieldInt8(6,e,op.Unknown)}},{key:"addParts",value:function(t,e){t.addFieldOffset(7,e,0)}},{key:"createPartsVector",value:function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}},{key:"startPartsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endGeometry",value:function(t){return t.endObject()}},{key:"createGeometry",value:function(e,r,n,o,i,a,s,u,l){return t.startGeometry(e),t.addEnds(e,r),t.addXy(e,n),t.addZ(e,o),t.addM(e,i),t.addT(e,a),t.addTm(e,s),t.addType(e,u),t.addParts(e,l),t.endGeometry(e)}}],(r=[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"ends",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}},{key:"endsLength",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"endsArray",value:function(){var t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"xy",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}},{key:"xyLength",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"xyArray",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"z",value:function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}},{key:"zLength",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"zArray",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"m",value:function(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}},{key:"mLength",value:function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"mArray",value:function(){var t=this.bb.__offset(this.bb_pos,10);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"t",value:function(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}},{key:"tLength",value:function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"tArray",value:function(){var t=this.bb.__offset(this.bb_pos,12);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"tm",value:function(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):BigInt(0)}},{key:"tmLength",value:function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"type",value:function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):op.Unknown}},{key:"parts",value:function(e,r){var n=this.bb.__offset(this.bb_pos,18);return n?(r||new t).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}},{key:"partsLength",value:function(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}}])&&bp(e.prototype,r),n&&bp(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function _p(t,e){for(var r=[],n=0;n>1]),r.push(o)}return r}function Ep(t,e,r){if(!r||0===r.length)return[_p(t,e)];var n,o=0,i=Array.from(r).map(function(e){return t.slice(o,o=e<<1)});return e&&(o=0,n=Array.from(r).map(function(t){return e.slice(o,o=t)})),i.map(function(t,e){return _p(t,n?n[e]:void 0)})}function Op(t,e){var r=e;if(r===op.Unknown&&(r=t.type()),r===op.GeometryCollection){for(var n=[],o=0;o=0;r--)t.addInt8(e[r]);return t.endVector()}},{key:"startPropertiesVector",value:function(t,e){t.startVector(1,e,1)}},{key:"addColumns",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"createColumnsVector",value:function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}},{key:"startColumnsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"endFeature",value:function(t){return t.endObject()}},{key:"finishFeatureBuffer",value:function(t,e){t.finish(e)}},{key:"finishSizePrefixedFeatureBuffer",value:function(t,e){t.finish(e,void 0,!0)}},{key:"createFeature",value:function(e,r,n,o){return t.startFeature(e),t.addGeometry(e,r),t.addProperties(e,n),t.addColumns(e,o),t.endFeature(e)}}],(r=[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"geometry",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new xp).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}},{key:"properties",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}},{key:"propertiesLength",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"propertiesArray",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"columns",value:function(t,e){var r=this.bb.__offset(this.bb_pos,8);return r?(e||new Tp).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}},{key:"columnsLength",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}}])&&Mp(e.prototype,r),n&&Mp(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Np=(new TextEncoder,new TextDecoder);function Lp(t,e){var r={};if(!e||0===e.length)return r;var n=t.propertiesArray();if(!n)return r;for(var o=new DataView(n.buffer,n.byteOffset),i=t.propertiesLength(),a=0;a0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:function(t,e){if(!t.length)return e;if(!e.length)return t;var r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}(e,r.value)}})},Bp.prototype.slice=function(t){if((t|=0)<0)throw new Error("invalid length");var e=this,r=this._array.length-this._index;if(this._index+t<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=t));var n=new Uint8Array(t);return n.set(this._array.subarray(this._index)),function o(){return e._source.read().then(function(i){return i.done?(e._array=Dp,e._index=0,r>0?n.subarray(0,r):null):r+i.value.length>=t?(e._array=i.value,e._index=t-r,n.set(i.value.subarray(0,t-r),r),n):(n.set(i.value,r),r+=i.value.length,o())})}()},Bp.prototype.cancel=function(){return this._source.cancel()};var zp=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.bb=null,this.bb_pos=0}var e,r,n;return e=t,n=[{key:"getRootAsCrs",value:function(e,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"getSizePrefixedRootAsCrs",value:function(e,r){return e.setPosition(e.position()+4),(r||new t).__init(e.readInt32(e.position())+e.position(),e)}},{key:"startCrs",value:function(t){t.startObject(6)}},{key:"addOrg",value:function(t,e){t.addFieldOffset(0,e,0)}},{key:"addCode",value:function(t,e){t.addFieldInt32(1,e,0)}},{key:"addName",value:function(t,e){t.addFieldOffset(2,e,0)}},{key:"addDescription",value:function(t,e){t.addFieldOffset(3,e,0)}},{key:"addWkt",value:function(t,e){t.addFieldOffset(4,e,0)}},{key:"addCodeString",value:function(t,e){t.addFieldOffset(5,e,0)}},{key:"endCrs",value:function(t){return t.endObject()}},{key:"createCrs",value:function(e,r,n,o,i,a,s){return t.startCrs(e),t.addOrg(e,r),t.addCode(e,n),t.addName(e,o),t.addDescription(e,i),t.addWkt(e,a),t.addCodeString(e,s),t.endCrs(e)}}],(r=[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"org",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"code",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}},{key:"name",value:function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"description",value:function(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"wkt",value:function(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"codeString",value:function(t){var e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}}])&&Gp(e.prototype,r),n&&Gp(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Vp(t){"@babel/helpers - typeof";return(Vp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Hp(t,e){for(var r=0;r=0;r--)t.addFloat64(e[r]);return t.endVector()}},{key:"startEnvelopeVector",value:function(t,e){t.startVector(8,e,8)}},{key:"addGeometryType",value:function(t,e){t.addFieldInt8(2,e,op.Unknown)}},{key:"addHasZ",value:function(t,e){t.addFieldInt8(3,+e,0)}},{key:"addHasM",value:function(t,e){t.addFieldInt8(4,+e,0)}},{key:"addHasT",value:function(t,e){t.addFieldInt8(5,+e,0)}},{key:"addHasTm",value:function(t,e){t.addFieldInt8(6,+e,0)}},{key:"addColumns",value:function(t,e){t.addFieldOffset(7,e,0)}},{key:"createColumnsVector",value:function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}},{key:"startColumnsVector",value:function(t,e){t.startVector(4,e,4)}},{key:"addFeaturesCount",value:function(t,e){t.addFieldInt64(8,e,BigInt("0"))}},{key:"addIndexNodeSize",value:function(t,e){t.addFieldInt16(9,e,16)}},{key:"addCrs",value:function(t,e){t.addFieldOffset(10,e,0)}},{key:"addTitle",value:function(t,e){t.addFieldOffset(11,e,0)}},{key:"addDescription",value:function(t,e){t.addFieldOffset(12,e,0)}},{key:"addMetadata",value:function(t,e){t.addFieldOffset(13,e,0)}},{key:"endHeader",value:function(t){return t.endObject()}},{key:"finishHeaderBuffer",value:function(t,e){t.finish(e)}},{key:"finishSizePrefixedHeaderBuffer",value:function(t,e){t.finish(e,void 0,!0)}}],(r=[{key:"__init",value:function(t,e){return this.bb_pos=t,this.bb=e,this}},{key:"name",value:function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"envelope",value:function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}},{key:"envelopeLength",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"envelopeArray",value:function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Float64Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}},{key:"geometryType",value:function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):op.Unknown}},{key:"hasZ",value:function(){var t=this.bb.__offset(this.bb_pos,10);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}},{key:"hasM",value:function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}},{key:"hasT",value:function(){var t=this.bb.__offset(this.bb_pos,14);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}},{key:"hasTm",value:function(){var t=this.bb.__offset(this.bb_pos,16);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}},{key:"columns",value:function(t,e){var r=this.bb.__offset(this.bb_pos,18);return r?(e||new Tp).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}},{key:"columnsLength",value:function(){var t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}},{key:"featuresCount",value:function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):BigInt("0")}},{key:"indexNodeSize",value:function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}},{key:"crs",value:function(t){var e=this.bb.__offset(this.bb_pos,24);return e?(t||new zp).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}},{key:"title",value:function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"description",value:function(t){var e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb_pos+e,t):null}},{key:"metadata",value:function(t){var e=this.bb.__offset(this.bb_pos,30);return e?this.bb.__string(this.bb_pos+e,t):null}}])&&Hp(e.prototype,r),n&&Hp(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Yp(t){for(var e=Wp.getRootAsHeader(t),r=e.featuresCount(),n=e.indexNodeSize(),o=[],i=0;i0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Zp(t){return this instanceof Zp?(this.v=t,this):new Zp(t)}function $p(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(t,e||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(t){o[t]&&(n[t]=function(e){return new Promise(function(r,n){i.push([t,e,r,n])>1||s(t,e)})})}function s(t,e){try{(r=o[t](e)).value instanceof Zp?Promise.resolve(r.value.v).then(u,l):c(i[0][2],r)}catch(t){c(i[0][3],t)}var r}function u(t){s("next",t)}function l(t){s("throw",t)}function c(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}}var td=function(t){function e(e){var r=t.call(this,e)||this;return Object.defineProperty(r,"name",{value:"RepeaterOverflowError",enumerable:!1}),"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(r,r.constructor.prototype):r.__proto__=r.constructor.prototype,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r,r.constructor),r}return function(t,e){function r(){this.constructor=t}Xp(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e}(Error);(function(){function t(t){if(t<0)throw new RangeError("Capacity may not be less than 0");this._c=t,this._q=[]}Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this._q.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),t.prototype.add=function(t){if(this.full)throw new Error("Buffer full");this._q.push(t)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()}})(),function(){function t(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this._q.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(t){for(;this._q.length>=this._c;)this._q.shift();this._q.push(t)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()}}(),function(){function t(t){if(t<1)throw new RangeError("Capacity may not be less than 1");this._c=t,this._q=[]}Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this._q.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(t){this._q.length=id;return Promise.resolve(e).then(function(e){return!r&&t.state>=ad?ld(t).then(function(t){return{value:t,done:!0}}):{value:e,done:r}})}function fd(t,e){var r,n;if(!(t.state>=od))if(t.state=od,t.onnext(),t.onstop(),null==t.err&&(t.err=e),0!==t.pushes.length||void 0!==t.buffer&&!t.buffer.empty)try{for(var o=Qp(t.pushes),i=o.next();!i.done;i=o.next()){i.value.resolve()}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}else hd(t)}function hd(t){var e,r;if(!(t.state>=id)){t.state=ad||(t.state=nd)){t.state=nd;var e=function(t,e){if(ed(e),t.pushes.length>=sd)throw new td("No more than "+sd+" pending calls to push are allowed on a single repeater.");if(t.state>=od)return Promise.resolve(void 0);var r,n=void 0===t.pending?Promise.resolve(e):t.pending.then(function(){return e});n=n.catch(function(e){t.state=sd)throw new td("No more than "+sd+" pending calls to next are allowed on a single repeater.");if(e.state<=rd&&dd(e),e.onnext(t),void 0!==e.buffer&&!e.buffer.empty){var r=cd(e,e.buffer.remove());if(e.pushes.length){var n=e.pushes.shift();e.buffer.add(n.value),e.onnext=n.resolve}return r}if(e.pushes.length){var o=e.pushes.shift();return e.onnext=o.resolve,cd(e,o.value)}return e.state>=od?(hd(e),cd(e,ld(e))):new Promise(function(r){return e.nexts.push({resolve:r,value:t})})},t.prototype.return=function(t){ed(t);var e=yd.get(this);if(void 0===e)throw new Error("WeakMap error");return hd(e),e.execution=Promise.resolve(e.execution).then(function(){return t}),cd(e,ld(e))},t.prototype.throw=function(t){var e=yd.get(this);if(void 0===e)throw new Error("WeakMap error");return e.state<=rd||e.state>=od||void 0!==e.buffer&&!e.buffer.empty?(hd(e),null==e.err&&(e.err=t),cd(e,ld(e))):this.next(Promise.reject(t))},t.prototype[Symbol.asyncIterator]=function(){return this},t.race=md,t.merge=bd,t.zip=wd,t.latest=Sd,t}();function gd(t,e){var r,n,o=[],i=function(t){null!=t&&"function"==typeof t[Symbol.asyncIterator]?o.push(t[Symbol.asyncIterator]()):null!=t&&"function"==typeof t[Symbol.iterator]?o.push(t[Symbol.iterator]()):o.push(function(){return $p(this,arguments,function(){return Kp(this,function(r){switch(r.label){case 0:return e.yieldValues?[4,Zp(t)]:[3,3];case 1:return[4,r.sent()];case 2:r.sent(),r.label=3;case 3:return e.returnValues?[4,Zp(t)]:[3,5];case 4:return[2,r.sent()];case 5:return[2]}})})}())};try{for(var a=Qp(t),s=a.next();!s.done;s=a.next()){i(s.value)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o}function md(t){var e=this,r=gd(t,{returnValues:!0});return new vd(function(t,n){return Jp(e,void 0,void 0,function(){var e,o,i,a,s,u;return Kp(this,function(l){switch(l.label){case 0:if(!r.length)return n(),[2];o=!1,n.then(function(){e(),o=!0}),l.label=1;case 1:l.trys.push([1,,5,7]),a=void 0,s=0,u=function(){var o,u,l,c,f,h;return Kp(this,function(p){switch(p.label){case 0:o=s;try{for(f=void 0,u=Qp(r),l=u.next();!l.done;l=u.next())c=l.value,Promise.resolve(c.next()).then(function(t){t.done?(n(),void 0===i&&(i=t)):s===o&&(s++,e(t))},function(t){return n(t)})}catch(t){f={error:t}}finally{try{l&&!l.done&&(h=u.return)&&h.call(u)}finally{if(f)throw f.error}}return[4,new Promise(function(t){return e=t})];case 1:return void 0===(a=p.sent())?[3,3]:[4,t(a.value)];case 2:p.sent(),p.label=3;case 3:return[2]}})},l.label=2;case 2:return o?[3,4]:[5,u()];case 3:return l.sent(),[3,2];case 4:return[2,i&&i.value];case 5:return n(),[4,Promise.race(r.map(function(t){return t.return&&t.return()}))];case 6:return l.sent(),[7];case 7:return[2]}})})})}function bd(t){var e=this,r=gd(t,{yieldValues:!0});return new vd(function(t,n){return Jp(e,void 0,void 0,function(){var e,o,i,a=this;return Kp(this,function(s){switch(s.label){case 0:if(!r.length)return n(),[2];e=[],o=!1,n.then(function(){var t,r;o=!0;try{for(var n=Qp(e),i=n.next();!i.done;i=n.next()){(0,i.value)()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),s.label=1;case 1:return s.trys.push([1,,3,4]),[4,Promise.all(r.map(function(r,s){return Jp(a,void 0,void 0,function(){var a;return Kp(this,function(u){switch(u.label){case 0:u.trys.push([0,,6,9]),u.label=1;case 1:return o?[3,5]:(Promise.resolve(r.next()).then(function(t){return e[s](t)},function(t){return n(t)}),[4,new Promise(function(t){e[s]=t})]);case 2:return void 0===(a=u.sent())?[3,4]:a.done?(i=a,[2]):[4,t(a.value)];case 3:u.sent(),u.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return r.return?[4,r.return()]:[3,8];case 7:u.sent(),u.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return s.sent(),[2,i&&i.value];case 3:return n(),[7];case 4:return[2]}})})})}function wd(t){var e=this,r=gd(t,{returnValues:!0});return new vd(function(t,n){return Jp(e,void 0,void 0,function(){var e,o,i,a;return Kp(this,function(s){switch(s.label){case 0:if(!r.length)return n(),[2,[]];o=!1,n.then(function(){e(),o=!0}),s.label=1;case 1:s.trys.push([1,,6,8]),s.label=2;case 2:return o?[3,5]:(Promise.all(r.map(function(t){return t.next()})).then(function(t){return e(t)},function(t){return n(t)}),[4,new Promise(function(t){return e=t})]);case 3:return void 0===(i=s.sent())?[2]:(a=i.map(function(t){return t.value}),i.some(function(t){return t.done})?[2,a]:[4,t(a)]);case 4:return s.sent(),[3,2];case 5:return[3,8];case 6:return n(),[4,Promise.all(r.map(function(t){return t.return&&t.return()}))];case 7:return s.sent(),[7];case 8:return[2]}})})})}function Sd(t){var e=this,r=gd(t,{yieldValues:!0,returnValues:!0});return new vd(function(t,n){return Jp(e,void 0,void 0,function(){var e,o,i,a,s,u=this;return Kp(this,function(l){switch(l.label){case 0:if(!r.length)return n(),[2,[]];o=[],i=!1,n.then(function(){var t,r;e();try{for(var n=Qp(o),a=n.next();!a.done;a=n.next()){(0,a.value)()}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}i=!0}),l.label=1;case 1:return l.trys.push([1,,5,7]),Promise.all(r.map(function(t){return t.next()})).then(function(t){return e(t)},function(t){return n(t)}),[4,new Promise(function(t){return e=t})];case 2:return void 0===(a=l.sent())?[2]:(s=a.map(function(t){return t.value}),a.every(function(t){return t.done})?[2,s]:[4,t(s.slice())]);case 3:return l.sent(),[4,Promise.all(r.map(function(e,r){return Jp(u,void 0,void 0,function(){var u;return Kp(this,function(l){switch(l.label){case 0:if(a[r].done)return[2,a[r].value];l.label=1;case 1:return i?[3,4]:(Promise.resolve(e.next()).then(function(t){return o[r](t)},function(t){return n(t)}),[4,new Promise(function(t){return o[r]=t})]);case 2:return void 0===(u=l.sent())?[2,a[r].value]:u.done?[2,u.value]:(s[r]=u.value,[4,t(s.slice())]);case 3:return l.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,l.sent()];case 5:return n(),[4,Promise.all(r.map(function(t){return t.return&&t.return()}))];case 6:return l.sent(),[7];case 7:return[2]}})})})}function xd(t){"@babel/helpers - typeof";return(xd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _d(t,e){for(var r=0;rt)){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function Id(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Nd(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Nd(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nd(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);rthis.nodes[1]),this.nodes[1]=t}},{key:"toString",value:function(){return"[NodeRange level: ".concat(this._level,", nodes: ").concat(this.nodes[0],"-").concat(this.nodes[1],"]")}}])&&Rd(e.prototype,r),n&&Rd(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),a=n.minX,s=n.minY,u=n.maxX,l=n.maxY,Ad.info("tree items: ".concat(e,", nodeSize: ").concat(r)),c=zd(e,r),f=c[0][0],void 0,y=c.length-1,h=new i([0,1],y),p=[h],Ad.debug("starting stream search with queue: ".concat(p,", numItems: ").concat(e,", nodeSize: ").concat(r,", levelBounds: ").concat(c)),d=jd().mark(function t(){var n,h,d,y,v,g,m,b,w,S,x,_;return jd().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=p.shift(),Ad.debug("popped node: ".concat(n,", queueLength: ").concat(p.length)),h=n.startNode(),d=h>=f,y=Id(c[n.level()],2),v=y[1],g=Math.min(n.endNode()+r,v),m=g-h,t.next=9,new Fd(o(h*Gd,m*Gd),0);case 9:b=t.sent,w=new Float64Array(b),S=new Uint32Array(b),x=jd().mark(function t(r){var o,c,y,v,g,m,b,x;return jd().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(uw[o+2])){t.next=7;break}return t.abrupt("return",0);case 7:if(!(s>w[o+3])){t.next=9;break}return t.abrupt("return",0);case 9:if(c=S[8+(o<<1)],y=S[9+(o<<1)],v=qd(y,c),!d){t.next=17;break}return g=function(){if(r ").concat(v)),b.extendEndNodeToNewOffset(v),t.abrupt("return",0);case 23:void 0,_=n.level()-1,x=new i([v,v+1],_),void 0!==b&&b.level()==x.level()?Ad.info("Same level, but too far away. Pushing new request at offset: ".concat(v," rather than merging with distant ").concat(b)):Ad.info("Pushing new level for ".concat(x," onto queue with nearestNodeRange: ").concat(b," since there's not already a range for this level.")),p.push(x);case 26:case"end":return t.stop()}var _},t)}),_=h;case 14:if(!(_=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function Kd(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||Qd(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qd(t,e){if(t){if("string"==typeof t)return Zd(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Zd(t,e):void 0}}function Zd(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function ty(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function ey(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){ty(i,n,o,a,s,"next",t)}function s(t){ty(i,n,o,a,s,"throw",t)}a(void 0)})}}function ry(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ny(t,e){for(var r=0;rPd.global.extraRequestThreshold()&&(Ad.info("Pushing new feature batch, since gap ".concat(w," was too large")),a.push(s),s=[]),s.push([y,g]);case 23:u=!1,r.next=9;break;case 26:r.next=32;break;case 28:r.prev=28,r.t0=r.catch(7),l=!0,c=r.t0;case 32:if(r.prev=32,r.prev=33,!u||null==f.return){r.next=37;break}return r.next=37,uy(f.return());case 37:if(r.prev=37,!l){r.next=40;break}throw c;case 40:return r.finish(37);case 41:return r.finish(32);case 42:return e.headerClient.logUsage("header+index"),s.length>0&&a.push(s),S=a.flatMap(function(t){return e.readFeatureBatch(t)}),r.delegateYield(ly(fy(vd.merge(S))),"t1",46);case 46:case"end":return r.stop()}},r,null,[[7,28,32,42],[33,,37,41]])}))()}},{key:"lengthBeforeTree",value:function(){return Wd.length+Yd+this.headerLength}},{key:"lengthBeforeFeatures",value:function(){return this.lengthBeforeTree()+this.indexLength}},{key:"buildFeatureClient",value:function(){return new dy(this.headerClient.httpClient)}},{key:"readFeatureBatch",value:function(t){var e=this;return ay($d().mark(function r(){var n,o,i,a,s,u,l,c,f,h,p;return $d().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:n=Kd(t[0],1),o=n[0],i=Kd(t[t.length-1],2),a=i[0],s=i[1],u=a+s-o,l=e.buildFeatureClient(),c=Jd(t),r.prev=7,c.s();case 9:if((f=c.n()).done){r.next=17;break}return h=Kd(f.value,1),p=h[0],r.next=13,uy(e.readFeature(l,p,u));case 13:return r.next=15,r.sent;case 15:r.next=9;break;case 17:r.next=22;break;case 19:r.prev=19,r.t0=r.catch(7),c.e(r.t0);case 22:return r.prev=22,c.f(),r.finish(22);case 25:l.logUsage("feature");case 26:case"end":return r.stop()}},r,null,[[7,19,22,25]])}))()}},{key:"readFeature",value:function(){var t=ey($d().mark(function t(e,r,n){var o,i,a,s,u,l,c;return $d().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=r+this.lengthBeforeFeatures(),t.next=3,e.getRange(o,4,n,"feature length");case 3:return a=t.sent,i=new DataView(a).getUint32(0,!0),t.next=7,e.getRange(o+4,i,n,"feature data");case 7:return s=t.sent,u=new Uint8Array(s),(l=new Uint8Array(i+Yd)).set(u,Yd),(c=new gp(l)).setPosition(Yd),t.abrupt("return",Ip.getRootAsFeature(c));case 14:case"end":return t.stop()}},t,this)}));return function(e,r,n){return t.apply(this,arguments)}}()}],[{key:"open",value:function(){var e=ey($d().mark(function e(r){var n,o,i,a,s,u,l,c,f,h,p;return $d().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=2024,o=new dy(r),i=function(){var t,e=0;for(t=0;t<3;t++){e+=Math.pow(16,t)*Gd}return e}(),a=n+i,Ad.debug("fetching header. minReqLength: ".concat(a," (assumedHeaderLength: ").concat(n,", assumedIndexLength: ").concat(i,")")),e.t0=Uint8Array,e.next=8,o.getRange(0,8,a,"header");case 8:if(e.t1=e.sent,(s=new e.t0(e.t1)).subarray(0,3).every(function(t,e){return Wd[e]===t})){e.next=13;break}throw Ad.error("bytes: ".concat(s," != ").concat(Wd)),new Error("Not a FlatGeobuf file");case 13:return Ad.debug("magic bytes look good"),e.next=16,o.getRange(8,4,a,"header");case 16:if(l=e.sent,!((u=new DataView(l).getUint32(0,!0))>10485760||u<8)){e.next=21;break}throw new Error("Invalid header size");case 21:return Ad.debug("headerLength: ".concat(u)),e.next=24,o.getRange(12,u,a,"header");case 24:return c=e.sent,f=new gp(new Uint8Array(c)),h=Yp(f),p=Ud(h.featuresCount,h.indexNodeSize),Ad.debug("completed: opening http reader"),e.abrupt("return",new t(o,h,u,p));case 30:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()}]),t}(),dy=function(){function t(e){ry(this,t),this.bytesEverUsed=0,this.bytesEverFetched=0,this.buffer=new ArrayBuffer(0),this.head=0,this.httpClient="string"==typeof e?new yy(e):e}return oy(t,[{key:"getRange",value:function(){var t=ey($d().mark(function t(e,r,n,o){var i,a,s;return $d().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.bytesEverUsed+=r,i=e-this.head,a=i+r,!(i>=0&&a<=this.buffer.byteLength)){t.next=5;break}return t.abrupt("return",this.buffer.slice(i,a));case 5:return s=Math.max(r,n),this.bytesEverFetched+=s,Ad.debug("requesting for new Range: ".concat(e,"-").concat(e+r-1)),t.next=10,this.httpClient.getRange(e,s,o);case 10:return this.buffer=t.sent,this.head=e,t.abrupt("return",this.buffer.slice(0,r));case 13:case"end":return t.stop()}},t,this)}));return function(e,r,n,o){return t.apply(this,arguments)}}()},{key:"logUsage",value:function(t){var e=t.split(" ")[0],r=this.bytesEverUsed,n=this.bytesEverFetched,o=(100*r/n).toFixed(2);Ad.info("".concat(e," bytes used/requested: ").concat(r," / ").concat(n," = ").concat(o,"%"))}}]),t}(),yy=function(){function t(e){ry(this,t),this.requestsEverMade=0,this.bytesEverRequested=0,this.url=e}return oy(t,[{key:"getRange",value:function(){var t=ey($d().mark(function t(e,r,n){var o,i;return $d().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.requestsEverMade+=1,this.bytesEverRequested+=r,o="bytes=".concat(e,"-").concat(e+r-1),Ad.info("request: #".concat(this.requestsEverMade,", purpose: ").concat(n,"), bytes: (this_request: ").concat(r,", ever: ").concat(this.bytesEverRequested,"), Range: ").concat(o)),t.next=6,fetch(this.url,{headers:{Range:o}});case 6:return i=t.sent,t.abrupt("return",i.arrayBuffer());case 8:case"end":return t.stop()}},t,this)}));return function(e,r,n){return t.apply(this,arguments)}}()}]),t}();function vy(t){"@babel/helpers - typeof";return(vy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gy(){gy=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new A(n||[]);return o(a,"_invoke",{value:P(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={};function g(){}function m(){}function b(){}var w={};l(w,a,function(){return this});var S=Object.getPrototypeOf,x=S&&S(S(M([])));x&&x!==r&&n.call(x,a)&&(w=x);var _=b.prototype=g.prototype=Object.create(w);function E(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function O(t,e){function r(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==vy(c)&&n.call(c,"__await")?e.resolve(c.__await).then(function(t){r("next",t,a,s)},function(t){r("throw",t,a,s)}):e.resolve(c).then(function(t){l.value=t,a(l)},function(t){return r("throw",t,a,s)})}s(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e(function(e,o){r(t,n,e,o)})}return i=i?i.then(o,o):o()}})}function P(e,r,n){var o=h;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=k(s,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function M(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function my(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function by(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){my(i,n,o,a,s,"next",t)}function s(t){my(i,n,o,a,s,"throw",t)}a(void 0)})}}function wy(t){var e,r,n,o=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);o--;){if(r&&null!=(e=t[r]))return e.call(t);if(n&&null!=(e=t[n]))return new Sy(e.call(t));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function Sy(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then(function(t){return{value:t,done:e}})}return(Sy=function(t){this.s=t,this.n=t.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var r=this.s.return;return void 0===r?Promise.resolve({value:t,done:!0}):e(r.apply(this.s,arguments))},throw:function(t){var r=this.s.return;return void 0===r?Promise.reject(t):e(r.apply(this.s,arguments))}},new Sy(t)}function xy(t){return new Oy(t,0)}function _y(t){return function(){return new Ey(t.apply(this,arguments))}}function Ey(t){var e,r;function n(e,r){try{var i=t[e](r),a=i.value,s=a instanceof Oy;Promise.resolve(s?a.v:a).then(function(r){if(s){var u="return"===e?"return":"next";if(!a.k||r.done)return n(u,r);r=t[u](r).value}o(i.done?"return":"normal",r)},function(t){n("throw",t)})}catch(t){o("throw",t)}}function o(t,o){switch(t){case"return":e.resolve({value:o,done:!0});break;case"throw":e.reject(o);break;default:e.resolve({value:o,done:!1})}(e=e.next)?n(e.key,e.arg):r=null}this._invoke=function(t,o){return new Promise(function(i,a){var s={key:t,arg:o,resolve:i,reject:a,next:null};r?r=r.next=s:(e=r=s,n(t,o))})},"function"!=typeof t.return&&(this.return=void 0)}function Oy(t,e){this.v=t,this.k=e}function Py(){return(Py=_y(gy().mark(function t(e,r,n){var o,i,a,s,u,l,c,f,h,p;return gy().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o="function"==typeof(d=e).slice?d:new Bp("function"==typeof d.read?d:d.getReader()),i=function(){var t=by(gy().mark(function t(e){return gy().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.slice(e);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),t.t0=Uint8Array,t.next=5,xy(i(8,"magic bytes"));case 5:if(t.t1=t.sent,(a=new t.t0(t.t1)).subarray(0,3).every(function(t,e){return Wd[e]===t})){t.next=9;break}throw new Error("Not a FlatGeobuf file");case 9:return t.t2=Uint8Array,t.next=12,xy(i(4,"header length"));case 12:return t.t3=t.sent,a=new t.t2(t.t3),s=new gp(a),u=s.readUint32(0),t.t4=Uint8Array,t.next=19,xy(i(u,"header data"));case 19:if(t.t5=t.sent,a=new t.t4(t.t5),s=new gp(a),l=Yp(s),n&&n(l),c=l.indexNodeSize,f=l.featuresCount,!(c>0)){t.next=29;break}return h=Ud(f,c),t.next=29,xy(i(h,"entire index, w/o rect"));case 29:return t.next=31,xy(Cy(i,l,r));case 31:if(!(p=t.sent)){t.next=36;break}return t.next=34,p;case 34:t.next=29;break;case 36:case"end":return t.stop()}var d},t)}))).apply(this,arguments)}function ky(){return(ky=_y(gy().mark(function t(e,r,n,o){var i,a,s,u,l,c,f;return gy().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,xy(py.open(e));case 2:i=t.sent,Ad.debug("opened reader"),o&&o(i.header),a=!1,s=!1,t.prev=7,l=wy(i.selectBbox(r));case 9:return t.next=11,xy(l.next());case 11:if(!(a=!(c=t.sent).done)){t.next=18;break}return f=c.value,t.next=15,n(f,i.header);case 15:a=!1,t.next=9;break;case 18:t.next=24;break;case 20:t.prev=20,t.t0=t.catch(7),s=!0,u=t.t0;case 24:if(t.prev=24,t.prev=25,!a||null==l.return){t.next=29;break}return t.next=29,xy(l.return());case 29:if(t.prev=29,!s){t.next=32;break}throw u;case 32:return t.finish(29);case 33:return t.finish(24);case 34:case"end":return t.stop()}},t,null,[[7,20,24,34],[25,,29,33]])}))).apply(this,arguments)}function Cy(t,e,r){return Ty.apply(this,arguments)}function Ty(){return(Ty=by(gy().mark(function t(e,r,n){var o,i,a,s,u;return gy().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Uint8Array,t.next=3,e(4,"feature length");case 3:if(t.t1=t.sent,0!==(o=new t.t0(t.t1)).byteLength){t.next=7;break}return t.abrupt("return");case 7:return i=new gp(o),a=i.readUint32(0),t.t2=Uint8Array,t.next=12,e(a,"feature data");case 12:return t.t3=t.sent,o=new t.t2(t.t3),(s=new Uint8Array(a+4)).set(o,4),(i=new gp(s)).setPosition(Yd),u=Ip.getRootAsFeature(i),t.abrupt("return",n(u,r));case 20:case"end":return t.stop()}},t)}))).apply(this,arguments)}function Ay(t,e){return{type:"FeatureCollection",features:function(t,e,r){if(!t.subarray(0,3).every(function(t,e){return Wd[e]===t}))throw new Error("Not a FlatGeobuf file");var n=new gp(t),o=n.readUint32(Wd.length);n.setPosition(Wd.length+Yd);var i=Yp(n);r&&r(i);var a=Wd.length+Yd+o,s=i.indexNodeSize,u=i.featuresCount;s>0&&(a+=Ud(u,s));for(var l=[];a=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function By(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function Fy(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){By(i,n,o,a,s,"next",t)}function s(t){By(i,n,o,a,s,"throw",t)}a(void 0)})}}function Gy(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e.layerID?e.layerID:q.createUniqueID("FGBLayer_"),this.layerId=this.id+"outer",this.sourceId=this.layerId,this.options=e,this.strategy=e.strategy||"bbox",this.url=e.url,this.layerType="",this.extent=e.extent,this.init()}var e,r,n;return e=t,(r=[{key:"init",value:function(){"bbox"===this.strategy&&(this.loadedExtentsRtree_=new(Ly()))}},{key:"iterateFeatures",value:function(){var t=Fy(Dy().mark(function t(e){var r,n,o,i,a,s,u;return Dy().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r={type:"FeatureCollection",features:[]},n=!1,o=!1,t.prev=3,a=zy(e);case 5:return t.next=7,a.next();case 7:if(!(n=!(s=t.sent).done)){t.next=15;break}u=s.value,this.options.featureLoader&&"function"==typeof this.options.featureLoader&&(u=this.options.featureLoader(u)),this.layerType||(this.layerType=Hy[u.geometry.type]),r.features.push(u);case 12:n=!1,t.next=5;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(3),o=!0,i=t.t0;case 21:if(t.prev=21,t.prev=22,!n||null==a.return){t.next=26;break}return t.next=26,a.return();case 26:if(t.prev=26,!o){t.next=29;break}throw i;case 29:return t.finish(26);case 30:return t.finish(21);case 31:return t.abrupt("return",r);case 32:case"end":return t.stop()}},t,this,[[3,17,21,31],[22,,26,30]])}));return function(e){return t.apply(this,arguments)}}()},{key:"_loadData",value:function(){var t=Fy(Dy().mark(function t(e){var r,n,o=this;return Dy().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]},e.length){t.next=7;break}return t.next=4,this._getStream(this.url);case 4:r=t.sent,t.next=9;break;case 7:n.value={extent:e.slice()},this.loadedExtentsRtree_.insert(n);case 9:return t.next=11,Iy(r&&r.body||this.url,n,function(t){o.layerType=Hy[t.geometryType]});case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"_getStream",value:function(){var t=Fy(Dy().mark(function t(e){return Dy().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,tt.get(e,{},{withoutFormatSuffix:!0}).then(function(t){return t});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()},{key:"_containsExtent",value:function(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}},{key:"_getInExtent",value:function(t){var e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.loadedExtentsRtree_.search(e).map(function(t){return t.value})}},{key:"_forEachInExtent",value:function(t,e){return this._forEach(this._getInExtent(t),e)}},{key:"_forEach",value:function(t,e){for(var r,n=0,o=t.length;n=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function Xy(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function Jy(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){Xy(i,n,o,a,s,"next",t)}function s(t){Xy(i,n,o,a,s,"throw",t)}a(void 0)})}}function Ky(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e.layerID?e.layerID:q.createUniqueID("FGBLayer_"),this.layerId=this.id+"outer",this.sourceId=this.layerId,this.options=e,this.strategy=e.strategy||"bbox",this.url=e.url,this.layerType="",this.extent=e.extent,this.overlay=!0,this.type="custom",this.renderingMode="3d",this._updateFeaturesFn=this._updateFeatures.bind(this)}var e,r,n;return e=t,(r=[{key:"onAdd",value:function(t){this.map=t;var e,r,n,o=[];if("bbox"===this.strategy){var i=this.map.getBounds().toArray();o=[i[0][0],i[0][1],i[1][0],i[1][1]],this.map.on("moveend",this._updateFeaturesFn)}if(this.extent){var a=(e=this.extent,n=[],function(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}(e,r=o)&&(e[0]>r[0]?n[0]=e[0]:n[0]=r[0],e[1]>r[1]?n[1]=e[1]:n[1]=r[1],e[2]0?(r.totalTimes--,r.ajaxPolling(t)):r._commit(t)}},{key:"ajaxPolling",value:function(t){var e=this,r=t.url,n=/^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;return e.index=parseInt(Math.random()*e.length),e.url=e.urls[e.index],r=r.replace(n,n.exec(e.url)[0]),t.url=r,t.isInTheSameDomain=q.isInTheSameDomain(r),e._commit(t)}},{key:"calculatePollingTimes",value:function(){var t=this;t.times?t.totalTimes>t.POLLING_TIMES?t.times>t.POLLING_TIMES?t.totalTimes=t.POLLING_TIMES:t.totalTimes=t.times:t.timest.POLLING_TIMES&&(t.totalTimes=t.POLLING_TIMES),t.totalTimes--}},{key:"isServiceSupportPolling",value:function(){return!("SuperMap.REST.ThemeService"===this.CLASS_NAME||"SuperMap.REST.EditFeaturesService"===this.CLASS_NAME)}},{key:"transformResult",value:function(t,e){return{result:t=q.transformResult(t),options:e}}},{key:"transformErrorResult",value:function(t,e){return{error:(t=q.transformResult(t)).error||t,options:e}}},{key:"serviceProcessCompleted",value:function(t,e){t=this.transformResult(t).result,this.events.triggerEvent("processCompleted",{result:t,options:e})}},{key:"serviceProcessFailed",value:function(t,e){var r=(t=this.transformErrorResult(t).error).error||t;this.events.triggerEvent("processFailed",{error:r,options:e})}},{key:"_returnContent",value:function(t){return t.scope.format!==Jr.FGB&&!!t.scope.returnContent}},{key:"supportDataFormat",value:function(t){return this.dataFormat().includes(t)}},{key:"dataFormat",value:function(){return[Jr.GEOJSON,Jr.ISERVER]}},{key:"_commit",value:function(t){var e=this;if("POST"===t.method||"PUT"===t.method||"PATCH"===t.method)if(t.params&&(t.url=q.urlAppend(t.url,q.getParameterString(t.params||{}))),"object"!==yv(t.data)||t.data instanceof FormData)t.params=t.data;else try{t.params=q.toJSON(t.data)}catch(t){console.log("不是json对象")}return tt.commit(t.method,t.url,t.params,{headers:t.headers,withoutFormatSuffix:t.withoutFormatSuffix,withCredentials:t.withCredentials,crossOrigin:t.crossOrigin,timeout:t.async?0:null,proxy:t.proxy}).then(function(t){return t.text?t.text():t.json?t.json():t}).then(function(e){var r=e;return"string"==typeof e&&(r=(new cr).read(e)),(!r||r.error||r.code>=300&&304!==r.code)&&(r=r&&r.error?{error:r.error}:{error:r}),r&&t.scope.format===Jr.FGB&&(r.newResourceLocation=r.newResourceLocation.replace(".json","")+".fgb"),r}).catch(function(t){return{error:t}}).then(function(r){var n={object:e};if(r.error){var o="processFailed";if(e.events&&e.events.listeners[o]&&e.events.listeners[o].length){var i=t.failure&&(t.scope?A.bind(t.failure,t.scope):t.failure);i?i(r,t):e.serviceProcessFailed(r,t)}else(n=pv(pv({},n),e.transformErrorResult(r,t))).type=o,t.failure&&t.failure(n)}else{var a="processCompleted";if(e.events&&e.events.listeners[a]&&e.events.listeners[a].length){var s=t.success&&(t.scope?A.bind(t.success,t.scope):t.success);s?s(r,t):e.serviceProcessCompleted(r,t)}else r.succeed=void 0==r.succeed||r.succeed,(n=pv(pv({},n),e.transformResult(r,t))).type=a,t.success&&t.success(n)}return n})}}])&&vv(e.prototype,r),n&&vv(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function bv(t){"@babel/helpers - typeof";return(bv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function wv(){wv=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new A(n||[]);return o(a,"_invoke",{value:P(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={};function g(){}function m(){}function b(){}var w={};l(w,a,function(){return this});var S=Object.getPrototypeOf,x=S&&S(S(M([])));x&&x!==r&&n.call(x,a)&&(w=x);var _=b.prototype=g.prototype=Object.create(w);function E(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function O(t,e){function r(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==bv(c)&&n.call(c,"__await")?e.resolve(c.__await).then(function(t){r("next",t,a,s)},function(t){r("throw",t,a,s)}):e.resolve(c).then(function(t){l.value=t,a(l)},function(t){return r("throw",t,a,s)})}s(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e(function(e,o){r(t,n,e,o)})}return i=i?i.then(o,o):o()}})}function P(e,r,n){var o=h;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=k(s,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function M(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function Sv(t){return function(t){if(Array.isArray(t))return xv(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return xv(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xv(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xv(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function Iv(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function Nv(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:"id";return Uv()(t,e)}function Kv(t){return t.hasOwnProperty("start")&&t.hasOwnProperty("end")}function Qv(t,e,r){var n=t.id,o=t.properties,i=t.lables,a=e?function(t,e){if(!e)return{};for(var r=t.id,n=t.labels,o=e.filter(function(t){return"entity"===t.type}),i=0;i0&&t(i[0])}},u=0;u0;)f.push(s.pop());i.push(f)}}return i},xg=function(t){for(var e=t.nodes,r=void 0===e?[]:e,n=t.edges,o=void 0===n?[]:n,i=[],a={},s={},u={},l=[],c=0,f=function t(e){s[e.id]=c,u[e.id]=c,c+=1,i.push(e),a[e.id]=!0;for(var n=gg(e.id,o,"target").filter(function(t){return r.map(function(t){return t.id}).indexOf(t)>-1}),f=function(o){var i=n[o];if(s[i]||0===s[i])a[i]&&(u[e.id]=Math.min(u[e.id],s[i]));else{var l=r.filter(function(t){return t.id===i});l.length>0&&t(l[0]),u[e.id]=Math.min(u[e.id],u[i])}},h=0;h0;){var d=i.pop();if(a[d.id]=!1,p.push(d),d===e)break}p.length>0&&l.push(p)}},h=0,p=r;h0;)for(var d=f.pop(),y=d.id,v=gg(y,t.edges),g=function(n){var o,a=v[n],s=t.nodes.find(function(t){return t.id===a});if(a===y)i.push(((o={})[a]=d,o));else if(a in p){if(!p[y].has(s)){for(var u=!0,l=[s,d],c=h[y];p[a].size&&!p[a].has(c)&&(l.push(c),c!==h[c.id]);)c=h[c.id];if(l.push(c),e&&r?(u=!1,l.findIndex(function(t){return e.indexOf(t.id)>-1})>-1&&(u=!0)):e&&!r&&l.findIndex(function(t){return e.indexOf(t.id)>-1})>-1&&(u=!1),u){for(var g={},m=1;m-1)return f;n.push(u),o.add(u);for(var h=c[u.id],p=0;p0;){var r=e.pop();o.has(r)&&(o.delete(r),i[r.id].forEach(function(t){e.push(t)}),i[r.id].clear())}}(u);else for(p=0;p-1});v-1?d[y.id].push(u[m]):a.push(((o={})[y.id]=y,o))}}return{component:p,adjList:d,minIdx:s}},g=0;g=g}),b=xg({nodes:m,edges:t.edges}).filter(function(t){return t.length>1});if(0===b.length)break;var w=v(b),S=w.minIdx,x=w.adjList,_=w.component;if(!(_.length>1))break;_.forEach(function(t){i[t.id]=new Set});var E=s[S];if(e&&r&&-1===e.indexOf(E.id))return a;l(E,E,x),g=S+1}return a},Mg=function(t,e,r,n){return void 0===n&&(n=!0),e?Ag(t,r,n):Tg(t,r,n)},jg=function(t){var e=null,r=t.nodes,n={},o={},i={},a={};(void 0===r?[]:r).forEach(function(t){o[t.id]=t});for(var s={enter:function(t){var r=t.current,a=t.previous;if(i[r]){e={};for(var s=r,u=a;u!==r;)e[s]=u,s=u,u=n[u];e[s]=u}else i[r]=r,delete o[r],n[r]=a},leave:function(t){var e=t.current;a[e]=e,delete i[e]},allowTraversal:function(t){var r=t.next;return!e&&!a[r]}};Object.keys(o).length;)Cg(t,Object.keys(o)[0],s);return e},Ig=function(t,e,r,n){var o=t.nodes,i=void 0===o?[]:o,a=t.edges,s=void 0===a?[]:a,u=[],l={},c={},f={};i.forEach(function(t,r){var n=t.id;u.push(n),c[n]=1/0,n===e&&(c[n]=0)});for(var h=i.length,p=function(t){var e=function(t,e,r){for(var n,o=1/0,i=0;ic[e.id]+s?(c[a]=c[e.id]+s,f[a]=[e.id]):c[a]===c[e.id]+s&&f[a].push(e.id)})},d=0;d0&&l.length>0;){var h=l[l.length-1];if(h.length){var p=h.shift();if(p&&(s.push(p),u[p]=!0,f=n?gg(p,a,"target"):gg(p,a),l.push(f.filter(function(t){return!u[t]}))),s[s.length-1]===r){var d=s.map(function(t){return t});c.push(d);y=s.pop();u[y]=!1,l.pop()}}else{var y=s.pop();u[y]=!1,l.pop()}}return c},Bg=function(t,e){for(var r=hg(t,e),n=[],o=r.length,i=0;in[i][s]+n[s][a]&&(n[i][a]=n[i][s]+n[s][a]);return n},Fg=function(t,e,r,n){void 0===e&&(e=!1),void 0===r&&(r="weight"),void 0===n&&(n=1e3);var o=t.nodes,i=void 0===o?[]:o,a=t.edges,s=void 0===a?[]:a,u={},l={};i.forEach(function(t,e){var r=bg();t.clusterId=r,u[r]={id:r,nodes:[t]},l[t.id]={node:t,idx:e}});var c=[],f={};hg(t,e).forEach(function(t,e){var r=0,n=i[e].id;f[n]={},t.forEach(function(t,e){if(t){r+=t;var o=i[e].id;f[n][o]=t}}),c.push(r)});for(var h=0,p=function(){var t=!1;if(i.forEach(function(e){var r={};Object.keys(f[e.id]).forEach(function(t){var n=f[e.id][t],o=l[t].node.clusterId;r[o]||(r[o]=0),r[o]+=n});var n=-1/0,o=[];if(Object.keys(r).forEach(function(t){n=0&&o.splice(i,1),o&&o.length){t=!0;var a=u[e.clusterId],s=a.nodes.indexOf(e);a.nodes.splice(s,1);var c=Math.floor(Math.random()*o.length),h=u[o[c]];h.nodes.push(e),e.clusterId=h.id}}}),!t)return"break";h++};h0&&_>E&&_-EE&&(P=c.map(function(t){return{node:t,clusterId:t.clusterId}}),k=(0,rg.clone)(g),E=_),C||O>100)break;O++,Object.keys(g).forEach(function(t){var e=0;h.forEach(function(n){var o=n.source,i=n.target,a=m[o].node.clusterId,s=m[i].node.clusterId;(a===t&&s!==t||s===t&&a!==t)&&(e+=n[r]||1)}),g[t].sumTot=e}),c.forEach(function(t,e){var n,i=g[t.clusterId],a=0,s=w[e]/(2*x),l=0,c=i.nodes;c.forEach(function(t){var r=m[t.id].idx;l+=b[e][r]||0});var f=l-i.sumTot*s,d=c.filter(function(e){return e.id!==t.id}),y=[];d.forEach(function(t,e){y[e]=p[t.originIndex]});var v=Wg(d,p)*u,_=S[t.id];if(Object.keys(_).forEach(function(r){var i=m[r].node.clusterId;if(i!==t.clusterId){var l=g[i],c=l.nodes;if(c&&c.length){var h=0;c.forEach(function(t){var r=m[t.id].idx;h+=b[e][r]||0});var d=h-l.sumTot*s,y=c.concat([t]),w=[];y.forEach(function(t,e){w[e]=p[t.originIndex]});var S=Wg(y,p)*u,x=d-f;o&&(x=d+S-(f+v)),x>a&&(a=x,n=l)}}}),a>0){n.nodes.push(t);var E=t.clusterId;t.clusterId=n.id;var O=i.nodes.indexOf(t);i.nodes.splice(O,1);var P=0,k=0;h.forEach(function(t){var e=t.source,o=t.target,i=m[e].node.clusterId,a=m[o].node.clusterId;(i===n.id&&a!==n.id||a===n.id&&i!==n.id)&&(P+=t[r]||1),(i===E&&a!==E||a===E&&i!==E)&&(k+=t[r]||1)}),n.sumTot=P,i.sumTot=k}})}var T={},A=0;Object.keys(k).forEach(function(t){var e=k[t];if(e.nodes&&e.nodes.length){var r=String(A+1);r!==t&&(e.id=r,e.nodes=e.nodes.map(function(t){return{id:t.id,clusterId:r}}),k[r]=e,T[t]=r,delete k[t],A++)}else delete k[t]}),P.forEach(function(t){var e=t.node,r=t.clusterId;e&&(e.clusterId=r,e.clusterId&&T[e.clusterId]&&(e.clusterId=T[e.clusterId]))});var M=[],j={};h.forEach(function(t){var e=t.source,n=t.target,o=t[r]||1,i=m[e].node.clusterId,a=m[n].node.clusterId;if(i&&a){var s="".concat(i,"---").concat(a);if(j[s])j[s].weight+=o,j[s].count++;else{var u={source:i,target:a,weight:o,count:1};j[s]=u,M.push(u)}}});var I=[];return Object.keys(k).forEach(function(t){I.push(k[t])}),{clusters:I,clusterEdges:M}},Xg=function(t,e,r,n,o,i,a,s){return void 0===e&&(e=!1),void 0===r&&(r="weight"),void 0===n&&(n=1e-4),void 0===o&&(o=void 0),void 0===i&&(i=[]),void 0===a&&(a=["id"]),void 0===s&&(s=1),Yg(t,e,r,n,!0,o,i,a,s)},Jg=function(t,e){var r;void 0===e&&(e=1);for(var n=(0,rg.clone)(t),o=n.nodes,i=void 0===o?[]:o,a=n.edges,s=void 0===a?[]:a,u=function(){var t=Og({nodes:i,edges:s}),n=Object.keys(t);n.sort(function(e,r){var n,o;return(null===(n=t[e])||void 0===n?void 0:n.degree)-(null===(o=t[r])||void 0===o?void 0:o.degree)});var o=n[0];if(!i.length||(null===(r=t[o])||void 0===r?void 0:r.degree)>=e)return"break";var a=i.findIndex(function(t){return t.id===o});i.splice(a,1),s=s.filter(function(t){return!(t.source===o||t.target===o)})};"break"!==u(););return{nodes:i,edges:s}},Kg=function(t,e,r){var n=[];switch(t){case Lg.EuclideanDistance:n=e[r];break;default:n=[]}return n},Qg=function(t,e,r,n,o,i){void 0===e&&(e=3),void 0===r&&(r=void 0),void 0===n&&(n=[]),void 0===o&&(o=["id"]),void 0===i&&(i=Lg.EuclideanDistance);var a=t.nodes,s=void 0===a?[]:a,u=t.edges,l=void 0===u?[]:u,c={clusters:[{id:"0",nodes:s}],clusterEdges:[]};if(i===Lg.EuclideanDistance&&!s.every(function(t){return t.hasOwnProperty(r)}))return c;var f=[],h=[];if(i===Lg.EuclideanDistance&&(f=Ug(s,r),h=Vg(f,n,o)),!h.length)return c;for(var p=(0,rg.uniq)(h.map(function(t){return t.join("")})),d=Math.min(e,s.length,p.length),y=0;yw&&!v.find(function(e){return(0,rg.isEqual)(e,Kg(i,h,s[t].originIndex))})&&(w=o,S=t)}},_=0;_=0;T--)m[Number(s[y].clusterId)][T].id===s[y].id&&m[Number(s[y].clusterId)].splice(T,1);s[y].clusterId=String(O),m[O].push(s[y])}}var A=!1;for(y=0;y=1e3)break}var N=[],L={};return l.forEach(function(t){var e,r,n=t.source,o=t.target,i=null===(e=s.find(function(t){return t.id===n}))||void 0===e?void 0:e.clusterId,a=null===(r=s.find(function(t){return t.id===o}))||void 0===r?void 0:r.clusterId,u="".concat(i,"---").concat(a);if(L[u])L[u].count++;else{var l={source:i,target:a,count:1};L[u]=l,N.push(l)}}),{clusters:m,clusterEdges:N}},Zg=function(t,e){var r=new Gg(e),n=r.norm2(),o=new Gg(t),i=o.norm2(),a=r.dot(o),s=n*i,u=s?a/s:0;return u},$g=function(t,e,r,n,o){void 0===t&&(t=[]),void 0===r&&(r=void 0),void 0===n&&(n=[]),void 0===o&&(o=[]);var i=(0,rg.clone)(t.filter(function(t){return t.id!==e.id})),a=t.findIndex(function(t){return t.id===e.id}),s=Ug(t,r),u=Vg(s,n,o),l=u[a],c=[];return i.forEach(function(t,r){if(t.id!==e.id){var n=u[r],o=Zg(n,l);c.push(o),t.cosineSimilarity=o}}),i.sort(function(t,e){return e.cosineSimilarity-t.cosineSimilarity}),{allCosineSimilarity:c,similarNodes:i}},tm=function(){function t(t){this.count=t.length,this.parent={};for(var e=0,r=t;e0&&(this.list[0]=e,this.moveDown(0)),t},t.prototype.insert=function(t){if(null!==t){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},t.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var r=this.list[e];this.list[e]=this.list[t],this.list[t]=r,t=e,e=this.getParent(t)}},t.prototype.moveDown=function(t){var e,r=t,n=this.getLeft(t),o=this.getRight(t),i=this.list.length;null!==n&&n0?r=n:null!==o&&o0&&(r=o),t!==r&&(e=[this.list[r],this.list[t]],this.list[t]=e[0],this.list[r]=e[1],this.moveDown(r))},t}(),nm=function(t,e){var r=[],n=t.nodes,o=void 0===n?[]:n,i=t.edges,a=void 0===i?[]:i;if(0===o.length)return r;var s=o[0],u=new Set;u.add(s);var l=new rm(function(t,r){return e?t.weight-r.weight:0});for(mg(s.id,a).forEach(function(t){l.insert(t)});!l.isEmpty();){var c=l.delMin(),f=c.source,h=c.target;u.has(f)&&u.has(h)||(r.push(c),u.has(f)||(u.add(f),mg(f,a).forEach(function(t){l.insert(t)})),u.has(h)||(u.add(h),mg(h,a).forEach(function(t){l.insert(t)})))}return r},om=function(t,e){var r=[],n=t.nodes,o=void 0===n?[]:n,i=t.edges,a=void 0===i?[]:i;if(0===o.length)return r;var s=a.map(function(t){return t});e&&s.sort(function(t,e){return t.weight-e.weight});for(var u=new tm(o.map(function(t){return t.id}));s.length>0;){var l=s.shift(),c=l.source,f=l.target;u.connected(c,f)||(r.push(l),u.union(c,f))}return r},im=function(t,e,r){return r?{prim:nm,kruskal:om}[r](t,e):om(t,e)},am=function(t,e,r){"number"!=typeof e&&(e=1e-6),"number"!=typeof r&&(r=.85);for(var n,o=1,i=0,a=1e3,s=t.nodes,u=void 0===s?[]:s,l=t.edges,c=void 0===l?[]:l,f=u.length,h={},p={},d=0;d0&&o>e;){for(i=0,d=0;d0&&(n+=p[b]/w)}h[v]=r*n,i+=h[v]}}for(i=(1-i)/f,o=0,d=0;d=0;e--){var r=this.dfsEdgeList[e],n=r.fromNode,o=r.toNode;nf||n.hasNode(i[c.to])||(e.labeld&&"break"!==y(v);v--);if(h){var g=t.findMinLabel(f);i.dfsEdgeList.push(new dm(c,p,cm,g.edgeLabel,cm));var m=i.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[m]===i.dfsEdgeList[m]&&a(f[g.edgeLabel].projected)}var b={};h=!1;var w=0;s.forEach(function(e){var r=new vm(e),i=t.findForwardPureEdges(n,r.edges[u[0]],l,r);i.length>0&&(h=!0,w=c,i.forEach(function(t){var r="".concat(t.label,"-").concat(o[t.to].label);b[r]||(b[r]={projected:[],edgeLabel:t.label,nodeLabel2:o[t.to].label}),b[r].projected.push({graphId:n.id,edge:t,preNode:e})}))});var S=u.length,x=function(e){if(h)return"break";var r=u[e];s.forEach(function(e){var a=new vm(e),s=t.findForwardRmpathEdges(n,a.edges[r],l,a);s.length>0&&(h=!0,w=i.dfsEdgeList[r].fromNode,s.forEach(function(t){var r="".concat(t.label,"-").concat(o[t.to].label);b[r]||(b[r]={projected:[],edgeLabel:t.label,nodeLabel2:o[t.to].label}),b[r].projected.push({graphId:n.id,edge:t,preNode:e})}))})};for(v=0;v=0;f--){var h=e.findBackwardEdge(u,c.edges[n[f]],c.edges[n[0]],c);if(h){var p="".concat(e.dfsCode.dfsEdgeList[n[f]].fromNode,"-").concat(h.label);s[p]||(s[p]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[n[f]].fromNode,edgeLabel:h.label}),s[p].projected.push({graphId:t.graphId,edge:h,preNode:t})}}if(!(r>=e.maxNodeNum)){e.findForwardPureEdges(u,c.edges[n[0]],i,c).forEach(function(e){var r="".concat(o,"-").concat(e.label,"-").concat(l[e.to].label);a[r]||(a[r]={projected:[],fromNodeId:o,edgeLabel:e.label,nodeLabel2:l[e.to].label}),a[r].projected.push({graphId:t.graphId,edge:e,preNode:t})});var d=function(r){e.findForwardRmpathEdges(u,c.edges[n[r]],i,c).forEach(function(o){var i="".concat(e.dfsCode.dfsEdgeList[n[r]].fromNode,"-").concat(o.label,"-").concat(l[o.to].label);a[i]||(a[i]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[n[r]].fromNode,edgeLabel:o.label,nodeLabel2:l[o.to].label}),a[i].projected.push({graphId:t.graphId,edge:o,preNode:t})})};for(f=0;fo){var a=o;o=n,n=a}var c=t.label,f="".concat(r,"-").concat(n,"-").concat(c,"-").concat(o),h="".concat(n,"-").concat(c,"-").concat(o);if(!i[h]){var p=i[h]||0;p++,i[h]=p}s[f]={graphId:r,nodeLabel1:n,edgeLabel:c,nodeLabel2:o}})})}),Object.keys(o).forEach(function(t){if(!(o[t]e&&(s=e);var n=r[t.id].inDegree;u>n&&(u=n);var o=r[t.id].outDegree;l>o&&(l=o)}),t[e]={degree:s,inDegree:u,outDegree:l}),{minPatternNodeLabelDegree:s,minPatternNodeLabelInDegree:u,minPatternNodeLabelOutDegree:l}},Cm=function(t,e,r,n,o,i,a){var s;if(void 0===r&&(r=!1),void 0===i&&(i="cluster"),void 0===a&&(a="cluster"),t&&t.nodes){var u=t.nodes.length;if(u){var l=Bg(t,r),c=Bg(e,r),f=Om(t.nodes,l,r),h=Om(e.nodes,c,r),p=_m(t.nodes,i),d=p.nodeMap,y=p.nodeLabelMap,v=_m(e.nodes,i),g=v.nodeMap,m=v.nodeLabelMap;Em(t.edges,a,d);var b=Em(e.edges,a,g).edgeLabelMap,w=[];null===c||void 0===c||c.forEach(function(t){w=w.concat(t)}),o||(o=Math.max.apply(Math,(0,eg.__spreadArray)((0,eg.__spreadArray)([],w,!1),[2],!1))),n||(n=o);var S=bm(t,l,i,n),x=bm(e,c,i,n),_=function(t,e,r,n,o){var i=Math.ceil(r/e),a={},s=0;return n.forEach(function(t,n){for(var u=0,l=0,c=t.nodeIdxs,f=t.neighborNum-1;u2*e)););if(p<2*e&&(a["".concat(n,"-").concat(h)]={start:n,end:h,distance:o[n][h]},u++,++s>=r))return a;if(++l>2*e)break}uN&&(N=r.length,j=r,I=e,M=t)});var L={},R={},D={},B={},F={},G={};Object.keys(m).forEach(function(n,o){F[n]=[],r&&(G[n]=[]);var s=-1/0,u={};m[n].forEach(function(t){var e=h["".concat(M.id,"-").concat(t.id)];if(e&&F[n].push(e),sF[n][h]){c=!0;break}if(c)return j.splice(e,1),"continue";var p={};o.neighbors.forEach(function(t){var e=f["".concat(r.id,"-").concat(t.id)];p["".concat(r.id,"-").concat(t.id)]={start:d[r.id].idx,end:d[t.id].idx,distance:e}}),E=Sm(p,S,t,E);var y=[];Object.keys(p).forEach(function(t){if(A[t])y.push(A[t]);else{var e=E[t];A[t]=xm(e,T,i,a),y.push(A[t])}}),y=y.sort(function(t,e){return e-t});var v=!1;for(h=0;h=0;p--)c(p)});var U=[];null===j||void 0===j||j.forEach(function(n){for(var s=d[n.id].idx,u=wm(t.nodes,l[s],s,i,o).neighbors,c=!1,h=u.length-1;h>=0;h--){if(u.length+1F[y][w])u.splice(h,1);else{if(r){var x="".concat(p.id,"-").concat(n.id),_=f[x];if(w=G[y].length-1,_>G[y][w]){u.splice(h,1);continue}}var O=A[v]?A[v]:Pm(t,n,p,d,b,S,T,i,a,A,E),P="".concat(M.id,"-").concat(y);if(O=0&&"break"!==x(y);y--);if(S)return U.splice(n,1),"continue";o.edges=c;var _=Ig(o,o.nodes[0].id,!1).length;if(Object.keys(_).reverse().forEach(function(t){if(t!==o.nodes[0].id&&!S){if(_[t]===1/0){var e=l[t].node[i];if(u[e]--,u[e]V[n][V[n].length-1]){if(e=l[t].node[i],u[e]--,u[e]=0;P--){var k=o.nodes[P],C=l[k.id].degree,T=l[k.id].inDegree,A=l[k.id].outDegree,j=k[i],I=km(L,j,g,m),N=I.minPatternNodeLabelDegree,R=I.minPatternNodeLabelInDegree,D=I.minPatternNodeLabelOutDegree;if(r?C=0;B--){var F=c[B];if(!l[F.source]||!l[F.target]){c.splice(B,1);var G=F[a];if(f[G]--,l[F.source]&&(l[F.source].degree--,l[F.source].outDegree--),l[F.target]&&(l[F.target].degree--,l[F.target].inDegree--),b[G]&&f[G]=0&&"break"!==H(q);q--);var W=U.length,Y=function(t){var e={};U[t].edges.forEach(function(t){var r="".concat(t.source,"-").concat(t.target,"-").concat(t.label);e[r]?e[r]++:e[r]=1});for(var r=function(t){var r={};U[t].edges.forEach(function(t){var e="".concat(t.source,"-").concat(t.target,"-").concat(t.label);r[e]?r[e]++:r[e]=1});var n=!0;Object.keys(r).length!==Object.keys(e).length?n=!1:Object.keys(e).forEach(function(t){r[t]!==e[t]&&(n=!1)}),n&&U.splice(t,1)},n=W-1;n>t;n--)r(n);W=U.length};for(q=0;q<=W-1;q++)Y(q);return U}}},Tm=function(){function t(t){void 0===t&&(t=10),this.linkedList=new yg,this.maxStep=t}return Object.defineProperty(t.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},t.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},t.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},t.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},t.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},t}(),Am=jg,Mm={getAdjMatrix:hg,breadthFirstSearch:wg,connectedComponent:_g,getDegree:Og,getInDegree:Pg,getOutDegree:kg,detectCycle:jg,detectDirectedCycle:Am,detectAllCycles:Mg,detectAllDirectedCycle:Ag,detectAllUndirectedCycle:Tg,depthFirstSearch:Cg,dijkstra:Ig,findAllPath:Dg,findShortestPath:Rg,floydWarshall:Bg,labelPropagation:Fg,louvain:Yg,iLouvain:Xg,kCore:Jg,kMeans:Qg,cosineSimilarity:Zg,nodesCosineSimilarity:$g,minimumSpanningTree:im,pageRank:am,getNeighbors:gg,Stack:Tm,GADDI:Cm},jm=r(4995),Im=r(4732),Nm=fg,Lm=function(t){return function(e,r){return e[t]-r[t]}},Rm=function(t,e,r){return t>=e&&t<=r},Dm=function(t,e,r,n){var o=r.x-t.x,i=r.y-t.y,a=e.x-t.x,s=e.y-t.y,u=n.x-r.x,l=n.y-r.y,c=a*l-s*u,f=1/c;if(c*c>1e-4*(a*a+s*s)*(u*u+l*l)){var h=(o*l-i*u)*f,p=(o*s-i*a)*f;return Rm(h,0,1)&&Rm(p,0,1)?{x:t.x+h*a,y:t.y+h*s}:null}return null},Bm=function(t,e){var r=t.x,n=t.y,o=t.width,i=t.height,a=[],s={x:r+o/2,y:n+i/2};a.push({x:r,y:n}),a.push({x:r+o,y:n}),a.push({x:r+o,y:n+i}),a.push({x:r,y:n+i}),a.push({x:r,y:n});for(var u=null,l=1;le[n][i]+e[i][o]&&(e[n][o]=e[n][i]+e[i][o]);return e},Ym=function(t,e){var r=t.nodes,n=t.edges,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(function(t,e){i[t.id]=e;o.push([])}),n&&n.forEach(function(t){var r=t.source,n=t.target,a=i[r],s=i[n];o[a][s]=1,e||(o[s][a]=1)}),o},Xm=function(t,e){t.translate(e.x,e.y)},Jm=function(t,e,r,n){void 0===n&&(n={duration:500});var o=t.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]);var i=t.getCanvasBBox(),a=e.x-i.minX,s=e.y-i.minY;if(r){var u=a*o[0],l=s*o[4],c=0,f=0,h=0,p=0;t.animate(function(t){return o=Nm(o,[["t",(h=u*t)-c,(p=l*t)-f]]),c=h,f=p,{matrix:o}},n)}else{var d=Nm(o,[["t",a,s]]);t.setMatrix(d)}},Km=function(t,e){var r=t.getMatrix();r||(r=[1,0,0,0,1,0,0,0,1]);var n=e;(0,rg.isArray)(e)||(n=[e,e]),(0,rg.isArray)(e)&&1===e.length&&(n=[e[0],e[0]]),r=Nm(r,[["s",n[0],n[1]]]),t.setMatrix(r)},Qm=function(t,e){var r=t.getMatrix();r||(r=[1,0,0,0,1,0,0,0,1]),r=Nm(r,[["r",e]]),t.setMatrix(r)},Zm=function(t,e,r){for(var n=[],o=0;o0!=a(l[1]-r)>0&&a(e-(r-u[1])*(u[0]-l[0])/(u[1]-l[1])-u[0])<0&&(n=!n)}return n},eb=function(t,e){return!(e.minX>t.maxX||e.maxXt.maxY||e.maxY1){var a=t[0],s=t[r-1];e.push({from:{x:s[0],y:s[1]},to:{x:a[0],y:a[1]}})}return e};if(t.length<2||e.length<2)return!1;var o=r(t),i=r(e);if(!eb(o,i))return!1;var a=!1;if((0,rg.each)(e,function(e){if(tb(t,e[0],e[1]))return a=!0,!1}),a)return!0;if((0,rg.each)(t,function(t){if(tb(e,t[0],t[1]))return a=!0,!1}),a)return!0;var s=n(t),u=n(e),l=!1;return(0,rg.each)(u,function(t){if(function(t,e){var r=!1;return(0,rg.each)(t,function(t){if(Dm(t.from,t.to,e.from,e.to))return r=!0,!1}),r}(s,t))return l=!0,!1}),l},nb=function(){function t(t,e,r,n){this.x1=t,this.y1=e,this.x2=r,this.y2=n}return t.prototype.getBBox=function(){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),r=Math.max(this.x1,this.x2),n=Math.max(this.y1,this.y2);return{x:t,y:e,minX:t,minY:e,maxX:r,maxY:n,width:r-t,height:n-e}},t}(),ob=function(t,e){return{top:[t.minX,t.minY,t.maxX,t.minY],left:[t.minX,t.minY,t.minX,t.maxY],bottom:[t.minX,t.maxY,t.maxX,t.maxY],right:[t.maxX,t.minY,t.maxX,t.maxY]}[e]},ib=function(t,e){var r=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),n=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),o=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(o){var i=r/o,a=n/o;if(i>=0&&i<=1&&a>=0&&a<=1)return i}return Number.POSITIVE_INFINITY},ab=function(t,e){for(var r=["top","left","bottom","right"],n=t.getBBox(),o=0,i=[],a=0;a<4;a++){var s=ob(n,r[a]),u=s[0],l=s[1],c=s[2],f=s[3];i[a]=Dm({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:u,y:l},{x:c,y:f}),i[a]&&(o+=1)}return[i,o]},sb=function(t,e){for(var r=["top","left","bottom","right"],n=t.getBBox(),o=Number.POSITIVE_INFINITY,i=0,a=0;a<4;a++){var s=ob(n,r[a]),u=s[0],l=s[1],c=s[2],f=s[3],h=ib(e,new nb(u,l,c,f));(h=Math.abs(h-.5))>=0&&h<=1&&(i+=1,o=h0){for(var n=0,o=t;ne.x+e.width,o=t.y>e.y+e.height,i=t.y":.604998779296875,"/":.5,"?":.53699951171875},_b=Math.PI,Eb=Math.sin,Ob=Math.cos,Pb=Eb(_b/8),kb=Ob(_b/8),Cb=function(t,e){var r=t.getBBox(),n={x:r.minX,y:r.minY},o={x:r.maxX,y:r.maxY};if(e){var i=e.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]),n=Um(n,i),o=Um(o,i)}var a=n.x,s=n.y,u=o.x,l=o.y;return{x:a,y:s,minX:a,minY:s,maxX:u,maxY:l,width:u-a,height:l-s}},Tb=function(t){var e=t.sourceNode||t.targetNode,r=e.get("group").getMatrix();r||(r=[1,0,0,0,1,0,0,0,1]);var n=e.getKeyShape(),o=n.getBBox(),i=t.loopCfg||{},a=i.dist||2*Math.max(o.width,o.height),s=i.position||Sb.defaultLoopPosition,u=[(o.minX+o.maxX)/2+r[6],(o.minY+o.maxY)/2+r[7]],l=[t.startPoint.x,t.startPoint.y],c=[t.endPoint.x,t.endPoint.y],f=o.height/2,h=o.width/2,p=f,d=f,y=p*Pb,v=p*kb,g=d*Pb,m=d*kb,b=n.get("type"),w=Math.min(f/2,h/2),S=Math.min(f,h),x=(null===i||void 0===i?void 0:i.pointPadding)?Math.min(S,null===i||void 0===i?void 0:i.pointPadding):w;if(l[0]===c[0]&&l[1]===c[1]){switch(s){case"top":"circle"===b?(l=[u[0]-y,u[1]-v],c=[u[0]+g,u[1]-m]):(l=[u[0]-x,u[1]-f],c=[u[0]+x,u[1]-f]);break;case"top-right":p=f,d=h,"circle"===b?(l=[u[0]+(y=p*Pb),u[1]-(v=p*kb)],c=[u[0]+(m=d*kb),u[1]-(g=d*Pb)]):(l=[u[0]+h-x,u[1]-f],c=[u[0]+h,u[1]-f+x]);break;case"right":p=h,d=h,"circle"===b?(l=[u[0]+(v=p*kb),u[1]-(y=p*Pb)],c=[u[0]+(m=d*kb),u[1]+(g=d*Pb)]):(l=[u[0]+h,u[1]-x],c=[u[0]+h,u[1]+x]);break;case"bottom-right":p=h,d=f,"circle"===b?(l=[u[0]+(v=p*kb),u[1]+(y=p*Pb)],c=[u[0]+(g=d*Pb),u[1]+(m=d*kb)]):(l=[u[0]+h,u[1]+f-x],c=[u[0]+h-x,u[1]+f]);break;case"bottom":p=f,d=f,"circle"===b?(l=[u[0]+(y=p*Pb),u[1]+(v=p*kb)],c=[u[0]-(g=d*Pb),u[1]+(m=d*kb)]):(l=[u[0]-x,u[1]+f],c=[u[0]+x,u[1]+f]);break;case"bottom-left":p=f,d=h,"circle"===b?(l=[u[0]-(y=p*Pb),u[1]+(v=p*kb)],c=[u[0]-(m=d*kb),u[1]+(g=d*Pb)]):(l=[u[0]-h,u[1]+f-x],c=[u[0]-h+x,u[1]+f]);break;case"left":p=h,d=h,"circle"===b?(l=[u[0]-(v=p*kb),u[1]+(y=p*Pb)],c=[u[0]-(m=d*kb),u[1]-(g=d*Pb)]):(l=[u[0]-h,u[1]-x],c=[u[0]-h,u[1]+x]);break;case"top-left":p=h,d=f,"circle"===b?(l=[u[0]-(v=p*kb),u[1]-(y=p*Pb)],c=[u[0]-(g=d*Pb),u[1]-(m=d*kb)]):(l=[u[0]-h+x,u[1]-f],c=[u[0]-h,u[1]-f+x]);break;default:l=[u[0]-(y=(p=h)*Pb),u[1]-(v=p*kb)],c=[u[0]+(g=(d=h)*Pb),u[1]-(m=d*kb)]}if(!1===i.clockwise){var _=[l[0],l[1]];l=[c[0],c[1]],c=[_[0],_[1]]}}var E=[l[0]-u[0],l[1]-u[1]],O=(p+a)/p,P=(d+a)/d;!1===i.clockwise&&(O=(d+a)/d,P=(p+a)/p);var k=Im.scale([0,0],E,O),C=[u[0]+k[0],u[1]+k[1]],T=[c[0]-u[0],c[1]-u[1]],A=Im.scale([0,0],T,P),M=[u[0]+A[0],u[1]+A[1]];return t.startPoint={x:l[0],y:l[1]},t.endPoint={x:c[0],y:c[1]},t.controlPoints=[{x:C[0],y:C[1]},{x:M[0],y:M[1]}],t},Ab=function(t,e,r,n,o){var i=[],a=null===t||void 0===t?void 0:t.getPoint(e);if(!a)return{x:0,y:0,angle:0};if(e<1e-4)i=t.getStartTangent().reverse();else if(e>.9999)i=t.getEndTangent();else{var s=null===t||void 0===t?void 0:t.getPoint(e+1e-4);i.push([a.x,a.y]),i.push([s.x,s.y])}var u=Math.atan2(i[1][1]-i[0][1],i[1][0]-i[0][0]);if(u<0&&(u+=2*_b),r&&(a.x+=Ob(u)*r,a.y+=Eb(u)*r),n){var l=u-_b/2;u>.5*_b&&u<1.5*_b&&(l-=_b),a.x+=Ob(l)*n,a.y+=Eb(l)*n}var c={x:a.x,y:a.y,angle:u};return o?(u>.5*_b&&u<1.5*_b&&(u-=_b),(0,eg.__assign)({rotate:u},c)):c},Mb=function(t,e){"function"==typeof e&&function t(e,r,n,o){if(!1===o(e,r,n))return!1;if(e&&e.children)for(var i=e.children.length-1;i>=0;i--)if(!t(e.children[i],e,i,o))return!1;return!0}(t,null,-1,e)},jb=function(t,e){"function"==typeof e&&function t(e,r,n,o){if(e&&e.children)for(var i=e.children.length-1;i>=0;i--)if(!t(e.children[i],e,i,o))return;return!1!==o(e,r,n)}(t,null,-1,e)},Ib=function(t,e){return e*(xb[t]||1)},Nb=function(t,e){var r=0,n=new RegExp("[一-龥]+");return t.split("").forEach(function(t){n.test(t)?r+=e:r+=Ib(t,e)}),[r,e]},Lb=function(t,e){return"number"!=typeof e||e<=0||e>=t.length?t:t.substring(0,e)+"..."},Rb=function(t,e){var r=[],n={},o={};t.forEach(function(t){o[t.id]=t}),t.forEach(function(t,e){var i=(0,rg.clone)(t);i.itemType="combo",i.children=void 0,i.parentId===i.id?(console.warn("The parentId for combo ".concat(i.id," can not be the same as the combo's id")),delete i.parentId):i.parentId&&!o[i.parentId]&&(console.warn("The parent combo for combo ".concat(i.id," does not exist!")),delete i.parentId);var a=n[i.id];if(a){if(i.children=a.children,n[i.id]=i,!(a=i).parentId)return void r.push(a);var s=n[a.parentId];if(s)s.children?s.children.push(i):s.children=[i];else{var u={id:a.parentId,children:[a]};n[a.parentId]=u,n[i.id]=i}}else if((0,rg.isString)(t.parentId)){var l=n[t.parentId];if(l)l.children?l.children.push(i):l.children=[i],n[i.id]=i;else{var c={id:t.parentId,children:[i]};n[c.id]=c,n[i.id]=i}}else r.push(i),n[i.id]=i});var i={};(e||[]).forEach(function(t){i[t.id]=t;var e=n[t.comboId];if(e){var r={id:t.id,comboId:t.comboId};e.children?e.children.push(r):e.children=[r],r.itemType="node",n[t.id]=r}});var a=0;return r.forEach(function(t){t.depth=a+10,Mb(t,function(t){var e,r=n[t.id].itemType;e="node"===r?n[t.comboId]:n[t.parentId],t.depth=e&&"node"===r?a+1:a+10,a-1&&i.splice(l,1),s||(o={id:e,itemType:"node",comboId:r},a[e]={children:void 0}),e){var c=!1;if(r){var f=0;(t||[]).forEach(function(t){c||Mb(t,function(t){return r!==t.id||(c=!0,t.children?t.children.push(o):t.children=[o],f=t.depth,"node"===o.itemType?o.depth=f+2:o.depth=f+1,!1)})})}else r&&c||"node"===o.itemType||t.push(o);var h=o.depth;Mb(o,function(t){return"node"===t.itemType?h+=2:h+=1,t.depth=h,!0})}return t},Bb=function(t,e,r){var n={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,x:void 0,y:void 0,width:void 0,height:void 0,centerX:void 0,centerY:void 0};if(!t||0===t.length){var o=(null===r||void 0===r?void 0:r.getModel())||{},i=o.x,a=o.y,s=o.fixSize,u=o.collapsed,l=o.fixCollapseSize,c=u?l:s,f=(0,rg.isArray)(c)?c:[c,c],h=f[0],p=f[1],d=[h/2,p/2];return{minX:i-d[0],minY:a-d[1],maxX:i+d[0],maxY:a+d[1],x:i,y:a,width:h,height:p}}return t.forEach(function(t){var r=e.findById(t.id);if(r&&r.isVisible()){r.set("bboxCanvasCache",void 0);var o=r.getCanvasBBox();o.x&&n.minX>o.minX&&(n.minX=o.minX),o.y&&n.minY>o.minY&&(n.minY=o.minY),o.x&&n.maxX2&&(r.push([o].concat(a.splice(0,2))),s="l",o="m"===o?"l":"L"),"o"===s&&1===a.length&&r.push([o,a[0]]),"r"===s)r.push([o].concat(a));else for(;a.length>=e[s]&&(r.push([o].concat(a.splice(0,e[s]))),e[s]););return t}),r},Xb=function(t,e){for(var r=[],n=0,o=t.length;o-2*!e>n;n+=2){var i=[{x:+t[n-2],y:+t[n-1]},{x:+t[n],y:+t[n+1]},{x:+t[n+2],y:+t[n+3]},{x:+t[n+4],y:+t[n+5]}];e?n?o-4===n?i[3]={x:+t[0],y:+t[1]}:o-2===n&&(i[2]={x:+t[0],y:+t[1]},i[3]={x:+t[2],y:+t[3]}):i[0]={x:+t[o-2],y:+t[o-1]}:o-4===n?i[3]=i[2]:n||(i[0]={x:+t[n],y:+t[n+1]}),r.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y])}return r},Jb=function(t,e,r,n,o){var i=[];if(null===o&&null===n&&(n=r),t=+t,e=+e,r=+r,n=+n,null!==o){var a=Math.PI/180,s=t+r*Math.cos(-n*a),u=t+r*Math.cos(-o*a);i=[["M",s,e+r*Math.sin(-n*a)],["A",r,r,0,+(o-n>180),0,u,e+r*Math.sin(-o*a)]]}else i=[["M",t,e],["m",0,-n],["a",r,n,0,1,1,0,2*n],["a",r,n,0,1,1,0,-2*n],["z"]];return i},Kb=function(t){if(!(t=Yb(t))||!t.length)return[["M",0,0]];var e,r,n=[],o=0,i=0,a=0,s=0,u=0;"M"===t[0][0]&&(a=o=+t[0][1],s=i=+t[0][2],u++,n[0]=["M",o,i]);for(var l=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase(),c=void 0,f=void 0,h=u,p=t.length;h1&&(n*=x=Math.sqrt(x),o*=x);var _=n*n,E=o*o,O=(a===s?-1:1)*Math.sqrt(Math.abs((_*E-_*S*S-E*w*w)/(_*S*S+E*w*w)));d=O*n*S/o+(e+u)/2,y=O*-o*w/n+(r+l)/2,h=Math.asin(((r-y)/o).toFixed(9)),p=Math.asin(((l-y)/o).toFixed(9)),h=ep&&(h-=2*Math.PI),!s&&p>h&&(p-=2*Math.PI)}var P=p-h;if(Math.abs(P)>v){var k=p,C=u,T=l;p=h+v*(s&&p>h?1:-1),m=t(u=d+n*Math.cos(p),l=y+o*Math.sin(p),n,o,i,0,s,C,T,[p,k,d,y])}P=p-h;var A=Math.cos(h),M=Math.sin(h),j=Math.cos(p),I=Math.sin(p),N=Math.tan(P/4),L=4/3*n*N,R=4/3*o*N,D=[e,r],B=[e+L*M,r-R*A],F=[u+L*I,l-R*j],G=[u,l];if(B[0]=2*D[0]-B[0],B[1]=2*D[1]-B[1],c)return[B,F,G].concat(m);for(var U=[],z=0,V=(m=[B,F,G].concat(m).join().split(",")).length;z7){t[e].shift();for(var i=t[e];i.length;)s[e]="A",o&&(u[e]="A"),t.splice(e++,0,["C"].concat(i.splice(0,6)));t.splice(e,1),r=Math.max(n.length,o&&o.length||0)}},p=function(t,e,i,a,s){t&&e&&"M"===t[s][0]&&"M"!==e[s][0]&&(e.splice(s,0,["M",a.x,a.y]),i.bx=0,i.by=0,i.x=t[s][1],i.y=t[s][2],r=Math.max(n.length,o&&o.length||0))};r=Math.max(n.length,o&&o.length||0);for(var d=0;d1?1:u<0?0:u)/2,c=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,p=0;p<12;p++){var d=l*c[p]+l,y=rw(d,t,r,o,a),v=rw(d,e,n,i,s),g=y*y+v*v;h+=f[p]*Math.sqrt(g)}return l*h},ow=function(t,e,r,n,o,i,a,s){if(!(Math.max(t,r)Math.max(o,a)||Math.max(e,n)Math.max(i,s))){var u=(t-r)*(i-s)-(e-n)*(o-a);if(u){var l=((t*n-e*r)*(o-a)-(t-r)*(o*s-i*a))/u,c=((t*n-e*r)*(i-s)-(e-n)*(o*s-i*a))/u,f=+l.toFixed(2),h=+c.toFixed(2);if(!(f<+Math.min(t,r).toFixed(2)||f>+Math.max(t,r).toFixed(2)||f<+Math.min(o,a).toFixed(2)||f>+Math.max(o,a).toFixed(2)||h<+Math.min(e,n).toFixed(2)||h>+Math.max(e,n).toFixed(2)||h<+Math.min(i,s).toFixed(2)||h>+Math.max(i,s).toFixed(2)))return{x:l,y:c}}}},iw=function(t,e,r){return e>=t.x&&e<=t.x+t.width&&r>=t.y&&r<=t.y+t.height},aw=function(t,e,r,n,o){if(o)return[["M",+t+ +o,e],["l",r-2*o,0],["a",o,o,0,0,1,o,o],["l",0,n-2*o],["a",o,o,0,0,1,-o,o],["l",2*o-r,0],["a",o,o,0,0,1,-o,-o],["l",0,2*o-n],["a",o,o,0,0,1,o,-o],["z"]];var i=[["M",t,e],["l",r,0],["l",0,n],["l",-r,0],["z"]];return i.parsePathArray=ew,i},sw=function(t,e,r,n){return null===t&&(t=e=r=n=0),null===e&&(e=t.y,r=t.width,n=t.height,t=t.x),{x:t,y:e,width:r,w:r,height:n,h:n,x2:t+r,y2:e+n,cx:t+r/2,cy:e+n/2,r1:Math.min(r,n)/2,r2:Math.max(r,n)/2,r0:Math.sqrt(r*r+n*n)/2,path:aw(t,e,r,n),vb:[t,e,r,n].join(" ")}},uw=function(t,e,r,n,o,i,a,s){(0,rg.isArray)(t)||(t=[t,e,r,n,o,i,a,s]);var u=function(t,e,r,n,o,i,a,s){for(var u,l,c,f,h=[],p=[[],[]],d=0;d<2;++d)if(0===d?(l=6*t-12*r+6*o,u=-3*t+9*r-9*o+3*a,c=3*r-3*t):(l=6*e-12*n+6*i,u=-3*e+9*n-9*i+3*s,c=3*n-3*e),Math.abs(u)<1e-12){if(Math.abs(l)<1e-12)continue;(f=-c/l)>0&&f<1&&h.push(f)}else{var y=l*l-4*c*u,v=Math.sqrt(y);if(!(y<0)){var g=(-l+v)/(2*u);g>0&&g<1&&h.push(g);var m=(-l-v)/(2*u);m>0&&m<1&&h.push(m)}}for(var b,w=h.length,S=w;w--;)b=1-(f=h[w]),p[0][w]=b*b*b*t+3*b*b*f*r+3*b*f*f*o+f*f*f*a,p[1][w]=b*b*b*e+3*b*b*f*n+3*b*f*f*i+f*f*f*s;return p[0][S]=t,p[1][S]=e,p[0][S+1]=a,p[1][S+1]=s,p[0].length=p[1].length=S+2,{min:{x:Math.min.apply(0,p[0]),y:Math.min.apply(0,p[1])},max:{x:Math.max.apply(0,p[0]),y:Math.max.apply(0,p[1])}}}.apply(null,t);return sw(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},lw=function(t,e,r,n,o,i,a,s,u){var l=1-u,c=Math.pow(l,3),f=Math.pow(l,2),h=u*u,p=h*u,d=t+2*u*(r-t)+h*(o-2*r+t),y=e+2*u*(n-e)+h*(i-2*n+e),v=r+2*u*(o-r)+h*(a-2*o+r),g=n+2*u*(i-n)+h*(s-2*i+n);return{x:c*t+3*f*u*r+3*l*u*u*o+p*a,y:c*e+3*f*u*n+3*l*u*u*i+p*s,m:{x:d,y:y},n:{x:v,y:g},start:{x:l*t+u*r,y:l*e+u*n},end:{x:l*o+u*a,y:l*i+u*s},alpha:90-180*Math.atan2(d-v,y-g)/Math.PI}},cw=function(t,e,r){if(!function(t,e){return t=sw(t),e=sw(e),iw(e,t.x,t.y)||iw(e,t.x2,t.y)||iw(e,t.x,t.y2)||iw(e,t.x2,t.y2)||iw(t,e.x,e.y)||iw(t,e.x2,e.y)||iw(t,e.x,e.y2)||iw(t,e.x2,e.y2)||(t.xe.x||e.xt.x)&&(t.ye.y||e.yt.y)}(uw(t),uw(e)))return r?0:[];for(var n=~~(nw.apply(0,t)/8),o=~~(nw.apply(0,e)/8),i=[],a=[],s={},u=r?0:[],l=0;l=0&&b<=1&&w>=0&&w<=1&&(r?u+=1:u.push({x:m.x,y:m.y,t1:b,t2:w}))}}return u},fw=function(t,e){return function(t,e,r){var n,o,i,a,s,u,l,c,f,h;t=$b(t),e=$b(e);for(var p=r?0:[],d=0,y=t.length;d=3&&(3===t.length&&e.push("Q"),e=e.concat(t[1])),2===t.length&&e.push("L"),e=e.concat(t[t.length-1])})}(t,e,r));else{var o=[].concat(t);"M"===o[0]&&(o[0]="L");for(var i=0;i<=r-1;i++)n.push(o)}return n},dw=function(t,e){if(1===t.length)return t;var r=t.length-1,n=e.length-1,o=r/n,i=[];if(1===t.length&&"M"===t[0][0]){for(var a=0;a=0;u--)a=i[u].index,"add"===i[u].type?t.splice(a,0,[].concat(t[a])):t.splice(a,1)}var f=o-(n=t.length);if(n0)){t[n]=e[n];break}r=mw(r,t[n-1],1)}t[n]=["Q"].concat(r.reduce(function(t,e){return t.concat(e)},[]));break;case"T":t[n]=["T"].concat(r[0]);break;case"C":if(r.length<3){if(!(n>0)){t[n]=e[n];break}r=mw(r,t[n-1],2)}t[n]=["C"].concat(r.reduce(function(t,e){return t.concat(e)},[]));break;case"S":if(r.length<2){if(!(n>0)){t[n]=e[n];break}r=mw(r,t[n-1],1)}t[n]=["S"].concat(r.reduce(function(t,e){return t.concat(e)},[]));break;default:t[n]=e[n]}return t},Sw=function(){function t(t,e){this.bubbles=!0,this.target=null,this.currentTarget=null,this.delegateTarget=null,this.delegateObject=null,this.defaultPrevented=!1,this.propagationStopped=!1,this.shape=null,this.fromShape=null,this.toShape=null,this.propagationPath=[],this.type=t,this.name=t,this.originalEvent=e,this.timeStamp=e.timeStamp}return t.prototype.preventDefault=function(){this.defaultPrevented=!0,this.originalEvent.preventDefault&&this.originalEvent.preventDefault()},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t.prototype.toString=function(){return"[Event (type="+this.type+")]"},t.prototype.save=function(){},t.prototype.restore=function(){},t}();function xw(t,e){var r=t.indexOf(e);-1!==r&&t.splice(r,1)}var _w="undefined"!=typeof window&&void 0!==window.document;function Ew(t,e){if(t.isCanvas())return!0;for(var r=e.getParent(),n=!1;r;){if(r===t){n=!0;break}r=r.getParent()}return n}function Ow(t){return t.cfg.visible&&t.cfg.capture}var Pw=function(t){function e(e){var r=t.call(this)||this;r.destroyed=!1;var n=r.getDefaultCfg();return r.cfg=(0,rg.mix)(n,e),r}return(0,eg.__extends)(e,t),e.prototype.getDefaultCfg=function(){return{}},e.prototype.get=function(t){return this.cfg[t]},e.prototype.set=function(t,e){this.cfg[t]=e},e.prototype.destroy=function(){this.cfg={destroyed:!0},this.off(),this.destroyed=!0},e}(ag),kw=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o0?n=function(t,e){if(e.onFrame)return t;var r=e.startTime,n=e.delay,o=e.duration,i=Object.prototype.hasOwnProperty;return(0,rg.each)(t,function(t){r+nt.delay&&(0,rg.each)(e.toAttrs,function(e,r){i.call(t.toAttrs,r)&&(delete t.toAttrs[r],delete t.fromAttrs[r])})}),t}(n,m):r.addAnimator(this),n.push(m),this.set("animations",n),this.set("_pause",{isPaused:!1})}},e.prototype.stopAnimate=function(t){var e=this;void 0===t&&(t=!0);var r=this.get("animations");(0,rg.each)(r,function(r){t&&(r.onFrame?e.attr(r.onFrame(1)):e.attr(r.toAttrs)),r.callback&&r.callback()}),this.set("animating",!1),this.set("animations",[])},e.prototype.pauseAnimate=function(){var t=this.get("timeline"),e=this.get("animations"),r=t.getTime();return(0,rg.each)(e,function(t){t._paused=!0,t._pauseTime=r,t.pauseCallback&&t.pauseCallback()}),this.set("_pause",{isPaused:!0,pauseTime:r}),this},e.prototype.resumeAnimate=function(){var t=this.get("timeline").getTime(),e=this.get("animations"),r=this.get("_pause").pauseTime;return(0,rg.each)(e,function(e){e.startTime=e.startTime+(t-r),e._paused=!1,e._pauseTime=null,e.resumeCallback&&e.resumeCallback()}),this.set("_pause",{isPaused:!1}),this.set("animations",e),this},e.prototype.emitDelegation=function(t,e){var r,n=this,o=e.propagationPath;this.getEvents();"mouseenter"===t?r=e.fromShape:"mouseleave"===t&&(r=e.toShape);for(var i=function(t){var i=o[t],s=i.get("name");if(s){if((i.isGroup()||i.isCanvas&&i.isCanvas())&&r&&Ew(i,r))return"break";(0,rg.isArray)(s)?(0,rg.each)(s,function(t){n.emitDelegateEvent(i,t,e)}):a.emitDelegateEvent(i,s,e)}},a=this,s=0;s0)});return o.length>0?(0,rg.each)(o,function(o){var i=o.getBBox(),a=i.minX,s=i.maxX,u=i.minY,l=i.maxY;ae&&(e=s),un&&(n=l)}):(t=0,e=0,r=0,n=0),{x:t,y:r,minX:t,minY:r,maxX:e,maxY:n,width:e-t,height:n-r}},e.prototype.getCanvasBBox=function(){var t=1/0,e=-1/0,r=1/0,n=-1/0,o=this.getChildren().filter(function(t){return t.get("visible")&&(!t.isGroup()||t.isGroup()&&t.getChildren().length>0)});return o.length>0?(0,rg.each)(o,function(o){var i=o.getCanvasBBox(),a=i.minX,s=i.maxX,u=i.minY,l=i.maxY;ae&&(e=s),un&&(n=l)}):(t=0,e=0,r=0,n=0),{x:t,y:r,minX:t,minY:r,maxX:e,maxY:n,width:e-t,height:n-r}},e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.children=[],e},e.prototype.onAttrChange=function(e,r,n){if(t.prototype.onAttrChange.call(this,e,r,n),"matrix"===e){var o=this.getTotalMatrix();this._applyChildrenMarix(o)}},e.prototype.applyMatrix=function(e){var r=this.getTotalMatrix();t.prototype.applyMatrix.call(this,e);var n=this.getTotalMatrix();n!==r&&this._applyChildrenMarix(n)},e.prototype._applyChildrenMarix=function(t){var e=this.getChildren();(0,rg.each)(e,function(e){e.applyMatrix(t)})},e.prototype.addShape=function(){for(var t=[],e=0;e=0;i--){var a=t[i];if(Ow(a)&&(a.isGroup()?o=a.getShape(e,r,n):a.isHit(e,r)&&(o=a)),o)break}return o},e.prototype.add=function(t){var e=this.getCanvas(),r=this.getChildren(),n=this.get("timeline"),o=t.getParent();o&&function(t,e,r){void 0===r&&(r=!0),r?e.destroy():(e.set("parent",null),e.set("canvas",null)),xw(t.getChildren(),e)}(o,t,!1),t.set("parent",this),e&&function t(e,r){if(e.set("canvas",r),e.isGroup()){var n=e.get("children");n.length&&n.forEach(function(e){t(e,r)})}}(t,e),n&&function t(e,r){if(e.set("timeline",r),e.isGroup()){var n=e.get("children");n.length&&n.forEach(function(e){t(e,r)})}}(t,n),r.push(t),t.onCanvasChange("add"),this._applyElementMatrix(t)},e.prototype._applyElementMatrix=function(t){var e=this.getTotalMatrix();e&&t.applyMatrix(e)},e.prototype.getChildren=function(){return this.get("children")||[]},e.prototype.sort=function(){var t,e=this.getChildren();(0,rg.each)(e,function(t,e){return t[Xw]=e,t}),e.sort((t=function(t,e){return t.get("zIndex")-e.get("zIndex")},function(e,r){var n=t(e,r);return 0===n?e[Xw]-r[Xw]:n})),this.onCanvasChange("sort")},e.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var t=this.getChildren(),e=t.length-1;e>=0;e--)t[e].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},e.prototype.destroy=function(){this.get("destroyed")||(this.clear(),t.prototype.destroy.call(this))},e.prototype.getFirst=function(){return this.getChildByIndex(0)},e.prototype.getLast=function(){var t=this.getChildren();return this.getChildByIndex(t.length-1)},e.prototype.getChildByIndex=function(t){return this.getChildren()[t]},e.prototype.getCount=function(){return this.getChildren().length},e.prototype.contain=function(t){return this.getChildren().indexOf(t)>-1},e.prototype.removeChild=function(t,e){void 0===e&&(e=!0),this.contain(t)&&t.remove(e)},e.prototype.findAll=function(t){var e=[],r=this.getChildren();return(0,rg.each)(r,function(r){t(r)&&e.push(r),r.isGroup()&&(e=e.concat(r.findAll(t)))}),e},e.prototype.find=function(t){var e=null,r=this.getChildren();return(0,rg.each)(r,function(r){if(t(r)?e=r:r.isGroup()&&(e=r.find(t)),e)return!1}),e},e.prototype.findById=function(t){return this.find(function(e){return e.get("id")===t})},e.prototype.findByClassName=function(t){return this.find(function(e){return e.get("className")===t})},e.prototype.findAllByName=function(t){return this.findAll(function(e){return e.get("name")===t})},e}(Ww),Kw=r(5838);function Qw(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Zw(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function $w(){}var tS="\\s*([+-]?\\d+)\\s*",eS="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rS="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",nS=/^#([0-9a-f]{3,8})$/,oS=new RegExp("^rgb\\(".concat(tS,",").concat(tS,",").concat(tS,"\\)$")),iS=new RegExp("^rgb\\(".concat(rS,",").concat(rS,",").concat(rS,"\\)$")),aS=new RegExp("^rgba\\(".concat(tS,",").concat(tS,",").concat(tS,",").concat(eS,"\\)$")),sS=new RegExp("^rgba\\(".concat(rS,",").concat(rS,",").concat(rS,",").concat(eS,"\\)$")),uS=new RegExp("^hsl\\(".concat(eS,",").concat(rS,",").concat(rS,"\\)$")),lS=new RegExp("^hsla\\(".concat(eS,",").concat(rS,",").concat(rS,",").concat(eS,"\\)$")),cS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function fS(){return this.rgb().formatHex()}function hS(){return this.rgb().formatRgb()}function pS(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=nS.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?dS(e):3===r?new gS(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?yS(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?yS(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=oS.exec(t))?new gS(e[1],e[2],e[3],1):(e=iS.exec(t))?new gS(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=aS.exec(t))?yS(e[1],e[2],e[3],e[4]):(e=sS.exec(t))?yS(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=uS.exec(t))?_S(e[1],e[2]/100,e[3]/100,1):(e=lS.exec(t))?_S(e[1],e[2]/100,e[3]/100,e[4]):cS.hasOwnProperty(t)?dS(cS[t]):"transparent"===t?new gS(NaN,NaN,NaN,0):null}function dS(t){return new gS(t>>16&255,t>>8&255,255&t,1)}function yS(t,e,r,n){return n<=0&&(t=e=r=NaN),new gS(t,e,r,n)}function vS(t,e,r,n){return 1===arguments.length?((o=t)instanceof $w||(o=pS(o)),o?new gS((o=o.rgb()).r,o.g,o.b,o.opacity):new gS):new gS(t,e,r,null==n?1:n);var o}function gS(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function mS(){return"#".concat(xS(this.r)).concat(xS(this.g)).concat(xS(this.b))}function bS(){var t=wS(this.opacity);return"".concat(1===t?"rgb(":"rgba(").concat(SS(this.r),", ").concat(SS(this.g),", ").concat(SS(this.b)).concat(1===t?")":", ".concat(t,")"))}function wS(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function SS(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function xS(t){return((t=SS(t))<16?"0":"")+t.toString(16)}function _S(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new OS(t,e,r,n)}function ES(t){if(t instanceof OS)return new OS(t.h,t.s,t.l,t.opacity);if(t instanceof $w||(t=pS(t)),!t)return new OS;if(t instanceof OS)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=NaN,s=i-o,u=(i+o)/2;return s?(a=e===i?(r-n)/s+6*(r0&&u<1?0:a,new OS(a,s,u,t.opacity)}function OS(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function PS(t){return(t=(t||0)%360)<0?t+360:t}function kS(t){return Math.max(0,Math.min(1,t||0))}function CS(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}function TS(t,e,r,n,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*r+(1+3*t+3*i-3*a)*n+a*o)/6}Qw($w,pS,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:fS,formatHex:fS,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ES(this).formatHsl()},formatRgb:hS,toString:hS}),Qw(gS,vS,Zw($w,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new gS(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new gS(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},clamp:function(){return new gS(SS(this.r),SS(this.g),SS(this.b),wS(this.opacity))},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mS,formatHex:mS,formatHex8:function(){return"#".concat(xS(this.r)).concat(xS(this.g)).concat(xS(this.b)).concat(xS(255*(isNaN(this.opacity)?1:this.opacity)))},formatRgb:bS,toString:bS})),Qw(OS,function(t,e,r,n){return 1===arguments.length?ES(t):new OS(t,e,r,null==n?1:n)},Zw($w,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new OS(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new OS(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,o=2*r-n;return new gS(CS(t>=240?t-240:t+120,o,n),CS(t,o,n),CS(t<120?t+240:t-120,o,n),this.opacity)},clamp:function(){return new OS(PS(this.h),kS(this.s),kS(this.l),wS(this.opacity))},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=wS(this.opacity);return"".concat(1===t?"hsl(":"hsla(").concat(PS(this.h),", ").concat(100*kS(this.s),"%, ").concat(100*kS(this.l),"%").concat(1===t?")":", ".concat(t,")"))}}));var AS=function(t){return function(){return t}};function MS(t,e){return function(r){return t+r*e}}function jS(t){return 1==(t=+t)?IS:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):AS(isNaN(e)?r:e)}}function IS(t,e){var r=e-t;return r?MS(t,r):AS(isNaN(t)?e:t)}var NS=function t(e){var r=jS(e);function n(t,e){var n=r((t=vS(t)).r,(e=vS(e)).r),o=r(t.g,e.g),i=r(t.b,e.b),a=IS(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=o(e),t.b=i(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function LS(t){return function(e){var r,n,o=e.length,i=new Array(o),a=new Array(o),s=new Array(o);for(r=0;r=1?(r=1,e-1):Math.floor(r*e),o=t[n],i=t[n+1],a=n>0?t[n-1]:2*o-i,s=ni&&(o=e.slice(i,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(n=n[0])?s[a]?s[a]+=n:s[++a]=n:(s[++a]=null,u.push({i:a,x:FS(r,n)})),i=zS.lastIndex;return if.length?(c=Yb(i[l]),f=Yb(o[l]),f=gw(f,c),f=ww(f,c),e.fromAttrs.path=f,e.toAttrs.path=c):e.pathFormatted||(c=Yb(i[l]),f=Yb(o[l]),f=ww(f,c),e.fromAttrs.path=f,e.toAttrs.path=c,e.pathFormatted=!0),n[l]=[];for(var h=0;h0){for(var i=n.animators.length-1;i>=0;i--)if((t=n.animators[i]).destroyed)n.removeAnimator(i);else{if(!t.isAnimatePaused())for(var a=(e=t.get("animations")).length-1;a>=0;a--)r=e[a],Dx(t,r,o)&&(e.splice(a,1),!1,r.callback&&r.callback());0===e.length&&n.removeAnimator(i)}n.canvas.get("autoDraw")||n.canvas.draw()}})},t.prototype.addAnimator=function(t){this.animators.push(t)},t.prototype.removeAnimator=function(t){this.animators.splice(t,1)},t.prototype.isAnimating=function(){return!!this.animators.length},t.prototype.stop=function(){this.timer&&this.timer.stop()},t.prototype.stopAllAnimations=function(t){void 0===t&&(t=!0),this.animators.forEach(function(e){e.stopAnimate(t)}),this.animators=[],this.canvas.draw()},t.prototype.getTime=function(){return this.current},t}(),Fx=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function Gx(t,e,r){r.name=e,r.target=t,r.currentTarget=t,r.delegateTarget=t,t.emit(e,r)}function Ux(t,e,r){if(r.bubbles){var n=void 0,o=!1;if("mouseenter"===e?(n=r.fromShape,o=!0):"mouseleave"===e&&(o=!0,n=r.toShape),t.isCanvas()&&o)return;if(n&&Ew(t,n))return void(r.bubbles=!1);r.name=e,r.currentTarget=t,r.delegateTarget=t,t.emit(e,r)}}var zx=function(){function t(t){var e=this;this.draggingShape=null,this.dragging=!1,this.currentShape=null,this.mousedownShape=null,this.mousedownPoint=null,this._eventCallback=function(t){var r=t.type;e._triggerEvent(r,t)},this._onDocumentMove=function(t){if(e.canvas.get("el")!==t.target&&(e.dragging||e.currentShape)){var r=e._getPointInfo(t);e.dragging&&e._emitEvent("drag",t,r,e.draggingShape)}},this._onDocumentMouseUp=function(t){if(e.canvas.get("el")!==t.target&&e.dragging){var r=e._getPointInfo(t);e.draggingShape&&e._emitEvent("drop",t,r,null),e._emitEvent("dragend",t,r,e.draggingShape),e._afterDrag(e.draggingShape,r,t)}},this.canvas=t.canvas}return t.prototype.init=function(){this._bindEvents()},t.prototype._bindEvents=function(){var t=this,e=this.canvas.get("el");(0,rg.each)(Fx,function(r){e.addEventListener(r,t._eventCallback)}),document&&(document.addEventListener("mousemove",this._onDocumentMove),document.addEventListener("mouseup",this._onDocumentMouseUp))},t.prototype._clearEvents=function(){var t=this,e=this.canvas.get("el");(0,rg.each)(Fx,function(r){e.removeEventListener(r,t._eventCallback)}),document&&(document.removeEventListener("mousemove",this._onDocumentMove),document.removeEventListener("mouseup",this._onDocumentMouseUp))},t.prototype._getEventObj=function(t,e,r,n,o,i){var a=new Sw(t,e);return a.fromShape=o,a.toShape=i,a.x=r.x,a.y=r.y,a.clientX=r.clientX,a.clientY=r.clientY,a.propagationPath.push(n),a},t.prototype._getShape=function(t,e){return this.canvas.getShape(t.x,t.y,e)},t.prototype._getPointInfo=function(t){var e=this.canvas,r=e.getClientByEvent(t),n=e.getPointByEvent(t);return{x:n.x,y:n.y,clientX:r.x,clientY:r.y}},t.prototype._triggerEvent=function(t,e){var r=this._getPointInfo(e),n=this._getShape(r,e),o=this["_on"+t],i=!1;if(o)o.call(this,r,n,e);else{var a=this.currentShape;"mouseenter"===t||"dragenter"===t||"mouseover"===t?(this._emitEvent(t,e,r,null,null,n),n&&this._emitEvent(t,e,r,n,null,n),"mouseenter"===t&&this.draggingShape&&this._emitEvent("dragenter",e,r,null)):"mouseleave"===t||"dragleave"===t||"mouseout"===t?(i=!0,a&&this._emitEvent(t,e,r,a,a,null),this._emitEvent(t,e,r,null,a,null),"mouseleave"===t&&this.draggingShape&&this._emitEvent("dragleave",e,r,null)):this._emitEvent(t,e,r,n,null,null)}if(i||(this.currentShape=n),n&&!n.get("destroyed")){var s=this.canvas;s.get("el").style.cursor=n.attr("cursor")||s.get("cursor")}},t.prototype._onmousedown=function(t,e,r){0===r.button&&(this.mousedownShape=e,this.mousedownPoint=t,this.mousedownTimeStamp=r.timeStamp),this._emitEvent("mousedown",r,t,e,null,null)},t.prototype._emitMouseoverEvents=function(t,e,r,n){var o=this.canvas.get("el");r!==n&&(r&&(this._emitEvent("mouseout",t,e,r,r,n),this._emitEvent("mouseleave",t,e,r,r,n),n&&!n.get("destroyed")||(o.style.cursor=this.canvas.get("cursor"))),n&&(this._emitEvent("mouseover",t,e,n,r,n),this._emitEvent("mouseenter",t,e,n,r,n)))},t.prototype._emitDragoverEvents=function(t,e,r,n,o){n?(n!==r&&(r&&this._emitEvent("dragleave",t,e,r,r,n),this._emitEvent("dragenter",t,e,n,r,n)),o||this._emitEvent("dragover",t,e,n)):r&&this._emitEvent("dragleave",t,e,r,r,n),o&&this._emitEvent("dragover",t,e,n)},t.prototype._afterDrag=function(t,e,r){t&&(t.set("capture",!0),this.draggingShape=null),this.dragging=!1;var n=this._getShape(e,r);n!==t&&this._emitMouseoverEvents(r,e,t,n),this.currentShape=n},t.prototype._onmouseup=function(t,e,r){if(0===r.button){var n=this.draggingShape;this.dragging?(n&&this._emitEvent("drop",r,t,e),this._emitEvent("dragend",r,t,n),this._afterDrag(n,t,r)):(this._emitEvent("mouseup",r,t,e),e===this.mousedownShape&&this._emitEvent("click",r,t,e),this.mousedownShape=null,this.mousedownPoint=null)}},t.prototype._ondragover=function(t,e,r){r.preventDefault();var n=this.currentShape;this._emitDragoverEvents(r,t,n,e,!0)},t.prototype._onmousemove=function(t,e,r){var n=this.canvas,o=this.currentShape,i=this.draggingShape;if(this.dragging)i&&this._emitDragoverEvents(r,t,o,e,!1),this._emitEvent("drag",r,t,i);else{var a=this.mousedownPoint;if(a){var s=this.mousedownShape,u=r.timeStamp-this.mousedownTimeStamp,l=a.clientX-t.clientX,c=a.clientY-t.clientY;u>120||l*l+c*c>40?s&&s.get("draggable")?((i=this.mousedownShape).set("capture",!1),this.draggingShape=i,this.dragging=!0,this._emitEvent("dragstart",r,t,i),this.mousedownShape=null,this.mousedownPoint=null):!s&&n.get("draggable")?(this.dragging=!0,this._emitEvent("dragstart",r,t,null),this.mousedownShape=null,this.mousedownPoint=null):(this._emitMouseoverEvents(r,t,o,e),this._emitEvent("mousemove",r,t,e)):(this._emitMouseoverEvents(r,t,o,e),this._emitEvent("mousemove",r,t,e))}else this._emitMouseoverEvents(r,t,o,e),this._emitEvent("mousemove",r,t,e)}},t.prototype._emitEvent=function(t,e,r,n,o,i){var a=this._getEventObj(t,e,r,n,o,i);if(n){a.shape=n,Gx(n,t,a);for(var s=n.getParent();s;)s.emitDelegation(t,a),a.propagationStopped||Ux(s,t,a),a.propagationPath.push(s),s=s.getParent()}else{Gx(this.canvas,t,a)}},t.prototype.destroy=function(){this._clearEvents(),this.canvas=null,this.currentShape=null,this.draggingShape=null,this.mousedownPoint=null,this.mousedownShape=null,this.mousedownTimeStamp=null},t}(),Vx=Dw(),Hx=Vx&&"firefox"===Vx.name,qx=function(t){function e(e){var r=t.call(this,e)||this;return r.initContainer(),r.initDom(),r.initEvents(),r.initTimeline(),r}return(0,eg.__extends)(e,t),e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.cursor="default",e.supportCSSTransform=!1,e},e.prototype.initContainer=function(){var t=this.get("container");(0,rg.isString)(t)&&(t=document.getElementById(t),this.set("container",t))},e.prototype.initDom=function(){var t=this.createDom();this.set("el",t),this.get("container").appendChild(t),this.setDOMSize(this.get("width"),this.get("height"))},e.prototype.initEvents=function(){var t=new zx({canvas:this});t.init(),this.set("eventController",t)},e.prototype.initTimeline=function(){var t=new Bx(this);this.set("timeline",t)},e.prototype.setDOMSize=function(t,e){var r=this.get("el");_w&&(r.style.width=t+"px",r.style.height=e+"px")},e.prototype.changeSize=function(t,e){this.setDOMSize(t,e),this.set("width",t),this.set("height",e),this.onCanvasChange("changeSize")},e.prototype.getRenderer=function(){return this.get("renderer")},e.prototype.getCursor=function(){return this.get("cursor")},e.prototype.setCursor=function(t){this.set("cursor",t);var e=this.get("el");_w&&e&&(e.style.cursor=t)},e.prototype.getPointByEvent=function(t){if(this.get("supportCSSTransform")){if(Hx&&!(0,rg.isNil)(t.layerX)&&t.layerX!==t.offsetX)return{x:t.layerX,y:t.layerY};if(!(0,rg.isNil)(t.offsetX))return{x:t.offsetX,y:t.offsetY}}var e=this.getClientByEvent(t),r=e.x,n=e.y;return this.getPointByClient(r,n)},e.prototype.getClientByEvent=function(t){var e=t;return t.touches&&(e="touchend"===t.type?t.changedTouches[0]:t.touches[0]),{x:e.clientX,y:e.clientY}},e.prototype.getPointByClient=function(t,e){var r=this.get("el").getBoundingClientRect();return{x:t-r.left,y:e-r.top}},e.prototype.getClientByPoint=function(t,e){var r=this.get("el").getBoundingClientRect();return{x:t+r.left,y:e+r.top}},e.prototype.draw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.parentNode.removeChild(t)},e.prototype.clearEvents=function(){this.get("eventController").destroy()},e.prototype.isCanvas=function(){return!0},e.prototype.getParent=function(){return null},e.prototype.destroy=function(){var e=this.get("timeline");this.get("destroyed")||(this.clear(),e&&e.stop(),this.clearEvents(),this.removeDom(),t.prototype.destroy.call(this))},e}(Jw),Wx=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.isGroup=function(){return!0},e.prototype.isEntityGroup=function(){return!1},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=this.getChildren(),n=0;n=t&&r.minY<=e&&r.maxY>=e},e.prototype.afterAttrsChange=function(e){t.prototype.afterAttrsChange.call(this,e),this.clearCacheBBox()},e.prototype.getBBox=function(){var t=this.cfg.bbox;return t||(t=this.calculateBBox(),this.set("bbox",t)),t},e.prototype.getCanvasBBox=function(){var t=this.cfg.canvasBBox;return t||(t=this.calculateCanvasBBox(),this.set("canvasBBox",t)),t},e.prototype.applyMatrix=function(e){t.prototype.applyMatrix.call(this,e),this.set("canvasBBox",null)},e.prototype.calculateCanvasBBox=function(){var t=this.getBBox(),e=this.getTotalMatrix(),r=t.minX,n=t.minY,o=t.maxX,i=t.maxY;if(e){var a=Uw(e,[t.minX,t.minY]),s=Uw(e,[t.maxX,t.minY]),u=Uw(e,[t.minX,t.maxY]),l=Uw(e,[t.maxX,t.maxY]);r=Math.min(a[0],s[0],u[0],l[0]),o=Math.max(a[0],s[0],u[0],l[0]),n=Math.min(a[1],s[1],u[1],l[1]),i=Math.max(a[1],s[1],u[1],l[1])}var c=this.attrs;if(c.shadowColor){var f=c.shadowBlur,h=void 0===f?0:f,p=c.shadowOffsetX,d=void 0===p?0:p,y=c.shadowOffsetY,v=void 0===y?0:y,g=r-h+d,m=o+h+d,b=n-h+v,w=i+h+v;r=Math.min(r,g),o=Math.max(o,m),n=Math.min(n,b),i=Math.max(i,w)}return{x:r,y:n,minX:r,minY:n,maxX:o,maxY:i,width:o-r,height:i-n}},e.prototype.clearCacheBBox=function(){this.set("bbox",null),this.set("canvasBBox",null)},e.prototype.isClipShape=function(){return this.get("isClipShape")},e.prototype.isInShape=function(t,e){return!1},e.prototype.isOnlyHitBox=function(){return!1},e.prototype.isHit=function(t,e){var r=this.get("startArrowShape"),n=this.get("endArrowShape"),o=[t,e,1],i=(o=this.invertFromMatrix(o))[0],a=o[1],s=this._isInBBox(i,a);if(this.isOnlyHitBox())return s;if(s&&!this.isClipped(i,a)){if(this.isInShape(i,a))return!0;if(r&&r.isHit(i,a))return!0;if(n&&n.isHit(i,a))return!0}return!1},e}(Ww),Xx=new Map;function Jx(t,e){Xx.set(t,e)}function Kx(t){return Xx.get(t)}function Qx(t){var e=t.attr();return{x:e.x,y:e.y,width:e.width,height:e.height}}function Zx(t){var e=t.attr(),r=e.x,n=e.y,o=e.r;return{x:r-o,y:n-o,width:2*o,height:2*o}}function $x(t,e,r,n){var o=t-r,i=e-n;return Math.sqrt(o*o+i*i)}function t_(t,e){return Math.abs(t-e)<.001}function e_(t,e){var r=(0,rg.min)(t),n=(0,rg.min)(e);return{x:r,y:n,width:(0,rg.max)(t)-r,height:(0,rg.max)(e)-n}}function r_(t){return(t+2*Math.PI)%(2*Math.PI)}var n_={box:function(t,e,r,n){return e_([t,r],[e,n])},length:function(t,e,r,n){return $x(t,e,r,n)},pointAt:function(t,e,r,n,o){return{x:(1-o)*t+o*r,y:(1-o)*e+o*n}},pointDistance:function(t,e,r,n,o,i){var a=(r-t)*(o-t)+(n-e)*(i-e);return a<0?$x(t,e,o,i):a>(r-t)*(r-t)+(n-e)*(n-e)?$x(r,n,o,i):this.pointToLine(t,e,r,n,o,i)},pointToLine:function(t,e,r,n,o,i){var a=[r-t,n-e];if(Im.exactEquals(a,[0,0]))return Math.sqrt((o-t)*(o-t)+(i-e)*(i-e));var s=[-a[1],a[0]];Im.normalize(s,s);var u=[o-t,i-e];return Math.abs(Im.dot(u,s))},tangentAngle:function(t,e,r,n){return Math.atan2(n-e,r-t)}},o_=1e-4;function i_(t,e,r,n,o,i){var a,s=1/0,u=[r,n],l=20;i&&i>200&&(l=i/10);for(var c=1/l,f=c/10,h=0;h<=l;h++){var p=h*c,d=[o.apply(null,t.concat([p])),o.apply(null,e.concat([p]))];(m=$x(u[0],u[1],d[0],d[1]))=0&&m=0?[o]:[]}function u_(t,e,r,n){return 2*(1-n)*(e-t)+2*n*(r-e)}function l_(t,e,r,n,o,i,a){var s=a_(t,r,o,a),u=a_(e,n,i,a),l=n_.pointAt(t,e,r,n,a),c=n_.pointAt(r,n,o,i,a);return[[t,e,l.x,l.y,s,u],[s,u,c.x,c.y,o,i]]}var c_={box:function(t,e,r,n,o,i){var a=s_(t,r,o)[0],s=s_(e,n,i)[0],u=[t,o],l=[e,i];return void 0!==a&&u.push(a_(t,r,o,a)),void 0!==s&&l.push(a_(e,n,i,s)),e_(u,l)},length:function(t,e,r,n,o,i){return function t(e,r,n,o,i,a,s){if(0===s)return($x(e,r,n,o)+$x(n,o,i,a)+$x(e,r,i,a))/2;var u=l_(e,r,n,o,i,a,.5),l=u[0],c=u[1];return l.push(s-1),c.push(s-1),t.apply(null,l)+t.apply(null,c)}(t,e,r,n,o,i,3)},nearestPoint:function(t,e,r,n,o,i,a,s){return i_([t,r,o],[e,n,i],a,s,a_)},pointDistance:function(t,e,r,n,o,i,a,s){var u=this.nearestPoint(t,e,r,n,o,i,a,s);return $x(u.x,u.y,a,s)},interpolationAt:a_,pointAt:function(t,e,r,n,o,i,a){return{x:a_(t,r,o,a),y:a_(e,n,i,a)}},divide:function(t,e,r,n,o,i,a){return l_(t,e,r,n,o,i,a)},tangentAngle:function(t,e,r,n,o,i,a){var s=u_(t,r,o,a),u=u_(e,n,i,a);return r_(Math.atan2(u,s))}};function f_(t,e,r,n,o){var i=1-o;return i*i*i*t+3*e*o*i*i+3*r*o*o*i+n*o*o*o}function h_(t,e,r,n,o){var i=1-o;return 3*(i*i*(e-t)+2*i*o*(r-e)+o*o*(n-r))}function p_(t,e,r,n){var o,i,a,s=-3*t+9*e-9*r+3*n,u=6*t-12*e+6*r,l=3*e-3*t,c=[];if(t_(s,0))t_(u,0)||(o=-l/u)>=0&&o<=1&&c.push(o);else{var f=u*u-4*s*l;t_(f,0)?c.push(-u/(2*s)):f>0&&(i=(-u-(a=Math.sqrt(f)))/(2*s),(o=(-u+a)/(2*s))>=0&&o<=1&&c.push(o),i>=0&&i<=1&&c.push(i))}return c}function d_(t,e,r,n,o,i,a,s,u){var l=f_(t,r,o,a,u),c=f_(e,n,i,s,u),f=n_.pointAt(t,e,r,n,u),h=n_.pointAt(r,n,o,i,u),p=n_.pointAt(o,i,a,s,u),d=n_.pointAt(f.x,f.y,h.x,h.y,u),y=n_.pointAt(h.x,h.y,p.x,p.y,u);return[[t,e,f.x,f.y,d.x,d.y,l,c],[l,c,y.x,y.y,p.x,p.y,a,s]]}function y_(t,e,r,n,o,i,a,s,u){if(0===u)return function(t,e){for(var r=0,n=t.length,o=0;o0?r:-1*r}var m_=function(t,e,r,n,o,i){var a=r,s=n;if(0===a||0===s)return{x:t,y:e};for(var u,l,c=o-t,f=i-e,h=Math.abs(c),p=Math.abs(f),d=a*a,y=s*s,v=Math.PI/4,g=0;g<4;g++){u=a*Math.cos(v),l=s*Math.sin(v);var m=(d-y)*Math.pow(Math.cos(v),3)/a,b=(y-d)*Math.pow(Math.sin(v),3)/s,w=u-m,S=l-b,x=h-m,_=p-b,E=Math.hypot(S,w),O=Math.hypot(_,x);v+=E*Math.asin((w*_-S*x)/(E*O))/Math.sqrt(d+y-u*u-l*l),v=Math.min(Math.PI/2,Math.max(0,v))}return{x:t+g_(u,c),y:e+g_(l,f)}};function b_(t,e,r,n,o,i){return r*Math.cos(o)*Math.cos(i)-n*Math.sin(o)*Math.sin(i)+t}function w_(t,e,r,n,o,i){return r*Math.sin(o)*Math.cos(i)+n*Math.cos(o)*Math.sin(i)+e}function S_(t,e,r){return{x:t*Math.cos(r),y:e*Math.sin(r)}}function x_(t,e,r){var n=Math.cos(r),o=Math.sin(r);return[t*n-e*o,t*o+e*n]}var __={box:function(t,e,r,n,o,i,a){for(var s=function(t,e,r){return Math.atan(-e/t*Math.tan(r))}(r,n,o),u=1/0,l=-1/0,c=[i,a],f=2*-Math.PI;f<=2*Math.PI;f+=Math.PI){var h=s+f;il&&(l=p)}var d=function(t,e,r){return Math.atan(e/(t*Math.tan(r)))}(r,n,o),y=1/0,v=-1/0,g=[i,a];for(f=2*-Math.PI;f<=2*Math.PI;f+=Math.PI){var m=d+f;iv&&(v=b)}return{x:u,y:y,width:l-u,height:v-y}},length:function(t,e,r,n,o,i,a){},nearestPoint:function(t,e,r,n,o,i,a,s,u){var l=x_(s-t,u-e,-o),c=l[0],f=l[1],h=m_(0,0,r,n,c,f),p=function(t,e,r,n){return(Math.atan2(n*t,r*e)+2*Math.PI)%(2*Math.PI)}(r,n,h.x,h.y);pa&&(h=S_(r,n,a));var d=x_(h.x,h.y,o);return{x:d[0]+t,y:d[1]+e}},pointDistance:function(t,e,r,n,o,i,a,s,u){var l=this.nearestPoint(t,e,r,n,s,u);return $x(l.x,l.y,s,u)},pointAt:function(t,e,r,n,o,i,a,s){var u=(a-i)*s+i;return{x:b_(t,0,r,n,o,u),y:w_(0,e,r,n,o,u)}},tangentAngle:function(t,e,r,n,o,i,a,s){var u=(a-i)*s+i,l=function(t,e,r,n,o,i,a,s){return-1*r*Math.cos(o)*Math.sin(s)-n*Math.sin(o)*Math.cos(s)}(0,0,r,n,o,0,0,u),c=function(t,e,r,n,o,i,a,s){return-1*r*Math.sin(o)*Math.sin(s)+n*Math.cos(o)*Math.cos(s)}(0,0,r,n,o,0,0,u);return r_(Math.atan2(c,l))}};function E_(t){if(t.length<2)return 0;for(var e=0,r=0;r1?e*n+function(t,e){return e?e-t:.14*t}(e,r)*(n-1):e}function M_(t){var e=t.fontSize,r=t.fontFamily,n=t.fontWeight;return[t.fontStyle,t.fontVariant,n,e+"px",r].join(" ").trim()}var j_=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/gi,I_=/[^\s\,]+/gi;var N_=function(t){var e=t||[];return(0,rg.isArray)(e)?e:(0,rg.isString)(e)?(e=e.match(j_),(0,rg.each)(e,function(t,r){if((t=t.match(I_))[0].length>1){var n=t[0].charAt(0);t.splice(1,0,t[0].substr(1)),t[0]=n}(0,rg.each)(t,function(e,r){isNaN(e)||(t[r]=+e)}),e[r]=t}),e):void 0};var L_=function(t,e,r){void 0===e&&(e=!1),void 0===r&&(r=[[0,0],[1,1]]);for(var n=!!e,o=[],i=0,a=t.length;i2&&(r.push([n].concat(i.splice(0,2))),a="l",n="m"===n?"l":"L"),"o"===a&&1===i.length&&r.push([n,i[0]]),"r"===a)r.push([n].concat(i));else for(;i.length>=e[a]&&(r.push([n].concat(i.splice(0,e[a]))),e[a]););return""}),r}var G_=/[a-z]/;function U_(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function z_(t){var e=F_(t);if(!e||!e.length)return[["M",0,0]];for(var r=!1,n=0;n=0){r=!0;break}}if(!r)return e;var i=[],a=0,s=0,u=0,l=0,c=0,f=e[0];"M"!==f[0]&&"m"!==f[0]||(u=a=+f[1],l=s=+f[2],c++,i[0]=["M",a,s]);n=c;for(var h=e.length;n1&&(r*=Math.sqrt(p),n*=Math.sqrt(p));var d=r*r*(h*h)+n*n*(f*f),y=d?Math.sqrt((r*r*(n*n)-d)/d):1;i===a&&(y*=-1),isNaN(y)&&(y=0);var v=n?y*r*h/n:0,g=r?y*-n*f/r:0,m=(s+l)/2+Math.cos(o)*v-Math.sin(o)*g,b=(u+c)/2+Math.sin(o)*v+Math.cos(o)*g,w=[(f-v)/r,(h-g)/n],S=[(-1*f-v)/r,(-1*h-g)/n],x=q_([1,0],w),_=q_(w,S);return H_(w,S)<=-1&&(_=Math.PI),H_(w,S)>=1&&(_=0),0===a&&_>0&&(_-=2*Math.PI),1===a&&_<0&&(_+=2*Math.PI),{cx:m,cy:b,rx:W_(t,[l,c])?0:r,ry:W_(t,[l,c])?0:n,startAngle:x,endAngle:x+_,xRotation:o,arcFlag:i,sweepFlag:a}}function X_(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function J_(t){for(var e=[],r=null,n=null,o=null,i=0,a=(t=N_(t)).length,s=0;sMath.PI/2?Math.PI-l:l,c=c>Math.PI/2?Math.PI-c:c,{xExtra:Math.cos(u/2-l)*(e/2*(1/Math.sin(u/2)))-e/2||0,yExtra:Math.cos(c-u/2)*(e/2*(1/Math.sin(u/2)))-e/2||0}}Jx("rect",Qx),Jx("image",Qx),Jx("circle",Zx),Jx("marker",Zx),Jx("polyline",function(t){for(var e=t.attr().points,r=[],n=[],o=0;or&&(r=l),c>o&&(o=c)}return{x:Math.floor(e),y:Math.floor(n),width:Math.ceil(r)-Math.floor(e),height:Math.ceil(o)-Math.floor(n),minX:e,minY:n,maxX:r,maxY:o}},oE=function(t,e,r,n,o){void 0===e&&(e=15),void 0===r&&(r="quadratic"),void 0===n&&(n=void 0),void 0===o&&(o=void 0);for(var i=t.length,a=2*e,s=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],u={},l=[],c={},f=0;fn.get("optimizeThreshold")){var a=1/0,s=1/0,u=-1/0,l=-1/0;i.forEach(function(t){var e=t.getModel(),r=e.x,n=e.y;a>r&&(a=r),s>n&&(s=n),up&&(d=p,console.warn("fitview failed, ratio out of range, ratio: %f",a,"graph maxzoom has been used instead"));var y=(0,iE.pd)(f,[["t",-o.x,-o.y],["s",d,d],["t",o.x,o.y]]),v=Ub({animateCfg:r,callback:function(){t.setMatrix(y),u.emit("viewportchange",{action:"translate",matrix:f}),u.emit("viewportchange",{action:"zoom",matrix:y})}});t.stopAnimate(),t.setMatrix(e),t.animate(function(t){return{matrix:yb(e,y,t)}},v)}else{var g=Ub({animateCfg:r,callback:function(){u.emit("viewportchange",{action:"translate",matrix:f})}});t.animate(function(t){return{matrix:yb(e,f,t)}},g)}}},t.prototype.fitView=function(t,e){var r,n=this.graph,o=this.getFormatPadding(),i=n.get("width"),a=n.get("height"),s=n.get("group"),u=s.getMatrix()||[1,0,0,0,1,0,0,0,1];s.resetMatrix();var l=n.getNodes();if(l.length>n.get("optimizeThreshold")){var c=1/0,f=1/0,h=-1/0,p=-1/0;l.forEach(function(t){var e=t.getModel(),r=e.x,n=e.y;c>r&&(c=r),f>n&&(f=n),hg&&(m=g),t)this.animatedFitView(s,u,e,r,d,y,m,!0);else{var b=d.x-y.x,w=d.y-y.y;if(rE(b)||rE(w))return;n.translate(b,w),n.zoom(m,d)||console.warn("zoom failed, ratio out of range, ratio: %f",m)}}},t.prototype.fitViewByRules=function(t,e,r){var n,o=t.onlyOutOfViewPort,i=void 0!==o&&o,a=t.direction,s=void 0===a?"both":a,u=t.ratioRule,l=void 0===u?"min":u,c=this.graph,f=this.getFormatPadding(),h=c.get("width"),p=c.get("height"),d=c.get("group"),y=d.getMatrix()||[1,0,0,0,1,0,0,0,1];d.resetMatrix();var v=c.getNodes();if(v.length>c.get("optimizeThreshold")){var g=1/0,m=1/0,b=-1/0,w=-1/0;v.forEach(function(t){var e=t.getModel(),r=e.x,n=e.y;g>r&&(g=r),m>n&&(m=n),bc.maxX&&(c.maxX=p.maxX),p.maxY>c.maxY&&(c.maxY=p.maxY)}if(c.x=c.minX,c.y=c.minY,c.width=c.maxX-c.minX,c.height=c.maxY-c.minY,0!==c.width&&0!==c.height){var d=this.getViewCenter(),y={x:c.x+c.width/2,y:c.y+c.height/2},v=(a-i[1]-i[3])/c.width,g=(s-i[0]-i[2])/c.height,m=v;v>g&&(m=g),r?this.animatedFitView(u,l,n,c,d,y,m,e):(o.translate(d.x-y.x,d.y-y.y),e&&!o.zoom(m,d)&&console.warn("zoom failed, ratio out of range, ratio: %f",m))}}},t.prototype.changeSize=function(t,e){var r=this.graph;if(!(0,rg.isNumber)(t)||!(0,rg.isNumber)(e))throw Error("invalid canvas width & height, please make sure width & height type is number");r.set({width:t,height:e}),r.get("canvas").changeSize(t,e),r.get("plugins").forEach(function(t){t.get("gridContainer")&&t.positionInit()})},t.prototype.destroy=function(){this.graph=null,this.destroyed=!1},t}();function sE(t){"@babel/helpers - typeof";return(sE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function uE(t){if("string"!=typeof t)return t;var e=function(t){if("string"!=typeof t)return t;try{return JSON.parse(t.trim())}catch(e){return t.trim()}},r=e(t);if("string"!=typeof r)return r;for(var n=function(t){return t[t.length-1]},o=t.trim(),i=[],a=[],s=function(){for(var t=[],e=0;en.width&&(n.width=c.width+c.x),c.height+c.y>n.height&&(n.height=c.height+c.y)}}}return t.bbox=function(t,e,r){var n,o,i=t.attrs,a=void 0===i?{}:i,s={x:e.x||0,y:e.y||0,width:r.width||0,height:r.height||0};switch(t.type){case"maker":case"circle":a.r&&(o=2*a.r,n=2*a.r);break;case"text":a.text&&(o=Nb(a.text,a.fontSize||12)[0],n=16,s.y+=n,s.height=n,s.width=o,t.attrs=(0,eg.__assign)({fontSize:12,fill:"#000"},a));break;default:a.width&&(o=a.width),a.height&&(n=a.height)}return n>=0&&(s.height=n),o>=0&&(s.width=o),a.marginTop&&(s.y+=a.marginTop),a.marginLeft&&(s.x+=a.marginLeft),s}(t,e,n),t.attrs=(0,eg.__assign)((0,eg.__assign)({},t.attrs),t.bbox),t}function hE(t){var e={},r=function(e){var r="function"==typeof t?t(e):t,n=cE(r)(e),o=document.createElement("div");o.innerHTML=n;var i=fE(function t(e,r){var n={},o=e.getAttributeNames&&e.getAttributeNames()||[],i=e.children&&Array.from(e.children).map(function(e){return t(e,r)}),a={},s=e.tagName?e.tagName.toLowerCase():"group";return"text"===s&&(n.text=e.innerText),a.type=s,"img"===s&&(a.type="image"),Array.from(o).forEach(function(t){var r=lE(t),o=e.getAttribute(t);try{if("style"===r||"attrs"===r){var i=uE(o);n=(0,eg.__assign)((0,eg.__assign)({},n),i)}else a[r]=uE(o)}catch(t){if("style"===r)throw t;a[r]=o}}),a.attrs=n,r&&r.style&&a.name&&"object"===sE(r.style[a.name])&&(a.attrs=(0,eg.__assign)((0,eg.__assign)({},a.attrs),r.style[a.name])),r&&r.style&&a.keyshape&&(a.attrs=(0,eg.__assign)((0,eg.__assign)({},a.attrs),r.style)),i.length&&(a.children=i),a}(o.children[0],e));return o.remove(),i};return{draw:function(t,n){var o=r(t),i=n;return function t(e){var r=e.attrs,o=void 0===r?{}:r,a=e.bbox,s=e.type,u=e.children,l=(0,eg.__rest)(e,["attrs","bbox","type","children"]);if("group"!==e.type){var c=n.addShape(e.type,(0,eg.__assign)({attrs:o,origin:{bbox:a,type:s,children:u}},l));e.keyshape&&(i=c)}e.children&&e.children.forEach(function(e){return t(e)})}(o),e[t.id]=[o],i},update:function(t,n){e[t.id]||(e[t.id]=[]);var o=n.getContainer(),i=o.get("children"),a=r(t),s=function t(e){var r;"group"!==e.type&&o.addShape(e.type,{attrs:e.attrs}),(null===(r=e.children)||void 0===r?void 0:r.length)&&e.children.map(function(e){return t(e)})},u=function t(e){var r,n=i.find(function(t){return t.attrs.key===e.attrs.key});n&&o.removeChild(n),(null===(r=e.children)||void 0===r?void 0:r.length)&&e.children.map(function(e){return t(e)})};!function t(e){var r=e.key;if("group"!==e.type){var o=i.find(function(t){return t.attrs.key===r});switch(e.action){case"change":if(o){var a=e.val.keyshape?n.getOriginStyle():{};o.attr((0,eg.__assign)((0,eg.__assign)({},a),e.val.attrs))}break;case"add":s(e.val);break;case"delete":u(e.val);break;case"restructure":u(e.formerTarget),s(e.nowTarget)}}e.children&&e.children.forEach(function(e){return t(e)})}(function t(e,r){var n,o,i,a,s=(e||{}).type,u=((null===r||void 0===r?void 0:r.attrs)||{}).key;if(u&&e&&(e.attrs.key=u),!e&&r)return{action:"delete",val:r,type:s,key:u};if(e&&!r)return{action:"add",val:e,type:s};if(!e&&!r)return{action:"same",type:s};var l=[];if((null===(n=e.children)||void 0===n?void 0:n.length)>0||(null===(o=r.children)||void 0===o?void 0:o.length)>0)for(var c=Math.max(null===(i=e.children)||void 0===i?void 0:i.length,null===(a=r.children)||void 0===a?void 0:a.length),f=r.children||[],h=e.children||[],p=0;p-1)return;r.push(o)}else s>-1&&r.splice(s,1)}else if((0,rg.isString)(e)){var u=r.filter(function(t){return t.includes(i)});u.length>0&&this.clearStates(u),(a=a.filter(function(t){return!t.includes(i)})).push(o),this.set("states",a)}if(n){var l=this.get("model").type;n.setState(l,t,e,this)}},t.prototype.clearStates=function(t){var e=this,r=e.getStates(),n=e.get("shapeFactory"),o=e.get("model").type;t||(t=r),(0,rg.isString)(t)&&(t=[t]);var i=r.filter(function(e){return-1===t.indexOf(e)});e.set("states",i),t.forEach(function(t){n.setState(o,t,!1,e)})},t.prototype.setOptimize=function(t){this.optimize=t},t.prototype.getContainer=function(){return this.get("group")},t.prototype.getKeyShape=function(){return this.get("keyShape")},t.prototype.getModel=function(){return this.get("model")},t.prototype.getType=function(){return this.get("type")},t.prototype.getID=function(){return this.get("id")},t.prototype.isItem=function(){return!0},t.prototype.getStates=function(){return this.get("states")},t.prototype.hasState=function(t){return this.getStates().indexOf(t)>=0},t.prototype.refresh=function(t){var e=this.get("model");this.updatePosition(e),this.updateShape(t),this.afterUpdate(),this.clearCache()},t.prototype.getUpdateType=function(t){},t.prototype.update=function(t,e){void 0===e&&(e=void 0);var r=this.get("model");if("move"===e)this.updatePosition(t);else{var n=r.visible,o=t.visible;n!==o&&void 0!==o&&this.changeVisibility(o);var i={x:r.x,y:r.y};t.x=isNaN(+t.x)?r.x:+t.x,t.y=isNaN(+t.y)?r.y:+t.y;var a=this.get("styles");if(t.stateStyles){var s=t.stateStyles;(0,rg.mix)(a,s),delete t.stateStyles}Object.assign(r,t),i.x===t.x&&i.y===t.y||this.updatePosition(t),this.updateShape(e)}this.afterUpdate(),this.clearCache()},t.prototype.updateShape=function(t){var e=this.get("shapeFactory"),r=this.get("model"),n=r.type;if(e.shouldUpdate(n)&&n===this.get("currentShape")){var o=this.getShapeCfg(r,t);e.baseUpdate(n,o,this,t),"move"!==t&&this.setOriginStyle()}else this.draw();this.restoreStates(e,n)},t.prototype.updatePosition=function(t){var e=this.get("model"),r=isNaN(+t.x)?+e.x:+t.x,n=isNaN(+t.y)?+e.y:+t.y,o=this.get("group");if(isNaN(r)||isNaN(n))return!1;e.x=r,e.y=n;var i=o.getMatrix();return(!i||i[6]!==r||i[7]!==n)&&(o.resetMatrix(),Xm(o,{x:r,y:n}),this.clearCache(),!0)},t.prototype.getBBox=function(){var t=this.get("bboxCache");return t||(t=this.calculateBBox(),this.set("bboxCache",t)),t},t.prototype.getCanvasBBox=function(){var t=this.get("bboxCanvasCache");return t||(t=this.calculateCanvasBBox(),this.set("bboxCanvasCache",t)),t},t.prototype.toFront=function(){this.get("group").toFront()},t.prototype.toBack=function(){this.get("group").toBack()},t.prototype.show=function(){this.changeVisibility(!0)},t.prototype.hide=function(){this.changeVisibility(!1)},t.prototype.changeVisibility=function(t){var e=this.get("group");t?e.show():e.hide(),this.set("visible",t)},t.prototype.isVisible=function(){return this.get("visible")},t.prototype.enableCapture=function(t){var e=this.get("group");e&&e.set("capture",t)},t.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),e.remove(),this._cfg=null,this.destroyed=!0}},t}(),wE={source:"start",target:"end"},SE=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},e.prototype.setEnd=function(t,e){var r=wE[t]+"Point",n=t+"Node",o=this.get(n);o&&!o.destroyed&&o.removeEdge(this),(0,rg.isPlainObject)(e)?(this.set(r,e),this.set(n,null)):e&&(e.addEdge(this),this.set(n,e),this.set(r,null))},e.prototype.getLinkPoint=function(t,e,r){var n=wE[t]+"Point",o=t+"Node",i=this.get(n);if(!i){var a=this.get(o),s=t+"Anchor",u=this.getPrePoint(t,r),l=e[s];(0,rg.isNil)(l)||(i=a.getLinkPointByAnchor(l)),i=i||a.getLinkPoint(u),(0,rg.isNil)(i.index)||this.set("".concat(t,"AnchorIndex"),i.index)}return i},e.prototype.getPrePoint=function(t,e){if(e&&e.length)return e["source"===t?0:e.length-1];var r="source"===t?"target":"source";return this.getEndPoint(r)},e.prototype.getEndPoint=function(t){var e=t+"Node",r=wE[t]+"Point",n=this.get(e);return n&&!n.destroyed?n.get("model"):this.get(r)},e.prototype.getControlPointsByCenter=function(t){var e=this.getEndPoint("source"),r=this.getEndPoint("target"),n=this.get("shapeFactory"),o=t.type;return n.getControlPoints(o,{startPoint:e,endPoint:r})},e.prototype.getEndCenter=function(t){var e=t+"Node",r=wE[t]+"Point",n=this.get(e);if(n){var o=n.getBBox();return{x:o.centerX,y:o.centerY}}return this.get(r)},e.prototype.init=function(){t.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},e.prototype.getShapeCfg=function(e,r){var n=this.get("linkCenter"),o=(null===r||void 0===r?void 0:r.includes("move"))?e:t.prototype.getShapeCfg.call(this,e);if(n)o.startPoint=this.getEndCenter("source"),o.endPoint=this.getEndCenter("target");else{var i=o.controlPoints||this.getControlPointsByCenter(o);o.startPoint=this.getLinkPoint("source",e,i),o.endPoint=this.getLinkPoint("target",e,i)}return o.sourceNode=this.get("sourceNode"),o.targetNode=this.get("targetNode"),o},e.prototype.getModel=function(){var t=this.get("model"),e=this.get("source".concat("Node")),r=this.get("target".concat("Node"));return e?delete t["source".concat("Node")]:t.source=this.get("start".concat("Point")),r?delete t["target".concat("Node")]:t.target=this.get("end".concat("Point")),(0,rg.isString)(t.source)||(0,rg.isPlainObject)(t.source)||(t.source=t.source.getID()),(0,rg.isString)(t.target)||(0,rg.isPlainObject)(t.target)||(t.target=t.target.getID()),t},e.prototype.setSource=function(t){this.setEnd("source",t),this.set("source",t)},e.prototype.setTarget=function(t){this.setEnd("target",t),this.set("target",t)},e.prototype.getSource=function(){return this.get("source")},e.prototype.getTarget=function(){return this.get("target")},e.prototype.updatePosition=function(){return!1},e.prototype.update=function(t,e){void 0===e&&(e=void 0);var r=this.get("model"),n=r.visible,o=t.visible;n!==o&&void 0!==o&&this.changeVisibility(o);var i=this.get("source"),a=this.get("target");if(i&&!i.destroyed&&a&&!a.destroyed){var s=this.get("styles");if(t.stateStyles){var u=t.stateStyles;(0,rg.mix)(s,u),delete t.stateStyles}Object.assign(r,t),this.updateShape(e),this.afterUpdate(),this.clearCache()}},e.prototype.destroy=function(){var e=this.get("source".concat("Node")),r=this.get("target".concat("Node"));e&&!e.destroyed&&e.removeEdge(this),r&&!r.destroyed&&r.removeEdge(this),t.prototype.destroy.call(this)},e}(bE),xE=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.getNearestPoint=function(t,e){for(var r=0,n=t[0],o=Hm(t[0],e),i=0;i-1&&e.splice(r,1)},e.prototype.clearCache=function(){this.set("bboxCache",null),this.set("anchorPointsCache",null)},e.prototype.getUpdateType=function(t){var e,r,n,o,i;if(t){var a=!(0,rg.isNil)(t.x),s=!(0,rg.isNil)(t.y),u=Object.keys(t);return 1===u.length&&(a||s)||2===u.length&&a&&s?"move":(0,rg.isNumber)(t.x)||(0,rg.isNumber)(t.y)||t.type||t.anchorPoints||t.size||(null===t||void 0===t?void 0:t.style)&&((null===(e=null===t||void 0===t?void 0:t.style)||void 0===e?void 0:e.r)||(null===(r=null===t||void 0===t?void 0:t.style)||void 0===r?void 0:r.width)||(null===(n=null===t||void 0===t?void 0:t.style)||void 0===n?void 0:n.height)||(null===(o=null===t||void 0===t?void 0:t.style)||void 0===o?void 0:o.rx)||(null===(i=null===t||void 0===t?void 0:t.style)||void 0===i?void 0:i.ry))?"bbox|label":u.includes("label")||u.includes("labelCfg")?"style|label":"style"}},e.prototype.setState=function(e,r){var n=this;this.optimize?t.prototype.setState.call(this,e,r):this.runWithBBoxAffected(function(){return t.prototype.setState.call(n,e,r)})},e.prototype.clearStates=function(e){var r=this;this.optimize?t.prototype.clearStates.call(this,e):this.runWithBBoxAffected(function(){return t.prototype.clearStates.call(r,e)})},e.prototype.runWithBBoxAffected=function(t){var e=["r","width","height","rx","ry","lineWidth"],r=this.getKeyShape().attr(),n={};Object.keys(this.getKeyShape().attr()).forEach(function(t){e.includes(t)&&(n[t]=r[t])}),t();for(var o=this.getKeyShape().attr(),i=0;i-1&&(e.splice(r,1),!0)}},e.prototype.removeNode=function(t){if(t){var e=this.getNodes(),r=e.indexOf(t);return r>-1&&(e.splice(r,1),!0)}},e.prototype.getUpdateType=function(t){},e.prototype.getBBox=function(){return this.set("bboxCanvasCache",null),this.calculateCanvasBBox()},e.prototype.clearCache=function(){this.set("bboxCache",null),this.set("bboxCanvasCache",null),this.set("anchorPointsCache",null)},e.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),this.set("sizeCache",null),this.set("bbox",null),e.remove(),this._cfg=null,this.destroyed=!0}},e}(xE),EE=function(){function t(t){var e=this;this.edgeToBeUpdateMap={},this.throttleRefresh=(0,rg.throttle)(function(t){var r=e.graph;if(r&&!r.get("destroyed")){var n=e.edgeToBeUpdateMap;if(n){var o=Object.values(n);o.length&&(o.forEach(function(t){var e=t.edge;if(e&&!e.destroyed){var r=e.getSource(),n=e.getTarget();r&&!r.destroyed&&n&&!n.destroyed&&e.refresh(t.updateType)}}),e.edgeToBeUpdateMap={})}}},16,{trailing:!0,leading:!0}),this.graph=t,this.destroyed=!1}return t.prototype.addItem=function(t,e){var r=this.graph,n="vedge"===t?"edge":t,o=r.get("".concat(n,"Group"))||r.get("group"),i=(0,rg.upperFirst)(n),a=null,s=r.get(n+(0,rg.upperFirst)("stateStyles"))||{},u=r.get("default"+i);e.stateStyles&&(s=e.stateStyles),u&&(0,rg.each)(u,function(t,r){(0,rg.isObject)(t)&&!(0,rg.isArray)(t)?e[r]=(0,rg.deepMix)({},t,e[r]):(0,rg.isArray)(t)?e[r]=e[r]||(0,rg.clone)(u[r]):e[r]=e[r]||u[r]});var l=r.get(n+"Mapper");if(l){var c=l(e);c.stateStyles&&(s=c.stateStyles,delete c.stateStyles),(0,rg.each)(c,function(t,r){(0,rg.isObject)(t)&&!(0,rg.isArray)(t)?e[r]=(0,rg.deepMix)({},e[r],t):e[r]=c[r]||e[r]})}if(r.emit("beforeadditem",{type:t,model:e}),"edge"===t||"vedge"===t){var f=void 0,h=void 0;if(f=e.source,h=e.target,f&&(0,rg.isString)(f)&&(f=r.findById(f)),h&&(0,rg.isString)(h)&&(h=r.findById(h)),!f||!h)return void console.warn("The source or target node of edge ".concat(e.id," does not exist!"));f.getType&&"combo"===f.getType()&&(e.isComboEdge=!0),h.getType&&"combo"===h.getType()&&(e.isComboEdge=!0),a=new SE({model:e,source:f,target:h,styles:s,linkCenter:r.get("linkCenter"),group:o.addGroup()})}else if("node"===t)a=new xE({model:e,styles:s,group:o.addGroup()});else if("combo"===t){var p=e.children,d=Bb(p,r),y=void 0,v=void 0;if(isNaN(d.x)?isNaN(e.x)&&(y=100*Math.random()):y=d.x,isNaN(d.y)?isNaN(e.y)&&(v=100*Math.random()):v=d.y,isNaN(e.x)||isNaN(e.y))e.x=y,e.y=v;else{var g=e.x-y,m=e.y-v;this.updateComboSucceeds(e.id,g,m,p)}var b=o.addGroup();b.setZIndex(e.depth),a=new _E({model:e,styles:s,animate:r.get("animate"),bbox:e.collapsed?Bb([],r):d,group:b}),e.collapsed||"circle"!==a.getKeyShape().get("type")||(d.width=Math.hypot(d.height,d.width),d.height=d.width,a.set("bbox",d),a.refresh());var w=a.getModel();(p||[]).forEach(function(t){var e=r.findById(t.id);a.addChild(e),t.depth=w.depth+2})}if(a)return a.setOptimize(r.getNodes().length>r.get("optimizeThreshold")),r.get("".concat(t,"s")).push(a),r.get("itemMap")[a.get("id")]=a,r.emit("afteradditem",{item:a,model:e}),a},t.prototype.updateItem=function(t,e){var r,n,o=this,i=this.graph;if((0,rg.isString)(t)&&(t=i.findById(t)),t&&!t.destroyed){var a="";t.getType&&(a=t.getType());var s=i.get(a+"Mapper"),u=t.getModel(),l=u.x,c=u.y,f=t.getUpdateType(e);if(s){var h=s((0,rg.deepMix)({},u,e)),p=(0,rg.deepMix)({},u,h,e);h.stateStyles&&(t.set("styles",p.stateStyles),delete p.stateStyles),(0,rg.each)(p,function(t,r){e[r]=t})}else(0,rg.each)(e,function(t,r){u[r]&&(0,rg.isObject)(t)&&!(0,rg.isArray)(t)&&(e[r]=(0,eg.__assign)((0,eg.__assign)({},u[r]),e[r]))});if(i.emit("beforeupdateitem",{item:t,cfg:e}),"edge"===a){if(e.source){var d=e.source;(0,rg.isString)(d)&&(d=i.findById(d)),t.setSource(d)}if(e.target){var y=e.target;(0,rg.isString)(y)&&(y=i.findById(y)),t.setTarget(y)}t.update(e)}else if("node"===a){t.update(e,f);var v=t.getEdges();"move"===f?(0,rg.each)(v,function(t){o.edgeToBeUpdateMap[t.getID()]={edge:t,updateType:f},o.throttleRefresh()}):(null===f||void 0===f?void 0:f.includes("bbox"))&&(0,rg.each)(v,function(t){t.refresh(f)})}else if("combo"===a){if(t.update(e,f),!isNaN(e.x)||!isNaN(e.y)){var g=e.x-l||0,m=e.y-c||0;this.updateComboSucceeds(u.id,g,m)}var b=t.getEdges();if(((null===f||void 0===f?void 0:f.includes("bbox"))||"move"===f)&&"combo"===a){var w=t.get("shapeFactory"),S=u.type||"circle";(void 0===u.animate||void 0===e.animate?null===(n=null===(r=w[S])||void 0===r?void 0:r.options)||void 0===n?void 0:n.animate:u.animate||e.animate)?setTimeout(function(){if(t&&!t.destroyed){var e=t.getKeyShape();e&&!e.destroyed&&(0,rg.each)(b,function(t){t&&!t.destroyed&&t.refresh()})}},201):(0,rg.each)(b,function(t){t.refresh()})}}t.setOptimize(i.getNodes().length>i.get("optimizeThreshold")),i.emit("afterupdateitem",{item:t,cfg:e})}},t.prototype.updateCombo=function(t,e,r){var n,o,i=this,a=this.graph;if((0,rg.isString)(t)&&(t=a.findById(t)),t&&!t.destroyed){var s=t.getModel(),u=Bb(e,a,t),l=u.x,c=u.y;t.set("bbox",u);var f=l,h=c;r?(f=isNaN(s.x)?l:s.x,h=isNaN(s.y)?c:s.y):(f=isNaN(l)?s.x:l,h=isNaN(c)?s.y:c),t.update({x:f,y:h});var p=t.get("shapeFactory"),d=s.type||"circle";(void 0===s.animate?null===(o=null===(n=p[d])||void 0===n?void 0:n.options)||void 0===o?void 0:o.animate:s.animate)?setTimeout(function(){if(t&&!t.destroyed){var e=t.getKeyShape();e&&!e.destroyed&&(t.getShapeCfg(s),i.updateComboEdges(t))}},201):this.updateComboEdges(t)}},t.prototype.updateComboEdges=function(t){for(var e,r,n=t.getEdges()||[],o=0;o-1&&i.splice(a,1),"edge"===o){var s=r.get("v".concat(o,"s")),u=s.indexOf(t);u>-1&&s.splice(u,1)}var l=t.get("id");delete r.get("itemMap")[l];var c=r.get("comboTrees"),f=t.get("id");if("node"===o){var h=t.getModel().comboId;if(c&&h){var p=c,d=!1;c.forEach(function(t){d||Mb(t,function(t){if(t.id===f&&p){var e=p.indexOf(t);return p.splice(e,1),d=!0,!1}return p=t.children,!0})})}for(var y=(b=t.getEdges()).length-1;y>=0;y--)r.removeItem(b[y],!1);h&&r.updateCombo(h)}else if("combo"===o){var v,g=t.getModel().parentId,m=!1;(c||[]).forEach(function(t){m||Mb(t,function(t){return t.id!==f||(v=t,m=!0,!1)})}),v.removed=!0,v&&v.children&&v.children.forEach(function(t){e.removeItem(t.id)});var b;for(y=(b=t.getEdges()).length;y>=0;y--)r.removeItem(b[y],!1);g&&r.updateCombo(g)}t.destroy(),r.emit("afterremoveitem",{item:n,type:o})}},t.prototype.setItemState=function(t,e,r){var n=this.graph,o=e;(0,rg.isString)(r)&&(o="".concat(e,":").concat(r)),t.hasState(o)===r&&r||(0,rg.isString)(r)&&t.hasState(o)||(n.emit("beforeitemstatechange",{item:t,state:o,enabled:r}),t.setState(e,r),n.autoPaint(),n.emit("afteritemstatechange",{item:t,state:o,enabled:r}))},t.prototype.priorityState=function(t,e){var r=this.graph,n=t;(0,rg.isString)(t)&&(n=r.findById(t)),this.setItemState(n,e,!1),this.setItemState(n,e,!0)},t.prototype.clearItemStates=function(t,e){var r=this.graph;(0,rg.isString)(t)&&(t=r.findById(t)),r.emit("beforeitemstatesclear",{item:t,states:e}),t.clearStates(e),r.emit("afteritemstatesclear",{item:t,states:e})},t.prototype.refreshItem=function(t){var e=this.graph;(0,rg.isString)(t)&&(t=e.findById(t)),e.emit("beforeitemrefresh",{item:t}),t.refresh(),e.emit("afteritemrefresh",{item:t})},t.prototype.addCombos=function(t,e){var r=this,n=this.graph;(t||[]).forEach(function(t){jb(t,function(t){var n;return e.forEach(function(e){e.id===t.id&&(e.children=t.children,e.depth=t.depth,n=e)}),n&&r.addItem("combo",n),!0})});var o=n.get("comboGroup");o&&o.sort()},t.prototype.changeItemVisibility=function(t,e){var r=this,n=this.graph;if((0,rg.isString)(t)&&(t=n.findById(t)),t){if(n.emit("beforeitemvisibilitychange",{item:t,visible:e}),t.changeVisibility(e),t.getType&&"node"===t.getType()){var o=t.getEdges();(0,rg.each)(o,function(t){(!e||t.get("source").isVisible()&&t.get("target").isVisible())&&r.changeItemVisibility(t,e)})}else if(t.getType&&"combo"===t.getType()){var i=n.get("comboTrees"),a=t.get("id"),s=[],u=!1;(i||[]).forEach(function(t){u||t.children&&0!==t.children.length&&Mb(t,function(t){return t.id!==a||(s=t.children,u=!0,!1)})}),s&&(!e||e&&!t.getModel().collapsed)&&s.forEach(function(t){var o=n.findById(t.id);r.changeItemVisibility(o,e)});o=t.getEdges();(0,rg.each)(o,function(t){(!e||t.get("source").isVisible()&&t.get("target").isVisible())&&r.changeItemVisibility(t,e)})}return n.emit("afteritemvisibilitychange",{item:t,visible:e}),t}console.warn("The item to be shown or hidden does not exist!")},t.prototype.destroy=function(){this.graph=null,this.destroyed=!0},t}(),OE=function(){function t(t){this.graph=t,this.destroyed=!1}return t.prototype.updateState=function(t,e,r){var n=this.graph.get("states"),o=e;(0,rg.isString)(r)&&(o="".concat(e,":").concat(r)),n[o]||(n[o]=[]),r?n[o].push(t):n[o]=n[o].filter(function(e){return e!==t}),this.graph.set("states",n),this.graph.emit("graphstatechange",{states:n})},t.prototype.updateStates=function(t,e,r){var n=this.graph.get("states");((0,rg.isString)(e)?[e]:e).forEach(function(e){var o=e;n[o]||(n[o]=[]),(0,rg.isString)(r)&&(o="".concat(e,":").concat(r)),r?n[o].push(t):n[o]=n[o].filter(function(e){return e!==t})}),this.graph.set("states",n),this.graph.emit("graphstatechange",{states:e})},t.prototype.destroy=function(){this.graph=null,this.destroyed=!0},t}(),PE=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,function(t,r){if("\\"===t.charAt(0))return t.slice(1);var n=e[r];return 0===n&&(n="0"),n||""}):t},kE=function(t){var e=[];if(t.length<2)throw new Error("point length must largn than 2, now it's ".concat(t.length));for(var r=0,n=t;r0?s-1:i-1,l=Im.normalize([0,0],Im.add([0,0],a[u].v,Im.scale([0,0],a[s].v,-1)));a[s].p=Im.add([0,0],a[s].p,Im.scale([0,0],l,e))}return a.map(function(t){var e=t.p;return{x:e[0],y:e[1]}})}var DE=function(t,e){for(var r=[],n=0;n<5;n++){var o=Math.cos((18+72*n)/180*Math.PI)*t,i=Math.sin((18+72*n)/180*Math.PI)*t,a=Math.cos((54+72*n)/180*Math.PI)*e,s=Math.sin((54+72*n)/180*Math.PI)*e;0===n?r.push(["M",o,-i]):r.push(["L",o,-i]),r.push(["L",a,-s])}return r.push(["Z"]),r},BE=function(t,e,r){return(t.y-r.y)*(e.x-r.x)-(t.x-r.x)*(e.y-r.y)},FE=function(t){var e=t.map(function(t){return{x:t.getModel().x,y:t.getModel().y}});e.sort(function(t,e){return t.x===e.x?t.y-e.y:t.x-e.x});for(var r={},n=e.length-1;n>=0;n--){var o=e[n],i=o.x,a=o.y;r["".concat(i,"-").concat(a)]&&e.splice(n,1),r["".concat(i,"-").concat(a)]=!0}if(1===e.length)return e;var s=[];for(n=0;n=2&&BE(s[s.length-2],s[s.length-1],e[n])<=0;)s.pop();s.push(e[n])}var u=[];for(n=e.length-1;n>=0;n--){for(;u.length>=2&&BE(u[u.length-2],u[u.length-1],e[n])<=0;)u.pop();u.push(e[n])}return u.pop(),s.pop(),s.concat(u)},GE={maxRoutingIterations:100,maxMarchingIterations:100,pixelGroupSize:2,edgeR0:10,edgeR1:10,nodeR0:5,nodeR1:10,morphBuffer:5,threshold:.001,skip:16,nodeInfluenceFactor:1,edgeInfluenceFactor:1,negativeNodeInfluenceFactor:-.5};function UE(t,e,r){var n=!1,o=function(t,r){return e.cells[t+r*e.width]},i=function(t,e){var n=0;return o(t-1,e-1)>=r&&(n+=1),o(t,e-1)>r&&(n+=2),o(t-1,e)>r&&(n+=4),o(t,e)>r&&(n+=8),n},a=function(r,n){for(var o,a,s=r,u=n,l=0;l-1){if(t[0].x===s&&t[0].y===u)return!0}else t.push({x:s,y:u});var c=i(s,u);switch(c){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:s++;break;case 12:case 14:case 4:s--;break;case 6:0===o&&(-1===a?s-=1:s+=1);break;case 1:case 13:case 5:u--;break;case 9:1===o&&(0===a?u-=1:u+=1);break;case 10:case 8:case 11:u++;break;default:return console.warn("Marching squares invalid state: ".concat(c)),!0}}};this.march=function(){for(var t=0;tr&&15!==i(t,s)&&(n=a(t,s));return n}}var zE=function(t,e,r){var n=null,o=Number.POSITIVE_INFINITY;return e.forEach(function(e){var i={x:t.getModel().x,y:t.getModel().y},a={x:e.getModel().x,y:e.getModel().y},s=lb(i,a),u=new nb(i.x,i.y,a.x,a.y),l=r.reduce(function(t,e){return sb(e,u)>0?t+1:t},0);s*Math.pow(l+1,2)=0&&o=1;)h=YE(r,c/=1.5,f,s),p=u(h,i)||u(h,o),d=l(h,e);!h||p||s&&d||(i.push(new nb(t.x1,t.y1,h.x,h.y)),i.push(new nb(h.x,h.y,t.x2,t.y2)),a=!0)};h(!0),a||h(!1)}}a||o.push(t),s+=1};!a&&i.length;)c()}for(;i.length;)o.push(i.pop());return o};var qE=function(t,e,r){var n=Object.assign(GE,r),o=ub(t.map(function(t){return{x:t.getModel().x,y:t.getModel().y}})),i=[],a=[];(t=t.sort(function(t,e){return lb({x:t.getModel().x,y:t.getModel().y},o)-lb({x:e.getModel().x,y:e.getModel().y},o)})).forEach(function(t){(function(t,e,r,n,o){var i=zE(t,r,e);if(null===i)return[];var a=new nb(t.getModel().x,t.getModel().y,i.getModel().x,i.getModel().y);return function(t){for(var r=[];t.length>0;){var n=t.pop();if(0===t.length){r.push(n);break}var o=t.pop(),i=new nb(n.x1,n.y1,o.x2,o.y2);VE(e,i)?(r.push(n),t.push(o)):t.push(i)}return r}(HE(a,e,n,o))})(t,e,i,n.maxRoutingIterations,n.morphBuffer).forEach(function(t){a.push(t)}),i.push(t)});for(var s,u,l,c,f,h=function(t,e,r){var n={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,width:0,height:0,x:0,y:0},o=[];t.forEach(function(t){o.push(t.getBBox())}),e.forEach(function(t){o.push(t.getBBox())});for(var i=0,a=o;in.maxX?s.maxX:n.maxX)+r,n.maxY=(s.maxY>n.maxY?s.maxY:n.maxY)+r}return n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.x=n.minX,n.y=n.minY,n}(t,a,n.nodeR0),p=(s=h.width,u=h.height,l=n.pixelGroupSize,c=Math.ceil(s/l),f=Math.ceil(u/l),{cells:new Float32Array(Math.max(0,c*f)).fill(0),width:c,height:f}),d=[],y=[],v=0;v1)for(m=Math.floor(g.length/n.skip);m<3&&n.skip>1;)n.skip-=1,m=Math.floor(g.length/n.skip);for(var b=0,w=0;w0))break;n.nonMemberInfluenceFactor*=.8}}return y};function WE(t,e,r,n,o,i){function a(t,e){var r=Math.floor((t-e)/i.pixelGroupSize);return r<0?0:r}function s(t,e){return t*i.pixelGroupSize+e}var u=(i.nodeR0-i.nodeR1)*(i.nodeR0-i.nodeR1),l=(i.edgeR0-i.edgeR1)*(i.edgeR0-i.edgeR1),c=function(t,e){return[Math.min(a(t.minX,e+n.minX),o.width),Math.min(a(t.minY,e+n.minY),o.height),Math.min(a(t.maxX,-e+n.minX),o.width),Math.min(a(t.maxY,-e+n.minY),o.height)]},f=function(t,e){for(var r=t.getBBox(),a=c(r,i.nodeR1),u=a[0],l=a[1],f=a[2],h=a[3],p=l;pu.y?n?l.topLeft:l.bottomRight:n?l.topRight:l.bottomLeft:a.ys.x?n?l.topLeft:l.bottomRight:n?l.bottomLeft:l.topRight:i.x0?this.cfg.padding+t:10+t,this.cfg.bubbleCfg={nodeR0:this.padding-t,nodeR1:this.padding-t,morphBuffer:this.padding-t}},t.prototype.setType=function(){this.type=this.cfg.type,this.members.length<3&&(this.type="round-convex"),"round-convex"!==this.type&&"smooth-convex"!==this.type&&"bubble"!==this.type&&(console.warn("The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default."),this.type="round-convex")},t.prototype.calcPath=function(t,e){var r,n,o;switch(this.type){case"round-convex":n=F_(o=LE((r=FE(t)).map(function(t){return[t.x,t.y]}),this.padding));break;case"smooth-convex":2===(r=FE(t)).length?n=F_(o=LE(r.map(function(t){return[t.x,t.y]}),this.padding)):r.length>2&&(o=RE(r.map(function(t){return[t.x,t.y]}),this.padding),n=ME(o));break;case"bubble":n=(r=qE(t,e,this.cfg.bubbleCfg)).length>=2&&ME(r)}return n},t.prototype.render=function(){this.group.addShape("path",{attrs:(0,eg.__assign)({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},t.prototype.addMember=function(t){if(t){(0,rg.isString)(t)&&(t=this.graph.findById(t)),this.members.push(t);var e=this.nonMembers.indexOf(t);return e>-1&&this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.addNonMember=function(t){if(t){(0,rg.isString)(t)&&(t=this.graph.findById(t)),this.nonMembers.push(t);var e=this.members.indexOf(t);return e>-1&&this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.removeMember=function(t){if(t){(0,rg.isString)(t)&&(t=this.graph.findById(t));var e=this.members.indexOf(t);return e>-1&&(this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0)}},t.prototype.removeNonMember=function(t){if(t){(0,rg.isString)(t)&&(t=this.graph.findById(t));var e=this.nonMembers.indexOf(t);return e>-1&&(this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0)}},t.prototype.updateData=function(t,e){var r=this;this.group.findById(this.id).remove(),t&&(this.members=t.map(function(t){return(0,rg.isString)(t)?r.graph.findById(t):t})),e&&(this.nonMembers=e.map(function(t){return(0,rg.isString)(t)?r.graph.findById(t):t})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.updateStyle=function(t){this.group.findById(this.id).attr((0,eg.__assign)({},t))},t.prototype.updateCfg=function(t){var e=this;this.cfg=(0,rg.deepMix)(this.cfg,t),this.id=this.cfg.id,this.group=this.cfg.group,t.members&&(this.members=this.cfg.members.map(function(t){return(0,rg.isString)(t)?e.graph.findById(t):t})),t.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(t){return(0,rg.isString)(t)?e.graph.findById(t):t})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.contain=function(t){var e,r,n=this,o=(e=(0,rg.isString)(t)?this.graph.findById(t):t).getKeyShape();if("path"===e.get("type"))r=AE(o.attr("path"));else{var i=o.getCanvasBBox();r=[[i.minX,i.minY],[i.maxX,i.minY],[i.maxX,i.maxY],[i.minX,i.maxY]]}return r=r.map(function(t){var e=n.graph.getPointByCanvas(t[0],t[1]);return[e.x,e.y]}),rb(r,AE(this.path))},t.prototype.destroy=function(){this.group.remove(),this.cfg=null},t}(),JE=fg,KE=function(t){function e(e){var r=t.call(this)||this;return r.sortCombos=(0,rg.debounce)(function(){var t=r.get("comboSorted");if(r&&!r.destroyed&&!t){r.set("comboSorted",!0);var e=[],n={};(r.get("comboTrees")||[]).forEach(function(t){Mb(t,function(t){return e[t.depth]?e[t.depth].push(t.id):e[t.depth]=[t.id],n[t.id]=t.depth,!0})}),(r.getEdges().concat(r.get("vedges"))||[]).forEach(function(t){var r=t.getModel(),o=n[r.source]||0,i=n[r.target]||0,a=Math.max(o,i);e[a]?e[a].push(r.id):e[a]=[r.id]}),e.forEach(function(t){if(t&&t.length)for(var e=t.length-1;e>=0;e--){var n=r.findById(t[e]);n&&n.toFront()}})}},500,!1),r.cfg=(0,rg.deepMix)(r.getDefaultCfg(),e),r.init(),r.animating=!1,r.destroyed=!1,r.cfg.enabledStack&&(r.undoStack=new Tm(r.cfg.maxStep),r.redoStack=new Tm(r.cfg.maxStep)),r}return(0,eg.__extends)(e,t),e.prototype.init=function(){this.initCanvas();var t=new aE(this),e=new Vb(this),r=new EE(this),n=new OE(this);this.set({viewController:t,modeController:e,itemController:r,stateController:n}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},e.prototype.initGroups=function(){var t=this.get("canvas");if(t){var e=(t.get("el")||{}).id,r=void 0===e?"g6":e,n=t.addGroup({id:"".concat(r,"-root"),className:Sb.rootContainerClassName});if(this.get("groupByTypes")){var o=n.addGroup({id:"".concat(r,"-edge"),className:Sb.edgeContainerClassName}),i=n.addGroup({id:"".concat(r,"-node"),className:Sb.nodeContainerClassName}),a=n.addGroup({id:"".concat(r,"-combo"),className:Sb.comboContainerClassName});a.toBack(),this.set({nodeGroup:i,edgeGroup:o,comboGroup:a})}var s=n.addGroup({id:"".concat(r,"-delegate"),className:Sb.delegateContainerClassName});this.set({delegateGroup:s}),this.set("group",n)}},e.prototype.getDefaultCfg=function(){return{container:void 0,width:void 0,height:void 0,renderer:"canvas",modes:{},plugins:[],data:{},fitViewPadding:10,minZoom:.02,maxZoom:10,event:!0,groupByTypes:!0,directed:!1,autoPaint:!0,nodes:[],edges:[],combos:[],vedges:[],itemMap:{},linkCenter:!1,defaultNode:{},defaultEdge:{},nodeStateStyles:{},edgeStateStyles:{},states:{},animate:!1,animateCfg:{onFrame:void 0,duration:500,easing:"easeLinear"},callback:void 0,enabledStack:!1,maxStep:10,tooltips:[],optimizeThreshold:1e3}},e.prototype.set=function(t,e){return(0,rg.isPlainObject)(t)?this.cfg=(0,eg.__assign)((0,eg.__assign)({},this.cfg),t):this.cfg[t]=e,"enabledStack"!==t||!e||this.undoStack||this.redoStack||(this.undoStack=new Tm(this.cfg.maxStep),this.redoStack=new Tm(this.cfg.maxStep)),this},e.prototype.get=function(t){var e;return null===(e=this.cfg)||void 0===e?void 0:e[t]},e.prototype.getGroup=function(){return this.get("group")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.getMinZoom=function(){return this.get("minZoom")},e.prototype.setMinZoom=function(t){return this.set("minZoom",t)},e.prototype.getMaxZoom=function(){return this.get("maxZoom")},e.prototype.setMaxZoom=function(t){return this.set("maxZoom",t)},e.prototype.getWidth=function(){return this.get("width")},e.prototype.getHeight=function(){return this.get("height")},e.prototype.clearItemStates=function(t,e){(0,rg.isString)(t)&&(t=this.findById(t));var r=this.get("itemController");e||(e=t.get("states")),r.clearItemStates(t,e),this.get("stateController").updateStates(t,e,!1)},e.prototype.node=function(t){"function"==typeof t&&this.set("nodeMapper",t)},e.prototype.edge=function(t){"function"==typeof t&&this.set("edgeMapper",t)},e.prototype.combo=function(t){"function"==typeof t&&this.set("comboMapper",t)},e.prototype.findById=function(t){return this.get("itemMap")[t]},e.prototype.find=function(t,e){var r,n=this.get("".concat(t,"s"));return(0,rg.each)(n,function(t,n){if(e(t,n))return r=t}),r},e.prototype.findAll=function(t,e){var r=[];return(0,rg.each)(this.get("".concat(t,"s")),function(t,n){e(t,n)&&r.push(t)}),r},e.prototype.findAllByState=function(t,e,r){return r?this.findAll(t,function(t){return t.hasState(e)&&r(t)}):this.findAll(t,function(t){return t.hasState(e)})},e.prototype.translate=function(t,e,r,n){var o=this,i=this.get("group"),a=(0,rg.clone)(i.getMatrix());if(a||(a=[1,0,0,0,1,0,0,0,1]),r){var s=Ub({animateCfg:n,callback:function(){return o.emit("viewportchange",{action:"translate",matrix:i.getMatrix()})}});Jm(i,{x:i.getCanvasBBox().x+t,y:i.getCanvasBBox().y+e},r,s||{duration:500,easing:"easeCubic"})}else a=JE(a,[["t",t,e]]),i.setMatrix(a),this.emit("viewportchange",{action:"translate",matrix:a}),this.autoPaint()},e.prototype.moveTo=function(t,e,r,n){var o=this.get("group");Jm(o,{x:t,y:e},r,n||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:o.getMatrix()})},e.prototype.fitView=function(t,e,r,n){t&&this.set("fitViewPadding",t);var o=this.get("viewController");e?o.fitViewByRules(e,r,n):o.fitView(r,n),this.autoPaint()},e.prototype.fitCenter=function(t,e){this.get("viewController").fitCenter(t,e),this.autoPaint()},e.prototype.addBehaviors=function(t,e){return this.get("modeController").manipulateBehaviors(t,e,!0),this},e.prototype.removeBehaviors=function(t,e){return this.get("modeController").manipulateBehaviors(t,e,!1),this},e.prototype.updateBehavior=function(t,e,r){return this.get("modeController").updateBehavior(t,e,r),this},e.prototype.zoom=function(t,e,r,n){var o=this,i=this.get("group"),a=(0,rg.clone)(i.getMatrix())||[1,0,0,0,1,0,0,0,1],s=this.get("minZoom"),u=this.get("maxZoom"),l=this.getZoom()||1,c=l*t,f=t,h=!1;if(s&&cu&&(f=u/l,h=!0),a=JE(a,e?[["t",-e.x,-e.y],["s",f,f],["t",e.x,e.y]]:[["s",f,f]]),r){var p=(0,rg.clone)(i.getMatrix());p||(p=[1,0,0,0,1,0,0,0,1]);var d=p[0],y=d*f,v=Ub({animateCfg:n,callback:function(){return o.emit("viewportchange",{action:"zoom",matrix:i.getMatrix()})}});i.animate(function(t){if(1===t)p=a;else{var r=db(d,y,t)/p[0];p=JE(p,e?[["t",-e.x,-e.y],["s",r,r],["t",e.x,e.y]]:[["s",r,r]])}return{matrix:p}},v)}else i.setMatrix(a),this.emit("viewportchange",{action:"zoom",matrix:a}),this.autoPaint();return!h},e.prototype.zoomTo=function(t,e,r,n){var o=t/this.getZoom();return this.zoom(o,e,r,n)},e.prototype.focusItem=function(t,e,r){var n=this.get("viewController"),o=!1;e?o=!0:void 0===e&&(o=this.get("animate"));var i={};r?i=r:void 0===r&&(i=this.get("animateCfg")),n.focus(t,o,i),this.autoPaint()},e.prototype.focusItems=function(t,e,r,n){this.get("viewController").focusItems(t,e,r,n)},e.prototype.autoPaint=function(){this.get("autoPaint")&&this.paint()},e.prototype.paint=function(){this.emit("beforepaint"),this.get("canvas").draw(),this.emit("afterpaint")},e.prototype.getPointByClient=function(t,e){return this.get("viewController").getPointByClient(t,e)},e.prototype.getClientByPoint=function(t,e){return this.get("viewController").getClientByPoint(t,e)},e.prototype.getPointByCanvas=function(t,e){return this.get("viewController").getPointByCanvas(t,e)},e.prototype.getCanvasByPoint=function(t,e){return this.get("viewController").getCanvasByPoint(t,e)},e.prototype.getGraphCenterPoint=function(){var t=this.get("group").getCanvasBBox();return{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}},e.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},e.prototype.showItem=function(t,e){void 0===e&&(e=!0);var r=this.get("itemController").changeItemVisibility(t,!0);if(e&&this.get("enabledStack")){var n=r.getID(),o={},i={};switch(r.getType()){case"node":o.nodes=[{id:n,visible:!1}],i.nodes=[{id:n,visible:!0}];break;case"edge":o.nodes=[{id:n,visible:!1}],i.edges=[{id:n,visible:!0}];break;case"combo":o.nodes=[{id:n,visible:!1}],i.combos=[{id:n,visible:!0}]}this.pushStack("visible",{before:o,after:i})}},e.prototype.hideItem=function(t,e){void 0===e&&(e=!0);var r=this.get("itemController").changeItemVisibility(t,!1);if(e&&this.get("enabledStack")){var n=r.getID(),o={},i={};switch(r.getType()){case"node":o.nodes=[{id:n,visible:!0}],i.nodes=[{id:n,visible:!1}];break;case"edge":o.nodes=[{id:n,visible:!0}],i.edges=[{id:n,visible:!1}];break;case"combo":o.nodes=[{id:n,visible:!0}],i.combos=[{id:n,visible:!1}]}this.pushStack("visible",{before:o,after:i})}},e.prototype.refreshItem=function(t){this.get("itemController").refreshItem(t)},e.prototype.setAutoPaint=function(t){this.set("autoPaint",t),this.get("canvas").set("autoDraw",t)},e.prototype.remove=function(t,e){void 0===e&&(e=!0),this.removeItem(t,e)},e.prototype.removeItem=function(t,e){void 0===e&&(e=!0);var r=t;if((0,rg.isString)(t)&&(r=this.findById(t)),!r&&(0,rg.isString)(t))console.warn("The item ".concat(t," to be removed does not exist!"));else if(r){var n="";if(r.getType&&(n=r.getType()),e&&this.get("enabledStack")){var o=(0,eg.__assign)((0,eg.__assign)({},r.getModel()),{itemType:n}),i={};switch(n){case"node":i.nodes=[o],i.edges=[];for(var a=r.getEdges(),s=a.length-1;s>=0;s--)i.edges.push((0,eg.__assign)((0,eg.__assign)({},a[s].getModel()),{itemType:"edge"}));break;case"edge":i.edges=[o];break;case"combo":i.combos=[o]}this.pushStack("delete",{before:i,after:{}})}if("node"===n)r.getModel().comboId&&this.updateComboTree(r,void 0,!1);if(this.get("itemController").removeItem(r),"combo"===n){var u=Db(this.get("comboTrees"));this.set("comboTrees",u)}}},e.prototype.innerAddItem=function(t,e,r){if(!function(t,e){if("node"===t||"combo"===t){if(e.id&&!(0,rg.isString)(e.id))return console.warn("G6 Warning Tips: missing 'id' property, or the 'id' %c".concat(e.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1}else if(!("edge"!==t||e.source&&e.target))return console.warn("G6 Warning Tips: missing 'source' or 'target' for the edge."),!1;return!0}(t,e))return!1;if(!e.id||!this.findById(e.id)){var n,o=this.get("comboTrees")||[];if("combo"===t){var i=this.get("itemMap"),a=!1;if(o.forEach(function(o){a||jb(o,function(o){if(e.parentId===o.id){a=!0;var s=(0,eg.__assign)({id:e.id,depth:o.depth+2},e);o.children?o.children.push(s):o.children=[s],e.depth=s.depth,n=r.addItem(t,e)}var u=i[o.id];return a&&u&&u.getType&&"combo"===u.getType()&&r.updateCombo(u,o.children),!0})}),!a){var s=(0,eg.__assign)({id:e.id,depth:0},e);e.depth=s.depth,o.push(s),n=r.addItem(t,e)}this.set("comboTrees",o),e.collapsed&&(this.collapseCombo(n,!1),this.updateCombo(n))}else if("node"===t&&(0,rg.isString)(e.comboId)&&o){var u;(u=this.findById(e.comboId))&&u.getType&&"combo"!==u.getType()&&console.warn("'".concat(e.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),n=r.addItem(t,e);var l=this.get("itemMap"),c=!1,f=!1;o.forEach(function(t){f||c||jb(t,function(t){if(t.id===e.id)return f=!0,!1;if(e.comboId===t.id&&!f){c=!0;var n=(0,rg.clone)(e);n.itemType="node",t.children?t.children.push(n):t.children=[n],n.depth=t.depth+1}return c&&l[t.id].getType&&"combo"===l[t.id].getType()&&r.updateCombo(l[t.id],t.children),!0})})}else n=r.addItem(t,e);if("node"===t&&e.comboId||"combo"===t&&e.parentId)(u=this.findById(e.comboId||e.parentId))&&u.getType&&"combo"===u.getType()&&u.addChild(n);return n}console.warn("This item exists already. Be sure the id %c".concat(e.id,"%c is unique."),"font-size: 20px; color: red;","")},e.prototype.addItem=function(t,e,r,n){void 0===r&&(r=!0),void 0===n&&(n=!0);var o=this.get("comboSorted");this.set("comboSorted",o&&!n);var i=this.get("itemController"),a=this.innerAddItem(t,e,i);if(!1===a||!0===a)return a;var s=this.get("combos");if(s&&s.length>0&&this.sortCombos(),this.autoPaint(),r&&this.get("enabledStack")){var u=(0,eg.__assign)((0,eg.__assign)({},a.getModel()),{itemType:t}),l={};switch(t){case"node":l.nodes=[u];break;case"edge":l.edges=[u];break;case"combo":l.combos=[u]}this.pushStack("add",{before:{},after:l})}return a},e.prototype.addItems=function(t,e,r){void 0===t&&(t=[]),void 0===e&&(e=!0),void 0===r&&(r=!0);var n=this.get("comboSorted");this.set("comboSorted",n&&!r);for(var o=this.get("itemController"),i=[],a=0;a0&&this.sortCombos()}if(this.autoPaint(),e&&this.get("enabledStack")){var l={nodes:[],edges:[],combos:[]};for(a=0;a=0;p--)h[p].destroyed&&h.splice(p,1);c&&(o.addCombos(c),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",l,i.edges),(0,rg.each)(u,function(t,e){(!t.getType||"node"!==t.getType()&&"combo"!==t.getType())&&l.edges.indexOf(t)<0&&(delete u[e],o.remove(t,!1))}),(this.get("comboTrees")||[]).forEach(function(t){jb(t,function(t){return"combo"===n.findById(t.id).getType()&&t.collapsed&&n.collapseCombo(t.id,!1),!0})}),this.set({nodes:l.nodes,edges:l.edges});var d=(this.get("layout")||{}).relayoutAtChangeData,y=void 0===d||d,v=this.get("layoutController");return y&&v&&(v.changeData(function(){setTimeout(function(){var t;null===(t=o.getCombos())||void 0===t||t.forEach(function(t){t.set("animate",!0)})},0)}),o.get("animate")&&!v.getLayoutType()?(o.positionsAnimate(),null===(r=o.getCombos())||void 0===r||r.forEach(function(t){return t.set("animate",!0)})):o.autoPaint()),setTimeout(function(){a.set("localRefresh",s)},16),this.set("data",i),this.emit("afterchangedata"),this},e.prototype.addCombos=function(t){var e=this.get("comboTrees");this.get("itemController").addCombos(e,t)},e.prototype.createCombo=function(t,e,r){var n=this;void 0===r&&(r=!0);var o=this.get("itemController");this.set("comboSorted",!1);var i,a="";if(t){if((0,rg.isString)(t))a=t,i={id:t};else{if(!(a=t.id))return void console.warn("Create combo failed. Please assign a unique string id for the adding combo.");i=t}var s=r&&this.get("enabledStack"),u={nodes:[],combos:[]};s&&e.forEach(function(t){var e=n.findById(t),r=e.getType();if("node"===r||"combo"===r){var o=e.getModel();u["".concat(r,"s")].push({id:t,parentId:"node"===r?o.comboId:o.parentId})}});var l=this.get("comboTrees"),c=new Set(e),f=new Map;l&&(l.forEach(function(t){jb(t,function(t,e,r){if(c.has(t.id)){if(e){var i=n.findById(e.id),a=n.findById(t.id);e.children.splice(r,1),i.removeChild(a),o.updateCombo(i,e.children)}"combo"===t.itemType&&f.set(t.id,t)}return!0})}),l=l.filter(function(t){return!c.has(t.id)}),this.set("comboTrees",l));var h={nodes:[],combos:[]},p=e.map(function(t){var e=n.findById(t),r=e.getModel(),o="";e.getType&&(o=e.getType());var i=f.get(t)||{id:e.getID(),itemType:o};return"combo"===o?(i.parentId=a,r.parentId=a):"node"===o&&(i.comboId=a,r.comboId=a),s&&h["".concat(o,"s")].push({id:r.id,parentId:a}),i});i.children=p,this.addItem("combo",i,!1),this.set("comboSorted",!1),l&&(l.forEach(function(t){Mb(t,function(t){return t.id!==a||(t.itemType="combo",t.children=p,!1)})}),this.sortCombos()),s&&(h.combos.push(i),this.pushStack("createCombo",{before:u,after:h}));var d=this.findById(a);!d.getModel().parentId&&d.getChildren().combos.length&&this.updateComboTree(d,void 0,!1),setTimeout(function(){d.set("animate",!0)},0)}},e.prototype.uncombo=function(t,e){var r,n,o=this;void 0===e&&(e=!0);var i=t;if((0,rg.isString)(t)&&(i=this.findById(t)),!i||i.getType&&"combo"!==i.getType())console.warn("The item is not a combo!");else{var a=i.getModel(),s=i.getModel().parentId,u=this.get("comboTrees");u||(u=[]);var l,c=this.get("itemMap"),f=i.get("id"),h=[],p=this.get("combos"),d=this.findById(s),y=e&&this.get("enabledStack"),v={};if(y&&((v=(0,rg.clone)(a)).children=[]),u.forEach(function(t){l||jb(t,function(t){var e;if(t.id===f){l=t,i.getEdges().map(function(t){return t.getID()}).forEach(function(t){o.removeItem(t,!1)});var r=p.indexOf(i);p.splice(r,1),delete c[f];var n=(0,rg.clone)(i.getModel());i.destroy(),o.emit("afterremoveitem",{item:n,type:"combo"})}return!s||!l||t.id!==s||(d.removeCombo(i),-1!==(r=(h=t.children).indexOf(l))&&h.splice(r,1),null===(e=l.children)||void 0===e||e.forEach(function(t){var e=o.findById(t.id),r=e.getModel();e.getType&&"combo"===e.getType()?(t.parentId=s,delete t.comboId,r.parentId=s,delete r.comboId):e.getType&&"node"===e.getType()&&(t.comboId=s,r.comboId=s),d.addChild(e),h.push(t)}),o.updateCombo(d),!1)})}),!s&&l){var g=u.indexOf(l);u.splice(g,1),null===(r=l.children)||void 0===r||r.forEach(function(t){t.parentId=void 0;var e=o.findById(t.id).getModel();delete e.parentId,delete e.comboId,"node"!==t.itemType&&u.push(t)})}if(y){var m={nodes:[],combos:[]},b={nodes:[],combos:[]};null===(n=l.children)||void 0===n||n.forEach(function(t){var e=o.findById(t.id).getType();"node"!==e&&"combo"!==e||(m["".concat(e,"s")].push({id:t.id,parentId:f}),b["".concat(e,"s")].push({id:t.id,parentId:s}))}),m.combos.push(v),this.pushStack("uncombo",{before:m,after:b})}}},e.prototype.updateCombos=function(t){var e=this;void 0===t&&(t=!1);var r=this.get("comboTrees"),n=this.get("itemController"),o=this.get("itemMap");(r||[]).forEach(function(r){jb(r,function(r){var i;if(!r)return!0;var a=o[r.id];if("combo"===(null===(i=null===a||void 0===a?void 0:a.getType)||void 0===i?void 0:i.call(a))){var s=(0,eg.__spreadArray)([],a.getStates(),!0);(0,rg.each)(s,function(t){return e.setItemState(a,t,!1)}),n.updateCombo(a,r.children,t),(0,rg.each)(s,function(t){return e.setItemState(a,t,!0)})}return!0})}),this.sortCombos()},e.prototype.updateCombo=function(t){var e,r=this,n=t;if((0,rg.isString)(t)&&(n=this.findById(t)),!n||n.getType&&"combo"!==n.getType())console.warn("The item to be updated is not a combo!");else{e=n.get("id");var o=this.get("comboTrees"),i=this.get("itemController"),a=this.get("itemMap");(o||[]).forEach(function(t){jb(t,function(t){if(!t)return!0;var n=a[t.id];if(e===t.id&&n&&n.getType&&"combo"===n.getType()){var o=(0,eg.__spreadArray)([],n.getStates(),!0);(0,rg.each)(o,function(t){n.getStateStyle(t)&&r.setItemState(n,t,!1)}),i.updateCombo(n,t.children),(0,rg.each)(o,function(t){n.getStateStyle(t)&&r.setItemState(n,t,!0)}),e&&(e=t.parentId)}return!0})})}},e.prototype.updateComboTree=function(t,e,r){void 0===r&&(r=!0);var n;this.set("comboSorted",!1);var o,i=(n=(0,rg.isString)(t)?this.findById(t):t).getModel(),a=i.comboId||i.parentId,s="";if(n.getType&&(s=n.getType()),e&&"combo"===s){var u,l=!0;if((this.get("comboTrees")||[]).forEach(function(t){u||Mb(t,function(t){if(!u)return t.id===n.getID()&&(u=t),!0})}),Mb(u,function(t){return t.id!==e||(l=!1,!1)}),!l)return void console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!")}if(r&&this.get("enabledStack")){var c={},f={};"combo"===s?(c.combos=[{id:i.id,parentId:i.parentId}],f.combos=[{id:i.id,parentId:e}]):"node"===s&&(c.nodes=[{id:i.id,parentId:i.comboId}],f.nodes=[{id:i.id,parentId:e}]),this.pushStack("updateComboTree",{before:c,after:f})}if(i.parentId||i.comboId){var h=this.findById(i.parentId||i.comboId);h&&h.removeChild(n)}("combo"===s?i.parentId=e:"node"===s&&(i.comboId=e),e)&&((o=this.findById(e))&&o.addChild(n));a&&((o=this.findById(a))&&o.removeChild(n));var p=Db(this.get("comboTrees"),i.id,e);this.set("comboTrees",p),this.updateCombos()},e.prototype.save=function(){var t=[],e=[],r=[];return(0,rg.each)(this.get("nodes"),function(e){t.push(e.getModel())}),(0,rg.each)(this.get("edges"),function(t){e.push(t.getModel())}),(0,rg.each)(this.get("combos"),function(t){r.push(t.getModel())}),{nodes:t,edges:e,combos:r}},e.prototype.changeSize=function(t,e){return this.get("viewController").changeSize(t,e),this},e.prototype.refresh=function(){if(this.emit("beforegraphrefresh"),this.get("animate"))this.positionsAnimate();else{var t=this.get("nodes"),e=this.get("edges"),r=this.get("edges");(0,rg.each)(t,function(t){t.refresh()}),(0,rg.each)(e,function(t){t.refresh()}),(0,rg.each)(r,function(t){t.refresh()})}this.emit("aftergraphrefresh"),this.autoPaint()},e.prototype.getNodes=function(){return this.get("nodes")},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getCombos=function(){return this.get("combos")},e.prototype.getComboChildren=function(t){if((0,rg.isString)(t)&&(t=this.findById(t)),t&&(!t.getType||"combo"===t.getType()))return t.getChildren();console.warn("The combo does not exist!")},e.prototype.positionsAnimate=function(t){var e=this;e.emit("beforeanimate");var r=e.get("animateCfg"),n=r.onFrame,o=t?e.getNodes().concat(e.getCombos()):e.getNodes(),i=o.map(function(t){var e=t.getModel();return{id:e.id,x:e.x,y:e.y}});e.stopAnimate();var a=e.get("canvas");e.animating=!0,setTimeout(function(){a.animate(function(r){(0,rg.each)(i,function(t){var o=e.findById(t.id);if(o&&!o.destroyed){var i=o.get("originAttrs"),a=o.get("model"),s=o.getContainer().getMatrix();if(void 0!==i&&null!==i||(s&&(i={x:s[6],y:s[7]}),o.set("originAttrs",i||0)),n){var u=n(o,r,t,i||{x:0,y:0});o.set("model",Object.assign(a,u))}else i?(a.x=i.x+(t.x-i.x)*r,a.y=i.y+(t.y-i.y)*r):(a.x=t.x,a.y=t.y)}}),e.refreshPositions(t)},{duration:r.duration,easing:r.easing,callback:function(){(0,rg.each)(o,function(t){t.set("originAttrs",null)}),r.callback&&r.callback(),e.emit("afteranimate"),e.animating=!1}})},0)},e.prototype.refreshPositions=function(t){this.emit("beforegraphrefreshposition");var e,r=this.get("nodes"),n=this.get("edges"),o=this.get("vedges"),i=this.get("combos"),a={},s=function(t){(0,rg.each)(t,function(t){e=t.getModel();var r=t.get("originAttrs");if(!r||e.x!==r.x||e.y!==r.y){var n=t.updatePosition({x:e.x,y:e.y});a[e.id]=n,e.comboId&&(a[e.comboId]=a[e.comboId]||n),e.parentId&&(a[e.parentId]=a[e.parentId]||n)}})};s(i),s(r),i&&0!==i.length&&(t?(s(i),this.updateCombos()):this.updateCombos()),(0,rg.each)(n,function(t){var e=t.getSource().getModel(),r=t.getTarget();if(!(0,rg.isPlainObject)(r)){var n=r.getModel();(a[e.id]||a[n.id]||t.getModel().isComboEdge)&&t.refresh()}}),(0,rg.each)(o,function(t){t.refresh()}),this.emit("aftergraphrefreshposition"),this.autoPaint()},e.prototype.stopAnimate=function(){var t=this.get("canvas").cfg.timeline;t&&t.stopAllAnimations()},e.prototype.isAnimating=function(){return this.animating},e.prototype.getZoom=function(){var t=this.get("group").getMatrix();return t?t[0]:1},e.prototype.getCurrentMode=function(){return this.get("modeController").getMode()},e.prototype.setMode=function(t){return this.get("modeController").setMode(t),this},e.prototype.clear=function(t){var e;return void 0===t&&(t=!1),null===(e=this.get("canvas"))||void 0===e||e.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],vedges:[],groups:[],combos:[],comboTrees:[]}),t||this.emit("afterrender"),this},e.prototype.updateLayout=function(t,e,r,n){var o=this;void 0===t&&(t={}),void 0===n&&(n=!0);var i=this.get("layoutController");if((0,rg.isString)(t)&&(t={type:t}),e){var a=r;a||(a="begin"===e?{x:0,y:0}:{x:this.getWidth()/2,y:this.getHeight()/2}),a=this.getPointByCanvas(a.x,a.y);var s=["force","gForce","fruchterman","force2"];s.includes(t.type)||!t.type&&s.includes(null===i||void 0===i?void 0:i.layoutType)?t.center=[a.x,a.y]:this.once("afterlayout",function(t){var r=o.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];a.x=a.x*r[0]+r[6],a.y=a.y*r[0]+r[7];var n=o.getGroup().getCanvasBBox(),i=n.minX,s=n.maxX,u=n.minY,l={x:(i+s)/2,y:(u+n.maxY)/2};"begin"===e&&(l.x=i,l.y=u),o.translate(a.x-l.x,a.y-l.y)})}var u=(0,eg.__assign)({},this.get("layout")),l={};Object.assign(l,u,t),t.pipes&&!t.type?delete l.type:!t.pipes&&l.type&&delete l.pipes,this.set("layout",l),i&&(i.isLayoutTypeSame(l)&&l.gpuEnabled===u.gpuEnabled?i.updateLayoutCfg(l):i.changeLayout(l),n&&this.get("enabledStack")&&this.pushStack("layout",{before:u,after:l}))},e.prototype.destroyLayout=function(){var t=this.get("layoutController");null===t||void 0===t||t.destroyLayout()},e.prototype.layout=function(){var t,e=this.get("layoutController"),r=this.get("layout");r&&e&&(r.workerEnabled?e.layout():(null===(t=e.layoutMethods)||void 0===t?void 0:t.length)?e.relayout(!0):e.layout())},e.prototype.collapseCombo=function(t,e){var r=this;if(void 0===e&&(e=!0),!this.destroyed)if((0,rg.isString)(t)&&(t=this.findById(t)),t){this.emit("beforecollapseexpandcombo",{action:"collapse",item:t});var n=t.getModel();this.get("itemController").collapseCombo(t,e),n.collapsed=!0;var o=this.getEdges().concat(this.get("vedges")),i=[],a=!1;(this.get("comboTrees")||[]).forEach(function(t){a||Mb(t,function(t){if(a&&t.depth<=n.depth)return!1;if(n.id===t.id&&(a=!0),a){var e=r.findById(t.id);e&&e.getType&&"combo"===e.getType()&&(i=(i=i.concat(e.getNodes())).concat(e.getCombos()))}return!0})});var s={};o.forEach(function(t){var e=t.getModel(),o=e.isVEdge,a=e.size,u=void 0===a?1:a;if(!t.isVisible()||o){var l,c=t.getSource(),f=t.getTarget(),h=null;if(c.getModel().id===n.id||i.includes(c)&&!i.includes(f)?(h=f,l=!1):(f.getModel().id===n.id||!i.includes(c)&&i.includes(f))&&(h=c,l=!0),h){if(o)return void r.removeItem(t,!1);for(var p=h.getModel();!h.isVisible();){var d=p.parentId,y=p.comboId,v=d||y;if(!(h=r.findById(v))||!v)return;p=h.getModel()}var g=p.id,m=l?{source:g,target:n.id,size:u,isVEdge:!0}:{source:n.id,target:g,size:u,isVEdge:!0},b="".concat(m.source,"-").concat(m.target);if(s[b])return void(s[b].size+=u);s[b]=m}}}),this.addItems(Object.values(s).map(function(t){return{type:"vedge",model:t}}),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:t})}else console.warn("The combo to be collapsed does not exist!")},e.prototype.expandCombo=function(t,e){var r=this;if(void 0===e&&(e=!0),(0,rg.isString)(t)&&(t=this.findById(t)),!t||t.getType&&"combo"!==t.getType())console.warn("The combo to be collapsed does not exist!");else{this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var n=t.getModel();this.get("itemController").expandCombo(t,e),n.collapsed=!1;var o=this.getEdges().concat(this.get("vedges")),i=[],a=!1;(this.get("comboTrees")||[]).forEach(function(t){a||Mb(t,function(t){if(a&&t.depth<=n.depth)return!1;if(n.id===t.id&&(a=!0),a){var e=r.findById(t.id);e&&e.getType&&"combo"===e.getType()&&(i=(i=i.concat(e.getNodes())).concat(e.getCombos()))}return!0})});var s={};o.forEach(function(t){if(!t.isVisible()||t.getModel().isVEdge){var e,o=t.getSource(),a=t.getTarget(),u=o.get("id"),l=a.get("id"),c=null;if(u===n.id||i.includes(o)&&!i.includes(a)?(c=a,e=!1):l===n.id||!i.includes(o)&&i.includes(a)?(c=o,e=!0):i.includes(o)&&i.includes(a)&&o.isVisible()&&a.isVisible()&&t.show(),c){var f=t.getModel(),h=f.isVEdge,p=f.size,d=void 0===p?1:p;if(h)return void r.removeItem(t,!1);for(var y=c.getModel();!c.isVisible();){var v=y.parentId,g=y.comboId,m=v||g;if(!(c=r.findById(m))||!m)return;y=c.getModel()}for(var b=y.id,w=e?a:o,S=w.getModel();!w.isVisible();){var x=S.parentId,_=S.comboId,E=x||_;if(!(w=r.findById(E))||!E)return;if(S.comboId===n.id||S.parentId===n.id)break;S=w.getModel()}var O=S.id;if(b){var P=e?{source:b,target:O,isVEdge:!0,size:d}:{source:O,target:b,isVEdge:!0,size:d},k="".concat(P.source,"-").concat(P.target);if(s[k])return void(s[k].size+=d);s[k]=P}}}}),this.addItems(Object.values(s).map(function(t){return{type:"vedge",model:t}}),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:t})}},e.prototype.collapseExpandCombo=function(t,e){if(void 0===e&&(e=!0),(0,rg.isString)(t)&&(t=this.findById(t)),t&&(!t.getType||"combo"===t.getType())){for(var r=t.getModel(),n=this.findById(r.parentId);n;){var o=n.getModel();if(o.collapsed)return console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),void(n=void 0);n=this.findById(o.parentId)}r.collapsed?this.expandCombo(t,e):this.collapseCombo(t,e),this.updateCombo(t)}},e.prototype.getNeighbors=function(t,e){var r=t;return(0,rg.isString)(t)&&(r=this.findById(t)),r.getNeighbors(e)},e.prototype.getNodeDegree=function(t,e,r){void 0===e&&(e=void 0),void 0===r&&(r=!1);var n=t;(0,rg.isString)(t)&&(n=this.findById(t));var o=this.get("degrees");o&&!r||(o=Og(this.save()),this.set("degrees",o));var i=o[n.getID()],a=0;if(!i)return 0;switch(e){case"in":a=i.inDegree;break;case"out":a=i.outDegree;break;case"all":a=i;break;default:a=i.degree}return a},e.prototype.getUndoStack=function(){return this.undoStack},e.prototype.getRedoStack=function(){return this.redoStack},e.prototype.getStackData=function(){return this.get("enabledStack")?{undoStack:this.undoStack.toArray(),redoStack:this.redoStack.toArray()}:null},e.prototype.clearStack=function(){this.get("enabledStack")&&(this.undoStack.clear(),this.redoStack.clear(),this.emit("stackchange",{undoStack:this.undoStack,redoStack:this.redoStack}))},e.prototype.pushStack=function(t,e,r){if(void 0===t&&(t="update"),void 0===r&&(r="undo"),this.get("enabledStack")){var n=e?(0,rg.clone)(e):{before:{},after:(0,rg.clone)(this.save())};"redo"===r?this.redoStack.push({action:t,data:n}):this.undoStack.push({action:t,data:n}),this.emit("stackchange",{action:t,stackType:r,undoStack:this.undoStack,redoStack:this.redoStack})}else console.warn("请先启用 undo & redo 功能,在实例化 Graph 时候配置 enabledStack: true !")},e.prototype.getAdjMatrix=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=this.get("directed"));var r=this.get("adjMatrix");return r&&t||(r=hg(this.save(),e),this.set("adjMatrix",r)),r},e.prototype.getShortestPathMatrix=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=this.get("directed"));var r=this.get("adjMatrix"),n=this.get("shortestPathMatrix");return r&&t||(r=hg(this.save(),e),this.set("adjMatrix",r)),n&&t||(n=Bg(this.save(),e),this.set("shortestPathMatrix",n)),n},e.prototype.on=function(e,r,n){return t.prototype.on.call(this,e,r,n)},e.prototype.destroy=function(){var t,e,r,n,o;this.emit("beforedestroy"),this.clear(),this.clearStack(),null===(t=this.get("itemController"))||void 0===t||t.destroy(),null===(e=this.get("modeController"))||void 0===e||e.destroy(),null===(r=this.get("viewController"))||void 0===r||r.destroy(),null===(n=this.get("stateController"))||void 0===n||n.destroy(),null===(o=this.get("canvas"))||void 0===o||o.destroy(),this.cfg=null,this.destroyed=!0,this.redoStack=null,this.undoStack=null,this.emit("afterdestroy")},e.prototype.createHull=function(t){if(t.members&&!(t.members.length<1)){var e=this.get("hullGroup"),r=this.get("hullMap");if(r||(r={},this.set("hullMap",r)),e&&!e.get("destroyed")||((e=this.get("group").addGroup({id:"hullGroup"})).toBack(),this.set("hullGroup",e)),r[t.id])return console.warn("Existed hull id."),r[t.id];var n=e.addGroup({id:"".concat(t.id,"-container")}),o=new XE(this,(0,eg.__assign)((0,eg.__assign)({},t),{group:n}));return r[o.id]=o,o}console.warn("Create hull failed! The members is empty.")},e.prototype.getHulls=function(){return this.get("hullMap")},e.prototype.getHullById=function(t){return this.get("hullMap")[t]},e.prototype.removeHull=function(t){var e,r;r=(0,rg.isString)(t)?this.getHullById(t):t,null===(e=this.get("hullMap"))||void 0===e||delete e[r.id],r.destroy()},e.prototype.removeHulls=function(){var t=this.getHulls();t&&Object.keys(t).length&&(Object.keys(t).forEach(function(e){t[e].destroy()}),this.set("hullMap",{}))},e}(ag);function QE(t){"@babel/helpers - typeof";return(QE="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var ZE=fg,$E=["startArrow","endArrow"],tO={lineWidth:1,stroke:void 0,fill:void 0,lineAppendWidth:1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,x:0,y:0,r:10,width:20,height:20,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},eO={edge:{lineWidth:1,stroke:"#000",lineDash:void 0,startArrow:!1,endArrow:!1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},node:tO,combo:tO},rO={options:{labelCfg:{style:{fontFamily:Sb.windowFontFamily}},descriptionCfg:{style:{fontFamily:Sb.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(t){return{}},getOptions:function(t,e){return"move"===e||(null===e||void 0===e?void 0:e.includes("bbox"))?t:(0,rg.deepMix)({},this.options,this.getCustomConfig(t)||{},t)},draw:function(t,e){e.shapeMap={},this.mergeStyle=this.getOptions(t);var r=this.drawShape(t,e);if(r.set("className",this.itemType+"-shape"),e.shapeMap[this.itemType+"-shape"]=r,t.label){var n=this.drawLabel(t,e);n.set("className",this.itemType+"-label"),e.shapeMap[this.itemType+"-label"]=n}return r},afterDraw:function(t,e,r){},drawShape:function(t,e){return null},drawLabel:function(t,e){var r=(this.mergeStyle||this.getOptions(t)||{}).labelCfg||{},n=this.getLabelStyle(t,r,e),o=n.rotate;delete n.rotate;var i=e.addShape("text",{attrs:n,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=i,!isNaN(o)&&""!==o){var a=i.getBBox(),s=[1,0,0,0,1,0,0,0,1];if(n.rotateCenter)switch(n.rotateCenter){case"center":s=ZE(s,[["t",-a.width/2,-a.height/2],["r",o],["t",a.width/2,a.height/2]]);break;case"lefttop":s=ZE(s,[["t",-n.x,-n.y],["r",o],["t",n.x,n.y]]);break;case"leftcenter":s=ZE(s,[["t",-n.x,-n.y-a.height/2],["r",o],["t",n.x,n.y+a.height/2]]);break;default:s=ZE(s,[["t",-a.width/2,-a.height/2],["r",o],["t",a.width/2,a.height/2]])}else s=ZE(s,[["t",-n.x,-n.y-a.height/2],["r",o],["t",n.x,n.y+a.height/2]]);i.setMatrix(s)}if(n.background){var u=this.drawLabelBg(t,e,i),l=this.itemType+"-label-bg";u.set("classname",l),e.shapeMap[l]=u,i.toFront()}return i},drawLabelBg:function(t,e,r){var n=this.options.labelCfg,o=(0,rg.mix)({},n,t.labelCfg),i=this.getLabelBgStyleByPosition(r,o),a=e.addShape("rect",{name:"text-bg-shape",attrs:i,labelRelated:!0});return e.shapeMap["text-bg-shape"]=a,a},getLabelStyleByPosition:function(t,e,r){return{text:t.label}},getLabelBgStyleByPosition:function(t,e){return{}},getLabelStyle:function(t,e,r){var n=this.getLabelStyleByPosition(t,e,r),o="".concat(this.itemType,"Label"),i=Sb[o]?Sb[o].style:null;return(0,eg.__assign)((0,eg.__assign)((0,eg.__assign)({},i),n),e.style)},getShapeStyle:function(t){return t.style},update:function(t,e,r){this.updateShapeStyle(t,e,r),this.updateLabel(t,e,r)},updateShapeStyle:function(t,e,r){var n,o=e.getContainer(),i=e.getKeyShape(),a=(0,rg.mix)({},i.attr(),t.style),s=function(t){var e,r=a[t];if((0,rg.isPlainObject)(r)){var s=(null===(n=o.shapeMap)||void 0===n?void 0:n[t])||o.find(function(e){return e.get("name")===t});null===s||void 0===s||s.attr(r)}else i.attr(((e={})[t]=r,e))};for(var u in a)s(u)},updateLabel:function(t,e,r){var n,o,i=e.getContainer(),a=(this.mergeStyle||this.getOptions({},r)||{}).labelCfg,s=void 0===a?{}:a,u=this.itemType+"-label",l=i.shapeMap[u]||i.find(function(t){return t.get("className")===u}),c=this.itemType+"-label-bg",f=i.shapeMap[c]||i.find(function(t){return t.get("className")===c});if(l&&void 0===t.label&&(i.removeChild(l),delete i.shapeMap[u],f&&(i.removeChild(f),delete i.shapeMap[c])),t.label||""===t.label)if(l){(!r||"bbox|label"===r||"edge"===this.itemType&&"style"!==r)&&(s=(0,rg.deepMix)(s,t.labelCfg));var h=this.getLabelStyleByPosition(t,s,i),p=null===(n=t.labelCfg)||void 0===n?void 0:n.style,d=(0,eg.__assign)((0,eg.__assign)({},h),p),y=d.rotate;if(delete d.rotate,isNaN(y)||""===y)1!==(null===(o=l.getMatrix())||void 0===o?void 0:o[4])&&l.resetMatrix(),l.attr(d);else{var v=[1,0,0,0,1,0,0,0,1];v=ZE(v,[["t",-d.x,-d.y],["r",y],["t",d.x,d.y]]),d.matrix=v,l.attr(d)}if(f)if(d.background){var g=this.getLabelBgStyleByPosition(l,s);f.attr(g)}else i.removeChild(f);else d.background&&((f=this.drawLabelBg(t,i,l)).set("classname",c),i.shapeMap[c]=f,l.toFront())}else{var m=this.drawLabel(t,i);m.set("className",u),i.shapeMap[u]=m}},afterUpdate:function(t,e){},setState:function(t,e,r){var n,o,i,a=r.get("keyShape");if(a&&!a.destroyed){var s=r.getType(),u=(0,rg.isBoolean)(e)?t:"".concat(t,":").concat(e),l=this.getStateStyle(u,r),c=r.getStateStyle(u);if(c||l){var f=(0,rg.mix)({},c||l),h=r.getContainer(),p={x:1,y:1,cx:1,cy:1,matrix:1};if("combo"===s&&(p.r=1,p.width=1,p.height=1),e){var d=function(t){var e,r=f[t];if((0,rg.isPlainObject)(r)&&!$E.includes(t)){var n=(null===(i=h.shapeMap)||void 0===i?void 0:i[t])||h.find(function(e){return e.get("name")===t});null===n||void 0===n||n.attr(r)}else a.attr(((e={})[t]=r,e))};for(var y in f)d(y)}else{var v=Gb(r.getCurrentStatesStyle()),g=r.getModel(),m=(0,rg.mix)({},g.style,Gb(r.getOriginStyle())),b=a.get("name"),w=a.attr(),S={};Object.keys(w).forEach(function(t){if("img"!==t){var e=w[t];e&&"object"===QE(e)?S[t]=(0,rg.clone)(e):S[t]=e}});var x={},_=function(t){var e=f[t];if((0,rg.isPlainObject)(e)&&!$E.includes(t)){var r=h.shapeMap[t]||h.find(function(e){return e.get("name")===t});if(r){var n=Gb(r.attr());(0,rg.each)(e,function(e,o){if(t===b&&S[o]&&!p[o]){delete S[o];var i=m[t][o]||eO[s][o];a.attr(o,i)}else if(n[o]||0===n[o]){delete n[o];var u=m[t][o]||eO[s][o];r.attr(o,u)}}),x[t]=n}}else if(S[t]&&!p[t]){delete S[t];var o=m[t]||(m[b]?m[b][t]:void 0)||eO[s][t];a.attr(t,o)}};for(var E in f)_(E);for(var y in b?x[b]=S:(0,rg.mix)(x,S),v)if(!p[y]){var O=v[y];(0,rg.isPlainObject)(O)&&!$E.includes(y)||(b?((0,rg.mix)(m[b],((o={})[y]=O,o)),delete m[y]):(0,rg.mix)(m,((n={})[y]=O,n)),delete v[y])}var P={};(0,rg.deepMix)(P,m,x,v);var k=!1,C=function(t){var e,r,n=P[t];if((0,rg.isPlainObject)(n)&&!$E.includes(t)){var o=h.shapeMap[t]||h.find(function(e){return e.get("name")===t});o&&(("text"===o.get("type")||o.get("labelRelated"))&&(delete n.x,delete n.y,delete n.matrix),t===b&&("combo"===s&&(delete n.r,delete n.width,delete n.height),k=!0),o.attr(n))}else if(!k){var i=n||eO[s][t];"combo"===s?b||a.attr(((e={})[t]=i,e)):a.attr(((r={})[t]=i,r))}};for(var T in P)C(T)}}}},getStateStyle:function(t,e){var r=e.getModel(),n=e.getType(),o=this.getOptions(r),i=o.stateStyles,a=o.style,s=void 0===a?{}:a,u=r.stateStyles?r.stateStyles[t]:i&&i[t];return"combo"===n?(0,rg.clone)(u):(0,rg.mix)({},s,u)},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e,r;return(null===t||void 0===t?void 0:t.anchorPoints)||(null===(e=this.getCustomConfig(t))||void 0===e?void 0:e.anchorPoints)||(null===(r=this.options)||void 0===r?void 0:r.anchorPoints)}},nO={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:Sb.nodeLabel.offset,getSize:function(t){var e,r=(null===(e=this.mergeStyle)||void 0===e?void 0:e.size)||t.size||this.getOptions({}).size||Sb.defaultNode.size;return(0,rg.isArray)(r)&&1===r.length&&(r=[r[0],r[0]]),(0,rg.isArray)(r)||(r=[r,r]),r},getLabelStyleByPosition:function(t,e){var r=e.maxLength,n=t.label;r&&(n=Lb(n,r));var o=e.position||this.labelPosition;if("center"===o)return{x:0,y:0,text:n,textBaseline:"middle",textAlign:"center"};var i=e.offset;(0,rg.isNil)(i)&&(i=this.offset);var a,s=this.getSize(t);switch(o){case"top":a={x:0,y:-s[1]/2-i,textBaseline:"bottom",textAlign:"center"};break;case"bottom":a={x:0,y:s[1]/2+i,textBaseline:"top",textAlign:"center"};break;case"left":a={x:-s[0]/2-i,y:0,textBaseline:"middle",textAlign:"right"};break;default:a={x:s[0]/2+i,y:0,textBaseline:"middle",textAlign:"left"}}return a.text=n,a},getLabelBgStyleByPosition:function(t,e){var r;if(!t)return{};var n=null===(r=e.style)||void 0===r?void 0:r.background;if(!n)return{};var o=t.getBBox(),i=$_(n.padding),a=o.width+i[1]+i[3],s=o.height+i[0]+i[2];return(0,eg.__assign)((0,eg.__assign)({x:o.minX-i[3],y:o.minY-i[0]},n),{width:a,height:s})},drawShape:function(t,e){var r=this.shapeType,n=this.getShapeStyle(t),o=e.addShape(r,{attrs:n,draggable:!0,name:"node-shape"});return e.shapeMap["node-shape"]=o,o},updateLinkPoints:function(t,e){var r,n=(this.mergeStyle||this.getOptions(t)).linkPoints,o=e.shapeMap["link-point-left"]||e.find(function(t){return"link-point-left"===t.get("className")}),i=e.shapeMap["link-point-right"]||e.find(function(t){return"link-point-right"===t.get("className")}),a=e.shapeMap["link-point-top"]||e.find(function(t){return"link-point-top"===t.get("className")}),s=e.shapeMap["link-point-bottom"]||e.find(function(t){return"link-point-bottom"===t.get("className")});o&&(r=o.attr()),i&&!r&&(r=i.attr()),a&&!r&&(r=a.attr()),s&&!r&&(r=s.attr()),r||(r=n);var u=(0,rg.mix)({},r,t.linkPoints),l=u.fill,c=u.stroke,f=u.lineWidth,h=u.size/2;h||(h=u.r);var p=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},d=p.left,y=p.right,v=p.top,g=p.bottom,m=this.getSize(t),b=m[0],w=m[1],S={r:h,fill:l,stroke:c,lineWidth:f};if(o)d||void 0===d?o.attr((0,eg.__assign)((0,eg.__assign)({},S),{x:-b/2,y:0})):(o.remove(),delete e.shapeMap["link-point-left"]);else if(d){var x="link-point-left";e.shapeMap[x]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},S),{x:-b/2,y:0}),className:x,name:x,isAnchorPoint:!0})}if(i)y||void 0===y||(i.remove(),delete e.shapeMap["link-point-right"]),i.attr((0,eg.__assign)((0,eg.__assign)({},S),{x:b/2,y:0}));else if(y){var _="link-point-right";e.shapeMap[_]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},S),{x:b/2,y:0}),className:_,name:_,isAnchorPoint:!0})}if(a)v||void 0===v||(a.remove(),delete e.shapeMap["link-point-top"]),a.attr((0,eg.__assign)((0,eg.__assign)({},S),{x:0,y:-w/2}));else if(v){var E="link-point-top";e.shapeMap[E]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},S),{x:0,y:-w/2}),className:E,name:E,isAnchorPoint:!0})}if(s)g||void 0===g?s.attr((0,eg.__assign)((0,eg.__assign)({},S),{x:0,y:w/2})):(s.remove(),delete e.shapeMap["link-point-bottom"]);else if(g){var O="link-point-bottom";e.shapeMap[O]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},S),{x:0,y:w/2}),className:O,name:O,isAnchorPoint:!0})}},updateShape:function(t,e,r,n,o){e.get("keyShape").attr((0,eg.__assign)({},r)),this.updateLabel(t,e,o),n&&this.updateIcon(t,e)},updateIcon:function(t,e){var r=this,n=e.getContainer(),o=(this.mergeStyle||this.getOptions(t)).icon,i=t.icon?t.icon:{show:void 0,text:void 0},a=i.show,s=i.text,u=n.shapeMap["".concat(this.type,"-icon")]||n.find(function(t){return t.get("name")==="".concat(r.type,"-icon")});if(u)if(a||void 0===a){var l=(0,rg.mix)({},u.attr(),o),c=l.width,f=void 0===c?20:c,h=l.height,p=void 0===h?20:h;("iconfont"===l.fontFamily||l.hasOwnProperty("text"))&&(f=0,p=0),u.attr((0,eg.__assign)((0,eg.__assign)({},l),{x:-f/2,y:-p/2}))}else u.remove(),delete n.shapeMap["".concat(this.type,"-icon")];else if(a){var d="".concat(this.type,"-icon");if(s)n.shapeMap[d]=n.addShape("text",{attrs:(0,eg.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:d,name:d});else{f=o.width,p=o.height;n.shapeMap[d]=n.addShape("image",{attrs:(0,eg.__assign)((0,eg.__assign)({},o),{x:-f/2,y:-p/2}),className:d,name:d})}var y=n.shapeMap["node-label"]||n.find(function(t){return"node-label"===t.get("name")});y&&y.toFront()}}},oO=(0,eg.__assign)((0,eg.__assign)({},rO),nO);mE.registerNode("single-node",oO);var iO={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:Sb.defaultEdge.size,style:{x:0,y:0,stroke:Sb.defaultEdge.style.stroke,lineAppendWidth:Sb.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:Sb.edgeLabel.style.fill,fontSize:Sb.edgeLabel.style.fontSize,fontFamily:Sb.windowFontFamily}},stateStyles:(0,eg.__assign)({},Sb.edgeStateStyles)},getPath:function(t){var e=[];return(0,rg.each)(t,function(t,r){0===r?e.push(["M",t.x,t.y]):e.push(["L",t.x,t.y])}),e},getShapeStyle:function(t){var e=this.options.style,r={stroke:t.color},n=(0,rg.mix)({},e,r,t.style),o=t.size||Sb.defaultEdge.size,i=(t=this.getPathPoints(t)).startPoint,a=t.endPoint,s=this.getControlPoints(t),u=[i];s&&(u=u.concat(s)),u.push(a);var l=this.getPath(u);return(0,rg.mix)({},Sb.defaultEdge.style,{stroke:Sb.defaultEdge.color,lineWidth:o,path:l},n)},updateShapeStyle:function(t,e,r){var n,o=e.getContainer(),i=(null===(n=e.getKeyShape)||void 0===n?void 0:n.call(e))||o.shapeMap["edge-shape"],a=t.size,s=(t=this.getPathPoints(t)).startPoint,u=t.endPoint,l=this.getControlPoints(t),c=[s];l&&(c=c.concat(l)),c.push(u);var f=i.attr(),h=t.style||{};void 0===h.stroke&&(h.stroke=t.color);var p=t.sourceNode,d=t.targetNode,y={radius:h.radius};l||(y={source:p,target:d,offset:h.offset,radius:h.radius});var v=this.getPath(c,y),g={};"move"===r?g={path:v}:(f.endArrow&&!1===h.endArrow&&(t.style.endArrow={path:""}),f.startArrow&&!1===h.startArrow&&(t.style.startArrow={path:""}),void 0===(g=(0,eg.__assign)({},t.style)).lineWidth&&(g.lineWidth=((0,rg.isNumber)(a)?a:null===a||void 0===a?void 0:a[0])||f.lineWidth),void 0===g.path&&(g.path=v),void 0===g.stroke&&(g.stroke=f.stroke||t.color)),i&&i.attr(g)},getLabelStyleByPosition:function(t,e,r){var n,o=e.position||this.labelPosition,i={},a=null===r||void 0===r?void 0:r.shapeMap["edge-shape"];n="start"===o?0:"end"===o?1:.5;var s,u=e.refX||this.refX,l=e.refY||this.refY;if(t.startPoint.x===t.endPoint.x&&t.startPoint.y===t.endPoint.y)return i.x=t.startPoint.x+u,i.y=t.startPoint.y+l,i.text=t.label,i;s=(0,rg.isNil)(e.autoRotate)?this.labelAutoRotate:e.autoRotate;var c=Ab(a,n,u,l,s);return i.x=c.x,i.y=c.y,i.rotate=c.rotate,i.textAlign=this._getTextAlign(o,c.angle),i.text=t.label,i},getLabelBgStyleByPosition:function(t,e){if(!t)return{};var r=t.getBBox(),n=e.style&&e.style.background;if(!n)return{};var o=n.padding,i=r.width+o[1]+o[3],a=r.height+o[0]+o[2],s=(0,eg.__assign)((0,eg.__assign)({},n),{width:i,height:a,x:r.minX-o[3],y:r.minY-o[0],matrix:[1,0,0,0,1,0,0,0,1]});return((0,rg.isNil)(e.autoRotate)?this.labelAutoRotate:e.autoRotate)&&(s.matrix=t.attr("matrix")||[1,0,0,0,1,0,0,0,1]),s},_getTextAlign:function(t,e){var r="center";return e?(e%=2*Math.PI,"center"!==t&&(r=e>=0&&e<=Math.PI/2||e>=1.5*Math.PI&&e<2*Math.PI?t:function(t){var e=t;return"start"===t?e="end":"end"===t&&(e="start"),e}(t)),r):t},getControlPoints:function(t){return t.controlPoints},getPathPoints:function(t){return t},drawShape:function(t,e){var r=this.getShapeStyle(t),n=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:r});return e.shapeMap["edge-shape"]=n,n},drawLabel:function(t,e){var r=this.options.labelCfg,n=(0,rg.deepMix)({},r,t.labelCfg),o=this.getLabelStyle(t,n,e),i=o.rotate;delete o.rotate;var a=e.addShape("text",{attrs:o,name:"text-shape",labelRelated:!0,draggable:!0});if(e.shapeMap["text-shape"]=a,isNaN(i)||""===i||a.rotateAtStart(i),o.background){var s=this.drawLabelBg(t,e,a,o,i),u=this.itemType+"-label-bg";s.set("classname",u),e.shapeMap[u]=s,a.toFront()}return a},drawLabelBg:function(t,e,r,n,o){var i=this.options.labelCfg,a=(0,rg.deepMix)({},i,t.labelCfg),s=this.getLabelBgStyleByPosition(r,a),u=e.addShape("rect",{name:"text-bg-shape",attrs:s,labelRelated:!0});return e.shapeMap["text-bg-shape"]=u,u}},aO=(0,eg.__assign)((0,eg.__assign)({},rO),iO);mE.registerEdge("single-edge",aO),mE.registerEdge("line",{getControlPoints:function(){}},"single-edge"),mE.registerEdge("spline",{getPath:function(t){return kE(t)}},"single-edge"),mE.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(t){var e,r,n=t.startPoint,o=t.endPoint,i=(n.x+o.x)/2,a=(n.y+o.y)/2;if(void 0!==t.controlPoints){if(r=t.controlPoints[0],e=Vm(n,r,o),n.x<=o.x&&n.y>o.y?this.clockwise=e.x>r.x?0:1:n.x<=o.x&&n.yr.x?1:0:n.x>o.x&&n.y<=o.y?this.clockwise=e.y=t&&o<=t+r&&i>=e&&i<=e+n}function PO(t,e){return!(e.minX>t.maxX||e.maxXt.maxY||e.maxY=0&&a<.5*Math.PI?(n={x:u.minX,y:u.minY},o={x:u.maxX,y:u.maxY}):.5*Math.PI<=a&&a1&&(r*=Math.sqrt(p),n*=Math.sqrt(p));var d=r*r*(h*h)+n*n*(f*f),y=d?Math.sqrt((r*r*(n*n)-d)/d):1;i===a&&(y*=-1),isNaN(y)&&(y=0);var v=n?y*r*h/n:0,g=r?y*-n*f/r:0,m=(s+l)/2+Math.cos(o)*v-Math.sin(o)*g,b=(u+c)/2+Math.sin(o)*v+Math.cos(o)*g,w=[(f-v)/r,(h-g)/n],S=[(-1*f-v)/r,(-1*h-g)/n],x=RO([1,0],w),_=RO(w,S);return LO(w,S)<=-1&&(_=Math.PI),LO(w,S)>=1&&(_=0),0===a&&_>0&&(_-=2*Math.PI),1===a&&_<0&&(_+=2*Math.PI),{cx:m,cy:b,rx:kO(t,[l,c])?0:r,ry:kO(t,[l,c])?0:n,startAngle:x,endAngle:x+_,xRotation:o,arcFlag:i,sweepFlag:a}}function BO(t){"@babel/helpers - typeof";return(BO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var FO=Math.sin,GO=Math.cos,UO=Math.atan2,zO=Math.PI;function VO(t,e,r,n,o,i,a){var s=e.stroke,u=e.lineWidth,l=UO(n-i,r-o),c=new _P({type:"path",canvas:t.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*GO(zO/6)+","+10*FO(zO/6)+" L0,0 L"+10*GO(zO/6)+",-"+10*FO(zO/6),stroke:s,lineWidth:u}});c.translate(o,i),c.rotateAtPoint(o,i,l),t.set(a?"startArrowShape":"endArrowShape",c)}function HO(t,e,r,n,o,i,a){var s=e.startArrow,u=e.endArrow,l=e.stroke,c=e.lineWidth,f=a?s:u,h=f.d,p=f.fill,d=f.stroke,y=f.lineWidth,v=(0,eg.__rest)(f,["d","fill","stroke","lineWidth"]),g=UO(n-i,r-o);h&&(o-=GO(g)*h,i-=FO(g)*h);var m=new _P({type:"path",canvas:t.get("canvas"),isArrowShape:!0,attrs:(0,eg.__assign)((0,eg.__assign)({},v),{stroke:d||l,lineWidth:y||c,fill:p})});m.translate(o,i),m.rotateAtPoint(o,i,g),t.set(a?"startArrowShape":"endArrowShape",m)}function qO(t,e,r,n,o){var i=UO(n-e,r-t);return{dx:GO(i)*o,dy:FO(i)*o}}function WO(t,e,r,n,o,i){"object"===BO(e.startArrow)?HO(t,e,r,n,o,i,!0):e.startArrow?VO(t,e,r,n,o,i,!0):t.set("startArrowShape",null)}function YO(t,e,r,n,o,i){"object"===BO(e.endArrow)?HO(t,e,r,n,o,i,!1):e.endArrow?VO(t,e,r,n,o,i,!1):t.set("startArrowShape",null)}var XO={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"};function JO(t,e){var r=e.attr();for(var n in r){var o=r[n],i=XO[n]?XO[n]:n;"matrix"===i&&o?t.transform(o[0],o[1],o[3],o[4],o[6],o[7]):"lineDash"===i&&t.setLineDash?(0,rg.isArray)(o)&&t.setLineDash(o):("strokeStyle"===i||"fillStyle"===i?o=IO(t,e,o):"globalAlpha"===i&&(o*=t.globalAlpha),t[i]=o)}}function KO(t,e,r){for(var n=0;nw?b:w,P=b>w?1:b/w,k=b>w?w/b:1;e.translate(g,m),e.rotate(_),e.scale(P,k),e.arc(0,0,O,S,x,1-E),e.scale(1/P,1/k),e.rotate(-_),e.translate(-g,-m)}break;case"Z":e.closePath()}if("Z"===h)s=u;else{var C=f.length;s=[f[C-2],f[C-1]]}}}}function eP(t,e){var r=t.get("canvas");r&&("remove"===e&&(t._cacheCanvasBBox=t.get("cacheCanvasBBox")),t.get("hasChanged")||(t.set("hasChanged",!0),t.cfg.parent&&t.cfg.parent.get("hasChanged")||(r.refreshElement(t,e,r),r.get("autoDraw")&&r.draw())))}function rP(t){var e,r,n;if(t.destroyed)e=t._cacheCanvasBBox;else{var o=t.get("cacheCanvasBBox"),i=o&&!(!o.width||!o.height),a=t.getCanvasBBox(),s=a&&!(!a.width||!a.height);i&&s?(n=a,e=(r=o)&&n?{minX:Math.min(r.minX,n.minX),minY:Math.min(r.minY,n.minY),maxX:Math.max(r.maxX,n.maxX),maxY:Math.max(r.maxY,n.maxY)}:r||n):i?e=o:s&&(e=a)}return e}var nP=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.onCanvasChange=function(t){eP(this,t)},e.prototype.getShapeBase=function(){return h},e.prototype.getGroupBase=function(){return e},e.prototype._applyClip=function(t,e){e&&(t.save(),JO(t,e),e.createPath(t),t.restore(),t.clip(),e._afterDraw())},e.prototype.cacheCanvasBBox=function(){var t=this.cfg.children,e=[],r=[];(0,rg.each)(t,function(t){var n=t.cfg.cacheCanvasBBox;n&&t.cfg.isInView&&(e.push(n.minX,n.maxX),r.push(n.minY,n.maxY))});var n=null;if(e.length){var o=(0,rg.min)(e),i=(0,rg.max)(e),a=(0,rg.min)(r),s=(0,rg.max)(r);n={minX:o,minY:a,x:o,y:a,maxX:i,maxY:s,width:i-o,height:s-a};var u=this.cfg.canvas;if(u){var l=u.getViewRange();this.set("isInView",PO(n,l))}}else this.set("isInView",!1);this.set("cacheCanvasBBox",n)},e.prototype.draw=function(t,e){var r=this.cfg.children,n=!e||this.cfg.refresh;r.length&&n&&(t.save(),JO(t,this),this._applyClip(t,this.getClip()),KO(t,r,e),t.restore(),this.cacheCanvasBBox()),this.cfg.refresh=null,this.set("hasChanged",!1)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("hasChanged",!1)},e}(Wx),oP=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.getShapeBase=function(){return h},e.prototype.getGroupBase=function(){return nP},e.prototype.onCanvasChange=function(t){eP(this,t)},e.prototype.calculateBBox=function(){var t=this.get("type"),e=this.getHitLineWidth(),r=Kx(t)(this),n=e/2,o=r.x-n,i=r.y-n,a=r.x+r.width+n,s=r.y+r.height+n;return{x:o,minX:o,y:i,minY:i,width:r.width+e,height:r.height+e,maxX:a,maxY:s}},e.prototype.isFill=function(){return!!this.attrs.fill||this.isClipShape()},e.prototype.isStroke=function(){return!!this.attrs.stroke},e.prototype._applyClip=function(t,e){e&&(t.save(),JO(t,e),e.createPath(t),t.restore(),t.clip(),e._afterDraw())},e.prototype.draw=function(t,e){var r=this.cfg.clipShape;if(e){if(!1===this.cfg.refresh)return void this.set("hasChanged",!1);if(!PO(e,this.getCanvasBBox()))return this.set("hasChanged",!1),void(this.cfg.isInView&&this._afterDraw())}t.save(),JO(t,this),this._applyClip(t,r),this.drawPath(t),t.restore(),this._afterDraw()},e.prototype.getCanvasViewBox=function(){var t=this.cfg.canvas;return t?t.getViewRange():null},e.prototype.cacheCanvasBBox=function(){var t=this.getCanvasViewBox();if(t){var e=this.getCanvasBBox(),r=PO(e,t);this.set("isInView",r),r?this.set("cacheCanvasBBox",e):this.set("cacheCanvasBBox",null)}},e.prototype._afterDraw=function(){this.cacheCanvasBBox(),this.set("hasChanged",!1),this.set("refresh",null)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("isInView",null),this.set("hasChanged",!1)},e.prototype.drawPath=function(t){this.createPath(t),this.strokeAndFill(t),this.afterDrawPath(t)},e.prototype.fill=function(t){t.fill()},e.prototype.stroke=function(t){t.stroke()},e.prototype.strokeAndFill=function(t){var e=this.attrs,r=e.lineWidth,n=e.opacity,o=e.strokeOpacity,i=e.fillOpacity;this.isFill()&&((0,rg.isNil)(i)||1===i?this.fill(t):(t.globalAlpha=i,this.fill(t),t.globalAlpha=n)),this.isStroke()&&r>0&&((0,rg.isNil)(o)||1===o||(t.globalAlpha=o),this.stroke(t)),this.afterDrawPath(t)},e.prototype.createPath=function(t){},e.prototype.afterDrawPath=function(t){},e.prototype.isInShape=function(t,e){var r=this.isStroke(),n=this.isFill(),o=this.getHitLineWidth();return this.isInStrokeOrPath(t,e,r,n,o)},e.prototype.isInStrokeOrPath=function(t,e,r,n,o){return!1},e.prototype.getHitLineWidth=function(){if(!this.isStroke())return 0;var t=this.attrs;return t.lineWidth+t.lineAppendWidth},e}(Yx),iP=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x:0,y:0,r:0})},e.prototype.isInStrokeOrPath=function(t,e,r,n,o){var i=this.attr(),a=i.x,s=i.y,u=i.r,l=o/2,c=EO(a,s,t,e);return n&&r?c<=u+l:n?c<=u:!!r&&(c>=u-l&&c<=u+l)},e.prototype.createPath=function(t){var e=this.attr(),r=e.x,n=e.y,o=e.r;t.beginPath(),t.arc(r,n,o,0,2*Math.PI,!1),t.closePath()},e}(oP);function aP(t,e,r,n){return t/(r*r)+e/(n*n)}var sP=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x:0,y:0,rx:0,ry:0})},e.prototype.isInStrokeOrPath=function(t,e,r,n,o){var i=this.attr(),a=o/2,s=i.x,u=i.y,l=i.rx,c=i.ry,f=(t-s)*(t-s),h=(e-u)*(e-u);return n&&r?aP(f,h,l+a,c+a)<=1:n?aP(f,h,l,c)<=1:!!r&&(aP(f,h,l-a,c-a)>=1&&aP(f,h,l+a,c+a)<=1)},e.prototype.createPath=function(t){var e=this.attr(),r=e.x,n=e.y,o=e.rx,i=e.ry;if(t.beginPath(),t.ellipse)t.ellipse(r,n,o,i,0,0,2*Math.PI,!1);else{var a=o>i?o:i,s=o>i?1:o/i,u=o>i?i/o:1;t.save(),t.translate(r,n),t.scale(s,u),t.arc(0,0,a,0,2*Math.PI),t.restore(),t.closePath()}},e}(oP);function uP(t){return t instanceof HTMLElement&&(0,rg.isString)(t.nodeName)&&"CANVAS"===t.nodeName.toUpperCase()}var lP=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x:0,y:0,width:0,height:0})},e.prototype.initAttrs=function(t){this._setImage(t.img)},e.prototype.isStroke=function(){return!1},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._afterLoading=function(){if(!0===this.get("toDraw")){var t=this.get("canvas");t?t.draw():this.createPath(this.get("context"))}},e.prototype._setImage=function(t){var e=this,r=this.attrs;if((0,rg.isString)(t)){var n=new Image;n.onload=function(){if(e.destroyed)return!1;e.attr("img",n),e.set("loading",!1),e._afterLoading();var t=e.get("callback");t&&t.call(e)},n.crossOrigin="Anonymous",n.src=t,this.set("loading",!0)}else t instanceof Image?(r.width||(r.width=t.width),r.height||(r.height=t.height)):uP(t)&&(r.width||(r.width=Number(t.getAttribute("width"))),r.height||(r.height,Number(t.getAttribute("height"))))},e.prototype.onAttrChange=function(e,r,n){t.prototype.onAttrChange.call(this,e,r,n),"img"===e&&this._setImage(r)},e.prototype.createPath=function(t){if(this.get("loading"))return this.set("toDraw",!0),void this.set("context",t);var e=this.attr(),r=e.x,n=e.y,o=e.width,i=e.height,a=e.sx,s=e.sy,u=e.swidth,l=e.sheight,c=e.img;(c instanceof Image||uP(c))&&((0,rg.isNil)(a)||(0,rg.isNil)(s)||(0,rg.isNil)(u)||(0,rg.isNil)(l)?t.drawImage(c,r,n,o,i):t.drawImage(c,a,s,u,l,r,n,o,i))},e}(oP);function cP(t,e,r,n,o,i,a){var s=Math.min(t,r),u=Math.max(t,r),l=Math.min(e,n),c=Math.max(e,n),f=o/2;return i>=s-f&&i<=u+f&&a>=l-f&&a<=c+f&&n_.pointToLine(t,e,r,n,i,a)<=o/2}var fP=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this.setArrow()},e.prototype.onAttrChange=function(e,r,n){t.prototype.onAttrChange.call(this,e,r,n),this.setArrow()},e.prototype.setArrow=function(){var t=this.attr(),e=t.x1,r=t.y1,n=t.x2,o=t.y2,i=t.startArrow,a=t.endArrow;i&&WO(this,t,n,o,e,r),a&&YO(this,t,e,r,n,o)},e.prototype.isInStrokeOrPath=function(t,e,r,n,o){if(!r||!o)return!1;var i=this.attr();return cP(i.x1,i.y1,i.x2,i.y2,o,t,e)},e.prototype.createPath=function(t){var e=this.attr(),r=e.x1,n=e.y1,o=e.x2,i=e.y2,a=e.startArrow,s=e.endArrow,u={dx:0,dy:0},l={dx:0,dy:0};a&&a.d&&(u=qO(r,n,o,i,e.startArrow.d)),s&&s.d&&(l=qO(r,n,o,i,e.endArrow.d)),t.beginPath(),t.moveTo(r+u.dx,n+u.dy),t.lineTo(o-l.dx,i-l.dy)},e.prototype.afterDrawPath=function(t){var e=this.get("startArrowShape"),r=this.get("endArrowShape");e&&e.draw(t),r&&r.draw(t)},e.prototype.getTotalLength=function(){var t=this.attr(),e=t.x1,r=t.y1,n=t.x2,o=t.y2;return n_.length(e,r,n,o)},e.prototype.getPoint=function(t){var e=this.attr(),r=e.x1,n=e.y1,o=e.x2,i=e.y2;return n_.pointAt(r,n,o,i,t)},e}(oP),hP={circle:function(t,e,r){return[["M",t-r,e],["A",r,r,0,1,0,t+r,e],["A",r,r,0,1,0,t-r,e]]},square:function(t,e,r){return[["M",t-r,e-r],["L",t+r,e-r],["L",t+r,e+r],["L",t-r,e+r],["Z"]]},diamond:function(t,e,r){return[["M",t-r,e],["L",t,e-r],["L",t+r,e],["L",t,e+r],["Z"]]},triangle:function(t,e,r){var n=r*Math.sin(1/3*Math.PI);return[["M",t-r,e+n],["L",t,e-n],["L",t+r,e+n],["Z"]]},"triangle-down":function(t,e,r){var n=r*Math.sin(1/3*Math.PI);return[["M",t-r,e-n],["L",t+r,e-n],["L",t,e+n],["Z"]]}},pP=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.initAttrs=function(t){this._resetParamsCache()},e.prototype._resetParamsCache=function(){this.set("paramsCache",{})},e.prototype.onAttrChange=function(e,r,n){t.prototype.onAttrChange.call(this,e,r,n),-1!==["symbol","x","y","r","radius"].indexOf(e)&&this._resetParamsCache()},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._getR=function(t){return(0,rg.isNil)(t.r)?t.radius:t.r},e.prototype._getPath=function(){var t,r,n=this.attr(),o=n.x,i=n.y,a=n.symbol||"circle",s=this._getR(n);if((0,rg.isFunction)(a))r=z_(r=(t=a)(o,i,s));else{if(!(t=e.Symbols[a]))return console.warn(a+" marker is not supported."),null;r=t(o,i,s)}return r},e.prototype.createPath=function(t){tP(this,t,{path:this._getPath()},this.get("paramsCache"))},e.Symbols=hP,e}(oP);function dP(t,e,r){var n=T_();return t.createPath(n),n.isPointInPath(e,r)}var yP=1e-6;function vP(t){return Math.abs(t)0!=vP(s[1]-r)>0&&vP(e-(r-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])<0&&(n=!n)}return n}function bP(t,e,r,n,o,i,a,s){var u=(Math.atan2(s-e,a-t)+2*Math.PI)%(2*Math.PI);if(uo)return!1;var l={x:t+r*Math.cos(u),y:e+r*Math.sin(u)};return EO(l.x,l.y,a,s)<=i/2}var wP=fg;var SP=(0,eg.__assign)({hasArc:function(t){for(var e=!1,r=t.length,n=0;n0&&n.push(o),{polygons:r,polylines:n}},isPointInStroke:function(t,e,r,n,o){for(var i=!1,a=e/2,s=0;sg?v:g,_=wP(null,[["t",-d,-y],["r",-w],["s",1/(v>g?1:v/g),1/(v>g?g/v:1)]]);jm.transformMat3(S,S,_),i=bP(0,0,x,m,b,e,S[0],S[1])}if(i)break}}return i}},a);function xP(t,e,r){for(var n=!1,o=0;o=n[0]&&t<=n[1]&&(e=(t-n[0])/(n[1]-n[0]),r=o)});var i=o[r];if((0,rg.isNil)(i)||(0,rg.isNil)(r))return null;var a=i.length,s=o[r+1];return v_.pointAt(i[a-2],i[a-1],s[1],s[2],s[3],s[4],s[5],s[6],e)},e.prototype._calculateCurve=function(){var t=this.attr().path;this.set("curve",SP.pathToCurve(t))},e.prototype._setTcache=function(){var t,e,r,n,o=0,i=0,a=[],s=this.get("curve");s&&((0,rg.each)(s,function(t,e){r=s[e+1],n=t.length,r&&(o+=v_.length(t[n-2],t[n-1],r[1],r[2],r[3],r[4],r[5],r[6])||0)}),this.set("totalLength",o),0!==o?((0,rg.each)(s,function(u,l){r=s[l+1],n=u.length,r&&((t=[])[0]=i/o,e=v_.length(u[n-2],u[n-1],r[1],r[2],r[3],r[4],r[5],r[6]),i+=e||0,t[1]=i/o,a.push(t))}),this.set("tCache",a)):this.set("tCache",[]))},e.prototype.getStartTangent=function(){var t,e=this.getSegments();if(e.length>1){var r=e[0].currentPoint,n=e[1].currentPoint,o=e[1].startTangent;t=[],o?(t.push([r[0]-o[0],r[1]-o[1]]),t.push([r[0],r[1]])):(t.push([n[0],n[1]]),t.push([r[0],r[1]]))}return t},e.prototype.getEndTangent=function(){var t,e=this.getSegments(),r=e.length;if(r>1){var n=e[r-2].currentPoint,o=e[r-1].currentPoint,i=e[r-1].endTangent;t=[],i?(t.push([o[0]-i[0],o[1]-i[1]]),t.push([o[0],o[1]])):(t.push([n[0],n[1]]),t.push([o[0],o[1]]))}return t},e}(oP);function EP(t,e,r,n,o){var i=t.length;if(i<2)return!1;for(var a=0;a=n[0]&&t<=n[1]&&(e=(t-n[0])/(n[1]-n[0]),r=o)}),n_.pointAt(n[r][0],n[r][1],n[r+1][0],n[r+1][1],e)},e.prototype._setTcache=function(){var t=this.attr().points;if(t&&0!==t.length){var e=this.getTotalLength();if(!(e<=0)){var r,n,o=0,i=[];(0,rg.each)(t,function(a,s){t[s+1]&&((r=[])[0]=o/e,n=n_.length(a[0],a[1],t[s+1][0],t[s+1][1]),o+=n,r[1]=o/e,i.push(r))}),this.set("tCache",i)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e},e.prototype.getEndTangent=function(){var t=this.attr().points,e=t.length-1,r=[];return r.push([t[e-1][0],t[e-1][1]]),r.push([t[e][0],t[e][1]]),r},e}(oP);var kP=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.isInStrokeOrPath=function(t,e,r,n,o){var i=this.attr(),a=i.x,s=i.y,u=i.width,l=i.height,c=i.radius;if(c){var f=!1;return r&&(f=function(t,e,r,n,o,i,a,s){return cP(t+o,e,t+r-o,e,i,a,s)||cP(t+r,e+o,t+r,e+n-o,i,a,s)||cP(t+r-o,e+n,t+o,e+n,i,a,s)||cP(t,e+n-o,t,e+o,i,a,s)||bP(t+r-o,e+o,o,1.5*Math.PI,2*Math.PI,i,a,s)||bP(t+r-o,e+n-o,o,0,.5*Math.PI,i,a,s)||bP(t+o,e+n-o,o,.5*Math.PI,Math.PI,i,a,s)||bP(t+o,e+o,o,Math.PI,1.5*Math.PI,i,a,s)}(a,s,u,l,c,o,t,e)),!f&&n&&(f=dP(this,t,e)),f}var h=o/2;return n&&r?OO(a-h,s-h,u+h,l+h,t,e):n?OO(a,s,u,l,t,e):r?function(t,e,r,n,o,i,a){var s=o/2;return OO(t-s,e-s,r,o,i,a)||OO(t+r-s,e-s,o,n,i,a)||OO(t+s,e+n-s,r,o,i,a)||OO(t-s,e+s,o,n,i,a)}(a,s,u,l,o,t,e):void 0},e.prototype.createPath=function(t){var e=this.attr(),r=e.x,n=e.y,o=e.width,i=e.height,a=e.radius;if(t.beginPath(),0===a)t.rect(r,n,o,i);else{var s=function(t){var e=0,r=0,n=0,o=0;return(0,rg.isArray)(t)?1===t.length?e=r=n=o=t[0]:2===t.length?(e=n=t[0],r=o=t[1]):3===t.length?(e=t[0],r=o=t[1],n=t[2]):(e=t[0],r=t[1],n=t[2],o=t[3]):e=r=n=o=t,[e,r,n,o]}(a),u=s[0],l=s[1],c=s[2],f=s[3];t.moveTo(r+u,n),t.lineTo(r+o-l,n),0!==l&&t.arc(r+o-l,n+l,l,-Math.PI/2,0),t.lineTo(r+o,n+i-c),0!==c&&t.arc(r+o-c,n+i-c,c,0,Math.PI/2),t.lineTo(r+f,n+i),0!==f&&t.arc(r+f,n+i-f,f,Math.PI/2,Math.PI),t.lineTo(r,n+u),0!==u&&t.arc(r+u,n+u,u,Math.PI,1.5*Math.PI),t.closePath()}},e}(oP),CP=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.isOnlyHitBox=function(){return!0},e.prototype.initAttrs=function(t){this._assembleFont(),t.text&&this._setText(t.text)},e.prototype._assembleFont=function(){var t=this.attrs;t.font=M_(t)},e.prototype._setText=function(t){var e=null;(0,rg.isString)(t)&&-1!==t.indexOf("\n")&&(e=t.split("\n")),this.set("textArr",e)},e.prototype.onAttrChange=function(e,r,n){t.prototype.onAttrChange.call(this,e,r,n),e.startsWith("font")&&this._assembleFont(),"text"===e&&this._setText(r)},e.prototype._getSpaceingY=function(){var t=this.attrs,e=t.lineHeight,r=1*t.fontSize;return e?e-r:.14*r},e.prototype._drawTextArr=function(t,e,r){var n,o=this.attrs,i=o.textBaseline,a=o.x,s=o.y,u=1*o.fontSize,l=this._getSpaceingY(),c=A_(o.text,o.fontSize,o.lineHeight);(0,rg.each)(e,function(e,o){n=s+o*(l+u)-c+u,"middle"===i&&(n+=c-u-(c-u)/2),"top"===i&&(n+=c-u),(0,rg.isNil)(e)||(r?t.fillText(e,a,n):t.strokeText(e,a,n))})},e.prototype._drawText=function(t,e){var r=this.attr(),n=r.x,o=r.y,i=this.get("textArr");if(i)this._drawTextArr(t,i,e);else{var a=r.text;(0,rg.isNil)(a)||(e?t.fillText(a,n,o):t.strokeText(a,n,o))}},e.prototype.strokeAndFill=function(t){var e=this.attrs,r=e.lineWidth,n=e.opacity,o=e.strokeOpacity,i=e.fillOpacity;this.isStroke()&&r>0&&((0,rg.isNil)(o)||1===o||(t.globalAlpha=n),this.stroke(t)),this.isFill()&&((0,rg.isNil)(i)||1===i?this.fill(t):(t.globalAlpha=i,this.fill(t),t.globalAlpha=n)),this.afterDrawPath(t)},e.prototype.fill=function(t){this._drawText(t,!0)},e.prototype.stroke=function(t){this._drawText(t,!1)},e}(oP);function TP(t,e,r){var n,o,i=t.getTotalMatrix();if(i){var a=(n=[e,r,1],(o=i)?Uw(zw(o),n):n);return[a[0],a[1]]}return[e,r]}function AP(t,e,r){if(t.isCanvas&&t.isCanvas())return!0;if(!Ow(t)||!1===t.cfg.isInView)return!1;if(t.cfg.clipShape){var n=TP(t,e,r),o=n[0],i=n[1];if(t.isClipped(o,i))return!1}var a=t.cfg.cacheCanvasBBox||t.getCanvasBBox();return e>=a.minX&&e<=a.maxX&&r>=a.minY&&r<=a.maxY}var MP=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,eg.__extends)(e,t),e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.renderer="canvas",e.autoDraw=!0,e.localRefresh=!0,e.refreshElements=[],e.clipView=!0,e.quickHit=!1,e},e.prototype.onCanvasChange=function(t){"attr"!==t&&"sort"!==t&&"changeSize"!==t||(this.set("refreshElements",[this]),this.draw())},e.prototype.getShapeBase=function(){return h},e.prototype.getGroupBase=function(){return nP},e.prototype.getPixelRatio=function(){var t=this.get("pixelRatio")||(window?window.devicePixelRatio:1);return t>=1?Math.ceil(t):1},e.prototype.getViewRange=function(){return{minX:0,minY:0,maxX:this.cfg.width,maxY:this.cfg.height}},e.prototype.createDom=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return this.set("context",e),t},e.prototype.setDOMSize=function(e,r){t.prototype.setDOMSize.call(this,e,r);var n=this.get("context"),o=this.get("el"),i=this.getPixelRatio();o.width=i*e,o.height=i*r,i>1&&n.scale(i,i)},e.prototype.clear=function(){t.prototype.clear.call(this),this._clearFrame();var e=this.get("context"),r=this.get("el");e.clearRect(0,0,r.width,r.height)},e.prototype.getShape=function(e,r){return this.get("quickHit")?function t(e,r,n){if(!AP(e,r,n))return null;for(var o=null,i=e.getChildren(),a=i.length-1;a>=0;a--){var s=i[a];if(s.isGroup())o=t(s,r,n);else if(AP(s,r,n)){var u=s,l=TP(s,r,n),c=l[0],f=l[1];u.isInShape(c,f)&&(o=s)}if(o)break}return o}(this,e,r):t.prototype.getShape.call(this,e,r,null)},e.prototype._getRefreshRegion=function(){var t,e=this.get("refreshElements"),r=this.getViewRange();e.length&&e[0]===this?t=r:(t=function(t){if(!t.length)return null;var e=[],r=[],n=[],o=[];return(0,rg.each)(t,function(t){var i=rP(t);i&&(e.push(i.minX),r.push(i.minY),n.push(i.maxX),o.push(i.maxY))}),{minX:(0,rg.min)(e),minY:(0,rg.min)(r),maxX:(0,rg.max)(n),maxY:(0,rg.max)(o)}}(e))&&(t.minX=Math.floor(t.minX),t.minY=Math.floor(t.minY),t.maxX=Math.ceil(t.maxX),t.maxY=Math.ceil(t.maxY),t.maxY+=1,this.get("clipView")&&(t=function(t,e){return t&&e&&PO(t,e)?{minX:Math.max(t.minX,e.minX),minY:Math.max(t.minY,e.minY),maxX:Math.min(t.maxX,e.maxX),maxY:Math.min(t.maxY,e.maxY)}:null}(t,r)));return t},e.prototype.refreshElement=function(t){this.get("refreshElements").push(t)},e.prototype._clearFrame=function(){var t=this.get("drawFrame");t&&((0,rg.clearAnimationFrame)(t),this.set("drawFrame",null),this.set("refreshElements",[]))},e.prototype.draw=function(){var t=this.get("drawFrame");this.get("autoDraw")&&t||this._startDraw()},e.prototype._drawAll=function(){var t=this.get("context"),e=this.get("el"),r=this.getChildren();t.clearRect(0,0,e.width,e.height),JO(t,this),KO(t,r),this.set("refreshElements",[])},e.prototype._drawRegion=function(){var t=this.get("context"),e=this.get("refreshElements"),r=this.getChildren(),n=this._getRefreshRegion();n?(t.clearRect(n.minX,n.minY,n.maxX-n.minX,n.maxY-n.minY),t.save(),t.beginPath(),t.rect(n.minX,n.minY,n.maxX-n.minX,n.maxY-n.minY),t.clip(),JO(t,this),QO(this,r,n),KO(t,r,n),t.restore()):e.length&&function t(e){for(var r=0;re)r.insertBefore(t,o);else if(i0&&(e?"stroke"in r?this._setColor(t,"stroke",i):"strokeStyle"in r&&this._setColor(t,"stroke",a):this._setColor(t,"stroke",i||a),u&&c.setAttribute(IP.strokeOpacity,u),l&&c.setAttribute(IP.lineWidth,l))},e.prototype._setColor=function(t,e,r){var n=this.get("el");if(r)if(r=r.trim(),/^[r,R,L,l]{1}[\s]*\(/.test(r))(o=t.find("gradient",r))||(o=t.addGradient(r)),n.setAttribute(IP[e],"url(#"+o+")");else if(/^[p,P]{1}[\s]*\(/.test(r)){var o;(o=t.find("pattern",r))||(o=t.addPattern(r)),n.setAttribute(IP[e],"url(#"+o+")")}else n.setAttribute(IP[e],r);else n.setAttribute(IP[e],"none")},e.prototype.shadow=function(t,e){var r=this.attr(),n=e||r,o=n.shadowOffsetX,i=n.shadowOffsetY,a=n.shadowBlur,s=n.shadowColor;(o||i||a||s)&&function(t,e){var r=t.cfg.el,n=t.attr(),o={dx:n.shadowOffsetX,dy:n.shadowOffsetY,blur:n.shadowBlur,color:n.shadowColor};if(o.dx||o.dy||o.blur||o.color){var i=e.find("filter",o);i||(i=e.addShadow(o)),r.setAttribute("filter","url(#"+i+")")}else r.removeAttribute("filter")}(this,t)},e.prototype.transform=function(t){var e=this.attr();(t||e).matrix&&DP(this)},e.prototype.isInShape=function(t,e){return this.isPointInPath(t,e)},e.prototype.isPointInPath=function(t,e){var r=this.get("el"),n=this.get("canvas").get("el").getBoundingClientRect(),o=t+n.left,i=e+n.top,a=document.elementFromPoint(o,i);return!(!a||!a.isEqualNode(r))},e.prototype.getHitLineWidth=function(){var t=this.attrs,e=t.lineWidth,r=t.lineAppendWidth;return this.isStroke()?e+r:0},e}(Yx),VP=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="circle",e.canFill=!0,e.canStroke=!0,e}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x:0,y:0,r:0})},e.prototype.createPath=function(t,e){var r=this.attr(),n=this.get("el");(0,rg.each)(e||r,function(t,e){"x"===e||"y"===e?n.setAttribute("c"+e,t):IP[e]&&n.setAttribute(IP[e],t)})},e}(zP),HP=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="dom",e.canFill=!1,e.canStroke=!1,e}return(0,eg.__extends)(e,t),e.prototype.createPath=function(t,e){var r=this.attr(),n=this.get("el");if((0,rg.each)(e||r,function(t,e){IP[e]&&n.setAttribute(IP[e],t)}),"function"==typeof r.html){var o=r.html.call(this,r);if(o instanceof Element||o instanceof HTMLDocument){for(var i=n.childNodes,a=i.length-1;a>=0;a--)n.removeChild(i[a]);n.appendChild(o)}else n.innerHTML=o}else n.innerHTML=r.html},e}(zP),qP=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="ellipse",e.canFill=!0,e.canStroke=!0,e}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x:0,y:0,rx:0,ry:0})},e.prototype.createPath=function(t,e){var r=this.attr(),n=this.get("el");(0,rg.each)(e||r,function(t,e){"x"===e||"y"===e?n.setAttribute("c"+e,t):IP[e]&&n.setAttribute(IP[e],t)})},e}(zP),WP=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="image",e.canFill=!1,e.canStroke=!1,e}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x:0,y:0,width:0,height:0})},e.prototype.createPath=function(t,e){var r=this,n=this.attr(),o=this.get("el");(0,rg.each)(e||n,function(t,e){"img"===e?r._setImage(n.img):IP[e]&&o.setAttribute(IP[e],t)})},e.prototype.setAttr=function(t,e){this.attrs[t]=e,"img"===t&&this._setImage(e)},e.prototype._setImage=function(t){var e=this.attr(),r=this.get("el");if((0,rg.isString)(t))r.setAttribute("href",t);else if(t instanceof window.Image)e.width||(r.setAttribute("width",t.width),this.attr("width",t.width)),e.height||(r.setAttribute("height",t.height),this.attr("height",t.height)),r.setAttribute("href",t.src);else if(t instanceof HTMLElement&&(0,rg.isString)(t.nodeName)&&"CANVAS"===t.nodeName.toUpperCase())r.setAttribute("href",t.toDataURL());else if(t instanceof ImageData){var n=document.createElement("canvas");n.setAttribute("width",""+t.width),n.setAttribute("height",""+t.height),n.getContext("2d").putImageData(t,0,0),e.width||(r.setAttribute("width",""+t.width),this.attr("width",t.width)),e.height||(r.setAttribute("height",""+t.height),this.attr("height",t.height)),r.setAttribute("href",n.toDataURL())}},e}(zP),YP=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="line",e.canFill=!1,e.canStroke=!0,e}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,e){var r=this.attr(),n=this.get("el");(0,rg.each)(e||r,function(e,o){if("startArrow"===o||"endArrow"===o)if(e){var i=(0,rg.isObject)(e)?t.addArrow(r,IP[o]):t.getDefaultArrow(r,IP[o]);n.setAttribute(IP[o],"url(#"+i+")")}else n.removeAttribute(IP[o]);else IP[o]&&n.setAttribute(IP[o],e)})},e.prototype.getTotalLength=function(){var t=this.attr(),e=t.x1,r=t.y1,n=t.x2,o=t.y2;return n_.length(e,r,n,o)},e.prototype.getPoint=function(t){var e=this.attr(),r=e.x1,n=e.y1,o=e.x2,i=e.y2;return n_.pointAt(r,n,o,i,t)},e}(zP),XP={circle:function(t,e,r){return[["M",t,e],["m",-r,0],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,2*-r,0]]},square:function(t,e,r){return[["M",t-r,e-r],["L",t+r,e-r],["L",t+r,e+r],["L",t-r,e+r],["Z"]]},diamond:function(t,e,r){return[["M",t-r,e],["L",t,e-r],["L",t+r,e],["L",t,e+r],["Z"]]},triangle:function(t,e,r){var n=r*Math.sin(1/3*Math.PI);return[["M",t-r,e+n],["L",t,e-n],["L",t+r,e+n],["z"]]},triangleDown:function(t,e,r){var n=r*Math.sin(1/3*Math.PI);return[["M",t-r,e-n],["L",t+r,e-n],["L",t,e+n],["Z"]]}},JP={get:function(t){return XP[t]},register:function(t,e){XP[t]=e},remove:function(t){delete XP[t]},getAll:function(){return XP}},KP=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="marker",e.canFill=!0,e.canStroke=!0,e}return(0,eg.__extends)(e,t),e.prototype.createPath=function(t){this.get("el").setAttribute("d",this._assembleMarker())},e.prototype._assembleMarker=function(){var t=this._getPath();return(0,rg.isArray)(t)?t.map(function(t){return t.join(" ")}).join(""):t},e.prototype._getPath=function(){var t,e=this.attr(),r=e.x,n=e.y,o=e.r||e.radius,i=e.symbol||"circle";return(t=(0,rg.isFunction)(i)?i:JP.get(i))?t(r,n,o):(console.warn(t+" symbol is not exist."),null)},e.symbolsFactory=JP,e}(zP),QP=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="path",e.canFill=!0,e.canStroke=!0,e}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,e){var r=this,n=this.attr(),o=this.get("el");(0,rg.each)(e||n,function(e,i){if("path"===i&&(0,rg.isArray)(e))o.setAttribute("d",r._formatPath(e));else if("startArrow"===i||"endArrow"===i)if(e){var a=(0,rg.isObject)(e)?t.addArrow(n,IP[i]):t.getDefaultArrow(n,IP[i]);o.setAttribute(IP[i],"url(#"+a+")")}else o.removeAttribute(IP[i]);else IP[i]&&o.setAttribute(IP[i],e)})},e.prototype._formatPath=function(t){var e=t.map(function(t){return t.join(" ")}).join("");return~e.indexOf("NaN")?"":e},e.prototype.getTotalLength=function(){var t=this.get("el");return t?t.getTotalLength():null},e.prototype.getPoint=function(t){var e=this.get("el"),r=this.getTotalLength();if(0===r)return null;var n=e?e.getPointAtLength(t*r):null;return n?{x:n.x,y:n.y}:null},e}(zP),ZP=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="polygon",e.canFill=!0,e.canStroke=!0,e}return(0,eg.__extends)(e,t),e.prototype.createPath=function(t,e){var r=this.attr(),n=this.get("el");(0,rg.each)(e||r,function(t,e){"points"===e&&(0,rg.isArray)(t)&&t.length>=2?n.setAttribute("points",t.map(function(t){return t[0]+","+t[1]}).join(" ")):IP[e]&&n.setAttribute(IP[e],t)})},e}(zP),$P=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="polyline",e.canFill=!0,e.canStroke=!0,e}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{startArrow:!1,endArrow:!1})},e.prototype.onAttrChange=function(e,r,n){t.prototype.onAttrChange.call(this,e,r,n),-1!==["points"].indexOf(e)&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.createPath=function(t,e){var r=this.attr(),n=this.get("el");(0,rg.each)(e||r,function(t,e){"points"===e&&(0,rg.isArray)(t)&&t.length>=2?n.setAttribute("points",t.map(function(t){return t[0]+","+t[1]}).join(" ")):IP[e]&&n.setAttribute(IP[e],t)})},e.prototype.getTotalLength=function(){var t=this.attr().points,e=this.get("totalLength");return(0,rg.isNil)(e)?(this.set("totalLength",O_(t)),this.get("totalLength")):e},e.prototype.getPoint=function(t){var e,r,n=this.attr().points,o=this.get("tCache");return o||(this._setTcache(),o=this.get("tCache")),(0,rg.each)(o,function(n,o){t>=n[0]&&t<=n[1]&&(e=(t-n[0])/(n[1]-n[0]),r=o)}),n_.pointAt(n[r][0],n[r][1],n[r+1][0],n[r+1][1],e)},e.prototype._setTcache=function(){var t=this.attr().points;if(t&&0!==t.length){var e=this.getTotalLength();if(!(e<=0)){var r,n,o=0,i=[];(0,rg.each)(t,function(a,s){t[s+1]&&((r=[])[0]=o/e,n=n_.length(a[0],a[1],t[s+1][0],t[s+1][1]),o+=n,r[1]=o/e,i.push(r))}),this.set("tCache",i)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e},e.prototype.getEndTangent=function(){var t=this.attr().points,e=t.length-1,r=[];return r.push([t[e-1][0],t[e-1][1]]),r.push([t[e][0],t[e][1]]),r},e}(zP);var tk=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="rect",e.canFill=!0,e.canStroke=!0,e}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.createPath=function(t,e){var r=this,n=this.attr(),o=this.get("el"),i=!1,a=["x","y","width","height","radius"];(0,rg.each)(e||n,function(t,e){-1===a.indexOf(e)||i?-1===a.indexOf(e)&&IP[e]&&o.setAttribute(IP[e],t):(o.setAttribute("d",r._assembleRect(n)),i=!0)})},e.prototype._assembleRect=function(t){var e=t.x,r=t.y,n=t.width,o=t.height,i=t.radius;if(!i)return"M "+e+","+r+" l "+n+",0 l 0,"+o+" l"+-n+" 0 z";var a=function(t){var e=0,r=0,n=0,o=0;return(0,rg.isArray)(t)?1===t.length?e=r=n=o=t[0]:2===t.length?(e=n=t[0],r=o=t[1]):3===t.length?(e=t[0],r=o=t[1],n=t[2]):(e=t[0],r=t[1],n=t[2],o=t[3]):e=r=n=o=t,{r1:e,r2:r,r3:n,r4:o}}(i);return(0,rg.isArray)(i)?1===i.length?a.r1=a.r2=a.r3=a.r4=i[0]:2===i.length?(a.r1=a.r3=i[0],a.r2=a.r4=i[1]):3===i.length?(a.r1=i[0],a.r2=a.r4=i[1],a.r3=i[2]):(a.r1=i[0],a.r2=i[1],a.r3=i[2],a.r4=i[3]):a.r1=a.r2=a.r3=a.r4=i,[["M "+(e+a.r1)+","+r],["l "+(n-a.r1-a.r2)+",0"],["a "+a.r2+","+a.r2+",0,0,1,"+a.r2+","+a.r2],["l 0,"+(o-a.r2-a.r3)],["a "+a.r3+","+a.r3+",0,0,1,"+-a.r3+","+a.r3],["l "+(a.r3+a.r4-n)+",0"],["a "+a.r4+","+a.r4+",0,0,1,"+-a.r4+","+-a.r4],["l 0,"+(a.r4+a.r1-o)],["a "+a.r1+","+a.r1+",0,0,1,"+a.r1+","+-a.r1],["z"]].join(" ")},e}(zP),ek={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"baseline",hanging:"hanging"},rk={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",hanging:"hanging"},nk={left:"left",start:"left",center:"middle",right:"end",end:"end"},ok=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="text",e.canFill=!0,e.canStroke=!0,e}return(0,eg.__extends)(e,t),e.prototype.getDefaultAttrs=function(){var e=t.prototype.getDefaultAttrs.call(this);return(0,eg.__assign)((0,eg.__assign)({},e),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.createPath=function(t,e){var r=this,n=this.attr(),o=this.get("el");this._setFont(),(0,rg.each)(e||n,function(t,e){"text"===e?r._setText(""+t):"matrix"===e&&t?DP(r):IP[e]&&o.setAttribute(IP[e],t)}),o.setAttribute("paint-order","stroke"),o.setAttribute("style","stroke-linecap:butt; stroke-linejoin:miter;")},e.prototype._setFont=function(){var t=this.get("el"),e=this.attr(),r=e.textBaseline,n=e.textAlign,o=Dw();o&&"firefox"===o.name?t.setAttribute("dominant-baseline",rk[r]||"alphabetic"):t.setAttribute("alignment-baseline",ek[r]||"baseline"),t.setAttribute("text-anchor",nk[n]||"left")},e.prototype._setText=function(t){var e=this.get("el"),r=this.attr(),n=r.x,o=r.textBaseline,i=void 0===o?"bottom":o;if(t)if(~t.indexOf("\n")){var a=t.split("\n"),s=a.length-1,u="";(0,rg.each)(a,function(t,e){0===e?"alphabetic"===i?u+=''+t+"":"top"===i?u+=''+t+"":"middle"===i?u+=''+t+"":"bottom"===i?u+=''+t+"":"hanging"===i&&(u+=''+t+""):u+=''+t+""}),e.innerHTML=u}else e.innerHTML=t;else e.innerHTML=""},e}(zP),ik=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,ak=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,sk=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function uk(t){var e=t.match(sk);if(!e)return"";var r="";return e.sort(function(t,e){return t=t.split(":"),e=e.split(":"),Number(t[0])-Number(e[0])}),(0,rg.each)(e,function(t){t=t.split(":"),r+=''}),r}var lk,ck,fk,hk,pk=function(){function t(t){this.cfg={};var e,r,n,o,i,a,s,u=null,l=(0,rg.uniqueId)("gradient_");return"l"===t.toLowerCase()[0]?function(t,e){var r,n,o=ik.exec(t),i=(0,rg.mod)((0,rg.toRadian)(parseFloat(o[1])),2*Math.PI),a=o[2];i>=0&&i<.5*Math.PI?(r={x:0,y:0},n={x:1,y:1}):.5*Math.PI<=i&&i';e.innerHTML=r},t}(),gk=function(){function t(t,e){this.cfg={};var r=NP("marker"),n=(0,rg.uniqueId)("marker_");r.setAttribute("id",n);var o=NP("path");o.setAttribute("stroke",t.stroke||"none"),o.setAttribute("fill",t.fill||"none"),r.appendChild(o),r.setAttribute("overflow","visible"),r.setAttribute("orient","auto-start-reverse"),this.el=r,this.child=o,this.id=n;var i=t["marker-start"===e?"startArrow":"endArrow"];return this.stroke=t.stroke||"#000",!0===i?this._setDefaultPath(e,o):(this.cfg=i,this._setMarker(t.lineWidth,o)),this}return t.prototype.match=function(){return!1},t.prototype._setDefaultPath=function(t,e){var r=this.el;e.setAttribute("d","M0,0 L"+10*Math.cos(Math.PI/6)+",5 L0,10"),r.setAttribute("refX",""+10*Math.cos(Math.PI/6)),r.setAttribute("refY","5")},t.prototype._setMarker=function(t,e){var r=this.el,n=this.cfg.path,o=this.cfg.d;(0,rg.isArray)(n)&&(n=n.map(function(t){return t.join(" ")}).join("")),e.setAttribute("d",n),r.appendChild(e),o&&r.setAttribute("refX",""+o/t)},t.prototype.update=function(t){var e=this.child;e.attr?e.attr("fill",t):e.setAttribute("fill",t)},t}(),mk=function(){function t(t){this.type="clip",this.cfg={};var e=NP("clipPath");this.el=e,this.id=(0,rg.uniqueId)("clip_"),e.id=this.id;var r=t.cfg.el;return e.appendChild(r),this.cfg=t,this}return t.prototype.match=function(){return!1},t.prototype.remove=function(){var t=this.el;t.parentNode.removeChild(t)},t}(),bk=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,wk=function(){function t(t){this.cfg={};var e=NP("pattern");e.setAttribute("patternUnits","userSpaceOnUse");var r=NP("image");e.appendChild(r);var n=(0,rg.uniqueId)("pattern_");e.id=n,this.el=e,this.id=n,this.cfg=t;var o=bk.exec(t)[2];r.setAttribute("href",o);var i=new Image;function a(){e.setAttribute("width",""+i.width),e.setAttribute("height",""+i.height)}return o.match(/^data:/i)||(i.crossOrigin="Anonymous"),i.src=o,i.complete?a():(i.onload=a,i.src=i.src),this}return t.prototype.match=function(t,e){return this.cfg===e},t}(),Sk=function(){function t(t){var e=NP("defs"),r=(0,rg.uniqueId)("defs_");e.id=r,t.appendChild(e),this.children=[],this.defaultArrow={},this.el=e,this.canvas=t}return t.prototype.find=function(t,e){for(var r=this.children,n=null,o=0;o]*>/,hk={tr:document.createElement("tbody"),tbody:lk,thead:lk,tfoot:lk,td:ck,th:ck,"*":document.createElement("div")});var e=fk.test(t)&&RegExp.$1;e&&e in hk||(e="*");var r=hk[e];t="string"==typeof t?t.replace(/(^\s*)|(\s*$)/g,""):t,r.innerHTML=""+t;var n=r.childNodes[0];return n&&r.contains(n)&&r.removeChild(n),n}var Ek=r(2630),Ok=r.n(Ek);function Pk(t){"@babel/helpers - typeof";return(Pk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var kk=/^\s+/,Ck=/\s+$/;function Tk(t,e){if(t=t||"",e=e||{},t instanceof Tk)return t;if(!(this instanceof Tk))return new Tk(t,e);var r=function(t){var e={r:0,g:0,b:0},r=1,n=null,o=null,i=null,a=!1,s=!1;"string"==typeof t&&(t=function(t){t=t.replace(kk,"").replace(Ck,"").toLowerCase();var e,r=!1;if(Wk[t])t=Wk[t],r=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(e=iC.rgb.exec(t))return{r:e[1],g:e[2],b:e[3]};if(e=iC.rgba.exec(t))return{r:e[1],g:e[2],b:e[3],a:e[4]};if(e=iC.hsl.exec(t))return{h:e[1],s:e[2],l:e[3]};if(e=iC.hsla.exec(t))return{h:e[1],s:e[2],l:e[3],a:e[4]};if(e=iC.hsv.exec(t))return{h:e[1],s:e[2],v:e[3]};if(e=iC.hsva.exec(t))return{h:e[1],s:e[2],v:e[3],a:e[4]};if(e=iC.hex8.exec(t))return{r:Qk(e[1]),g:Qk(e[2]),b:Qk(e[3]),a:eC(e[4]),format:r?"name":"hex8"};if(e=iC.hex6.exec(t))return{r:Qk(e[1]),g:Qk(e[2]),b:Qk(e[3]),format:r?"name":"hex"};if(e=iC.hex4.exec(t))return{r:Qk(e[1]+""+e[1]),g:Qk(e[2]+""+e[2]),b:Qk(e[3]+""+e[3]),a:eC(e[4]+""+e[4]),format:r?"name":"hex8"};if(e=iC.hex3.exec(t))return{r:Qk(e[1]+""+e[1]),g:Qk(e[2]+""+e[2]),b:Qk(e[3]+""+e[3]),format:r?"name":"hex"};return!1}(t));"object"==Pk(t)&&(aC(t.r)&&aC(t.g)&&aC(t.b)?(u=t.r,l=t.g,c=t.b,e={r:255*Jk(u,255),g:255*Jk(l,255),b:255*Jk(c,255)},a=!0,s="%"===String(t.r).substr(-1)?"prgb":"rgb"):aC(t.h)&&aC(t.s)&&aC(t.v)?(n=$k(t.s),o=$k(t.v),e=function(t,e,r){t=6*Jk(t,360),e=Jk(e,100),r=Jk(r,100);var n=Math.floor(t),o=t-n,i=r*(1-e),a=r*(1-o*e),s=r*(1-(1-o)*e),u=n%6;return{r:255*[r,a,i,i,s,r][u],g:255*[s,r,r,a,i,i][u],b:255*[i,i,s,r,r,a][u]}}(t.h,n,o),a=!0,s="hsv"):aC(t.h)&&aC(t.s)&&aC(t.l)&&(n=$k(t.s),i=$k(t.l),e=function(t,e,r){var n,o,i;function a(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=Jk(t,360),e=Jk(e,100),r=Jk(r,100),0===e)n=o=i=r;else{var s=r<.5?r*(1+e):r+e-r*e,u=2*r-s;n=a(u,s,t+1/3),o=a(u,s,t),i=a(u,s,t-1/3)}return{r:255*n,g:255*o,b:255*i}}(t.h,n,i),a=!0,s="hsl"),t.hasOwnProperty("a")&&(r=t.a));var u,l,c;return r=Xk(r),{ok:a,format:t.format||s,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:r}}(t);this._originalInput=t,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||r.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}function Ak(t,e,r){t=Jk(t,255),e=Jk(e,255),r=Jk(r,255);var n,o,i=Math.max(t,e,r),a=Math.min(t,e,r),s=(i+a)/2;if(i==a)n=o=0;else{var u=i-a;switch(o=s>.5?u/(2-i-a):u/(i+a),i){case t:n=(e-r)/u+(e>1)+720)%360;--e;)n.h=(n.h+o)%360,i.push(Tk(n));return i}function qk(t,e){e=e||6;for(var r=Tk(t).toHsv(),n=r.h,o=r.s,i=r.v,a=[],s=1/e;e--;)a.push(Tk({h:n,s:o,v:i})),i=(i+s)%1;return a}Tk.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,n=this.toRgb();return t=n.r/255,e=n.g/255,r=n.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},setAlpha:function(t){return this._a=Xk(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=Mk(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=Mk(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),n=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=Ak(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=Ak(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),n=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return jk(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,n,o){var i=[Zk(Math.round(t).toString(16)),Zk(Math.round(e).toString(16)),Zk(Math.round(r).toString(16)),Zk(tC(n))];if(o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1))return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0);return i.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*Jk(this._r,255))+"%",g:Math.round(100*Jk(this._g,255))+"%",b:Math.round(100*Jk(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*Jk(this._r,255))+"%, "+Math.round(100*Jk(this._g,255))+"%, "+Math.round(100*Jk(this._b,255))+"%)":"rgba("+Math.round(100*Jk(this._r,255))+"%, "+Math.round(100*Jk(this._g,255))+"%, "+Math.round(100*Jk(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Yk[jk(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+Ik(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var o=Tk(t);r="#"+Ik(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return Tk(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(Dk,arguments)},brighten:function(){return this._applyModification(Bk,arguments)},darken:function(){return this._applyModification(Fk,arguments)},desaturate:function(){return this._applyModification(Nk,arguments)},saturate:function(){return this._applyModification(Lk,arguments)},greyscale:function(){return this._applyModification(Rk,arguments)},spin:function(){return this._applyModification(Gk,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(Hk,arguments)},complement:function(){return this._applyCombination(Uk,arguments)},monochromatic:function(){return this._applyCombination(qk,arguments)},splitcomplement:function(){return this._applyCombination(Vk,arguments)},triad:function(){return this._applyCombination(zk,[3])},tetrad:function(){return this._applyCombination(zk,[4])}},Tk.fromRatio=function(t,e){if("object"==Pk(t)){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:$k(t[n]));t=r}return Tk(t,e)},Tk.equals=function(t,e){return!(!t||!e)&&Tk(t).toRgbString()==Tk(e).toRgbString()},Tk.random=function(){return Tk.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},Tk.mix=function(t,e,r){r=0===r?0:r||50;var n=Tk(t).toRgb(),o=Tk(e).toRgb(),i=r/100;return Tk({r:(o.r-n.r)*i+n.r,g:(o.g-n.g)*i+n.g,b:(o.b-n.b)*i+n.b,a:(o.a-n.a)*i+n.a})},Tk.readability=function(t,e){var r=Tk(t),n=Tk(e);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)},Tk.isReadable=function(t,e,r){var n,o,i=Tk.readability(t,e);switch(o=!1,(n=function(t){var e,r;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==r&&"large"!==r&&(r="small");return{level:e,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7}return o},Tk.mostReadable=function(t,e,r){var n,o,i,a,s=null,u=0;o=(r=r||{}).includeFallbackColors,i=r.level,a=r.size;for(var l=0;lu&&(u=n,s=Tk(e[l]));return Tk.isReadable(t,s,{level:i,size:a})||!o?s:(r.includeFallbackColors=!1,Tk.mostReadable(t,["#fff","#000"],r))};var Wk=Tk.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Yk=Tk.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(Wk);function Xk(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Jk(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var r=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Kk(t){return Math.min(1,Math.max(0,t))}function Qk(t){return parseInt(t,16)}function Zk(t){return 1==t.length?"0"+t:""+t}function $k(t){return t<=1&&(t=100*t+"%"),t}function tC(t){return Math.round(255*parseFloat(t)).toString(16)}function eC(t){return Qk(t)/255}var rC,nC,oC,iC=(nC="[\\s|\\(]+("+(rC="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+rC+")[,|\\s]+("+rC+")\\s*\\)?",oC="[\\s|\\(]+("+rC+")[,|\\s]+("+rC+")[,|\\s]+("+rC+")[,|\\s]+("+rC+")\\s*\\)?",{CSS_UNIT:new RegExp(rC),rgb:new RegExp("rgb"+nC),rgba:new RegExp("rgba"+oC),hsl:new RegExp("hsl"+nC),hsla:new RegExp("hsla"+oC),hsv:new RegExp("hsv"+nC),hsva:new RegExp("hsva"+oC),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function aC(t){return!!iC.CSS_UNIT.exec(t)}var sC=2,uC=.16,lC=.05,cC=.05,fC=.15,hC=5,pC=4,dC=[{index:7,opacity:.15},{index:6,opacity:.25},{index:5,opacity:.3},{index:5,opacity:.45},{index:5,opacity:.65},{index:5,opacity:.85},{index:4,opacity:.9},{index:3,opacity:.95},{index:2,opacity:.97},{index:1,opacity:.98}];function yC(t,e,r){var n;return(n=Math.round(t.h)>=60&&Math.round(t.h)<=240?r?Math.round(t.h)-sC*e:Math.round(t.h)+sC*e:r?Math.round(t.h)+sC*e:Math.round(t.h)-sC*e)<0?n+=360:n>=360&&(n-=360),n}function vC(t,e,r){return 0===t.h&&0===t.s?t.s:((n=r?t.s-uC*e:e===pC?t.s+uC:t.s+lC*e)>1&&(n=1),r&&e===hC&&n>.1&&(n=.1),n<.06&&(n=.06),Number(n.toFixed(2)));var n}function gC(t,e,r){var n;return(n=r?t.v+cC*e:t.v-fC*e)>1&&(n=1),Number(n.toFixed(2))}function mC(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[],n=Tk(t),o=hC;o>0;o-=1){var i=n.toHsv(),a=Tk({h:yC(i,o,!0),s:vC(i,o,!0),v:gC(i,o,!0)}).toHexString();r.push(a)}r.push(n.toHexString());for(var s=1;s<=pC;s+=1){var u=n.toHsv(),l=Tk({h:yC(u,s),s:vC(u,s),v:gC(u,s)}).toHexString();r.push(l)}return"dark"===e.theme?dC.map(function(t){var n=t.index,o=t.opacity;return Tk.mix(e.backgroundColor||"#141414",r[n],100*o).toHexString()}):r}var bC={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},wC={},SC={};Object.keys(bC).forEach(function(t){wC[t]=mC(bC[t]),wC[t].primary=wC[t][5],SC[t]=mC(bC[t],{theme:"dark",backgroundColor:"#141414"}),SC[t].primary=SC[t][5]});wC.red,wC.volcano,wC.gold,wC.orange,wC.yellow,wC.lime,wC.green,wC.cyan,wC.blue,wC.geekblue,wC.purple,wC.magenta,wC.grey;var xC=function(t,e,r){var n=Ok()(t),o=Ok()(e);return Ok()([(1-r)*n.red()+r*o.red(),(1-r)*n.green()+r*o.green(),(1-r)*n.blue()+r*o.blue()]).rgb()},_C=function(t,e,r,n){return void 0===e&&(e="#fff"),void 0===r&&(r="default"),void 0===n&&(n="rgb(150, 150, 150)"),"default"===r?function(t,e,r){void 0===e&&(e="#fff"),void 0===r&&(r="rgb(150, 150, 150)");var n=xC(e,t,.05).rgb().toString(),o=xC(e,t,.1).rgb().toString(),i=xC(e,t,.2).rgb().toString(),a=xC(e,t,.4).rgb().toString(),s=xC(e,r,.02).rgb().toString(),u=xC(e,r,.05).rgb().toString(),l=xC(e,r,.1).rgb().toString(),c=xC(e,r,.2).rgb().toString(),f=xC(e,r,.3).rgb().toString(),h=mC(t,{theme:"default",backgroundColor:e}),p=Ok()(t).hex().toLowerCase(),d=h.indexOf(p),y=t;return-1!==d&&(y=h[d+1]),{mainStroke:t,mainFill:o,activeStroke:t,activeFill:n,inactiveStroke:a,inactiveFill:n,selectedStroke:t,selectedFill:e,highlightStroke:y,highlightFill:i,disableStroke:f,disableFill:u,edgeMainStroke:f,edgeActiveStroke:t,edgeInactiveStroke:c,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:l,comboMainStroke:f,comboMainFill:s,comboActiveStroke:t,comboActiveFill:n,comboInactiveStroke:f,comboInactiveFill:s,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:y,comboHighlightFill:s,comboDisableStroke:c,comboDisableFill:u}}(t,e,"rgb(150, 150, 150)"):function(t,e,r){void 0===e&&(e="#fff"),void 0===r&&(r="#777");var n=xC(e,t,.2).rgb().toString(),o=xC(e,t,.3).rgb().toString(),i=xC(e,t,.6).rgb().toString(),a=xC(e,t,.8).rgb().toString(),s=xC(e,r,.2).rgb().toString(),u=xC(e,r,.25).rgb().toString(),l=xC(e,r,.3).rgb().toString(),c=xC(e,r,.4).rgb().toString(),f=xC(e,r,.5).rgb().toString(),h=mC(t,{theme:"dark",backgroundColor:e}),p=Ok()(t).hex().toLowerCase(),d=h.indexOf(p),y=t;return-1!==d&&(y=h[d+1]),{mainStroke:a,mainFill:n,activeStroke:t,activeFill:o,inactiveStroke:a,inactiveFill:n,selectedStroke:t,selectedFill:n,highlightStroke:t,highlightFill:i,disableStroke:f,disableFill:u,edgeMainStroke:r,edgeActiveStroke:t,edgeInactiveStroke:r,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:l,comboMainStroke:c,comboMainFill:u,comboActiveStroke:t,comboActiveFill:s,comboInactiveStroke:c,comboInactiveFill:u,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:y,comboHighlightFill:u,comboDisableStroke:c,comboDisableFill:s}}(t,e,"#777")},EC=function(t,e,r,n){void 0===e&&(e="#fff"),void 0===r&&(r="default"),void 0===n&&(n="rgb(150, 150, 150)");var o=[];return t.forEach(function(t){o.push(_C(t,e,r,n))}),o},OC=_C("rgb(95, 149, 255)","rgb(255, 255, 255)"),PC={version:"0.8.23",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:OC.mainStroke,fill:OC.mainFill},size:20,color:OC.mainStroke,linkPoints:{size:8,lineWidth:1,fill:OC.activeFill,stroke:OC.activeStroke}},nodeStateStyles:{active:{fill:OC.activeFill,stroke:OC.activeStroke,lineWidth:2,shadowColor:OC.mainStroke,shadowBlur:10},selected:{fill:OC.selectedFill,stroke:OC.selectedStroke,lineWidth:4,shadowColor:OC.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:OC.highlightFill,stroke:OC.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:OC.inactiveFill,stroke:OC.inactiveStroke,lineWidth:1},disable:{fill:OC.disableFill,stroke:OC.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:"rgb(0, 0, 0)",textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:OC.edgeMainStroke,lineAppendWidth:2},color:OC.edgeMainStroke},edgeStateStyles:{active:{stroke:OC.edgeActiveStroke,lineWidth:1},selected:{stroke:OC.edgeSelectedStroke,lineWidth:2,shadowColor:OC.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:OC.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:OC.edgeInactiveStroke,lineWidth:1},disable:{stroke:OC.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:"rgb(0, 0, 0)",textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:OC.comboMainFill,lineWidth:1,stroke:OC.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:OC.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:OC.comboActiveStroke,lineWidth:1,fill:OC.comboActiveFill},selected:{stroke:OC.comboSelectedStroke,lineWidth:2,fill:OC.comboSelectedFill,shadowColor:OC.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:OC.comboHighlightStroke,lineWidth:2,fill:OC.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:OC.comboInactiveStroke,fill:OC.comboInactiveFill,lineWidth:1},disable:{stroke:OC.comboDisableStroke,fill:OC.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},textWaterMarkerConfig:{width:150,height:100,compatible:!1,text:{x:0,y:60,lineHeight:20,rotate:20,fontSize:14,fontFamily:"Microsoft YaHei",fill:"rgba(0, 0, 0, 0.1)",baseline:"Middle"}},imageWaterMarkerConfig:{width:150,height:130,compatible:!1,image:{x:0,y:0,width:30,height:20,rotate:0}},waterMarkerImage:"https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg"},kC=function t(e,r){var n;e.isGroup()&&r.isGroup()&&(null===(n=e.get("children"))||void 0===n||n.forEach(function(e,n){var o=r.get("children")[n];t(e,o)}));var o=e.get("type"),i=r.get("type");if("image"===o&&"image"===i){var a=e.get("clipShape");a&&r.setClip({type:a.get("type"),attrs:a.attr()})}};function CC(t,e,r){if(t){if("function"==typeof t.addEventListener)return t.addEventListener(e,r,!1),{remove:function(){t.removeEventListener(e,r,!1)}};if("function"==typeof t.attachEvent)return t.attachEvent("on"+e,r),{remove:function(){t.detachEvent("on"+e,r)}}}}var TC=yO.cloneEvent,AC=yO.isViewportChanged,MC=function(t){function e(e){var r=t.call(this,e)||this;return r.extendEvents=[],r.dragging=!1,r.mousedown=!1,r.preItem=null,r.destroy(),r.graph=e,r.destroyed=!1,r.initEvents(),r}return(0,eg.__extends)(e,t),e.prototype.initEvents=function(){var t=this.graph,e=this.extendEvents,r=void 0===e?[]:e,n=t.get("canvas"),o=n.get("el"),i=(0,rg.wrapBehavior)(this,"onCanvasEvents"),a=(0,rg.wrapBehavior)(this,"onExtendEvents"),s=(0,rg.wrapBehavior)(this,"onWheelEvent");n.off("*").on("*",i),this.canvasHandler=i,r.push(CC(o,"wheel",s)),"undefined"!=typeof window&&(r.push(CC(window,"keydown",a)),r.push(CC(window,"keyup",a)),r.push(CC(window,"focus",a))),this.resetHandler&&t.off("afterchangedata",this.resetHandler),this.resetHandler=(0,rg.wrapBehavior)(this,"resetStatus"),t.on("afterchangedata",this.resetHandler)},e.getItemRoot=function(t){for(;t&&!t.get("item");)t=t.get("parent");return t},e.prototype.onCanvasEvents=function(t){var r=this,n=this.graph,o=n.get("canvas"),i=t.target,a=t.type;switch(a){case"drag":this.onCanvasEvents(Object.assign({},t,{type:"mousemove"}));break;case"dragend":this.onCanvasEvents(Object.assign({},t,{type:"mouseup"}));break;case"mousedown":this.mousedown=!0;break;case"mouseup":setTimeout(function(){return r.mousedown=!1});break;case"click":if(!this.mousedown)return}t.canvasX=t.x,t.canvasY=t.y;var s={x:t.canvasX,y:t.canvasY},u=n.get("group").getMatrix();if(u||(u=[1,0,0,0,1,0,0,0,1]),AC(u)&&(s=n.getPointByClient(t.clientX,t.clientY)),t.x=s.x,t.y=s.y,t.currentTarget=n,i===o)return"mousemove"!==a&&"mouseleave"!==a||this.handleMouseMove(t,"canvas"),t.target=o,t.item=null,n.emit(a,t),void n.emit("canvas:".concat(a),t);var l=e.getItemRoot(i);if(l){var c=l.get("item");if(!c.destroyed){var f=c.getType();if(t.target=i,t.item=c,t.canvasX===t.x&&t.canvasY===t.y){var h=n.getCanvasByPoint(t.x,t.y);t.canvasX=h.x,t.canvasY=h.y}t.name&&!t.name.includes(":")?(n.emit("".concat(f,":").concat(a),t),n.emit(a,t)):t.name&&n.emit(t.name,t),"dragstart"===a&&(this.dragging=!0),"dragend"===a&&(this.dragging=!1),"mousemove"===a&&this.handleMouseMove(t,f)}}else n.emit(a,t)},e.prototype.onExtendEvents=function(t){this.graph.emit(t.type,t)},e.prototype.onWheelEvent=function(t){(0,rg.isNil)(t.wheelDelta)&&(t.wheelDelta=-t.detail),this.graph.emit("wheel",t)},e.prototype.handleMouseMove=function(t,e){var r=this.graph,n=this.preItem,o=r.get("canvas"),i=t.target===o?null:t.item;t=TC(t),n&&n!==i&&!n.destroyed&&(t.item=n,this.emitCustomEvent(n.getType(),"mouseleave",t),this.dragging&&this.emitCustomEvent(n.getType(),"dragleave",t)),i&&n!==i&&(t.item=i,this.emitCustomEvent(e,"mouseenter",t),this.dragging&&this.emitCustomEvent(e,"dragenter",t)),this.preItem=i},e.prototype.emitCustomEvent=function(t,e,r){r.type=e,this.graph.emit("".concat(t,":").concat(e),r)},e.prototype.resetStatus=function(){this.mousedown=!1,this.dragging=!1,this.preItem=null},e.prototype.destroy=function(){var t=this.graph,e=this.canvasHandler,r=this.extendEvents;t.get("canvas").off("*",e),(0,rg.each)(r,function(t){t.remove()}),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},e}(gO),jC=r(9015),IC=r(6144),NC=r.n(IC),LC=yO.traverseTree,RC=function(t,e){return t?(0,rg.isNumber)(t)?function(e){return t}:t:function(t){return e||1}},DC=function(t,e){var r=[],n=[],o={},i=0;for(i=0;i=0&&(i="x",o="y");var a=0;LC(t,function(t){return a++,t.x>n.x&&(n.x=t.x),t.xn.y&&(n.y=t.y),t.yWebGL.
    ','Find out how to get it here.'].join("\n"):['Your browser does not seem to support WebGL.
    ','Find out how to get it here.'].join("\n")),t},addGetWebGLMessage:function(e){var r=void 0!==(e=e||{}).parent?e.parent:document.body,n=void 0!==e.id?e.id:"oldie",o=t().getWebGLErrorMessage();o.id=n,r.appendChild(o)}}},HC=function(){var t=navigator.userAgent.toLowerCase();return t.indexOf("firefox")>-1?"firefox":t.indexOf("safari")>-1?"safari":t.indexOf("opr")>-1?"opera":t.indexOf("chrome")>-1?"chrome":t.indexOf("trident")>-1?"ie 11":t.indexOf("ie")>-1?"ie":"unknown"},qC=(0,eg.__assign)((0,eg.__assign)((0,eg.__assign)((0,eg.__assign)((0,eg.__assign)({},yO),d),y),v),g),WC=qC.radialLayout,YC=function(){function t(t){this.type=t.type,this.radial=t.radial,this.config=t}return t.prototype.init=function(t){var e=this;this.data=t,this.radial?this.layoutMethod=function(t){var r=NC()[e.type](t,e.config);return WC(r),r}:this.layoutMethod=function(t){return NC()[e.type](t,e.config)}},t.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},t.prototype.layout=function(t){return this.init(t),this.execute()},t}();(0,jC.registerLayout)("grid",jC.GridLayout),(0,jC.registerLayout)("random",jC.RandomLayout),(0,jC.registerLayout)("force",jC.ForceLayout),(0,jC.registerLayout)("circular",jC.CircularLayout),(0,jC.registerLayout)("dagre",jC.DagreLayout),(0,jC.registerLayout)("dagreCompound",jC.DagreCompoundLayout),(0,jC.registerLayout)("radial",jC.RadialLayout),(0,jC.registerLayout)("concentric",jC.ConcentricLayout),(0,jC.registerLayout)("mds",jC.MDSLayout),(0,jC.registerLayout)("fruchterman",jC.FruchtermanLayout),(0,jC.registerLayout)("fruchterman-gpu",jC.FruchtermanGPULayout),(0,jC.registerLayout)("gForce",jC.GForceLayout),(0,jC.registerLayout)("force2",jC.Force2Layout),(0,jC.registerLayout)("gForce-gpu",jC.GForceGPULayout),(0,jC.registerLayout)("comboForce",jC.ComboForceLayout),(0,jC.registerLayout)("comboCombined",jC.ComboCombinedLayout),(0,jC.registerLayout)("forceAtlas2",jC.ForceAtlas2Layout);var XC=function(){return function(t,e){var r=t.toString(),n=new Blob(["importScripts('".concat(e,"');(").concat(r,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(n))}}(),JC=function(t){return void 0===t&&(t="https://unpkg.com/@antv/layout@0.3.23/dist/layout.min.js"),new XC(function(){var t={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("force2",layout.Force2Layout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("dagreCompound",layout.DagreCompoundLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout),onmessage=function(e){(function(e){var r=e.data.type;return r===t.RUN||r===t.GPURUN})(e)&&function(e){var r=this;switch(e.data.type){case t.RUN:var n,o=e.data,i=o.nodes,a=o.edges,s=o.layoutCfg,u=(p=void 0===s?{}:s).type;if(!(l=layout.getLayoutByName(u))){this.postMessage({type:t.ERROR,message:"layout ".concat(u," not found")});break}p.onLayoutEnd=function(){r.postMessage({type:t.END,nodes:i}),null===n||void 0===n||n.destroy()},(n=new l(p)).init({nodes:i,edges:a}),n.execute();break;case t.GPURUN:var l,c=e.data,f=c.nodes,h=(a=c.edges,c.layoutCfg),p=void 0===h?{}:h,d=c.canvas;if(u=p.type,!(l=layout.getLayoutByName(u))){this.postMessage({type:t.ERROR,message:"layout ".concat(u," not found")});break}if("gpu"!==u.split("-")[1]){this.postMessage({type:t.ERROR,message:"layout ".concat(u," does not support GPU")});break}var y=new l(p);y.init({nodes:f,edges:a}),y.executeWithWorker(d,this)}}(e)}},t)},KC="LAYOUT_RUN",QC="LAYOUT_END",ZC="LAYOUT_ERROR",$C="LAYOUT_TICK",tT="GPU_LAYOUT_RUN",eT="GPU_LAYOUT_END";function rT(t){"@babel/helpers - typeof";return(rT="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var nT=function(t){return setTimeout(t,16)},oT=function(t){return clearTimeout(t)},iT=function(t){return("undefined"!=typeof window&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||nT)(t)},aT=function(t){return("undefined"!=typeof window&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||oT)(t)},sT=["fruchterman","gForce"],uT=["force","grid","circular"],lT=function(t){function e(e){var r=t.call(this,e)||this;return r.graph=e,r.layoutCfg=e.get("layout")||{},r.layoutType=r.getLayoutType(),r.worker=null,r.workerData={},r.initLayout(),r}return(0,eg.__extends)(e,t),e.prototype.initLayout=function(){},e.prototype.getWorker=function(){return this.worker?this.worker:("undefined"==typeof Worker?(console.warn("Web worker is not supported in current browser."),this.worker=null):this.worker=JC(this.layoutCfg.workerScriptURL),this.worker)},e.prototype.stopWorker=function(){var t=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,t.requestId&&(aT(t.requestId),t.requestId=null),t.requestId2&&(aT(t.requestId2),t.requestId2=null))},e.prototype.execLayoutMethod=function(t,e){var r=this;return new Promise(function(n,o){return(0,eg.__awaiter)(r,void 0,void 0,function(){var r,i,a,s,u,l,c,f,h;return(0,eg.__generator)(this,function(p){switch(p.label){case 0:if(!(r=this.graph)||r.get("destroyed"))return[2];i=t.type,t.onLayoutEnd=function(){r.emit("aftersublayout",{type:i}),n()},i&&this.isGPU&&(fT(i)?i="".concat(i,"-gpu"):console.warn("The '".concat(i,"' layout does not support GPU calculation for now, it will run in CPU."))),yO.isForce(i)?(a=t.onTick,s=t.animate,u=void 0===s&&("force"===i||"force2"===i),f=function(){a&&a(),(s||u)&&r.refreshPositions()},t.tick=f):"comboForce"!==i&&"comboCombined"!==i||(t.comboTrees=r.get("comboTrees")),!1;try{l=new jC.Layouts[i](t),this.layoutMethods[e]&&this.layoutMethods[e].destroy(),this.layoutMethods[e]=l}catch(t){console.warn("The layout method: '".concat(i,"' does not exist! Please specify it first.")),o()}return l.enableTick&&(c=t.onTick,f=function(){c&&c(),r.refreshPositions()},l.tick=f),function(t,e){var r;if(!(null===(r=null===t||void 0===t?void 0:t.nodes)||void 0===r?void 0:r.length))return;t.nodes.forEach(function(t){t.layoutOrder=e})}(h=this.filterLayoutData(this.data,t),e),l.init(h),r.emit("beforesublayout",{type:i}),[4,l.execute()];case 1:return p.sent(),l.isCustomLayout&&t.onLayoutEnd&&t.onLayoutEnd(),[2]}})})})},e.prototype.updateLayoutMethod=function(t,e){var r=this;return new Promise(function(n,o){return(0,eg.__awaiter)(r,void 0,void 0,function(){var r,o,i,a,s,u,l;return(0,eg.__generator)(this,function(c){switch(c.label){case 0:return r=this.graph,o=null===e||void 0===e?void 0:e.type,e.onLayoutEnd=function(){r.emit("aftersublayout",{type:o}),n()},yO.isForce(o)&&(i=e.onTick,a=e.animate,s=void 0===a&&("force"===o||"force2"===o),u=function(){null===i||void 0===i||i(),(a||s)&&r.refreshPositions()},e.tick=u),l=this.filterLayoutData(this.data,e),t.init(l),t.updateCfg(e),r.emit("beforesublayout",{type:o}),[4,t.execute()];case 1:return c.sent(),t.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd(),[2]}})})})},e.prototype.layout=function(t){var e,r=this,n=this.graph;if(n&&!n.get("destroyed")){this.data=this.setDataFromGraph();var o=this.data,i=o.nodes,a=o.hiddenNodes;if(!i)return!1;var s=n.get("width"),u=n.get("height"),l={};Object.assign(l,{width:s,height:u,center:[s/2,u/2]},this.layoutCfg),this.layoutCfg=l;var c=l.type,f=!1;null===(e=this.layoutMethods)||void 0===e||e.forEach(function(t){var e;return f=!!(null===(e=t.nodes)||void 0===e?void 0:e.length)||f});var h=this.destoryLayoutMethods();n.emit("beforelayout");var p=Promise.resolve();f&&c&&1===(null===h||void 0===h?void 0:h.length)&&h[0]===c?this.tweakInit():p=this.initPositions(l.center,i),this.initPositions(l.center,a).then(),this.isGPU=hT(l,c);var d=l.onLayoutEnd,y=l.layoutEndFormatted,v=l.adjust;if(y||(l.layoutEndFormatted=!0,l.onAllLayoutEnd=function(){return(0,eg.__awaiter)(r,void 0,void 0,function(){return(0,eg.__generator)(this,function(t){switch(t.label){case 0:return d&&d(i),this.refreshLayout(),v&&l.pipes?[4,this.adjustPipesBox(this.data,v)]:[3,2];case 1:t.sent(),this.refreshLayout(),t.label=2;case 2:return n.emit("afterlayout"),[2]}})})}),this.stopWorker(),l.workerEnabled&&this.layoutWithWorker(this.data,t))return!0;var g=!1;return l.type?(g=!0,p=p.then(function(){return(0,eg.__awaiter)(r,void 0,void 0,function(){return(0,eg.__generator)(this,function(t){switch(t.label){case 0:return[4,this.execLayoutMethod(l,0)];case 1:return[2,t.sent()]}})})})):l.pipes&&(g=!0,l.pipes.forEach(function(t,e){p=p.then(function(){return(0,eg.__awaiter)(r,void 0,void 0,function(){return(0,eg.__generator)(this,function(r){switch(r.label){case 0:return[4,this.execLayoutMethod(t,e)];case 1:return[2,r.sent()]}})})})})),g?p.then(function(){l.onAllLayoutEnd&&l.onAllLayoutEnd(),t&&t()}).catch(function(t){console.warn("graph layout failed,",t)}):(n.refreshPositions(),null===t||void 0===t||t()),!1}},e.prototype.tweakInit=function(){var t=this.data,e=this.graph,r=t.nodes,n=t.edges;if(null===r||void 0===r?void 0:r.length){var o={};r.forEach(function(t){var e=t.x,r=t.y;isNaN(e)||isNaN(r)||(o[t.id]={x:e,y:r},t.mass=t.mass||2)}),n.forEach(function(t){var e=t.source,r=t.target,n=o[e],i=o[r];!n&&i?o[e]={x:i.x+80*(Math.random()-.5),y:i.y+80*(Math.random()-.5)}:!i&&n&&(o[r]={x:n.x+80*(Math.random()-.5),y:n.y+80*(Math.random()-.5)})});var i=e.get("width"),a=e.get("height");r.forEach(function(t){var e=o[t.id]||{x:i/2+20*(Math.random()-.5),y:a/2+20*(Math.random()-.5)};t.x=e.x,t.y=e.y})}},e.prototype.initWithPreset=function(t,e){var r=this;return new Promise(function(n,o){return(0,eg.__awaiter)(r,void 0,void 0,function(){var r,o,i,a,s,u,l;return(0,eg.__generator)(this,function(c){switch(c.label){case 0:return o=(r=this).layoutCfg,i=r.data,(null===(a=o.preset)||void 0===a?void 0:a.type)&&jC.Layouts[null===a||void 0===a?void 0:a.type]?(s=hT(a,a.type),u=s?"".concat(a.type,"-gpu"):a.type,l=new jC.Layouts[u](a),delete o.preset,l.init(i),[4,l.execute()]):(null===e||void 0===e||e(),n(),[2,!1]);case 1:return c.sent(),null===t||void 0===t||t(),n(),[2,!0]}})})})},e.prototype.layoutWithWorker=function(t,e){var r=this,n=this.layoutCfg,o=this.graph,i=this.getWorker(),a=this.workerData;if(!i)return!1;a.requestId=null,a.requestId2=null,a.currentTick=null,a.currentTickData=null,o.emit("beforelayout");var s=Promise.resolve(),u=!1;if(n.type)u=!0,s=s.then(function(){return r.runWebworker(i,t,n)});else if(n.pipes){u=!0;for(var l=function(e){s=s.then(function(){return r.runWebworker(i,t,e)})},c=0,f=n.pipes;c'),u=r?r.backgroundColor:void 0,l=r?r.padding:void 0;l?(0,rg.isNumber)(l)&&(l=[l,l,l,l]):l=[0,0,0,0];var c=o+l[0]+l[2],f=i+l[1]+l[3],h={container:s,height:c,width:f,quickHit:!0},p="svg"===a?new xk(h):new MP(h),d=this.get("group").clone(),y=(0,rg.clone)(d.getMatrix());y||(y=[1,0,0,0,1,0,0,0,1]);var v=(n.maxX+n.minX)/2,g=(n.maxY+n.minY)/2;y=pT(y,[["t",-v,-g],["t",i/2+l[3],o/2+l[0]]]),d.resetMatrix(),d.setMatrix(y),p.add(d);var m=p.get("el"),b="";e||(e="image/png"),setTimeout(function(){if("svg"===a){var r=m.cloneNode(!0),n=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),o=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",n);o.replaceChild(r,o.documentElement);var i=(new XMLSerializer).serializeToString(o);b="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(i))}else{var s=void 0,l=m.getContext("2d"),h=void 0;if(u){var p="undefined"!=typeof window?window.devicePixelRatio:1;try{s=l.getImageData(0,0,f*p,c*p),h=l.globalCompositeOperation,l.globalCompositeOperation="destination-over",l.fillStyle=u,l.fillRect(0,0,f,c)}catch(t){console.error("Download image failed. Out of memory at ImageData creation")}}b=m.toDataURL(e),u&&(l.clearRect(0,0,f,c),l.putImageData(s,0,0),l.globalCompositeOperation=h)}t&&t(b)},16)},e.prototype.downloadFullImage=function(t,e,r){var n=this,o=this.get("group").getCanvasBBox(),i=o.height,a=o.width,s=this.get("renderer"),u=_k('
    '),l=document.querySelector(".g6-graph-watermarker"),c=r?r.backgroundColor:void 0,f=r?r.padding:void 0;f?(0,rg.isNumber)(f)&&(f=[f,f,f,f]):f=[0,0,0,0];var h=i+f[0]+f[2],p=a+f[1]+f[3];if(l){var d=this.get("graphWaterMarker").cfg||{},y=d.width,v=d.height;h=Math.ceil(h/v)*v,p=Math.ceil(p/y)*y}var g,m,b={container:u,height:h,width:p},w="svg"===s?new xk(b):new MP(b),S=this.get("group"),x=(m=(g=S).clone(),kC(g,m),m),_=(0,rg.clone)(x.getMatrix());_||(_=[1,0,0,0,1,0,0,0,1]);var E=(o.maxX+o.minX)/2,O=(o.maxY+o.minY)/2;_=pT(_,[["t",-E,-O],["t",a/2+f[3],i/2+f[0]]]),x.resetMatrix(),x.setMatrix(_),w.add(x);var P=w.get("el");e||(e="image/png"),this.asyncToDataUrl(e,c,function(r){var o=document.createElement("a"),i=(t||"graph")+("svg"===s?".svg":".".concat(e.split("/")[1]));n.dataURLToImage(r,s,o,i);var a=document.createEvent("MouseEvents");a.initEvent("click",!1,!1),o.dispatchEvent(a)},p,h,P)},e.prototype.downloadImage=function(t,e,r){var n=this;this.stopAnimate();var o=this.get("canvas").getRenderer();e||(e="image/png");var i=(t||"graph")+("svg"===o?".svg":".".concat(e.split("/")[1])),a=document.createElement("a");this.asyncToDataUrl(e,r,function(t){n.dataURLToImage(t,o,a,i);var e=document.createEvent("MouseEvents");e.initEvent("click",!1,!1),a.dispatchEvent(e)})},e.prototype.dataURLToImage=function(t,e,r,n){if(t&&"data:"!==t){if("undefined"!=typeof window)if(window.Blob&&window.URL&&"svg"!==e){var o=t.split(","),i="";if(o&&o.length>0){var a=o[0].match(/:(.*?);/);a&&a.length>=2&&(i=a[1])}for(var s=atob(o[1]),u=s.length,l=new Uint8Array(u);u--;)l[u]=s.charCodeAt(u);var c=new Blob([l],{type:i});window.navigator.msSaveBlob?window.navigator.msSaveBlob(c,n):r.addEventListener("click",function(){r.download=n,r.href=window.URL.createObjectURL(c)})}else r.addEventListener("click",function(){r.download=n,r.href=t})}else console.error("Download image failed. The graph is too large or there is invalid attribute values in graph items")},e.prototype.addPlugin=function(t){t.destroyed||(this.get("plugins").push(t),t.initPlugin(this))},e.prototype.removePlugin=function(t){var e=this.get("plugins"),r=e.indexOf(t);r>=0&&(t.destroyPlugin(),e.splice(r,1))},e.prototype.setImageWaterMarker=function(t,e){void 0===t&&(t=PC.waterMarkerImage);var r=this.get("container");(0,rg.isString)(r)&&(r=document.getElementById(r)),r.style.position||(r.style.position="relative");var n=this.get("graphWaterMarker"),o=(0,rg.deepMix)({},PC.imageWaterMarkerConfig,e),i=o.width,a=o.height,s=o.compatible,u=o.image;if(!t){var l=s?r:document.querySelector(".g6-graph-watermarker");return l&&(l.style.cssText=void 0),void(n&&n.clear())}if(n)n.clear();else{var c={container:r,width:i,height:a,capture:!1},f=this.get("pixelRatio");f&&(c.pixelRatio=f,window.devicePixelRatio=f),n=new MP(c),this.set("graphWaterMarker",n)}n.get("el").style.display="none";var h=n.get("context"),p=u.rotate,d=u.x,y=u.y;h.rotate(-p*Math.PI/180);var v=new Image;v.crossOrigin="anonymous",v.src=t,v.onload=function(){if(h.drawImage(v,d,y,u.width,u.height),h.rotate(p*Math.PI/180),s)r.style.cssText="background-image: url(".concat(n.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var t=document.querySelector(".g6-graph-watermarker");t||((t=document.createElement("div")).className="g6-graph-watermarker"),t.className="g6-graph-watermarker",n.destroyed||(t.style.cssText="background-image: url(".concat(n.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),r.appendChild(t))}}},e.prototype.setTextWaterMarker=function(t,e){var r=this.get("container");(0,rg.isString)(r)&&(r=document.getElementById(r)),r.style.position||(r.style.position="relative");var n=this.get("graphWaterMarker"),o=(0,rg.deepMix)({},PC.textWaterMarkerConfig,e),i=o.width,a=o.height,s=o.compatible,u=o.text;if(!(null===t||void 0===t?void 0:t.length)){var l=s?r:document.querySelector(".g6-graph-watermarker");return l&&(l.style.cssText=void 0),void(n&&n.clear())}if(n)n.clear();else{var c={container:r,width:i,height:a,capture:!1},f=this.get("pixelRatio");f&&(c.pixelRatio=f,window.devicePixelRatio=f),n=new MP(c),this.set("graphWaterMarker",n)}n.get("el").style.display="none";var h=n.get("context"),p=u.rotate,d=u.fill,y=u.fontFamily,v=u.fontSize,g=u.baseline,m=u.x,b=u.y,w=u.lineHeight;h.rotate(-p*Math.PI/180),h.font="".concat(v,"px ").concat(y),h.fillStyle=d,h.textBaseline=g;for(var S=(0,rg.isString)(t)?[t]:t,x=S.length-1;x>=0;x--)h.fillText(S[x],m,b+x*w);if(h.rotate(p*Math.PI/180),s)r.style.cssText="background-image: url(".concat(n.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var _=document.querySelector(".g6-graph-watermarker");_||((_=document.createElement("div")).className="g6-graph-watermarker"),_.style.cssText="background-image: url(".concat(n.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;"),r.appendChild(_)}},e.prototype.destroy=function(){var e,r,n,o;(0,rg.each)(this.get("plugins"),function(t){t.destroyPlugin()});var i=this.get("tooltips");if(i)for(var a=0;a0)for(var l=u.length-1;l>=0;l--){var c=u[l].getModel();-1===e.indexOfChild(t.children||[],c.id)&&(o.innerRemoveChild(c.id,{x:t.x,y:t.y},n),u.splice(l,1))}i.get("originAttrs")&&(a=i.get("originAttrs").x,s=i.get("originAttrs").y);var f=i.getModel();n&&i.set("originAttrs",{x:f.x,y:f.y}),i.set("model",Object.assign(f,t.data)),a===t.x&&s===t.y||i.updatePosition({x:t.x,y:t.y})}else o.innerAddChild(t,r,n)},e.prototype.innerRemoveChild=function(t,e,r){var n=this,o=n.findById(t);if(o)if((0,rg.each)(o.get("children"),function(t){n.innerRemoveChild(t.getModel().id,e,r)}),r){var i=o.getModel();o.set("to",e),o.set("originAttrs",{x:i.x,y:i.y}),n.get("removeList").push(o)}else n.removeItem(o,!1)},e.prototype.changeData=function(t,e){void 0===e&&(e=!0);var r=this;this.getNodes().map(function(t){return r.clearItemStates(t)}),this.getEdges().map(function(t){return r.clearItemStates(t)}),e&&this.get("enabledStack")&&this.pushStack("changedata",{before:r.get("originData"),after:t||r.get("data")}),t?(r.data(t),r.render(!1)):r.layout(this.get("fitView"))},e.prototype.changeLayout=function(t){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");this.updateLayout(t)},e.prototype.updateLayout=function(t,e,r,n){void 0===n&&(n=!0);if(t){if(n&&this.get("enabledStack")&&this.pushStack("layout",{before:this.get("layout"),after:t}),this.set("layout",t),this.set("layoutMethod",this.getLayout()),this.layout(),e){var o=r;o||(o="begin"===e?{x:0,y:0}:{x:this.getWidth()/2,y:this.getHeight()/2}),o=this.getPointByCanvas(o.x,o.y);var i=this.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];o.x=o.x*i[0]+i[6],o.y=o.y*i[0]+i[7];var a=this.getGroup().getCanvasBBox(),s=a.minX,u=a.maxX,l=a.minY,c={x:(s+u)/2,y:(l+a.maxY)/2};"begin"===e&&(c.x=s,c.y=l),this.translate(o.x-c.x,o.y-c.y)}}else console.warn("layout cannot be null")},e.prototype.refreshLayout=function(t){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");this.layout(t)},e.prototype.layout=function(t){var e=this,r=this.get("data"),n=this.get("layoutMethod"),o=this.get("layout"),i=r;if(null===o||void 0===o?void 0:o.excludeInvisibles){r=(0,rg.clone)(this.get("data"));var a={};mT(r,function(t){var r=t.children;if(!(null===r||void 0===r?void 0:r.length))return!0;for(var n=r.length-1;n>=0;n--){var o=e.findById(r[n].id);(o?!o.isVisible():!1===r[n].visible)&&(a[t.id]=a[t.id]||[],a[t.id].push({idx:n,child:r.splice(n,1)[0]}))}}),i=n?n(r,this.get("layout")):r,mT(i,function(t){var e=a[t.id];if(null===e||void 0===e?void 0:e.length)for(var r=e.length-1;r>=0;r--){var n=e[r],o=n.idx,i=n.child;t.children.splice(o,0,i)}})}else i=n?n(r,this.get("layout")):r;var s=this.get("animate");(this.emit("beforerefreshlayout",{data:r,layoutData:i}),this.emit("beforelayout"),this.innerUpdateChild(i,void 0,s),t)&&this.get("viewController").fitView();s?this.layoutAnimate(i):(this.refresh(),this.paint()),this.emit("afterrefreshlayout",{data:r,layoutData:i}),this.emit("afterlayout")},e.prototype.addChild=function(t,e,r){void 0===r&&(r=!0);this.emit("beforeaddchild",{model:t,parent:e}),(0,rg.isString)(e)||(e=e.get("id"));var n=this.findDataById(e);n&&(n.children||(n.children=[]),n.children.push(t),this.findById(e).refresh(),this.changeData(void 0,r))},e.prototype.updateChildren=function(t,e,r){void 0===r&&(r=!0);var n=this.findById(e);e&&n?(this.findDataById(e).children=t,n.refresh(),this.changeData(void 0,r)):console.warn("Update children failed! There is no node with id '".concat(e,"'"))},e.prototype.updateChild=function(t,r,n){void 0===n&&(n=!0);if(r&&this.findById(r)){var o=this.findDataById(r),i=this.findById(t.id);if(o.children||(o.children=[]),i){var a=e.indexOfChild(o.children,t.id);a>-1&&(o.children[a]=t)}else o.children.push(t);var s=this.findById(r);null===s||void 0===s||s.refresh(),this.changeData(void 0,n)}else this.changeData(t,n)},e.prototype.removeChild=function(t,r){void 0===r&&(r=!0);var n,o=this.findById(t);if((n=o?null===o||void 0===o?void 0:o.get("parent"):this.getNodes().find(function(e){return!!(e.getModel().children||[]).find(function(e){return e.id===t})}))&&!n.destroyed){var i=n.get("id"),a=this.findDataById(i),s=a&&a.children||[],u=e.indexOfChild(s,t);s.splice(u,1),n.refresh()}this.changeData(void 0,r)},e.prototype.findDataById=function(t,e){var r=this;if(e||(e=r.get("data")),t===e.id)return e;var n=null;return(0,rg.each)(e.children||[],function(e){return e.id===t?(n=e,!1):!(n=r.findDataById(t,e))&&void 0}),n},e.prototype.layoutAnimate=function(t,e){var r=this,n=this.get("animateCfg");r.emit("beforeanimate",{data:t}),r.getEdges().forEach(function(t){var e=t.get("model");e.sourceAnchor||(e.sourceAnchor=t.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(n){mT(t,function(o){var i=r.findById(o.id);if(i){var a=i.get("originAttrs"),s=i.get("model");if(a||(a={x:s.x,y:s.y},i.set("originAttrs",a)),e){var u=e(i,n,a,t);i.set("model",Object.assign(s,u))}else s.x=a.x+(o.x-a.x)*n,s.y=a.y+(o.y-a.y)*n}return!0}),(0,rg.each)(r.get("removeList"),function(t){var e=t.getModel(),r=t.get("originAttrs"),o=t.get("to");e.x=r.x+(o.x-r.x)*n,e.y=r.y+(o.y-r.y)*n}),r.refreshPositions()},{duration:n.duration,easing:n.ease,callback:function(){(0,rg.each)(r.getNodes(),function(t){t.set("originAttrs",null)}),(0,rg.each)(r.get("removeList"),function(t){r.removeItem(t,!1)}),r.set("removeList",[]),n.callback&&n.callback(),r.emit("afteranimate",{data:t})},delay:n.delay})},e.prototype.stopLayoutAnimate=function(){this.get("canvas").stopAnimate(),this.emit("layoutanimateend",{data:this.get("data")}),this.layoutAnimating=!1},e.prototype.isLayoutAnimating=function(){return this.layoutAnimating},e.prototype.render=function(t){void 0===t&&(t=!0);var e=this.get("data");if(!e||!(0,rg.isObject)(e)||!Object.keys(e).length)throw new Error("data must be defined first");this.clear(),t&&this.get("enabledStack")&&this.clearStack(),this.emit("beforerender"),this.layout(this.get("fitView")),this.emit("afterrender")},e.prototype.save=function(){return this.get("data")},e.prototype.data=function(e){t.prototype.data.call(this,e),this.set("originData",vT(e))},e}(dT);function wT(t,e){if(t)for(var r in e)e.hasOwnProperty(r)&&(t.style[r]=e[r]);return t}var ST=function(){function t(t){this._cfgs=(0,rg.deepMix)(this.getDefaultCfgs(),t),this._events={},this.destroyed=!1}return t.prototype.getDefaultCfgs=function(){return{}},t.prototype.initPlugin=function(t){var e=this;e.set("graph",t);var r=e.getEvents(),n={};(0,rg.each)(r,function(r,o){var i=(0,rg.wrapBehavior)(e,r);n[o]=i,t.on(o,i)}),this._events=n,this.init()},t.prototype.getEvents=function(){return{}},t.prototype.get=function(t){var e;return null===(e=this._cfgs)||void 0===e?void 0:e[t]},t.prototype.set=function(t,e){this._cfgs[t]=e},t.prototype.destroy=function(){},t.prototype.destroyPlugin=function(){this.destroy();var t=this.get("graph"),e=this._events;(0,rg.each)(e,function(e,r){t.off(r,e)}),this._events=null,this._cfgs=null,this.destroyed=!0},t}(),xT=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_T="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",ET=function(t){function e(e){return t.call(this,e)||this}return xT(e,t),e.prototype.getDefaultCfgs=function(){return{img:_T,follow:!0}},e.prototype.init=function(){var t=this.get("graph"),e=t.get("container"),r=t.get("canvas").get("el"),n=this.get("img")||_T;n.includes("url(")||(n='url("'.concat(n,'")'));var o=_k("
    "),i=_k(""));this.set("container",o),this.set("gridContainer",i),this.positionInit(),o.appendChild(i),e.insertBefore(o,r)},e.prototype.positionInit=function(){var t=this.get("graph"),e=t.get("minZoom"),r=t.get("width"),n=t.get("height");wT(this.get("container"),{width:"".concat(r,"px"),height:"".concat(n,"px")});var o=80*r/e,i=80*n/e;wT(this.get("gridContainer"),{width:"".concat(o,"px"),height:"".concat(i,"px"),left:"-".concat(o/2,"px"),top:"-".concat(i/2,"px")})},e.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},e.prototype.updateGrid=function(t){var e=this.get("gridContainer"),r=t.matrix;r||(r=[1,0,0,0,1,0,0,0,1]);var n=this.get("follow");wT(e,{transform:"matrix(".concat(r[0],", ").concat(r[1],", ").concat(r[3],", ").concat(r[4],", ").concat(n?r[6]:"0",", ").concat(n?r[7]:"0",")")})},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t=this.get("graph").get("container"),e=this.get("container");t.removeChild(e)},e}(ST),OT=r(3448),PT=r.n(OT),kT=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();"undefined"!=typeof document&&PT()("\n .g6-component-contextmenu {\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 10px 8px;\n box-shadow: rgb(174, 174, 174) 0px 0px 10px;\n }\n .g6-contextmenu-ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n");var CT=function(t){function e(e){return t.call(this,e)||this}return kT(e,t),e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(t){return"\n
      \n
    • 菜单项1
    • \n
    • 菜单项2
    • \n
    \n "},shouldBegin:function(t){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},e.prototype.getEvents=function(){return"click"===this.get("trigger")?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},e.prototype.init=function(){var t=this.get("className"),e=_k("
    "));wT(e,{top:"0px",position:"absolute",visibility:"hidden"});var r=this.get("container");r||(r=this.get("graph").get("container")),(0,rg.isString)(r)&&(r=document.getElementById(r)),r.appendChild(e),this.set("menu",e)},e.prototype.onMenuShow=function(t){var e=this;t.preventDefault();var r=this.get("itemTypes");if(t.item){if(t.item&&t.item.getType&&-1===r.indexOf(t.item.getType()))return void e.onMenuHide()}else if(-1===r.indexOf("canvas"))return void e.onMenuHide();if(this.get("shouldBegin")(t)){var n=this.get("menu"),o=this.get("getContent"),i=this.get("graph"),a=o(t,i);(0,rg.isString)(a)?n.innerHTML=a:n.innerHTML=a.outerHTML,this.removeMenuEventListener();var s=this.get("handleMenuClick");if(s){var u=function(e){s(e.target,t.item,i)};this.set("handleMenuClickWrapper",u),n.addEventListener("click",u)}var l=i.get("width"),c=i.get("height"),f=n.getBoundingClientRect(),h=this.get("offsetX")||0,p=this.get("offsetY")||0,d=i.getContainer().offsetTop,y=i.getContainer().offsetLeft,v=t.canvasX+y+h,g=t.canvasY+d+p;v+f.width>l&&(v=t.canvasX-f.width-h+y),g+f.height>c&&(g=t.canvasY-f.height-p+d),g<0&&(g=0),wT(n,{top:"".concat(g,"px"),left:"".concat(v,"px"),visibility:"visible"});var m="click"===this.get("trigger"),b=function(t){m?m=!1:e.onMenuHide()};document.body.addEventListener("click",b),this.set("handler",b)}},e.prototype.removeMenuEventListener=function(){var t=this.get("handleMenuClickWrapper"),e=this.get("handler");t&&(this.get("menu").removeEventListener("click",t),this.set("handleMenuClickWrapper",null));e&&document.body.removeEventListener("click",e)},e.prototype.onMenuHide=function(){var t=this.get("menu");t&&wT(t,{visibility:"hidden"}),this.removeMenuEventListener()},e.prototype.destroy=function(){var t=this.get("menu");if(this.removeMenuEventListener(),t){var e=this.get("container");e||(e=this.get("graph").get("container")),(0,rg.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}},e}(ST),TT=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),AT=function(){return(AT=Object.assign||function(t){for(var e,r=1,n=arguments.length;r-1,a=navigator.userAgent.toLowerCase().indexOf("safari")>-1,s=_k("\n ")),u=0,l=0,c=!1,f=0,h=0,p=0,d=0,y=0,v=0,g=a||i?"mousedown":"dragstart";s.addEventListener(g,function(o){var i,a;if(o.dataTransfer){var g=new Image;g.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",null===(a=(i=o.dataTransfer).setDragImage)||void 0===a||a.call(i,g,0,0);try{o.dataTransfer.setData("text/html","view-port-minimap")}catch(t){o.dataTransfer.setData("text","view-port-minimap")}}if(e.refresh=!1,o.target===s){var m=s.style;f=parseInt(m.left,10),h=parseInt(m.top,10),p=parseInt(m.width,10),d=parseInt(m.height,10),p>r[0]||d>r[1]||(v=n.getZoom(),y=t.get("ratio"),c=!0,u=o.clientX,l=o.clientY)}},!1);var m=function(t){if(c&&!(0,rg.isNil)(t.clientX)&&!(0,rg.isNil)(t.clientY)){var e=u-t.clientX,o=l-t.clientY;(f-e<0||f-e+p>=r[0])&&(e=0),(h-o<0||h-o+d>=r[1])&&(o=0),h-=o,wT(s,{left:"".concat(f-=e,"px"),top:"".concat(h,"px")}),n.translate(e*v/y,o*v/y),u=t.clientX,l=t.clientY}};a||i||s.addEventListener("drag",m,!1);var b=function(){c=!1,e.refresh=!0},w=a||i?"mouseup":"dragend";s.addEventListener(w,b,!1),o.addEventListener("mouseleave",b),o.addEventListener("mouseup",b),(a||i)&&o.addEventListener("mousemove",m,!1),this.set("viewport",s),o.appendChild(s)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),e=this.get("totaldx"),r=this.get("totaldy"),n=this.get("graph"),o=this.get("size"),i=n.get("canvas").get("el"),a=n.get("width")||i.scrollWidth||500,s=n.get("height")||i.scrollHeight||500,u=n.getPointByCanvas(0,0),l=n.getPointByCanvas(a,s),c=this.get("viewport");c||this.initViewport();var f=(l.x-u.x)*t,h=(l.y-u.y)*t,p=u.x*t+e,d=u.y*t+r,y=p+f,v=d+h;p<0&&(f+=p,p=0),y>o[0]&&(f-=y-o[0]),d<0&&(h+=d,d=0),v>o[1]&&(h-=v-o[1]),this.set("ratio",t),wT(c,{left:"".concat(p,"px"),top:"".concat(d,"px"),width:"".concat(f,"px"),height:"".concat(h,"px")})}},e.prototype.updateGraphShapes=function(){var t,e=this._cfgs.graph,r=this.get("canvas"),n=e.get("group");n.destroyed||(r.clear(),this.get("hideEdge")?(t=r.addGroup(),n.get("children").forEach(function(e){e.get("id").includes("-edge")||t.add(e.clone())})):((t=n.clone()).resetMatrix(),r.add(t)),"svg"===e.get("renderer")&&this.updateVisible(t))},e.prototype.updateVisible=function(t){var e=this;if(t.isGroup()||t.get("visible")){var r=t.get("children");if(!r||!r.length)return;r.forEach(function(t){t.get("visible")||t.hide(),e.updateVisible(t)})}else t.hide()},e.prototype.updateKeyShapes=function(){var t=this,e=this._cfgs.graph,r=this.get("canvas"),n=r.get("children")[0]||r.addGroup();this.get("hideEdge")||(0,rg.each)(e.getEdges(),function(e){t.updateOneEdgeKeyShape(e,n)}),(0,rg.each)(e.getNodes(),function(e){t.updateOneNodeKeyShape(e,n)});var o=e.getCombos();if(o&&o.length){var i=n.find(function(t){return"comboGroup"===t.get("name")})||n.addGroup({name:"comboGroup"});setTimeout(function(){t.destroyed||((0,rg.each)(o,function(e){t.updateOneComboKeyShape(e,i)}),null===i||void 0===i||i.sort(),null===i||void 0===i||i.toBack(),t.updateCanvas())},250)}this.clearDestroyedShapes()},e.prototype.updateOneComboKeyShape=function(t,e){if(!this.destroyed){var r=this.get("itemMap")||{},n=r[t.get("id")],o=t.getBBox(),i=t.get("keyShape").clone(),a=i.attr(),s={x:o.centerX,y:o.centerY};n?s=Object.assign(a,s):(n=i,e.add(n));var u=n.get("type");"rect"!==u&&"image"!==u||(s.x=o.minX,s.y=o.minY),n.attr(s),t.isVisible()?n.show():n.hide(),n.exist=!0;var l=t.getModel().depth;isNaN(l)||n.set("zIndex",l),r[t.get("id")]=n,this.set("itemMap",r)}},e.prototype.updateOneNodeKeyShape=function(t,e){var r=this.get("itemMap")||{},n=r[t.get("id")],o=t.getBBox(),i=t.get("keyShape").clone(),a=i.attr(),s={x:o.centerX,y:o.centerY};n?(s=Object.assign(a,s),n.toFront()):(n=i,e.add(n));var u=n.get("type");"rect"!==u&&"image"!==u||(s.x=o.minX,s.y=o.minY),n.attr(s),t.isVisible()?n.show():n.hide(),n.exist=!0;var l=t.getModel().depth;isNaN(l)||n.set("zIndex",l),r[t.get("id")]=n,this.set("itemMap",r)},e.prototype.updateDelegateShapes=function(){var t=this,e=this._cfgs.graph,r=this.get("canvas"),n=r.get("children")[0]||r.addGroup();this.get("hideEdge")||(0,rg.each)(e.getEdges(),function(e){t.updateOneEdgeKeyShape(e,n)}),(0,rg.each)(e.getNodes(),function(e){t.updateOneNodeDelegateShape(e,n)});var o=e.getCombos();if(o&&o.length){var i=n.find(function(t){return"comboGroup"===t.get("name")})||n.addGroup({name:"comboGroup"});setTimeout(function(){t.destroyed||((0,rg.each)(o,function(e){t.updateOneComboKeyShape(e,i)}),null===i||void 0===i||i.sort(),null===i||void 0===i||i.toBack(),t.updateCanvas())},250)}this.clearDestroyedShapes()},e.prototype.clearDestroyedShapes=function(){var t=this.get("itemMap")||{},e=Object.keys(t);if(e&&0!==e.length)for(var r=e.length-1;r>=0;r--){var n=t[e[r]],o=n.exist;n.exist=!1,o||(n.remove(),delete t[e[r]])}},e.prototype.updateOneEdgeKeyShape=function(t,e){var r=this.get("itemMap")||{},n=r[t.get("id")];if(n){var o=t.get("keyShape").attr("path");n.attr("path",o)}else n=t.get("keyShape").clone(),e.add(n);t.isVisible()?n.show():n.hide(),n.exist=!0,r[t.get("id")]=n,this.set("itemMap",r)},e.prototype.updateOneNodeDelegateShape=function(t,e){var r=this.get("delegateStyle"),n=this.get("itemMap")||{},o=n[t.get("id")],i=t.getBBox();if(o){var a={x:i.minX,y:i.minY,width:i.width,height:i.height};o.attr(a),o.toFront()}else o=e.addShape("rect",{attrs:AT({x:i.minX,y:i.minY,width:i.width,height:i.height},r),name:"minimap-node-shape"});t.isVisible()?o.show():o.hide(),o.exist=!0,n[t.get("id")]=o,this.set("itemMap",n)},e.prototype.init=function(){this.initContainer(),this.get("graph").on("afterupdateitem",this.handleUpdateCanvas),this.get("graph").on("afteritemstatechange",this.handleUpdateCanvas),this.get("graph").on("afteradditem",this.handleUpdateCanvas),this.get("graph").on("afterremoveitem",this.handleUpdateCanvas),this.get("graph").on("afterrender",this.handleUpdateCanvas),this.get("graph").on("afterlayout",this.handleUpdateCanvas)},e.prototype.initContainer=function(){var t=this.get("graph"),e=this.get("size"),r=this.get("className"),n=this.get("container"),o=_k("
    "));(0,rg.isString)(n)&&(n=document.getElementById(n)),n?n.appendChild(o):t.get("container").appendChild(o),this.set("container",o);var i,a=_k('
    ');o.appendChild(a),a.addEventListener("dragenter",function(t){t.preventDefault()}),a.addEventListener("dragover",function(t){t.preventDefault()}),i="svg"===t.get("renderer")?new xk({container:a,width:e[0],height:e[1]}):new MP({container:a,width:e[0],height:e[1]}),this.set("canvas",i),this.updateCanvas()},e.prototype.updateCanvas=function(){if(!this.destroyed&&this.get("refresh")){var t=this.get("graph");if(!t.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var e=this.get("size"),r=this.get("canvas"),n=this.get("type"),o=this.get("padding");if(!r.destroyed){switch(n){case"default":this.updateGraphShapes();break;case"keyShape":this.updateKeyShapes();break;case"delegate":this.updateDelegateShapes()}var i=r.get("children")[0];if(i){i.resetMatrix();var a=i.getCanvasBBox(),s=t.get("canvas").getCanvasBBox(),u=t.getZoom()||1,l=s.width/u,c=s.height/u;Number.isFinite(a.width)&&(l=MT(a.width,l),c=MT(a.height,c)),l+=2*o,c+=2*o;var f=Math.min(e[0]/l,e[1]/c),h=[1,0,0,0,1,0,0,0,1],p=0,d=0;Number.isFinite(a.minX)&&(p=-a.minX),Number.isFinite(a.minY)&&(d=-a.minY);var y=(e[0]-(l-2*o)*f)/2,v=(e[1]-(c-2*o)*f)/2;h=jT(h,[["t",p,d],["s",f,f],["t",y,v]]),i.setMatrix(h),this.set("ratio",f),this.set("totaldx",y+p*f),this.set("totaldy",v+d*f),this.set("dx",y),this.set("dy",v),this.updateViewport()}}}}},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t;null===(t=this.get("canvas"))||void 0===t||t.destroy();var e=this.get("container");(null===e||void 0===e?void 0:e.parentNode)&&e.parentNode.removeChild(e)},e}(ST),NT=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function LT(t,e,r){var n=t.x-e.x,o=t.y-e.y;return!r||Math.abs(n)>r||Math.abs(o)>r?Math.sqrt(n*n+o*o):r}function RT(t,e){var r=(e.source.y-e.target.y)/(e.source.x-e.target.x),n=(r*r*e.source.x+r*(t.y-e.source.y)+t.x)/(r*r+1);return{x:n,y:r*(n-e.source.x)+e.source.y}}var DT=function(t){function e(e){return t.call(this,e)||this}return NT(e,t),e.prototype.getDefaultCfgs=function(){return{edgeBundles:[],edgePoints:[],K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:.6666667,bundleThreshold:.6,eps:1e-6,onLayoutEnd:function(){},onTick:function(){}}},e.prototype.init=function(){var t=this.get("graph"),e=this.get("onTick");this.set("tick",function(){e&&e(),t.refreshPositions()})},e.prototype.bundling=function(t){var e=this;if(e.set("data",t),!e.isTicking()){var r=t.edges||[],n={},o=!1;if((t.nodes||[]).forEach(function(t){null!==t.x&&null!==!t.y&&void 0!==t.x&&void 0!==!t.y||(o=!0),n[t.id]=t}),o)throw new Error("please layout the graph or assign x and y for nodes first");e.set("nodeIdMap",n);var i=e.get("divisions"),a=e.get("divRate"),s=e.divideEdges(i);e.set("edgePoints",s);var u=e.getEdgeBundles();e.set("edgeBundles",u);for(var l=e.get("cycles"),c=e.get("iterations"),f=e.get("iterRate"),h=e.get("lambda"),p=0;pc;){var n=c/r,a={x:o[i][e-1].x,y:o[i][e-1].y};a.x+=n*(t.x-o[i][e-1].x),a.y+=n*(t.y-o[i][e-1].y),f.push(a),r-=c,c=l}c-=r}}),f.push({x:u.x,y:u.y}),o[i]=f}}),o},e.prototype.getEdgeLength=function(t){var e=0;return t.forEach(function(r,n){0!==n&&(e+=LT(r,t[n-1]))}),e},e.prototype.getEdgeBundles=function(){var t=this,e=t.get("data").edges||[],r=t.get("bundleThreshold"),n=t.get("nodeIdMap"),o=t.get("edgeBundles");return o||(o=[]),e.forEach(function(t,e){o[e]&&void 0!==o[e]||(o[e]=[])}),e.forEach(function(i,a){var s=n[i.source],u=n[i.target];e.forEach(function(e,i){if(!(i<=a)){var l=n[e.source],c=n[e.target];t.getBundleScore({source:s,target:u},{source:l,target:c})>=r&&(o[a].push(i),o[i].push(a))}})}),o},e.prototype.getBundleScore=function(t,e){return t.vx=t.target.x-t.source.x,t.vy=t.target.y-t.source.y,e.vx=e.target.x-e.source.x,e.vy=e.target.y-e.source.y,t.length=LT({x:t.source.x,y:t.source.y},{x:t.target.x,y:t.target.y}),e.length=LT({x:e.source.x,y:e.source.y},{x:e.target.x,y:e.target.y}),this.getAngleScore(t,e)*this.getScaleScore(t,e)*this.getPositionScore(t,e)*this.getVisibilityScore(t,e)},e.prototype.getAngleScore=function(t,e){return function(t,e){return t.x*e.x+t.y*e.y}({x:t.vx,y:t.vy},{x:e.vx,y:e.vy})/(t.length*e.length)},e.prototype.getScaleScore=function(t,e){var r=(t.length+e.length)/2;return 2/(r/Math.min(t.length,e.length)+Math.max(t.length,e.length)/r)},e.prototype.getPositionScore=function(t,e){var r=(t.length+e.length)/2;return r/(r+LT({x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2},{x:(e.source.x+e.target.x)/2,y:(e.source.y+e.target.y)/2}))},e.prototype.getVisibilityScore=function(t,e){var r=this.getEdgeVisibility(t,e),n=this.getEdgeVisibility(e,t);return rr||Math.abs(a.y)>r){var s=1/LT(o[n][t],o[e][t]);i.x+=a.x*s,i.y+=a.y*s}}),i},e.prototype.isTicking=function(){return this.get("ticking")},e.prototype.getSimulation=function(){return this.get("forceSimulation")},e.prototype.destroy=function(){this.get("ticking")&&this.getSimulation().stop(),t.prototype.destroy.call(this)},e}(ST),BT=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),FT=function(){return(FT=Object.assign||function(t){for(var e,r=1,n=arguments.length;r(i||r.get("height"))&&e>1||s<(a||.05*r.get("height"))&&e<1)&&(e=1),s*=e,this.set("r",s),this.set("r2",s*s);var u=this.get("d");this.set("molecularParam",(u+1)*s),this.set("delegateCenterDiff",void 0),this.magnify(t,o)}},e.prototype.scaleRByDrag=function(t){if(t){var e,r=this.get("dragPrePos"),n=this.get("graph"),o=n.getPointByClient(t.clientX,t.clientY);e=t.x-r.x<0?.95:1/.95;var i=this.get("maxR"),a=this.get("minR"),s=this.get("r");(s>(i||n.get("height"))&&e>1||s<(a||.05*n.get("height"))&&e<1)&&(e=1),s*=e,this.set("r",s),this.set("r2",s*s);var u=this.get("d");this.set("molecularParam",(u+1)*s),this.magnify(t,o),this.set("dragPrePos",{x:t.x,y:t.y})}},e.prototype.scaleDByWheel=function(t){if(t||t.originalEvent){t.preventDefault&&t.preventDefault();var e=0;e=t.originalEvent.wheelDelta<0?-.1:.1;var r=this.get("d")+e,n=this.get("maxD"),o=this.get("minD");if(ro){this.set("d",r);var i=this.get("r");this.set("molecularParam",(r+1)*i);var a=this.get("delegate"),s=a?{x:a.attr("x"),y:a.attr("y")}:void 0;this.set("delegateCenterDiff",void 0),this.magnify(t,s)}}},e.prototype.scaleDByDrag=function(t){var e=this.get("dragPrePos"),r=t.x-e.x>0?.1:-.1,n=this.get("d")+r,o=this.get("maxD"),i=this.get("minD");if(ni){this.set("d",n);var a=this.get("r");this.set("molecularParam",(n+1)*a),this.magnify(t)}this.set("dragPrePos",{x:t.x,y:t.y})},e.prototype.magnify=function(t,e){this.restoreCache();var r=this.get("graph"),n=this.get("cachedMagnifiedModels"),o=this.get("cachedOriginPositions"),i=this.get("showLabel"),a=this.get("r"),s=this.get("r2"),u=this.get("d"),l=this.get("molecularParam"),c=r.getNodes(),f=c.length,h=e?{x:e.x,y:e.y}:{x:t.x,y:t.y};!this.get("dragging")||"mousemove"!==this.get("trigger")&&"click"!==this.get("trigger")||(h=this.get("cacheCenter"));var p=this.get("delegateCenterDiff");p&&(h.x+=p.x,h.y+=p.y),this.updateDelegate(h,a);for(var d=0;d\n
  • \n \n \n \n
  • \n
  • \n \n \n \n
  • \n
  • \n \n \n \n
  • \n
  • \n \n \n \n
  • \n
  • \n \n \n \n
  • \n
  • \n \n \n \n
  • \n \n '},zoomSensitivity:2}},e.prototype.init=function(){var t=this,e=this.get("graph"),r=this.get("getContent")(e),n=r;(0,rg.isString)(r)&&(n=_k(r));var o=this.get("className");n.setAttribute("class",o||"g6-component-toolbar");var i=this.get("container");i||(i=this.get("graph").get("container")),(0,rg.isString)(i)&&(i=document.getElementById(i)),i.appendChild(n),this.set("toolBar",n);var a=this.get("handleClick");n.addEventListener("click",function(r){var n=function(t){if(!t)return[];if(t.composedPath)return t.composedPath();for(var e=[],r=t.target;r;){if(e.push(r),"HTML"===r.tagName)return e.push(document,window),e;r=r.parentElement}return e}(r).filter(function(t){return"LI"===t.nodeName});if(0!==n.length){var o=n[0].getAttribute("code");o&&(a?a(o,e):t.handleDefaultOperator(o))}});var s=this.get("position");s&&wT(n,{top:"".concat(s.y,"px"),left:"".concat(s.x,"px")}),this.bindUndoRedo()},e.prototype.bindUndoRedo=function(){var t=this.get("graph"),e=document.querySelector('.g6-component-toolbar li[code="undo"]'),r=document.querySelector('.g6-component-toolbar li[code="undo"] svg'),n=document.querySelector('.g6-component-toolbar li[code="redo"]'),o=document.querySelector('.g6-component-toolbar li[code="redo"] svg');e&&r&&n&&o&&(e.setAttribute("style","cursor: not-allowed"),r.setAttribute("style","opacity: 0.4"),n.setAttribute("style","cursor: not-allowed"),o.setAttribute("style","opacity: 0.4"),t.on("stackchange",function(t){var i=t.undoStack,a=t.redoStack,s=i.length,u=a.length;0===s?(e.setAttribute("style","cursor: not-allowed"),r.setAttribute("style","opacity: 0.4")):(e.removeAttribute("style"),r.removeAttribute("style")),0===u?(n.setAttribute("style","cursor: not-allowed"),o.setAttribute("style","opacity: 0.4")):(n.removeAttribute("style"),o.removeAttribute("style"))}))},e.prototype.undo=function(){var t=this.get("graph"),e=t.getUndoStack();if(e&&0!==e.length){var r=e.pop();if(r){var n=r.action;t.pushStack(n,(0,rg.clone)(r.data),"redo");var o=r.data.before;if("add"===n&&(o=r.data.after),!o)return;switch(n){case"visible":Object.keys(o).forEach(function(e){var r=o[e];r&&r.forEach(function(e){var r=t.findById(e.id);e.visible?t.showItem(r,!1):t.hideItem(r,!1)})});break;case"render":case"update":Object.keys(o).forEach(function(e){var r=o[e];r&&r.forEach(function(e){var r=t.findById(e.id);delete e.id,t.updateItem(r,e,!1),"combo"===r.getType()&&t.updateCombo(r)})});break;case"changedata":t.changeData(o,!1);break;case"delete":Object.keys(o).forEach(function(e){var r=o[e];r&&r.forEach(function(e){var r=e.itemType;delete e.itemType,t.addItem(r,e,!1)})});break;case"add":Object.keys(o).forEach(function(e){var r=o[e];r&&r.forEach(function(e){t.removeItem(e.id,!1)})});break;case"updateComboTree":Object.keys(o).forEach(function(e){var r=o[e];r&&r.forEach(function(e){t.updateComboTree(e.id,e.parentId,!1)})});break;case"createCombo":var i=r.data.after.combos,a=i[i.length-1];Object.keys(o).forEach(function(e){var r=o[e];r&&r.forEach(function(e){t.updateComboTree(e.id,e.parentId,!1)})}),t.removeItem(a.id,!1);break;case"uncombo":var s=o.combos[o.combos.length-1],u=o.nodes.concat(o.combos).map(function(t){return t.id}).filter(function(t){return t!==s.id});t.createCombo(s,u,!1);break;case"layout":t.updateLayout(o,void 0,void 0,!1)}}}},e.prototype.redo=function(){var t=this.get("graph"),e=t.getRedoStack();if(e&&0!==e.length){var r=e.pop();if(r){var n=r.action,o=r.data.after;if(t.pushStack(n,(0,rg.clone)(r.data)),"delete"===n&&(o=r.data.before),!o)return;switch(n){case"visible":Object.keys(o).forEach(function(e){var r=o[e];r&&r.forEach(function(e){var r=t.findById(e.id);e.visible?t.showItem(r,!1):t.hideItem(r,!1)})});break;case"render":case"update":Object.keys(o).forEach(function(e){var r=o[e];r&&r.forEach(function(e){var r=t.findById(e.id);delete e.id,t.updateItem(r,e,!1),"combo"===r.getType()&&t.updateCombo(r)})});break;case"changedata":t.changeData(o,!1);break;case"delete":o.edges&&o.edges.forEach(function(e){t.removeItem(e.id,!1)}),o.nodes&&o.nodes.forEach(function(e){t.removeItem(e.id,!1)}),o.combos&&o.combos.forEach(function(e){t.removeItem(e.id,!1)});break;case"add":Object.keys(o).forEach(function(e){var r=o[e];r&&r.forEach(function(e){var r=e.itemType;delete e.itemType,t.addItem(r,e,!1)})});break;case"updateComboTree":Object.keys(o).forEach(function(e){var r=o[e];r&&r.forEach(function(e){t.updateComboTree(e.id,e.parentId,!1)})});break;case"createCombo":var i=o.combos[o.combos.length-1];t.createCombo(i,i.children.map(function(t){return t.id}),!1);break;case"uncombo":var a=r.data.before.combos,s=a[a.length-1];t.uncombo(s.id,!1);break;case"layout":t.updateLayout(o,void 0,void 0,!1)}}}},e.prototype.zoomOut=function(){var t=this.get("graph"),e=t.getZoom(),r=1/(1-.05*this.get("zoomSensitivity"));r*e>(this.get("maxZoom")||t.get("maxZoom"))||t.zoomTo(e*r)},e.prototype.zoomIn=function(){var t=this.get("graph"),e=t.getZoom(),r=1-.05*this.get("zoomSensitivity");r*e<(this.get("minZoom")||t.get("minZoom"))||t.zoomTo(e*r)},e.prototype.realZoom=function(){this.get("graph").zoomTo(1)},e.prototype.autoZoom=function(){this.get("graph").fitView([20,20])},e.prototype.handleDefaultOperator=function(t){switch(t){case"redo":this.redo();break;case"undo":this.undo();break;case"zoomOut":this.zoomOut();break;case"zoomIn":this.zoomIn();break;case"realZoom":this.realZoom();break;case"autoZoom":this.autoZoom()}},e.prototype.destroy=function(){var t=this.get("toolBar");if(t){var e=this.get("container");e||(e=this.get("graph").get("container")),(0,rg.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}var r=this.get("handleClick");r&&t.removeEventListener("click",r)},e}(ST),HT=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();"undefined"!=typeof document&&PT()("\n .g6-component-tooltip {\n border: 1px solid #e2e2e2;\n border-radius: 4px;\n font-size: 12px;\n color: #545454;\n background-color: rgba(255, 255, 255, 0.9);\n padding: 10px 8px;\n box-shadow: rgb(174, 174, 174) 0px 0px 10px;\n }\n .tooltip-type {\n padding: 0;\n margin: 0;\n }\n .tooltip-id {\n color: #531dab;\n }\n");var qT=function(t){function e(e){return t.call(this,e)||this}return HT(e,t),e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,getContent:function(t){return"\n

    类型:".concat(t.item.getType(),"

    \n ID:").concat(t.item.getID(),"\n ")},shouldBegin:function(t){return!0},itemTypes:["node","edge","combo"],trigger:"mouseenter",fixToNode:void 0}},e.prototype.getEvents=function(){return"click"===this.get("trigger")?{"node:click":"onClick","edge:click":"onClick","combo:click":"onClick","canvas:click":"onMouseLeave",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave",drag:"onMouseLeave"}:{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove","edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove","combo:mouseenter":"onMouseEnter","combo:mouseleave":"onMouseLeave","combo:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave","node:drag":"onMouseLeave"}},e.prototype.init=function(){var t=this,e=t.get("className")||"g6-component-tooltip",r=_k("
    ")),n=t.get("container");n||(n=t.get("graph").get("container")),(0,rg.isString)(n)&&(n=document.getElementById(n)),wT(r,{position:"absolute",visibility:"hidden",display:"none"}),n.appendChild(r),"click"!==t.get("trigger")&&(r.addEventListener("mouseenter",function(t){wT(r,{visibility:"visible",display:"unset"})}),r.addEventListener("mouseleave",function(e){t.hideTooltip()})),t.set("tooltip",r)},e.prototype.onClick=function(t){var e=this.get("itemTypes");if(!t.item||!t.item.getType||-1!==e.indexOf(t.item.getType())){var r=t.item,n=this.get("graph");this.currentTarget===r?(this.currentTarget=null,this.hideTooltip(),n.emit("tooltipchange",{item:t.item,action:"hide"})):(this.currentTarget=r,this.showTooltip(t),n.emit("tooltipchange",{item:t.item,action:"show"}))}},e.prototype.onMouseEnter=function(t){var e=this.get("itemTypes");if(!t.item||!t.item.getType||-1!==e.indexOf(t.item.getType())){var r=t.item,n=this.get("graph");this.currentTarget=r,this.showTooltip(t),n.emit("tooltipchange",{item:t.item,action:"show"})}},e.prototype.onMouseMove=function(t){var e=this.get("itemTypes");t.item&&t.item.getType&&-1===e.indexOf(t.item.getType())||this.currentTarget&&t.item===this.currentTarget&&this.showTooltip(t)},e.prototype.onMouseLeave=function(){this.hideTooltip(),this.get("graph").emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null},e.prototype.clearContainer=function(){var t=this.get("tooltip");t&&(t.innerHTML="")},e.prototype.showTooltip=function(t){if(t.item){var e=this.get("itemTypes");if(!t.item.getType||-1!==e.indexOf(t.item.getType())){var r=this.get("tooltip"),n=this.get("getContent")(t);(0,rg.isString)(n)?r.innerHTML=n:(this.clearContainer(),r.appendChild(n)),this.updatePosition(t)}}},e.prototype.hideTooltip=function(){var t=this.get("tooltip");t&&wT(t,{visibility:"hidden",display:"none"})},e.prototype.updatePosition=function(t){var e=this.get("shouldBegin"),r=this.get("tooltip");if(e(t)){var n=this.get("graph"),o=n.get("width"),i=n.get("height"),a=this.get("offsetX")||0,s=this.get("offsetY")||0,u=n.getPointByClient(t.clientX,t.clientY),l=this.get("fixToNode"),c=t.item;if(c.getType&&"node"===c.getType()&&l&&(0,rg.isArray)(l)&&l.length>=2){var f=c.getBBox();u={x:f.minX+f.width*l[0],y:f.minY+f.height*l[1]}}var h=n.getCanvasByPoint(u.x,u.y),p=h.x,d=h.y,y=n.getContainer(),v={x:p+y.offsetLeft+a,y:d+y.offsetTop+s};wT(r,{visibility:"visible",display:"unset"});var g=r.getBoundingClientRect();p+g.width+a>o&&(v.x-=g.width+a),d+g.height+s>i&&(v.y-=g.height+s,v.y<0&&(v.y=0)),wT(r,{left:"".concat(v.x,"px"),top:"".concat(v.y,"px")})}else wT(r,{visibility:"hidden",display:"none"})},e.prototype.hide=function(){this.onMouseLeave()},e.prototype.destroy=function(){var t=this.get("tooltip");if(t){var e=this.get("container");e||(e=this.get("graph").get("container")),(0,rg.isString)(e)&&(e=document.getElementById(e)),e.removeChild(t)}},e}(ST),WT=function(){function t(t){var e=t.x,r=void 0===e?0:e,n=t.y,o=void 0===n?0:n,i=t.container,a=t.text,s=t.padding,u=void 0===s?[4,4,4,4]:s,l=t.className,c=void 0===l?"g6-component-timebar-tooltip":l,f=t.backgroundColor,h=void 0===f?"#000":f,p=t.textColor,d=void 0===p?"#fff":p,y=t.opacity,v=void 0===y?.8:y,g=t.fontSize,m=void 0===g?12:g;this.container=i,this.className=c,this.backgroundColor=h,this.textColor=d,this.x=r,this.y=o,this.text=a,this.padding=u,this.opacity=v,this.fontSize=m,this.render()}return t.prototype.render=function(){var t=this.className,e=(this.x,this.y,this.backgroundColor),r=this.textColor,n=this.text,o=this.padding,i=this.opacity,a=this.fontSize,s=this.container,u=_k("
    '));(0,rg.isString)(s)&&(s=document.getElementById(s)),s.appendChild(u),this.parentHeight=s.offsetHeight,this.parentWidth=s.offsetWidth,wT(u,{visibility:"hidden",top:0,left:0});var l=_k("\n
    "));l.innerHTML=n,u.appendChild(l),this.backgroundDOM=l;var c=_k("
    "));u.appendChild(c),this.arrowDOM=c,this.container=u},t.prototype.show=function(t){var e=t.text,r=t.x;t.y,t.clientX,t.clientY;this.backgroundDOM.innerHTML=e;var n=this.backgroundDOM.offsetWidth,o=this.backgroundDOM.offsetHeight,i=this.arrowDOM.offsetWidth,a=this.arrowDOM.offsetHeight;wT(this.container,{top:"".concat(-o-a,"px"),left:"".concat(r,"px"),visibility:"visible"}),wT(this.backgroundDOM,{marginLeft:"".concat(-n/2,"px")}),wT(this.arrowDOM,{marginLeft:"".concat(-i/2,"px"),top:"".concat(o,"px")});var s=r-n/2,u=r+n/2;s<0?wT(this.backgroundDOM,{marginLeft:"".concat(-n/2-s,"px")}):u>this.parentWidth&&wT(this.backgroundDOM,{marginLeft:"".concat(-n/2-u+this.parentWidth+12,"px")})},t.prototype.hide=function(){wT(this.container,{top:0,left:0,visibility:"hidden"})},t}(),YT=function(){return(YT=Object.assign||function(t){for(var e,r=1,n=arguments.length;rr&&(i=r,o=e)})}o=e.originalEvent.deltaY>0?Math.max(0,o-1):Math.min(t.speedAxisY.length-1,o+1);var a=t.speedAxisY[o]-n;r=KT(r,[["t",0,a]]),t.speedPoint.setMatrix(r),t.currentSpeed=t.speedAxisY.length-o,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit("timebarConfigChanged",{speed:t.currentSpeed,type:t.currentType})}),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",function(e){var r,n,o=e.target.get("isChecked");o?(t.checkedIcon.hide(),t.checkedText.attr("text",(null===(n=t.controllerCfg)||void 0===n?void 0:n.timePointControllerText)||"单一时间"),t.currentType=nA.RANGE):(t.checkedIcon.show(),t.checkedText.attr("text",(null===(r=t.controllerCfg)||void 0===r?void 0:r.timeRangeControllerText)||"时间范围"),t.currentType=nA.SINGLE),e.target.set("isChecked",!o),t.group.emit("timebarConfigChanged",{type:t.currentType,speed:t.currentSpeed})})},t.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},t}(),iA=function(){return(iA=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=b&&n<=w?l:c,a=v.addShape("rect",{attrs:iA({x:o+n*(y+2),y:o,width:y,height:p},i),draggable:!0,name:"tick-rect-".concat(n)}),s=v.addShape("rect",{attrs:{x:o+n*y+2*(2*n-1)/2,y:o,width:0===n||n===d-1?y+1:y+2,height:p,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(n)});s.toFront();var h,x=a.getBBox(),_=(x.minX+x.maxX)/2;if(g.push({rect:a,pickRect:s,value:e.date,x:_,y:x.minY}),u?(h=u(e),!(0,rg.isString)(h)&&h&&(h=e.date)):n%Math.round(d/10)==0&&(h=e.date),h){m.push(h);var E=x.maxY+2*o;v.addShape("line",{attrs:{stroke:"#BFBFBF",x1:_,y1:E,x2:_,y2:E+4},name:"tick-line"});var O=E+4+o,P=v.addShape("text",{attrs:iA({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:_,y:O,textAlign:"center",text:h,textBaseline:"top",fontSize:10,fontFamily:t.fontFamily||"Arial, sans-serif"},f),capture:!1,name:"tick-label"}),k=P.getBBox();if(k.maxX>r?P.attr("textAlign","right"):k.minX<0&&P.attr("textAlign","left"),(0,rg.isNumber)(S)&&10!==m.length){var C=aA([1,0,0,0,1,0,0,0,1],[["t",-_,-O],["r",S],["t",_-5,O+2]]);P.attr({textAlign:"left",matrix:C})}1===m.length?P.attr({textAlign:"left"}):10===m.length&&P.attr({textAlign:"right"})}}),this.tickRects=g;var x=this.group;this.currentSpeed=1,this.controllerBtnGroup=new oA(iA({group:x,x:this.x,y:this.y+n+5,width:r,height:40,hideTimeTypeController:!0,speed:this.currentSpeed,fontFamily:this.fontFamily||"Arial, sans-serif"},this.controllerCfg))},t.prototype.initEvent=function(){var t=this,e=this.sliceGroup;e.on("click",function(e){var r=e.target;if("rect"===r.get("type")&&r.get("name")){var n=parseInt(r.get("name").split("-")[2],10);if(!isNaN(n)){var o=t.tickRects,i=t.unselectedTickStyle;o.forEach(function(t){t.rect.attr(i)});var a=t.selectedTickStyle;o[n].rect.attr(a),t.startTickRectId=n,t.endTickRectId=n;var s=n/o.length;t.graph.emit("valuechange",{value:[s,s]})}}}),e.on("dragstart",function(e){var r=t.tickRects,n=t.unselectedTickStyle;r.forEach(function(t){t.rect.attr(n)});var o=e.target,i=parseInt(o.get("name").split("-")[2],10),a=t.selectedTickStyle;r[i].rect.attr(a),t.startTickRectId=i;var s=i/r.length;t.graph.emit("valuechange",{value:[s,s]}),t.dragging=!0}),e.on("dragover",function(e){if(t.dragging&&"rect"===e.target.get("type")){for(var r=parseInt(e.target.get("name").split("-")[2],10),n=t.startTickRectId,o=t.tickRects,i=t.selectedTickStyle,a=t.unselectedTickStyle,s=0;s=n&&s<=r?i:a;o[s].rect.attr(u)}var l=o.length;t.endTickRectId=r;var c=n/l,f=r/l;t.graph.emit("valuechange",{value:[c,f]})}}),e.on("drop",function(e){if(t.dragging&&(t.dragging=!1,"rect"===e.target.get("type"))){var r=t.startTickRectId,n=parseInt(e.target.get("name").split("-")[2],10);if(!(n0?this.endTickRectId++:(e[this.endTickRectId].rect.attr(n),this.endTickRectId--),i!==this.startTickRectId)this.endTickRectIdthis.max?NaN:this.values[n]},e.prototype.getText=function(e){for(var r=[],n=1;n1?t-1:t}this.translateIndexMap&&(this.translateIndexMap=void 0)},e}(hA),dA=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,yA="[^\\s]+",vA=/\[([^]*?)\]/gm;function gA(t,e){for(var r=[],n=0,o=t.length;n-1?n:null}};function bA(t){for(var e=[],r=1;r3?0:(t-t%10!=10?1:0)*t%10]}},EA=bA({},_A),OA=function(t){return EA=bA(EA,t)},PA=function(t){return t.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},kA=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length0?"-":"+")+kA(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+kA(Math.floor(Math.abs(e)/60),2)+":"+kA(Math.abs(e)%60,2)}},TA=function(t){return+t-1},AA=[null,"\\d\\d?"],MA=[null,yA],jA=["isPm",yA,function(t,e){var r=t.toLowerCase();return r===e.amPm[0]?0:r===e.amPm[1]?1:null}],IA=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var e=(t+"").match(/([+-]|\d\d)/gi);if(e){var r=60*+e[1]+parseInt(e[2],10);return"+"===e[0]?r:-r}return 0}],NA={D:["day","\\d\\d?"],DD:["day","\\d\\d"],Do:["day","\\d\\d?"+yA,function(t){return parseInt(t,10)}],M:["month","\\d\\d?",TA],MM:["month","\\d\\d",TA],YY:["year","\\d\\d",function(t){var e=+(""+(new Date).getFullYear()).substr(0,2);return+(""+(+t>68?e-1:e)+t)}],h:["hour","\\d\\d?",void 0,"isPm"],hh:["hour","\\d\\d",void 0,"isPm"],H:["hour","\\d\\d?"],HH:["hour","\\d\\d"],m:["minute","\\d\\d?"],mm:["minute","\\d\\d"],s:["second","\\d\\d?"],ss:["second","\\d\\d"],YYYY:["year","\\d{4}"],S:["millisecond","\\d",function(t){return 100*+t}],SS:["millisecond","\\d\\d",function(t){return 10*+t}],SSS:["millisecond","\\d{3}"],d:AA,dd:AA,ddd:MA,dddd:MA,MMM:["month",yA,mA("monthNamesShort")],MMMM:["month",yA,mA("monthNames")],a:jA,A:jA,ZZ:IA,Z:IA},LA={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},RA=function(t){return bA(LA,t)},DA=function(t,e,r){if(void 0===e&&(e=LA.default),void 0===r&&(r={}),"number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");var n=[];e=(e=LA[e]||e).replace(vA,function(t,e){return n.push(e),"@@@"});var o=bA(bA({},EA),r);return(e=e.replace(dA,function(e){return CA[e](t,o)})).replace(/@@@/g,function(){return n.shift()})};function BA(t,e,r){if(void 0===r&&(r={}),"string"!=typeof e)throw new Error("Invalid format in fecha parse");if(e=LA[e]||e,t.length>1e3)return null;var n={year:(new Date).getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},o=[],i=[],a=e.replace(vA,function(t,e){return i.push(PA(e)),"@@@"}),s={},u={};a=PA(a).replace(dA,function(t){var e=NA[t],r=e[0],n=e[1],i=e[3];if(s[r])throw new Error("Invalid format. "+r+" specified twice in format");return s[r]=!0,i&&(u[i]=!0),o.push(e),"("+n+")"}),Object.keys(u).forEach(function(t){if(!s[t])throw new Error("Invalid format. "+t+" is required in specified format")}),a=a.replace(/@@@/g,function(){return i.shift()});var l=t.match(new RegExp(a,"i"));if(!l)return null;for(var c,f=bA(bA({},EA),r),h=1;h11||n.month<0||n.day>31||n.day<1||n.hour>23||n.hour<0||n.minute>59||n.minute<0||n.second>59||n.second<0)return null;return c}var FA={format:DA,parse:BA,defaultI18n:_A,setGlobalDateI18n:OA,setGlobalDateMasks:RA};var GA="format";function UA(t,e){return(m[GA]||FA[GA])(t,e)}function zA(t){return(0,rg.isString)(t)&&(t=t.indexOf("T")>0?new Date(t).getTime():new Date(t.replace(/-/gi,"/")).getTime()),(0,rg.isDate)(t)&&(t=t.getTime()),t}var VA=1e3,HA=60*VA,qA=60*HA,WA=24*qA,YA=31*WA,XA=365*WA,JA=[["HH:mm:ss",VA],["HH:mm:ss",10*VA],["HH:mm:ss",30*VA],["HH:mm",HA],["HH:mm",10*HA],["HH:mm",30*HA],["HH",qA],["HH",6*qA],["HH",12*qA],["YYYY-MM-DD",WA],["YYYY-MM-DD",4*WA],["YYYY-WW",7*WA],["YYYY-MM",YA],["YYYY-MM",4*YA],["YYYY-MM",6*YA],["YYYY",380*WA]];function KA(t,e,r){var n,o=(n=function(t){return t[1]},function(t,e,r,o){for(var i=(0,rg.isNil)(r)?0:r,a=(0,rg.isNil)(o)?t.length:o;i>>1;n(t[s])>e?a=s:i=s+1}return i})(JA,(e-t)/r)-1,i=JA[o];return o<0?i=JA[0]:o>=JA.length&&(i=(0,rg.last)(JA)),i}var QA=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="timeCat",e}return(0,eg.__extends)(e,t),e.prototype.translate=function(t){t=zA(t);var e=this.values.indexOf(t);return-1===e&&(e=(0,rg.isNumber)(t)&&t-1){var n=this.values[r],o=this.formatter;return n=o?o(n,e):UA(n,this.mask)}return t},e.prototype.initCfg=function(){this.tickMethod="time-cat",this.mask="YYYY-MM-DD",this.tickCount=7},e.prototype.setDomain=function(){var e=this.values;(0,rg.each)(e,function(t,r){e[r]=zA(t)}),e.sort(function(t,e){return t-e}),t.prototype.setDomain.call(this)},e}(pA),ZA=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isContinuous=!0,e}return(0,eg.__extends)(e,t),e.prototype.scale=function(t){if((0,rg.isNil)(t))return NaN;var e=this.rangeMin(),r=this.rangeMax();return this.max===this.min?e:e+this.getScalePercent(t)*(r-e)},e.prototype.init=function(){t.prototype.init.call(this);var e=this.ticks,r=(0,rg.head)(e),n=(0,rg.last)(e);rthis.max&&(this.max=n),(0,rg.isNil)(this.minLimit)||(this.min=r),(0,rg.isNil)(this.maxLimit)||(this.max=n)},e.prototype.setDomain=function(){var t=(0,rg.getRange)(this.values),e=t.min,r=t.max;(0,rg.isNil)(this.min)&&(this.min=e),(0,rg.isNil)(this.max)&&(this.max=r),this.min>this.max&&(this.min=e,this.max=r)},e.prototype.calculateTicks=function(){var e=this,r=t.prototype.calculateTicks.call(this);return this.nice||(r=(0,rg.filter)(r,function(t){return t>=e.min&&t<=e.max})),r},e.prototype.getScalePercent=function(t){var e=this.max,r=this.min;return(t-r)/(e-r)},e.prototype.getInvertPercent=function(t){return(t-this.rangeMin())/(this.rangeMax()-this.rangeMin())},e}(hA),$A=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="linear",e.isLinear=!0,e}return(0,eg.__extends)(e,t),e.prototype.invert=function(t){var e=this.getInvertPercent(t);return this.min+e*(this.max-this.min)},e.prototype.initCfg=function(){this.tickMethod="wilkinson-extended",this.nice=!1},e}(ZA);function tM(t,e){var r=Math.E;return e>=0?Math.pow(r,Math.log(e)/t):-1*Math.pow(r,Math.log(-e)/t)}function eM(t,e){return 1===t?1:Math.log(e)/Math.log(t)}function rM(t,e,r){(0,rg.isNil)(r)&&(r=Math.max.apply(null,t));var n=r;return(0,rg.each)(t,function(t){t>0&&t1&&(n=1),n}var nM=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e}return(0,eg.__extends)(e,t),e.prototype.invert=function(t){var e,r=this.base,n=eM(r,this.max),o=this.rangeMin(),i=this.rangeMax()-o,a=this.positiveMin;if(a){if(0===t)return 0;var s=1/(n-(e=eM(r,a/r)))*i;if(t=0?1:-1;return Math.pow(i,r)*a},e.prototype.initCfg=function(){this.tickMethod="pow",this.exponent=2,this.tickCount=5,this.nice=!0},e.prototype.getScalePercent=function(t){var e=this.max,r=this.min;if(e===r)return 0;var n=this.exponent;return(tM(n,t)-tM(n,r))/(tM(n,e)-tM(n,r))},e}(ZA),iM=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="time",e}return(0,eg.__extends)(e,t),e.prototype.getText=function(t,e){var r=this.translate(t),n=this.formatter;return n?n(r,e):UA(r,this.mask)},e.prototype.scale=function(e){var r=e;return((0,rg.isString)(r)||(0,rg.isDate)(r))&&(r=this.translate(r)),t.prototype.scale.call(this,r)},e.prototype.translate=function(t){return zA(t)},e.prototype.initCfg=function(){this.tickMethod="time-pretty",this.mask="YYYY-MM-DD",this.tickCount=7,this.nice=!1},e.prototype.setDomain=function(){var t=this.values,e=this.getConfig("min"),r=this.getConfig("max");if((0,rg.isNil)(e)&&(0,rg.isNumber)(e)||(this.min=this.translate(this.min)),(0,rg.isNil)(r)&&(0,rg.isNumber)(r)||(this.max=this.translate(this.max)),t&&t.length){var n=[],o=1/0,i=o,a=0;(0,rg.each)(t,function(t){var e=zA(t);if(isNaN(e))throw new TypeError("Invalid Time: "+t+" in time scale!");o>e?(i=o,o=e):i>e&&(i=e),a1&&(this.minTickInterval=i-o),(0,rg.isNil)(e)&&(this.min=o),(0,rg.isNil)(r)&&(this.max=a)}},e}($A),aM=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="quantize",e}return(0,eg.__extends)(e,t),e.prototype.invert=function(t){var e=this.ticks,r=e.length,n=this.getInvertPercent(t),o=Math.floor(n*(r-1));if(o>=r-1)return(0,rg.last)(e);if(o<0)return(0,rg.head)(e);var i=e[o],a=o/(r-1);return i+(n-a)/((o+1)/(r-1)-a)*(e[o+1]-i)},e.prototype.initCfg=function(){this.tickMethod="r-pretty",this.tickCount=5,this.nice=!0},e.prototype.calculateTicks=function(){var e=t.prototype.calculateTicks.call(this);return this.nice||((0,rg.last)(e)!==this.max&&e.push(this.max),(0,rg.head)(e)!==this.min&&e.unshift(this.min)),e},e.prototype.getScalePercent=function(t){var e=this.ticks;if(t<(0,rg.head)(e))return 0;if(t>(0,rg.last)(e))return 1;var r=0;return(0,rg.each)(e,function(e,n){if(!(t>=e))return!1;r=n}),r/(e.length-1)},e}(ZA),sM=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="quantile",e}return(0,eg.__extends)(e,t),e.prototype.initCfg=function(){this.tickMethod="quantile",this.tickCount=5,this.nice=!0},e}(aM),uM={};function lM(t,e){if(function(t){return uM[t]}(t))throw new Error("type '"+t+"' existed.");uM[t]=e}var cM=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="identity",e.isIdentity=!0,e}return(0,eg.__extends)(e,t),e.prototype.calculateTicks=function(){return this.values},e.prototype.scale=function(t){return this.values[0]!==t&&(0,rg.isNumber)(t)?t:this.range[0]},e.prototype.invert=function(t){var e=this.range;return te[1]?NaN:this.values[0]},e}(hA);function fM(t){var e=t.values,r=t.tickInterval,n=t.tickCount,o=t.showLast;if((0,rg.isNumber)(r)){var i=(0,rg.filter)(e,function(t,e){return e%r==0}),a=(0,rg.last)(e);return o&&(0,rg.last)(i)!==a&&i.push(a),i}var s=e.length,u=t.min,l=t.max;if((0,rg.isNil)(u)&&(u=0),(0,rg.isNil)(l)&&(l=e.length-1),!(0,rg.isNumber)(n)||n>=s)return e.slice(u,l+1);if(n<=0||l<=0)return[];for(var c=1===n?s:Math.floor(s/(n-1)),f=[],h=u,p=0;p=l);p++)h=Math.min(u+p*c,l),p===n-1&&o?f.push(e[l]):f.push(e[h]);return f}var hM=Math.sqrt(50),pM=Math.sqrt(10),dM=Math.sqrt(2),yM=function(){function t(){this._domain=[0,1]}return t.prototype.domain=function(t){return t?(this._domain=Array.from(t,Number),this):this._domain.slice()},t.prototype.nice=function(t){var e,r;void 0===t&&(t=5);var n,o=this._domain.slice(),i=0,a=this._domain.length-1,s=this._domain[i],u=this._domain[a];return u0?n=vM(s=Math.floor(s/n)*n,u=Math.ceil(u/n)*n,t):n<0&&(n=vM(s=Math.ceil(s*n)/n,u=Math.floor(u*n)/n,t)),n>0?(o[i]=Math.floor(s/n)*n,o[a]=Math.ceil(u/n)*n,this.domain(o)):n<0&&(o[i]=Math.ceil(s*n)/n,o[a]=Math.floor(u*n)/n,this.domain(o)),this},t.prototype.ticks=function(t){return void 0===t&&(t=5),function(t,e,r){var n,o,i,a,s=-1;if(r=+r,(t=+t)==(e=+e)&&r>0)return[t];(n=e0)for(t=Math.ceil(t/a),e=Math.floor(e/a),i=new Array(o=Math.ceil(e-t+1));++s=0?(i>=hM?10:i>=pM?5:i>=dM?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(i>=hM?10:i>=pM?5:i>=dM?2:1)}function gM(t,e,r){return("ceil"===r?Math.ceil(t/e):"floor"===r?Math.floor(t/e):Math.round(t/e))*e}function mM(t,e,r){var n=gM(t,r,"floor"),o=gM(e,r,"ceil");n=(0,rg.fixedBase)(n,r),o=(0,rg.fixedBase)(o,r);for(var i=[],a=Math.max((o-n)/(Math.pow(2,12)-1),r),s=n;s<=o;s+=a){var u=(0,rg.fixedBase)(s,a);i.push(u)}return{min:n,max:o,ticks:i}}function bM(t,e,r){var n,o=t.minLimit,i=t.maxLimit,a=t.min,s=t.max,u=t.tickCount,l=void 0===u?5:u,c=(0,rg.isNil)(o)?(0,rg.isNil)(e)?a:e:o,f=(0,rg.isNil)(i)?(0,rg.isNil)(r)?s:r:i;if(c>f&&(f=(n=[c,f])[0],c=n[1]),l<=2)return[c,f];for(var h=(f-c)/(l-1),p=[],d=0;d=0&&(u=1),1-s/(a-1)-r+u}function EM(t,e,r){var n=(0,rg.size)(e);return 1-(0,rg.indexOf)(e,t)/(n-1)-r+1}function OM(t,e,r,n,o,i){var a=(t-1)/(i-o),s=(e-1)/(Math.max(i,n)-Math.min(r,o));return 2-Math.max(a/s,s/a)}function PM(t,e){return t>=e?2-(t-1)/(e-1):1}function kM(t,e,r,n){var o=e-t;return 1-.5*(Math.pow(e-n,2)+Math.pow(t-r,2))/Math.pow(.1*o,2)}function CM(t,e,r){var n=e-t;if(r>n){var o=(r-n)/2;return 1-Math.pow(o,2)/Math.pow(.1*n,2)}return 1}function TM(t,e,r,n,o,i){void 0===r&&(r=5),void 0===n&&(n=!0),void 0===o&&(o=SM),void 0===i&&(i=[.25,.2,.5,.05]);var a=r<0?0:Math.round(r);if(Number.isNaN(t)||Number.isNaN(e)||"number"!=typeof t||"number"!=typeof e||!a)return{min:0,max:0,ticks:[]};if(e-t<1e-15||1===a)return{min:t,max:e,ticks:[t]};if(e-t>1e148){var s=(e-t)/(S=r||5);return{min:t,max:e,ticks:Array(S).fill(null).map(function(e,r){return wM(t+s*r)})}}for(var u={score:-2,lmin:0,lmax:0,lstep:0},l=1;l<1/0;){for(var c=0;cu.score&&(!n||_<=t&&E>=e)&&(u.lmin=_,u.lmax=E,u.lstep=O,u.score=T)}v+=1}p+=1}}l+=1}var A=wM(u.lmax),M=wM(u.lmin),j=wM(u.lstep),I=Math.floor(function(t){return Math.round(1e12*t)/1e12}((A-M)/j))+1,N=new Array(I);N[0]=wM(M);for(c=1;c1&&(o*=Math.ceil(a)),n&&oXA)for(var u=jM(r),l=Math.ceil(i/XA),c=s;c<=u+l;c+=l)a.push(IM(c));else if(i>YA){var f=Math.ceil(i/YA),h=NM(e),p=function(t,e){var r=jM(t),n=jM(e),o=NM(t);return 12*(n-r)+(NM(e)-o)%12}(e,r);for(c=0;c<=p+f;c+=f)a.push(LM(s,c+h))}else if(i>WA){var d=(b=new Date(e)).getFullYear(),y=b.getMonth(),v=b.getDate(),g=Math.ceil(i/WA),m=function(t,e){return Math.ceil((e-t)/WA)}(e,r);for(c=0;cqA){d=(b=new Date(e)).getFullYear(),y=b.getMonth(),g=b.getDate();var b,w=b.getHours(),S=Math.ceil(i/qA),x=function(t,e){return Math.ceil((e-t)/qA)}(e,r);for(c=0;c<=x+S;c+=S)a.push(new Date(d,y,g,w+c).getTime())}else if(i>HA){var _=function(t,e){return Math.ceil((e-t)/6e4)}(e,r),E=Math.ceil(i/HA);for(c=0;c<=_+E;c+=E)a.push(e+c*HA)}else{var O=i;O=512&&console.warn("Notice: current ticks length("+a.length+') >= 512, may cause performance issues, even out of memory. Because of the configure "tickInterval"(in milliseconds, current is '+i+") is too small, increase the value to solve the problem!"),a}),fA("log",function(t){var e,r=t.base,n=t.tickCount,o=t.min,i=t.max,a=t.values,s=eM(r,i);if(o>0)e=Math.floor(eM(r,o));else{var u=rM(a,r,i);e=Math.floor(eM(r,u))}for(var l=s-e,c=Math.ceil(l/n),f=[],h=e;h=0?1:-1;return Math.pow(t,e)*r})}),fA("quantile",function(t){var e=t.tickCount,r=t.values;if(!r||!r.length)return[];for(var n=r.slice().sort(function(t,e){return t-e}),o=[],i=0;ip?(s.show(),l.show(),p=c.minX+c.width+10):(s.hide(),l.hide()),s}),this.controllerBtnGroup=new oA(JM({group:this.group,x:this.x,y:this.y+r+25,width:e,height:35},this.controllerCfg)),this.updateStartEnd(0),this.updateUI(),i.move(this.x,this.y),this.bindEvents(),this.currentMode===nA.SINGLE&&(this.minHandlerShape.hide(),this.foregroundShape.hide(),this.minTextShape.hide())},t.prototype.bindEvents=function(){var t=this,e=this.group.find(function(t){return"minHandlerShape"===t.get("name")});e&&(e.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),e.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var r=this.group.find(function(t){return"maxHandlerShape"===t.get("name")});r&&(r.on("maxHandlerShape-handler:mousedown",this.onMouseDown(this.maxHandlerShape)),r.on("maxHandlerShape-handler:touchstart",this.onMouseDown(this.maxHandlerShape))),this.foregroundShape.on("mousedown",this.onMouseDown(this.foregroundShape)),this.foregroundShape.on("touchstart",this.onMouseDown(this.foregroundShape)),this.group.on("".concat("playPauseBtn",":click"),function(){t.isPlay=!t.isPlay,t.currentHandler=t.maxHandlerShape,t.changePlayStatus()}),this.group.on("".concat("nextStepBtn",":click"),function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(.01),t.updateUI()}),this.group.on("".concat("preStepBtn",":click"),function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(-.01),t.updateUI()}),this.group.on("timebarConfigChanged",function(e){var r=e.type,n=e.speed;t.currentSpeed=n,t.currentMode=r,r===nA.SINGLE?(t.minHandlerShape.hide(),t.foregroundShape.hide(),t.minTextShape.hide()):r===nA.RANGE&&(t.minHandlerShape.show(),t.foregroundShape.show(),t.minTextShape.show())})},t.prototype.adjustTickIndex=function(t){for(var e=0;e1&&(this.start=1),this.end>1&&(this.end=1),this.end<0&&(this.end=0);var e=this.x+this.start*this.width,r=this.x+this.end*this.width;this.foregroundShape.attr("x",e),this.foregroundShape.attr("width",r-e);var n=(0,rg.get)(this.handlerStyle,"width",2);this.setText(this.minText,this.maxText);var o=this.dodgeText([e,r]),i=o[0],a=o[1];this.minHandlerShape.setX(e-n/2),(0,rg.each)(i,function(e,r){return t.minTextShape.attr(r,e)}),this.maxHandlerShape.setX(r-n/2),(0,rg.each)(a,function(e,r){return t.maxTextShape.attr(r,e)}),this.currentMode===nA.RANGE?this.graph.emit("valuechange",{value:[this.start,this.end].sort()}):this.currentMode===nA.SINGLE&&this.graph.emit("valuechange",{value:[this.end,this.end]})},t.prototype.dodgeText=function(t){var e,r,n=(0,rg.get)(this.handlerStyle,"width",2),o=this.minTextShape,i=this.maxTextShape,a=t[0],s=t[1],u=!1;a>s&&(a=(e=[s,a])[0],s=e[1],o=(r=[i,o])[0],i=r[1],u=!0);var l=o.getBBox(),c=i.getBBox(),f=null,h=null;return"trend"===this.timeBarType?(f=a-l.widththis.x+this.width?{x:s-n/2-2,textAlign:"right"}:{x:s+n/2+2,textAlign:"left"}):"simple"===this.timeBarType&&(f=o.attr("x")>l.width?{x:a,textAlign:"center"}:{x:a,textAlign:"left"},h=i.attr("x")>this.width-c.width?{x:s,textAlign:"right"}:{x:s,textAlign:"center"}),u?[h,f]:[f,h]},t.prototype.startPlay=function(){var t=this;return"undefined"!=typeof window?window.requestAnimationFrame(function(){var e=t,r=e.ticks,n=e.width,o=t.currentSpeed,i=n/r.length/(1e3*(10-o)/60),a=t.adjustOffsetRange(i/t.width);t.updateStartEnd(a),t.updateUI(),t.isPlay&&(t.playHandler=t.startPlay())}):void 0},t.prototype.changePlayStatus=function(t){void 0===t&&(t=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit("timebarstartplay",null)):this.playHandler&&("undefined"!=typeof window&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit("timebarendplay",null))},t.prototype.destory=function(){this.graph.off("valuechange",function(){});var t=this.group,e=t.find(function(t){return"minHandlerShape"===t.get("name")});e&&(e.off("minHandlerShape-handler:mousedown"),e.off("minHandlerShape-handler:touchstart"),e.destroy());var r=t.find(function(t){return"maxHandlerShape"===t.get("name")});r&&(r.off("maxHandlerShape-handler:mousedown"),r.off("maxHandlerShape-handler:touchstart"),r.destroy()),this.foregroundShape.off("mousedown"),this.foregroundShape.off("touchstart"),this.foregroundShape.destroy(),t.off("".concat("playPauseBtn",":click")),t.off("".concat("nextStepBtn",":click")),t.off("".concat("preStepBtn",":click")),t.off("timebarConfigChanged"),t.destroy(),this.trendComponent&&this.trendComponent.destory()},t}(),ij=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),aj=function(){return(aj=Object.assign||function(t){for(var e,r=1,n=arguments.length;r")),{position:"relative"}),a)&&this.get("graph").get("container").appendChild(t);this.set("timeBarContainer",t),e="SVG"===r.get("renderer")?new xk({container:t,width:o,height:i}):new MP({container:t,width:o,height:i}),this.get("containerCSS")&&wT(t,this.get("containerCSS")),this.set("canvas",e)},e.prototype.init=function(){this.initContainer();var t=this.get("canvas").addGroup({name:"timebar-group"});this.set("timeBarGroup",t),this.renderTrend(),this.initEvent();var e="undefined"!=typeof window&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif";this.set("fontFamily",e)},e.prototype.play=function(){this.togglePlay(!0)},e.prototype.pause=function(){this.togglePlay(!1)},e.prototype.togglePlay=function(t){var e=this.get("timebar");e&&(e.isPlay=!!t,e.changePlayStatus())},e.prototype.renderTrend=function(){var t=this,e=this._cfgs,r=e.width,n=e.x,o=e.y,i=e.padding,a=e.type,s=e.trend,u=e.slider,l=e.controllerCfg,c=e.textStyle,f=e.tick,h=e.backgroundStyle,p=e.foregroundStyle,d=s.data,y=sj(s,["data"]),v=r-2*i,g="trend"===a?26:4,m=this.get("graph"),b=this.get("timeBarGroup"),w=this.get("canvas"),S=null;if("trend"===a||"simple"===a){var x=this.get("getValue");S=new oj(aj(aj({graph:m,canvas:w,group:b,type:a,x:n+i,y:"trend"===a?o+i:o+i+15,width:v,height:g,padding:i,backgroundStyle:h,foregroundStyle:p,trendCfg:aj(aj({},y),{data:d.map(function(t){return(null===x||void 0===x?void 0:x(t))||t.value})})},u),{tick:{ticks:d,tickLabelFormatter:f.tickLabelFormatter,tickLabelStyle:f.tickLabelStyle,tickLineStyle:f.tickLineStyle},handlerStyle:aj(aj({},u.handlerStyle),{height:u.height||g}),controllerCfg:l,textStyle:c}))}else"tick"===a&&(S=new lA(aj({graph:m,canvas:w,group:b,x:n+i,y:o+i,width:r,height:42,padding:2,controllerCfg:l},f)));var _=function e(){var r=t.get("timebar");r.draggingHandler=!1,r.isPlay&&(r.isPlay=!1,r.currentHandler=r.maxHandlerShape,r.changePlayStatus()),document.removeEventListener("mouseup",e)};w.on("mousedown",function(t){"maxHandlerShape-handler"!==t.target.get("name")&&"minHandlerShape-handler"!==t.target.get("name")&&t.target!==S.foregroundShape||document.addEventListener("mouseup",_)}),this.set("timebar",S)},e.prototype.filterData=function(t){var e,r=t.value;if(!r){r=[];var n=this._cfgs.type;n&&"trend"!==n&&"simple"!==n?"tick"===n&&(r[0]=this._cfgs.tick.start,r[1]=this._cfgs.tick.end):(r[0]=this._cfgs.slider.start,r[1]=this._cfgs.slider.end)}var o=null,i=this._cfgs.type;if("trend"===i||"simple"===i?o=this._cfgs.trend.data:"tick"===i&&(o=this._cfgs.tick.data),o&&0!==o.length){var a=this.get("rangeChange"),s=this.get("graph"),u=Math.round(o.length*r[0]),l=Math.round(o.length*r[1]);l=l>=o.length?o.length-1:l,u=u>=o.length?o.length-1:u;var c=null===(e=this._cfgs.tick)||void 0===e?void 0:e.tickLabelFormatter,f=c?c(o[u]):o[u].date,h=c?c(o[l]):o[l].date;if("tick"!==i)this.get("timebar").setText(f,h);if(a)a(s,f,h);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&0===this.cacheGraphData.nodes.length)&&(this.cacheGraphData=s.get("data"));var p=this.get("filterItemTypes"),d=this.get("changeData"),y=this.get("getDate"),v=this.get("shouldIgnore"),g=o[u].date,m=o[l].date;if(d||void 0===d){var b=this.cacheGraphData.nodes,w=this.cacheGraphData.edges,S={},x={};s.getNodes().forEach(function(t){return S[t.getID()]=!0}),s.getEdges().forEach(function(t){return x[t.getID()]=!0}),p.includes("node")&&(null===b||void 0===b||b.forEach(function(t){var e=+((null===y||void 0===y?void 0:y(t))||t.date),r=e>=g&&e<=m||(null===v||void 0===v?void 0:v("node",t,{min:g,max:m})),n=S[t.id];n&&!r?(s.removeItem(t.id),S[t.id]=!1):!n&&r&&(s.addItem("node",t),S[t.id]=!0)}),null===w||void 0===w||w.forEach(function(t){var e=S[t.source]&&S[t.target]||(null===v||void 0===v?void 0:v("edge",t,{min:g,max:m})),r=!!s.findById(t.id);r&&!e?(s.removeItem(t.id),x[t.id]=!1):!r&&e?(s.addItem("edge",t),x[t.id]=!0):r||(x[t.id]=!1)})),(this.get("filterEdge")||p.includes("edge"))&&(null===w||void 0===w||w.filter(function(t){var e=+((null===y||void 0===y?void 0:y(t))||t.date),r=e>=g&&e<=m||(null===v||void 0===v?void 0:v("edge",t,{min:g,max:m})),n=S[t.source]&&S[t.target],o=r&&n,i=x[t.id];i&&!o?(x[t.id]=!1,s.removeItem(t.id)):!i&&o&&(x[t.id]=!0,s.addItem("edge",t))}))}else p.includes("node")&&s.getNodes().forEach(function(t){var e=t.getModel();if(null===v||void 0===v||!v("node",e,{min:g,max:m})){var r=+((null===y||void 0===y?void 0:y(e))||e.date);rm?s.hideItem(t):s.showItem(t)}}),(this.get("filterEdge")||p.includes("edge"))&&s.getEdges().forEach(function(t){var e=t.getModel();if(null===v||void 0===v||!v("edge",e,{min:o[u].date,max:o[l].date})){var r=+((null===y||void 0===y?void 0:y(e))||e.date);if(ro[l].date)s.hideItem(t);else{var n=t.getSource().isVisible(),i=t.getTarget().isVisible();n&&i&&s.showItem(t)}}})}}else console.warn("请配置 TimeBar 组件的数据")},e.prototype.initEvent=function(){var t=this.get("graph");t.on("afterchangedata",this.changeData),t.on("afterrender",this.afterrenderListener),t.on("valuechange",this.valueChangeListener)},e.prototype.destroy=function(){var e=this.get("graph");e.off("afterchangedata",this.changeData),e.off("afterrender",this.afterrenderListener),e.off("valuechange",this.valueChangeListener);var r=this.get("timebar");r&&r.destory&&r.destory(),t.prototype.destroy.call(this);var n=this.get("timeBarContainer");if(n){var o=this.get("container");o||(o=this.get("graph").get("container")),(0,rg.isString)(o)&&(o=document.getElementById(o)),o===n&&(o=o.parentElement),o.removeChild(n)}},e}(ST),lj=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cj=yO.applyMatrix;var fj=function(t){function e(e){return t.call(this,e)||this}return lj(e,t),e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",width:200,delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,e=this._cfgs,r=e.graph;if(!this.destroyed){var n=this.get("container");(0,rg.isString)(n)&&(n=document.getElementById(n));var o=_k("
    ")),i=0,a=0,s=!1,u=0,l=0,c=0,f=0,h=0,p=0;n.addEventListener("mousedown",function(n){if(e.refresh=!1,n.target===o){var u=o.style;c=parseInt(u.width,10),f=parseInt(u.height,10);var l=t.get("width"),d=t.get("height");c>l||f>d||(p=r.getZoom(),h=t.get("ratio"),s=!0,i=n.clientX,a=n.clientY)}},!1),n.addEventListener("mousemove",function(e){if(s&&!(0,rg.isNil)(e.clientX)&&!(0,rg.isNil)(e.clientY)){var n=t.get("width"),d=t.get("height"),y=o.style;u=parseInt(y.left,10),l=parseInt(y.top,10),c=parseInt(y.width,10),f=parseInt(y.height,10);var v=i-e.clientX,g=a-e.clientY;u-v<0?v=u:u-v+c>=n&&(v=0),l-g<0?g=l:l-g+f>=d&&(g=0),l-=g,wT(o,{left:"".concat(u-=v,"px"),top:"".concat(l,"px")}),r.translate(v*p/h,g*p/h),i=e.clientX,a=e.clientY}},!1),n.addEventListener("mouseleave",function(){s=!1,e.refresh=!0},!1),n.addEventListener("mouseup",function(){s=!1,e.refresh=!0},!1),this.set("viewport",o),n.appendChild(o)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),e=this.get("width"),r=this.get("height"),n=this.get("graph"),o=n.get("width"),i=o/n.get("height"),a=n.getGroup(),s=a.getCanvasBBox(),u=[(s.minX+s.maxX)/2,(s.minY+s.maxY)/2],l=[s.maxX-s.minX,s.maxY-s.minY],c={centerX:u[0],centerY:u[1],width:0,height:0,minX:0,minY:0};s[0]/s[1]>i?(c.width=l[0],c.height=c.width/i):(c.height=l[1],c.width=c.height*i),c.minX=u[0]-c.width/2,c.minY=u[1]-c.height/2;var f=a.getMatrix();f||(f=[1,0,0,0,1,0,0,0,1]);var h=sg.invert([1,0,0,0,1,0,0,0,1],f),p=cj({x:c.minX,y:c.minY},h),d=n.getCanvasByPoint(p.x,p.y),y=this.get("viewport");y||this.initViewport();var v=o/c.width,g=v*e,m=v*r,b=e*-d.x/c.width,w=r*-d.y/c.height,S=b+g,x=w+m;b<0&&(g+=b,b=0),S>e&&(g-=S-e),w<0&&(m+=w,w=0),x>r&&(m-=x-r),this.set("ratio",t),wT(y,{left:"".concat(b,"px"),top:"".concat(w,"px"),width:"".concat(g,"px"),height:"".concat(m,"px")})}},e.prototype.init=function(){this.initContainer()},e.prototype.initContainer=function(){var t=this.get("graph"),e=t.get("width"),r=t.get("height")/e,n=this.get("className"),o=this.get("container"),i=this.get("width"),a=this.get("height");i||a||(i=200),i?(a=r*i,this.set("height",a)):(i=1/r*a,this.set("width",i));var s=_k("
    "));(0,rg.isString)(o)&&(o=document.getElementById(o)),o?o.appendChild(s):t.get("container").appendChild(s),this.set("container",s);var u=_k('
    ');s.appendChild(u);var l=_k('');u.appendChild(l),this.set("containerDOM",u),this.set("containerSpan",l);var c=_k(''));this.set("imgDOM",c),this.updateImgSize(),l.appendChild(c),this.updateCanvas()},e.prototype.updateImgSize=function(){var t=this.get("imgDOM"),e=this.get("width"),r=this.get("height");t.onload=function(){var n=function(t,e){var r,n;if(t.naturalWidth)r=t.naturalWidth,n=t.naturalHeight;else{var o=new Image;o.src=t.src,o.onload=function(){e&&e(o.width,o.height)}}return[r,n]}(t);n[0]>n[1]?t.width=e:t.height=r}},e.prototype.updateCanvas=function(){if(this.get("refresh")){var t=this.get("graph");if(!t.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var e=this.get("width")/t.get("canvas").getCanvasBBox().width;this.set("ratio",e),this.updateViewport()}}},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.updateGraphImg=function(t){this.get("imgDOM").remove(),this.set("graphImg",t);var e=_k(''));this.set("imgDOM",e),e.src=t,this.updateImgSize(),this.get("containerSpan").appendChild(e),this.updateCanvas()},e.prototype.destroy=function(){var t=this.get("container");t.parentNode.removeChild(t)},e}(ST),hj=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pj=function(){return(pj=Object.assign||function(t){for(var e,r=1,n=arguments.length;r(o||r.get("height"))&&e>1||a<(i||.05*r.get("height"))&&e<1)&&(e=1),a*=e,this.set("r",a),this.filter(t)}},e.prototype.filter=function(t){var e=this.get("graph"),r=e.getNodes(),n={},o=this.get("r"),i=this.get("type"),a={x:t.x,y:t.y};this.updateDelegate(a,o);var s=this.get("shouldShow"),u=this.get("vShapes");u&&u.forEach(function(t){t.remove(),t.destroy()}),u=[],r.forEach(function(t){var e=t.getModel(),r=e.x,i=e.y;dj({x:r,y:i},a)
    ");n.appendChild(o),this.set("container",o);var i=this.render();wT(o,this.getContainerPos(i)),this.bindEvents()},e.prototype.getContainerPos=function(t){void 0===t&&(t=[0,0]);var e=this.get("graph"),r=this.get("offsetX"),n=this.get("offsetY"),o=this.get("margin"),i=this.get("position").split("-"),a={top:0,right:1,bottom:2,left:3},s={left:(e.getWidth()-t[0])/2+0,top:(e.getHeight()-t[1])/2+0};return i.forEach(function(r){var n=o[a[r]],i=r;switch(r){case"top":case"left":n+=0;break;case"bottom":n=e.getHeight()-t[1]-n+0,i="top";break;default:n=e.getWidth()-t[0]-n+0,i="left"}s[i]=n}),s.top+=n+e.getContainer().offsetTop,s.left+=r+e.getContainer().offsetLeft,Object.keys(s).forEach(function(t){s[t]="".concat(s[t],"px")}),s},e.prototype.bindEvents=function(){var t=this,e=t.get("filter");if(e&&e.enable){var r=e.trigger||"click";_j.includes(r)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),r="click");var n=t.get("legendCanvas");"mouseenter"===r?(n.on("node-container:mouseenter",function(e){return t.filterData(e)}),n.on("node-container:mouseleave",function(e){t.clearFilter(),t.clearActiveLegend()})):(n.on("node-container:click",function(e){return t.filterData(e)}),n.on("click",function(e){e.target&&e.target.isCanvas&&e.target.isCanvas()&&(t.clearFilter(),t.clearActiveLegend())}))}},e.prototype.changeData=function(t){this.set("data",t);var e=this.render();wT(this.get("container"),this.getContainerPos(e))},e.prototype.activateLegend=function(t){var e=this.get("filter");(null===e||void 0===e?void 0:e.multiple)||this.clearActiveLegend();var r=t.get("parent");r.get("active")?(r.set("active",!1),this.findLegendItemsByState("active").length&&r.set("inactive",!0)):(r.set("inactive",!1),r.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach(function(t){t.set("inactive",!0)}):this.clearActiveLegend();var n=(null===e||void 0===e?void 0:e.legendStateStyles)||{},o=(null===n||void 0===n?void 0:n.inactive)||{opacity:.5,"text-shape":{opacity:.5}},i=o["text-shape"]||{};this.findLegendItemsByState("inactive").forEach(function(t){var e=t.get("children"),r=e[0],n=e[1];r.attr(xj(xj({},r.get("oriAttrs")),o)),n.attr(xj(xj({},n.get("oriAttrs")),i))});var a=(null===n||void 0===n?void 0:n.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},s=a["text-shape"]||{};this.findLegendItemsByState("active").forEach(function(t){var e=t.get("children"),r=e[0],n=e[1];r.attr(xj(xj({},r.get("oriAttrs")),a)),n.attr(xj(xj({},n.get("oriAttrs")),s))})},e.prototype.findLegendItemsByState=function(t,e,r){void 0===e&&(e="all"),void 0===r&&(r=!0);var n=this.get("legendCanvas").find(function(t){return"root"===t.get("name")}),o=n.find(function(t){return"node-group"===t.get("name")}),i=n.find(function(t){return"edge-group"===t.get("name")});return"node"===e?o.get("children").filter(function(e){return!!e.get(t)===r}):"edge"===e?i.get("children").filter(function(e){return!!e.get(t)===r}):o.get("children").filter(function(e){return!!e.get(t)===r}).concat(i.get("children").filter(function(e){return!!e.get(t)===r}))},e.prototype.clearActiveLegend=function(){var t=this.get("legendCanvas").find(function(t){return"root"===t.get("name")});[t.find(function(t){return"node-group"===t.get("name")}),t.find(function(t){return"edge-group"===t.get("name")})].forEach(function(t){t.get("children").forEach(function(t){t.set("active",!1),t.set("inactive",!1);var e=t.get("children"),r=e[0],n=e[1];r.attr(r.get("oriAttrs")),n.attr(n.get("oriAttrs"))})})},e.prototype.filterData=function(t){var e=this.get("filter"),r=null===e||void 0===e?void 0:e.filterFunctions;if(e&&r){var n=this.get("legendCanvas"),o=this.get("graph"),i=e.graphActiveState||"active",a=e.graphInactiveState||"inactive",s=e.multiple;this.clearFilter(),s||this.clearActiveLegend(),this.activateLegend(t.target);var u=n.find(function(t){return"root"===t.get("name")}),l=u.find(function(t){return"node-group"===t.get("name")}),c=u.find(function(t){return"edge-group"===t.get("name")}),f=l.get("children").filter(function(t){return t.get("active")}),h=c.get("children").filter(function(t){return t.get("active")}),p=0,d=["getNodes","getEdges"];d.forEach(function(t){o[t]().forEach(function(e){var n=!1;("getNodes"===t?f:h).forEach(function(t){var o=r[t.get("id")];n=n||o(e.getModel())}),n?(o.setItemState(e,a,!1),o.setItemState(e,i,!0),p++):(o.setItemState(e,i,!1),o.setItemState(e,a,!0))})}),p||d.forEach(function(t){o[t]().forEach(function(t){o.clearItemStates(t,[a])})})}},e.prototype.clearFilter=function(){var t=this.get("graph"),e=this.get("filter");if(e){var r=e.graphActiveState||"active",n=e.graphInactiveState||"inactive";t.getNodes().forEach(function(e){t.clearItemStates(e,[r,n])}),t.getEdges().forEach(function(e){t.clearItemStates(e,[r,n])})}},e.prototype.render=function(){var t=this;this.processData();var e=this.get("legendCanvas");e?e.clear():e=new MP({container:this.get("container"),width:200,height:200});var r=e.addGroup({name:"root"}),n=r.addGroup({name:"node-group"}),o=r.addGroup({name:"edge-group"});this.set("legendCanvas",e);var i=this.get("itemsData"),a=[n,o];["nodes","edges"].forEach(function(e,r){i[e].forEach(function(n){var o,i,s=a[r].addGroup({id:n.id,name:"node-container"}),u=n.type,l=t.getShapeSize(n),c=l.width,f=l.height,h=l.r,p=t.getStyle(e.substr(0,4),n);switch(n.type){case"circle":i={r:h,x:0,y:0};break;case"rect":i={width:c,height:f,x:-c/2,y:-f/2};break;case"ellipse":i={rx:c,ry:f,x:0,y:0},u="ellipse";break;case"line":i={x1:-c/2,y1:0,x2:c/2,y2:0},u="line";break;case"quadratic":i={path:[["M",-c/2,0],["Q",0,c/2,c/2,0]]},u="path";break;case"cubic":i={path:[["M",-c/2,0],["C",-c/6,c/2,c/6,-c/2,c/2,0]]},u="path";break;case"diamond":i={path:[["M",0,-f],["L",c,0],["L",0,f],["L",-c,0],["Z"]]},u="path";break;case"triangle":i={path:[["M",-c,f],["L",0,-f],["L",c,f],["Z"]]},u="path";break;case"star":i={path:yO.getStarPath(3*h,1.2*h)},u="path";break;default:i={r:h,x:0,y:0}}var d=s.addShape(u,{attrs:xj(xj({},i),p),name:"".concat(n.type,"-node-keyShape"),oriAttrs:xj({opacity:1},p)});if(n.label){var y=d.getBBox(),v=(null===(o=n.labelCfg)||void 0===o?void 0:o.style)||{},g=xj({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},v);s.addShape("text",{attrs:xj({x:y.maxX+4,y:0,text:n.label},g),className:"legend-label",name:"".concat(n.type,"-node-text"),oriAttrs:g})}})});var s,u=this.get("padding"),l=r.find(function(t){return"title-container"===t.get("name")}),c={height:0,maxY:0,width:0};if(this.get("title")){l||(l=r.addGroup({name:"title-container"}));var f={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:u[0]},h=this.get("titleConfig")||{},p=Object.assign(f,h.style||{});s=l.addShape("text",{attrs:xj({text:this.get("title")},p)}),c=l.getCanvasBBox(),l.setMatrix([1,0,0,0,1,0,h.offsetX,h.offsetY,1])}this.layoutItems();var d=r.getCanvasBBox(),y=n.getCanvasBBox(),v=y.minX<0?Math.abs(y.minX)+u[3]:u[3],g=c.maxYl.max&&(l.max=i[0]),p>c&&(c=p),t.setMatrix([1,0,0,0,1,0,d,y,1])});var f=l.max-l.min,h={min:0,max:-1/0},p=s.getCanvasBBox();i[0]=0,i[1]="vertical"===n?p.maxX+e:p.maxY+r,u.get("children").forEach(function(t,o){0===o&&(h.min=i[0]);var a=t.get("children")[0],s=t.getCanvasBBox(),u=a.getBBox(),l=u.width,c=u.height,f=0,p=0;"vertical"===n?(f=i[1],p=i[0],i[0]=p+s.height+r,t.setMatrix([1,0,0,0,1,0,0,p+c/2,1])):(f=i[0],p=i[1],i[0]=f+s.width+e,t.setMatrix([1,0,0,0,1,0,f+l/2,0,1])),i[0]>h.max&&(h.max=i[0])});var d=h.max-h.min;if(o&&""!==o&&"left"!==o){var y=f-d,v="center"===o?Math.abs(y)/2:Math.abs(y);(y<0?s:u).get("children").forEach(function(t){var e=t.getMatrix()||[1,0,0,0,1,0,0,0,1];"vertical"===n?e[7]+=v:e[6]+=v,t.setMatrix(e)})}},e.prototype.processData=function(){var t=this.get("data"),e={nodes:[],edges:[]};t.nodes&&(t.nodes.sort(function(t,e){return t.order-e.order}),t.nodes.forEach(function(t){var r,n,o,i,a,s=t.size||[(null===(r=t.style)||void 0===r?void 0:r.width)||(null===(n=t.style)||void 0===n?void 0:n.r)||8,(null===(o=t.style)||void 0===o?void 0:o.height)||(null===(i=t.style)||void 0===i?void 0:i.r)||8],u=(null===(a=t.labelCfg)||void 0===a?void 0:a.style)||{};e.nodes.push({id:t.id||(0,rg.uniqueId)(),type:t.type||"circle",style:xj({},t.style),order:t.order,label:t.label,itemType:"node",size:s,labelCfg:{position:"right",style:xj({fontFamily:"Arial"},u)}})})),t.edges&&(t.edges.sort(function(t,e){return t.order-e.order}),t.edges.forEach(function(t){var r,n,o=t.type||"line";"cubic-horizontal"===t.type&&(o="cubic");var i=(null===(r=t.labelCfg)||void 0===r?void 0:r.style)||{},a=t.size||[(null===(n=t.style)||void 0===n?void 0:n.width)||8,1];e.edges.push({id:t.id||(0,rg.uniqueId)(),type:o,size:a,style:xj({lineWidth:(0,rg.isArray)(a)?a[1]:1},t.style),order:t.order,label:t.label,itemType:"edge",labelCfg:{position:"right",style:xj({fontFamily:"Arial"},i)}})})),this.set("itemsData",e)},e.prototype.getContainer=function(){return this.get("container")},e.prototype.formatArray=function(t){var e=this.get(t);if((0,rg.isNumber)(e))this.set(t,[e,e,e,e]);else if((0,rg.isArray)(e))switch(e.length){case 0:this.set(t,[0,0,0,0]);break;case 1:this.set(t,[e[0],e[0],e[0],e[0]]);break;case 2:this.set(t,[e[0],e[1],e[0],e[1]]);break;case 3:this.set(t,[e[0],e[1],e[2],e[1]])}return this.get(t)},e.prototype.getShapeSize=function(t){var e,r,n;return t.size&&((0,rg.isArray)(t.size)?(e=t.size[0],r=t.size[1]||t.size[0],n=t.size[0]/2):(0,rg.isNumber)(t.size)&&(e=t.size,r=t.size,n=t.size/2)),t.style&&(t.style.width&&(e=t.style.width),t.style.height&&(r=t.style.height),t.style.r&&(n=t.style.r)),n||(n=5),e||(e=n),r||(r=n),{width:e,height:r,r:n}},e.prototype.getStyle=function(t,e){return xj(xj({},"node"===t?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1}),e.style||{})},e.prototype.destroy=function(){var t=this.get("legendCanvas");null===t||void 0===t||t.destroy();var e=this.get("graph").get("container"),r=this.get("container");e.removeChild(r)},e}(ST),Oj=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Pj=function(){return(Pj=Object.assign||function(t){for(var e,r=1,n=arguments.length;r+

    ":"

    -

    ",c=e?"":"

    ".concat(a,"

    "),f=e?"".concat(u,"px"):"".concat(u,"px ").concat(u,"px 0 0");return'
    \n \n

    ").concat(o,"

    \n ").concat(l,"\n ").concat("

    x

    ","\n
    \n ").concat(c,"\n ")}},e.prototype.init=function(){var t=this;if(!t.destroyed){var e=t.get("graph").getContainer(),r=t.get("container");this.get("containerCfg")?(r=this.createContainer(),e.appendChild(r)):r=e,this.set("container",r);var n=e.getBoundingClientRect(),o=new MP({container:e,width:n.right-n.left,height:n.bottom-n.top});wT(o.get("el"),{position:"absolute",top:0,left:0,pointerEvents:"none"}),window.addEventListener("resize",(0,rg.debounce)(function(){return t.resizeCanvas(t)},100));var i=o.addGroup({id:"annotation-link-group"});t.set("linkGroup",i),t.set("canvas",o),t.get("getTitle")||t.set("getTitle",function(t){var e,r=(null===(e=null===t||void 0===t?void 0:t.getModel)||void 0===e?void 0:e.call(t))||{},n=r.label,o=r.id;return n||o||"-"}),t.get("getContent")||t.set("getContent",function(t){var e,r;if(!t)return"-";var n=(null===(e=t.getModel)||void 0===e?void 0:e.call(t))||{},o=n.label,i=n.id,a=null===(r=t.getType)||void 0===r?void 0:r.call(t),s=a?"".concat(a,": "):"";return"".concat(s).concat(o||i||"")});var a=t.get("defaultData");a&&this.readData(a)}},e.prototype.createContainer=function(){var t=this;if(!this.destroyed){var e=this.get("containerCfg"),r=this.get("graph"),n=r.getContainer(),o=n.getBoundingClientRect(),i=o.left,a=o.right,s=o.top,u=o.bottom-s,l=a-i,c=e.position,f=void 0===c?"top":c,h=e.offsetX,p=void 0===h?0:h,d=e.offsetY,y=void 0===d?0:d,v=kj(e,["position","offsetX","offsetY"]),g=e.height,m=void 0===g?"fit-content":g,b=e.width,w=void 0===b?r.getWidth():b;"100%"===m&&(m=u),"100%"===w&&(w=l);var S="unset",x="unset",_={};switch(f){case"right":S="".concat(u,"px"),(_={top:0,right:0}).right+=i+p,_.top+=s+y;break;case"bottom":x="".concat(l,"px"),(_={bottom:0,left:0}).left+=i+p,_.bottom+=s+y;break;case"top":x="".concat(l,"px");case"left":S="".concat(u,"px");default:(_={top:0,left:0}).left+=i+p,_.top+=s+y}Object.keys(_).forEach(function(t){_[t]="".concat(_[t],"px")});var E=_k("
    "));return wT(E,Pj(Pj({position:"absolute",display:"top"===f||"bottom"===f?"inline-flex":"unset",width:(0,rg.isNumber)(w)?"".concat(w,"px"):w,height:(0,rg.isNumber)(m)?"".concat(m,"px"):m,maxHeight:S,maxWidth:x,overflow:"scroll"},_),v)),n.appendChild(E),E.addEventListener("scroll",function(e){t.updateLinks()}),E}},e.prototype.resizeCanvas=function(t){clearTimeout(t.resizeTimer),t.resizeTimer=setTimeout(function(){if(t&&!t.destroyed){var e=t.get("container").getBoundingClientRect(),r=e.right-e.left,n=e.bottom-e.top;t.get("canvas").changeSize(r,n),t.updateOutsideCards(t)}},250)},e.prototype.updateOutsideCards=function(t){var e=t||this,r=e.get("cardInfoMap")||{},n=e.get("graph"),o=n.getPointByCanvas(0,0),i=n.getPointByCanvas(n.getWidth(),n.getHeight()),a=n.getClientByPoint(o.x,o.y),s=a.x,u=a.y,l=n.getClientByPoint(i.x,i.y),c=l.x,f=l.y;Object.values(r).forEach(function(t){var e=t.card;if(e){var r=e.style,n=Aj(r.left),o=Aj(r.top),i=e.getBoundingClientRect(),a=i.width,l=i.height,h=n,p=o;n+a>c-s&&(h=c-s-a),n<0&&(h=0),o+l>f-u&&(p=f-u-l),o<0&&(p=0),wT(e,{left:"".concat(h,"px"),top:"".concat(p,"px")})}}),e.updateLinks()},e.prototype.showAnnotation=function(t){if(!this.destroyed){var e=t.item;this.toggleAnnotation(e)}},e.prototype.hideCards=function(){var t=this;if(!t.destroyed){var e=t.get("cardInfoMap")||{};Object.keys(e).forEach(function(e){t.hideCard(e)})}},e.prototype.toggleAnnotation=function(t,e){var r,n;void 0===e&&(e={});if(!this.destroyed){var o=this.get("cardInfoMap")||{},i=this.get("graph"),a=this.get("container"),s=this.get("containerCfg"),u=Object.assign({},this.get("cardCfg")||{},e),l=u.minHeight,c=u.minWidth,f=u.width,h=u.height,p=u.collapsed,d=void 0!==p&&p,y=u.x,v=u.y,g=u.title,m=u.content,b=u.maxTitleLength,w=u.defaultBegin,S=kj(u,["minHeight","minWidth","width","height","collapsed","x","y","title","content","maxTitleLength","defaultBegin"]),x=this.get("linkGroup"),_=this.get("rows")||[[]],E=null===(r=t.isCanvas)||void 0===r?void 0:r.call(t),O=E?"canvas-annotation":t.getID(),P=o[O]||{},k=P.card,C=P.link,T=P.x,A=P.y,M=P.title,j=P.content,I=this.get("getTitle"),N=this.get("getContent"),L=this.get("getContentPlaceholder")||function(){return""},R=this.get("getTitlePlaceHolder")||function(){return""},D=L(t),B=R(t),F=_k(this.getDOMContent(Pj({itemId:O,collapsed:d,title:(null===(n=M||g||(null===I||void 0===I?void 0:I(t)))||void 0===n?void 0:n.substr(0,b))||B,content:j||m||(null===N||void 0===N?void 0:N(t))||D},S))),G=(0,rg.isNumber)(l)?"".concat(l,"px"):l;wT(F,{minHeight:d?"unset":G,minWidth:(0,rg.isNumber)(c)?"".concat(c,"px"):c,height:h,width:f});var U,z=!!k;if(z?(null===C||void 0===C||C.remove(!0),a.replaceChild(F,k)):a.appendChild(F),!s){if(U=a.getBoundingClientRect()||{},void 0!==y&&void 0!==v)T=y,A=v;else if(!z&&!E){var V=U.top,H=w||{},q=H.left,W=H.right,Y=void 0===W?16:W,X=H.top,J=void 0===X?8:X,K=H.bottom,Q=Y,Z=J;isNaN(q)||(Q=a.scrollWidth-q),isNaN(K)||(Z=a.scrollHeight-K);var $=(0,rg.isNumber)(c)?c:100;T=a.scrollWidth-F.scrollWidth-(_.length-1)*$-Q;var tt=_[_.length-1],et=(tt[tt.length-1]||{}).bbox;A=(null===et||void 0===et?void 0:et.bottom)-V||Z}wT(F,{position:"absolute",left:"".concat(T,"px"),top:"".concat(A,"px"),cusor:s?"unset":"move"})}this.bindListener(F,O);var rt=F.getBoundingClientRect();if(!E){var nt=Tj(t,rt,i,this.get("canvas")),ot=this.get("linkStyle");C=x.addShape("path",{attrs:Pj({lineWidth:1,lineDash:[5,5],stroke:"#ccc",path:nt},ot)})}if(o[O]=Pj(Pj({},o[O]||{}),{id:O,collapsed:d,card:F,link:C,x:T,y:A,cardBBox:rt,content:j||m,title:M||g,contentPlaceholder:D,titlePlaceholder:B,isCanvas:E}),this.set("cardInfoMap",o),s)this.updateCardPositionsInConatainer(),this.updateLinks();else{var it=!isNaN(y)&&!isNaN(v);if(!z&&!E&&!it){var at=U.bottom,st=void 0===at?0:at;V=U.top;_[_.length-1].push({id:O,bbox:rt}),rt.top>st-V-rt.height-16&&_.push([]),this.set("rows",_)}}this.updateCardSize(O);var ut=this.get("onAnnotationChange");null===ut||void 0===ut||ut(o[O],z?"update":"create")}},e.prototype.updateCardPositionsInConatainer=function(){if(!this.destroyed){var t=this.get("cardInfoMap");if(t){var e=this.get("container"),r=this.get("containerCfg").position,n=e.getBoundingClientRect().width,o=getComputedStyle(e),i=Aj(o.paddingLeft)+Aj(o.paddingRight);n-=i,Object.values(t).forEach(function(t){var e=t.card,o=e.getBoundingClientRect().width;switch(r){case"right":wT(e,{marginLeft:n?"".concat(n-o,"px"):"0px"});break;case"top":case"bottom":wT(e,{marginLeft:"8px"})}})}}},e.prototype.handleExpandCollapseCard=function(t){if(!this.destroyed){var e=this.get("graph"),r=this.get("cardInfoMap");if(r){var n=r[t].collapsed,o=e.findById(t);if(o)"hide"!==this.get("cardCfg").collapseType||n?this.toggleAnnotation(o,{collapsed:!n}):this.hideCard(t),r[t]=Pj(Pj({},r[t]),{collapsed:!n})}}},e.prototype.hideCard=function(t){if(!this.destroyed){var e=this.get("cardInfoMap");if(e&&e[t]){var r=e[t],n=r.card,o=r.link;wT(n,{display:"none"}),null===o||void 0===o||o.hide(),this.get("onAnnotationChange")(e[t],"hide")}}},e.prototype.removeCard=function(t){if(!this.destroyed){var e=this.get("cardInfoMap");if(e){var r=e[t],n=r.card,o=r.link;this.get("container").removeChild(n),null===o||void 0===o||o.remove(!0),delete e[t],this.get("onAnnotationChange")(r,"remove")}}},e.prototype.bindListener=function(t,e){var r=this;if(!this.destroyed){t.addEventListener("mousemove",function(t){var n;if("g6-annotation-collapse"===t.target.className?n="collapse":"g6-annotation-expand"===t.target.className?n="expand":"g6-annotation-close"===t.target.className&&(n="close"),n){var o=r.get("cardCfg").onMouseEnterIcon;(void 0===o?function(){}:o)(t,e,n)}}),t.addEventListener("mouseout",function(t){var n;if("g6-annotation-collapse"===t.target.className?n="collapse":"g6-annotation-expand"===t.target.className?n="expand":"g6-annotation-close"===t.target.className&&(n="close"),n){var o=r.get("cardCfg").onMouseLeaveIcon;(void 0===o?function(){}:o)(t,e,n)}}),t.addEventListener("mouseenter",function(t){var n=r.get("cardInfoMap");if(n){var o=r.get("graph"),i=o.findById(e);if(i){var a=r.get("itemHighlightState");o.setItemState(i,a,!0)}var s=n[e].link;if(s){var u=r.get("linkHighlightStyle")||{};s.attr(u)}}}),t.addEventListener("mouseleave",function(t){var n=r.get("cardInfoMap");if(n){var o=r.get("graph"),i=o.findById(e);if(i){var a=r.get("itemHighlightState");o.setItemState(i,a,!1)}var s=n[e].link;if(s){var u=r.get("linkHighlightStyle")||{};Object.keys(u).forEach(function(t){s.attr(t,void 0),s.attr(t,void 0)});var l=r.get("linkStyle");s.attr(l)}}}),t.addEventListener("click",function(t){var n=(r.get("cardCfg")||{}).onClickIcon;if("g6-annotation-collapse"===t.target.className||"g6-annotation-expand"===t.target.className)"hide"===r.get("cardCfg").collapseType?r.hideCard(e):r.handleExpandCollapseCard(e),null===n||void 0===n||n(t,e,"g6-annotation-collapse"===t.target.className?"collapse":"expand");else if("g6-annotation-close"===t.target.className){"remove"===r.get("cardCfg").closeType?r.removeCard(e):r.hideCard(e),null===n||void 0===n||n(t,e,"close")}}),this.get("editable")&&t.addEventListener("dblclick",function(t){var n=r.get("cardInfoMap"),o=(r.get("cardCfg")||{}).maxTitleLength,i=void 0===o?20:o;if(n){var a=t.target,s=a.className;if("g6-annotation-title"===s||"g6-annotation-content"===s){var u="g6-annotation-title"===s?a.getBoundingClientRect():a.parentNode.getBoundingClientRect(),l=u.width,c=u.height,f=getComputedStyle(a),h=_k("<".concat("g6-annotation-title"===s?"input":"textarea",' class="').concat(s,'-input" type="textarea" style="width:').concat(l,"px; height: ").concat(c,'px; min-width: 16px;"/>')),p=_k('
    '));p.appendChild(h),a.parentNode.replaceChild(p,a);var d=n[e],y=d.contentPlaceholder,v=d.titlePlaceholder,g=d.content,m=d.title,b=g;"g6-annotation-title"===s?(h.name="title",h.maxLength=i,b=m):h.name="content",b?(h.innerHTML=a.innerHTML,h.value=a.innerHTML):h.placeholder="g6-annotation-title"===s?v:y,h.focus(),h.addEventListener("blur",function(t){h.value&&(a.innerHTML=h.value,d[h.name||"title"]=h.value),p.parentNode.replaceChild(a,p),r.updateCardSize(e);var n=r.get("onAnnotationChange");null===n||void 0===n||n(d,"update")})}}});var n=["g6-annotation-title","g6-annotation-content","g6-annotation-title-input","g6-annotation-content-input"];t.draggable=!0,t.addEventListener("dragstart",function(e){var o=e.target.className;if(!n.includes(o)){var i=t.style;r.set("dragging",{card:t,x:e.clientX,y:e.clientY,left:Aj(i.left),top:Aj(i.top)})}}),t.addEventListener("drag",function(t){t.preventDefault();var n=r.get("cardInfoMap");if(n){var o=t.clientX,i=t.clientY,a=r.get("dragging");if(!isNaN(o)&&!isNaN(i)&&a){var s=a.x,u=a.y,l=a.left,c=a.top,f=a.card,h=o-s,p=i-u;l+=h,c+=p;var d=r.get("graph"),y=d.getPointByCanvas(0,0),v=d.getPointByCanvas(d.getWidth(),d.getHeight()),g=d.getClientByPoint(y.x,y.y),m=g.x,b=g.y,w=d.getClientByPoint(v.x,v.y),S=w.x,x=w.y,_=f.getBoundingClientRect(),E=_.right-_.left,O=_.bottom-_.top;(l>S-m-E&&h>0||l<0&&h<0)&&(l-=h),(c>x-b-O&&p>0||c<0&&p<0)&&(c-=p),wT(f,{left:"".concat(l,"px"),top:"".concat(c,"px"),visibility:"hidden"}),s=o,u=i;var P=(n[e]||{}).link;if(P){var k=d.findById(e);P.attr("path",Tj(k,_,d,r.get("canvas")))}r.set("dragging",{x:s,y:u,left:l,top:c,card:f})}}});t.addEventListener("dragend",function(t){var n=r.get("cardInfoMap");if(n){var o=r.get("dragging");if(o){var i=o.left,a=o.top,s=o.card;n[e].x=i,n[e].y=a,wT(s,{visibility:"visible"}),r.set("dragging",!1);var u=r.get("rows");null===u||void 0===u||u.forEach(function(t){for(var r=t.length-1;r>=0;r--)t[r].id===e&&t.splice(r,1)});var l=r.get("onAnnotationChange");null===l||void 0===l||l(n[e],"update")}}})}},e.prototype.updateCardSize=function(t){var e=this.get("cardInfoMap");if(e){var r=e[t].card,n=r.getBoundingClientRect().width,o=r.getElementsByClassName("g6-annotation-title")[0];if(o){var i=getComputedStyle(o),a=Aj(i.marginLeft),s=o.getBoundingClientRect().width;wT(o,{marginRight:"".concat(n-a-24-16-s,"px")})}}},e.prototype.updateLink=function(t){var e=t.item;if(e){var r=this.get("cardInfoMap");if(r){var n=this.get("canvas"),o=this.get("graph"),i=r[e.getID()]||{},a=i.link,s=i.card;if(a){var u=Tj(e,s.getBoundingClientRect(),o,n);a.attr("path",u)}}}},e.prototype.updateLinks=function(){var t=this;if(!this.destroyed){var e=this.get("cardInfoMap");if(e){var r=this.get("graph");Object.values(e).forEach(function(e){var n=e.id,o=r.findById(n);t.updateLink({item:o})})}}},e.prototype.onGraphDataChange=function(){var t=this,e=this.get("cardInfoMap");if(e){var r=this.get("graph");Object.values(e).forEach(function(e){var n=e.id,o=e.card,i=e.isCanvas;if(o&&!i&&"none"!==o.style.display){var a=r.findById(n);a&&a.isVisible()?t.toggleAnnotation(a):t.hideCard(n)}})}},e.prototype.onGraphItemVisibilityChange=function(t){var e=t.item,r=t.visible;if(e&&!e.destroyed){var n=this.get("cardInfoMap");if(n){var o=e.getID();n[o]&&(r||this.hideCard(o))}}},e.prototype.saveData=function(t){void 0===t&&(t=!1);var e=this.get("cardInfoMap");if(e){var r=this.get("graph"),n=this.get("getTitle"),o=this.get("getContent"),i=[];return Object.values(e).forEach(function(e){var a=e.title,s=e.content,u=e.x,l=e.y,c=e.id,f=e.collapsed,h=e.card;if(!h||"none"!==h.style.display||t){var p=r.findById(c)||r.get("canvas");i.push({id:c,x:u,y:l,collapsed:f,title:a||(null===n||void 0===n?void 0:n(p)),content:s||(null===o||void 0===o?void 0:o(p)),visible:h&&"none"!==h.style.display})}}),i}},e.prototype.readData=function(t){var e=this,r=this.get("graph");t.forEach(function(t){var n=t.id,o=t.x,i=t.y,a=t.title,s=t.content,u=t.collapsed,l=t.visible,c=r.findById(n);if(c||"canvas-annotation"!==n||(c=r.get("canvas")),!c){var f=e.get("cardInfoMap")||{};return f[n]=t,void e.set("cardInfoMap",f)}e.toggleAnnotation(c,{x:o,y:i,title:a,content:s,collapsed:u}),l||e.hideCard(n)})},e.prototype.clear=function(){var t=this.get("cardInfoMap");if(t){var e=this.get("container");Object.values(t).forEach(function(t){var r=t.card,n=t.link;e.removeChild(r),null===n||void 0===n||n.remove(!0)}),this.set("cardInfoMap",{})}},e.prototype.destroy=function(){var t;this.clear(),null===(t=this.get("canvas"))||void 0===t||t.destroy();var e=this.get("graph");e&&!e.destroyed&&(this.get("containerCfg")&&e.getContainer().removeChild(this.get("container")),this.destroyed=!0)},e}(ST),Tj=function(t,e,r,n){var o,i;if("edge"===t.getType())i=[t.getKeyShape().getPoint(.5)];else{var a=null===(o=t.getKeyShape)||void 0===o?void 0:o.call(t).getBBox(),s=a.minX,u=a.minY,l=a.maxX,c=a.maxY,f=t.getModel(),h=f.x,p=f.y;i={left:{x:s+=h,y:((u+=p)+(c+=p))/2},right:{x:l+=h,y:(u+c)/2},top:{x:(s+l)/2,y:u},bottom:{x:(s+l)/2,y:c}}}Object.keys(i).forEach(function(t){var e=i[t],o=e.x,a=e.y,s=r.getClientByPoint(o,a);i[t]=n.getPointByClient(s.x,s.y)});var d=e.top,y=void 0===d?0:d,v=e.left,g=void 0===v?0:v,m=e.right,b=void 0===m?0:m,w=e.bottom,S=void 0===w?0:w,x={left:n.getPointByClient(g,(y+S)/2),right:n.getPointByClient(b,(y+S)/2),top:n.getPointByClient((g+b)/2,y),bottom:n.getPointByClient((g+b)/2,S)};return function(t,e){var r,n,o=1/0;Object.keys(t).forEach(function(i){var a=t[i];Object.keys(e).forEach(function(t){var i=e[t],s=a.x-i.x,u=a.y-i.y,l=s*s+u*u;o>l&&(o=l,r=a,n=i)})});var i=yO.getControlPoint(r,n,.5,20);return[["M",r.x,r.y],["Q",i.x,i.y,n.x,n.y]]}(i,x)},Aj=function(t){return Number(t.replace(/\s+|px/gi,""))||0},Mj={PluginBase:ST,Menu:CT,Grid:ET,Minimap:IT,Bundling:DT,ToolBar:VT,Tooltip:qT,Fisheye:UT,TimeBar:uj,ImageMinimap:fj,EdgeFilterLens:vj,SnapLine:wj,Legend:Ej,Annotation:Cj};mO("circle",{options:{size:xO.defaultNode.size,style:{x:0,y:0,stroke:xO.defaultNode.style.stroke,fill:xO.defaultNode.style.fill,lineWidth:xO.defaultNode.style.lineWidth},labelCfg:{style:{fill:xO.nodeLabel.style.fill,fontSize:xO.nodeLabel.style.fontSize,fontFamily:xO.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:xO.defaultNode.linkPoints.size,lineWidth:xO.defaultNode.linkPoints.lineWidth,fill:xO.defaultNode.linkPoints.fill,stroke:xO.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,eg.__assign)({},xO.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=void 0===r?{}:r,o=this.getShapeStyle(t),i=(0,rg.deepMix)({},n,t.icon),a="".concat(this.type,"-keyShape"),s=e.addShape("circle",{attrs:o,className:a,name:a,draggable:!0});e.shapeMap[a]=s;var u=i.width,l=i.height,c=i.show,f=i.text;if(c){var h="".concat(this.type,"-icon");e.shapeMap[h]=f?e.addShape("text",{attrs:(0,eg.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:h,name:h,draggable:!0}):e.addShape("image",{attrs:(0,eg.__assign)({x:-u/2,y:-l/2},i),className:h,name:h,draggable:!0})}return this.drawLinkPoints(t,e),s},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints;if(r){var n=r||{},o=n.top,i=n.left,a=n.right,s=n.bottom,u=n.size,l=n.r,c=(0,eg.__rest)(n,["top","left","right","bottom","size","r"]),f=this.getSize(t)[0]/2;if(i){var h="link-point-left";e.shapeMap[h]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:-f,y:0,r:u/2||l||5}),className:h,name:h,isAnchorPoint:!0})}if(a){var p="link-point-right";e.shapeMap[p]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:f,y:0,r:u/2||l||5}),className:p,name:p,isAnchorPoint:!0})}if(o){var d="link-point-top";e.shapeMap[d]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:0,y:-f,r:u/2||l||5}),className:d,name:d,isAnchorPoint:!0})}if(s){var y="link-point-bottom";e.shapeMap[y]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:0,y:f,r:u/2||l||5}),className:y,name:y,isAnchorPoint:!0})}}},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,rg.deepMix)({},e,r),o=this.getSize(t)[0]/2;return(0,eg.__assign)({x:0,y:0,r:o},n)},update:function(t,e,r){var n=e.getContainer(),o=this.getSize(t),i=(0,eg.__assign)({},t.style);void 0===t.style.stroke&&t.color&&(i.stroke=t.color),void 0!==t.style.r||isNaN(o[0])||(i.r=o[0]/2),this.updateShape(t,e,i,!0,r),this.updateLinkPoints(t,n)}},"single-node"),mO("rect",{options:{size:[100,30],style:{radius:0,stroke:xO.defaultNode.style.stroke,fill:xO.defaultNode.style.fill,lineWidth:xO.defaultNode.style.lineWidth},labelCfg:{style:{fill:xO.nodeLabel.style.fill,fontSize:xO.nodeLabel.style.fontSize,fontFamily:xO.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:xO.defaultNode.linkPoints.size,lineWidth:xO.defaultNode.linkPoints.lineWidth,fill:xO.defaultNode.linkPoints.fill,stroke:xO.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},anchorPoints:[[0,.5],[1,.5]],stateStyles:(0,eg.__assign)({},xO.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(t,e){var r=this.getShapeStyle(t),n=e.addShape("rect",{attrs:r,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return e.shapeMap["".concat(this.type,"-keyShape")]=n,this.drawLinkPoints(t,e),n},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=void 0===r?{}:r,o=n.top,i=n.left,a=n.right,s=n.bottom,u=n.size,l=n.r,c=(0,eg.__rest)(n,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],p=f[1];i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:-h/2,y:0,r:u/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:h/2,y:0,r:u/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:0,y:-p/2,r:u/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:0,y:p/2,r:u/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,rg.mix)({},e,r),o=this.getSize(t),i=n.width||o[0],a=n.height||o[1];return(0,eg.__assign)({x:-i/2,y:-a/2,width:i,height:a},n)},update:function(t,e,r){var n=e.getContainer(),o=this.getOptions({}).style,i=this.getSize(t),a=e.get("keyShape");t.size||(i[0]=a.attr("width")||o.width,i[1]=a.attr("height")||o.height);var s={stroke:t.color,x:-i[0]/2,y:-i[1]/2,width:i[0],height:i[1]},u=(0,rg.mix)({},o,a.attr(),s);u=(0,rg.mix)(u,t.style),this.updateShape(t,e,u,!1,r),this.updateLinkPoints(t,n)}},"single-node"),mO("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:xO.defaultNode.style.stroke,fill:xO.defaultNode.style.fill,lineWidth:xO.defaultNode.style.lineWidth},labelCfg:{style:{fill:xO.nodeLabel.style.fill,fontSize:xO.nodeLabel.style.fontSize,fontFamily:xO.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:xO.defaultNode.linkPoints.size,lineWidth:xO.defaultNode.linkPoints.lineWidth,fill:xO.defaultNode.linkPoints.fill,stroke:xO.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,eg.__assign)({},xO.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=void 0===r?{}:r,o=this.getShapeStyle(t),i=e.addShape("ellipse",{attrs:o,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});e.shapeMap["ellipse-keyShape"]=i;var a=n.width,s=n.height,u=n.show,l=n.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=l?e.addShape("text",{attrs:(0,eg.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:(0,eg.__assign)({x:-a/2,y:-s/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),i},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=void 0===r?{}:r,o=n.top,i=n.left,a=n.right,s=n.bottom,u=n.size,l=n.r,c=(0,eg.__rest)(n,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0]/2,p=f[1]/2;i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:-h,y:0,r:u/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:h,y:0,r:u/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:0,y:-p,r:u/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:0,y:p,r:u/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,rg.mix)({},e,r),o=this.getSize(t),i=o[0]/2,a=o[1]/2;return(0,eg.__assign)({x:0,y:0,rx:i,ry:a},n)},update:function(t,e,r){var n=e.getContainer(),o=this.getOptions({}).style,i=this.getSize(t),a={stroke:t.color,rx:i[0]/2,ry:i[1]/2},s=e.get("keyShape"),u=(0,rg.mix)({},o,s.attr(),a);u=(0,rg.mix)(u,t.style),this.updateShape(t,e,u,!0,r),this.updateLinkPoints(t,n)}},"single-node"),mO("diamond",{options:{size:[80,80],style:{stroke:xO.defaultNode.style.stroke,fill:xO.defaultNode.style.fill,lineWidth:xO.defaultNode.style.lineWidth},labelCfg:{style:{fill:xO.nodeLabel.style.fill,fontSize:xO.nodeLabel.style.fontSize,fontFamily:xO.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:xO.defaultNode.linkPoints.size,lineWidth:xO.defaultNode.linkPoints.lineWidth,fill:xO.defaultNode.linkPoints.fill,stroke:xO.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,eg.__assign)({},xO.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=void 0===r?{}:r,o=this.getShapeStyle(t),i=e.addShape("path",{attrs:o,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=i;var a=n.width,s=n.height,u=n.show,l=n.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=l?e.addShape("text",{attrs:(0,eg.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:(0,eg.__assign)({x:-a/2,y:-s/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),i},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=void 0===r?{}:r,o=n.top,i=n.left,a=n.right,s=n.bottom,u=n.size,l=n.r,c=(0,eg.__rest)(n,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],p=f[1];i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:-h/2,y:0,r:u/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:h/2,y:0,r:u/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:0,y:-p/2,r:u/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:0,y:p/2,r:u/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getPath:function(t){var e=this.getSize(t),r=e[0],n=e[1];return[["M",0,-n/2],["L",r/2,0],["L",0,n/2],["L",-r/2,0],["Z"]]},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,rg.mix)({},e,r),o=this.getPath(t);return(0,eg.__assign)({path:o},n)},update:function(t,e,r){var n=e.getContainer(),o=this.getOptions({}).style,i=this.getPath(t),a={stroke:t.color,path:i},s=e.get("keyShape"),u=(0,rg.mix)({},o,s.attr(),a);u=(0,rg.mix)(u,t.style),this.updateShape(t,e,u,!0,r),this.updateLinkPoints(t,n)}},"single-node"),mO("triangle",{options:{size:40,direction:"up",style:{stroke:xO.defaultNode.style.stroke,fill:xO.defaultNode.style.fill,lineWidth:xO.defaultNode.style.lineWidth},labelCfg:{style:{fill:xO.nodeLabel.style.fill,fontSize:xO.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:xO.defaultNode.linkPoints.size,lineWidth:xO.defaultNode.linkPoints.lineWidth,fill:xO.defaultNode.linkPoints.fill,stroke:xO.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20,offset:6},stateStyles:(0,eg.__assign)({},xO.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.icon,o=void 0===n?{}:n,i=r.direction,a=this.getShapeStyle(t),s=t.direction||i,u=e.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=u;var l=o.width,c=o.height,f=o.show,h=o.offset,p=o.text;if(f)if(p)e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,eg.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0});else{var d=-l/2,y=-c/2;"up"!==s&&"down"!==s||(y+=h),"left"!==s&&"right"!==s||(d+=h),e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,eg.__assign)({x:d,y:y},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(t,e),u},drawLinkPoints:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.linkPoints,o=void 0===n?{}:n,i=r.direction,a=t.direction||i,s=o.top,u=o.left,l=o.right,c=o.bottom,f=o.size,h=o.r,p=(0,eg.__rest)(o,["top","left","right","bottom","size","r"]),d=this.getSize(t)[0];if(u){var y=null,v=d*Math.sin(1/3*Math.PI),g=d*Math.sin(1/3*Math.PI);"up"===a?y=[-g,v]:"down"===a?y=[-g,-v]:"left"===a&&(y=[-g,g-v]),y&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},p),{x:y[0],y:y[1],r:f/2||h||5}),className:"link-point-left",name:"link-point-left"}))}if(l){var m=null;v=d*Math.sin(1/3*Math.PI),g=d*Math.sin(1/3*Math.PI);"up"===a?m=[g,v]:"down"===a?m=[g,-v]:"right"===a&&(m=[g,g-v]),m&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},p),{x:m[0],y:m[1],r:f/2||h||5}),className:"link-point-right",name:"link-point-right"}))}if(s){var b=null;v=d*Math.sin(1/3*Math.PI),g=d*Math.sin(1/3*Math.PI);"up"===a?b=[g-v,-v]:"left"===a?b=[g,-v]:"right"===a&&(b=[-g,-v]),b&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},p),{x:b[0],y:b[1],r:f/2||h||5}),className:"link-point-top",name:"link-point-top"}))}if(c){var w=null;v=d*Math.sin(1/3*Math.PI),g=d*Math.sin(1/3*Math.PI);"down"===a?w=[-g+v,v]:"left"===a?w=[g,v]:"right"===a&&(w=[-g,v]),w&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},p),{x:w[0],y:w[1],r:f/2||h||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(t){var e=(this.mergeStyle||this.getOptions(t)).direction,r=t.direction||e,n=this.getSize(t)[0],o=n*Math.sin(1/3*Math.PI),i=n*Math.sin(1/3*Math.PI),a=[["M",-i,o],["L",0,-o],["L",i,o],["Z"]];return"down"===r?a=[["M",-i,-o],["L",i,-o],["L",0,o],["Z"]]:"left"===r?a=[["M",-i,i-o],["L",i,-i],["L",i,i],["Z"]]:"right"===r&&(a=[["M",i,i-o],["L",-i,i],["L",-i,-i],["Z"]]),a},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,rg.mix)({},e,r),o=this.getPath(t);return(0,eg.__assign)({path:o},n)},update:function(t,e,r){var n=e.getContainer(),o=this.getOptions({}).style,i=this.getPath(t),a={stroke:t.color,path:i},s=e.get("keyShape"),u=(0,rg.mix)({},o,s.attr(),a);u=(0,rg.mix)(u,t.style),this.updateShape(t,e,u,!0,r),this.updateLinkPoints(t,n)},updateLinkPoints:function(t,e){var r=this.getOptions({}),n=r.linkPoints,o=r.direction,i=t.direction||o,a=e.shapeMap["link-point-left"]||e.find(function(t){return"link-point-left"===t.get("className")}),s=e.shapeMap["link-point-right"]||e.find(function(t){return"link-point-right"===t.get("className")}),u=e.shapeMap["link-point-top"]||e.find(function(t){return"link-point-top"===t.get("className")}),l=e.shapeMap["link-point-bottom"]||e.find(function(t){return"link-point-bottom"===t.get("className")}),c=n,f=a||s||u||l;f&&(c=f.attr());var h=(0,rg.mix)({},c,t.linkPoints),p=h.fill,d=h.stroke,y=h.lineWidth,v=h.size/2;v||(v=h.r);var g=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},m=g.left,b=g.right,w=g.top,S=g.bottom,x=this.getSize(t)[0],_={r:v,fill:p,stroke:d,lineWidth:y},E=null,O=x*Math.sin(1/3*Math.PI),P=x*Math.sin(1/3*Math.PI);"up"===i?E=[-P,O]:"down"===i?E=[-P,-O]:"left"===i&&(E=[-P,P-O]),E&&(a?m||void 0===m?a.attr((0,eg.__assign)((0,eg.__assign)({},_),{x:E[0],y:E[1]})):(a.remove(),delete e.shapeMap["link-point-left"]):m&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},_),{x:E[0],y:E[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var k=null;"up"===i?k=[P,O]:"down"===i?k=[P,-O]:"right"===i&&(k=[P,P-O]),k&&(s?b||void 0===b?s.attr((0,eg.__assign)((0,eg.__assign)({},_),{x:k[0],y:k[1]})):(s.remove(),delete e.shapeMap["link-point-right"]):b&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},_),{x:k[0],y:k[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var C=null;"up"===i?C=[P-O,-O]:"left"===i?C=[P,-O]:"right"===i&&(C=[-P,-O]),C&&(u?w||void 0===w?u.attr((0,eg.__assign)((0,eg.__assign)({},_),{x:C[0],y:C[1]})):(u.remove(),delete e.shapeMap["link-point-top"]):w&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},_),{x:C[0],y:C[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var T=null;"down"===i?T=[-P+O,O]:"left"===i?T=[P,O]:"right"===i&&(T=[-P,O]),T&&(l?S||void 0===S?l.attr((0,eg.__assign)((0,eg.__assign)({},_),{x:T[0],y:T[1]})):(l.remove(),delete e.shapeMap["link-point-bottom"]):S&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},_),{x:T[0],y:T[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node"),mO("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:xO.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:xO.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:xO.windowFontFamily},paddingTop:0},preRect:{show:!0,width:4,fill:"#40a9ff",radius:2},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:10,lineWidth:1,fill:"#72CC4A",stroke:"#72CC4A"},logoIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/4f81893c-1806-4de4-aff3-9a6b266bc8a2.svg",width:16,height:16,offset:0},stateIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/300a2523-67e0-4cbf-9d4a-67c077b40395.svg",width:16,height:16,offset:-5},anchorPoints:[[0,.5],[1,.5]]},shapeType:"modelRect",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).preRect,n=void 0===r?{}:r,o=this.getShapeStyle(t),i=this.getSize(t),a=i[0],s=i[1],u=e.addShape("rect",{attrs:o,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=u;var l=n.show,c=(0,eg.__rest)(n,["show"]);return l&&(e.shapeMap["pre-rect"]=e.addShape("rect",{attrs:(0,eg.__assign)({x:-a/2,y:-s/2,height:s},c),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(t,e),this.drawStateIcon(t,e),this.drawLinkPoints(t,e),u},drawLogoIcon:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).logoIcon,n=void 0===r?{}:r,o=this.getSize(t)[0];if(n.show){var i=n.width,a=n.height,s=n.x,u=n.y,l=n.offset,c=n.text,f=(0,eg.__rest)(n,["width","height","x","y","offset","text"]);e.shapeMap["rect-logo-icon"]=c?e.addShape("text",{attrs:(0,eg.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},f),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):e.addShape("image",{attrs:(0,eg.__assign)((0,eg.__assign)({},f),{x:s||-o/2+i+l,y:u||-a/2,width:i,height:a}),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0})}},drawStateIcon:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).stateIcon,n=void 0===r?{}:r,o=this.getSize(t)[0];if(n.show){var i=n.width,a=n.height,s=n.x,u=n.y,l=n.offset,c=n.text,f=(0,eg.__rest)(n,["width","height","x","y","offset","text"]);e.shapeMap["rect-state-icon"]=c?e.addShape("text",{attrs:(0,eg.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},f),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):e.addShape("image",{attrs:(0,eg.__assign)((0,eg.__assign)({},f),{x:s||o/2-i+l,y:u||-a/2,width:i,height:a}),className:"rect-state-icon",name:"rect-state-icon",draggable:!0})}},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=void 0===r?{}:r,o=n.top,i=n.left,a=n.right,s=n.bottom,u=n.size,l=n.r,c=(0,eg.__rest)(n,["top","left","right","bottom","size","r"]),f=this.getSize(t),h=f[0],p=f[1];i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:-h/2,y:0,r:u/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:h/2,y:0,r:u/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:0,y:-p/2,r:u/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},c),{x:0,y:p/2,r:u/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(t,e){var r=this.getOptions(t),n=r.labelCfg,o=void 0===n?{}:n,i=r.logoIcon,a=void 0===i?{}:i,s=r.descriptionCfg,u=void 0===s?{}:s,l=this.getSize(t)[0],c=null,f=a.show,h=a.width,p=-l/2+o.offset;f&&(p=-l/2+h+o.offset);var d=o.style,y=u.style,v=u.paddingTop;return(0,rg.isString)(t.description)?(c=e.addShape("text",{attrs:(0,eg.__assign)((0,eg.__assign)({},d),{x:p,y:-5,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=c,e.shapeMap["rect-description"]=e.addShape("text",{attrs:(0,eg.__assign)((0,eg.__assign)({},y),{x:p,y:17+(v||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(c=e.addShape("text",{attrs:(0,eg.__assign)((0,eg.__assign)({},d),{x:p,y:7,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=c),c},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,rg.mix)({},e,r),o=this.getSize(t),i=n.width||o[0],a=n.height||o[1];return(0,eg.__assign)({x:-i/2,y:-a/2,width:i,height:a},n)},update:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.style,o=void 0===n?{}:n,i=r.labelCfg,a=void 0===i?{}:i,s=r.descriptionCfg,u=void 0===s?{}:s,l=this.getSize(t),c=l[0],f=l[1];e.get("keyShape").attr((0,eg.__assign)((0,eg.__assign)({},o),{x:-c/2,y:-f/2,width:c,height:f}));var h=e.getContainer(),p=h.shapeMap["rect-logo-icon"]||h.find(function(t){return"rect-logo-icon"===t.get("className")}),d=p?p.attr():{},y=(0,rg.mix)({},d,t.logoIcon),v=y.width;void 0===v&&(v=this.options.logoIcon.width);var g=t.logoIcon?t.logoIcon.show:void 0,m=a.offset,b=-c/2+v+m;g||void 0===g||(b=-c/2+m);var w=h.shapeMap["node-label"]||h.find(function(t){return"node-label"===t.get("className")}),S=h.shapeMap["rect-description"]||h.find(function(t){return"rect-description"===t.get("className")});if(t.label)if(w){var x=t.labelCfg?t.labelCfg.style:{},_=(0,rg.mix)({},w.attr(),x);t.label&&(_.text=t.label),_.x=b,(0,rg.isString)(t.description)&&(_.y=-5),S&&(S.resetMatrix(),S.attr({x:b})),w.resetMatrix(),w.attr(_)}else h.shapeMap["node-label"]=h.addShape("text",{attrs:(0,eg.__assign)((0,eg.__assign)({},a.style),{x:b,y:t.description?-5:7,text:t.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});if((0,rg.isString)(t.description)){var E=u.paddingTop;if(S){x=t.descriptionCfg?t.descriptionCfg.style:{};var O=(0,rg.mix)({},S.attr(),x);(0,rg.isString)(t.description)&&(O.text=t.description),O.x=b,S.resetMatrix(),S.attr((0,eg.__assign)((0,eg.__assign)({},O),{y:17+(E||0)}))}else h.shapeMap["rect-description"]=h.addShape("text",{attrs:(0,eg.__assign)((0,eg.__assign)({},u.style),{x:b,y:17+(E||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})}var P=h.shapeMap["pre-rect"]||h.find(function(t){return"pre-rect"===t.get("className")});if(P&&!P.destroyed){var k=(0,rg.mix)({},P.attr(),t.preRect);P.attr((0,eg.__assign)((0,eg.__assign)({},k),{x:-c/2,y:-f/2,height:f}))}if(p&&!p.destroyed)if(g||void 0===g){var C=y.width,T=y.height,A=y.x,M=y.y,j=y.offset,I=(0,eg.__rest)(y,["width","height","x","y","offset"]);p.attr((0,eg.__assign)((0,eg.__assign)({},I),{x:A||-c/2+C+j,y:M||-T/2,width:C,height:T}))}else p.remove(),delete h.shapeMap["pre-rect"];else g&&this.drawLogoIcon(t,h);var N=h.shapeMap["rect-state-icon"]||h.find(function(t){return"rect-state-icon"===t.get("className")}),L=N?N.attr():{},R=(0,rg.mix)({},L,t.stateIcon);if(N){R.show||void 0===R.show||(N.remove(),delete h.shapeMap["rect-state-icon"]);var D=R.width,B=(T=R.height,A=R.x,M=R.y,R.offset),F=(0,eg.__rest)(R,["width","height","x","y","offset"]);N.attr((0,eg.__assign)((0,eg.__assign)({},F),{x:A||c/2-D+B,y:M||-T/2,width:D,height:T}))}else R.show&&this.drawStateIcon(t,h);this.updateLinkPoints(t,h)},getOptions:function(t,e){return"move"===e?t:(0,rg.deepMix)({},this.options,this.getCustomConfig(t)||{},t)}},"single-node"),mO("star",{options:{size:60,style:{stroke:xO.defaultNode.style.stroke,fill:xO.defaultNode.style.fill,lineWidth:xO.defaultNode.style.lineWidth},labelCfg:{style:{fill:xO.nodeLabel.style.fill,fontSize:xO.nodeLabel.style.fontSize,fontFamily:xO.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:xO.defaultNode.linkPoints.size,lineWidth:xO.defaultNode.linkPoints.lineWidth,fill:xO.defaultNode.linkPoints.fill,stroke:xO.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,eg.__assign)({},xO.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=void 0===r?{}:r,o=this.getShapeStyle(t),i=e.addShape("path",{attrs:o,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=i;var a=n.width,s=n.height,u=n.show,l=n.text;return u&&(e.shapeMap["".concat(this.type,"-icon")]=l?e.addShape("text",{attrs:(0,eg.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:(0,eg.__assign)({x:-a/2,y:-s/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),i},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=void 0===r?{}:r,o=n.top,i=n.left,a=n.right,s=n.leftBottom,u=n.rightBottom,l=n.size,c=n.r,f=(0,eg.__rest)(n,["top","left","right","leftBottom","rightBottom","size","r"]),h=this.getSize(t)[0];if(a){var p=Math.cos(.1*Math.PI)*h,d=Math.sin(.1*Math.PI)*h;e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},f),{x:p,y:-d,r:l/2||c||5}),className:"link-point-right",name:"link-point-right"})}if(o){p=Math.cos(.5*Math.PI)*h,d=Math.sin(.5*Math.PI)*h;e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},f),{x:p,y:-d,r:l/2||c||5}),className:"link-point-top",name:"link-point-top"})}if(i){p=Math.cos(.9*Math.PI)*h,d=Math.sin(.9*Math.PI)*h;e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},f),{x:p,y:-d,r:l/2||c||5}),className:"link-point-left",name:"link-point-left"})}if(s){p=Math.cos(1.3*Math.PI)*h,d=Math.sin(1.3*Math.PI)*h;e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},f),{x:p,y:-d,r:l/2||c||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(u){p=Math.cos(1.7*Math.PI)*h,d=Math.sin(1.7*Math.PI)*h;e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},f),{x:p,y:-d,r:l/2||c||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(t){var e=this.getSize(t)[0],r=3*e/8,n=t.innerR||r;return yO.getStarPath(e,n)},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,rg.mix)({},e,r),o=this.getPath(t);return(0,eg.__assign)({path:o},n)},update:function(t,e,r){var n=e.getContainer(),o=this.getOptions({}).style,i=this.getPath(t),a={stroke:t.color,path:i},s=e.get("keyShape"),u=(0,rg.mix)({},o,s.attr(),a);u=(0,rg.mix)(u,t.style),this.updateShape(t,e,u,!0,r),this.updateLinkPoints(t,n)},updateLinkPoints:function(t,e){var r=this.getOptions({}).linkPoints,n=e.shapeMap["link-point-left"]||e.find(function(t){return"link-point-left"===t.get("className")}),o=e.shapeMap["link-point-right"]||e.find(function(t){return"link-point-right"===t.get("className")}),i=e.shapeMap["link-point-top"]||e.find(function(t){return"link-point-top"===t.get("className")}),a=e.shapeMap["link-point-left-bottom"]||e.find(function(t){return"link-point-left-bottom"===t.get("className")}),s=e.shapeMap["link-point-left-bottom"]||e.find(function(t){return"link-point-right-bottom"===t.get("className")}),u=r,l=n||o||i||a||s;l&&(u=l.attr());var c=(0,rg.mix)({},u,t.linkPoints),f=c.fill,h=c.stroke,p=c.lineWidth,d=c.size/2;d||(d=c.r);var y=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},v=y.left,g=y.right,m=y.top,b=y.leftBottom,w=y.rightBottom,S=this.getSize(t)[0],x={r:d,fill:f,stroke:h,lineWidth:p},_=Math.cos(.1*Math.PI)*S,E=Math.sin(.1*Math.PI)*S;o?g||void 0===g?o.attr((0,eg.__assign)((0,eg.__assign)({},x),{x:_,y:-E})):(o.remove(),delete e.shapeMap["link-point-right"]):g&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},x),{x:_,y:-E}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),_=Math.cos(.5*Math.PI)*S,E=Math.sin(.5*Math.PI)*S,i?m||void 0===m?i.attr((0,eg.__assign)((0,eg.__assign)({},x),{x:_,y:-E})):(i.remove(),delete e.shapeMap["link-point-top"]):m&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},x),{x:_,y:-E}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),_=Math.cos(.9*Math.PI)*S,E=Math.sin(.9*Math.PI)*S,n?v||void 0===v?n.attr((0,eg.__assign)((0,eg.__assign)({},x),{x:_,y:-E})):(n.remove(),delete e.shapeMap["link-point-left"]):v&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},x),{x:_,y:-E}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),_=Math.cos(1.3*Math.PI)*S,E=Math.sin(1.3*Math.PI)*S,a?b||void 0===b?a.attr((0,eg.__assign)((0,eg.__assign)({},x),{x:_,y:-E})):(a.remove(),delete e.shapeMap["link-point-left-bottom"]):b&&(e.shapeMap["link-point-left-bottom"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},x),{x:_,y:-E}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),_=Math.cos(1.7*Math.PI)*S,E=Math.sin(1.7*Math.PI)*S,s?w||void 0===w?s.attr((0,eg.__assign)((0,eg.__assign)({},x),{x:_,y:-E})):(s.remove(),delete e.shapeMap["link-point-right-bottom"]):w&&(e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:(0,eg.__assign)((0,eg.__assign)({},x),{x:_,y:-E}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var jj=yO.defaultSubjectColors;mO("donut",{options:{size:xO.defaultNode.size,style:{x:0,y:0,stroke:xO.defaultNode.style.stroke,fill:xO.defaultNode.style.fill,lineWidth:xO.defaultNode.style.lineWidth},labelCfg:{style:{fill:xO.nodeLabel.style.fill,fontSize:xO.nodeLabel.style.fontSize,fontFamily:xO.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:xO.defaultNode.linkPoints.size,lineWidth:xO.defaultNode.linkPoints.lineWidth,fill:xO.defaultNode.linkPoints.fill,stroke:xO.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,eg.__assign)({},xO.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=void 0===r?{}:r,o=this.getShapeStyle(t),i=(0,rg.deepMix)({},n,t.icon),a=e.addShape("circle",{attrs:o,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});e.shapeMap["".concat(this.type,"-keyShape")]=a;var s=i.width,u=i.height,l=i.show,c=i.text;return l&&(e.shapeMap["".concat(this.type,"-icon")]=c?e.addShape("text",{attrs:(0,eg.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.addShape("image",{attrs:(0,eg.__assign)({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),Ij(t,e,a),this.drawLinkPoints(t,e),a},updateShape:function(t,e,r,n,o){var i=e.get("keyShape");i.attr((0,eg.__assign)({},r)),Lj(t,e,i),this.updateLabel(t,e,o),n&&this.updateIcon(t,e)}},"circle");var Ij=function(t,e,r){var n=t.donutAttrs,o=void 0===n?{}:n,i=t.donutColorMap,a=void 0===i?{}:i,s=Object.keys(o).length;if(o&&s>1){var u=Rj(o,a),l=u.configs,c=u.totalValue;if(c){var f=Dj(r),h=f.lineWidth,p=f.arcR,d=[p,0],y=0;if(1===s)return void Nj(e,{arcR:p,arcBegin:d,beginAngle:y,config:l[0],fanIndex:0,lineWidth:h,totalValue:c,drawWhole:!0});for(var v=0;v.999)r=[i,1e-4],o=1;else{var g=v*Math.PI*2;n=s+g,r=[i*Math.cos(n),-i*Math.sin(n)],o=g>Math.PI?1:0}var m={path:[["M",a[0],a[1]],["A",i,i,0,o,0,r[0],r[1]]],stroke:u.color||(null===y||void 0===y?void 0:y.attr("stroke"))||jj[l%jj.length],lineWidth:c};return y?y.attr(m):t.shapeMap["".concat("fan-shape-").concat(l)]=t.addShape("path",{attrs:m,name:"".concat("fan-shape-").concat(l),draggable:!0}),{beginAngle:n,arcBegin:r,shape:t.shapeMap["".concat("fan-shape-").concat(l)],shouldEnd:p||v>.999}},Lj=function(t,e,r){var n=t.donutAttrs,o=t.donutColorMap,i=void 0===o?{}:o,a={},s=e.getContainer();if(n){var u=Rj(n,i),l=u.configs,c=u.totalValue;if(c)for(var f=Dj(r),h=f.lineWidth,p=f.arcR,d=[p,0],y=0,v=0;v=0;n--){var o=t[n];o.id="".concat(o.x,"|||").concat(o.y),r[o.id]||(r[o.id]=o,e.push(o))}return e},Gj=function(t){return Fj(t)},Uj=function(t,e){return t.width||t.height?{centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}:t},zj=function(t,e,r){var n=function(t,e){var r=Math.abs(t.x-e.centerX),n=Math.abs(t.y-e.centerY);return 0===r&&0===n?0:r/e.width>n/e.height}(e,t);if(0===n){var o=t.centerX,i=t.centerY;return r.ye.x?o=t.maxX:r.xt.centerX?t.maxX:t.minX,y:e.y}:{x:e.x,y:e.y>t.centerY?t.maxY:t.minY}},Vj=function(t,e){var r=Math.min(t.minX,e.minX),n=Math.min(t.minY,e.minY),o=Math.max(t.maxX,e.maxX),i=Math.max(t.maxY,e.maxY);return{centerX:(r+o)/2,centerY:(n+i)/2,minX:r,minY:n,maxX:o,maxY:i,height:i-n,width:o-r}},Hj=function(t){return[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}]},qj=function(t,e){var r=t.x,n=t.y;return re.maxX||ne.maxY},Wj=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},Yj=function(t,e,r,n,o){return Wj(t,e)+Wj(t,r)+function(t,e){var r=0;return e.forEach(function(e){e&&(t.x===e.x&&(r+=-2),t.y===e.y&&(r+=-2))}),r}(t,[e,r,n,o])},Xj=function t(e,r,n,o,i){void 0===i&&(i=0),e.unshift(r[o]),n[o]&&n[o]!==o&&i<=100&&t(e,r,n,n[o],i+1)},Jj=function(t,e,r,n){var o=r.x-t.x,i=r.y-t.y,a=n.x-t.x,s=n.y-t.y,u=r.x-e.x,l=r.y-e.y,c=n.x-e.x,f=n.y-e.y;return(o*s-i*a)*(u*f-l*c)<=0&&(o*l-i*u)*(a*f-s*c)<=0},Kj=function(t,e,r){if(r.width||r.height){var n=Hj(r),o=n[0],i=n[1],a=n[2],s=n[3];return Jj(t,e,o,i)||Jj(t,e,o,s)||Jj(t,e,i,a)||Jj(t,e,a,s)}return!1},Qj=function(t,e,r,n){var o=[];return t.forEach(function(t){if(t!==e&&(t.x===e.x||t.y===e.y)){if(Kj(t,e,r)||Kj(t,e,n))return;o.push(t)}}),Fj(o)},Zj=function(t,e){var r=[],n=t[0];return r.push("M".concat(n.x," ").concat(n.y)),t.forEach(function(n,o){var i=t[o+1],a=t[o+2];if(i&&a)if(function(t,e,r){return!(t.x===e.x&&e.x===r.x||t.y===e.y&&e.y===r.y)}(n,i,a)){var s=function(t,e,r,n){var o=Wj(t,e),i=Wj(r,e);return ot.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]}(t,e.x).concat(function(t,e){return et.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]}(t,e.y))}(t,_).filter(function(t){return qj(t,y)&&qj(t,v)}))}),[{x:g.x,y:m.y},{x:m.x,y:g.y}].forEach(function(t){qj(t,y)&&qj(t,v)&&x.push(t)}),x.unshift(g),x.push(m);var E=function(t,e,r,n,o,i,a){var s,u=[],l=((s={})[e.id]=e,s),c={},f={},h={};f[e.id]=0,h[e.id]=Yj(e,r,e);var p=new tI;p.add({id:e.id,value:h[e.id]});var d,y={};for(t.forEach(function(t){y[t.id]=t});Object.keys(l).length;){var v=p.minId(!1);if(!v)break;if((d=l[v])===r){var g=[];return Xj(g,y,c,r.id),g}delete l[d.id],p.remove(d.id),u.push(d);var m=Qj(t,d,n,o);m.forEach(function(t){if(-1===u.indexOf(t)){var n=t.id;l[n]||(l[n]=t);var o=h[d.id]+Wj(d,t);f[n]&&o>=f[n]?p.add({id:n,value:h[n]}):(c[n]=d.id,f[n]=o,h[n]=f[n]+Yj(t,r,e,i,a),p.add({id:n,value:h[n]}))}})}return[e,r]}(x=Fj(x),g,m,i,a,t,e);return E.unshift(t),E.push(e),Gj(E)},tI=function(){function t(){this.arr=[],this.map={},this.arr=[],this.map={}}return t.prototype._innerAdd=function(t,e){for(var r=[0,e-1];r[1]-r[0]>1;){var n=Math.floor((r[0]+r[1])/2);if(this.arr[n].value>t.value)r[1]=n;else{if(!(this.arr[n].value=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t},t.prototype._findFirstId=function(){for(;this.arr.length;){var t=this.arr.shift();if(this.map[t.id])return t.id}},t.prototype.minId=function(t){return t?this._clearAndGetMinId():this._findFirstId()},t}(),eI={offset:20,maxAllowedDirectionChange:Math.PI/2,maximumLoops:2e3,gridSize:10,directions:[{stepX:1,stepY:0},{stepX:-1,stepY:0},{stepX:0,stepY:1},{stepX:0,stepY:-1}],get penalties(){return{0:0,45:this.gridSize/2,90:this.gridSize/2}},distFunc:function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},fallbackRoute:function(t,e,r,n,o){return Gj($j(t,e,r,n,o.offset))}},rI=(Math.PI,function(t,e){var r=Math.round(Math.abs(t/e));return r<0?0:(t<0?-1:1)*r}),nI=function(t,e){var r=e.x-t.x,n=e.y-t.y;return r||n?Math.atan2(n,r):0},oI=function(t,e){var r=Math.abs(t-e);return r>Math.PI?2*Math.PI-r:r},iI=function(t,e,r){for(var n=1/0,o=0,i=e.length;ou.minX&&e.xu.minY&&e.y0&&k>0;){var A=m.minId((k+1)%30==0);if(!A)break;if(S=p[A],T["".concat(S.x,"|||").concat(S.y)])return uI(S,y,l,e,t,c,s);delete p[S.id],m.remove(S.id),d[S.id]=!0;for(b=0;bi.maxAllowedDirectionChange||u[M])){p[M]||(p[M]=_);var j=a[P];E=i.distFunc(S,_)+(isNaN(j)?s:j),O=v[S.id]+E;var I=v[M];I&&O>=I||(y[M]=S,v[M]=O,g[M]=O+iI(_,h,i.distFunc),m.add({id:M,value:g[M]}))}}k-=1}return i.fallbackRoute(t,e,r,n,i)};bO("polyline",{options:{color:xO.defaultEdge.color,size:xO.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:xO.defaultEdge.style.stroke,lineAppendWidth:xO.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:xO.edgeLabel.style.fill,fontSize:xO.edgeLabel.style.fontSize,fontFamily:xO.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:(0,eg.__assign)({},xO.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(t,e){var r=this.getShapeStyle(t);0===r.radius&&delete r.radius;var n=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:r});return e.shapeMap["edge-shape"]=n,n},getShapeStyle:function(t){var e=this.options.style,r={stroke:t.color},n=(0,rg.mix)({},e,r,t.style);t=this.getPathPoints(t),this.radius=n.radius,this.offset=n.offset;var o=t.startPoint,i=t.endPoint,a=this.getControlPoints(t),s=[o];a&&(s=s.concat(a)),s.push(i);var u=t.sourceNode,l=t.targetNode,c=n.radius,f=this.options.routeCfg,h=(0,rg.mix)({},f,t.routeCfg);h.offset=n.offset;var p=this.getPath(s,u,l,c,h,!Boolean(a));return((0,rg.isArray)(p)&&p.length<=1||(0,rg.isString)(p)&&-1===p.indexOf("L"))&&(p="M0 0, L0 0"),(isNaN(o.x)||isNaN(o.y)||isNaN(i.x)||isNaN(i.y))&&(p="M0 0, L0 0"),(0,rg.mix)({},xO.defaultEdge.style,n,{lineWidth:t.size,path:p})},updateShapeStyle:function(t,e){var r=e.getContainer();if(e.isVisible()){var n={stroke:t.color},o=r.shapeMap["edge-shape"]||r.find(function(t){return"edge-shape"===t.get("className")})||e.getKeyShape(),i=t.size,a=(t=this.getPathPoints(t)).startPoint,s=t.endPoint,u=this.getControlPoints(t),l=[a];u&&(l=l.concat(u)),l.push(s);var c=o.attr(),f=(0,rg.mix)({},n,c,t.style),h=t.sourceNode,p=t.targetNode,d=f.radius,y=this.options.routeCfg,v=(0,rg.mix)({},y,t.routeCfg);v.offset=f.offset;var g=this.getPath(l,h,p,d,v,!Boolean(u));((0,rg.isArray)(g)&&g.length<=1||(0,rg.isString)(g)&&-1===g.indexOf("L"))&&(g="M0 0, L0 0"),(isNaN(a.x)||isNaN(a.y)||isNaN(s.x)||isNaN(s.y))&&(g="M0 0, L0 0"),c.endArrow&&!1===f.endArrow&&(t.style.endArrow={path:""}),c.startArrow&&!1===f.startArrow&&(t.style.startArrow={path:""});var m=(0,rg.mix)(n,o.attr(),{lineWidth:i,path:g},t.style);o&&o.attr(m)}},getPath:function(t,e,r,n,o,i){var a=o.offset,s=o.obstacles,u=o.simple;if(!a||t.length>2||!1===i){if(n)return Zj(t,n);var l=[];return(0,rg.each)(t,function(t,e){0===e?l.push(["M",t.x,t.y]):l.push(["L",t.x,t.y])}),l}!1===u||(null===s||void 0===s?void 0:s.length)||(u=!0);var c=u?$j(t[t.length-1],t[0],r,e,a):lI(t[0],t[t.length-1],e,r,o);return c&&c.length?n?Zj(c,n):(c=function(t){if(!(null===t||void 0===t?void 0:t.length))return t;for(var e=t[t.length-1],r={x:e.x,y:e.y},n=[e],o=[e],i=t.length-2;i>=0;i--){var a,s=t[i];s.x===r.x?n.push(s):(n=[s],r.x=s.x),s.y===r.y?o.push(s):(o=[s],r.y=s.y),n.length>2?(a=t.indexOf(n[1]))>-1&&t.splice(a,1):o.length>2&&(a=t.indexOf(o[1]))>-1&&t.splice(a,1)}return t}(c),yO.pointsToPolygon(c)):"M0 0, L0 0"}},"single-edge");var cI=qC.cloneEvent,fI=qC.isNaN,hI=Math.abs,pI=["shift","ctrl","alt","control"],dI={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,scalableRange:0,allowDragOnItem:!1}},getEvents:function(){return{mousedown:"onMouseDown",drag:"onDragMove",dragend:"onMouseUp","canvas:click":"onMouseUp",keyup:"onKeyUp",focus:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onMouseUp"}},updateViewport:function(t){var e=this.origin,r=+t.clientX,n=+t.clientY;if(!fI(r)&&!fI(n)){var o=r-e.x,i=n-e.y;"x"===this.get("direction")?i=0:"y"===this.get("direction")&&(o=0),this.origin={x:r,y:n};var a=this.graph.get("width"),s=this.graph.get("height"),u=this.graph.get("canvas").getCanvasBBox(),l=this.scalableRange,c=this.scalableRange;l<1&&l>-1&&(l*=a,c*=s),(u.minX<=a+l&&u.minX+o>a+l||u.maxX+l>=0&&u.maxX+l+o<0)&&(o=0),(u.minY<=s+c&&u.minY+i>s+c||u.maxY+c>=0&&u.maxY+c+i<0)&&(i=0),this.graph.translate(o,i)}},onTouchStart:function(t){var e=t.originalEvent.touches,r=e[0],n=e[1];r&&n||(t.preventDefault(),this.mousedown=!0,this.onDragStart(t))},onMouseDown:function(t){this.mousedown=!0},onDragMove:function(t){this.mousedown&&(this.dragstart?this.onDrag(t):(this.dragstart=!0,this.onDragStart(t)))},onDragStart:function(t){var e=t.originalEvent;if((!e||"touchstart"===t.name||0===e.button)&&("touchstart"===t.name||"undefined"==typeof window||!window.event||window.event.buttons||window.event.button)&&this.shouldBegin(t,this)&&!this.keydown&&this.allowDrag(t)){if(this.origin={x:t.clientX,y:t.clientY},this.dragging=!1,this.enableOptimize){for(var r=this.graph,n=r.getEdges(),o=0,i=n.length;os)for(var h=n.getNodes(),p=0,d=h.length;p-1?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(t){var e,r,n=t.target,o=n&&n.isCanvas&&n.isCanvas();if((0,rg.isBoolean)(this.allowDragOnItem)&&!this.allowDragOnItem&&!o)return!1;if((0,rg.isObject)(this.allowDragOnItem)){var i=this.allowDragOnItem,a=i.node,s=i.edge,u=i.combo,l=null===(r=null===(e=t.item)||void 0===e?void 0:e.getType)||void 0===r?void 0:r.call(e);if(!a&&"node"===l)return!1;if(!s&&"edge"===l)return!1;if(!u&&"combo"===l)return!1}return!0}},yI={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:mousedown":"onMouseDown",drag:"onDragMove",dragend:"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onDragEnd",afterchangedata:"onDragEnd"}},validationCombo:function(t){return!(!this.origin||!t||t.destroyed)&&"combo"===t.getType()},onTouchStart:function(t){if(t.item){try{var e=t.originalEvent.touches,r=e[0],n=e[1];if(r&&n)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},this.dragstart=!0,this.onDragStart(t)}},onTouchMove:function(t){try{var e=t.originalEvent.touches,r=e[0],n=e[1];if(r&&n)return void this.onDragEnd(t);t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.onDrag(t)},onMouseDown:function(t){this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},"undefined"==typeof window||this.windowEventBinded||(this.windowEventBinded=!0,document.body.addEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.addEventListener("mouseup",this.onDragEnd.bind(this)))},onDragMove:function(t){var e,r;"node"===(null===(r=null===(e=t.item)||void 0===e?void 0:e.getType)||void 0===r?void 0:r.call(e))?this.mousedown&&(this.dragstart?this.onDrag((0,eg.__assign)((0,eg.__assign)({},t),this.mousedown)):(this.dragstart=!0,this.onDragStart(t))):this.onDragEnd()},onDragStart:function(t){var e=this;if(this.currentShouldEnd=!0,this.shouldBegin((0,eg.__assign)((0,eg.__assign)({},t),this.mousedown),this)){var r=this.mousedown,n=r.item,o=r.target;if(n&&!n.destroyed&&!n.hasLocked()){if(n.getContainer().set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(n),o)if(o.get("isAnchorPoint"))return;var i=this.graph;this.targets=[],this.targetCombo=null;var a=i.findAllByState("node",this.selectedState),s=n.get("id");if(0===a.filter(function(t){var e=t.get("id");return s===e}).length?this.targets.push(n):a.length>1?a.forEach(function(t){t.hasLocked()||e.targets.push(t)}):this.targets.push(n),this.graph.get("enabledStack")&&this.enableStack){var u=[];this.targets.forEach(function(t){var e=t.getModel(),r=e.x,n=e.y,o=e.id;u.push({x:r,y:n,id:o})}),this.set("beforeDragNodes",u)}this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(t){t.getEdges().forEach(function(t){t.isVisible()&&(e.hidenEdge[t.getID()]=!0,t.hide())})}),this.origin=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(t){var e=this;if(this.mousedown&&this.origin&&this.shouldUpdate(t,this))if(this.get("enableDelegate"))this.updateDelegate(t);else if(this.enableDebounce)this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos});else{var r={};this.targets.map(function(n){e.update(n,t);var o=n.getModel().comboId;o&&(r[o]=e.graph.findById(o))}),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(t){var e,r=this;if(this.mousedown=!1,this.dragstart=!1,"undefined"!=typeof window&&this.windowEventBinded&&(this.windowEventBinded=!1,document.body.removeEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.removeEventListener("mouseup",this.onDragEnd.bind(this))),this.origin){null===(e=this.cachedCaptureItems)||void 0===e||e.forEach(function(t){t.getContainer().set("capture",!0)}),this.cachedCaptureItems=[],this.delegateRect&&(this.delegateRect.remove(),this.delegateRect=null),this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(t){t.getEdges().forEach(function(t){r.hidenEdge[t.getID()]&&t.show(),t.refresh()})}),this.hidenEdge={};var n=this.graph;if(n.get("enabledStack")&&this.enableStack){var o={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(t){o.before.nodes.push(t)}),this.targets.forEach(function(t){var e=t.getModel(),r=e.x,n=e.y,i=e.id;o.after.nodes.push({x:r,y:n,id:i})}),n.pushStack("update",(0,rg.clone)(o))}n.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(t){var e=t.item;if(this.currentShouldEnd=this.shouldEnd(t,e,this),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd&&this.validationCombo(e)){var r=this.graph;if(this.comboActiveState&&r.setItemState(e,this.comboActiveState,!1),this.targetCombo=e,this.onlyChangeComboSize)r.updateCombos();else{var n=e.getModel();this.targets.map(function(t){t.getModel().comboId!==n.id&&r.updateComboTree(t,n.id)}),r.updateCombo(e)}r.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(t){var e=this.graph;this.currentShouldEnd=this.shouldEnd(t,void 0,this),this.updatePositions(t,!this.currentShouldEnd),this.targets&&0!==this.targets.length&&this.currentShouldEnd&&(this.onlyChangeComboSize?this.updateParentCombos():this.targets.map(function(t){t.getModel().comboId&&e.updateComboTree(t)}))},onDropNode:function(t){if(this.targets&&0!==this.targets.length){var e=t.item,r=this.graph,n=e.getModel().comboId,o=n?r.findById(n):void 0;if(this.currentShouldEnd=this.shouldEnd(t,o,this),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(n){var i=r.findById(n);this.comboActiveState&&r.setItemState(i,this.comboActiveState,!1),this.targets.map(function(t){var e=t.getModel();n!==e.comboId&&r.updateComboTree(t,n)}),r.updateCombo(i)}else this.targets.map(function(t){t.getModel().comboId&&r.updateComboTree(t)});r.emit("dragnodeend",{items:this.targets,targetItem:e})}}},onDragEnter:function(t){var e=t.item;if(this.validationCombo(e)){var r=this.graph;this.comboActiveState&&r.setItemState(e,this.comboActiveState,!0)}},onDragLeave:function(t){var e=t.item;if(this.validationCombo(e)){var r=this.graph;this.comboActiveState&&r.setItemState(e,this.comboActiveState,!1)}},updatePositions:function(t,e){var r=this;this.targets&&0!==this.targets.length&&(this.get("enableDelegate")?this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos}):e||this.targets.map(function(e){return r.update(e,t)}):this.targets.map(function(n){return r.update(n,t,e)}))},update:function(t,e,r){var n=this.origin,o=t.get("model"),i=t.get("id");this.point[i]||(this.point[i]={x:o.x||0,y:o.y||0});var a=e.x-n.x+this.point[i].x,s=e.y-n.y+this.point[i].y;r&&(a+=n.x-e.x,s+=n.y-e.y);var u={x:a,y:s};this.get("updateEdge")?this.graph.updateItem(t,u,!1):t.updatePosition(u)},debounceUpdate:(0,rg.debounce)(function(t){var e=t.targets,r=t.graph,n=t.point,o=t.origin,i=t.evt,a=t.updateEdge,s=t.onlyChangeComboSize,u=t.updateParentCombos;e.map(function(t){var e=t.get("model"),s=t.get("id");n[s]||(n[s]={x:e.x||0,y:e.y||0});var u={x:i.x-o.x+n[s].x,y:i.y-o.y+n[s].y};a?r.updateItem(t,u,!1):t.updatePosition(u)}),s&&u(r,e)},50,!0),updateDelegate:function(t){var e=this.graph;if(this.delegateRect){var r=t.x-this.origin.x+this.originPoint.minX,n=t.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:r,y:n})}else{var o=e.get("group"),i=(0,rg.deepMix)({},PC.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(t),s=a.x,u=a.y,l=a.width,c=a.height,f=a.minX,h=a.minY;this.originPoint={x:s,y:u,width:l,height:c,minX:f,minY:h},this.delegateRect=o.addShape("rect",{attrs:(0,eg.__assign)({width:l,height:c,x:s,y:u},i),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(t){var e=this.targets;0===e.length&&e.push(t.item);for(var r=1/0,n=-1/0,o=1/0,i=-1/0,a=0;an&&(n=c),f>i&&(i=f)}return{x:Math.floor(r),y:Math.floor(o),width:Math.ceil(n)-Math.floor(r),height:Math.ceil(i)-Math.floor(o),minX:r,minY:o}},updateParentCombos:function(t,e){var r=t||this.graph,n=e||this.targets,o={};null===n||void 0===n||n.forEach(function(t){var e=t.getModel().comboId;e&&(o[e]=r.findById(e))}),Object.values(o).forEach(function(t){t&&r.updateCombo(t)})}},vI=null,gI={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldClearStatusOnSecond:!1,shouldUpdate:function(){return!0}}},getEvents:function(){return"mouseenter"===this.get("trigger")?{"node:mouseenter":"setAllItemStates","combo:mouseenter":"setAllItemStates","node:mouseleave":"clearActiveState","combo:mouseleave":"clearActiveState"}:{"node:click":"setAllItemStates","combo:click":"setAllItemStates","canvas:click":"clearActiveState","node:touchstart":"setOnTouchStart","combo:touchstart":"setOnTouchStart","canvas:touchstart":"clearOnTouchStart"}},setOnTouchStart:function(t){try{var e=t.originalEvent.touches,r=e[0],n=e[1];if(r&&n)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.setAllItemStates(t)},clearOnTouchStart:function(t){try{var e=t.originalEvent.touches,r=e[0],n=e[1];if(r&&n)return;t.preventDefault()}catch(t){console.warn("Touch original event not exist!")}this.clearActiveState(t)},setAllItemStates:function(t){clearTimeout(this.timer),this.throttleSetAllItemStates(t,this)},clearActiveState:function(t){var e=this;this.shouldClearStatusOnSecond&&(vI=null),this.timer=setTimeout(function(){e.throttleClearActiveState(t,e)},50)},throttleSetAllItemStates:(0,rg.throttle)(function(t,e){var r=t.item,n=e.graph;if(n&&!n.destroyed&&(e.item=r,e.shouldUpdate(t.item,{event:t,action:"activate"},e))){var o=e.shouldClearStatusOnSecond,i=r.getModel().id;if(vI===i&&o)return e.throttleClearActiveState(t,e),void(vI=null);for(var a=e.activeState,s=e.inactiveState,u=n.getNodes(),l=n.getCombos(),c=n.getEdges(),f=n.get("vedges"),h=u.length,p=l.length,d=c.length,y=f.length,v=e.inactiveItems||{},g=e.activeItems||{},m=0;m-1||(this.trigger="shift",console.warn("Behavior brush-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),"drag"===this.trigger?{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates"}:{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates",keyup:"onKeyUp",keydown:"onKeyDown"}},onMouseDown:function(t){var e=t.item,r=this.brush,n=this.selectOnCombo,o="combo"===(null===e||void 0===e?void 0:e.getType());o&&!n||!o&&e||("drag"===this.trigger||this.keydown)&&(this.selectedNodes&&0!==this.selectedNodes.length&&this.clearStates(),r||(r=this.createBrush()),this.originPoint={x:t.canvasX,y:t.canvasY},r.attr({width:0,height:0}),r.show(),this.dragging=!0)},onMouseMove:function(t){this.dragging&&("drag"===this.trigger||this.keydown)&&this.updateBrush(t)},onMouseUp:function(t){this.graph;(this.brush||this.dragging)&&("drag"===this.trigger||this.keydown)&&(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(t),this.dragging=!1)},clearStates:function(){var t=this.graph,e=this.selectedState,r=t.findAllByState("node",e),n=t.findAllByState("edge",e),o=t.findAllByState("combo",e);r.forEach(function(r){return t.setItemState(r,e,!1)}),n.forEach(function(r){return t.setItemState(r,e,!1)}),o.forEach(function(r){return t.setItemState(r,e,!1)}),this.selectedNodes=[],this.selectedEdges=[],this.selectedCombos=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges,this.selectedCombos),t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})},isBBoxCenterInRect:function(t,e,r,n,o){var i=t.getBBox();return i.centerX>=e&&i.centerX<=r&&i.centerY>=n&&i.centerY<=o},getSelectedNodes:function(t){var e=this,r=this.graph,n=this.originPoint,o=this.shouldUpdate,i=this.isBBoxCenterInRect,a=this.selectedState,s={x:t.x,y:t.y},u=r.getPointByCanvas(n.x,n.y),l=mI(s.x,u.x),c=bI(s.x,u.x),f=mI(s.y,u.y),h=bI(s.y,u.y),p=[],d=[];r.getNodes().forEach(function(t){if(t.isVisible()&&i(t,l,c,f,h)&&o(t,"select",e)){p.push(t);var n=t.getModel();d.push(n.id),r.setItemState(t,a,!0)}});var y=[];this.includeEdges&&p.forEach(function(t){t.getOutEdges().forEach(function(t){if(t.isVisible()){var n=t.getModel(),i=n.source,a=n.target;d.includes(i)&&d.includes(a)&&o(t,"select",e)&&(y.push(t),r.setItemState(t,e.selectedState,!0))}})});var v=[];this.includeCombos&&r.getCombos().forEach(function(t){if(t.isVisible()&&i(t,l,c,f,h)&&o(t,"select",e)){v.push(t);var n=t.getModel();d.push(n.id),r.setItemState(t,a,!0)}}),this.selectedEdges=y,this.selectedNodes=p,this.selectedCombos=v,this.onSelect&&this.onSelect(p,y,v),r.emit("nodeselectchange",{selectedItems:{nodes:p,edges:y,combos:v},select:!0})},createBrush:function(){var t=this.graph.get("canvas").addShape("rect",{attrs:this.brushStyle,capture:!1,name:"brush-shape"});return this.brush=t,this.delegate=t,t},updateBrush:function(t){var e=this.originPoint;this.brush.attr({width:wI(t.canvasX-e.x),height:wI(t.canvasY-e.y),x:mI(t.canvasX,e.x),y:mI(t.canvasY,e.y)})},onKeyDown:function(t){var e=t.key;if(e){var r=this.trigger.toLowerCase(),n=e.toLowerCase();this.keydown=n===r||"control"===n&&"ctrl"===r||"ctrl"===n&&"control"===r}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.keydown=!1}},_I=["shift","ctrl","alt","control"],EI={getDefaultCfg:function(){return{multiple:!0,trigger:"shift",selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){return _I.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="shift",console.warn("Behavior click-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),this.multiple?{"node:click":"onClick","combo:click":"onClick","edge:click":"onClick","canvas:click":"onCanvasClick",keyup:"onKeyUp",keydown:"onKeyDown"}:{"node:click":"onClick","combo:click":"onClick","edge:click":"onClick","canvas:click":"onCanvasClick"}},onClick:function(t){var e=this,r=t.item;if(r&&!r.destroyed){var n=r.getType(),o=e.graph,i=e.keydown,a=e.multiple,s=e.shouldUpdate;if((0,e.shouldBegin)(t,e)){if(!i||!a){var u=o.findAllByState("node",e.selectedState).concat(o.findAllByState("edge",e.selectedState)).concat(o.findAllByState("combo",e.selectedState));(0,rg.each)(u,function(t){t!==r&&o.setItemState(t,e.selectedState,!1)})}if(function(){switch(n){case"node":return e.selectNode;case"edge":return e.selectEdge;case"combo":return e.selectCombo;default:return!1}}())if(r.hasState(e.selectedState)){s(t,e)&&o.setItemState(r,e.selectedState,!1);l=o.findAllByState("node",e.selectedState),c=o.findAllByState("edge",e.selectedState),f=o.findAllByState("combo",e.selectedState);o.emit("nodeselectchange",{target:r,selectedItems:{nodes:l,edges:c,combos:f},select:!1})}else{s(t,e)&&o.setItemState(r,e.selectedState,!0);l=o.findAllByState("node",e.selectedState),c=o.findAllByState("edge",e.selectedState),f=o.findAllByState("combo",e.selectedState);o.emit("nodeselectchange",{target:r,selectedItems:{nodes:l,edges:c,combos:f},select:!0})}else{var l=o.findAllByState("node",e.selectedState),c=o.findAllByState("edge",e.selectedState),f=o.findAllByState("combo",e.selectedState);o.emit("nodeselectchange",{selectedItems:{nodes:l,edges:c,combos:f},select:!1})}}}},onCanvasClick:function(t){var e=this,r=this.graph;if((0,this.shouldBegin)(t,this)){var n=r.findAllByState("node",this.selectedState);(0,rg.each)(n,function(t){r.setItemState(t,e.selectedState,!1)});var o=r.findAllByState("edge",this.selectedState);(0,rg.each)(o,function(t){r.setItemState(t,e.selectedState,!1)});var i=r.findAllByState("combo",this.selectedState);(0,rg.each)(i,function(t){r.setItemState(t,e.selectedState,!1)}),r.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.trigger.toLowerCase()||"control"===e.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.keydown=!1}},OI=fg,PI={getDefaultCfg:function(){return this.isFireFox="firefox"===HC(),{sensitivity:2,minZoom:void 0,maxZoom:void 0,enableOptimize:!1,optimizeZoom:.1,fixSelectedItems:{fixAll:!1,fixLineWidth:!1,fixLabel:!1,fixState:"selected"},animate:!1,animateCfg:{duration:500}}},getEvents:function(){var t=this.fixSelectedItems;return t.fixState||(t.fixState="selected"),t.fixAll&&(t.fixLineWidth=!0,t.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(t){var e=t.originalEvent.touches,r=e[0],n=e[1];t.preventDefault(),n&&(this.shouldBegin&&!this.shouldBegin(t,this)||(this.startPoint={pageX:r.pageX,pageY:r.pageY},this.moveable=!0,n&&(this.endPoint={pageX:n.pageX,pageY:n.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(t){if(this.moveable){t.preventDefault();var e=t.originalEvent.touches,r=e[0],n=e[1];if(n){this.endPoint||(this.endPoint={pageX:n.pageX,pageY:n.pageY});var o=function(t,e){return Math.hypot(e.x-t.x,e.y-t.y)},i=o({x:r.pageX,y:r.pageY},{x:n.pageX,y:n.pageY})/o({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),a=this.originScale*i;this.currentScale=a;var s=this.get("minZoom")||this.graph.get("minZoom");if(!(a>(this.get("maxZoom")||this.graph.get("maxZoom"))||a0||t.wheelDelta<0?1-.05*i:1/(1-.05*i):t.wheelDelta<0?1-.05*i:1/(1-.05*i));var u=this.get("minZoom")||r.get("minZoom"),l=this.get("maxZoom")||r.get("maxZoom");if(s>l?s=l:sr/2?u-=c.width:u+=this.offset,l>n/2?l-=c.height:l+=this.offset;var f="".concat(u,"px"),h="".concat(l,"px");wT(this.container,{left:f,top:h,visibility:"visible"})}else wT(o,{visibility:"hidden"})},createTooltip:function(t){var e=t.get("el");e.style.position="relative";var r=_k('
    '));return e.parentNode.appendChild(r),wT(r,{position:"absolute",visibility:"visible"}),this.width=t.get("width"),this.height=t.get("height"),this.container=r,this.graph.get("tooltips").push(r),r}},CI=(0,eg.__assign)({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(t){return t.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},kI),TI=(0,eg.__assign)({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(t){return"source: ".concat(t.source," target: ").concat(t.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},kI),AI=["click","dblclick"],MI={getDefaultCfg:function(){return{trigger:"click",onChange:function(){}}},getEvents:function(){var t,e;return AI.includes(this.trigger)?e=this.trigger:(e="click",console.warn("Behavior collapse-expand 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),(t={})["node:".concat(e)]="onNodeClick",t.touchstart="onNodeClick",t},onNodeClick:function(t){var e=this;if("click"===this.trigger){if(this.timer)return clearTimeout(this.timer),void(this.timer=0);this.timer=setTimeout(function(){e.toggle(t),clearTimeout(e.timer),e.timer=0},200)}else this.toggle(t)},toggle:function(t){var e=t.item;if(e){var r=this.graph.findDataById(e.get("id"));if(r){var n=r.children;if(n&&0!==n.length){var o=!r.collapsed;this.shouldBegin(t,o,this)&&(r.collapsed=o,e.getModel().collapsed=o,this.graph.emit("itemcollapsed",{item:t.item,collapsed:o}),this.shouldUpdate(t,o,this)&&(this.onChange(e,o,this),this.graph.layout()))}}}}},jI=qC.calculationItemsBBox,II={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected",enableStack:!0}},getEvents:function(){return{"combo:mousedown":"onMouseDown","combo:dragstart":"onDragStart","combo:drag":"onDrag","combo:dragend":"onDragEnd","combo:drop":"onDrop","node:drop":"onNodeDrop","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave"}},validationCombo:function(t){var e=t.item;return!(!e||e.destroyed)&&(!!this.shouldUpdate(t,this)&&"combo"===e.getType())},onMouseDown:function(t){this.origin={x:t.x,y:t.y}},onDragStart:function(t){var e=this,r=this.graph,n=t.item;if(this.currentShouldEnd=!0,this.validationCombo(t)){this.targets=[];var o=r.findAllByState("combo",this.selectedState),i=n.get("id");0===o.filter(function(t){var e=t.get("id");return i===e}).length?this.targets.push(n):this.targets=o;var a=[];this.targets.forEach(function(t){var e=t.getModel(),r=e.x,n=e.y,o=e.id;a.push({x:r,y:n,id:o})}),this.set("beforeDragItems",a),this.activeState&&this.targets.map(function(t){var n=t.getModel();if(n.parentId){var o=r.findById(n.parentId);o&&r.setItemState(o,e.activeState,!0)}}),this.point={},this.originPoint={},this.currentItemChildCombos=[],function t(e,r){if(!1!==r(e)&&e){var n=e.get("combos");if(0===n.length)return!1;(0,rg.each)(n,function(e){t(e,r)})}}(n,function(t){if(t.destroyed)return!1;var r=t.getModel();return e.currentItemChildCombos.push(r.id),!0})}},onDrag:function(t){var e=this;if(this.origin&&this.validationCombo(t))if(this.enableDelegate)this.updateDelegate(t);else{if(this.activeState){var r=this.graph,n=t.item,o=n.getModel(),i=r.getCombos(),a=n.getBBox(),s=a.centerX,u=a.centerY,l=a.width;i.filter(function(t){var r=t.getModel();return o.parentId,r.id!==o.id&&!e.currentItemChildCombos.includes(r.id)}).map(function(t){var n=t.getBBox(),o=n.centerX,i=n.centerY,a=n.width,c=s-o,f=u-i,h=2*Math.sqrt(c*c+f*f);l+a-h>.8*l?r.setItemState(t,e.activeState,!0):r.setItemState(t,e.activeState,!1)})}(0,rg.each)(this.targets,function(r){e.updateCombo(r,t)}),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(t,e){var r=this;(this.enableDelegate||e)&&(0,rg.each)(this.targets,function(n){r.updateCombo(n,t,e)})},onDrop:function(t){var e=this,r=t.item;if(this.currentShouldEnd=this.shouldEnd(t,r,this),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd&&r&&this.targets&&!r.destroyed){var n=this.graph,o=r.getModel();this.targets.map(function(t){t.getModel().parentId!==o.id?(e.activeState&&n.setItemState(r,e.activeState,!1),e.onlyChangeComboSize?n.updateCombo(t):n.updateComboTree(t,o.id,!1)):n.updateCombo(r)}),this.end(r,t),this.endComparison=!0}},onNodeDrop:function(t){var e=this;if(this.targets&&0!==this.targets.length){var r=this.graph,n=t.item.getModel().comboId,o=n?r.findById(n):void 0;if(this.currentShouldEnd=this.shouldEnd(t,o,this),this.updatePositions(t,!this.currentShouldEnd),this.currentShouldEnd){var i;if(n){if(this.activeState){var a=r.findById(n);r.setItemState(a,this.activeState,!1)}this.targets.map(function(t){e.onlyChangeComboSize?r.updateCombo(t):n!==t.getID()&&(i=r.findById(n),n!==t.getModel().parentId&&r.updateComboTree(t,n,!1))})}else this.targets.map(function(t){e.onlyChangeComboSize?r.updateCombo(t):t.getModel().comboId&&r.updateComboTree(t,void 0,!1)});this.endComparison=!0,this.end(i,t)}}},onDragEnter:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,r=this.graph;this.activeState&&r.setItemState(e,this.activeState,!0)}},onDragLeave:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,r=this.graph;this.activeState&&r.setItemState(e,this.activeState,!1)}},onDragEnd:function(t){if(this.targets&&0!==this.targets.length){var e=t.item;this.currentShouldEnd&&this.updatePositions(t);var r=this.getParentCombo(e.getModel().parentId),n=this.graph;r&&this.activeState&&n.setItemState(r,this.activeState,!1),this.end(void 0,t)}},end:function(t,e){var r=this;if(this.origin){var n=this.graph;if(this.delegateShape)n.get("delegateGroup").clear(),this.delegateShape=null;if(t&&this.activeState&&n.setItemState(t,this.activeState,!1),!t){var o=n.get("enabledStack")&&this.enableStack,i={before:{nodes:[],edges:[],combos:[].concat(this.get("beforeDragItems"))},after:{nodes:[],edges:[],combos:[]}};this.targets.map(function(t){if(r.onlyChangeComboSize){n.updateCombo(t);var e=t.getModel(),a=e.x,s=e.y,u=e.id;i.after.combos.push({x:a,y:s,id:u}),n.pushStack("update",i)}else n.updateComboTree(t,void 0,o)})}this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(t,e,r){var n=this;if(void 0===r&&(r={}),!1!==e(t,r)&&t){var o=t.get("combos");(0,rg.each)(o,function(t){n.traverse(t,e,r)});var i=t.get("nodes");(0,rg.each)(i,function(t){n.traverse(t,e,r)})}},updateCombo:function(t,e,r){this.updateSingleItem(t,e,r);var n={};this.traverse(t,function(t,e){return!t.destroyed&&(t.getEdges().forEach(function(t){return e[t.getID()]=t}),!0)},n),Object.values(n).forEach(function(t){return t.refresh()})},updateSingleItem:function(t,e,r){var n=this.origin,o=this.graph,i=t.getModel(),a=t.get("id");this.point[a]||(this.point[a]={x:i.x,y:i.y});var s=e.x-n.x+this.point[a].x,u=e.y-n.y+this.point[a].y;r&&(s+=n.x-e.x,u+=n.y-e.y),o.updateItem(t,{x:s,y:u},!1)},getParentCombo:function(t){var e=this.graph;if(t){var r=e.findById(t);if(r)return r}},updateDelegate:function(t){var e=this.graph;if(this.delegateShape){var r=t.x-this.origin.x+this.originPoint.minX,n=t.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:r,y:n})}else{var o=e.get("delegateGroup"),i=null,a=(i=this.targets.length>1?jI(this.targets):this.targets[0].getBBox()).x,s=i.y,u=i.width,l=i.height,c=i.minX,f=i.minY;this.originPoint={x:a,y:s,width:u,height:l,minX:c,minY:f};var h=(0,eg.__assign)((0,eg.__assign)({},PC.delegateStyle),this.delegateStyle);this.delegateShape=o.addShape("rect",{attrs:(0,eg.__assign)({width:i.width,height:i.height,x:i.x,y:i.y},h),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}},updateParentCombos:function(){var t=this.graph,e=this.targets,r={};null===e||void 0===e||e.forEach(function(e){var n=e.getModel().parentId;n&&(r[n]=t.findById(n))}),Object.values(r).forEach(function(e){e&&t.updateCombo(e)})}},NI=["click","dblclick"],LI={getDefaultCfg:function(){return{trigger:"dblclick",relayout:!0}},getEvents:function(){var t,e;return NI.includes(this.trigger)?e=this.trigger:(e="dblclick",console.warn("Behavior collapse-expand-group 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),(t={})["combo:".concat(e)]="onComboClick",t},onComboClick:function(t){var e=t.item,r=this.graph,n=this.relayout;if(e&&!e.destroyed&&"combo"===e.getType()){var o=e.getModel().id;o&&(r.collapseExpandCombo(o),n&&r.get("layout")?r.layout():r.refreshPositions())}}},RI=qC.isPolygonsIntersect,DI=qC.pathToPoints,BI=["drag","shift","ctrl","alt","control"],FI=["click","drag"],GI=["shift","ctrl","control","alt","meta",void 0],UI=["shift","ctrl","alt","control"],zI=["shift","ctrl","alt","control","meta"],VI={"drag-canvas":dI,"zoom-canvas":PI,"drag-node":yI,"activate-relations":gI,"brush-select":xI,"click-select":EI,"lasso-select":{getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:"shift",includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return BI.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="shift",console.warn("Behavior lasso-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),"drag"===this.trigger?{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd","canvas:click":"clearStates"}:{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd",keyup:"onKeyUp",keydown:"onKeyDown","canvas:click":"clearStates"}},onDragStart:function(t){var e=this.lasso;t.item||("drag"===this.trigger||this.keydown)&&(this.selectedNodes&&0!==this.selectedNodes.length&&this.clearStates("dragstart"),e||(e=this.createLasso()),this.dragging=!0,this.originPoint={x:t.x,y:t.y},this.points.push(this.originPoint),e.show())},onDragMove:function(t){this.dragging&&("drag"===this.trigger||this.keydown)&&(this.points.push({x:t.x,y:t.y}),this.updateLasso(t))},onDragEnd:function(t){(this.lasso||this.dragging)&&("drag"===this.trigger||this.keydown)&&(this.points.push(this.originPoint),this.getSelectedItems(),this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1)},getLassoPath:function(){var t=this.points,e=[];return t.length&&(t.forEach(function(t,r){0===r?e.push(["M",t.x,t.y]):e.push(["L",t.x,t.y])}),e.push(["L",t[0].x,t[0].y])),e},clearStates:function(t){void 0===t&&(t="canvas:click");var e=this.graph,r=this.selectedState,n=this.shouldDeselect,o=e.findAllByState("node",r),i=e.findAllByState("edge",r);n&&!n({action:t,nodes:o,edges:i})||(o.forEach(function(t){return e.setItemState(t,r,!1)}),i.forEach(function(t){return e.setItemState(t,r,!1)})),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],e.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedItems:function(){var t=this,e=this.graph,r=this.shouldUpdate,n=this.points.map(function(t){return[e.getCanvasByPoint(t.x,t.y).x,e.getCanvasByPoint(t.x,t.y).y]}),o=this.selectedState,i=[],a=[];e.getNodes().forEach(function(s){if(s.isVisible()&&function(t,e){var r,n=t.getKeyShape();if("path"===t.get("type"))r=DI(n.attr("path"));else{var o=n.getCanvasBBox();r=[[o.minX,o.minY],[o.maxX,o.minY],[o.maxX,o.maxY],[o.minX,o.maxY]]}return RI(e,r)}(s,n)&&r(s,"select",t)){i.push(s);var u=s.getModel();a.push(u.id),e.setItemState(s,o,!0)}});var s=[];this.includeEdges&&i.forEach(function(n){n.getOutEdges().forEach(function(n){if(n.isVisible()){var o=n.getModel(),i=o.source,u=o.target;a.includes(i)&&a.includes(u)&&r(n,"select",t)&&(s.push(n),e.setItemState(n,t.selectedState,!0))}})}),this.selectedEdges=s,this.selectedNodes=i,this.onSelect&&this.onSelect(i,s),e.emit("nodeselectchange",{selectedItems:{nodes:i,edges:s},select:!0})},createLasso:function(){var t=this.graph.get("delegateGroup").addShape("path",{attrs:(0,eg.__assign)({path:[]},this.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=t,this.delegate=t,this.points=[],t},updateLasso:function(t){this.lasso.attr({path:this.getLassoPath()})},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.trigger.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.lasso&&(this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1),this.keydown=!1}},tooltip:CI,"edge-tooltip":TI,"collapse-expand":MI,"drag-combo":II,"collapse-expand-combo":LI,"create-edge":{getDefaultCfg:function(){return{trigger:"click",key:void 0,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var t;return FI.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="click",console.warn("Behavior create-edge 的 trigger 参数不合法,请输入 'click','drag'")),this.key&&-1===GI.indexOf(this.key.toLowerCase())&&(this.trigger=void 0,console.warn("Behavior create-edge 的 key 参数不合法,请输入 'shift','ctrl','alt','control',或 undefined")),"drag"===this.trigger?t={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:"click"===this.trigger&&(t={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),this.key&&(t.keydown="onKeyDown",t.keyup="onKeyUp"),t},onDragEnd:function(t){if(!this.key||this.keydown){var e=t.item;e&&e.getID()!==this.source&&"node"===e.getType()||this.cancelCreating({item:this.edge,x:t.x,y:t.y})}},onClick:function(t){if(!this.key||this.keydown){var e=t.item,r=this.graph,n=e.getModel(),o=this.getEdgeConfig;if(this.addingEdge&&this.edge){if(!this.shouldEnd(t,this))return;var i=void 0;i=o&&(0,rg.isFunction)(o)?o({source:this.source,target:n.id},this):this.edgeConfig;var a=(0,eg.__assign)({target:n.id},i);if(this.source===n.id&&(a.type="loop"),r.emit("beforecreateedge",{}),r.updateItem(this.edge,a,!1),r.get("enabledStack")){var s=(0,eg.__assign)((0,eg.__assign)({},this.edge.getModel()),{itemType:"edge"}),u={};u.edges=[s],r.pushStack("add",{before:{},after:u})}r.emit("aftercreateedge",{edge:this.edge}),this.edge.getKeyShape().set("capture",!0),this.edge=null,this.addingEdge=!1}else{if(!this.shouldBegin(t,this))return;i=void 0;i=o&&(0,rg.isFunction)(o)?o({source:n.id,target:n.id},this):this.edgeConfig,this.edge=r.addItem("edge",(0,eg.__assign)({source:n.id,target:n.id},i),!1),this.source=n.id,this.addingEdge=!0,this.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(t){if(!this.key||this.keydown){this.edge&&this.edge.destroyed&&this.cancelCreating({item:this.edge});var e={x:t.x,y:t.y};this.graph.findById(this.source)?this.addingEdge&&this.edge&&this.graph.updateItem(this.edge,{target:e},!1):this.addingEdge=!1}},cancelCreating:function(t){var e,r;if(!this.key||this.keydown){var n=this.graph,o=t.item;return this.addingEdge&&(this.edge===o||(null===(r=null===(e=t.target)||void 0===e?void 0:e.isCanvas)||void 0===r?void 0:r.call(e)))?(this.edge&&!this.edge.destroyed&&n.removeItem(this.edge,!1),this.edge=null,void(this.addingEdge=!1)):void 0}},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.key.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.addingEdge&&this.edge&&(this.graph.removeItem(this.edge,!1),this.addingEdge=!1,this.edge=null),this.keydown=!1}},"shortcuts-call":{getDefaultCfg:function(){return{trigger:"ctrl",combinedKey:"1",functionName:"fitView",functionParams:[]}},getEvents:function(){return UI.indexOf(this.trigger.toLowerCase())>-1||(this.trigger="ctrl",console.warn("Behavior shortcuts-fit-view 的 trigger 参数 '".concat(this.trigger,"' 不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'"))),this.combinedKey===this.trigger&&(this.combinedKey=void 0),{keyup:"onKeyUp",keydown:"onKeyDown"}},onKeyDown:function(t){var e=t.key;if(e){var r=this.trigger.toLowerCase(),n=e.toLowerCase();this.triggerKeydown||(this.triggerKeydown=n===r||"control"===n&&"ctrl"===r||"ctrl"===n&&"control"===r);var o=this.graph;if(!o[this.functionName])return console.warn("Behavior shortcuts-fit-view 的 functionName 参数 '".concat(this.functionName,"' 不合法,它不是 Graph 的一个函数名")),{};if(!this.triggerKeydown||this.combinedKey){var i=this.combinedKey.toLowerCase();this.triggerKeydown&&(n===i||"control"===n&&"ctrl"===i||"ctrl"===n&&"control"===i)&&(this.functionParams&&this.functionParams.length?o[this.functionName].apply(o,this.functionParams):o[this.functionName]())}else this.functionParams&&this.functionParams.length?o[this.functionName].apply(o,this.functionParams):o[this.functionName]()}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}},"scroll-canvas":{getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return this.zoomKey&&-1!==zI.indexOf(this.zoomKey)||(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(t){var e=this;if(this.allowDrag(t)){var r=this.graph,n=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];if(n.includes("control")&&n.push("ctrl"),n.some(function(e){return t["".concat(e,"Key")]})){var o=r.get("canvas").getPointByClient(t.clientX,t.clientY),i=r.getZoom();t.wheelDelta>0?i+=.05*i:i-=.05*i,r.zoomTo(i,{x:o.x,y:o.y})}else{var a=t.deltaX||t.movementX,s=t.deltaY||t.movementY;!s&&navigator.userAgent.indexOf("Firefox")>-1&&(s=125*-t.wheelDelta/3);var u=this.graph.get("width"),l=this.graph.get("height"),c=this.graph.get("canvas").getCanvasBBox(),f=this.scalableRange,h=this.scalableRange;f<1&&f>-1&&(f*=u,h*=l);var p=c.minX,d=c.maxX,y=c.minY,v=c.maxY;a>0?d<-f?a=0:d-a<-f&&(a=d+f):a<0&&(p>u+f?a=0:p-a>u+f&&(a=p-(u+f))),s>0?v<-h?s=0:v-s<-h&&(s=v+h):s<0&&(y>l+h?s=0:y-s>l+h&&(s=y-(l+h))),"x"===this.get("direction")?s=0:"y"===this.get("direction")&&(a=0),r.translate(-a,-s)}if(t.preventDefault(),this.get("enableOptimize")){var g=this.get("optimizeZoom"),m=this.get("optimized"),b=r.getNodes(),w=r.getEdges(),S=b.length,x=w.length;if(!m){for(var _=0;_t.length)&&(e=t.length);for(var r=0,n=new Array(e);r\n
  • 展开
  • \n ":"
      \n
    • 折叠
    • \n
    ":void 0}},handleMenuClick:function(e,r){switch(e.id.split("-")[0]){case"hide":t.hideItem(r);break;case"expand":t.expandNode(r);break;case"collapse":t.collapseNode(r);break;case"show":t.showItem(r)}},offsetX:26,offsetY:0,itemTypes:["node","edge","canvas"]})}},{key:"_getGraphConfig",value:function(t){var e=this,r={speed:120,maxIteration:83,tick:function(){e.refreshPositions()}},n={type:"fruchterman",gravity:5},o={},i={type:"line",style:{endArrow:{path:"M 0,0 L 4,2 L 4,-2 Z",fill:"#e0e0e0"},lineWidth:.5},labelCfg:{autoRotate:!0,style:{fontSize:4,fill:"#333"}}},a={default:["drag-canvas","zoom-canvas","drag-node"]},s=this._getContextMenu(),u=[new ZI.ToolBar,s],l={lineWidth:3,stroke:"#b4d6ff"},c={stroke:"#b4d6ff",shadowColor:"#b4d6ff",shadowBlur:5,endArrow:{path:"M 0,0 L 4,2 L 4,-2 Z",fill:"#b4d6ff"}};if(!t)return this._setToolBarStyle(),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"knowledgeGraph",e=document.querySelector("#".concat(t));return{container:t,width:e.scrollWidth,height:e.scrollHeight,plugins:u,modes:a,layout:nN(nN({},n),r),defaultNode:o,defaultEdge:i,nodeStateStyles:{hover:l},edgeStateStyles:{hover:c}}}();t.container=t.container||"knowledgeGraph";var f="string"==typeof t.container?document.querySelector("#".concat(t.container)):t.container;return t.width=t.width||f.scrollWidth,t.height=t.height||f.scrollHeight,t.layout=nN(nN(nN({},n),t.layout||{}),!1!==t.animate?r:{}),t.defaultNode=nN(nN({},o),t.defaultNode||{}),t.defaultEdge=nN(nN({},i),t.defaultEdge||{}),t.modes={default:[!1!==t.dragCanvas&&"drag-canvas",!1!==t.zoomCanvas&&"zoom-canvas",!1!==t.dragNode&&"drag-node"]},t.nodeStateStyles={hover:nN(nN({},l),t.nodeHighlightStyle||{})},t.edgeStateStyles={hover:nN(nN({},c),t.edgeHighlightStyle||{})},!1!==t.showToolBar&&(t.plugins=[new ZI.ToolBar],this._setToolBarStyle()),!1!==t.showContextMenu&&(t.plugins=[].concat(tN(t.plugins||[]),[s]),this._setToolBarStyle()),t}},{key:"changeSize",value:function(t,e){return this.graph.changeSize(t,e)}},{key:"autoResize",value:function(){var t=this,e=this.getContainer();window.addEventListener("resize",function(){var r=e.scrollWidth,n=e.scrollHeight;t.graph.changeSize(r,n),t.graph.refresh()})}},{key:"zoom",value:function(t,e,r,n){this.graph.zoom(t,e,r,n)}},{key:"zoomTo",value:function(t,e,r,n){this.graph.zoomTo(t,e,r,n)}},{key:"fitView",value:function(t,e,r,n){this.graph.fitView(t,e,r,n)}},{key:"fitCenter",value:function(t,e){this.graph.fitCenter(t,e)}},{key:"getGraphCenterPoint",value:function(){return this.graph.getGraphCenterPoint()}},{key:"getViewPortCenterPoint",value:function(){return this.graph.getViewPortCenterPoint()}},{key:"getZoom",value:function(){return this.graph.getZoom()}},{key:"getMinZoom",value:function(){return this.graph.getMinZoom()}},{key:"setMinZoom",value:function(t){this.graph.setMinZoom(t)}},{key:"getMaxZoom",value:function(){return this.graph.getMaxZoom()}},{key:"setMaxZoom",value:function(t){this.graph.setMaxZoom(t)}},{key:"getWidth",value:function(){return this.graph.getWidth()}},{key:"getHeight",value:function(){return this.graph.getHeight()}},{key:"setCenter",value:function(t){var e=this.graph.getWidth()/2,r=this.graph.getHeight()/2,n=this.graph.getCanvasByPoint(t.x,t.y);this.graph.translate(e-n.x,r-n.y)}},{key:"_setToolBarStyle",value:function(){PT()("\n .g6-component-toolbar li[code='redo'],\n .g6-component-toolbar li[code='undo'],\n .g6-component-toolbar li[code='realZoom'] {\n display: none;\n }\n .g6-component-contextmenu {\n position: absolute;\n z-index: 2;\n list-style-type: none;\n border-radius: 6px;\n font-size: 14px;\n width: fit-content;\n transition: opacity .2s;\n text-align: center;\n box-shadow: 0 5px 18px 0 rgba(0, 0, 0, 0.6);\n border: 0px;\n }\n .g6-component-contextmenu ul {\n padding-left: 0px;\n margin: 0;\n }\n .g6-component-contextmenu li {\n cursor: pointer;\n list-style-type: none;\n list-style: none;\n margin-left: 0;\n line-height: 38px;\n padding: 0px 35px;\n }\n .g6-component-contextmenu li:hover {\n color: #333;\n background: #aaaaaa45;\n }\n ")}},{key:"highlightNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t.on("node:mouseenter",function(e){var r=e.item;t.setAutoPaint(!1),t.getNodes().forEach(function(e){t.clearItemStates(e)}),t.setItemState(r,"hover",!0),t.paint(),t.setAutoPaint(!0)}),t.on("node:mouseleave",function(){t.setAutoPaint(!1),t.getNodes().forEach(function(e){t.clearItemStates(e)}),t.paint(),t.setAutoPaint(!0)})}},{key:"highlightEdge",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t.on("edge:mouseenter",function(e){var r=e.item;t.setAutoPaint(!1),t.getNodes().forEach(function(e){t.clearItemStates(e)}),t.setItemState(r,"hover",!0),t.paint(),t.setAutoPaint(!0)}),t.on("edge:mouseleave",function(){t.setAutoPaint(!1),t.getEdges().forEach(function(e){t.clearItemStates(e)}),t.paint(),t.setAutoPaint(!0)})}},{key:"setData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph;this.data?e.changeData(t):e.data(t),this.data=t}},{key:"render",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).render()}},{key:"updateGraph",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph;this.data=t,e.changeData(t)}},{key:"refresh",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).refresh()}},{key:"getContainer",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).getContainer()}},{key:"getCanvas",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).get("canvas")}},{key:"getNodes",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).getNodes()}},{key:"getEdges",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).getEdges()}},{key:"getNeighbors",value:function(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).getNeighbors(t,e)}},{key:"findById",value:function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph).findById(t)}},{key:"find",value:function(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).find(t,e)}},{key:"findAll",value:function(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).findAll(t,e)}},{key:"getEdgesByNode",value:function(t){return t.getEdges()}},{key:"getInEdges",value:function(t){return t.getInEdges()}},{key:"getOutEdges",value:function(t){return t.getOutEdges()}},{key:"getSourceByEdge",value:function(t){return t.getSource()}},{key:"getTargetByEdge",value:function(t){return t.getTarget()}},{key:"expandNode",value:function(t){var e=t.getModel().id;this._expandCollapseNode(this.collpasedData[e],"show"),delete this.collpasedData[e]}},{key:"collapseNode",value:function(t){var e=t.getModel().id,r=[];this._collapseFunc(t,r),this.collpasedData[e]=r,this._expandCollapseNode(r)}},{key:"isCollpased",value:function(t){return!!this.collpasedData[t]}},{key:"_collapseFunc",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=this.getNeighbors(t,"target"),n=this.getNeighbors(t,"source"),o=0;o1&&void 0!==arguments[1]?arguments[1]:"hide";t&&t.forEach(function(t){"hide"===r?e.hideItem(t.id):(e.showItem(t.id),e.isCollpased(t.id)&&delete e.collpasedData[t.id]),t.children&&e._expandCollapseNode(t.children,r)})}},{key:"showItem",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).showItem(t,e)}},{key:"hideItem",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).hideItem(t,e)}},{key:"show",value:function(t){t.show()}},{key:"hide",value:function(t){t.hide()}},{key:"changeVisibility",value:function(t,e){t.changeVisibility(e)}},{key:"isVisible",value:function(t){return t.isVisible()}},{key:"getModel",value:function(t){return t.getModel()}},{key:"addItem",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).addItem(t,e)}},{key:"removeItem",value:function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph).removeItem(t)}},{key:"updateItem",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).updateItem(t,e)}},{key:"refreshItem",value:function(t){(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph).refreshItem(t)}},{key:"refreshPositions",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).refreshPositions()}},{key:"on",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).on(t,e)}},{key:"off",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).off(t,e)}},{key:"toDataURL",value:function(t,e){(arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.graph).toDataURL(t,e)}},{key:"bindNodeDefaultDragEvent",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t.on("node:dragstart",function(t){uN(t)}),t.on("node:drag",function(t){uN(t)}),t.on("node:dragend",function(t){t.item.get("model").fx=null,t.item.get("model").fy=null})}},{key:"stopDefaultEventPropagation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t.on("click",function(t){t.stopPropagation()}),t.on("mousedown",function(t){t.stopPropagation()}),t.on("mouseover",function(t){t.stopPropagation()}),t.on("mouseout",function(t){t.stopPropagation()})}},{key:"clear",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).clear()}},{key:"destroy",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph).destroy()}}])&&iN(e.prototype,r),n&&iN(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function uN(t){var e=t.item.get("model");return e.fx=t.x,e.fy=t.y,e.x=t.x,e.y=t.y,e}var lN=r(5611),cN=r.n(lN);function fN(t){"@babel/helpers - typeof";return(fN="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function hN(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:"G6";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.graph=null,this.config=cN()(e),this.graphRender=null,this.type=r,this.createGraphRender(this.type),this.config=this.graphRender._getGraphConfig(this.config),this.createGraph(this.config),this.CLASS_NAME="SuperMap.KnowledgeGraph"}var e,r,n;return e=t,n=[{key:"dataFromGraphMap",value:function(t,e){return Xv(t,e)}},{key:"dataFromKnowledgeGraphQuery",value:function(t){return Xv(t)}}],(r=[{key:"handleNodeStatus",value:function(t){var e=t.expand,r=t.collapse,n=t.hidden;this.expandNodes(e),this.collapseNodes(r),this.hideNodes(n)}},{key:"expandNodes",value:function(t){var e=this;t&&t.forEach(function(t){e.expandNode(t+"")})}},{key:"collapseNodes",value:function(t){var e=this;t&&t.forEach(function(t){e.collapseNode(t+"")})}},{key:"hideNodes",value:function(t){var e=this;t&&t.forEach(function(t){e.hideItem(t+"")})}},{key:"createGraphRender",value:function(t){"G6"===t&&(this.graphRender=new sN)}},{key:"createGraph",value:function(t){var e=this.initGraph(t);return this.graph=e,this.autoResize(),e}},{key:"getGraph",value:function(){return this.graph}},{key:"autoResize",value:function(){this.config&&!1!==this.config.autoResize&&this.graphRender.autoResize()}},{key:"zoom",value:function(t,e,r,n){this.graphRender.zoom(t,e,r,n)}},{key:"zoomTo",value:function(t,e,r,n){this.graphRender.zoomTo(t,e,r,n)}},{key:"fitView",value:function(t,e,r,n){this.graphRender.fitView(t,e,r,n)}},{key:"fitCenter",value:function(t,e){this.graphRender.fitCenter(t,e)}},{key:"getGraphCenterPoint",value:function(){return this.graphRender.getGraphCenterPoint()}},{key:"getViewPortCenterPoint",value:function(){return this.graphRender.getViewPortCenterPoint()}},{key:"getZoom",value:function(){return this.graphRender.getZoom()}},{key:"getMinZoom",value:function(){return this.graphRender.getMinZoom()}},{key:"setMinZoom",value:function(t){this.graphRender.setMinZoom(t)}},{key:"getMaxZoom",value:function(){return this.graphRender.getMaxZoom()}},{key:"setMaxZoom",value:function(t){this.graphRender.setMaxZoom(t)}},{key:"getWidth",value:function(){return this.graphRender.getWidth()}},{key:"getHeight",value:function(){return this.graphRender.getHeight()}},{key:"initGraph",value:function(t){var e=this,r=this.graphRender.initGraph(t);this.graph=r;return this.graph.on("beforelayout",function(){void 0!==e.config.zoom&&e.zoom(e.config.zoom),void 0!==e.config.center&&e.graphRender.setCenter({x:e.config.center[0],y:e.config.center[1]})}),r}},{key:"setData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph;t=t||{nodes:[],edges:[]},this.config&&this.config.nodeLabelMaxWidth&&(t.nodes=this.nodeLabelOpenEllipsis(this.config.nodeLabelMaxWidth,t.nodes)),this.graphRender.setData(t,e),this.render(e),this.data=t}},{key:"render",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t&&this.graphRender.render(t)}},{key:"updateGraph",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.graph;e&&this.graphRender.updateGraph(t,e)}},{key:"refresh",value:function(){return this.graphRender.refresh()}},{key:"changeSize",value:function(t,e){return this.graphRender.changeSize(t,e)}},{key:"resize",value:function(t,e){this.graphRender.changeSize(t,e),this.graphRender.refresh()}},{key:"getContainer",value:function(){return this.graphRender.getContainer()}},{key:"getCanvas",value:function(){return this.graphRender.getCanvas()}},{key:"getNodes",value:function(){return this.graphRender.getNodes()}},{key:"getEdges",value:function(){return this.graphRender.getEdges()}},{key:"getNeighbors",value:function(t,e){return this.graphRender.getNeighbors(t,e)}},{key:"findById",value:function(t){return this.graphRender.findById(t)}},{key:"find",value:function(t,e){return this.graphRender.find(t,e)}},{key:"findAll",value:function(t,e){return this.graphRender.findAll(t,e)}},{key:"getEdgesByNode",value:function(t){return this.graphRender.getEdgesByNode(t)}},{key:"getInEdges",value:function(t){return this.graphRender.getInEdges(t)}},{key:"getOutEdges",value:function(t){return this.graphRender.getOutEdges(t)}},{key:"getSourceByEdge",value:function(t){return this.graphRender.getSourceByEdge(t)}},{key:"getTargetByEdge",value:function(t){return this.graphRender.getTargetByEdge(t)}},{key:"expandNode",value:function(t){var e=this.findById(t);e&&this.graphRender.expandNode(e)}},{key:"collapseNode",value:function(t){var e=this.findById(t);e&&this.graphRender.collapseNode(e)}},{key:"showItem",value:function(t,e){this.graphRender.showItem(t,e)}},{key:"hideItem",value:function(t,e){this.graphRender.hideItem(t,e)}},{key:"show",value:function(t){this.graphRender.show(t)}},{key:"hide",value:function(t){this.graphRender.hide(t)}},{key:"changeVisibility",value:function(t,e){this.graphRender.changeVisibility(t,e)}},{key:"isVisible",value:function(t){return this.graphRender.isVisible(t)}},{key:"getModel",value:function(t){return this.graphRender.getModel(t)}},{key:"addItem",value:function(t,e){return this.graphRender.addItem(t,e)}},{key:"removeItem",value:function(t){return this.graphRender.removeItem(t)}},{key:"updateItem",value:function(t,e){return this.graphRender.updateItem(t,e)}},{key:"refreshItem",value:function(t){return this.graphRender.refreshItem(t)}},{key:"refreshPositions",value:function(){return this.graphRender.refreshPositions()}},{key:"on",value:function(t,e){this.graphRender.on(t,e)}},{key:"off",value:function(t,e){this.graphRender.off(t,e)}},{key:"toDataURL",value:function(t,e){this.graphRender.toDataURL(t,e)}},{key:"nodeLabelOpenEllipsis",value:function(t,e){var r=this;return e?t?e.map(function(e){var n=e.labelCfg&&e.labelCfg.fontSize||r.defaultNode&&r.defaultNode.labelCfg&&r.defaultNode.labelCfg.fontSize||14;return e.label=function(t,e,r){var n=1*r;e*=1.6;if(function(t){for(var e=0,r=0;r0&&t.charCodeAt(r)<128?e++:e+=2;return e}(t)*n>e){var o=Math.floor((e-20)/n),i=t.substring(0,o);return(t.substring(o).length+"…".length)*n>e?i+"\n"+t.substring(o,o+o-2)+"…":0==t.substring(o).length?i:i+"\n"+t.substring(o)}return t}(e.label,t,n),e}):e:[]}},{key:"clear",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t&&t.clear()}},{key:"destroy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.graph;t&&t.destroy()}}])&&hN(e.prototype,r),n&&hN(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function yN(t){"@babel/helpers - typeof";return(yN="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function vN(){vN=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new A(n||[]);return o(a,"_invoke",{value:P(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={};function g(){}function m(){}function b(){}var w={};l(w,a,function(){return this});var S=Object.getPrototypeOf,x=S&&S(S(M([])));x&&x!==r&&n.call(x,a)&&(w=x);var _=b.prototype=g.prototype=Object.create(w);function E(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function O(t,e){function r(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==yN(c)&&n.call(c,"__await")?e.resolve(c.__await).then(function(t){r("next",t,a,s)},function(t){r("throw",t,a,s)}):e.resolve(c).then(function(t){l.value=t,a(l)},function(t){return r("throw",t,a,s)})}s(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e(function(e,o){r(t,n,e,o)})}return i=i?i.then(o,o):o()}})}function P(e,r,n){var o=h;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=k(s,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function M(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function gN(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function mN(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0}function rL(t){var e=function(t){var e,r,n=t.paint,o=void 0===n?{}:n,i=t.layout,a=void 0===i?{}:i,s=Object.keys(o).concat(Object.keys(a)),u=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=KN(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(tL);try{var l=function(){var t=r.value,n=s.some(function(e){return e.startsWith(t.prefix)});if(n)return e=t.type,1};for(u.s();!(r=u.n()).done&&!l(););}catch(t){u.e(t)}finally{u.f()}return e||$N.symbol}(t);return ZN(ZN(ZN({},$N.symbol,{type:"layout",name:"icon-image"}),$N.line,{type:"paint",name:"line-pattern"}),$N.fill,{type:"paint",name:"fill-pattern"})[e]}var nL=["array","boolean","collator","format","literal","number","object","string","to-boolean","to-color","to-number","to-string","typeof","feature-state","geometry-type","id","line-progress","properties","at","get","has","length","!","!=","<","<=","==",">",">=","all","any","case","match","coalesce","interpolate","interpolate-hcl","interpolate-lab","step","let","var","concat","downcase","is-supported-script","resolved-locale","upcase","rgb","rgba","-","*","/","%","^","+","abs","acos","asin","atan","ceil","cos","e","floor","ln","ln2","log10","log2","max","min","pi","round","sin","sqrt","tan","zoom","heatmap-density"];function oL(t){if(t&&t.length>0){var e=JN(t,1)[0];return"string"==typeof e&&nL.includes(e)}return!1}function iL(t){return Object.keys(t).every(function(e){return!oL(t[e])})}function aL(t){return(eL(t)?t:[t]).every(function(t){return iL(t.paint||{})&&iL(t.layout||{})})}var sL=function(t){return["background-color","background-color-transition","background-pattern","background-pattern-transition","background-opacity","background-opacity-transition","fill-antialias","fill-opacity","fill-opacity-transition","fill-color","fill-color-transition","fill-outline-color","fill-outline-color-transition","fill-translate","fill-translate-transition","fill-translate-anchor","fill-pattern","fill-pattern-transition","fill-extrusion-opacity","fill-extrusion-opacity-transition","fill-extrusion-color","fill-extrusion-color-transition","fill-extrusion-translate","fill-extrusion-translate-transition","fill-extrusion-translate-anchor","fill-extrusion-pattern","fill-extrusion-pattern-transition","fill-extrusion-height","fill-extrusion-height-transition","fill-extrusion-base","fill-extrusion-base-transition","fill-extrusion-vertical-gradient","line-opacity","line-opacity-transition","line-color","line-color-transition","line-translate","line-translate-transition","line-translate-anchor","line-width","line-width-transition","line-gap-width","line-gap-width-transition","line-offset","line-offset-transition","line-blur","line-blur-transition","line-dasharray","line-dasharray-transition","line-pattern","line-pattern-transition","line-gradient","icon-opacity","icon-opacity-transition","icon-color","icon-color-transition","icon-halo-color","icon-halo-color-transition","icon-halo-width","icon-halo-width-transition","icon-halo-blur","icon-halo-blur-transition","icon-translate","icon-translate-transition","icon-translate-anchor","text-opacity","text-opacity-transition","text-color","text-color-transition","text-halo-color","text-halo-color-transition","text-halo-width","text-halo-width-transition","text-halo-blur","text-halo-blur-transition","text-translate","text-translate-transition","text-translate-anchor","raster-opacity","raster-opacity-transition","raster-hue-rotate","raster-hue-rotate-transition","raster-brightness-min","raster-brightness-min-transition","raster-brightness-max","raster-brightness-max-transition","raster-saturation","raster-saturation-transition","raster-contrast","raster-contrast-transition","raster-fade-duration","raster-resampling","circle-sort-key","circle-radius","circle-radius-transition","circle-color","circle-color-transition","circle-blur","circle-blur-transition","circle-opacity","circle-opacity-transition","circle-translate","circle-translate-transition","circle-translate-anchor","circle-pitch-scale","circle-pitch-alignment","circle-stroke-width","circle-stroke-width-transition","circle-stroke-color","circle-stroke-color-transition","circle-stroke-opacity","circle-stroke-opacity-transition","heatmap-radius","heatmap-radius-transition","heatmap-weight","heatmap-intensity","heatmap-intensity-transition","heatmap-color","heatmap-opacity","heatmap-opacity-transition","hillshade-illumination-direction","hillshade-illumination-anchor","hillshade-exaggeration","hillshade-exaggeration-transition","hillshade-shadow-color","hillshade-shadow-color-transition","hillshade-highlight-color","hillshade-highlight-color-transition","hillshade-accent-color","hillshade-accent-color-transition"].includes(t)};function uL(t){"@babel/helpers - typeof";return(uL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function lL(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function cL(t){for(var e=1;e0}},{key:"removeSymbol",value:function(t){this.symbolManager.removeSymbol(t)}},{key:"getSymbol",value:function(t){return this.symbolManager.getSymbol(t)}},{key:"getLayerIds",value:function(t){return this.compositeSymbolRender.getLayerIds(t)||[]}},{key:"getLayerId",value:function(t){return this.compositeSymbolRender.getLayerId(t)}},{key:"removeLayerId",value:function(t){return this.compositeSymbolRender.removeLayerId(t)}},{key:"getLayer",value:function(t){var e=this.map.getLayerBySymbolBak(t),r=this.getLayerSymbol(t);if(e)return r?cL(cL({},e),{},{symbol:r}):e;var n=this.getLayerIds(t);if(n[0]){var o=this.map.getLayerBySymbolBak(n[0]);return o&&cL(cL({},o),{},{symbol:r,id:t})}}},{key:"removeLayer",value:function(t){var e=this,r=this.getLayerIds(t);r.length>0?(r.forEach(function(t){return e.map.style.removeLayer(t)}),this.removeLayerId(t)):this.map.style.removeLayer(t)}},{key:"getStyle",value:function(){var t=this,e=this.map.style.serialize();return this.hasSymbol()&&(e.layers=e.layers.reduce(function(e,r){var n=t.getLayerId(r.id);return n?!e.find(function(t){return t.id===n})&&e.push(cL(cL({},r),{},{symbol:t.getLayerSymbol(n),id:n})):t.getLayerSymbol(r.id)?e.push(cL(cL({},r),{},{symbol:t.getLayerSymbol(r.id)})):e.push(r),e},[])),e}},{key:"getFirstLayerId",value:function(t){return this.getLayerIds(t)[0]}},{key:"moveLayer",value:function(t,e){var r=this,n=this.getLayerIds(t),o=e&&this.map.style.getLayer(e),i=o&&o.id||e&&this.getFirstLayerId(e);n.length>0?n.forEach(function(t){return r.map.style.moveLayer(t,i)}):this.map.style.moveLayer(t,i)}},{key:"setFilter",value:function(t,e,r){var n=this;if(oL(this.getLayerSymbol(t))){var o=this.getFirstLayerId(t);this.map.style.setFilter(o,e,r);var i=this.getLayerSymbol(t);this.setSymbol(t,i)}else{var a=this.getLayerIds(t);a.length>0?a.forEach(function(t){return n.map.style.setFilter(t,e,r)}):this.map.style.setFilter(t,e,r)}}},{key:"getFilter",value:function(t){var e=this.getFirstLayerId(t);if(this.map.style.getLayer(e))return this.map.style.getFilter(e)}},{key:"setLayerZoomRange",value:function(t,e,r){var n=this,o=this.getLayerIds(t);o.length>0?o.forEach(function(t){return n.map.style.setLayerZoomRange(t,e,r)}):this.map.style.setLayerZoomRange(t,e,r)}},{key:"setPaintProperty",value:function(t,e,r,n){var o=this,i=this.getLayerIds(t);i.length>0?i.forEach(function(t){return o.map.style.setPaintProperty(t,e,r,n)}):this.map.style.setPaintProperty(t,e,r,n)}},{key:"getPaintProperty",value:function(t,e){var r=this.getFirstLayerId(t);return this.map.style.getPaintProperty(r,e)}},{key:"setLayoutProperty",value:function(t,e,r,n){var o=this,i=this.getLayerIds(t);i.length>0?i.forEach(function(t){return o.map.style.setLayoutProperty(t,e,r,n)}):this.map.style.setLayoutProperty(t,e,r,n)}},{key:"getLayoutProperty",value:function(t,e){var r=this.getFirstLayerId(t);return this.map.style.getLayoutProperty(r,e)}},{key:"updateLayerSymbol",value:function(t){var e=this;Object.keys(this._layerSymbols).forEach(function(r){var n=e._layerSymbols[r];n.includes(t)&&e.setSymbol(r,n)})}},{key:"updateSymbol",value:function(t,e){return this.getSymbol(t)?aL(e)?(this.symbolManager.addSymbol(t,e),void this.updateLayerSymbol(t)):this.map.fire("error",{error:new Error("Symbol is not supported expressions.")}):this.map.fire("error",{error:new Error('Symbol "'.concat(t,'" could not be loaded. Please make sure you have added the symbol with map.addSymbol().'))})}},{key:"setSymbolProperty",value:function(t,e,r,n){var o=this.getSymbol(t);if(!o)return this.map.fire("error",{error:new Error('Symbol "'.concat(t,'" could not be loaded. Please make sure you have added the symbol with map.addSymbol().'))});if(oL(n))return this.map.fire("error",{error:new Error("Symbol value is not supported expressions.")});var i=sL(r)?"paint":"layout";if(o.length>0){var a=o[e];if(!a)return this.map.fire("error",{error:new Error("symbol[".concat(e,"] does not exist."))});a[i]||(a[i]={}),Object.assign(a[i],fL({},r,n))}else o[i]||(o[i]={}),Object.assign(o[i],fL({},r,n));this.symbolManager.addSymbol(t,o),this.updateLayerSymbol(t)}},{key:"getSymbolProperty",value:function(t,e,r){var n=this.getSymbol(t);if(n){var o=sL(r)?"paint":"layout";return n.length>0?n[e]&&n[e][o]&&n[e][o][r]:n[o]&&n[o][r]}this.map.fire("error",{error:new Error('Symbol "'.concat(t,'" could not be loaded. Please make sure you have added the symbol with map.addSymbol().'))})}}])&&hL(e.prototype,r),n&&hL(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function yL(t){"@babel/helpers - typeof";return(yL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function vL(){vL=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new A(n||[]);return o(a,"_invoke",{value:P(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",v={};function g(){}function m(){}function b(){}var w={};l(w,a,function(){return this});var S=Object.getPrototypeOf,x=S&&S(S(M([])));x&&x!==r&&n.call(x,a)&&(w=x);var _=b.prototype=g.prototype=Object.create(w);function E(t){["next","throw","return"].forEach(function(e){l(t,e,function(t){return this._invoke(e,t)})})}function O(t,e){function r(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==yL(c)&&n.call(c,"__await")?e.resolve(c.__await).then(function(t){r("next",t,a,s)},function(t){r("throw",t,a,s)}):e.resolve(c).then(function(t){l.value=t,a(l)},function(t){return r("throw",t,a,s)})}s(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e(function(e,o){r(t,n,e,o)})}return i=i?i.then(o,o):o()}})}function P(e,r,n){var o=h;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=k(s,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function M(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function gL(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function mL(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){gL(i,n,o,a,s,"next",t)}function s(t){gL(i,n,o,a,s,"throw",t)}a(void 0)})}}var bL=function(){var t=function(t){return w().Map.prototype.symbolHandler||(w().Map.prototype.symbolHandler=new dL(t)),w().Map.prototype.symbolHandler._update(t)};function e(){return(e=mL(vL().mark(function t(e,r){var n,o,i,a,s,u;return vL().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n="".concat(r.basePath,"/").concat(e,"/").concat(e),t.next=4,tt.get("".concat(n,".json")).then(function(t){return t.ok?t.json():null}).catch(function(){return null});case 4:if(o=t.sent){t.next=7;break}return t.abrupt("return",null);case 7:if(i=o.paint||{},a=o.layout||{},s=i["fill-pattern"]||i["line-pattern"]||a["icon-image"],t.t0=s,!t.t0){t.next=15;break}return t.next=14,new Promise(function(t){var e=new Image;e.src="".concat(n,".png"),e.onload=function(r){t(r?e:null)},e.onerror=function(){t(null)}});case 14:t.t0=t.sent;case 15:return u=t.t0,t.abrupt("return",{value:o,image:u});case 17:case"end":return t.stop()}},t)}))).apply(this,arguments)}function r(r,n){return function(t,r){return e.apply(this,arguments)}(r,n).then(function(e){if(!e)return null;var r=e.value,o=e.image;return o&&t(n).addSymbolImageToMap(r,o),r})}void 0===w().Map.prototype.addLayerBySymbolBak&&(w().Map.prototype.addLayerBySymbolBak=w().Map.prototype.addLayer,w().Map.prototype.addLayer=function(e,r){var n=t(this);if(!(n.getLayerIds(e.id).length>0))return e.symbol?(n.addLayer(e,r),this):(this.addLayerBySymbolBak(e,r),this);this.fire("error",{error:new Error("A layer with this id already exists.")})}),void 0===w().Map.prototype.getLayerBySymbolBak&&(w().Map.prototype.getLayerBySymbolBak=w().Map.prototype.getLayer,w().Map.prototype.getLayer=function(e){return t(this).getLayer(e)}),void 0===w().Map.prototype.moveLayerBySymbolBak&&(w().Map.prototype.moveLayerBySymbolBak=w().Map.prototype.moveLayer,w().Map.prototype.moveLayer=function(e,r){return!this.style.getLayer(e)||r&&!this.style.getLayer(r)?(t(this).moveLayer(e,r),this._update(!0)):this.moveLayerBySymbolBak(e,r)}),void 0===w().Map.prototype.removeLayerBySymbolBak&&(w().Map.prototype.removeLayerBySymbolBak=w().Map.prototype.removeLayer,w().Map.prototype.removeLayer=function(e){return this.style.getLayer(e)?this.removeLayerBySymbolBak(e):t(this).removeLayer(e)}),void 0===w().Map.prototype.setLayoutPropertyBySymbolBak&&(w().Map.prototype.setLayoutPropertyBySymbolBak=w().Map.prototype.setLayoutProperty,w().Map.prototype.setLayoutProperty=function(e,r,n,o){return this.overlayLayersManager[e]||this.style.getLayer(e)?this.setLayoutPropertyBySymbolBak(e,r,n,o):(t(this).setLayoutProperty(e,r,n,o),this._update(!0))}),w().Map.prototype.setSymbol=function(e,r){t(this).setSymbol(e,r)},w().Map.prototype.setStyleBak||(w().Map.prototype.setStyleBak=w().Map.prototype.setStyle,w().Map.prototype.setStyle=function(t,e){var r=this;return this.setStyleBak(t,e),this.style&&this.style.once("style.load",function(){t.layers.filter(function(t){return t.symbol}).forEach(function(t){r.setSymbol(t.id,t.symbol)})}),this}),w().Map.prototype.loadSymbol=(n=mL(vL().mark(function t(e,n){var o,i,a,s,u,l,c=this;return vL().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if("string"!=typeof e){t.next=9;break}return t.next=3,r(e,this);case 3:o=t.sent,i=null,o||(i="Symbol ".concat(e," is not exists")),n(i,o),t.next=21;break;case 9:if(!q.isArray(e)){t.next=20;break}return a=e.map(function(t){return r(t,c)}),t.next=13,Promise.all(a);case 13:s=t.sent,u=null,(l=e.filter(function(t,e){return!s[e]})).length>0&&(u="Symbol ".concat(l.join(",")," is not exists")),n(u,s),t.next=21;break;case 20:n({message:"Symbol id must be a string or string[]."});case 21:case"end":return t.stop()}},t,this)})),function(t,e){return n.apply(this,arguments)}),w().Map.prototype.addSymbol=function(e,r){t(this).addSymbol(e,r)},w().Map.prototype.getSymbol=function(e){return t(this).getSymbol(e)},w().Map.prototype.hasSymbol=function(t){return t?!!this.getSymbol(t):(this.fire("error",{error:new Error("Missing required symbol id")}),!1)},w().Map.prototype.removeSymbol=function(e){t(this).removeSymbol(e)},w().Map.prototype.updateSymbol=function(e,r){t(this).updateSymbol(e,r)},w().Map.prototype.setSymbolProperty=function(e,r,n,o){t(this).setSymbolProperty(e,r,n,o)},w().Map.prototype.getSymbolProperty=function(e,r,n){return t(this).getSymbolProperty(e,r,n)},w().Map.prototype.getStyle=function(){if(this.style)return t(this).getStyle()},w().Map.prototype.setFilter=function(e,r,n){return this.style.getLayer(e)?(this.style.setFilter(e,r,n),this._update(!0)):(t(this).setFilter(e,r,n),this._update(!0))},w().Map.prototype.getFilter=function(e){return this.style.getLayer(e)?this.style.getFilter(e):t(this).getFilter(e)},w().Map.prototype.setLayerZoomRange=function(e,r,n){return this.style.getLayer(e)?(this.style.setLayerZoomRange(e,r,n),this._update(!0)):(t(this).setLayerZoomRange(e,r,n),this._update(!0))},w().Map.prototype.setPaintProperty=function(e,r,n,o){return this.style.getLayer(e)?(this.style.setPaintProperty(e,r,n,o),this._update(!0)):(t(this).setPaintProperty(e,r,n,o),this._update(!0))},w().Map.prototype.getPaintProperty=function(e,r){return this.style.getLayer(e)?this.style.getPaintProperty(e,r):t(this).getPaintProperty(e,r)},w().Map.prototype.getLayoutProperty=function(e,r){return this.style.getLayer(e)?this.style.getLayoutProperty(e,r):t(this).getLayoutProperty(e,r)},void 0===w().Map.prototype.onBak&&(w().Map.prototype.onBak=w().Map.prototype.on,w().Map.prototype.on=function(e,r,n){var o=this;return void 0===n||this.style.getLayer(r)?this.onBak(e,r,n):(t(this).getLayerIds(r).forEach(function(t){return o.onBak(e,t,n)}),this)}),void 0===w().Map.prototype.onceBak&&(w().Map.prototype.onceBak=w().Map.prototype.once,w().Map.prototype.once=function(e,r,n){var o=this;return void 0===n||this.style.getLayer(r)?this.onceBak(e,r,n):(t(this).getLayerIds(r).forEach(function(t){return o.onceBak(e,t,n)}),this)}),void 0===w().Map.prototype.offBak&&(w().Map.prototype.offBak=w().Map.prototype.off,w().Map.prototype.off=function(e,r,n){var o=this;return void 0===n||this.style.getLayer(r)?this.offBak(e,r,n):(t(this).getLayerIds(r).forEach(function(t){return o.offBak(e,t,n)}),this)});var n};function wL(t){"@babel/helpers - typeof";return(wL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function SL(t,e){for(var r=0;r=0){var e=JSON.parse(t.data);return t.filterParam=e,t.eventType="setFilterParamSucceeded",void this.events.triggerEvent("setFilterParamSucceeded",t)}var r=JSON.parse(t.data);t.featureResult=r,t.eventType="messageSucceeded",this.events.triggerEvent("messageSucceeded",t)}},{key:"_connect",value:function(t){return t=fv.appendCredential(t),"WebSocket"in window?new WebSocket(t):"MozWebSocket"in window?new(0,window.MozWebSocket)(t):(console.log("no WebSocket"),null)}}])&&VR(r.prototype,n),o&&VR(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function KR(t){"@babel/helpers - typeof";return(KR="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function QR(t,e){for(var r=0;r=0&&n.toIndex>=0&&!o&&(n.url=q.urlAppend(n.url,"fromIndex=".concat(n.fromIndex,"&toIndex=").concat(n.toIndex))),n.returnContent&&(t.returnCountOnly||t.returnDatasetInfoOnly||t.returnFeaturesOnly||console.warn("recommend set returnFeaturesOnly config to true to imporve performance. if need get Total amount and Dataset information. FeatureService provide getFeaturesCount and getFeaturesDatasetInfo method"),t.returnCountOnly&&(n.url=q.urlAppend(n.url,"returnCountOnly="+t.returnCountOnly)),t.returnDatasetInfoOnly&&(n.url=q.urlAppend(n.url,"returnDatasetInfoOnly="+t.returnDatasetInfoOnly)),t.returnFeaturesOnly&&(n.url=q.urlAppend(n.url,"returnFeaturesOnly="+t.returnFeaturesOnly))),r=n.getJsonParameters(t),n.request({method:"POST",data:r,scope:n,success:e,failure:e})}}},{key:"transformResult",value:function(t,e){t=q.transformResult(t);var r=new Kn;(this.format===Jr.GEOJSON&&t.features&&(t.features=r.toGeoJSON(t.features)),this.returnFeaturesOnly&&Array.isArray(t))&&(t={succeed:t.succeed,features:r.toGeoJSON(t)});return{result:t,options:e}}},{key:"dataFormat",value:function(){return[Jr.GEOJSON,Jr.ISERVER,Jr.FGB]}}])&&lB(r.prototype,n),o&&lB(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function gB(t){"@babel/helpers - typeof";return(gB="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function mB(t,e){for(var r=0;r0;)t.fields.pop();t.fields=null}}}])&&PB(r.prototype,n),o&&PB(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function NB(t){"@babel/helpers - typeof";return(NB="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function LB(t,e){for(var r=0;r0;)t.fields.pop();t.fields=null}t.attributeFilter=null,t.spatialQueryMode=null,t.getFeatureMode=null}}])&&aF(r.prototype,n),o&&aF(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function dF(t){"@babel/helpers - typeof";return(dF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function yF(t,e){for(var r=0;r0;)t.fields.pop();t.fields=null}t.geometry&&(t.geometry.destroy(),t.geometry=null)}}])&&_F(r.prototype,n),o&&_F(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function MF(t){"@babel/helpers - typeof";return(MF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function jF(t,e){for(var r=0;r0;)t.fields.pop();t.fields=null}t.attributeFilter=null,t.spatialQueryMode=null,t.getFeatureMode=null}}])&&GF(r.prototype,n),o&&GF(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function XF(t){"@babel/helpers - typeof";return(XF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function JF(t,e){for(var r=0;r0)for(var r in t.items)t.items[r].destroy(),t.items[r]=null;t.items=null}t.defaultStyle&&(t.defaultStyle.destroy(),t.defaultStyle=null)}},{key:"toServerJSONObject",value:function(){var t={};if((t=q.copyAttributes(t,this)).defaultStyle&&t.defaultStyle.toServerJSONObject&&(t.defaultStyle=t.defaultStyle.toServerJSONObject()),t.items){for(var e=[],r=t.items.length,n=0;n0)for(var r in t.items)t.items[r].destroy(),t.items[r]=null;t.items=null}t.rangeExpression=null,t.rangeMode=null,t.rangeParameter=null,t.colorGradientType=null}}])&&rH(r.prototype,n),o&&rH(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function cH(t){"@babel/helpers - typeof";return(cH="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function fH(t,e){for(var r=0;r0?t[0].subLayers.layers:null)?r.length:0,this.handleLayers(n,r),{result:t[0],options:e}}},{key:"handleLayers",value:function(t,e){var r;if(t)for(var n=0;n0)this.handleLayers(e[n].subLayers.layers.length,e[n].subLayers.layers);else switch(e[n].ugcLayerType){case"THEME":(r=new qH).fromJson(e[n]),e[n]=r;break;case"GRID":(r=new nq).fromJson(e[n]),e[n]=r;break;case"IMAGE":(r=new fq).fromJson(e[n]),e[n]=r;break;case"VECTOR":(r=new bq).fromJson(e[n]),e[n]=r}}}}])&&Sq(r.prototype,n),o&&Sq(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function Tq(t){"@babel/helpers - typeof";return(Tq="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Aq(t,e){for(var r=0;r0&&(n+='"subLayers":'+t.toJSON()),n+=',"visible":true,',n+='"name":"'+this.getMapName(this.mapUrl)+'"',n+="}]",r.request({method:"PUT",data:n,scope:r,success:e,failure:e})}}},{key:"createTempLayerComplete",value:function(t,e){return e.result=q.transformResult(e.result),e.result.succeed&&(this.lastparams.resourceID=e.result.newResourceID),this.processAsync(this.lastparams,t)}},{key:"getMapName",value:function(t){var e=t;"/"===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1));var r=e.lastIndexOf("/");return e.substring(r+1,e.length)}},{key:"transformResult",value:function(t,e){return null!=(t=q.transformResult(t))&&null!=this.lastparams&&null!=this.lastparams.resourceID&&(t.newResourceID=this.lastparams.resourceID),{result:t,options:e}}}])&&sW(r.prototype,n),o&&sW(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function yW(t){"@babel/helpers - typeof";return(yW="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function vW(t,e){for(var r=0;r=200&&t.code<300||0==t.code||304===t.code,n=t.code&&r;return!t.code||n?{result:t,options:e}:{error:t,options:e}}}])&&kW(r.prototype,n),o&&kW(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function LW(t){"@babel/helpers - typeof";return(LW="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function RW(t,e){for(var r=0;r0&&(r+=","),r+='{"x":'+e[o].x+',"y":'+e[o].y+"}";else if(!0===t)for(var i=0;i0&&(r+=","),r+=e[i];return r+="]"}}])&&JY(r.prototype,n),o&&JY(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function rX(t){"@babel/helpers - typeof";return(rX="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function nX(t,e){for(var r=0;r0&&(r+=","),r+='{"x":'+e[o].x+',"y":'+e[o].y+"}";else if(!0===t)for(var i=0;i0&&(r+=","),r+=e[i];return r+="]"}},{key:"toGeoJSONResult",value:function(t){if(!t||!t.facilityPathList)return t;var e=new Kn;return t.facilityPathList.map(function(t){return t.route&&(t.route=e.toGeoJSON(t.route)),t.pathGuideItems&&(t.pathGuideItems=e.toGeoJSON(t.pathGuideItems)),t.edgeFeatures&&(t.edgeFeatures=e.toGeoJSON(t.edgeFeatures)),t.nodeFeatures&&(t.nodeFeatures=e.toGeoJSON(t.nodeFeatures)),t}),t}}])&&VX(r.prototype,n),o&&VX(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function KX(t){"@babel/helpers - typeof";return(KX="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function QX(t,e){for(var r=0;r0&&(e+=","),e+=q.toJSON(t[n]);return e+="]"}},{key:"toGeoJSONResult",value:function(t){if(!t)return null;var e=new Kn;return t.demandResults&&(t.demandResults=e.toGeoJSON(t.demandResults)),t.supplyResults&&(t.supplyResults=e.toGeoJSON(t.supplyResults)),t}}])&&eJ(r.prototype,n),o&&eJ(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function uJ(t){"@babel/helpers - typeof";return(uJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function lJ(t,e){for(var r=0;r0&&(r+=","),r+='{"x":'+e[o].x+',"y":'+e[o].y+"}";else if(!0===t)for(var i=0;i0&&(r+=","),r+=e[i];return r+="]"}},{key:"toGeoJSONResult",value:function(t){if(!t||!t.pathList)return null;var e=new Kn;return t.pathList.map(function(t){return t.route&&(t.route=e.toGeoJSON(t.route)),t.pathGuideItems&&(t.pathGuideItems=e.toGeoJSON(t.pathGuideItems)),t.edgeFeatures&&(t.edgeFeatures=e.toGeoJSON(t.edgeFeatures)),t.nodeFeatures&&(t.nodeFeatures=e.toGeoJSON(t.nodeFeatures)),t}),t}}])&&pJ(r.prototype,n),o&&pJ(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function wJ(t){"@babel/helpers - typeof";return(wJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function SJ(t,e){for(var r=0;r0&&(r+=","),r+='{"x":'+e[o].x+',"y":'+e[o].y+"}";else if(!0===t)for(var i=0;i0&&(r+=","),r+=e[i];return r+="]"}},{key:"toGeoJSONResult",value:function(t){if(!t||!t.pathList||t.pathList.length<1)return null;var e=new Kn;return t.pathList.forEach(function(t){t.route&&(t.route=e.toGeoJSON(t.route)),t.pathGuideItems&&(t.pathGuideItems=e.toGeoJSON(t.pathGuideItems)),t.edgeFeatures&&(t.edgeFeatures=e.toGeoJSON(t.edgeFeatures)),t.nodeFeatures&&(t.nodeFeatures=e.toGeoJSON(t.nodeFeatures))}),t}}])&&OJ(r.prototype,n),o&&OJ(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function jJ(t){"@babel/helpers - typeof";return(jJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function IJ(t,e){for(var r=0;r0&&(r+=","),r+='{"x":'+e[o].x+',"y":'+e[o].y+"}";else if(!0===t)for(var i=0;i0&&(r+=","),r+=e[i];return r+="]"}},{key:"toGeoJSONResult",value:function(t){if(!t||!t.serviceAreaList)return t;var e=new Kn;return t.serviceAreaList.map(function(t){return t.serviceRegion&&(t.serviceRegion=e.toGeoJSON(t.serviceRegion)),t.edgeFeatures&&(t.edgeFeatures=e.toGeoJSON(t.edgeFeatures)),t.nodeFeatures&&(t.nodeFeatures=e.toGeoJSON(t.nodeFeatures)),t.routes&&(t.routes=e.toGeoJSON(t.routes)),t}),t}}])&&DJ(r.prototype,n),o&&DJ(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function HJ(t){"@babel/helpers - typeof";return(HJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function qJ(t,e){for(var r=0;r0&&(e+=","),e+='{"x":'+o[r].x+',"y":'+o[r].y+"}";i+=e+="]"}else if(!0===t.isAnalyzeById){for(var a="[",s=t.nodes,u=s.length,l=0;l0&&(a+=","),a+=s[l];i+=a+="]"}return i}},{key:"toGeoJSONResult",value:function(t){if(!t||!t.tspPathList)return null;var e=new Kn;return t.tspPathList.forEach(function(t){t.route&&(t.route=e.toGeoJSON(t.route)),t.pathGuideItems&&(t.pathGuideItems=e.toGeoJSON(t.pathGuideItems)),t.edgeFeatures&&(t.edgeFeatures=e.toGeoJSON(t.edgeFeatures)),t.nodeFeatures&&(t.nodeFeatures=e.toGeoJSON(t.nodeFeatures))}),t}}])&&JJ(r.prototype,n),o&&JJ(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function rK(t){"@babel/helpers - typeof";return(rK="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function nK(t,e){for(var r=0;r0)for(var e in t.items)t.items[e].destroy(),t.items[e]=null;t.items=null}t.numericPrecision=null,t.rangeMode=null,t.rangeCount=null,t.colorGradientType=null}}])&&UZ(e.prototype,r),n&&UZ(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function HZ(t){"@babel/helpers - typeof";return(HZ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function qZ(t,e){for(var r=0;r=0;t--)this.points[t].destroy();this.points=null}}}])&&E9(r.prototype,n),o&&E9(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function j9(t){"@babel/helpers - typeof";return(j9="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function I9(t,e){for(var r=0;r0&&(1===o.length?r+="'displayFilter':\""+o[0]+'",':r+="'displayFilter':\""+o[a]+'",'),(i=t.displayOrderBy)&&i.length>0&&(1===i.length?r+="'displayOrderBy':'"+i[0]+"',":r+="'displayOrderBy':'"+i[a]+"',"),(e=t.fieldValuesDisplayFilter)&&(r+="'fieldValuesDisplayFilter':"+q.toJSON(e)+","),t.joinItems&&t.joinItems.length>0&&t.joinItems[a]&&(r+="'joinItems':["+q.toJSON(t.joinItems[a])+"],"),t.datasetNames&&t.dataSourceNames){var u=t.datasetNames[a]?a:t.datasetNames.length-1,l=t.dataSourceNames[a]?a:t.dataSourceNames.length-1;r+="'datasetInfo': {'name': '"+t.datasetNames[u]+"','dataSourceName': '"+t.dataSourceNames[l]+"'}},"}else r+="},"}t.themes&&t.themes.length>0&&(r=r.substring(0,r.length-1)),r+="]},";var c=this.url.split("/");return r+="'name': '"+c[c.length-2]+"'}]"}}])&&Z7(r.prototype,n),o&&Z7(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function att(t){"@babel/helpers - typeof";return(att="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function stt(t,e){for(var r=0;r=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function cet(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function fet(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){cet(i,n,o,a,s,"next",t)}function s(t){cet(i,n,o,a,s,"throw",t)}a(void 0)})}}function het(t,e){for(var r=0;r0&&o.push(","),r=e[i].geometry,o.push(this.extractGeometry(r));return n&&o.push(")"),o.join("")}},{key:"extractGeometry",value:function(t){var e=t.CLASS_NAME.split(".")[2].toLowerCase();return this.extract[e]?("collection"===e?"GEOMETRYCOLLECTION":e.toUpperCase())+"("+this.extract[e].apply(this,[t])+")":null}}])&&crt(r.prototype,n),o&&crt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function vrt(t){"@babel/helpers - typeof";return(vrt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function grt(t,e){for(var r=0;r=0?e.speed:1,this.frequency=e.speed&&e.frequency>=0?e.frequency:1e3,this.startTime=e.startTime&&null!=e.startTime?e.startTime:0,this.endTime=e.endTime&&null!=e.endTime&&e.endTime>=r.startTime?e.endTime:+new Date,this.repeat=void 0===e.repeat||e.repeat,this.reverse=void 0!==e.reverse&&e.reverse,this.currentTime=null,this.oldTime=null,this.running=!1,this.EVENT_TYPES=["start","pause","stop"],r.events=new ra(this,null,this.EVENT_TYPES),r.speed=Number(r.speed),r.frequency=Number(r.frequency),r.startTime=Number(r.startTime),r.endTime=Number(r.endTime),r.startTime=Date.parse(new Date(r.startTime)),r.endTime=Date.parse(new Date(r.endTime)),r.currentTime=r.startTime,this.CLASS_NAME="SuperMap.TimeControlBase"}var e,r,n;return e=t,(r=[{key:"updateOptions",value:function(t){var e=this;(t=t||{}).speed&&t.speed>=0&&(e.speed=t.speed,e.speed=Number(e.speed)),t.speed&&t.frequency>=0&&(e.frequency=t.frequency,e.frequency=Number(e.frequency)),t.startTime&&null!=t.startTime&&(e.startTime=t.startTime,e.startTime=Date.parse(new Date(e.startTime))),t.endTime&&null!=t.endTime&&t.endTime>=e.startTime&&(e.endTime=t.endTime,e.endTime=Date.parse(new Date(e.endTime))),null!=t.repeat&&(e.repeat=t.repeat),null!=t.reverse&&(e.reverse=t.reverse)}},{key:"start",value:function(){var t=this;t.running||(t.running=!0,t.tick(),t.events.triggerEvent("start",t.currentTime))}},{key:"pause",value:function(){this.running=!1,this.events.triggerEvent("pause",this.currentTime)}},{key:"stop",value:function(){var t=this;t.currentTime=t.startTime,t.running&&(t.running=!1),t.events.triggerEvent("stop",t.currentTime)}},{key:"toggle",value:function(){this.running?this.pause():this.start()}},{key:"setSpeed",value:function(t){return t>=0&&(this.speed=t,!0)}},{key:"getSpeed",value:function(){return this.speed}},{key:"setFrequency",value:function(t){return t>=0&&(this.frequency=t,!0)}},{key:"getFrequency",value:function(){return this.frequency}},{key:"setStartTime",value:function(t){var e=this;return!((t=Date.parse(new Date(t)))>e.endTime)&&(e.startTime=t,e.currentTime=e.endTime&&(e.currentTime=e.startTime,e.tick()),!0)}},{key:"getEndTime",value:function(){return this.endTime}},{key:"setCurrentTime",value:function(t){var e=this;return e.currentTime=Date.parse(new Date(e.currentTime)),t>=e.startTime&&t<=e.endTime&&(e.currentTime=t,e.startTime=e.currentTime,e.tick(),!0)}},{key:"getCurrentTime",value:function(){return this.currentTime}},{key:"setRepeat",value:function(t){this.repeat=t}},{key:"getRepeat",value:function(){return this.repeat}},{key:"setReverse",value:function(t){this.reverse=t}},{key:"getReverse",value:function(){return this.reverse}},{key:"getRunning",value:function(){return this.running}},{key:"destroy",value:function(){var t=this;t.speed=null,t.frequency=null,t.startTime=null,t.endTime=null,t.currentTime=null,t.repeat=null,t.running=!1,t.reverse=null}},{key:"tick",value:function(){}}])&&grt(e.prototype,r),n&&grt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function wrt(t){"@babel/helpers - typeof";return(wrt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Srt(t,e){for(var r=0;r=t.endTime&&(t.currentTime=t.endTime)}}}])&&Srt(r.prototype,n),o&&Srt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function Trt(t){"@babel/helpers - typeof";return(Trt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Art(t,e){for(var r=0;r3&&void 0!==arguments[3]?arguments[3]:{headers:this.headers,crossOrigin:this.crossOrigin,withCredentials:this.withCredentials};return e=fv.appendCredential(e),tt.commit(t,e,r,n).then(function(t){return t.json()})}}])&&qrt(e.prototype,r),n&&qrt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Xrt(t){"@babel/helpers - typeof";return(Xrt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Jrt(t,e){for(var r=0;r0)for(var r in t.items)t.items[r].destroy(),t.items[r]=null;t.items=null}t.reverseColor=null,t.rangeMode=null,t.rangeParameter=null,t.colorGradientType=null}}])&&iat(r.prototype,n),o&&iat(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function pat(t){"@babel/helpers - typeof";return(pat="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function dat(t,e){for(var r=0;r0)for(var r in t.items)t.items[r].destroy(),t.items[r]=null;t.items=null}t.defaultcolor&&(t.defaultcolor.destroy(),t.defaultcolor=null)}},{key:"toServerJSONObject",value:function(){var t={};if((t=q.copyAttributes(t,this)).defaultcolor&&t.defaultcolor.toServerJSONObject&&(t.defaultcolor=t.defaultcolor.toServerJSONObject()),t.items){for(var e=[],r=t.items.length,n=0;n0&&(t=t.substring(0,t.length-1)),"{"+t+"}"}return null}}])&&Mat(e.prototype,r),n&&Mat(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Nat(t){"@babel/helpers - typeof";return(Nat="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Lat(t,e){for(var r=0;r3&&void 0!==arguments[3]?arguments[3]:{};return e=fv.appendCredential(e),n.crossOrigin=this.options.crossOrigin,n.headers=this.options.headers,tt.commit(t,e,r,n).then(function(t){return t.json()})}}])&&Iut(e.prototype,r),n&&Iut(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Rut(t){"@babel/helpers - typeof";return(Rut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Dut(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);re.geoFence.radius&&(e.outOfGeoFence&&e.outOfGeoFence(t),e.events.triggerEvent("outOfGeoFence",{data:t})),r})}},{key:"_distance",value:function(t,e,r,n){return Math.sqrt((t-r)*(t-r)+(e-n)*(e-n))}},{key:"_getMeterPerMapUnit",value:function(t){var e;return"meter"===t?e=1:"degree"===t&&(e=2*Math.PI*6378137/360),e}}])&&plt(e.prototype,r),n&&plt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function vlt(t){"@babel/helpers - typeof";return(vlt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function glt(t,e){for(var r=0;r=e)if("RANGE"===r)for(o=0;o=0&&this.getSqrtInterval(t,r):"logarithm"===e?this.getMin(t)>0&&this.getGeometricProgression(t,r):void 0}},{key:"getSum",value:function(t){return this.getInstance(t).sum()}},{key:"getMax",value:function(t){return this.getInstance(t).max()}},{key:"getMin",value:function(t){return this.getInstance(t).min()}},{key:"getMean",value:function(t){return this.getInstance(t).mean()}},{key:"getMedian",value:function(t){return this.getInstance(t).median()}},{key:"getTimes",value:function(t){return t.length}},{key:"getEqInterval",value:function(t,e){return this.getInstance(t).getClassEqInterval(e)}},{key:"getJenks",value:function(t,e){return this.getInstance(t).getClassJenks(e)}},{key:"getSqrtInterval",value:function(t,e){return t=t.map(function(t){return Math.sqrt(t)}),this.getInstance(t).getClassEqInterval(e).map(function(t){return t*t})}},{key:"getGeometricProgression",value:function(t,e){return this.getInstance(t).getClassGeometricProgression(e)}}],(r=null)&&xlt(e.prototype,r),n&&xlt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();var Olt=r(8518),Plt=r.n(Olt);function klt(t){"@babel/helpers - typeof";return(klt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Clt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tlt(t,e){for(var r=0;rl&&(u[o]=u[o].slice(n-l),l=n)}function y(t){var e,i,a,s;if(t instanceof Function)return t.call(c.parsers);if("string"==typeof t)e=r.charAt(n)===t?t:null,i=1,d();else{if(d(),!(e=t.exec(u[o])))return null;i=e[0].length}if(e){var f=n+=i;for(s=n+u[o].length-i;n=0&&"\n"!==n.charAt(a);a--)t.column++;return new Error([t.filename,t.line,t.column,t.message].join(";"))}return this.env=e=e||{},this.env.filename=this.env.filename||null,this.env.inputs=this.env.inputs||{},c={parse:function(i){var a,c=null;if(n=o=l=s=0,u=[],r=i.replace(/\r\n/g,"\n"),e.filename&&(f.env.inputs[e.filename]=r),u=function(t){for(var e,n,o,i,a=0,s=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,u=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,l=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,f=0,h=t[0],p=0;p0?"missing closing `}`":"missing opening `{`"}),t.map(function(t){return t.join("")})}([[]]),c)throw v(c);var h=function(t,e){var r=t.specificity,n=e.specificity;return r[0]!=n[0]?n[0]-r[0]:r[1]!=n[1]?n[1]-r[1]:r[2]!=n[2]?n[2]-r[2]:n[3]-r[3]};return(a=new t.Tree.Ruleset([],y(this.parsers.primary))).root=!0,a.toList=function(t){t.error=function(e){t.errors||(t.errors=new Error("")),t.errors.message?t.errors.message+="\n"+v(e).message:t.errors.message=v(e).message},t.frames=t.frames||[];var e=this.flatten([],[],t);return e.sort(h),e},a},parsers:{primary:function(){for(var t,e=[];(t=y(this.rule)||y(this.ruleset)||y(this.comment))||y(/^[\s\n]+/)||(t=y(this.invalid));)t&&e.push(t);return e},invalid:function(){var e=y(/^[^;\n]*[;\n]/);if(e)return new t.Tree.Invalid(e,a)},comment:function(){var e;if("/"===r.charAt(n))return"/"===r.charAt(n+1)?new t.Tree.Comment(y(/^\/\/.*/),!0):(e=y(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/))?new t.Tree.Comment(e):void 0},entities:{quoted:function(){if('"'===r.charAt(n)||"'"===r.charAt(n)){var e=y(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);return e?new t.Tree.Quoted(e[1]||e[2]):void 0}},field:function(){if(y("[")){var e=y(/(^[^\]]+)/);if(y("]"))return e?new t.Tree.Field(e[1]):void 0}},comparison:function(){var t=y(/^=~|=|!=|<=|>=|<|>/);if(t)return t},keyword:function(){var e=y(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);if(e)return new t.Tree.Keyword(e)},call:function(){var e,r;if(e=/^([\w\-]+|%)\(/.exec(u[o])){if("url"===(e=e[1]))return null;n+=e.length;if(y("("),r=y(this.entities.arguments),y(")"))return e?new t.Tree.Call(e,r,n):void 0}},arguments:function(){for(var t,e=[];t=y(this.expression);){e.push(t);if(!y(","))break}return e},literal:function(){return y(this.entities.dimension)||y(this.entities.keywordcolor)||y(this.entities.hexcolor)||y(this.entities.quoted)},url:function(){var e;if("u"===r.charAt(n)&&y(/^url\(/)){e=y(this.entities.quoted)||y(this.entities.variable)||y(/^[\-\w%@_match\/.&=:;#+?~]+/)||"";return y(")")?new t.Tree.URL(void 0!==e.value||e instanceof t.Tree.Variable?e:new t.Tree.Quoted(e)):new t.Tree.Invalid(e,a,"Missing closing ) in URL.")}},variable:function(){var o,i=n;if("@"===r.charAt(n)&&(o=y(/^@[\w-]+/)))return new t.Tree.Variable(o,i,e.filename)},hexcolor:function(){var e;if("#"===r.charAt(n)&&(e=y(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/)))return new t.Tree.Color(e[1])},keywordcolor:function(){var e=u[o].match(/^[a-z]+/);if(e&&e[0]in t.Tree.Reference.data.colors)return new t.Tree.Color(t.Tree.Reference.data.colors[y(/^[a-z]+/)])},dimension:function(){var e=r.charCodeAt(n);if(!(e>57||e<45||47===e)){var o=y(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);return o?new t.Tree.Dimension(o[1],o[2],a):void 0}}},variable:function(){var t;if("@"===r.charAt(n)&&(t=y(/^(@[\w-]+)\s*:/)))return t[1]},entity:function(){var t=y(this.entities.call)||y(this.entities.literal),e=y(this.entities.field)||y(this.entities.variable),r=y(this.entities.url)||y(this.entities.keyword);return t||e||r},end:function(){var t;return y(";")||("string"==typeof(t="}")?r.charAt(n)===t:!!t.test(u[o]))},element:function(){var e=y(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);if(e)return new t.Tree.Element(e)},attachment:function(){var t=y(/^::([\w\-]+(?:\/[\w\-]+)*)/);if(t)return t[1]},selector:function(){for(var e,o,i,s,u,l=[],c=new t.Tree.Filterset,f=[],h=0,p=0;(i=y(this.element))||(u=y(this.zoom))||(s=y(this.filter))||(e=y(this.attachment));){if(h++,i)l.push(i);else if(u)f.push(u),p++;else if(s){var d=c.add(s);if(d)throw v({message:d,index:n-1});p++}else{if(o)throw v({message:"Encountered second attachment name.",index:n-1});o=e}var g=r.charAt(n);if("{"===g||"}"===g||";"===g||","===g)break}if(h)return new t.Tree.Selector(c,f,l,o,p,a)},filter:function(){h();var r,n,o;if(y("[")&&(r=y(/^[a-zA-Z0-9\-_]+/)||y(this.entities.quoted)||y(this.entities.variable)||y(this.entities.keyword)||y(this.entities.field))&&(r instanceof t.Tree.Quoted&&(r=new t.Tree.Field(r.toString())),(n=y(this.entities.comparison))&&(o=y(this.entities.quoted)||y(this.entities.variable)||y(this.entities.dimension)||y(this.entities.keyword)||y(this.entities.field)))){if(!y("]"))throw v({message:"Missing closing ] of filter.",index:a-1});return r.is||(r=new t.Tree.Field(r)),new t.Tree.Filter(r,n,o,a,e.filename)}},zoom:function(){h();var e,r;if(y(/^\[\s*zoom/g)&&(e=y(this.entities.comparison))&&(r=y(this.entities.variable)||y(this.entities.dimension))&&y("]"))return new t.Tree.Zoom(e,r,a);p()},block:function(){var t;if(y("{")&&(t=y(this.primary))&&y("}"))return t},ruleset:function(){var e,r,n=[];for(h();e=y(this.selector);){for(n.push(e);y(this.comment););if(!y(","))break;for(;y(this.comment););}if(e)for(;y(this.comment););if(n.length>0&&(r=y(this.block))){if(1===n.length&&n[0].elements.length&&"Map"===n[0].elements[0].value){var o=new t.Tree.Ruleset(n,r);return o.isMap=!0,o}return new t.Tree.Ruleset(n,r)}p()},rule:function(){var o,i,u=r.charAt(n);if(h(),"."!==u&&"#"!==u&&(o=y(this.variable)||y(this.property))){if((i=y(this.value))&&y(this.end))return new t.Tree.Rule(o,i,a,e.filename);s=n,p()}},font:function(){for(var e,r=[],n=[];e=y(this.entity);)n.push(e);if(r.push(new t.Tree.Expression(n)),y(","))for(;(e=y(this.expression))&&(r.push(e),y(",")););return new t.Tree.Value(r)},value:function(){for(var e,r=[];(e=y(this.expression))&&(r.push(e),y(",")););return r.length>1?new t.Tree.Value(r.map(function(t){return t.value[0]})):1===r.length?new t.Tree.Value(r):void 0},sub:function(){var t;if(y("(")&&(t=y(this.expression))&&y(")"))return t},multiplication:function(){var e,r,n,o;if(e=y(this.operand)){for(;(n=y("/")||y("*")||y("%"))&&(r=y(this.operand));)o=new t.Tree.Operation(n,[o||e,r],a);return o||e}},addition:function(){var e,o,i,s;if(e=y(this.multiplication)){for(;(i=y(/^[-+]\s+/)||" "!=r.charAt(n-1)&&(y("+")||y("-")))&&(o=y(this.multiplication));)s=new t.Tree.Operation(i,[s||e,o],a);return s||e}},operand:function(){return y(this.sub)||y(this.entity)},expression:function(){for(var e,r=[];e=y(this.addition)||y(this.entity);)r.push(e);if(r.length>0)return new t.Tree.Expression(r)},property:function(){var t=y(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);if(t)return t[1]}}}}},{key:"parse",value:function(t){var e=this.parser;return this.ruleSet=e.parse(t)}},{key:"toShaders",value:function(){if(this.ruleSet){var t=this.ruleSet;if(t){var e=t.toList(this.env);e.reverse();var r={},n=[];this._toShaders(r,n,e);for(var o=[],i={},a=0,s=e.length;a=0){if(!e.featureFilter){var i=o+n.length,a=r.indexOf(")",i+1),s="featureId&&(featureId"+r.substring(i,a)+")";Object.defineProperty(e,"featureFilter",{configurable:!0,enumerable:!1,value:function(t){return!!s}})}return{property:p,getValue:Function("attributes","zoom","seftFilter","var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){"+r+";} return _value; ")}}return{property:p,getValue:Function("attributes","zoom","var _value = null;"+r+"; return _value; ")}}(c[p],f);Object.defineProperty(f,"attachment",{configurable:!0,enumerable:!1,value:l}),Object.defineProperty(f,"elements",{configurable:!0,enumerable:!1,value:u.elements}),o.push(f),i[n[a]]=!0}Object.defineProperty(f,"zoom",{configurable:!0,enumerable:!1,value:u.zoom})}return o}}return null}},{key:"_toShaders",value:function(e,r,n){for(var o=0,i=n.length;o= minzoom - 1e-6 and scale < maxzoom + 1e-6"},maxzoom:{"default-value":"1.79769e+308",type:"float","default-meaning":"The layer will be visible at the maximum possible scale",doc:"The maximum scale denominator that this layer will be visible at. The default is the numeric limit of the C++ double type, which may vary slightly by system, but is likely a massive number like 1.79769e+308 and ensures that this layer will always be visible unless the value is reduced. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"},queryable:{"default-value":!1,type:"boolean","default-meaning":"The layer will not be available for the direct querying of data values",doc:"This property was added for GetFeatureInfo/WMS compatibility and is rarely used. It is off by default meaning that in a WMS context the layer will not be able to be queried unless the property is explicitly set to true"},"clear-label-cache":{"default-value":!1,type:"boolean","default-meaning":"The renderer's collision detector cache (used for avoiding duplicate labels and overlapping markers) will not be cleared immediately before processing this layer",doc:"This property, by default off, can be enabled to allow a user to clear the collision detector cache before a given layer is processed. This may be desirable to ensure that a given layers data shows up on the map even if it normally would not because of collisions with previously rendered labels or markers"},"group-by":{"default-value":"",type:"string","default-meaning":"No special layer grouping will be used during rendering",doc:"https://github.com/mapnik/mapnik/wiki/Grouped-rendering"},"buffer-size":{"default-value":"0",type:"float","default-meaning":"No buffer will be used",doc:"Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"},"maximum-extent":{"default-value":"none",type:"bbox","default-meaning":"No clipping extent will be used",doc:"An extent to be used to limit the bounds used to query this specific layer data during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Layer."}},symbolizers:{"*":{"image-filters":{css:"image-filters","default-value":"none","default-meaning":"no filters",type:"functions",functions:[["agg-stack-blur",2],["emboss",0],["blur",0],["gray",0],["sobel",0],["edge-detect",0],["x-gradient",0],["y-gradient",0],["invert",0],["sharpen",0]],doc:"A list of image filters."},"comp-op":{css:"comp-op","default-value":"src-over","default-meaning":"add the current layer on top of other layers",doc:"Composite operation. This defines how this layer should behave relative to layers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]},opacity:{css:"opacity",type:"float",doc:"An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)","default-value":1,"default-meaning":"no separate buffer will be used and no alpha will be applied to the style after rendering"}},map:{"background-color":{css:"background-color","default-value":"none","default-meaning":"transparent",type:"color",doc:"Map Background color"},"background-image":{css:"background-image",type:"uri","default-value":"","default-meaning":"transparent",doc:"An image that is repeated below all features on a map as a background.",description:"Map Background image"},srs:{css:"srs",type:"string","default-value":"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs","default-meaning":"The proj4 literal of EPSG:4326 is assumed to be the Map's spatial reference and all data from layers within this map will be plotted using this coordinate system. If any layers do not declare an srs value then they will be assumed to be in the same srs as the Map and not transformations will be needed to plot them in the Map's coordinate space",doc:"Map spatial reference (proj4 string)"},"buffer-size":{css:"buffer-size","default-value":"0",type:"float","default-meaning":"No buffer will be used",doc:'Extra tolerance around the map (in pixels) used to ensure labels crossing tile boundaries are equally rendered in each tile (e.g. cut in each tile). Not intended to be used in combination with "avoid-edges".'},"maximum-extent":{css:"","default-value":"none",type:"bbox","default-meaning":"No clipping extent will be used",doc:"An extent to be used to limit the bounds used to query all layers during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Map."},base:{css:"base","default-value":"","default-meaning":"This base path defaults to an empty string meaning that any relative paths to files referenced in styles or layers will be interpreted relative to the application process.",type:"string",doc:"Any relative paths used to reference files will be understood as relative to this directory path if the map is loaded from an in memory object rather than from the filesystem. If the map is loaded from the filesystem and this option is not provided it will be set to the directory of the stylesheet."},"paths-from-xml":{css:"","default-value":!0,"default-meaning":"Paths read from XML will be interpreted from the location of the XML",type:"boolean",doc:"value to control whether paths in the XML will be interpreted from the location of the XML or from the working directory of the program that calls load_map()"},"minimum-version":{css:"","default-value":"none","default-meaning":"Mapnik version will not be detected and no error will be thrown about compatibility",type:"string",doc:"The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"},"font-directory":{css:"font-directory",type:"uri","default-value":"none","default-meaning":"No map-specific fonts will be registered",doc:"Path to a directory which holds fonts which should be registered when the Map is loaded (in addition to any fonts that may be automatically registered)."}},polygon:{fill:{css:"polygon-fill",type:"color","default-value":"rgba(128,128,128,1)","default-meaning":"gray and fully opaque (alpha = 1), same as rgb(128,128,128)",doc:"Fill color to assign to a polygon"},"fill-opacity":{css:"polygon-opacity",type:"float",doc:"The opacity of the polygon","default-value":1,"default-meaning":"opaque"},gamma:{css:"polygon-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of polygon edges"},"gamma-method":{css:"polygon-gamma-method",type:["power","linear","none","threshold","multiply"],"default-value":"power","default-meaning":"pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",doc:"An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"},clip:{css:"polygon-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"polygon-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"polygon-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"polygon-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},line:{stroke:{css:"line-color","default-value":"rgba(0,0,0,1)",type:"color","default-meaning":"black and fully opaque (alpha = 1), same as rgb(0,0,0)",doc:"The color of a drawn line"},"stroke-width":{css:"line-width","default-value":1,type:"float",doc:"The width of a line in pixels"},"stroke-opacity":{css:"line-opacity","default-value":1,type:"float","default-meaning":"opaque",doc:"The opacity of a line"},"stroke-linejoin":{css:"line-join","default-value":"miter",type:["miter","round","bevel"],doc:"The behavior of lines when joining"},"stroke-linecap":{css:"line-cap","default-value":"butt",type:["butt","round","square"],doc:"The display of line endings"},"stroke-gamma":{css:"line-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of stroke line"},"stroke-gamma-method":{css:"line-gamma-method",type:["power","linear","none","threshold","multiply"],"default-value":"power","default-meaning":"pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",doc:"An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"},"stroke-dasharray":{css:"line-dasharray",type:"numbers",doc:"A pair of length values [a,b], where (a) is the dash length and (b) is the gap length respectively. More than two values are supported for more complex patterns.","default-value":"none","default-meaning":"solid line"},"stroke-dashoffset":{css:"line-dash-offset",type:"numbers",doc:"valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)","default-value":"none","default-meaning":"solid line"},"stroke-miterlimit":{css:"line-miterlimit",type:"float",doc:"The limit on the ratio of the miter length to the stroke-width. Used to automatically convert miter joins to bevel joins for sharp angles to avoid the miter extending beyond the thickness of the stroking path. Normally will not need to be set, but a larger value can sometimes help avoid jaggy artifacts.","default-value":4,"default-meaning":"Will auto-convert miters to bevel line joins when theta is less than 29 degrees as per the SVG spec: 'miterLength / stroke-width = 1 / sin ( theta / 2 )'"},clip:{css:"line-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"line-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},offset:{css:"line-offset",type:"float","default-value":0,"default-meaning":"no offset",doc:"Offsets a line a number of pixels parallel to its actual path. Postive values move the line left, negative values move it right (relative to the directionality of the line)."},rasterizer:{css:"line-rasterizer",type:["full","fast"],"default-value":"full",doc:"Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."},"geometry-transform":{css:"line-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"line-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},markers:{file:{css:"marker-file",doc:"An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.","default-value":"","default-meaning":"An ellipse or circle, if width equals height",type:"uri"},opacity:{css:"marker-opacity",doc:"The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke","default-value":1,"default-meaning":"The stroke-opacity and fill-opacity will be used",type:"float"},"fill-opacity":{css:"marker-fill-opacity",doc:"The fill opacity of the marker","default-value":1,"default-meaning":"opaque",type:"float"},stroke:{css:"marker-line-color",doc:"The color of the stroke around a marker shape.","default-value":"black",type:"color"},"stroke-width":{css:"marker-line-width",doc:"The width of the stroke around a marker shape, in pixels. This is positioned on the boundary, so high values can cover the area itself.",type:"float"},"stroke-opacity":{css:"marker-line-opacity","default-value":1,"default-meaning":"opaque",doc:"The opacity of a line",type:"float"},placement:{css:"marker-placement",type:["point","line","interior"],"default-value":"point","default-meaning":"Place markers at the center point (centroid) of the geometry",doc:"Attempt to place markers on a point, in the center of a polygon, or if markers-placement:line, then multiple times along a line. 'interior' placement can be used to ensure that points placed on polygons are forced to be inside the polygon interior"},"multi-policy":{css:"marker-multi-policy",type:["each","whole","largest"],"default-value":"each","default-meaning":"If a feature contains multiple geometries and the placement type is either point or interior then a marker will be rendered for each",doc:"A special setting to allow the user to control rendering behavior for 'multi-geometries' (when a feature contains multiple geometries). This setting does not apply to markers placed along lines. The 'each' policy is default and means all geometries will get a marker. The 'whole' policy means that the aggregate centroid between all geometries will be used. The 'largest' policy means that only the largest (by bounding box areas) feature will get a rendered marker (this is how text labeling behaves by default)."},"marker-type":{css:"marker-type",type:["arrow","ellipse"],"default-value":"ellipse",doc:"The default marker-type. If a SVG file is not given as the marker-file parameter, the renderer provides either an arrow or an ellipse (a circle if height is equal to width)"},width:{css:"marker-width","default-value":10,doc:"The width of the marker, if using one of the default types.",type:"expression"},height:{css:"marker-height","default-value":10,doc:"The height of the marker, if using one of the default types.",type:"expression"},fill:{css:"marker-fill","default-value":"blue",doc:"The color of the area of the marker.",type:"color"},"allow-overlap":{css:"marker-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping markers are shown or hidden.","default-meaning":"Do not allow makers to overlap with each other - overlapping markers will not be shown."},"ignore-placement":{css:"marker-ignore-placement",type:"boolean","default-value":!1,"default-meaning":"do not store the bbox of this geometry in the collision detector cache",doc:"value to control whether the placement of the feature will prevent the placement of other features"},spacing:{css:"marker-spacing",doc:"Space between repeated labels","default-value":100,type:"float"},"max-error":{css:"marker-max-error",type:"float","default-value":.2,doc:"The maximum difference between actual marker placement and the marker-spacing parameter. Setting a high value can allow the renderer to try to resolve placement conflicts with other symbolizers."},transform:{css:"marker-transform",type:"functions",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]],"default-value":"","default-meaning":"No transformation",doc:"SVG transformation definition"},clip:{css:"marker-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"marker-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"marker-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"marker-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},shield:{name:{css:"shield-name",type:"expression",serialization:"content",doc:'Value to use for a shield"s text label. Data columns are specified using brackets like [column_name]'},file:{css:"shield-file",required:!0,type:"uri","default-value":"none",doc:"Image file to render behind the shield text"},"face-name":{css:"shield-face-name",type:"string",validate:"font",doc:"Font name and style to use for the shield text","default-value":"",required:!0},"unlock-image":{css:"shield-unlock-image",type:"boolean",doc:"This parameter should be set to true if you are trying to position text beside rather than on top of the shield image","default-value":!1,"default-meaning":"text alignment relative to the shield image uses the center of the image as the anchor for text positioning."},size:{css:"shield-size",type:"float",doc:"The size of the shield text in pixels"},fill:{css:"shield-fill",type:"color",doc:"The color of the shield text"},placement:{css:"shield-placement",type:["point","line","vertex","interior"],"default-value":"point",doc:"How this shield should be placed. Point placement attempts to place it on top of points, line places along lines multiple times per feature, vertex places on the vertexes of polygons, and interior attempts to place inside of polygons."},"avoid-edges":{css:"shield-avoid-edges",doc:"Tell positioning algorithm to avoid labeling near intersection edges.",type:"boolean","default-value":!1},"allow-overlap":{css:"shield-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping shields are shown or hidden.","default-meaning":"Do not allow shields to overlap with other map elements already placed."},"minimum-distance":{css:"shield-min-distance",type:"float","default-value":0,doc:"Minimum distance to the next shield symbol, not necessarily the same shield."},spacing:{css:"shield-spacing",type:"float","default-value":0,doc:"The spacing between repeated occurrences of the same shield on a line"},"minimum-padding":{css:"shield-min-padding","default-value":0,doc:"Determines the minimum amount of padding that a shield gets relative to other shields",type:"float"},"wrap-width":{css:"shield-wrap-width",type:"unsigned","default-value":0,doc:"Length of a chunk of text in characters before wrapping text"},"wrap-before":{css:"shield-wrap-before",type:"boolean","default-value":!1,doc:"Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."},"wrap-character":{css:"shield-wrap-character",type:"string","default-value":" ",doc:"Use this character instead of a space to wrap long names."},"halo-fill":{css:"shield-halo-fill",type:"color","default-value":"#FFFFFF","default-meaning":"white",doc:"Specifies the color of the halo around the text."},"halo-radius":{css:"shield-halo-radius",doc:"Specify the radius of the halo in pixels","default-value":0,"default-meaning":"no halo",type:"float"},"character-spacing":{css:"shield-character-spacing",type:"unsigned","default-value":0,doc:"Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."},"line-spacing":{css:"shield-line-spacing",doc:"Vertical spacing between lines of multiline labels (in pixels)",type:"unsigned"},dx:{css:"shield-text-dx",type:"float",doc:"Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},dy:{css:"shield-text-dy",type:"float",doc:"Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},"shield-dx":{css:"shield-dx",type:"float",doc:"Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},"shield-dy":{css:"shield-dy",type:"float",doc:"Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},opacity:{css:"shield-opacity",type:"float",doc:"(Default 1.0) - opacity of the image used for the shield","default-value":1},"text-opacity":{css:"shield-text-opacity",type:"float",doc:"(Default 1.0) - opacity of the text placed on top of the shield","default-value":1},"horizontal-alignment":{css:"shield-horizontal-alignment",type:["left","middle","right","auto"],doc:"The shield's horizontal alignment from its centerpoint","default-value":"auto"},"vertical-alignment":{css:"shield-vertical-alignment",type:["top","middle","bottom","auto"],doc:"The shield's vertical alignment from its centerpoint","default-value":"middle"},"text-transform":{css:"shield-text-transform",type:["none","uppercase","lowercase","capitalize"],doc:"Transform the case of the characters","default-value":"none"},"justify-alignment":{css:"shield-justify-alignment",type:["left","center","right","auto"],doc:"Define how text in a shield's label is justified","default-value":"auto"},clip:{css:"shield-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},"comp-op":{css:"shield-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},"line-pattern":{file:{css:"line-pattern-file",type:"uri","default-value":"none",required:!0,doc:"An image file to be repeated and warped along a line"},clip:{css:"line-pattern-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"line-pattern-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"line-pattern-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"line-pattern-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},"polygon-pattern":{file:{css:"polygon-pattern-file",type:"uri","default-value":"none",required:!0,doc:"Image to use as a repeated pattern fill within a polygon"},alignment:{css:"polygon-pattern-alignment",type:["local","global"],"default-value":"local",doc:"Specify whether to align pattern fills to the layer or to the map."},gamma:{css:"polygon-pattern-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of polygon pattern edges"},opacity:{css:"polygon-pattern-opacity",type:"float",doc:"(Default 1.0) - Apply an opacity level to the image used for the pattern","default-value":1,"default-meaning":"The image is rendered without modifications"},clip:{css:"polygon-pattern-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"polygon-pattern-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"polygon-pattern-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"polygon-pattern-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},raster:{opacity:{css:"raster-opacity","default-value":1,"default-meaning":"opaque",type:"float",doc:"The opacity of the raster symbolizer on top of other symbolizers."},"filter-factor":{css:"raster-filter-factor","default-value":-1,"default-meaning":"Allow the datasource to choose appropriate downscaling.",type:"float",doc:"This is used by the Raster or Gdal datasources to pre-downscale images using overviews. Higher numbers can sometimes cause much better scaled image output, at the cost of speed."},scaling:{css:"raster-scaling",type:["near","fast","bilinear","bilinear8","bicubic","spline16","spline36","hanning","hamming","hermite","kaiser","quadric","catrom","gaussian","bessel","mitchell","sinc","lanczos","blackman"],"default-value":"near",doc:"The scaling algorithm used to making different resolution versions of this raster layer. Bilinear is a good compromise between speed and accuracy, while lanczos gives the highest quality."},"mesh-size":{css:"raster-mesh-size","default-value":16,"default-meaning":"Reprojection mesh will be 1/16 of the resolution of the source image",type:"unsigned",doc:"A reduced resolution mesh is used for raster reprojection, and the total image size is divided by the mesh-size to determine the quality of that mesh. Values for mesh-size larger than the default will result in faster reprojection but might lead to distortion."},"comp-op":{css:"raster-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},point:{file:{css:"point-file",type:"uri",required:!1,"default-value":"none",doc:"Image file to represent a point"},"allow-overlap":{css:"point-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping points are shown or hidden.","default-meaning":"Do not allow points to overlap with each other - overlapping markers will not be shown."},"ignore-placement":{css:"point-ignore-placement",type:"boolean","default-value":!1,"default-meaning":"do not store the bbox of this geometry in the collision detector cache",doc:"value to control whether the placement of the feature will prevent the placement of other features"},opacity:{css:"point-opacity",type:"float","default-value":1,"default-meaning":"Fully opaque",doc:"A value from 0 to 1 to control the opacity of the point"},placement:{css:"point-placement",type:["centroid","interior"],doc:"How this point should be placed. Centroid calculates the geometric center of a polygon, which can be outside of it, while interior always places inside of a polygon.","default-value":"centroid"},transform:{css:"point-transform",type:"functions",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]],"default-value":"","default-meaning":"No transformation",doc:"SVG transformation definition"},"comp-op":{css:"point-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},text:{name:{css:"text-name",type:"expression",required:!0,"default-value":"",serialization:"content",doc:"Value to use for a text label. Data columns are specified using brackets like [column_name]"},"face-name":{css:"text-face-name",type:"string",validate:"font",doc:"Font name and style to render a label in",required:!0},size:{css:"text-size",type:"float","default-value":10,doc:"Text size in pixels"},"text-ratio":{css:"text-ratio",doc:"Define the amount of text (of the total) present on successive lines when wrapping occurs","default-value":0,type:"unsigned"},"wrap-width":{css:"text-wrap-width",doc:"Length of a chunk of text in characters before wrapping text","default-value":0,type:"unsigned"},"wrap-before":{css:"text-wrap-before",type:"boolean","default-value":!1,doc:"Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."},"wrap-character":{css:"text-wrap-character",type:"string","default-value":" ",doc:"Use this character instead of a space to wrap long text."},spacing:{css:"text-spacing",type:"unsigned",doc:"Distance between repeated text labels on a line (aka. label-spacing)"},"character-spacing":{css:"text-character-spacing",type:"float","default-value":0,doc:"Horizontal spacing adjustment between characters in pixels"},"line-spacing":{css:"text-line-spacing","default-value":0,type:"unsigned",doc:"Vertical spacing adjustment between lines in pixels"},"label-position-tolerance":{css:"text-label-position-tolerance","default-value":0,type:"unsigned",doc:"Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"},"max-char-angle-delta":{css:"text-max-char-angle-delta",type:"float","default-value":"22.5",doc:"The maximum angle change, in degrees, allowed between adjacent characters in a label. This value internally is converted to radians to the default is 22.5*math.pi/180.0. The higher the value the fewer labels will be placed around around sharp corners."},fill:{css:"text-fill",doc:"Specifies the color for the text","default-value":"#000000",type:"color"},opacity:{css:"text-opacity",doc:"A number from 0 to 1 specifying the opacity for the text","default-value":1,"default-meaning":"Fully opaque",type:"float"},"halo-fill":{css:"text-halo-fill",type:"color","default-value":"#FFFFFF","default-meaning":"white",doc:"Specifies the color of the halo around the text."},"halo-radius":{css:"text-halo-radius",doc:"Specify the radius of the halo in pixels","default-value":0,"default-meaning":"no halo",type:"float"},dx:{css:"text-dx",type:"float",doc:"Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},dy:{css:"text-dy",type:"float",doc:"Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},"vertical-alignment":{css:"text-vertical-alignment",type:["top","middle","bottom","auto"],doc:"Position of label relative to point position.","default-value":"auto","default-meaning":'Default affected by value of dy; "bottom" for dy>0, "top" for dy<0.'},"avoid-edges":{css:"text-avoid-edges",doc:"Tell positioning algorithm to avoid labeling near intersection edges.","default-value":!1,type:"boolean"},"minimum-distance":{css:"text-min-distance",doc:"Minimum permitted distance to the next text symbolizer.",type:"float"},"minimum-padding":{css:"text-min-padding",doc:"Determines the minimum amount of padding that a text symbolizer gets relative to other text",type:"float"},"minimum-path-length":{css:"text-min-path-length",type:"float","default-value":0,"default-meaning":"place labels on all paths",doc:"Place labels only on paths longer than this value."},"allow-overlap":{css:"text-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping text is shown or hidden.","default-meaning":"Do not allow text to overlap with other text - overlapping markers will not be shown."},orientation:{css:"text-orientation",type:"expression",doc:"Rotate the text."},placement:{css:"text-placement",type:["point","line","vertex","interior"],"default-value":"point",doc:"Control the style of placement of a point versus the geometry it is attached to."},"placement-type":{css:"text-placement-type",doc:'Re-position and/or re-size text to avoid overlaps. "simple" for basic algorithm (using text-placements string,) "dummy" to turn this feature off.',type:["dummy","simple"],"default-value":"dummy"},placements:{css:"text-placements",type:"string","default-value":"",doc:'If "placement-type" is set to "simple", use this "POSITIONS,[SIZES]" string. An example is `text-placements: "E,NE,SE,W,NW,SW";` '},"text-transform":{css:"text-transform",type:["none","uppercase","lowercase","capitalize"],doc:"Transform the case of the characters","default-value":"none"},"horizontal-alignment":{css:"text-horizontal-alignment",type:["left","middle","right","auto"],doc:"The text's horizontal alignment from its centerpoint","default-value":"auto"},"justify-alignment":{css:"text-align",type:["left","right","center","auto"],doc:"Define how text is justified","default-value":"auto","default-meaning":"Auto alignment means that text will be centered by default except when using the `placement-type` parameter - in that case either right or left justification will be used automatically depending on where the text could be fit given the `text-placements` directives"},clip:{css:"text-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},"comp-op":{css:"text-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},building:{fill:{css:"building-fill","default-value":"#FFFFFF",doc:"The color of the buildings walls.",type:"color"},"fill-opacity":{css:"building-fill-opacity",type:"float",doc:"The opacity of the building as a whole, including all walls.","default-value":1},height:{css:"building-height",doc:"The height of the building in pixels.",type:"expression","default-value":"0"}}},colors:{aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50],transparent:[0,0,0,0]},filter:{value:["true","false","null","point","linestring","polygon","collection"]}};function Nlt(t){"@babel/helpers - typeof";return(Nlt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Llt(t,e){for(var r=0;r1&&(e=arguments[1]),arguments.length>2&&(r=arguments[2]),{is:"tag",val:t,color:e,mode:r,toString:function(n){return'\n\t"}}},hsl:function(t,e,r){return this.hsla(t,e,r,1)},hsla:function(t,e,r,n){if([t=this.number(t)%360/360,e=this.number(e),r=this.number(r),n=this.number(n)].some(isNaN))return null;var o=r<=.5?r*(e+1):r+e-r*e,i=2*r-o;return this.rgba(255*a(t+1/3),255*a(t),255*a(t-1/3),n);function a(t){return 6*(t=t<0?t+1:t>1?t-1:t)<1?i+(o-i)*t*6:2*t<1?o:3*t<2?i+(o-i)*(2/3-t)*6:i}},hue:function(t){return"toHSL"in t?new jlt.Tree.Dimension(Math.round(t.toHSL().h)):null},saturation:function(t){return"toHSL"in t?new jlt.Tree.Dimension(Math.round(100*t.toHSL().s),"%"):null},lightness:function(t){return"toHSL"in t?new jlt.Tree.Dimension(Math.round(100*t.toHSL().l),"%"):null},alpha:function(t){return"toHSL"in t?new jlt.Tree.Dimension(t.toHSL().a):null},saturate:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.s+=e.value/100,r.s=this.clamp(r.s),this.hsla_simple(r)},desaturate:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.s-=e.value/100,r.s=this.clamp(r.s),this.hsla_simple(r)},lighten:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.l+=e.value/100,r.l=this.clamp(r.l),this.hsla_simple(r)},darken:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.l-=e.value/100,r.l=this.clamp(r.l),this.hsla_simple(r)},fadein:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.a+=e.value/100,r.a=this.clamp(r.a),this.hsla_simple(r)},fadeout:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL();return r.a-=e.value/100,r.a=this.clamp(r.a),this.hsla_simple(r)},spin:function(t,e){if(!("toHSL"in t))return null;var r=t.toHSL(),n=(r.h+e.value)%360;return r.h=n<0?360+n:n,this.hsla_simple(r)},replace:function(t,e,r){return"field"===t.is?t.toString+".replace("+e.toString()+", "+r.toString()+")":t.replace(e,r)},mix:function(t,e,r){var n=r.value/100,o=2*n-1,i=t.toHSL().a-e.toHSL().a,a=((o*i==-1?o:(o+i)/(1+o*i))+1)/2,s=1-a,u=[t.rgb[0]*a+e.rgb[0]*s,t.rgb[1]*a+e.rgb[1]*s,t.rgb[2]*a+e.rgb[2]*s],l=t.alpha*n+e.alpha*(1-n);return new jlt.Tree.Color(u,l)},greyscale:function(t){return this.desaturate(t,new jlt.Tree.Dimension(100))},"%":function(t){for(var e=Array.prototype.slice.call(arguments,1),r=t.value,n=0;n.5?l/(2-a-s):l/(a+s),a){case r:t=(n-o)/l+(n=0){if(!t.ppi)return t.error({message:"ppi is not set, so metric units can't be used",index:this.index}),{is:"undefined",value:"undefined"};this.value=this.value/this.densities[this.unit]*t.ppi,this.unit="px"}return this}},{key:"toColor",value:function(){return new jlt.Tree.Color([this.value,this.value,this.value])}},{key:"round",value:function(){return this.value=Math.round(this.value),this}},{key:"toString",value:function(){return this.value.toString()}},{key:"operate",value:function(t,e,r){return"%"===this.unit&&"%"!==r.unit?(t.error({message:"If two operands differ, the first must not be %",index:this.index}),{is:"undefined",value:"undefined"}):"%"!==this.unit&&"%"===r.unit?"*"===e||"/"===e||"%"===e?(t.error({message:"Percent values can only be added or subtracted from other values",index:this.index}),{is:"undefined",value:"undefined"}):new jlt.Tree.Dimension(jlt.Tree.operate(e,this.value,this.value*r.value*.01),this.unit):new jlt.Tree.Dimension(jlt.Tree.operate(e,this.value,r.value),this.unit||r.unit)}}]),t}(),jlt.Tree.Element=function(){function t(e){Clt(this,t),this.value=e.trim(),"#"===this.value[0]&&(this.type="id",this.clean=this.value.replace(/^#/,"")),"."===this.value[0]&&(this.type="class",this.clean=this.value.replace(/^\./,"")),-1!==this.value.indexOf("*")&&(this.type="wildcard")}return Alt(t,[{key:"specificity",value:function(){return["id"===this.type?1:0,"class"===this.type?1:0]}},{key:"toString",value:function(){return this.value}}]),t}(),jlt.Tree.Expression=function(){function t(e){Clt(this,t),this.is="expression",this.value=e}return Alt(t,[{key:"ev",value:function(t){return this.value.length>1?new jlt.Tree.Expression(this.value.map(function(e){return e.ev(t)})):this.value[0].ev(t)}},{key:"toString",value:function(t){return this.value.map(function(e){return e.toString(t)}).join(" ")}}]),t}(),jlt.Tree.Field=function(){function t(e){Clt(this,t),this.is="field",this.value=e||""}return Alt(t,[{key:"toString",value:function(){return'["'+this.value.toUpperCase()+'"]'}},{key:"ev",value:function(){return this}}]),t}(),jlt.Tree.Filter=function(){function t(e,r,n,o,i){Clt(this,t),this.ops={"<":[" < ","numeric"],">":[" > ","numeric"],"=":[" = ","both"],"!=":[" != ","both"],"<=":[" <= ","numeric"],">=":[" >= ","numeric"],"=~":[".match(","string",")"]},this.key=e,this.op=r,this.val=n,this.index=o,this.filename=i,this.id=this.key+this.op+this.val}return Alt(t,[{key:"ev",value:function(t){return this.key=this.key.ev(t),this.val=this.val.ev(t),this}},{key:"toString",value:function(){return"["+this.id+"]"}}]),t}(),jlt.Tree.Filterset=function(){function t(){Clt(this,t),this.filters={}}return Alt(t,[{key:"toJS",value:function(t){function e(t){var e=t.op;"="===e&&(e="==");var r=t.val;void 0!==t._val&&(r=t._val.toString(!0)),t.key&&"scale"===t.key.value?r=+r:"string"!=typeof r&&"object"!==klt(r)||(r="'"+r+"'");var n="attributes";return n+"&&"+n+t.key+"&&"+n+t.key+" "+e+r}var r=[];for(var n in this.filters)r.push(e(this.filters[n]));return r.join(" && ")}},{key:"toString",value:function(){var t=[];for(var e in this.filters)t.push(this.filters[e].id);return t.sort().join("\t")}},{key:"ev",value:function(t){for(var e in this.filters)this.filters[e].ev(t);return this}},{key:"clone",value:function(){var t=new jlt.Tree.Filterset;for(var e in this.filters)t.filters[e]=this.filters[e];return t}},{key:"cloneWith",value:function(t){var e=[];for(var r in t.filters){var n=this.addable(t.filters[r]);if(!1===n)return!1;!0===n&&e.push(t.filters[r])}if(!e.length)return null;var o=new jlt.Tree.Filterset;for(r in this.filters)o.filters[r]=this.filters[r];for(;r=e.shift();)o.add(r);return o}},{key:"addable",value:function(t){var e=t.key.toString(),r=t.val.toString();switch(r.match(/^[0-9]+(\.[0-9]*)?_match/)&&(r=parseFloat(r)),t.op){case"=":return void 0!==this.filters[e+"="]?this.filters[e+"="].val.toString()==r&&null:void 0===this.filters[e+"!="+r]&&(!(void 0!==this.filters[e+">"]&&this.filters[e+">"].val>=r)&&(!(void 0!==this.filters[e+"<"]&&this.filters[e+"<"].val<=r)&&(!(void 0!==this.filters[e+">="]&&this.filters[e+">="].val>r)&&!(void 0!==this.filters[e+"<="]&&this.filters[e+"<="].val"]&&this.filters[e+">"].val>=r?null:void 0!==this.filters[e+"<"]&&this.filters[e+"<"].val<=r?null:void 0!==this.filters[e+">="]&&this.filters[e+">="].val>r?null:!(void 0!==this.filters[e+"<="]&&this.filters[e+"<="].val":return e+"="in this.filters?!(this.filters[e+"="].val<=r)&&null:!(void 0!==this.filters[e+"<"]&&this.filters[e+"<"].val<=r)&&(!(void 0!==this.filters[e+"<="]&&this.filters[e+"<="].val<=r)&&(void 0!==this.filters[e+">"]&&this.filters[e+">"].val>=r?null:!(void 0!==this.filters[e+">="]&&this.filters[e+">="].val>r)||null));case">=":return void 0!==this.filters[e+"="]?!(this.filters[e+"="].val"]&&this.filters[e+">"].val>=r?null:!(void 0!==this.filters[e+">="]&&this.filters[e+">="].val>=r)||null));case"<":return void 0!==this.filters[e+"="]?!(this.filters[e+"="].val>=r)&&null:!(void 0!==this.filters[e+">"]&&this.filters[e+">"].val>=r)&&(!(void 0!==this.filters[e+">="]&&this.filters[e+">="].val>=r)&&(void 0!==this.filters[e+"<"]&&this.filters[e+"<"].val<=r?null:!(void 0!==this.filters[e+"<="]&&this.filters[e+"<="].valr)&&null:!(void 0!==this.filters[e+">"]&&this.filters[e+">"].val>=r)&&(!(void 0!==this.filters[e+">="]&&this.filters[e+">="].val>r)&&(void 0!==this.filters[e+"<"]&&this.filters[e+"<"].val<=r?null:!(void 0!==this.filters[e+"<="]&&this.filters[e+"<="].val<=r)||null))}}},{key:"conflict",value:function(t){var e=t.key.toString(),r=t.val.toString();return isNaN(parseFloat(r))||(r=parseFloat(r)),("="===t.op&&void 0!==this.filters[e+"="]&&r!=this.filters[e+"="].val.toString()||"!="===t.op&&void 0!==this.filters[e+"="]&&r==this.filters[e+"="].val.toString()||"="===t.op&&void 0!==this.filters[e+"!="]&&r===this.filters[e+"!="].val.toString())&&t.toString()+" added to "+this.toString()+" produces an invalid filter"}},{key:"add",value:function(t,e){var r,n=t.key.toString(),o=t.op,i=this.conflict(t);if(i)return i;if("="===o){for(var a in this.filters)this.filters[a].key===n&&delete this.filters[a];this.filters[n+"="]=t}else if("!="===o)this.filters[n+"!="+t.val]=t;else if("=~"===o)this.filters[n+"=~"+t.val]=t;else if(">"===o){for(var s in this.filters)this.filters[s].key===n&&this.filters[s].val<=t.val&&delete this.filters[s];this.filters[n+">"]=t}else if(">="===o){for(var u in this.filters)r=+this.filters[u].val.toString(),this.filters[u].key===n&&r",this.filters[n+">"]=t):this.filters[n+">="]=t}else if("<"===o){for(var l in this.filters)r=+this.filters[l].val.toString(),this.filters[l].key===n&&r>=t.val&&delete this.filters[l];this.filters[n+"<"]=t}else if("<="===o){for(var c in this.filters)r=+this.filters[c].val.toString(),this.filters[c].key===n&&r>t.val&&delete this.filters[c];void 0!==this.filters[n+"!="+t.val]?(delete this.filters[n+"!="+t.val],t.op="<",this.filters[n+"<"]=t):this.filters[n+"<="]=t}}}]),t}(),jlt.Tree.Fontset=Alt(function t(e,r){Clt(this,t),this.fonts=r,this.name="fontset-"+e.effects.length}),jlt.Tree.Invalid=function(){function t(e,r,n){Clt(this,t),this.is="invalid",this.chunk=e,this.index=r,this.type="syntax",this.message=n||"Invalid code: "+this.chunk}return Alt(t,[{key:"ev",value:function(t){return t.error({chunk:this.chunk,index:this.index,type:"syntax",message:this.message||"Invalid code: "+this.chunk}),{is:"undefined"}}}]),t}(),jlt.Tree.Keyword=function(){function t(e){Clt(this,t),this.value=e;var r={transparent:"color",true:"boolean",false:"boolean"};this.is=r[e]?r[e]:"keyword"}return Alt(t,[{key:"ev",value:function(){return this}},{key:"toString",value:function(){return this.value}}]),t}(),jlt.Tree.Literal=function(){function t(e){Clt(this,t),this.value=e||"",this.is="field"}return Alt(t,[{key:"toString",value:function(){return this.value}},{key:"ev",value:function(){return this}}]),t}(),jlt.Tree.Operation=function(){function t(e,r,n){Clt(this,t),this.is="operation",this.op=e.trim(),this.operands=r,this.index=n}return Alt(t,[{key:"ev",value:function(t){var e,r=this.operands[0].ev(t),n=this.operands[1].ev(t);return"undefined"===r.is||"undefined"===n.is?{is:"undefined",value:"undefined"}:(r instanceof jlt.Tree.Dimension&&n instanceof jlt.Tree.Color&&("*"===this.op||"+"===this.op?(e=n,n=r,r=e):t.error({name:"OperationError",message:"Can't substract or divide a color from a number",index:this.index})),r instanceof jlt.Tree.Quoted&&n instanceof jlt.Tree.Quoted&&"+"!==this.op?(t.error({message:"Can't subtract, divide, or multiply strings.",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):r instanceof jlt.Tree.Field||n instanceof jlt.Tree.Field||r instanceof jlt.Tree.Literal||n instanceof jlt.Tree.Literal?"color"===r.is||"color"===n.is?(t.error({message:"Can't subtract, divide, or multiply colors in expressions.",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):new jlt.Tree.Literal(r.ev(t).toString(!0)+this.op+n.ev(t).toString(!0)):void 0===r.operate?(t.error({message:"Cannot do math with type "+r.is+".",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):r.operate(t,this.op,n))}}]),t}(),jlt.Tree.Quoted=function(){function t(e){Clt(this,t),this.is="string",this.value=e||""}return Alt(t,[{key:"toString",value:function(t){var e=this.value.replace(/&/g,"&"),r=e.replace(/\'/g,"\\'").replace(/\"/g,""").replace(//g,">");return!0===t?"'"+r+"'":e}},{key:"ev",value:function(){return this}},{key:"operate",value:function(t,e,r){return new jlt.Tree.Quoted(jlt.Tree.operate(e,this.toString(),r.toString(this.contains_field)))}}]),t}(),jlt.Tree.Reference={_validateValue:{font:function(t,e){return!t.validation_data||!t.validation_data.fonts||-1!=t.validation_data.fonts.indexOf(e)}},setData:function(t){this.data=t,this.selector_cache=function(t){var e={};for(var r in t.symbolizers)for(var n in t.symbolizers[r])t.symbolizers[r][n].hasOwnProperty("css")&&(e[t.symbolizers[r][n].css]=[t.symbolizers[r][n],r,n]);return e}(t),this.mapnikFunctions=function(t){var e={};for(var r in t.symbolizers)for(var n in t.symbolizers[r])if("functions"===t.symbolizers[r][n].type)for(var o=0;o1?Array.prototype.push.apply(r,n.find(new jlt.Tree.Selector(null,null,t.elements.slice(1)),e)):r.push(n);break}}),this._lookups[n]=r)}},{key:"evZooms",value:function(t){for(var e=0;ejlt.Tree.Zoom.maxZoom||e<0)&&t.error({message:"Only zoom levels between 0 and "+jlt.Tree.Zoom.maxZoom+" supported.",index:this.index}),this.op){case"=":return this.zoom="zoom && zoom === "+e,this;case">":this.zoom="zoom && zoom > "+e;break;case">=":this.zoom="zoom && zoom >= "+e;break;case"<":this.zoom="zoom && zoom < "+e;break;case"<=":this.zoom="zoom && zoom <= "+e}return this}},{key:"toString",value:function(){for(var t="",e=0;e<=jlt.Tree.Zoom.maxZoom;e++)t+=this.zoom&1<=l[2]||l[1]<=l[3])&&(this.DVBOrigonPoint=[l[0],l[3]],this.DVBWidth=Math.abs(l[2]-l[0]),this.DVBHeight=Math.abs(l[1]-l[3]),this.DVBCenterPoint=[this.DVBOrigonPoint[0]+this.DVBWidth/2,this.DVBOrigonPoint[1]+this.DVBHeight/2],this.origonPointOffset=[this.DVBOrigonPoint[0]-a[0],this.DVBOrigonPoint[1]-a[1]],!0)}},{key:"resetLocation",value:function(t){t&&(this.lonlat=t);var e=this.getLocalXY(this.lonlat);e[0]+=this.XOffset,e[1]+=this.YOffset,this.location=e;var r=this.width,n=this.height,o=this.location;return this.chartBounds=new Bt(o[0]-r/2,o[1]+n/2,o[0]+r/2,o[1]-n/2),this.resetLinearGradient(),o}},{key:"resetLinearGradient",value:function(){}},{key:"shapesConvertToRelativeCoordinate",value:function(){for(var t=this.shapes,e=this.location,r=0,n=t.length;r=0?n.push(parseFloat(o[a].toString()).toFixed(r)):n.push(parseFloat(o[a].toString()))}catch(t){throw new Error("not a number")}return n.length===e.length&&n};var $lt=function(t){function e(t,r,n,o,i){var a;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(a=Jlt(this,e,[t,r,n,o,i])).CLASS_NAME="SuperMap.Feature.Theme.Bar",a}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zlt(t,e)}(e,qlt),r=e,(n=[{key:"destroy",value:function(){Klt(Qlt(e.prototype),"destroy",this).call(this)}},{key:"assembleShapes",value:function(){var t={showShadow:!0,shadowBlur:8,shadowColor:"rgba(100,100,100,0.8)",shadowOffsetX:2,shadowOffsetY:2},e=this.setting;if(e.barLinearGradient||(e.barLinearGradient=[["#00FF00","#00CD00"],["#00CCFF","#5E87A2"],["#00FF66","#669985"],["#CCFF00","#94A25E"],["#FF9900","#A2945E"]]),e.dataViewBoxParameter||(void 0===e.useAxis||e.useAxis?e.dataViewBoxParameter=[45,15,15,15]:e.dataViewBoxParameter=[5,5,5,5]),this.initBaseParameter()){var r=this.DVBCodomain;this.DVBUnitValue=(r[1]-r[0])/this.DVBHeight;var n=this.dataViewBox,o=this.dataValues;if(!(o.length<1)){for(var i=0,a=o.length;ir[1])return;var s=this.calculateXShapeInfo();if(s){var u=s.xPositions,l=s.width;(void 0===e.useBackground||e.useBackground)&&this.shapes.push(tc.Background(this.shapeFactory,this.chartBox,e)),(void 0===e.useAxis||e.useAxis)&&(this.shapes=this.shapes.concat(tc.GraphAxis(this.shapeFactory,n,e,s)));for(var c=0;c=e.length&&(r%=e.length);var u=e[r][0],l=e[r][1],c=(new Go).getLinearGradient(a,0,s,0,[[0,u],[1,l]]);o.style.color=c}}}}])&&Ylt(r.prototype,n),o&&Ylt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function tct(t){"@babel/helpers - typeof";return(tct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ect(t,e){for(var r=0;re[1])return;var a=this.calculateXShapeInfo();if(a){var s=a.xPositions,u=a.width;(void 0===t.useBackground||t.useBackground)&&this.shapes.push(tc.Background(this.shapeFactory,this.chartBox,t)),(!t.axis3DParameter||isNaN(t.axis3DParameter)||t.axis3DParameter<15)&&(t.axis3DParameter=20),(void 0===t.useAxis||t.useAxis)&&(this.shapes=this.shapes.concat(tc.GraphAxis(this.shapeFactory,r,t,a)));for(var l=t.bar3DParameter&&!isNaN(t.bar3DParameter)?t.bar3DParameter:10,c=0;c=s[2]||s[1]<=s[3])&&(this.DVBOrigonPoint=[s[0],s[3]],this.DVBWidth=Math.abs(s[2]-s[0]),this.DVBHeight=Math.abs(s[1]-s[3]),this.DVBCenterPoint=[this.DVBOrigonPoint[0]+this.DVBWidth/2,this.DVBOrigonPoint[1]+this.DVBHeight/2],this.origonPointOffset=[this.DVBOrigonPoint[0]-o[0],this.DVBOrigonPoint[1]-o[1]],!0)}}])&&lct(r.prototype,n),o&&lct(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function vct(t){"@babel/helpers - typeof";return(vct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gct(t,e){for(var r=0;r0?this.DVBUnitValue=t.maxR/(o[1]-o[0]):this.DVBUnitValue=t.maxR;var i=this.DVBUnitValue,a=n[0]*i+t.minR;if(this.width=2*a,this.height=2*a,this.initBaseParameter()&&(!o||!(n[0]o[1]))){var s=this.DVBCenterPoint,u=new Xu(s[0],s[1],a);u.style=tc.ShapeStyleTool(null,t.circleStyle,null,null,0),void 0!==t.fillColor?u.style.fillColor=t.fillColor:u.style.fillColor="#ff9277",u.highlightStyle=tc.ShapeStyleTool(null,t.circleHoverStyle),void 0!==t.circleHoverAble&&(u.hoverable=t.circleHoverAble),void 0!==t.circleClickAble&&(u.clickable=t.circleClickAble),u.refDataID=this.data.id,u.dataInfo={field:this.fields[0],r:a,value:n[0]},this.shapes.push(this.shapeFactory.createShape(u)),this.shapesConvertToRelativeCoordinate()}}}])&&gct(r.prototype,n),o&&gct(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function Ect(t){"@babel/helpers - typeof";return(Ect="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Oct(t,e){for(var r=0;rr[1])return null;a=u[f],s=e[1]-(o[f]-r[0])/n;var p=new Ws(a,s);p.style=tc.ShapeStyleTool({fillColor:"#ee9900"},t.pointStyle,t.pointStyleByFields,t.pointStyleByCodomain,f,o[f]),p.highlightStyle=tc.ShapeStyleTool(null,t.pointHoverStyle),void 0!==t.pointHoverAble&&(p.hoverable=t.pointHoverAble),void 0!==t.pointClickAble&&(p.clickable=t.pointClickAble),p.refDataID=this.data.id,p.dataInfo={field:this.fields[f],value:o[f]},c.push(this.shapeFactory.createShape(p));var d=[a,s];l.push(d)}var y=new tu(l);y.style=tc.ShapeStyleTool({strokeColor:"#ee9900"},t.lineStyle),y.clickable=!1,y.hoverable=!1;var v=this.shapeFactory.createShape(y);this.shapes.push(v),this.shapes=this.shapes.concat(c),this.shapesConvertToRelativeCoordinate()}}}}},{key:"calculateXShapeInfo",value:function(){var t,e=this.dataViewBox,r=this.setting,n=this.dataValues.length;if(n<1)return null;var o=[],i=this.DVBWidth,a=0;if(r.xShapeBlank&&r.xShapeBlank.length&&2==r.xShapeBlank.length){var s=i-((t=r.xShapeBlank)[0]+t[1]);if(s<=n)return null;a=s/(n-1)}else t=[a=i/(n+1),a,a];for(var u=0,l=0;ln[1])return;for(var i=0,a=0;a=360&&(c=359.9999999);var y=new Eu(u[0],u[1],h,l,c);if(void 0===t.sectorStyleByFields){var v=p%e.length;y.style=tc.ShapeStyleTool(null,t.sectorStyle,e,null,v)}else y.style=tc.ShapeStyleTool(null,t.sectorStyle,t.sectorStyleByFields,t.sectorStyleByCodomain,p,r[p]);y.highlightStyle=tc.ShapeStyleTool(null,t.sectorHoverStyle),void 0!==t.sectorHoverAble&&(y.hoverable=t.sectorHoverAble),void 0!==t.sectorClickAble&&(y.clickable=t.sectorClickAble),y.refDataID=this.data.id,y.dataInfo={field:this.fields[p],value:r[p]},this.shapes.push(this.shapeFactory.createShape(y)),l=c}this.shapesConvertToRelativeCoordinate()}}}}])&&Ict(r.prototype,n),o&&Ict(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function Gct(t){"@babel/helpers - typeof";return(Gct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Uct(t,e){for(var r=0;rr[1])return null;a=u[l],s=e[1]-(o[l]-r[0])/n;var f=new Ws(a,s);f.style=tc.ShapeStyleTool({fillColor:"#ee9900"},t.pointStyle,t.pointStyleByFields,t.pointStyleByCodomain,l,o[l]),f.highlightStyle=tc.ShapeStyleTool(null,t.pointHoverStyle),void 0!==t.pointHoverAble&&(f.hoverable=t.pointHoverAble),void 0!==t.pointClickAble&&(f.clickable=t.pointClickAble),f.refDataID=this.data.id,f.dataInfo={field:this.fields[l],value:o[l]},this.shapes.push(this.shapeFactory.createShape(f))}this.shapesConvertToRelativeCoordinate()}}}},{key:"calculateXShapeInfo",value:function(){var t,e=this.dataViewBox,r=this.setting,n=this.dataValues.length;if(n<1)return null;var o=[],i=this.DVBWidth,a=0;if(r.xShapeBlank&&r.xShapeBlank.length&&2==r.xShapeBlank.length){var s=i-((t=r.xShapeBlank)[0]+t[1]);if(s<=n)return null;a=s/(n-1)}else t=[a=i/(n+1),a,a];for(var u=0,l=0;ln[1])return;for(var i=0,a=0;a=0&&e.innerRingRadius1&&void 0!==arguments[1]?arguments[1]:"warring";"success"===e?(this.icon.setAttribute("class","supermapol-icons-message-success"),this.messageBoxContainer.setAttribute("class","component-messageboxcontainer component-border-bottom-green")):"failure"===e?(this.icon.setAttribute("class","supermapol-icons-message-failure"),this.messageBoxContainer.setAttribute("class","component-messageboxcontainer component-border-bottom-red")):"warring"===e&&(this.icon.setAttribute("class","supermapol-icons-message-warning"),this.messageBoxContainer.setAttribute("class","component-messageboxcontainer component-border-bottom-orange")),this.messageBox.innerHTML=t,this.messageBoxContainer.hidden=!1}}])&&sft(e.prototype,r),n&&sft(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),cft=function(){try{return echarts}catch(t){return{}}}(),fft={"en-US":{title_dataFlowService:"Data Flow Service",title_distributedAnalysis:"Distributed Analysis",title_clientComputing:"Client Computing",title_dataServiceQuery:"Data Service Query",title_searchCity:"Search city",title_searchLayer:" Search layer",text_input_value_inputDataFlowUrl:"Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe",text_displayFeaturesInfo:"Display feature information",text_subscribe:"subscribe",text_cancelSubscribe:"unsubscribe",text_densityAnalysis:"Density Analysis",text_CalculateTheValuePerUnitArea:"Calculate the value per unit area within the neighborhood shape",text_option_selectDataset:"Please select a dataset",text_label_dataset:"Dataset",text_option_simplePointDensityAnalysis:"Simple point density analysis",text_option_nuclearDensityAnalysis:"Nuclear density analysis",text_label_analyticalMethod:"Analytical method",text_option_quadrilateral:"Quadrilateral",text_option_hexagon:"hexagon",text_label_meshType:"Mesh type",text_option_notSet:"Not set",text_label_weightField:"Weight field",text_label_gridSizeInMeters:"Grid size",text_label_searchRadius:"Search radius",text_label_queryRange:"Scope of analysis",text_label_areaUnit:"Area unit",text_option_equidistantSegmentation:"Equidistant segmentation",text_option_logarithm:"Logarithm",text_option_equalCountingSegment:"Equal counting segment",text_option_squareRootSegmentation:"Square root segmentation",text_label_thematicMapSegmentationMode:"Thematic map segmentation mode",text_label_thematicMapSegmentationParameters:"Thematic map segmentation parameters",text_option_greenOrangePurpleGradient:"Green orange purple gradient",text_option_greenOrangeRedGradient:"Green orange red gradient",text_option_rainbowGradient:"Rainbow gradient",text_option_spectralGradient:"Spectral gradient",text_option_terrainGradient:"Terrain gradient",text_label_thematicMapColorGradientMode:"Thematic map color gradient mode",text_label_resultLayerName:"Result layer name",text_chooseFile:"Open File",text_isoline:"Isoline",text_extractDiscreteValue:"Extract discrete value generation curve",text_buffer:"Buffer",text_specifyTheDistance:"Specify the distance to create the surrounding area",text_label_analysisLayer:"Analysis layer",text_label_extractField:"Extract field",text_label_extractedValue:"Extracted value",text_label_distanceAttenuation:"Distance attenuation",text_label_gridSize:"gridSize",text_label_bufferRadius:"Buffer radius",text_label_defaultkilometers:"Default 10 kilometers",text_label_kilometer:"kilometer",text_label_unit:"unit",text_retainOriginal:"Retain original object field",text_mergeBuffer:"Merge buffer",text_label_color:"Color",text_label_buffer:"[Buffer]",text_label_isolines:"[Isolines]",text_label_queryRangeTips:"The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850",text_label_queryModel:"Query mode",text_label_IDArrayOfFeatures:"ID array of features",text_label_maxFeatures:"The maximum number of features that can be returned",text_label_bufferDistance:"Buffer distance",text_label_queryRange1:"Query range",text_label_spatialQueryMode:"Spatial query mode",text_label_featureFilter:"Feature filter",text_label_geometricObject:"Geometric object",text_label_queryMode:"Query mode",text_label_searchTips:"Search for city locations or layer features",text_label_chooseSearchLayers:"Select a query layer",text_loadSearchCriteria:"Load search criteria",text_saveSearchCriteria:"Save search criteria",btn_analyze:"Analyze",btn_analyzing:"Analyzing",btn_emptyTheAnalysisLayer:"Empty the analysis layer",btn_cancelAnalysis:"Cancel",btn_query:"Query",btn_querying:"Querying",btn_emptyTheRresultLayer:"Clear all result layers","msg_dataReturnedIsEmpty.":"The request is successful and the data returned by the query is empty.",msg_dataFlowServiceHasBeenSubscribed:"The data stream service has been subscribed to.",msg_inputDataFlowUrlFirst:"Please enter the data stream service address first.",msg_datasetOrMethodUnsupport:"This dataset does not support this analysis type. Please reselect the dataset.",msg_selectDataset:"Please select a data set!",msg_setTheWeightField:"Please set the weight field!",msg_theFieldNotSupportAnalysis:"The field you currently select does not support analysis!",msg_resultIsEmpty:"The result of the analysis is empty!",msg_openFileFail:"Failed to open file!",msg_fileTypeUnsupported:"File format is not supported!",msg_fileSizeExceeded:"File size exceeded! The file size should not exceed 10M!",msg_dataInWrongGeoJSONFormat:"Wrong data format! Non standard GEOJSON format data!",msg_dataInWrongFormat:"Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!",msg_searchKeywords:"Search keywords cannot be empty. Please enter your search criteria.",msg_searchGeocodeField:"Did not match the address matching service data!",msg_cityGeocodeField:"The address matching service of the current city is not configured.",msg_getFeatureField:"No related vector features found!",msg_dataflowservicesubscribed:"The data stream service has been subscribed to.",msg_subscribesucceeded:"The data stream service subscription was successful.",msg_crsunsupport:"Does not support the coordinate system of the current map",msg_tilematrixsetunsupport:"Incoming TileMatrixSet is not supported",msg_jsonResolveFiled:"JSON format parsing failure!",msg_requestContentFiled:"Failed to request data through iportal!",msg_getdatafailed:"Failed to get data!"},"zh-CN":{title_dataFlowService:"数据流服务",title_distributedAnalysis:"分布式分析",title_clientComputing:"客户端计算",title_dataServiceQuery:"数据服务查询",title_searchCity:"搜索城市",title_searchLayer:"搜索图层",text_input_value_inputDataFlowUrl:"请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe",text_displayFeaturesInfo:"显示要素信息",text_subscribe:"订阅",text_cancelSubscribe:"取消订阅",text_densityAnalysis:"密度分析",text_CalculateTheValuePerUnitArea:"计算点指定邻域形状内的每单位面积量值",text_option_selectDataset:"请选择数据集",text_label_dataset:"数据集",text_option_simplePointDensityAnalysis:"简单点密度分析",text_option_nuclearDensityAnalysis:"核密度分析",text_label_analyticalMethod:"分析方法",text_option_quadrilateral:"四边形",text_option_hexagon:"六边形",text_label_meshType:"网格面类型",text_option_notSet:"未设置",text_label_weightField:"权重字段",text_label_gridSizeInMeters:"网格大小",text_label_searchRadius:"搜索半径",text_label_queryRange:"分析范围",text_label_areaUnit:"面积单位",text_option_equidistantSegmentation:"等距离分段",text_option_logarithm:"对数",text_option_equalCountingSegment:"等计数分段",text_option_squareRootSegmentation:"平方根分段",text_label_thematicMapSegmentationMode:"专题图分段模式",text_label_thematicMapSegmentationParameters:"专题图分段参数",text_option_greenOrangePurpleGradient:"绿橙紫渐变",text_option_greenOrangeRedGradient:"绿橙红渐变",text_option_rainbowGradient:"彩虹渐变",text_option_spectralGradient:"光谱渐变",text_option_terrainGradient:"地形渐变",text_label_thematicMapColorGradientMode:"专题图颜色渐变模式",text_label_resultLayerName:"结果图层名称",text_chooseFile:"选择文件",text_isoline:"等值线",text_extractDiscreteValue:"提取离散值生成曲线",text_buffer:"缓冲区",text_specifyTheDistance:"指定距离创建周边区域",text_label_analysisLayer:"分析图层",text_label_extractField:"提取字段",text_label_extractedValue:"提取值",text_label_distanceAttenuation:"距离衰减",text_label_gridSize:"栅格大小",text_label_bufferRadius:"缓冲半径",text_label_defaultkilometers:"默认10千米",text_option_kilometer:"千米",text_label_unit:"单位",text_retainOriginal:"保留原对象字段属性",text_mergeBuffer:"合并缓冲区",text_label_color:"颜色",text_label_buffer:"[缓冲区]",text_label_isolines:"[等值线]",text_label_queryRangeTips:"默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850",text_label_IDArrayOfFeatures:"要素 ID 数组",text_label_maxFeatures:"最多可返回的要素数量",text_label_bufferDistance:"缓冲区距离",text_label_queryRange1:"查询范围",text_label_spatialQueryMode:"空间查询模式",text_label_featureFilter:"要素过滤器",text_label_geometricObject:"几何对象",text_label_queryMode:"查询模式",text_label_searchTips:"搜索城市地点或图层要素",text_label_chooseSearchLayers:"选择查询图层",text_loadSearchCriteria:"加载搜索条件",text_saveSearchCriteria:"保存搜索条件",btn_analyze:"分析",btn_analyzing:"分析中",btn_emptyTheAnalysisLayer:"清空分析图层",btn_cancelAnalysis:"取消",btn_query:"查询",btn_querying:"查询中",btn_emptyTheRresultLayer:"清除所有结果图层",msg_dataFlowServiceHasBeenSubscribed:"已订阅该数据流服务。",msg_inputDataFlowUrlFirst:"请先输入数据流服务地址。",msg_datasetOrMethodUnsupport:"该数据集不支持本分析类型,请重新选择数据集",msg_selectDataset:"请选择数据集!",msg_setTheWeightField:"请设置权重字段!",msg_theFieldNotSupportAnalysis:"您当前选择的字段不支持分析!",msg_resultIsEmpty:"分析的结果为空!",msg_dataReturnedIsEmpty:"请求成功,查询返回的数据为空。",msg_openFileFail:"打开文件失败!",msg_fileTypeUnsupported:"不支持该文件格式!",msg_fileSizeExceeded:"文件大小超限!文件大小不得超过 10M!",msg_dataInWrongGeoJSONFormat:"数据格式错误!非标准的 GEOJSON 格式数据!",msg_dataInWrongFormat:"数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!",msg_searchKeywords:"搜索关键字不能为空,请输入搜索条件。",msg_searchGeocodeField:"未匹配到地址匹配服务数据!",msg_cityGeocodeField:"未配置当前城市的地址匹配服务。",msg_getFeatureField:"未查找到相关矢量要素!",msg_dataflowservicesubscribed:"已订阅该数据流服务。",msg_subscribesucceeded:"数据流服务订阅成功。",msg_crsunsupport:"不支持当前地图的坐标系",msg_tilematrixsetunsupport:"不支持传入的TileMatrixSet",msg_jsonResolveFiled:"json格式解析失败!",msg_requestContentFiled:"通过iportal请求数据失败!",msg_getdatafailed:"获取数据失败!"},code:null,defaultCode:"en-US",getCode:function(){return fft.code||fft.setCode(),fft.code},setCode:function(){var t=this.getLanguageFromCookie();t||(t=fft.defaultCode,t="Netscape"===navigator.appName?navigator.language:navigator.browserLanguage),0===t.indexOf("zh")&&(t="zh-CN"),0===t.indexOf("en")&&(t="en-US"),fft.code=t},getLanguageFromCookie:function(){for(var t=document.cookie.split(";"),e=0;e0){var a=i.SheetNames[0],s=hft.utils.sheet_to_csv(i.Sheets[a]);e&&e.call(n,s)}}catch(t){r&&r.call(n,t)}},o.onerror=function(t){r&&r.call(n,t)},this.rABF&&o.readAsArrayBuffer(t.file)},processDataToGeoJson:function(t,e,r,n,o){var i=null;if("EXCEL"===t||"CSV"===t)i=this.processExcelDataToGeoJson(e),r&&r.call(o,i);else if("JSON"===t||"GEOJSON"===t){var a=e;"string"==typeof a&&(a=JSON.parse(a)),"ISERVER"===a.type?i=a.data.recordsets[0].features:"FeatureCollection"===a.type?i=a:n&&n.call(o,fft.i18n("msg_dataInWrongGeoJSONFormat")),r&&r.call(o,i)}else n&&n.call(o,fft.i18n("msg_dataInWrongFormat"))},processExcelDataToGeoJson:function(t){for(var e=this.string2Csv(t),r=e.colTitles,n=-1,o=-1,i=0,a=r.length;i0?(n.dataItemServices.forEach(function(n){if("RESTDATA"===n.serviceType&&"PUBLISHED"===n.serviceStatus)o=n;else{if("RESTMAP"!==n.serviceType||"PUBLISHED"!==n.serviceStatus)return void r.getDatafromContent(t,e);o=n}}),o&&r.getDatafromRest(o.serviceType,o.address,e)):r.getDatafromContent(t,e):r._fireFailedEvent(n)}).catch(function(t){console.log(t),r._fireFailedEvent(t)})}},{key:"getDatafromContent",value:function(t,e){var r=this,n={result:{}},o=this;t+="/content.json?pageSize=9999999¤tPage=1",tt.get(t,null,{withCredentials:this.datasets.withCredentials}).then(function(t){return t.json()}).then(function(t){if(!1!==t.succeed){if(t.type){if("JSON"===t.type||"GEOJSON"===t.type){if(t.content=JSON.parse(t.content.trim()),!t.content.features)return void console.log(fft.i18n("msg_jsonResolveFiled"));var i=r._formatGeoJSON(t.content);n.result.features={type:t.content.type,features:i}}else if("EXCEL"===t.type||"CSV"===t.type){var a=r._excelData2Feature(t.content);n.result.features={type:"FeatureCollection",features:a}}e(n,"content")}}else o._fireFailedEvent(t)},this).catch(function(t){console.log(t),o._fireFailedEvent(t)})}},{key:"getDatafromRest",value:function(t,e,r){var n=this,o=this.datasets.withCredentials;if("RESTDATA"===t){var i,a,s="".concat(e,"/data/datasources");tt.get(s,null,{withCredentials:o}).then(function(t){return t.json()}).then(function(t){i=t.datasourceNames[0],s="".concat(e,"/data/datasources/").concat(i,"/datasets"),tt.get(s,null,{withCredentials:o}).then(function(t){return t.json()}).then(function(t){return a=t.datasetNames[0],n.getDatafromRestData("".concat(e,"/data"),[i+":"+a],r),[i+":"+a]}).catch(function(t){n._fireFailedEvent(t)})}).catch(function(t){n._fireFailedEvent(t)})}else{var u,l,c,f="".concat(e,"/maps");tt.get(f,null,{withCredentials:o}).then(function(t){return t.json()}).then(function(t){u=t[0].name,c=t[0].path,f=f="".concat(e,"/maps/").concat(u,"/layers"),tt.get(f,null,{withCredentials:o}).then(function(t){return t.json()}).then(function(t){return l=t[0].subLayers.layers[0].caption,n.getDatafromRestMap(l,c,r),l}).catch(function(t){n._fireFailedEvent(t)})}).catch(function(t){n._fireFailedEvent(t)})}}},{key:"getDatafromRestData",value:function(t,e,r){var n=this;this.datasets.queryInfo.attributeFilter=this.datasets.queryInfo.attributeFilter||"SmID>0",this._getFeatureBySQL(t,e,this.datasets.queryInfo,function(t){r(t,"RESTDATA")},function(t){console.log(t),n._fireFailedEvent(t)})}},{key:"getDatafromRestMap",value:function(t,e,r){var n=this;this.datasets.queryInfo.attributeFilter=this.datasets.queryInfo.attributeFilter||"smid=1",this._queryFeatureBySQL(e,t,this.datasets.queryInfo,null,null,function(t){r(t,"RESTMAP")},function(t){console.log(t),n._fireFailedEvent(t)})}},{key:"_getFeatureBySQL",value:function(t,e,r,n,o){var i,a,s={name:e.join().replace(":","@")};Object.assign(s,r),i=new wB(s),a=new KB({queryParameter:i,datasetNames:e,fromIndex:0,toIndex:1e5,returnContent:!0}),new oF(t).processAsync(a,function(t){"processCompleted"===t.type?n&&n(t):o&&o(t)})}},{key:"_queryFeatureBySQL",value:function(t,e,r,n,o,i,a,s,u,l){var c,f,h={name:e};Object.assign(h,r),c=new wB(h),n&&(c.fields=n);var p={queryParams:[c]};l&&(p.queryOption=Zr.ATTRIBUTE),s&&(p.startRecord=s),u&&(p.expectCount=u),o&&(p.prjCoordSys={epsgCode:o}),f=new $1(p),this._queryBySQL(t,f,function(t){"processCompleted"===t.type?i(t):a(t)})}},{key:"_queryBySQL",value:function(t,e,r,n){new s2(t,{format:this._processFormat(n)}).processAsync(e,r)}},{key:"_processFormat",value:function(t){return t||Jr.GEOJSON}},{key:"_formatGeoJSON",value:function(t){var e=t.features;return e.forEach(function(t,e){t.properties.index=e}),e}},{key:"_excelData2Feature",value:function(t){for(var e=t.colTitles,r=-1,n=-1,o=0,i=e.length;o=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function wft(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&t.forEach(function(t){t.xAxis&&e.xField.push({field:t.xAxis.field,name:t.xAxis.name}),t.yAxis&&e.yField.push({field:t.yAxis.field,name:t.yAxis.name})})}},{key:"getDatasetInfo",value:function(t){var e=this;this.createChart=t,this.datasets&&this._checkUrl(this.datasets.url)&&(this.chartModel=new gft(this.datasets),"iServer"===this.datasets.type?this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this)):"iPortal"===this.datasets.type&&this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this)),this.chartModel.events.on({getdatafailed:function(t){e.events.triggerEvent("getdatafailed",t)}}))}},{key:"_getDatasetInfoSuccess",value:function(t){var e=this.datasets.url,r=e.indexOf("rest");if(r>0){var n=e.indexOf("/",r+5),o=e.substring(r+5,n),i=e.substring(0,r+4)+"/data";if("maps"===o){var a=e.indexOf("/",n+1),s=e.substring(n+1,a);i=e.substring(0,r+4)+"/maps/"+s,t.result.dataUrl=i,this._getLayerFeatures(t)}else"data"===o&&(t.result.dataUrl=i,this._getDataFeatures(t))}}},{key:"_getDataInfoSuccess",value:function(t,e){"RESTMAP"===e?this._getChartDatasFromLayer(t):this._getChartDatas(t)}},{key:"_getDataFeatures",value:function(t){this.chartModel.getDataFeatures(t,this._getChartDatas.bind(this))}},{key:"_getLayerFeatures",value:function(t){this.chartModel.getLayerFeatures(t,this._getChartDatasFromLayer.bind(this))}},{key:"_getChartDatas",value:function(t){if(t){this.features=t.result.features;var e=this.features.features,r={};if(e.length){var n=e[0],o=[],i=[];for(var a in n.properties)o.push(a),i.push(this._getDataType(n.properties[a]));for(var s in r={features:e,fieldCaptions:o,fieldTypes:i,fieldValues:[]},i){var u=[];for(var l in e){var c=e[l],f=r.fieldCaptions[s],h=c.properties[f];u.push(h)}r.fieldValues.push(u)}this.createChart(r)}}}},{key:"_getChartDatasFromLayer",value:function(t){if(t.result.recordsets){var e=t.result.recordsets[0],r=e.features.features;this.features=e.features;var n={};if(r.length){for(var o in(n={features:e.features,fieldCaptions:e.fieldCaptions,fieldTypes:e.fieldTypes,fieldValues:[]}).fieldCaptions){var i=[];for(var a in r){var s=r[a],u=n.fieldCaptions[o],l=s.properties[u];i.push(l)}n.fieldValues.push(i)}this.createChart(n)}}}},{key:"_createChartOptions",value:function(t){return this.calculatedData=this._createChartDatas(t),this.updateChartOptions(this.chartType)}},{key:"changeType",value:function(t){if(t!==this.chartType)return this.chartType=t,this.updateChartOptions(this.chartType)}},{key:"updateData",value:function(t,e,r){this.updateChart=r,this.xField=[],this.yField=[],this._initXYField(e),t.type=t.type||"iServer",t.withCredentials=t.withCredentials||!1,this.datasets=t,this.getDatasetInfo(this._updateDataSuccess.bind(this))}},{key:"_updateDataSuccess",value:function(t){var e=this._createChartOptions(t);this.updateChart(e)}},{key:"updateChartOptions",value:function(t,e){if(this.calculatedData){var r=this.grid,n=this._createChartSeries(this.calculatedData,t),o=[];for(var i in this.calculatedData.XData)o.push({value:this.calculatedData.XData[i].fieldsData});var a={type:"category",name:this.xField[0].name||"X",data:o,nameTextStyle:{color:"#fff",fontSize:14},splitLine:{show:!1},axisLine:{lineStyle:{color:"#eee"}}},s={type:"value",name:this.yFieldName||"Y",data:{},nameTextStyle:{color:"#fff",fontSize:14},splitLine:{show:!1},axisLine:{lineStyle:{color:"#eee"}}},u={formatter:"{b0}: {c0}"},l="#404a59";return e&&(e.grid&&(r=e.grid),e.tooltip&&(u=e.tooltip),e.backgroundColor&&(l=e.backgroundColor)),{backgroundColor:l,grid:r,series:n,xAxis:a,yAxis:s,tooltip:u}}}},{key:"_createChartDatas",value:function(t){var e=0,r=[],n=t.fieldCaptions,o=this;n.forEach(function(t,r){o.xField[0]&&t===o.xField[0].field&&(e=r)}),this.yFieldName="",this.yField.forEach(function(t,e){0!==e&&(o.yFieldName=o.yFieldName+","),o.yFieldName=o.yFieldName+t.name,n.forEach(function(e,n){e===t.field&&r.push(n)})});var i=this._getAttrData(t,e),a=[];if(r.length>0)r.forEach(function(e){var r=[];for(var n in t.fieldValues[e])r.push({value:t.fieldValues[e][n]});a.push(r)});else{for(var s=[],u=[],l=i.length,c=0;c0;t--)this.header.removeChild(this.header.children[t]),this.content.removeChild(this.content.children[t])}},{key:"_changeTabsPage",value:function(t){for(var e=t.target.index,r=0;r0;e--)this.content.removeChild(this.content.children[e-1]);var r=this.config[t];for(var n in r)this._createCityItem(n,r[n])}},{key:"_createCityItem",value:function(t,e){var r=document.createElement("div"),n=document.createElement("div");n.setAttribute("class","component-citytabpag__py-key"),n.innerHTML=t,r.appendChild(n);var o=document.createElement("div");o.setAttribute("class","component-citytabpag__content");for(var i=0;i0&&this.appendTabs(t),this.rootContainer=e}},{key:"setTabs",value:function(t){this.removeAllTabs(),this.appendTabs(t)}},{key:"appendTabs",value:function(t){for(var e=0;e0;t--)this.navTabsTitle.removeChild(this.navTabsTitle.children[t]),this.navTabsContent.removeChild(this.navTabsContent.children[t])}},{key:"_changeTabsPage",value:function(t){for(var e=t.target.index,r=0;r=0;t--)this.content.removeChild(this.content.children[t])}},{key:"setPageLink",value:function(t){this.pageNumberLis=[],this.currentPageNumberLis=[],this.clearPageLink(),this._createPageLi(t),this._appendPageLink()}},{key:"_createPageLi",value:function(t){for(var e=0;e1;t--)this.link.removeChild(this.link.children[t])}},{key:"_createLink",value:function(t){for(var e=0;e<4;e++){var r=document.createElement("li");r.setAttribute("class","disable");var n=document.createElement("span");r.appendChild(n),0===e?(n.id="first",n.setAttribute("class","supermapol-icons-first")):1===e?(n.id="prev",n.setAttribute("class","supermapol-icons-prev")):2===e?(n.id="next",n.setAttribute("class","supermapol-icons-next")):3===e&&(n.id="last",n.setAttribute("class","supermapol-icons-last")),t.appendChild(r)}}},{key:"_changePageEvent",value:function(t){var e=t.target;if("disable"!==e.parentElement.classList[0]){var r;if(e.id)r=e.id;else{if(!Number(e.innerHTML))return;r=Number(e.innerHTML)}this._prePageNum(r),this.clearPageLink(),this._appendPageLink()}}},{key:"_changeDisableState",value:function(){this.link.children[0].setAttribute("class",""),this.link.children[1].setAttribute("class",""),this.link.children[this.link.children.length-1].setAttribute("class",""),this.link.children[this.link.children.length-2].setAttribute("class",""),1===this.currentPage&&(this.link.children[0].setAttribute("class","disable"),this.link.children[1].setAttribute("class","disable")),this.currentPage===this.pageNumberLis.length&&(this.link.children[this.link.children.length-1].setAttribute("class","disable"),this.link.children[this.link.children.length-2].setAttribute("class","disable"))}},{key:"_prePageNum",value:function(t){var e=[];if(this.currentPage="first"===t?1:"last"===t?this.pageNumberLis.length:"prev"===t?this.currentPage-1:"next"===t?this.currentPage+1:t,this.pageNumberLis.length<=5)for(var r=0;r=this.pageNumberLis.length-3)for(var o=this.pageNumberLis.length-5;o0&&(this.currentPageNumberLis=e)}}])&&Lht(r.prototype,n),o&&Lht(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function Uht(t){"@babel/helpers - typeof";return(Uht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zht(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function Vht(t){for(var e=1;e|<|=|!/g," ").split(" ").filter(function(t){return t}).forEach(function(t){var n=e.find(function(e){return e===t});if(Xht(t)&&n&&(r=r.replace(n,"$"+n)),n){var o=qht(n);r=r.replace(n,o)}}),r}function Yht(t){var e={};for(var r in t){var n=r;Xht(r)&&(n="$"+r),e[n=qht(n)]=t[r]}return e}function Xht(t){return/^\d/.test(t)}urt.Lang=fft,urt.i18n=urt.Lang.i18n,urt.Util=Vht(Vht({},urt.Util),q),urt.Browser=z,urt.INCHES_PER_UNIT=W,urt.METERS_PER_INCH=Y,urt.DOTS_PER_INCH=96,urt.IS_GECKO=H,urt.setCORS=function(t){X=t},urt.isCORS=Z,urt.setRequestTimeout=function(t){return J=t},urt.getRequestTimeout=$,urt.FetchRequest=tt,urt.EncryptRequest=pt,urt.getServiceKey=dt,urt.inherit=function(t,e){var r,n,o,i=function(){};for(i.prototype=e.prototype,t.prototype=new i,r=2,n=arguments.length;r2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=ept(this,e)).mapId=t,n.server=r.server,n.withCredentials=r.withCredentials,n.target=r.target,n.mapOptions=o,n._canvgsV=[],n}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&npt(t,e)}(e,w().Evented),r=e,(n=[{key:"initializeMap",value:function(t){var e=this;this.baseProjection=t.projection,this.mapParams={title:t.title,description:t.description},this._createMap(t);var r=t.layers;this.map.on("load",function(){e._addBaseMap(t),r&&0!==r.length?e._addLayers(r):e._sendMapToUser(0,0)}),this.map.on("remove",function(){e._stopCanvg()})}},{key:"_createMap",value:function(t){var e=[],r=t.layers;r&&r.length>0&&r.forEach(function(t){t.labelStyle&&e.push(t.labelStyle.fontFamily)},this),e.push("supermapol-icons");var n,o=e.join(","),i=t.center,a=t.level||0,s=0;if(t.minScale&&t.maxScale)s=this._transformScaleToZoom(t.minScale,w().CRS?w().CRS.get(this.baseProjection):"EPSG:3857");else{var u=this._getResolution(w().CRS?w().CRS.get(this.baseProjection).getExtent():[-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892])/this._getResolution(t.extent);s=+Math.log(u)/Math.LN2.toFixed(2)}a+=s,n=i?$n.unproject([i.x,i.y]):new(w().LngLat)(0,0),this.map=new(w().Map)({container:this.target,center:this.mapOptions.center||n,zoom:this.mapOptions.zoom||a,bearing:this.mapOptions.bearing||0,pitch:this.mapOptions.pitch||0,style:{version:8,sources:{},layers:[]},crs:this.baseProjection,localIdeographFontFamily:o||""}),this.fire("mapinitialized")}},{key:"_addBaseMap",value:function(t){this._createBaseLayer(t)}},{key:"_createBaseLayer",value:function(t){var e=t.baseLayer||t,r=e.layerType;(r.indexOf("TIANDITU_VEC")>-1||r.indexOf("TIANDITU_IMG")>-1||r.indexOf("TIANDITU_TER")>-1)&&(r=r.substr(0,12));var n;switch(r){case"TIANDITU_VEC":case"TIANDITU_IMG":case"TIANDITU_TER":this._createTiandituLayer(t);break;case"BING":this._createBingLayer(e.name);break;case"WMS":this._createWMSLayer(e);break;case"WMTS":this._createWMTSLayer(e);break;case"TILE":case"SUPERMAP_REST":this._createDynamicTiledLayer(e);break;case"CLOUD":case"CLOUD_BLACK":case"OSM":case"JAPAN_ORT":case"JAPAN_RELIEF":case"JAPAN_PALE":case"JAPAN_STD":case"GOOGLE_CN":case"GOOGLE":n={CLOUD:"http://t2.dituhui.com/FileService/image?map=quanguo&type=web&x={x}&y={y}&z={z}",CLOUD_BLACK:"http://t3.dituhui.com/MapService/getGdp?x={x}&y={y}&z={z}",OSM:"http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png",GOOGLE:"https://www.google.cn/maps/vt/pb=!1m4!1m3!1i{z}!2i{x}!3i{y}!2m3!1e0!2sm!3i380072576!3m8!2szh-CN!3scn!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e0!5m1!1e0",GOOGLE_CN:"https://mt{0-3}.google.cn/vt/lyrs=m&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}",JAPAN_STD:"https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png",JAPAN_PALE:"https://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png",JAPAN_RELIEF:"https://cyberjapandata.gsi.go.jp/xyz/relief/{z}/{x}/{y}.png",JAPAN_ORT:"https://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg"}[r],this._createXYZLayer(e,n);break;case"MAPBOXSTYLE":this._createMapboxStyle(e)}}},{key:"_createMapboxStyle",value:function(t){var e,r=this,n=t.dataSource,o=void 0===n?{}:n,i=o.serverId,a=o.url;e=void 0!==i?"".concat(this.server,"web/datas/").concat(i,"/download"):a,tt.get(e,null,{withCredentials:this.withCredentials,withoutFormatSuffix:!0,headers:{"Content-Type":"application/json;chartset=uft-8"}}).then(function(t){return t.json()}).then(function(t){r._matchStyleObject(t),r.map.setStyle(t)})}},{key:"_matchStyleObject",value:function(t){var e=t.sprite,r=t.glyphs;e&&"object"===Zht(e)&&(t.sprite=Object.values(e)[0]),r&&"object"===Zht(r)&&(t.glyphs=Object.values(r)[0])}},{key:"_createTiandituLayer",value:function(t){var e=this._getTiandituUrl(t),r=t.baseLayer.layerType,n=Boolean(t.baseLayer.labelLayerVisible),o=e.labelUrl,i=e.tiandituUrl;this._addBaselayer(i,"tianditu-layers-"+r),n&&this._addBaselayer(o,"tianditu-label-layers-"+r)}},{key:"_createWMTSLayer",value:function(t){var e=this,r=this._getWMTSUrl(t);this._filterWMTSIsMatched(t,function(n,o){n&&e._addBaselayer([r],"wmts-layers"+t.name,0,o)})}},{key:"_filterWMTSIsMatched",value:function(t,e){var r=this,n=!1,o=22,i=t.url;tt.get(i,null,{withCredentials:!1,withoutFormatSuffix:!0}).then(function(t){return t.text()}).then(function(i){var a=new Qht.XMLParser({numberParseOptions:{hex:!1,leadingZeros:!1,eNotation:!1},alwaysCreateTextNode:!0,textNodeName:"_text"}).parse(i).Capabilities.Contents.TileMatrixSet;Array.isArray(a)||(a=[a]);for(var s=0;s-1)n=!0;else{if(!a[s].WellKnownScaleSet||"Custom"!==a[s].WellKnownScaleSet._text)throw Error(fft.i18n("msg_tilematrixsetunsupport"));for(var u=[],l="EPSG:3857"===r.map.crs?opt:ipt,c=0,f=l.length;c-1&&(r.svgDiv||(r.svgDiv=document.createElement("div"),document.body.appendChild(r.svgDiv)),r._getCanvasFromSVG(o.src,r.svgDiv,function(e){var n=e.toDataURL("img/png");n&&r.map.loadImage(n,function(e,n){e&&console.log(e),r.map.addImage(s+"",n),r.map.addLayer({id:u,type:"symbol",source:a,layout:{"icon-image":s+"","icon-size":o.scale,visibility:t.visible}})},r)})),!o.src){var l={layout:{}};"LINESTRING"===n&&o.lineCap&&(n="LINE",l.layout={"line-cap":o.lineCap});var c=t.visible;l.layout.visibility=c,l.style=r._transformStyleToMapBoxGl(o,n),r._addOverlayToMap(n,a,u,l),"POLYGON"===n&&o.strokeColor&&r._addStrokeLineForPoly(o,a,u+"-strokeLine",c)}},this)}},{key:"setFeatureInfo",value:function(t){var e,r=t.dv_v5_markerInfo;if(!r||!r.dataViz_title)return r;e=r;var n=t.properties;for(var o in e)n[o]&&(e[o]=n[o],delete n[o]);return e}},{key:"_createHeatLayer",value:function(t,e){var r=t.themeSetting,n={};n.gradient=r.colors.slice(),n.radius=parseInt(r.radius);var o=r.customSettings;for(var i in o)n.gradient[i]=o[i];r.weight&&this._changeWeight(e,r.weight);var a=["interpolate",["linear"],["heatmap-density"]],s=(1/n.gradient.length).toFixed(2);n.gradient.forEach(function(t,e){a.push(e*s),0===e&&(t=$n.hexToRgba(t,0)),a.push(t)});var u={"heatmap-color":a,"heatmap-radius":r.radius+15,"heatmap-intensity":{base:1,stops:[[0,.8],[22,1]]}};if(e[0].weight&&e.length>=4){var l=[];e.forEach(function(t){l.push(t.weight)});var c=Elt.getMax(l),f=Elt.getMin(l);u["heatmap-weight"]=["interpolate",["linear"],["get","weight"],f,0,c,1]}this.map.addLayer({id:t.layerID,type:"heatmap",source:{type:"geojson",data:{type:"FeatureCollection",features:e}},paint:u})}},{key:"_changeWeight",value:function(t,e){this.fieldMaxValue={},this._getMaxValue(t,e);var r=this.fieldMaxValue[e];t.forEach(function(t){var n=t.properties[e];t.weight=n/r})}},{key:"_getMaxValue",value:function(t,e){var r,n=[],o=e;this.fieldMaxValue[o]||(t.forEach(function(t){(r=t.properties)&&parseFloat(r[o])&&n.push(parseFloat(r[o]))}),this.fieldMaxValue[o]=Elt.getArrayStatistic(n,"Maximum"))}},{key:"_createRangeLayer",value:function(t,e){var r=t.themeSetting.themeField,n=t.style,o=t.featureType,i=this._getRangeStyleGroup(t,e),a={type:"geojson",data:{type:"FeatureCollection",features:e=this._getFiterFeatures(t.filterCondition,e)}},s=["match",["get","index"]];e.forEach(function(t){for(var e=parseFloat(t.properties[r]),n=0;n0&&n.push(i)}return n}},{key:"_replaceFilterCharacter",value:function(t){return t=t.replace(/=/g,"==").replace(/AND|and/g,"&&").replace(/or|OR/g,"||").replace(/<==/g,"<=").replace(/>==/g,">=")}},{key:"_getRangeStyleGroup",value:function(t,e){var r,n=t.featureType,o=t.style,i=[],a=t.themeSetting,s=a.customSettings,u=a.themeField,l=a.segmentCount;e.forEach(function(t){(r=t.properties||t.get("Properties"))?r[u]&&$n.isNumber(r[u])&&i.push(parseFloat(r[u])):t.get(u)&&$n.isNumber(t.get(u))&&t.get(u)&&i.push(parseFloat(t.get(u)))},this);var c=Elt.getArraySegments(i,a.segmentMethod,l);if(c){var f=l;for(var h in r&&c[0]===c[r.length-1]&&(f=1,c.length=2),c){var p=c[h];p=0==h?Math.floor(100*p)/100:Math.ceil(100*p)/100+.1,c[h]=Number(p.toFixed(2))}for(var d=a.colors,y=0;y300||o.height>300||r(o)})}},{key:"_stopCanvg",value:function(){this._canvgsV.forEach(function(t){return t.stop()}),this._canvgsV=[]}},{key:"_addOverlayToMap",value:function(t,e,r,n){"circle"!==(t={POINT:"circle",LINE:"line",POLYGON:"fill"}[t])&&"line"!==t&&"fill"!==t||this.map.addLayer({id:r,type:t,source:e,paint:n.style,layout:n.layout||{}})}},{key:"_addBaselayer",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:22,o=arguments.length>4?arguments[4]:void 0;this.map.addLayer({id:e,type:"raster",source:{type:"raster",tiles:t,tileSize:256,rasterSource:o?"iserver":"",prjCoordSys:o?{epsgCode:this.baseProjection.split(":")[1]}:""},minzoom:r,maxzoom:n})}},{key:"_addStrokeLineForPoly",value:function(t,e,r,n){var o={};o.style=this._transformStyleToMapBoxGl(t,"LINE"),o.layout={visibility:n},this._addOverlayToMap("LINE",e,r,o)}},{key:"_parseGeoJsonData2Feature",value:function(t){for(var e=t.allDatas.features,r=[],n=0,o=e.length;n 0"}),i=new KB({queryParameter:o,datasetNames:e,fromIndex:0,toIndex:1e5,returnContent:!0}),new oF(t).processAsync(i,function(t){"processCompleted"===t.type?r(t):n(t)})}},{key:"_queryFeatureBySQL",value:function(t,e,r,n,o,i,a,s,u,l){var c,f;c=new wB({name:e,attributeFilter:r}),n&&(c.fields=n);var h={queryParams:[c]};l&&(h.queryOption=Zr.ATTRIBUTE),s&&(h.startRecord=s),u&&(h.expectCount=u),o&&(h.prjCoordSys={epsgCode:o}),f=new $1(h),new L2(t).queryBySQL(f,function(t){"processCompleted"===t.type?i(t):a(t)})}},{key:"_handleMultyPolygon",value:function(t){return t.forEach(function(t){if("Polygon"===t.geometry.type){var e=t.geometry.coordinates;if(e.length>1){var r=[];e.forEach(function(t){r.push([t])}),t.geometry.coordinates=r,t.geometry.type="MultiPolygon"}}}),t}},{key:"_transformScaleToZoom",value:function(t,e){var r=295829515.2024169;"EPSG:3857"!==(e||this.map.getCRS()).epsgCode&&(r=295295895);var n=t.split(":")[1];return Math.min(24,+Math.log2(r/+n).toFixed(2))}},{key:"_getResolution",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:512;return t.leftBottom&&t.rightTop?Math.max(t.rightTop.x-t.leftBottom.x,t.rightTop.y-t.leftBottom.y)/e:Math.max(t[2]-t[0],t[3]-t[1])/e}}])&&$ht(r.prototype,n),o&&$ht(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function upt(t){"@babel/helpers - typeof";return(upt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function lpt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function cpt(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=new Array(e);r2&&void 0!==arguments[2]?arguments[2]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=vpt(this,e)).mapId=t,n.options=r,n.mapOptions={center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch},n._legendList=[],n._mapResourceInfo={},n._sprite="",n._spriteDatas={},n._appreciableLayers=[],n}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mpt(t,e)}(e,w().Evented),r=e,(n=[{key:"initializeMap",value:function(t,e){if(this._mapInfo=t,e)return this.map=e,void this._initLayers();this._createMap()}},{key:"getLayers",value:function(){return this._appreciableLayers||[]}},{key:"_createMap",value:function(){var t=this,e=this._mapInfo,r=e.name,n=e.crs,o=e.center,i=void 0===o?new(w().LngLat)(0,0):o,a=e.zoom,s=void 0===a?0:a,u=e.bearing,l=void 0===u?0:u,c=e.pitch,f=void 0===c?0:c,h=e.minzoom,p=e.maxzoom,d=e.sprite,y=void 0===d?"":d;i=this.mapOptions.center||i,s=this.mapOptions.zoom||s,l=this.mapOptions.bearing||l,f=this.mapOptions.pitch||f;var v=this._getLabelFontFamily(),g={container:this.options.target,crs:n,center:i,zoom:s,style:{sprite:y,name:r,version:8,sources:{},layers:[]},minzoom:h,maxzoom:p,bearing:l,pitch:f,localIdeographFontFamily:v||""};this.map=new(w().Map)(g),this._sprite=y,this.fire("mapinitialized",{map:this.map}),this.map.on("load",function(){t._initLayers()})}},{key:"_initLayers",value:function(){var t=this;this.map&&this.map.getCRS&&this.map.getCRS().epsgCode!==this._mapInfo.crs?this.fire("projectionisnotmatch"):Promise.all([this._getMapRelatedInfo(),this._getSpriteDatas()]).then(function(e){var r=hpt(e,1)[0];t.mapParams={title:t._mapInfo.name,description:r.description},t._mapResourceInfo=JSON.parse(r.projectInfo),t._createMapRelatedInfo(),t._addLayersToMap()}).catch(function(e){t.fire("getmapinfofailed",{error:e})})}},{key:"_createMapRelatedInfo",value:function(){var t=this._mapInfo.glyphs;for(var e in t)this.map.style.addGlyphs(e,t[e])}},{key:"_getMapRelatedInfo",value:function(){var t=$n.transformUrl(Object.assign({url:"".concat(this.options.server,"web/maps/").concat(this.mapId)},this.options));return tt.get(t,null,{withCredentials:this.options.withCredentials}).then(function(t){return t.json()})}},{key:"_addLayersToMap",value:function(){var t=this,e=this._setUniqueId(this._mapInfo),r=e.sources,n=e.layers,o=e.layerIdMapList;n.forEach(function(e){e.source&&!t.map.getSource(e.source)&&t.map.addSource(e.source,r[e.source]),t.map.addLayer(e)}),this._sendMapToUser(o)}},{key:"_setUniqueId",value:function(t){var e=this,r=JSON.parse(JSON.stringify(t.layers)),n={},o={},i=function(i){var a=e.map.getSource(i)?"_".concat(+new Date):"",s=i+a;n[s]=t.sources[i],r=r.map(function(t){var r=t;if(t.source===i){var n=t.id;e.map.getLayer(n)&&(n=a?t.id+a:"".concat(t.id,"_").concat(+new Date)),r=Object.assign({},t,{id:n,source:s})}return o[t.id]=r.id,r})};for(var a in t.sources)i(a);return{sources:n,layers:r,layerIdMapList:o}}},{key:"_sendMapToUser",value:function(t){this._appreciableLayers=this._generateLayers(t),this.fire("addlayerssucceeded",{map:this.map,mapparams:this.mapParams,layers:this._appreciableLayers})}},{key:"_getLayerInfosFromCatalogs",value:function(t){for(var e=[],r=0;r0){var s=this._getLayerInfosFromCatalogs(i);e.push.apply(e,fpt(s))}}return e}},{key:"getLegendInfo",value:function(){return this._legendList}},{key:"clean",value:function(){this.map&&(this.map=null,this._legendList=[],this.mapOptions={},this._appreciableLayers=[])}},{key:"_generateLayers",value:function(t){var e=this,r=this._mapResourceInfo.catalogs,n=void 0===r?[]:r;return this._getLayerInfosFromCatalogs(n).map(function(r){var n=r.title,o=r.visualization,i=t[r.id],a=e._mapInfo.layers.find(function(t){return t.id===r.id});e._createLegendInfo(Object.assign({},a,{id:i}),o);var s,u="",l="",c=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ppt(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(e._mapResourceInfo.datas);try{for(c.s();!(s=c.n()).done;){var f=s.value,h=f.datasets.find(function(t){return t.msDatasetId===r.msDatasetId});if(h){u=f.sourceType,l=h.datasetId;break}}}catch(t){c.e(t)}finally{c.f()}var p={dataSource:{serverId:l,type:u},layerID:i,layerType:"raster"===a.type?"raster":"vector",type:a.type,name:n},d=e._parseRendererStyleData(o.renderer)[0];if(d){var y="";"heat"===d.type?y=d.field:d.color&&(y=d.color.field),y&&(p.themeSetting={themeField:y})}return p})}},{key:"_parseRendererStyleData",value:function(t){return t instanceof Array?t:[t]}},{key:"_getLabelFontFamily",value:function(){var t=[],e=this._mapInfo.layers;return e&&e.length>0&&e.forEach(function(e){var r=e.layout&&e.layout["text-font"]||[];t.push.apply(t,fpt(r))}),t.join(",")}},{key:"_getSpriteDatas",value:function(){var t=this,e=this._sprite;if(e){if("string"==typeof e){var r=e.replace(/.+(web\/maps\/.+)/,"".concat(this.options.server,"$1"));return tt.get(r,null,{withCredentials:this.options.withCredentials}).then(function(t){return t.json()}).then(function(e){t._spriteDatas=e})}this._spriteDatas=e}}},{key:"_createLegendInfo",value:function(t,e){var r,n=this,o=this._parseRendererStyleData(e.renderer).reduce(function(e,r){var o=n._createLayerLegendList(t,r);return o&&e.push.apply(e,fpt(o)),e},[]);(r=this._legendList).push.apply(r,fpt(o))}},{key:"_getLegendSimpleStyle",value:function(t,e){var r={},n=Ept[t],o=Opt[n];o&&o.filter(function(t){return e[t]&&"simple"===e[t].type}).forEach(function(t){("outlineColor"!==t||(e.antialias||{}).value)&&(r[t]=(e[t]||{}).value)});return r}},{key:"_createLayerLegendList",value:function(t,e){var r=this,n=t.type,o=t.id,i=t.title,a=Ept[n];if("heat"===e.type){var s=this._heatColorToGradient((t.paint||{})["heatmap-color"]);return s.length>0?[{themeField:e.field,styleGroup:[{style:{type:Ipt,shape:a,colors:s}}],layerId:o,layerTitle:i}]:void 0}var u=Opt[a];if(u){var l=this._getLegendSimpleStyle(n,e),c=this._parseLegendtyle({layerType2LegendType:a,customValue:l}),f=u.filter(function(t){return e[t]&&"simple"!==e[t].type});return f.length?f.map(function(t){var n=e[t],s=r._getSettingStyle(t,n.defaultValue,l),u=[],c={layerType2LegendType:a,styleField:t,subStyleSetting:n,simpleStyle:l,defaultSetting:s};switch(r._getLegendStyleType(t,n)){case kpt:u=r._parseLinearStyle(c);break;case Tpt:u=r._parseRangeStyle(c);break;case Cpt:u=r._parseUniqueStyle(c)}return{themeField:(n.field||[])[0],styleField:t,styleGroup:u,layerId:o,layerTitle:i}}):[{styleGroup:[{style:cpt(cpt({},c),{},{shape:a})}],layerId:o,layerTitle:i}]}}},{key:"_heatColorToGradient",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=[];return t.forEach(function(r,n){n>5&&n%2==0&&e.push({value:r,key:6===n?0:t[n-1]})}),e}},{key:"_getSettingValue",value:function(t){var e=t.type,r=t.value,n=t.values;return"linear"===e?r:n}},{key:"_getLegendStyleType",value:function(t,e){var r=e.type,n=this._getSettingValue(e),o="linear"===r?{type:"linear"}:e.interpolateInfo;return["unique","linear"].includes(r)?this._isColorAttr(t)&&o&&"linear"===o.type&&n.length>1?kpt:Cpt:Tpt}},{key:"_isColorAttr",value:function(t){return["color","textColor","outlineColor","textHaloColor"].includes(t)}},{key:"_parseLinearStyle",value:function(t){var e=t.subStyleSetting,r=t.layerType2LegendType,n=this._getSettingValue(e)||[];return[{styleField:null,style:{type:Ipt,shape:r,colors:n}}]}},{key:"_parseUniqueStyle",value:function(t){var e=this,r=t.layerType2LegendType,n=t.styleField,o=t.subStyleSetting,i=t.simpleStyle,a=t.defaultSetting,s=o.values,u=o.interpolateInfo,l=void 0===u?{}:u,c=s.map(function(t){var o=e._getSettingStyle(n,t.value,i),a=e._parseLegendtyle({layerType2LegendType:r,customValue:o});return{fieldValue:t.key,style:cpt(cpt({},a),{},{shape:r})}});if(!l.type||"custom"===l.type){var f=this._parseLegendtyle({layerType2LegendType:r,customValue:a});c.push({fieldValue:null,style:cpt(cpt({},f),{},{shape:r})})}return c}},{key:"_parseRangeStyle",value:function(t){var e=this,r=t.layerType2LegendType,n=t.styleField,o=t.subStyleSetting,i=t.simpleStyle,a=t.defaultSetting,s=o.values.map(function(t){var o=e._getSettingStyle(n,t.value,i),a=e._parseLegendtyle({layerType2LegendType:r,customValue:o});return{start:t.start,end:t.end,style:cpt(cpt({},a),{},{shape:r})}}),u=this._parseLegendtyle({layerType2LegendType:r,customValue:a});return s.push({start:null,end:null,style:cpt(cpt({},u),{},{shape:r})}),s}},{key:"_getSettingStyle",value:function(t,e,r){var n=Object.assign({},r);return n[t]=e,n}},{key:"_parseLegendtyle",value:function(t){var e=this,r=t.layerType2LegendType,n=t.customValue,o=cpt({},_pt[r]);r!==Spt.LINE&&Object.keys(o).forEach(function(t){var e=n[xpt[t]||t];([Spt.FILL,Spt.FILLEXTRUSION].includes(r)||e)&&(o[t]=e)});var i=n.symbolsContent||{},a=i.symbolId,s=void 0===a?Ppt[r]:a,u=i.style;switch(r){case Spt.POINT:return"BASE"===(this._getIconById(s)?"BASE":"SERVICE")?cpt({type:Ipt},o):this._getSpriteStyle(s,o);case Spt.LINE:u=u||[];var l=cpt({},_pt.LINE),c=u instanceof Array?u:[u];if(c.some(function(t){return!!e._getImageIdBySymbol(t,Apt)})){var f=this._getImageIdBySymbol(c[0],Apt);return this._getSpriteStyle(f,o)}var h,p=n.symbolsContent?{}:{height:n.width||l.height,lineWidth:n.width||l.width,color:n.color||l.backgroundColor};if(delete Object.assign({},n).symbolsContent,n.symbolsContent){var d=this._getLineWidth(c);h=c.map(function(t){return e._transformLineStyle({oldWidth:d,symbol:t,defaultStyle:l,customValue:n})})}return cpt(cpt(cpt({type:Ipt},n),p),{},{lineStyles:h,width:100});case Spt.FILL:case Spt.FILLEXTRUSION:var y=o.backgroundColor,v=((u||{}).paint||{})["fill-color"],g=cpt({},_pt.FILL);return y||Object.assign(o,{backgroundColor:v}),Object.keys(o).forEach(function(t){["backgroundColor","width","height","opacity"].includes(t)&&!o[t]&&(o[t]=g[t])}),o.outlineColor&&Object.assign(o,{outline:g.outline,marginLeft:"1px"}),this._spriteDatas[s]?this._getSpriteStyle(s,o):cpt({type:Ipt},o)}}},{key:"_getIconById",value:function(t){if("image"!==(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"svg")){return[{id:"circle",name:"circle"}].find(function(e){return e.id===t})}}},{key:"_getImageIdBySymbol",value:function(t,e){var r=t.paint||{};return e===Apt?r["line-pattern"]:e===Mpt?r["fill-pattern"]:r["icon-image"]}},{key:"_getSpriteStyle",value:function(t,e){if(this._spriteDatas[t]){var r=this._spriteDatas[t];if(r.width&&r.height)return cpt(cpt({type:jpt,sprite:r},e),{},{url:"string"==typeof this._sprite?"".concat(this._sprite,".png"):""})}}},{key:"_transformLineStyle",value:function(t){var e,r=t.oldWidth,n=t.symbol,o=t.defaultStyle,i=t.customValue,a=n.paint,s=void 0===a?{}:a;return void 0!==i.height&&(e=this._updateSingleStyleByWidth(r,i.height,n)),{lineWidth:((e||{}).paint||{})["line-width"]||s["line-width"]||o.height,opacity:i.opacity||s["line-opacity"]||o.opacity,color:i.color||s["line-color"]||o.backgroundColor,lineDash:s["line-dasharray"]||[],lineOffset:s["line-offset"]||0}}},{key:"_updateSingleStyleByWidth",value:function(t,e,r){if(t===e)return r;var n=(r||{}).paint||{};if(0===t)return{paint:Object.assign({},n,{"line-width":Number(e.toFixed(2))})};var o=e/t,i=n["line-width"],a=n["line-offset"]||0,s=n["line-dasharray"]||[],u=this._updateDash(s,o);return{paint:Object.assign({},n,{"line-width":Number((i*o).toFixed(2)),"line-offset":Number((a*o).toFixed(2)),"line-dasharray":u&&u.map(function(t){return Number(t.toFixed(2))})})}}},{key:"_updateDash",value:function(t,e){if(t&&0!==t.length)return t.map(function(t){return t/e})}},{key:"_getLineWidth",value:function(t){return t instanceof Array?this._getWholeWidth(t):(t.paint||{})["line-width"]||0}},{key:"_getWholeWidth",value:function(t){var e,r;return t.forEach(function(t){var n=(t||{}).paint||{},o=n["line-width"],i=n["line-offset"]||0,a=i+o/2,s=i-o/2;(a>e||void 0===e)&&(e=a),(s1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=Bpt(this,e)).mapId=t,r.options=Object.assign({},n),r.options.server=r._formatServerUrl(n.server),r.options.target=n.target||"map",r.options.withCredentials=n.withCredentials||!1,r.mapOptions=o,r._createWebMap(),r.on("mapinitialized",function(){r.map.on("remove",function(){r._stopCanvg()})}),r}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gpt(t,e)}(e,w().Evented),r=e,(n=[{key:"resize",value:function(){this.map.resize()}},{key:"setMapId",value:function(t){this.mapId=t,this._createWebMap()}},{key:"setWebMapOptions",value:function(t){var e=this._formatServerUrl(t.server);this.options.server=e,this._createWebMap()}},{key:"setMapOptions",value:function(t){var e=t.center,r=t.zoom,n=t.maxBounds,o=t.minZoom,i=t.maxZoom,a=t.isWorldCopy,s=t.bearing,u=t.pitch;e&&e.length&&this.map.setCenter(e),r&&this.map.setZoom(r),n&&this.map.setMaxBounds(n),o&&this.map.setMinZoom(o),i&&this.map.setMaxZoom(i),a&&this.map.setRenderWorldCopies(a),s&&this.map.setBearing(s),u&&this.map.setPitch(u)}},{key:"_createWebMap",value:function(){var t=$n.transformUrl(Object.assign({url:"".concat(this.options.server,"web/maps/").concat(this.mapId,"/map")},this.options));this._getMapInfo(t)}},{key:"_formatServerUrl",value:function(t){var e=t.split("");return"/"!==e[e.length-1]&&(t+="/"),t}},{key:"_getMapInfo",value:function(t){var e=this;tt.get(t,null,{withCredentials:this.options.withCredentials}).then(function(t){return t.json()}).then(function(t){var r=e._getMapProjection(t);if(!["EPSG:4490","EPSG:4214","EPSG:4610","EPSG:3857","EPSG:4326"].find(function(t){return t===r}))throw Error(fft.i18n("msg_crsunsupport"));e.webMapInstance=e._initMap(t),e._registerWebMapEvents(),e.webMapInstance.initializeMap(t)}).catch(function(t){e.fire("getmapfailed",{error:t})})}},{key:"_getMapProjection",value:function(t){return this._isWebMapV3(t.version)?t.crs:t.projection}},{key:"_initMap",value:function(t){var e=new(this._getMapFactory(t.version))(this.mapId,this.options,this.mapOptions);return e.setEventedParent(this),e}},{key:"_getMapFactory",value:function(t){return this._isWebMapV3(t)?Npt:spt}},{key:"_registerWebMapEvents",value:function(){var t=this;this.webMapInstance&&(this.webMapInstance.on("mapinitialized",function(){t.map=t.webMapInstance.map}),this.webMapInstance.on("addlayerssucceeded",function(e){var r=e.mapparams;t.mapParams=r}))}},{key:"_getWebMapInstance",value:function(){return this.webMapInstance}},{key:"_isWebMapV3",value:function(t){return t.startsWith("3.")}}])&&Rpt(r.prototype,n),o&&Rpt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}();function zpt(t){"@babel/helpers - typeof";return(zpt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Vpt(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:22,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:512,n=[],o=Math.abs(t.left-t.right)/r,i=0;iMath.abs(t-e[o])&&(r=Math.abs(t-e[o]),n=o);return n}(Vc(r,n,o),i)}var Xpt=1,Jpt=2,Kpt=3,Qpt=4,Zpt=5,$pt=6378137,tdt=6356752.314,edt=.0066943799901413165,rdt=484813681109536e-20,ndt=Math.PI/2,odt=.16666666666666666,idt=.04722222222222222,adt=.022156084656084655,sdt=1e-10,udt=.017453292519943295,ldt=57.29577951308232,cdt=Math.PI/4,fdt=2*Math.PI,hdt=3.14159265359,pdt={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},ddt={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},ydt=/[\s_\-\/\(\)]/g;function vdt(t,e){if(t[e])return t[e];for(var r,n=Object.keys(t),o=e.toLowerCase().replace(ydt,""),i=-1;++i=this.text.length)return;t=this.text[this.place++]}switch(this.state){case bdt:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},Odt.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(_dt.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},Odt.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=bdt)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=bdt,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},Odt.prototype.number=function(t){if(!Edt.test(t)){if(_dt.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},Odt.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Odt.prototype.keyword=function(t){if(xdt.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=bdt)}if(!_dt.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Odt.prototype.neutral=function(t){if(Sdt.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(Edt.test(t))return this.word=t,void(this.state=3);if(!_dt.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},Odt.prototype.output=function(){for(;this.place0?90:-90)):(t.lat0=Adt(t.lat1>0?90:-90),t.lat_ts=t.lat1)}(o),o}function jdt(t){var e=this;if(2===arguments.length){var r=arguments[1];"string"==typeof r?"+"===r.charAt(0)?jdt[t]=gdt(arguments[1]):jdt[t]=Mdt(arguments[1]):jdt[t]=r}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){Array.isArray(t)?jdt.apply(e,t):jdt(t)});if("string"==typeof t){if(t in jdt)return jdt[t]}else"EPSG"in t?jdt["EPSG:"+t.EPSG]=t:"ESRI"in t?jdt["ESRI:"+t.ESRI]=t:"IAU2000"in t?jdt["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(jdt);var Idt=jdt;var Ndt=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var Ldt=["3857","900913","3785","102113"];var Rdt=function(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in Idt}(t))return Idt[t];if(function(t){return Ndt.some(function(e){return t.indexOf(e)>-1})}(t)){var e=Mdt(t);if(function(t){var e=vdt(t,"authority");if(e){var r=vdt(e,"epsg");return r&&Ldt.indexOf(r)>-1}}(e))return Idt["EPSG:3857"];var r=function(t){var e=vdt(t,"extension");if(e)return vdt(e,"proj4")}(e);return r?gdt(r):e}return function(t){return"+"===t[0]}(t)?gdt(t):void 0};function Ddt(t,e){var r,n;if(t=t||{},!e)return t;for(n in e)void 0!==(r=e[n])&&(t[n]=r);return t}function Bdt(t,e,r){var n=t*e;return r/Math.sqrt(1-n*n)}function Fdt(t){return t<0?-1:1}function Gdt(t){return Math.abs(t)<=hdt?t:t-Fdt(t)*fdt}function Udt(t,e,r){var n=t*r,o=.5*t;return n=Math.pow((1-n)/(1+n),o),Math.tan(.5*(ndt-e))/n}function zdt(t,e){for(var r,n,o=.5*t,i=ndt-2*Math.atan(e),a=0;a<=15;a++)if(r=t*Math.sin(i),i+=n=ndt-2*Math.atan(e*Math.pow((1-r)/(1+r),o))-i,Math.abs(n)<=1e-10)return i;return-9999}function Vdt(t){return t}var Hdt=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Bdt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,r,n=t.x,o=t.y;if(o*ldt>90&&o*ldt<-90&&n*ldt>180&&n*ldt<-180)return null;if(Math.abs(Math.abs(o)-ndt)<=sdt)return null;if(this.sphere)e=this.x0+this.a*this.k0*Gdt(n-this.long0),r=this.y0+this.a*this.k0*Math.log(Math.tan(cdt+.5*o));else{var i=Math.sin(o),a=Udt(this.e,o,i);e=this.x0+this.a*this.k0*Gdt(n-this.long0),r=this.y0-this.a*this.k0*Math.log(a)}return t.x=e,t.y=r,t},inverse:function(t){var e,r,n=t.x-this.x0,o=t.y-this.y0;if(this.sphere)r=ndt-2*Math.atan(Math.exp(-o/(this.a*this.k0)));else{var i=Math.exp(-o/(this.a*this.k0));if(-9999===(r=zdt(this.e,i)))return null}return e=Gdt(this.long0+n/(this.a*this.k0)),t.x=e,t.y=r,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:Vdt,inverse:Vdt,names:["longlat","identity"]}],qdt={},Wdt=[];function Ydt(t,e){var r=Wdt.length;return t.names?(Wdt[r]=t,t.names.forEach(function(t){qdt[t.toLowerCase()]=r}),this):(console.log(e),!0)}var Xdt={start:function(){Hdt.forEach(Ydt)},add:Ydt,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==qdt[e]&&Wdt[qdt[e]]?Wdt[qdt[e]]:void 0}},Jdt={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"}},Kdt=Jdt.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Jdt.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var Qdt={};Qdt.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Qdt.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Qdt.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Qdt.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Qdt.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},Qdt.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Qdt.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Qdt.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},Qdt.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Qdt.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},Qdt.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Qdt.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Qdt.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Qdt.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Qdt.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Qdt.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Qdt.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var Zdt=function(t,e,r,n,o,i,a){var s={};return s.datum_type=void 0===t||"none"===t?Zpt:Qpt,e&&(s.datum_params=e.map(parseFloat),0===s.datum_params[0]&&0===s.datum_params[1]&&0===s.datum_params[2]||(s.datum_type=Xpt),s.datum_params.length>3&&(0===s.datum_params[3]&&0===s.datum_params[4]&&0===s.datum_params[5]&&0===s.datum_params[6]||(s.datum_type=Jpt,s.datum_params[3]*=rdt,s.datum_params[4]*=rdt,s.datum_params[5]*=rdt,s.datum_params[6]=s.datum_params[6]/1e6+1))),a&&(s.datum_type=Kpt,s.grids=a),s.a=r,s.b=n,s.es=o,s.ep2=i,s},$dt={};function tyt(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:$dt[t]||null,isNull:!1}}function eyt(t){return t/3600*Math.PI/180}function ryt(t,e,r){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,r)))}function nyt(t){return t.map(function(t){return[eyt(t.longitudeShift),eyt(t.latitudeShift)]})}function oyt(t,e,r){return{name:ryt(t,e+8,e+16).trim(),parent:ryt(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,r),upperLatitude:t.getFloat64(e+88,r),lowerLongitude:t.getFloat64(e+104,r),upperLongitude:t.getFloat64(e+120,r),latitudeInterval:t.getFloat64(e+136,r),longitudeInterval:t.getFloat64(e+152,r),gridNodeCount:t.getInt32(e+168,r)}}function iyt(t,e,r,n){for(var o=e+176,i=[],a=0;a-1.001*ndt)u=-ndt;else if(u>ndt&&u<1.001*ndt)u=ndt;else{if(u<-ndt)return{x:-1/0,y:-1/0,z:t.z};if(u>ndt)return{x:1/0,y:1/0,z:t.z}}return s>Math.PI&&(s-=2*Math.PI),o=Math.sin(u),a=Math.cos(u),i=o*o,{x:((n=r/Math.sqrt(1-e*i))+l)*a*Math.cos(s),y:(n+l)*a*Math.sin(s),z:(n*(1-e)+l)*o}}function lyt(t,e,r,n){var o,i,a,s,u,l,c,f,h,p,d,y,v,g,m,b=t.x,w=t.y,S=t.z?t.z:0;if(o=Math.sqrt(b*b+w*w),i=Math.sqrt(b*b+w*w+S*S),o/r<1e-12){if(g=0,i/r<1e-12)return ndt,m=-n,{x:t.x,y:t.y,z:t.z}}else g=Math.atan2(w,b);a=S/i,f=(s=o/i)*(1-e)*(u=1/Math.sqrt(1-e*(2-e)*s*s)),h=a*u,v=0;do{v++,l=e*(c=r/Math.sqrt(1-e*h*h))/(c+(m=o*f+S*h-c*(1-e*h*h))),y=(d=a*(u=1/Math.sqrt(1-l*(2-l)*s*s)))*f-(p=s*(1-l)*u)*h,f=p,h=d}while(y*y>1e-24&&v<30);return{x:g,y:Math.atan(d/Math.abs(p)),z:m}}function cyt(t){return t===Xpt||t===Jpt}function fyt(t,e,r){if(function(t,e){return t.datum_type===e.datum_type&&!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===Xpt?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==Jpt||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6])}(t,e))return r;if(t.datum_type===Zpt||e.datum_type===Zpt)return r;var n=t.a,o=t.es;if(t.datum_type===Kpt){if(0!==hyt(t,!1,r))return;n=$pt,o=edt}var i=e.a,a=e.b,s=e.es;if(e.datum_type===Kpt&&(i=$pt,a=tdt,s=edt),o===s&&n===i&&!cyt(t.datum_type)&&!cyt(e.datum_type))return r;if((r=uyt(r,o,n),cyt(t.datum_type)&&(r=function(t,e,r){if(e===Xpt)return{x:t.x+r[0],y:t.y+r[1],z:t.z+r[2]};if(e===Jpt){var n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],u=r[5],l=r[6];return{x:l*(t.x-u*t.y+s*t.z)+n,y:l*(u*t.x+t.y-a*t.z)+o,z:l*(-s*t.x+a*t.y+t.z)+i}}}(r,t.datum_type,t.datum_params)),cyt(e.datum_type)&&(r=function(t,e,r){if(e===Xpt)return{x:t.x-r[0],y:t.y-r[1],z:t.z-r[2]};if(e===Jpt){var n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],u=r[5],l=r[6],c=(t.x-n)/l,f=(t.y-o)/l,h=(t.z-i)/l;return{x:c+u*f-s*h,y:-u*c+f+a*h,z:s*c-a*f+h}}}(r,e.datum_type,e.datum_params)),r=lyt(r,s,i,a),e.datum_type===Kpt)&&0!==hyt(e,!0,r))return;return r}function hyt(t,e,r){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;for(var n={x:-r.x,y:r.y},o={x:Number.NaN,y:Number.NaN},i=[],a=0;an.y||c>n.x||p1e-12&&Math.abs(a.y)>1e-12);if(u<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=Gdt(i.x+r.ll[0]),n.y=i.y+r.ll[1]}else isNaN(i.x)||(n.x=t.x+i.x,n.y=t.y+i.y);return n}function dyt(t,e){var r,n={x:t.x/e.del[0],y:t.y/e.del[1]},o=Math.floor(n.x),i=Math.floor(n.y),a=n.x-1*o,s=n.y-1*i,u={x:Number.NaN,y:Number.NaN};if(o<0||o>=e.lim[0])return u;if(i<0||i>=e.lim[1])return u;r=i*e.lim[0]+o;var l=e.cvs[r][0],c=e.cvs[r][1];r++;var f=e.cvs[r][0],h=e.cvs[r][1];r+=e.lim[0];var p=e.cvs[r][0],d=e.cvs[r][1];r--;var y=e.cvs[r][0],v=e.cvs[r][1],g=a*s,m=a*(1-s),b=(1-a)*(1-s),w=(1-a)*s;return u.x=b*l+m*f+w*y+g*p,u.y=b*c+m*h+w*v+g*d,u}function yyt(t,e,r){var n,o,i,a=r.x,s=r.y,u=r.z||0,l={};for(i=0;i<3;i++)if(!e||2!==i||void 0!==r.z)switch(0===i?(n=a,o=-1!=="ew".indexOf(t.axis[i])?"x":"y"):1===i?(n=s,o=-1!=="ns".indexOf(t.axis[i])?"y":"x"):(n=u,o="z"),t.axis[i]){case"e":l[o]=n;break;case"w":l[o]=-n;break;case"n":l[o]=n;break;case"s":l[o]=-n;break;case"u":void 0!==r[o]&&(l.z=n);break;case"d":void 0!==r[o]&&(l.z=-n);break;default:return null}return l}function vyt(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function gyt(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function myt(t,e,r,n){var o,i=void 0!==(r=Array.isArray(r)?vyt(r):{x:r.x,y:r.y,z:r.z,m:r.m}).z;if(function(t){gyt(t.x),gyt(t.y)}(r),t.datum&&e.datum&&function(t,e){return(t.datum.datum_type===Xpt||t.datum.datum_type===Jpt||t.datum.datum_type===Kpt)&&"WGS84"!==e.datumCode||(e.datum.datum_type===Xpt||e.datum.datum_type===Jpt||e.datum.datum_type===Kpt)&&"WGS84"!==t.datumCode}(t,e)&&(r=myt(t,o=new syt("WGS84"),r,n),t=o),n&&"enu"!==t.axis&&(r=yyt(t,!1,r)),"longlat"===t.projName)r={x:r.x*udt,y:r.y*udt,z:r.z||0};else if(t.to_meter&&(r={x:r.x*t.to_meter,y:r.y*t.to_meter,z:r.z||0}),!(r=t.inverse(r)))return;if(t.from_greenwich&&(r.x+=t.from_greenwich),r=fyt(t.datum,e.datum,r))return e.from_greenwich&&(r={x:r.x-e.from_greenwich,y:r.y,z:r.z||0}),"longlat"===e.projName?r={x:r.x*ldt,y:r.y*ldt,z:r.z||0}:(r=e.forward(r),e.to_meter&&(r={x:r.x/e.to_meter,y:r.y/e.to_meter,z:r.z||0})),n&&"enu"!==e.axis?yyt(e,!0,r):(i||delete r.z,r)}var byt=syt("WGS84");function wyt(t,e,r,n){var o,i,a;return Array.isArray(r)?(o=myt(t,e,r,n)||{x:NaN,y:NaN},r.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof o.z?[o.x,o.y,o.z].concat(r.splice(3)):[o.x,o.y,r[2]].concat(r.splice(3)):[o.x,o.y].concat(r.splice(2)):[o.x,o.y]):(i=myt(t,e,r,n),2===(a=Object.keys(r)).length?i:(a.forEach(function(n){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===n||"y"===n||"z"===n)return}else if("x"===n||"y"===n)return;i[n]=r[n]}),i))}function Syt(t){return t instanceof syt?t:t.oProj?t.oProj:syt(t)}var xyt=function(t,e,r){t=Syt(t);var n,o=!1;return void 0===e?(e=t,t=byt,o=!0):(void 0!==e.x||Array.isArray(e))&&(r=e,e=t,t=byt,o=!0),e=Syt(e),r?wyt(t,e,r):(n={forward:function(r,n){return wyt(t,e,r,n)},inverse:function(r,n){return wyt(e,t,r,n)}},o&&(n.oProj=e),n)},_yt=6,Eyt="AJSAJS",Oyt="AFAFAF",Pyt=65,kyt=73,Cyt=79,Tyt=86,Ayt=90,Myt={forward:jyt,inverse:function(t){var e=Ryt(Byt(t.toUpperCase()));if(e.lat&&e.lon)return[e.lon,e.lat,e.lon,e.lat];return[e.left,e.bottom,e.right,e.top]},toPoint:Iyt};function jyt(t,e){return e=e||5,function(t,e){var r="00000"+t.easting,n="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(p=t.easting,d=t.northing,y=t.zoneNumber,v=Dyt(y),g=Math.floor(p/1e5),m=Math.floor(d/1e5)%20,o=g,i=m,a=v,s=a-1,u=Eyt.charCodeAt(s),l=Oyt.charCodeAt(s),c=u+o-1,f=l+i,h=!1,c>Ayt&&(c=c-Ayt+Pyt-1,h=!0),(c===kyt||ukyt||(c>kyt||uCyt||(c>Cyt||uAyt&&(c=c-Ayt+Pyt-1),f>Tyt?(f=f-Tyt+Pyt-1,h=!0):h=!1,(f===kyt||lkyt||(f>kyt||lCyt||(f>Cyt||lTyt&&(f=f-Tyt+Pyt-1),String.fromCharCode(c)+String.fromCharCode(f))+r.substr(r.length-5,e)+n.substr(n.length-5,e);var o,i,a,s,u,l,c,f,h;var p,d,y,v,g,m}(function(t){var e,r,n,o,i,a,s,u=t.lat,l=t.lon,c=6378137,f=Nyt(u),h=Nyt(l);s=Math.floor((l+180)/6)+1,180===l&&(s=60);u>=56&&u<64&&l>=3&&l<12&&(s=32);u>=72&&u<84&&(l>=0&&l<9?s=31:l>=9&&l<21?s=33:l>=21&&l<33?s=35:l>=33&&l<42&&(s=37));a=Nyt(6*(s-1)-180+3),.006739496752268451,e=c/Math.sqrt(1-.00669438*Math.sin(f)*Math.sin(f)),r=Math.tan(f)*Math.tan(f),n=.006739496752268451*Math.cos(f)*Math.cos(f),o=Math.cos(f)*(h-a),i=c*(.9983242984503243*f-.002514607064228144*Math.sin(2*f)+2639046602129982e-21*Math.sin(4*f)-3.418046101696858e-9*Math.sin(6*f));var p=.9996*e*(o+(1-r+n)*o*o*o/6+(5-18*r+r*r+72*n-.39089081163157013)*o*o*o*o*o/120)+5e5,d=.9996*(i+e*Math.tan(f)*(o*o/2+(5-r+9*n+4*n*n)*o*o*o*o/24+(61-58*r+r*r+600*n-2.2240339282485886)*o*o*o*o*o*o/720));u<0&&(d+=1e7);return{northing:Math.round(d),easting:Math.round(p),zoneNumber:s,zoneLetter:function(t){var e="Z";84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C");return e}(u)}}({lat:t[1],lon:t[0]}),e)}function Iyt(t){var e=Ryt(Byt(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Nyt(t){return t*(Math.PI/180)}function Lyt(t){return t/Math.PI*180}function Ryt(t){var e=t.northing,r=t.easting,n=t.zoneLetter,o=t.zoneNumber;if(o<0||o>60)return null;var i,a,s,u,l,c,f,h,p=6378137,d=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),y=r-5e5,v=e;n<"N"&&(v-=1e7),c=6*(o-1)-180+3,h=(f=v/.9996/6367449.145945056)+(3*d/2-27*d*d*d/32)*Math.sin(2*f)+(21*d*d/16-55*d*d*d*d/32)*Math.sin(4*f)+151*d*d*d/96*Math.sin(6*f),i=p/Math.sqrt(1-.00669438*Math.sin(h)*Math.sin(h)),a=Math.tan(h)*Math.tan(h),s=.006739496752268451*Math.cos(h)*Math.cos(h),u=.99330562*p/Math.pow(1-.00669438*Math.sin(h)*Math.sin(h),1.5),l=y/(.9996*i);var g=h-i*Math.tan(h)/u*(l*l/2-(5+3*a+10*s-4*s*s-.06065547077041606)*l*l*l*l/24+(61+90*a+298*s+45*a*a-1.6983531815716497-3*s*s)*l*l*l*l*l*l/720);g=Lyt(g);var m,b=(l-(1+2*a+s)*l*l*l/6+(5-2*s+28*a-3*s*s+.05391597401814761+24*a*a)*l*l*l*l*l/120)/Math.cos(h);if(b=c+Lyt(b),t.accuracy){var w=Ryt({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});m={top:w.lat,right:w.lon,bottom:g,left:b}}else m={lat:g,lon:b};return m}function Dyt(t){var e=t%_yt;return 0===e&&(e=_yt),e}function Byt(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,r=t.length,n=null,o="",i=0;!/[A-Z]/.test(e=t.charAt(i));){if(i>=2)throw"MGRSPoint bad conversion from: "+t;o+=e,i++}var a=parseInt(o,10);if(0===i||i+3>r)throw"MGRSPoint bad conversion from: "+t;var s=t.charAt(i++);if(s<="A"||"B"===s||"Y"===s||s>="Z"||"I"===s||"O"===s)throw"MGRSPoint zone letter "+s+" not handled: "+t;n=t.substring(i,i+=2);for(var u=Dyt(a),l=function(t,e){var r=Eyt.charCodeAt(e-1),n=1e5,o=!1;for(;r!==t.charCodeAt(0);){if(++r===kyt&&r++,r===Cyt&&r++,r>Ayt){if(o)throw"Bad character: "+t;r=Pyt,o=!0}n+=1e5}return n}(n.charAt(0),u),c=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var r=Oyt.charCodeAt(e-1),n=0,o=!1;for(;r!==t.charCodeAt(0);){if(++r===kyt&&r++,r===Cyt&&r++,r>Tyt){if(o)throw"Bad character: "+t;r=Pyt,o=!0}n+=1e5}return n}(n.charAt(1),u);c0&&(h=1e5/Math.pow(10,y),p=t.substring(i,i+y),v=parseFloat(p)*h,d=t.substring(i+y),g=parseFloat(d)*h),{easting:v+l,northing:g+c,zoneLetter:s,zoneNumber:a,accuracy:h}}function Fyt(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function Gyt(t,e,r){if(!(this instanceof Gyt))return new Gyt(t,e,r);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var n=t.split(",");this.x=parseFloat(n[0],10),this.y=parseFloat(n[1],10),this.z=parseFloat(n[2],10)||0}else this.x=t,this.y=e,this.z=r||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Gyt.fromMGRS=function(t){return new Gyt(Iyt(t))},Gyt.prototype.toMGRS=function(t){return jyt([this.x,this.y],t)};var Uyt=Gyt,zyt=1,Vyt=.25,Hyt=.046875,qyt=.01953125,Wyt=.01068115234375,Yyt=.75,Xyt=.46875,Jyt=.013020833333333334,Kyt=.007120768229166667,Qyt=.3645833333333333,Zyt=.005696614583333333,$yt=.3076171875;function tvt(t){var e=[];e[0]=zyt-t*(Vyt+t*(Hyt+t*(qyt+t*Wyt))),e[1]=t*(Yyt-t*(Hyt+t*(qyt+t*Wyt)));var r=t*t;return e[2]=r*(Xyt-t*(Jyt+t*Kyt)),r*=t,e[3]=r*(Qyt-t*Zyt),e[4]=r*t*$yt,e}function evt(t,e,r,n){return r*=e,e*=e,n[0]*t-r*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}var rvt=20;function nvt(t,e,r){for(var n=1/(1-e),o=t,i=rvt;i;--i){var a=Math.sin(o),s=1-e*a*a;if(o-=s=(evt(o,a,Math.cos(o),r)-t)*(s*Math.sqrt(s))*n,Math.abs(s)sdt?Math.tan(i):0,d=Math.pow(p,2),y=Math.pow(d,2);e=1-this.es*Math.pow(s,2),l/=Math.sqrt(e);var v=evt(i,s,u,this.en);r=this.a*(this.k0*l*(1+c/6*(1-d+f+c/20*(5-18*d+y+14*f-58*d*f+c/42*(61+179*y-y*d-479*d)))))+this.x0,n=this.a*(this.k0*(v-this.ml0+s*a*l/2*(1+c/12*(5-d+9*f+4*h+c/30*(61+y-58*d+270*f-330*d*f+c/56*(1385+543*y-y*d-3111*d))))))+this.y0}else{var g=u*Math.sin(a);if(Math.abs(Math.abs(g)-1)=1){if(g-1>sdt)return 93;n=0}else n=Math.acos(n);i<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=r,t.y=n,t},inverse:function(t){var e,r,n,o,i=(t.x-this.x0)*(1/this.a),a=(t.y-this.y0)*(1/this.a);if(this.es)if(r=nvt(e=this.ml0+a/this.k0,this.es,this.en),Math.abs(r)sdt?Math.tan(r):0,c=this.ep2*Math.pow(u,2),f=Math.pow(c,2),h=Math.pow(l,2),p=Math.pow(h,2);e=1-this.es*Math.pow(s,2);var d=i*Math.sqrt(e)/this.k0,y=Math.pow(d,2);n=r-(e*=l)*y/(1-this.es)*.5*(1-y/12*(5+3*h-9*c*h+c-4*f-y/30*(61+90*h-252*c*h+45*p+46*c-y/56*(1385+3633*h+4095*p+1574*p*h)))),o=Gdt(this.long0+d*(1-y/6*(1+2*h+c-y/20*(5+28*h+24*p+8*c*h+6*c-y/42*(61+662*h+1320*p+720*p*h))))/u)}else n=ndt*Fdt(a),o=0;else{var v=Math.exp(i/this.k0),g=.5*(v-1/v),m=this.lat0+a/this.k0,b=Math.cos(m);e=Math.sqrt((1-Math.pow(b,2))/(1+Math.pow(g,2))),n=Math.asin(e),a<0&&(n=-n),o=0===g&&0===b?0:Gdt(Math.atan2(g,b)+this.long0)}return t.x=o,t.y=n,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function ivt(t){var e=Math.exp(t);return e=(e-1/e)/2}function avt(t,e){t=Math.abs(t),e=Math.abs(e);var r=Math.max(t,e),n=Math.min(t,e)/(r||1);return r*Math.sqrt(1+Math.pow(n,2))}function svt(t){var e=Math.abs(t);return e=function(t){var e=1+t,r=e-1;return 0===r?t:t*Math.log(e)/r}(e*(1+e/(avt(1,e)+1))),t<0?-e:e}function uvt(t,e){for(var r,n=2*Math.cos(2*e),o=t.length-1,i=t[o],a=0;--o>=0;)r=n*i-a+t[o],a=i,i=r;return e+r*Math.sin(2*e)}function lvt(t,e,r){for(var n,o,i=Math.sin(e),a=Math.cos(e),s=ivt(r),u=function(t){var e=Math.exp(t);return e=(e+1/e)/2}(r),l=2*a*u,c=-2*i*s,f=t.length-1,h=t[f],p=0,d=0,y=0;--f>=0;)n=d,o=p,h=l*(d=h)-n-c*(p=y)+t[f],y=c*d-o+l*p;return[(l=i*u)*h-(c=a*s)*y,l*y+c*h]}var cvt={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(ovt.init.apply(this),this.forward=ovt.forward,this.inverse=ovt.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),r=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),r*=e,this.cgb[1]=r*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=r*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),r*=e,this.cgb[2]=r*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=r*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),r*=e,this.cgb[3]=r*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=r*(1237/630+e*(e*(-24832/14175)-2.4)),r*=e,this.cgb[4]=r*(4174/315+e*(-144838/6237)),this.cbg[4]=r*(-734/315+e*(109598/31185)),r*=e,this.cgb[5]=r*(601676/22275),this.cbg[5]=r*(444337/155925),r=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+r*(.25+r*(1/64+r/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=r*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=r*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),r*=e,this.utg[2]=r*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=r*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),r*=e,this.utg[3]=r*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=r*(49561/161280+e*(-179/168+e*(6601661/7257600))),r*=e,this.utg[4]=r*(-4583/161280+e*(108847/3991680)),this.gtu[4]=r*(34729/80640+e*(-3418889/1995840)),r*=e,this.utg[5]=-.03233083094085698*r,this.gtu[5]=.6650675310896665*r;var n=uvt(this.cbg,this.lat0);this.Zb=-this.Qn*(n+function(t,e){for(var r,n=2*Math.cos(e),o=t.length-1,i=t[o],a=0;--o>=0;)r=n*i-a+t[o],a=i,i=r;return Math.sin(e)*r}(this.gtu,2*n))},forward:function(t){var e=Gdt(t.x-this.long0),r=t.y;r=uvt(this.cbg,r);var n=Math.sin(r),o=Math.cos(r),i=Math.sin(e),a=Math.cos(e);r=Math.atan2(n,a*o),e=Math.atan2(i*o,avt(n,o*a)),e=svt(Math.tan(e));var s,u,l=lvt(this.gtu,2*r,2*e);return r+=l[0],e+=l[1],Math.abs(e)<=2.623395162778?(s=this.a*(this.Qn*e)+this.x0,u=this.a*(this.Qn*r+this.Zb)+this.y0):(s=1/0,u=1/0),t.x=s,t.y=u,t},inverse:function(t){var e,r,n=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(o=(o-this.Zb)/this.Qn,n/=this.Qn,Math.abs(n)<=2.623395162778){var i=lvt(this.utg,2*o,2*n);o+=i[0],n+=i[1],n=Math.atan(ivt(n));var a=Math.sin(o),s=Math.cos(o),u=Math.sin(n),l=Math.cos(n);o=Math.atan2(a*l,avt(u,l*s)),e=Gdt((n=Math.atan2(u,l*s))+this.long0),r=uvt(this.cgb,o)}else e=1/0,r=1/0;return t.x=e,t.y=r,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"]};var fvt={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(Gdt(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*udt,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,cvt.init.apply(this),this.forward=cvt.forward,this.inverse=cvt.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function hvt(t,e){return Math.pow((1-t)/(1+t),e)}var pvt=20;var dvt={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+cdt)/(Math.pow(Math.tan(.5*this.lat0+cdt),this.C)*hvt(this.e*t,this.ratexp))},forward:function(t){var e=t.x,r=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+cdt),this.C)*hvt(this.e*Math.sin(r),this.ratexp))-ndt,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,r=t.y,n=Math.pow(Math.tan(.5*r+cdt)/this.K,1/this.C),o=pvt;o>0&&(r=2*Math.atan(n*hvt(this.e*Math.sin(t.y),-.5*this.e))-ndt,!(Math.abs(r-t.y)<1e-14));--o)t.y=r;return o?(t.x=e,t.y=r,t):null},names:["gauss"]};var yvt={init:function(){dvt.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,r,n,o;return t.x=Gdt(t.x-this.long0),dvt.forward.apply(this,[t]),e=Math.sin(t.y),r=Math.cos(t.y),n=Math.cos(t.x),o=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*r*n),t.x=o*r*Math.sin(t.x),t.y=o*(this.cosc0*e-this.sinc0*r*n),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,r,n,o,i;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,i=Math.sqrt(t.x*t.x+t.y*t.y)){var a=2*Math.atan2(i,this.R2);e=Math.sin(a),r=Math.cos(a),o=Math.asin(r*this.sinc0+t.y*e*this.cosc0/i),n=Math.atan2(t.x*e,i*this.cosc0*r-t.y*this.sinc0*e)}else o=this.phic0,n=0;return t.x=n,t.y=o,dvt.inverse.apply(this,[t]),t.x=Gdt(t.x+this.long0),t},names:["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};var vvt={init:function(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=sdt&&(this.k0=.5*(1+Fdt(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=sdt&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=sdt&&(this.k0=.5*this.cons*Bdt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Udt(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Bdt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-ndt,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,r,n,o,i,a,s=t.x,u=t.y,l=Math.sin(u),c=Math.cos(u),f=Gdt(s-this.long0);return Math.abs(Math.abs(s-this.long0)-Math.PI)<=sdt&&Math.abs(u+this.lat0)<=sdt?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*l+this.coslat0*c*Math.cos(f)),t.x=this.a*e*c*Math.sin(f)+this.x0,t.y=this.a*e*(this.coslat0*l-this.sinlat0*c*Math.cos(f))+this.y0,t):(r=2*Math.atan(this.ssfn_(u,l,this.e))-ndt,o=Math.cos(r),n=Math.sin(r),Math.abs(this.coslat0)<=sdt?(i=Udt(this.e,u*this.con,this.con*l),a=2*this.a*this.k0*i/this.cons,t.x=this.x0+a*Math.sin(s-this.long0),t.y=this.y0-this.con*a*Math.cos(s-this.long0),t):(Math.abs(this.sinlat0)0?Gdt(this.long0+Math.atan2(t.x,-1*t.y)):Gdt(this.long0+Math.atan2(t.x,t.y)):Gdt(this.long0+Math.atan2(t.x*Math.sin(s),a*this.coslat0*Math.cos(s)-t.y*this.sinlat0*Math.sin(s))),t.x=e,t.y=r,t)}if(Math.abs(this.coslat0)<=sdt){if(a<=sdt)return r=this.lat0,e=this.long0,t.x=e,t.y=r,t;t.x*=this.con,t.y*=this.con,n=a*this.cons/(2*this.a*this.k0),r=this.con*zdt(this.e,n),e=this.con*Gdt(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else o=2*Math.atan(a*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,a<=sdt?i=this.X0:(i=Math.asin(Math.cos(o)*this.sinX0+t.y*Math.sin(o)*this.cosX0/a),e=Gdt(this.long0+Math.atan2(t.x*Math.sin(o),a*this.cosX0*Math.cos(o)-t.y*this.sinX0*Math.sin(o)))),r=-1*zdt(this.e,Math.tan(.5*(ndt+i)));return t.x=e,t.y=r,t},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],ssfn_:function(t,e,r){return e*=r,Math.tan(.5*(ndt+t))*Math.pow((1-e)/(1+e),.5*r)}};var gvt={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),r=this.a,n=1/this.rf,o=2*n-Math.pow(n,2),i=this.e=Math.sqrt(o);this.R=this.k0*r*Math.sqrt(1-o)/(1-o*Math.pow(e,2)),this.alpha=Math.sqrt(1+o/(1-o)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),s=Math.log(Math.tan(Math.PI/4+t/2)),u=Math.log((1+i*e)/(1-i*e));this.K=a-this.alpha*s+this.alpha*i/2*u},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),r=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),n=-this.alpha*(e+r)+this.K,o=2*(Math.atan(Math.exp(n))-Math.PI/4),i=this.alpha*(t.x-this.lambda0),a=Math.atan(Math.sin(i)/(Math.sin(this.b0)*Math.tan(o)+Math.cos(this.b0)*Math.cos(i))),s=Math.asin(Math.cos(this.b0)*Math.sin(o)-Math.sin(this.b0)*Math.cos(o)*Math.cos(i));return t.y=this.R/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))+this.y0,t.x=this.R*a+this.x0,t},inverse:function(t){for(var e=t.x-this.x0,r=t.y-this.y0,n=e/this.R,o=2*(Math.atan(Math.exp(r/this.R))-Math.PI/4),i=Math.asin(Math.cos(this.b0)*Math.sin(o)+Math.sin(this.b0)*Math.cos(o)*Math.cos(n)),a=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(o))),s=this.lambda0+a/this.alpha,u=0,l=i,c=-1e3,f=0;Math.abs(l-c)>1e-7;){if(++f>20)return;u=1/this.alpha*(Math.log(Math.tan(Math.PI/4+i/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),c=l,l=2*Math.atan(Math.exp(u))-Math.PI/2}return t.x=s,t.y=l,t},names:["somerc"]},mvt=1e-7;var bvt={init:function(){var t,e,r,n,o,i,a,s,u,l,c,f,h,p=0,d=0,y=0,v=0,g=0,m=0,b=0;this.no_off=(h="object"==typeof(f=this).PROJECTION?Object.keys(f.PROJECTION)[0]:f.PROJECTION,"no_uoff"in f||"no_off"in f||-1!==["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(h)),this.no_rot="no_rot"in this;var w=!1;"alpha"in this&&(w=!0);var S=!1;if("rectified_grid_angle"in this&&(S=!0),w&&(b=this.alpha),S&&(p=this.rectified_grid_angle*udt),w||S)d=this.longc;else if(y=this.long1,g=this.lat1,v=this.long2,m=this.lat2,Math.abs(g-m)<=mvt||(t=Math.abs(g))<=mvt||Math.abs(t-ndt)<=mvt||Math.abs(Math.abs(this.lat0)-ndt)<=mvt||Math.abs(Math.abs(m)-ndt)<=mvt)throw new Error;var x=1-this.es;e=Math.sqrt(x),Math.abs(this.lat0)>sdt?(s=Math.sin(this.lat0),r=Math.cos(this.lat0),t=1-this.es*s*s,this.B=r*r,this.B=Math.sqrt(1+this.es*this.B*this.B/x),this.A=this.B*this.k0*e/t,(o=(n=this.B*e/(r*Math.sqrt(t)))*n-1)<=0?o=0:(o=Math.sqrt(o),this.lat0<0&&(o=-o)),this.E=o+=n,this.E*=Math.pow(Udt(this.e,this.lat0,s),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=o=1),w||S?(w?(c=Math.asin(Math.sin(b)/n),S||(p=b)):(c=p,b=Math.asin(n*Math.sin(c))),this.lam0=d-Math.asin(.5*(o-1/o)*Math.tan(c))/this.B):(i=Math.pow(Udt(this.e,g,Math.sin(g)),this.B),a=Math.pow(Udt(this.e,m,Math.sin(m)),this.B),o=this.E/i,u=(a-i)/(a+i),l=((l=this.E*this.E)-a*i)/(l+a*i),(t=y-v)<-Math.pi?v-=fdt:t>Math.pi&&(v+=fdt),this.lam0=Gdt(.5*(y+v)-Math.atan(l*Math.tan(.5*this.B*(y-v))/u)/this.B),c=Math.atan(2*Math.sin(this.B*Gdt(y-this.lam0))/(o-1/o)),p=b=Math.asin(n*Math.sin(c))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(p),this.cosrot=Math.cos(p),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.A,this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(b))),this.lat0<0&&(this.u_0=-this.u_0)),o=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(cdt-o)),this.v_pole_s=this.ArB*Math.log(Math.tan(cdt+o))},forward:function(t){var e,r,n,o,i,a,s,u,l={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-ndt)>sdt){if(e=.5*((i=this.E/Math.pow(Udt(this.e,t.y,Math.sin(t.y)),this.B))-(a=1/i)),r=.5*(i+a),o=Math.sin(this.B*t.x),n=(e*this.singam-o*this.cosgam)/r,Math.abs(Math.abs(n)-1)0?this.v_pole_n:this.v_pole_s,s=this.ArB*t.y;return this.no_rot?(l.x=s,l.y=u):(s-=this.u_0,l.x=u*this.cosrot+s*this.sinrot,l.y=s*this.cosrot-u*this.sinrot),l.x=this.a*l.x+this.x0,l.y=this.a*l.y+this.y0,l},inverse:function(t){var e,r,n,o,i,a,s,u={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(r=t.y,e=t.x):(r=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),o=.5*((n=Math.exp(-this.BrA*r))-1/n),i=.5*(n+1/n),s=((a=Math.sin(this.BrA*e))*this.cosgam+o*this.singam)/i,Math.abs(Math.abs(s)-1)sdt?this.ns=Math.log(n/s)/Math.log(o/u):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(o,this.ns)),this.rh=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,r=t.y;Math.abs(2*Math.abs(r)-Math.PI)<=sdt&&(r=Fdt(r)*(ndt-2*sdt));var n,o,i=Math.abs(Math.abs(r)-ndt);if(i>sdt)n=Udt(this.e,r,Math.sin(r)),o=this.a*this.f0*Math.pow(n,this.ns);else{if((i=r*this.ns)<=0)return null;o=0}var a=this.ns*Gdt(e-this.long0);return t.x=this.k0*(o*Math.sin(a))+this.x0,t.y=this.k0*(this.rh-o*Math.cos(a))+this.y0,t},inverse:function(t){var e,r,n,o,i,a=(t.x-this.x0)/this.k0,s=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(a*a+s*s),r=1):(e=-Math.sqrt(a*a+s*s),r=-1);var u=0;if(0!==e&&(u=Math.atan2(r*a,r*s)),0!==e||this.ns>0){if(r=1/this.ns,n=Math.pow(e/(this.a*this.f0),r),-9999===(o=zdt(this.e,n)))return null}else o=-ndt;return i=Gdt(u/this.ns+this.long0),t.x=i,t.y=o,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]};var Svt={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,r,n,o,i,a,s,u=t.x,l=t.y,c=Gdt(u-this.long0);return e=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/e)-this.s45),n=-c*this.alfa,o=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(n)),i=Math.asin(Math.cos(r)*Math.sin(n)/Math.cos(o)),a=this.n*i,s=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(o/2+this.s45),this.n),t.y=s*Math.cos(a)/1,t.x=s*Math.sin(a)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var e,r,n,o,i,a,s,u=t.x;t.x=t.y,t.y=u,this.czech||(t.y*=-1,t.x*=-1),i=Math.sqrt(t.x*t.x+t.y*t.y),o=Math.atan2(t.y,t.x)/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/i,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(o)),r=Math.asin(Math.cos(n)*Math.sin(o)/Math.cos(e)),t.x=this.long0-r/this.alfa,a=e,s=0;var l=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-t.y)<1e-10&&(s=1),a=t.y,l+=1}while(0===s&&l<15);return l>=15?null:t},names:["Krovak","krovak"]};function xvt(t,e,r,n,o){return t*o-e*Math.sin(2*o)+r*Math.sin(4*o)-n*Math.sin(6*o)}function _vt(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function Evt(t){return.375*t*(1+.25*t*(1+.46875*t))}function Ovt(t){return.05859375*t*t*(1+.75*t)}function Pvt(t){return t*t*t*(35/3072)}function kvt(t,e,r){var n=e*r;return t/Math.sqrt(1-n*n)}function Cvt(t){return Math.abs(t)1e-7?(1-t*t)*(e/(1-(r=t*e)*r)-.5/t*Math.log((1-r)/(1+r))):2*e}var jvt=.3333333333333333,Ivt=.17222222222222222,Nvt=.10257936507936508,Lvt=.06388888888888888,Rvt=.0664021164021164,Dvt=.016415012942191543;var Bvt={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-ndt)0)switch(this.qp=Mvt(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,r=[];return r[0]=t*jvt,e=t*t,r[0]+=e*Ivt,r[1]=e*Lvt,e*=t,r[0]+=e*Nvt,r[1]+=e*Rvt,r[2]=e*Dvt,r}(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=Mvt(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,r,n,o,i,a,s,u,l,c,f=t.x,h=t.y;if(f=Gdt(f-this.long0),this.sphere){if(i=Math.sin(h),c=Math.cos(h),n=Math.cos(f),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((r=this.mode===this.EQUIT?1+c*n:1+this.sinph0*i+this.cosph0*c*n)<=sdt)return null;e=(r=Math.sqrt(2/r))*c*Math.sin(f),r*=this.mode===this.EQUIT?i:this.cosph0*i-this.sinph0*c*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(h+this.lat0)=0?(e=(l=Math.sqrt(a))*o,r=n*(this.mode===this.S_POLE?l:-l)):e=r=0}}return t.x=this.a*e+this.x0,t.y=this.a*r+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,r,n,o,i,a,s,u,l,c,f=t.x/this.a,h=t.y/this.a;if(this.sphere){var p,d=0,y=0;if((r=.5*(p=Math.sqrt(f*f+h*h)))>1)return null;switch(r=2*Math.asin(r),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(y=Math.sin(r),d=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(p)<=sdt?0:Math.asin(h*y/p),f*=y,h=d*p;break;case this.OBLIQ:r=Math.abs(p)<=sdt?this.lat0:Math.asin(d*this.sinph0+h*y*this.cosph0/p),f*=y*this.cosph0,h=(d-Math.sin(r)*this.sinph0)*p;break;case this.N_POLE:h=-h,r=ndt-r;break;case this.S_POLE:r-=ndt}e=0!==h||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(f,h):0}else{if(s=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(f/=this.dd,h*=this.dd,(a=Math.sqrt(f*f+h*h))1&&(t=t>1?1:-1),Math.asin(t)}var Gvt={init:function(){Math.abs(this.lat1+this.lat2)sdt?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,r=t.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var n=Mvt(this.e3,this.sin_phi),o=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,i=this.ns0*Gdt(e-this.long0),a=o*Math.sin(i)+this.x0,s=this.rh-o*Math.cos(i)+this.y0;return t.x=a,t.y=s,t},inverse:function(t){var e,r,n,o,i,a;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),n=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),n=-1),o=0,0!==e&&(o=Math.atan2(n*t.x,n*t.y)),n=e*this.ns0/this.a,this.sphere?a=Math.asin((this.c-n*n)/(2*this.ns0)):(r=(this.c-n*n)/this.ns0,a=this.phi1z(this.e3,r)),i=Gdt(o/this.ns0+this.long0),t.x=i,t.y=a,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,e){var r,n,o,i,a,s=Fvt(.5*e);if(t0||Math.abs(i)<=sdt?(a=this.x0+1*this.a*r*Math.sin(n)/i,s=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*r*o)/i):(a=this.x0+this.infinity_dist*r*Math.sin(n),s=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*r*o)),t.x=a,t.y=s,t},inverse:function(t){var e,r,n,o,i,a;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(o=Math.atan2(e,this.rc),r=Math.sin(o),a=Fvt((n=Math.cos(o))*this.sin_p14+t.y*r*this.cos_p14/e),i=Math.atan2(t.x*r,e*this.cos_p14*n-t.y*this.sin_p14*r),i=Gdt(this.long0+i)):(a=this.phic0,i=0),t.x=i,t.y=a,t},names:["gnom"]};var zvt={init:function(){this.sphere||(this.k0=Bdt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,r,n=t.x,o=t.y,i=Gdt(n-this.long0);if(this.sphere)e=this.x0+this.a*i*Math.cos(this.lat_ts),r=this.y0+this.a*Math.sin(o)/Math.cos(this.lat_ts);else{var a=Mvt(this.e,Math.sin(o));e=this.x0+this.a*this.k0*i,r=this.y0+this.a*a*.5/this.k0}return t.x=e,t.y=r,t},inverse:function(t){var e,r;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=Gdt(this.long0+t.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(r=function(t,e){var r=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-r)<1e-6)return e<0?-1*ndt:ndt;for(var n,o,i,a,s=Math.asin(.5*e),u=0;u<30;u++)if(o=Math.sin(s),i=Math.cos(s),a=t*o,s+=n=Math.pow(1-a*a,2)/(2*i)*(e/(1-t*t)-o/(1-a*a)+.5/t*Math.log((1-a)/(1+a))),Math.abs(n)<=1e-10)return s;return NaN}(this.e,2*t.y*this.k0/this.a),e=Gdt(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=r,t},names:["cea"]};var Vvt={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,r=t.y,n=Gdt(e-this.long0),o=Cvt(r-this.lat0);return t.x=this.x0+this.a*n*this.rc,t.y=this.y0+this.a*o,t},inverse:function(t){var e=t.x,r=t.y;return t.x=Gdt(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=Cvt(this.lat0+(r-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","eqc"]},Hvt=20;var qvt={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=_vt(this.es),this.e1=Evt(this.es),this.e2=Ovt(this.es),this.e3=Pvt(this.es),this.ml0=this.a*xvt(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,r,n,o=t.x,i=t.y,a=Gdt(o-this.long0);if(n=a*Math.sin(i),this.sphere)Math.abs(i)<=sdt?(e=this.a*a,r=-1*this.a*this.lat0):(e=this.a*Math.sin(n)/Math.tan(i),r=this.a*(Cvt(i-this.lat0)+(1-Math.cos(n))/Math.tan(i)));else if(Math.abs(i)<=sdt)e=this.a*a,r=-1*this.ml0;else{var s=kvt(this.a,this.e,Math.sin(i))/Math.tan(i);e=s*Math.sin(n),r=this.a*xvt(this.e0,this.e1,this.e2,this.e3,i)-this.ml0+s*(1-Math.cos(n))}return t.x=e+this.x0,t.y=r+this.y0,t},inverse:function(t){var e,r,n,o,i,a,s,u,l;if(n=t.x-this.x0,o=t.y-this.y0,this.sphere)if(Math.abs(o+this.a*this.lat0)<=sdt)e=Gdt(n/this.a+this.long0),r=0;else{var c;for(a=this.lat0+o/this.a,s=n*n/this.a/this.a+a*a,u=a,i=Hvt;i;--i)if(u+=l=-1*(a*(u*(c=Math.tan(u))+1)-u-.5*(u*u+s)*c)/((u-a)/c-1),Math.abs(l)<=sdt){r=u;break}e=Gdt(this.long0+Math.asin(n*Math.tan(u)/this.a)/Math.sin(r))}else if(Math.abs(o+this.ml0)<=sdt)r=0,e=Gdt(this.long0+n/this.a);else{var f,h,p,d,y;for(a=(this.ml0+o)/this.a,s=n*n/this.a/this.a+a*a,u=a,i=Hvt;i;--i)if(y=this.e*Math.sin(u),f=Math.sqrt(1-y*y)*Math.tan(u),h=this.a*xvt(this.e0,this.e1,this.e2,this.e3,u),p=this.e0-2*this.e1*Math.cos(2*u)+4*this.e2*Math.cos(4*u)-6*this.e3*Math.cos(6*u),u-=l=(a*(f*(d=h/this.a)+1)-d-.5*f*(d*d+s))/(this.es*Math.sin(2*u)*(d*d+s-2*a*d)/(4*f)+(a-d)*(f*p-2/Math.sin(2*u))-p),Math.abs(l)<=sdt){r=u;break}f=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),e=Gdt(this.long0+Math.asin(n*f/this.a)/Math.sin(r))}return t.x=e,t.y=r,t},names:["Polyconic","poly"]};var Wvt={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,r=t.x,n=t.y-this.lat0,o=r-this.long0,i=n/rdt*1e-5,a=o,s=1,u=0;for(e=1;e<=10;e++)s*=i,u+=this.A[e]*s;var l,c=u,f=a,h=1,p=0,d=0,y=0;for(e=1;e<=6;e++)l=p*c+h*f,h=h*c-p*f,p=l,d=d+this.B_re[e]*h-this.B_im[e]*p,y=y+this.B_im[e]*h+this.B_re[e]*p;return t.x=y*this.a+this.x0,t.y=d*this.a+this.y0,t},inverse:function(t){var e,r,n=t.x,o=t.y,i=n-this.x0,a=(o-this.y0)/this.a,s=i/this.a,u=1,l=0,c=0,f=0;for(e=1;e<=6;e++)r=l*a+u*s,u=u*a-l*s,l=r,c=c+this.C_re[e]*u-this.C_im[e]*l,f=f+this.C_im[e]*u+this.C_re[e]*l;for(var h=0;h.999999999999&&(r=.999999999999),e=Math.asin(r);var n=Gdt(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),r=(2*e+Math.sin(2*e))/Math.PI,Math.abs(r)>1&&(r=1);var o=Math.asin(r);return t.x=n,t.y=o,t},names:["Mollweide","moll"]};var Qvt={init:function(){Math.abs(this.lat1+this.lat2)=0?(r=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(r=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var i=0;return 0!==r&&(i=Math.atan2(e*t.x,e*t.y)),this.sphere?(o=Gdt(this.long0+i/this.ns),n=Cvt(this.g-r/this.a),t.x=o,t.y=n,t):(n=Tvt(this.g-r/this.a,this.e0,this.e1,this.e2,this.e3),o=Gdt(this.long0+i/this.ns),t.x=o,t.y=n,t)},names:["Equidistant_Conic","eqdc"]};var Zvt={init:function(){this.R=this.a},forward:function(t){var e,r,n=t.x,o=t.y,i=Gdt(n-this.long0);Math.abs(o)<=sdt&&(e=this.x0+this.R*i,r=this.y0);var a=Fvt(2*Math.abs(o/Math.PI));(Math.abs(i)<=sdt||Math.abs(Math.abs(o)-ndt)<=sdt)&&(e=this.x0,r=o>=0?this.y0+Math.PI*this.R*Math.tan(.5*a):this.y0+Math.PI*this.R*-Math.tan(.5*a));var s=.5*Math.abs(Math.PI/i-i/Math.PI),u=s*s,l=Math.sin(a),c=Math.cos(a),f=c/(l+c-1),h=f*f,p=f*(2/l-1),d=p*p,y=Math.PI*this.R*(s*(f-d)+Math.sqrt(u*(f-d)*(f-d)-(d+u)*(h-d)))/(d+u);i<0&&(y=-y),e=this.x0+y;var v=u+f;return y=Math.PI*this.R*(p*v-s*Math.sqrt((d+u)*(u+1)-v*v))/(d+u),r=o>=0?this.y0+y:this.y0-y,t.x=e,t.y=r,t},inverse:function(t){var e,r,n,o,i,a,s,u,l,c,f,h;return t.x-=this.x0,t.y-=this.y0,f=Math.PI*this.R,i=(n=t.x/f)*n+(o=t.y/f)*o,f=3*(o*o/(u=-2*(a=-Math.abs(o)*(1+i))+1+2*o*o+i*i)+(2*(s=a-2*o*o+n*n)*s*s/u/u/u-9*a*s/u/u)/27)/(l=(a-s*s/3/u)/u)/(c=2*Math.sqrt(-l/3)),Math.abs(f)>1&&(f=f>=0?1:-1),h=Math.acos(f)/3,r=t.y>=0?(-c*Math.cos(h+Math.PI/3)-s/3/u)*Math.PI:-(-c*Math.cos(h+Math.PI/3)-s/3/u)*Math.PI,e=Math.abs(n)2*ndt*this.a)return;return r=e/this.a,n=Math.sin(r),o=Math.cos(r),i=this.long0,Math.abs(e)<=sdt?a=this.lat0:(a=Fvt(o*this.sin_p12+t.y*n*this.cos_p12/e),s=Math.abs(this.lat0)-ndt,i=Math.abs(s)<=sdt?this.lat0>=0?Gdt(this.long0+Math.atan2(t.x,-t.y)):Gdt(this.long0-Math.atan2(-t.x,t.y)):Gdt(this.long0+Math.atan2(t.x*n,e*this.cos_p12*o-t.y*this.sin_p12*n))),t.x=i,t.y=a,t}return u=_vt(this.es),l=Evt(this.es),c=Ovt(this.es),f=Pvt(this.es),Math.abs(this.sin_p12-1)<=sdt?(a=Tvt(((h=this.a*xvt(u,l,c,f,ndt))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,u,l,c,f),i=Gdt(this.long0+Math.atan2(t.x,-1*t.y)),t.x=i,t.y=a,t):Math.abs(this.sin_p12+1)<=sdt?(h=this.a*xvt(u,l,c,f,ndt),a=Tvt(((e=Math.sqrt(t.x*t.x+t.y*t.y))-h)/this.a,u,l,c,f),i=Gdt(this.long0+Math.atan2(t.x,t.y)),t.x=i,t.y=a,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),y=Math.atan2(t.x,t.y),p=kvt(this.a,this.e,this.sin_p12),v=Math.cos(y),m=-(g=this.e*this.cos_p12*v)*g/(1-this.es),b=3*this.es*(1-m)*this.sin_p12*this.cos_p12*v/(1-this.es),x=1-m*(S=(w=e/p)-m*(1+m)*Math.pow(w,3)/6-b*(1+3*m)*Math.pow(w,4)/24)*S/2-w*S*S*S/6,d=Math.asin(this.sin_p12*Math.cos(S)+this.cos_p12*Math.sin(S)*v),i=Gdt(this.long0+Math.asin(Math.sin(y)*Math.sin(S)/Math.cos(d))),_=Math.sin(d),a=Math.atan2((_-this.es*x*this.sin_p12)*Math.tan(d),_*(1-this.es)),t.x=i,t.y=a,t)},names:["Azimuthal_Equidistant","aeqd"]};var tgt={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var e,r,n,o,i,a,s,u=t.x,l=t.y;return n=Gdt(u-this.long0),e=Math.sin(l),r=Math.cos(l),o=Math.cos(n),((i=this.sin_p14*e+this.cos_p14*r*o)>0||Math.abs(i)<=sdt)&&(a=1*this.a*r*Math.sin(n),s=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*r*o)),t.x=a,t.y=s,t},inverse:function(t){var e,r,n,o,i,a,s;return t.x-=this.x0,t.y-=this.y0,r=Fvt((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),n=Math.sin(r),o=Math.cos(r),a=this.long0,Math.abs(e)<=sdt?(s=this.lat0,t.x=a,t.y=s,t):(s=Fvt(o*this.sin_p14+t.y*n*this.cos_p14/e),i=Math.abs(this.lat0)-ndt,Math.abs(i)<=sdt?(a=this.lat0>=0?Gdt(this.long0+Math.atan2(t.x,-t.y)):Gdt(this.long0-Math.atan2(-t.x,t.y)),t.x=a,t.y=s,t):(a=Gdt(this.long0+Math.atan2(t.x*n,e*this.cos_p14*o-t.y*this.sin_p14*n)),t.x=a,t.y=s,t))},names:["ortho"]},egt={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},rgt={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function ngt(t,e,r,n){var o;return tcdt&&o<=ndt+cdt?(n.value=rgt.AREA_1,o-=ndt):o>ndt+cdt||o<=-(ndt+cdt)?(n.value=rgt.AREA_2,o=o>=0?o-hdt:o+hdt):(n.value=rgt.AREA_3,o+=ndt)),o}function ogt(t,e){var r=t+e;return r<-hdt?r+=fdt:r>+hdt&&(r-=fdt),r}var igt={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=ndt-cdt/2?this.face=egt.TOP:this.lat0<=-(ndt-cdt/2)?this.face=egt.BOTTOM:Math.abs(this.long0)<=cdt?this.face=egt.FRONT:Math.abs(this.long0)<=ndt+cdt?this.face=this.long0>0?egt.RIGHT:egt.LEFT:this.face=egt.BACK,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,r,n,o,i,a,s={x:0,y:0},u={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,r=t.x,this.face===egt.TOP)o=ndt-e,r>=cdt&&r<=ndt+cdt?(u.value=rgt.AREA_0,n=r-ndt):r>ndt+cdt||r<=-(ndt+cdt)?(u.value=rgt.AREA_1,n=r>0?r-hdt:r+hdt):r>-(ndt+cdt)&&r<=-cdt?(u.value=rgt.AREA_2,n=r+ndt):(u.value=rgt.AREA_3,n=r);else if(this.face===egt.BOTTOM)o=ndt+e,r>=cdt&&r<=ndt+cdt?(u.value=rgt.AREA_0,n=-r+ndt):r=-cdt?(u.value=rgt.AREA_1,n=-r):r<-cdt&&r>=-(ndt+cdt)?(u.value=rgt.AREA_2,n=-r-ndt):(u.value=rgt.AREA_3,n=r>0?-r+hdt:-r-hdt);else{var l,c,f,h,p,d;this.face===egt.RIGHT?r=ogt(r,+ndt):this.face===egt.BACK?r=ogt(r,+hdt):this.face===egt.LEFT&&(r=ogt(r,-ndt)),h=Math.sin(e),p=Math.cos(e),d=Math.sin(r),l=p*Math.cos(r),c=p*d,f=h,this.face===egt.FRONT?n=ngt(o=Math.acos(l),f,c,u):this.face===egt.RIGHT?n=ngt(o=Math.acos(c),f,-l,u):this.face===egt.BACK?n=ngt(o=Math.acos(-l),f,-c,u):this.face===egt.LEFT?n=ngt(o=Math.acos(-c),f,l,u):(o=n=0,u.value=rgt.AREA_0)}return a=Math.atan(12/hdt*(n+Math.acos(Math.sin(n)*Math.cos(cdt))-ndt)),i=Math.sqrt((1-Math.cos(o))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(n))))),u.value===rgt.AREA_1?a+=ndt:u.value===rgt.AREA_2?a+=hdt:u.value===rgt.AREA_3&&(a+=1.5*hdt),s.x=i*Math.cos(a),s.y=i*Math.sin(a),s.x=s.x*this.a+this.x0,s.y=s.y*this.a+this.y0,t.x=s.x,t.y=s.y,t},inverse:function(t){var e,r,n,o,i,a,s,u,l,c,f,h,p={lam:0,phi:0},d={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,r=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?d.value=rgt.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(d.value=rgt.AREA_1,e-=ndt):t.x<0&&-t.x>=Math.abs(t.y)?(d.value=rgt.AREA_2,e=e<0?e+hdt:e-hdt):(d.value=rgt.AREA_3,e+=ndt),l=hdt/12*Math.tan(e),i=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),a=Math.atan(i),(s=1-(n=Math.cos(e))*n*(o=Math.tan(r))*o*(1-Math.cos(Math.atan(1/Math.cos(a)))))<-1?s=-1:s>1&&(s=1),this.face===egt.TOP)u=Math.acos(s),p.phi=ndt-u,d.value===rgt.AREA_0?p.lam=a+ndt:d.value===rgt.AREA_1?p.lam=a<0?a+hdt:a-hdt:d.value===rgt.AREA_2?p.lam=a-ndt:p.lam=a;else if(this.face===egt.BOTTOM)u=Math.acos(s),p.phi=u-ndt,d.value===rgt.AREA_0?p.lam=-a+ndt:d.value===rgt.AREA_1?p.lam=-a:d.value===rgt.AREA_2?p.lam=-a-ndt:p.lam=a<0?-a-hdt:-a+hdt;else{var y,v,g;l=(y=s)*y,v=(l+=(g=l>=1?0:Math.sqrt(1-l)*Math.sin(a))*g)>=1?0:Math.sqrt(1-l),d.value===rgt.AREA_1?(l=v,v=-g,g=l):d.value===rgt.AREA_2?(v=-v,g=-g):d.value===rgt.AREA_3&&(l=v,v=g,g=-l),this.face===egt.RIGHT?(l=y,y=-v,v=l):this.face===egt.BACK?(y=-y,v=-v):this.face===egt.LEFT&&(l=y,y=v,v=-l),p.phi=Math.acos(-g)-ndt,p.lam=Math.atan2(v,y),this.face===egt.RIGHT?p.lam=ogt(p.lam,-ndt):this.face===egt.BACK?p.lam=ogt(p.lam,-hdt):this.face===egt.LEFT&&(p.lam=ogt(p.lam,+ndt))}return 0!==this.es&&(c=p.phi<0?1:0,f=Math.tan(p.phi),h=this.b/Math.sqrt(f*f+this.one_minus_f_squared),p.phi=Math.atan(Math.sqrt(this.a*this.a-h*h)/(this.one_minus_f*h)),c&&(p.phi=-p.phi)),p.lam+=this.long0,t.x=p.lam,t.y=p.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},agt=[[1,2.2199e-17,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],sgt=[[-5.20417e-18,.0124,1.21431e-18,-8.45284e-11],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],ugt=.8487,lgt=1.3523,cgt=ldt/5,fgt=1/cgt,hgt=18,pgt=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))},dgt=function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])};var ygt={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=Gdt(t.x-this.long0),r=Math.abs(t.y),n=Math.floor(r*cgt);n<0?n=0:n>=hgt&&(n=hgt-1),r=ldt*(r-fgt*n);var o={x:pgt(agt[n],r)*e,y:pgt(sgt[n],r)};return t.y<0&&(o.y=-o.y),o.x=o.x*this.a*ugt+this.x0,o.y=o.y*this.a*lgt+this.y0,o},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*ugt),y:Math.abs(t.y-this.y0)/(this.a*lgt)};if(e.y>=1)e.x/=agt[hgt][0],e.y=t.y<0?-ndt:ndt;else{var r=Math.floor(e.y*hgt);for(r<0?r=0:r>=hgt&&(r=hgt-1);;)if(sgt[r][0]>e.y)--r;else{if(!(sgt[r+1][0]<=e.y))break;++r}var n=sgt[r],o=5*(e.y-n[0])/(sgt[r+1][0]-n[0]);o=function(t,e,r,n){for(var o=e;n;--n){var i=t(o);if(o-=i,Math.abs(i)1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(t){var e,r,n,o,i=t.x,a=t.y;if(i-=this.long0,"ellipse"===this.shape){a=Math.atan(this.radius_p2*Math.tan(a));var s=this.radius_p/avt(this.radius_p*Math.cos(a),Math.sin(a));if(r=s*Math.cos(i)*Math.cos(a),n=s*Math.sin(i)*Math.cos(a),o=s*Math.sin(a),(this.radius_g-r)*r-n*n-o*o*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-r,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/avt(o,e)),t.y=this.radius_g_1*Math.atan(o/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(o/avt(n,e)))}else"sphere"===this.shape&&(e=Math.cos(a),r=Math.cos(i)*e,n=Math.sin(i)*e,o=Math.sin(a),e=this.radius_g-r,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/avt(o,e)),t.y=this.radius_g_1*Math.atan(o/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(o/avt(n,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,r,n,o,i=-1,a=0,s=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(s=Math.tan(t.y/this.radius_g_1),a=Math.tan(t.x/this.radius_g_1)*avt(1,s)):(a=Math.tan(t.x/this.radius_g_1),s=Math.tan(t.y/this.radius_g_1)*avt(1,a));var u=s/this.radius_p;if(e=a*a+u*u+i*i,(n=(r=2*this.radius_g*i)*r-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;o=(-r-Math.sqrt(n))/(2*e),i=this.radius_g+o*i,a*=o,s*=o,t.x=Math.atan2(a,i),t.y=Math.atan(s*Math.cos(t.x)/i),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(s=Math.tan(t.y/this.radius_g_1),a=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+s*s)):(a=Math.tan(t.x/this.radius_g_1),s=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+a*a)),e=a*a+s*s+i*i,(n=(r=2*this.radius_g*i)*r-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;o=(-r-Math.sqrt(n))/(2*e),i=this.radius_g+o*i,a*=o,s*=o,t.x=Math.atan2(a,i),t.y=Math.atan(s*Math.cos(t.x)/i)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};xyt.defaultDatum="WGS84",xyt.Proj=syt,xyt.WGS84=new xyt.Proj("WGS84"),xyt.Point=Uyt,xyt.toPoint=vyt,xyt.defs=Idt,xyt.nadgrid=function(t,e){var r=new DataView(e),n=function(t){var e=t.getInt32(8,!1);return 11!==e&&(11!==(e=t.getInt32(8,!0))&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}(r),o=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:ryt(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(r,n);o.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var i={header:o,subgrids:function(t,e,r){for(var n=[],o=0;o=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:M(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function Egt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function Ogt(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},r=new qpt(JW,t,e);return r.getMapInfo((n=Cgt(_gt().mark(function n(o,i,a){var s,u,l,c,f,h;return _gt().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,"processCompleted"!==o.type){n.next=15;break}if(s=o.result,u=s.dynamicProjection,l=s.prjCoordSys,c=l.epsgCode,!Wpt(l.type)){n.next=6;break}return a(new Error("mapbox-gl cannot support plane coordinate system.")),n.abrupt("return");case 6:if(3857===c||u||w().CRS){n.next=9;break}return a(new Error("The EPSG code ".concat(c," needs to include mapbox-gl-enhance.js. Refer to the example: https://iclient.supermap.io/examples/mapboxgl/editor.html#mvtVectorTile_2362"))),n.abrupt("return");case 9:return n.next=11,Igt(t,o.result,Ogt(Ogt({},e),{},{initMapService:r}));case 11:return f=n.sent,h=new(w().Map)(f),f.style&&f.style.layers&&f.style.layers.length>0?h.on("load",function(){i({map:h})}):i({map:h}),n.abrupt("return");case 15:a(new Error("Fetch mapService is failed.")),n.next=21;break;case 18:n.prev=18,n.t0=n.catch(0),a(n.t0);case 21:case"end":return n.stop()}},n,null,[[0,18]])})),function(t,e,r){return n.apply(this,arguments)}));var n},w().supermap.WebMapV3=Npt,w().supermap.Graphic=kN,w().supermap.map.getDefaultVectorTileStyle=function(t,e){e=e||{};var r={};r.version=e.version||8,r.layers=e.layers||[],r.light=e.light||{anchor:"viewport",color:"#fcf6ef",intensity:.5,position:[1.15,201,20]};var n={version:r.version,sources:{"vector-tiles":{type:"vector",tiles:[t]}},layers:r.layers,light:r.light};return null!=e.sprite&&(n.sprite=e.sprite),null!=e.glyphs&&(n.glyphs=e.glyphs),n},w().supermap.map.setBackground=function(t,e){e&&t&&t.addLayer({id:"background",type:"background",paint:{"background-color":e}},"background")},w().supermap.map.setPaintProperty=function(t,e,r,n,o,i){if(e&&t){"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]);for(var a=0;a=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),l=a.call(i,"finallyLoc");if(u&&l){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),b}},r}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},96:function(t){function e(r){"@babel/helpers - typeof";return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},9514:function(t,e,r){function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(8663)();t.exports=o;try{regeneratorRuntime=o}catch(t){"object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}},961:function(t,e,r){"use strict";var n=r(3712);t.exports=n},9784:function(t,e,r){"use strict";var n=r(6433);t.exports=n},9435:function(t,e,r){"use strict";r(7851);var n=r(5329);t.exports=n.Object.assign},8142:function(t,e,r){"use strict";r(494);var n=r(9385);t.exports=n.f("asyncIterator")},7644:function(t,e,r){"use strict";var n=r(2631),o=r(4861),i=TypeError;t.exports=function(t){if(n(t))return t;throw new i(o(t)+" is not a function")}},9809:function(t,e,r){"use strict";var n=r(6220),o=String,i=TypeError;t.exports=function(t){if(n(t))return t;throw new i(o(t)+" is not an object")}},7943:function(t,e,r){"use strict";var n=r(1059),o=r(7636),i=r(428),a=function(t){return function(e,r,a){var s=n(e),u=i(s);if(0===u)return!t&&-1;var l,c=o(a,u);if(t&&r!=r){for(;u>c;)if((l=s[c++])!=l)return!0}else for(;u>c;c++)if((t||c in s)&&s[c]===r)return t||c||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},4538:function(t,e,r){"use strict";var n=r(398),o=n({}.toString),i=n("".slice);t.exports=function(t){return i(o(t),8,-1)}},578:function(t,e,r){"use strict";var n=r(2791),o=r(7197),i=r(1805),a=r(1807);t.exports=function(t,e,r){for(var s=o(e),u=a.f,l=i.f,c=0;c0&&n[0]<4?1:+(n[0]+n[1])),!o&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(o=+n[1]),t.exports=o},1009:function(t){"use strict";t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3768:function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(1697),i=r(1805).f,a=r(5233),s=r(5414),u=r(6507),l=r(578),c=r(3670);t.exports=function(t,e){var r,f,h,p,d,y=t.target,v=t.global,g=t.stat;if(r=v?o:g?o[y]||u(y,{}):o[y]&&o[y].prototype)for(f in e){if(p=e[f],h=t.dontCallGetSet?(d=i(r,f))&&d.value:r[f],!c(v?f:y+(g?".":"#")+f,t.forced)&&void 0!==h){if(n(p)==n(h))continue;l(p,h)}(t.sham||h&&h.sham)&&a(p,"sham",!0),s(r,f,p,t)}}},4877:function(t){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},8574:function(t,e,r){"use strict";var n=r(4877);t.exports=!n(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},9707:function(t,e,r){"use strict";var n=r(8574),o=Function.prototype.call;t.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},2756:function(t,e,r){"use strict";var n=r(9234),o=r(2791),i=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=o(i,"name"),u=s&&"something"===function(){}.name,l=s&&(!n||n&&a(i,"name").configurable);t.exports={EXISTS:s,PROPER:u,CONFIGURABLE:l}},398:function(t,e,r){"use strict";var n=r(8574),o=Function.prototype,i=o.call,a=n&&o.bind.bind(i,i);t.exports=n?a:function(t){return function(){return i.apply(t,arguments)}}},5189:function(t,e,r){"use strict";var n=r(1697),o=r(2631);t.exports=function(t,e){return arguments.length<2?(r=n[t],o(r)?r:void 0):n[t]&&n[t][e];var r}},2968:function(t,e,r){"use strict";var n=r(7644),o=r(155);t.exports=function(t,e){var r=t[e];return o(r)?void 0:n(r)}},1697:function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=function(t){return t&&t.Math===Math&&t};t.exports=o("object"==("undefined"==typeof globalThis?"undefined":n(globalThis))&&globalThis)||o("object"==("undefined"==typeof window?"undefined":n(window))&&window)||o("object"==("undefined"==typeof self?"undefined":n(self))&&self)||o("object"==(void 0===r.g?"undefined":n(r.g))&&r.g)||o("object"==n(this)&&this)||function(){return this}()||Function("return this")()},2791:function(t,e,r){"use strict";var n=r(398),o=r(6079),i=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(o(t),e)}},8551:function(t){"use strict";t.exports={}},107:function(t,e,r){"use strict";var n=r(9234),o=r(4877),i=r(2533);t.exports=!n&&!o(function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})},9213:function(t,e,r){"use strict";var n=r(398),o=r(4877),i=r(4538),a=Object,s=n("".split);t.exports=o(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"===i(t)?s(t,""):a(t)}:a},3128:function(t,e,r){"use strict";var n=r(398),o=r(2631),i=r(4243),a=n(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return a(t)}),t.exports=i.inspectSource},7863:function(t,e,r){"use strict";var n,o,i,a=r(5032),s=r(1697),u=r(6220),l=r(5233),c=r(2791),f=r(4243),h=r(109),p=r(8551),d=s.TypeError,y=s.WeakMap;if(a||f.state){var v=f.state||(f.state=new y);v.get=v.get,v.has=v.has,v.set=v.set,n=function(t,e){if(v.has(t))throw new d("Object already initialized");return e.facade=t,v.set(t,e),e},o=function(t){return v.get(t)||{}},i=function(t){return v.has(t)}}else{var g=h("state");p[g]=!0,n=function(t,e){if(c(t,g))throw new d("Object already initialized");return e.facade=t,l(t,g,e),e},o=function(t){return c(t,g)?t[g]:{}},i=function(t){return c(t,g)}}t.exports={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var r;if(!u(e)||(r=o(e)).type!==t)throw new d("Incompatible receiver, "+t+" required");return r}}}},2631:function(t){"use strict";function e(t){"@babel/helpers - typeof";return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r="object"==("undefined"==typeof document?"undefined":e(document))&&document.all;t.exports=void 0===r&&void 0!==r?function(t){return"function"==typeof t||t===r}:function(t){return"function"==typeof t}},3670:function(t,e,r){"use strict";var n=r(4877),o=r(2631),i=/#|\.prototype\./,a=function(t,e){var r=u[s(t)];return r===c||r!==l&&(o(e)?n(e):!!e)},s=a.normalize=function(t){return String(t).replace(i,".").toLowerCase()},u=a.data={},l=a.NATIVE="N",c=a.POLYFILL="P";t.exports=a},155:function(t){"use strict";t.exports=function(t){return null===t||void 0===t}},6220:function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(2631);t.exports=function(t){return"object"==n(t)?null!==t:o(t)}},497:function(t){"use strict";t.exports=!1},3443:function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(5189),i=r(2631),a=r(7123),s=r(5970),u=Object;t.exports=s?function(t){return"symbol"==n(t)}:function(t){var e=o("Symbol");return i(e)&&a(e.prototype,u(t))}},428:function(t,e,r){"use strict";var n=r(9800);t.exports=function(t){return n(t.length)}},7773:function(t,e,r){"use strict";var n=r(398),o=r(4877),i=r(2631),a=r(2791),s=r(9234),u=r(2756).CONFIGURABLE,l=r(3128),c=r(7863),f=c.enforce,h=c.get,p=String,d=Object.defineProperty,y=n("".slice),v=n("".replace),g=n([].join),m=s&&!o(function(){return 8!==d(function(){},"length",{value:8}).length}),b=String(String).split("String"),w=t.exports=function(t,e,r){"Symbol("===y(p(e),0,7)&&(e="["+v(p(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(e="get "+e),r&&r.setter&&(e="set "+e),(!a(t,"name")||u&&t.name!==e)&&(s?d(t,"name",{value:e,configurable:!0}):t.name=e),m&&r&&a(r,"arity")&&t.length!==r.arity&&d(t,"length",{value:r.arity});try{r&&a(r,"constructor")&&r.constructor?s&&d(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=f(t);return a(n,"source")||(n.source=g(b,"string"==typeof e?e:"")),t};Function.prototype.toString=w(function(){return i(this)&&h(this).source||l(this)},"toString")},7443:function(t){"use strict";var e=Math.ceil,r=Math.floor;t.exports=Math.trunc||function(t){var n=+t;return(n>0?r:e)(n)}},6355:function(t,e,r){"use strict";var n=r(9234),o=r(398),i=r(9707),a=r(4877),s=r(3334),u=r(791),l=r(15),c=r(6079),f=r(9213),h=Object.assign,p=Object.defineProperty,d=o([].concat);t.exports=!h||a(function(){if(n&&1!==h({b:1},h(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},r=Symbol("assign detection");return t[r]=7,"abcdefghijklmnopqrst".split("").forEach(function(t){e[t]=t}),7!==h({},t)[r]||"abcdefghijklmnopqrst"!==s(h({},e)).join("")})?function(t,e){for(var r=c(t),o=arguments.length,a=1,h=u.f,p=l.f;o>a;)for(var y,v=f(arguments[a++]),g=h?d(s(v),h(v)):s(v),m=g.length,b=0;m>b;)y=g[b++],n&&!i(p,v,y)||(r[y]=v[y]);return r}:h},1807:function(t,e,r){"use strict";var n=r(9234),o=r(107),i=r(4796),a=r(9809),s=r(6779),u=TypeError,l=Object.defineProperty,c=Object.getOwnPropertyDescriptor;e.f=n?i?function(t,e,r){if(a(t),e=s(e),a(r),"function"==typeof t&&"prototype"===e&&"value"in r&&"writable"in r&&!r.writable){var n=c(t,e);n&&n.writable&&(t[e]=r.value,r={configurable:"configurable"in r?r.configurable:n.configurable,enumerable:"enumerable"in r?r.enumerable:n.enumerable,writable:!1})}return l(t,e,r)}:l:function(t,e,r){if(a(t),e=s(e),a(r),o)try{return l(t,e,r)}catch(t){}if("get"in r||"set"in r)throw new u("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},1805:function(t,e,r){"use strict";var n=r(9234),o=r(9707),i=r(15),a=r(1718),s=r(1059),u=r(6779),l=r(2791),c=r(107),f=Object.getOwnPropertyDescriptor;e.f=n?f:function(t,e){if(t=s(t),e=u(e),c)try{return f(t,e)}catch(t){}if(l(t,e))return a(!o(i.f,t,e),t[e])}},3602:function(t,e,r){"use strict";var n=r(7386),o=r(1009).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},791:function(t,e){"use strict";e.f=Object.getOwnPropertySymbols},7123:function(t,e,r){"use strict";var n=r(398);t.exports=n({}.isPrototypeOf)},7386:function(t,e,r){"use strict";var n=r(398),o=r(2791),i=r(1059),a=r(7943).indexOf,s=r(8551),u=n([].push);t.exports=function(t,e){var r,n=i(t),l=0,c=[];for(r in n)!o(s,r)&&o(n,r)&&u(c,r);for(;e.length>l;)o(n,r=e[l++])&&(~a(c,r)||u(c,r));return c}},3334:function(t,e,r){"use strict";var n=r(7386),o=r(1009);t.exports=Object.keys||function(t){return n(t,o)}},15:function(t,e){"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!r.call({1:2},1);e.f=o?function(t){var e=n(this,t);return!!e&&e.enumerable}:r},5720:function(t,e,r){"use strict";var n=r(9707),o=r(2631),i=r(6220),a=TypeError;t.exports=function(t,e){var r,s;if("string"===e&&o(r=t.toString)&&!i(s=n(r,t)))return s;if(o(r=t.valueOf)&&!i(s=n(r,t)))return s;if("string"!==e&&o(r=t.toString)&&!i(s=n(r,t)))return s;throw new a("Can't convert object to primitive value")}},7197:function(t,e,r){"use strict";var n=r(5189),o=r(398),i=r(3602),a=r(791),s=r(9809),u=o([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=i.f(s(t)),r=a.f;return r?u(e,r(t)):e}},5329:function(t,e,r){"use strict";var n=r(1697);t.exports=n},1308:function(t,e,r){"use strict";var n=r(155),o=TypeError;t.exports=function(t){if(n(t))throw new o("Can't call method on "+t);return t}},109:function(t,e,r){"use strict";var n=r(4499),o=r(606),i=n("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},4243:function(t,e,r){"use strict";var n=r(497),o=r(1697),i=r(6507),a=t.exports=o["__core-js_shared__"]||i("__core-js_shared__",{});(a.versions||(a.versions=[])).push({version:"3.36.0",mode:n?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.0/LICENSE",source:"https://github.com/zloirock/core-js"})},4499:function(t,e,r){"use strict";var n=r(4243);t.exports=function(t,e){return n[t]||(n[t]=e||{})}},7161:function(t,e,r){"use strict";var n=r(5950),o=r(4877),i=r(1697).String;t.exports=!!Object.getOwnPropertySymbols&&!o(function(){var t=Symbol("symbol detection");return!i(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41})},7636:function(t,e,r){"use strict";var n=r(7105),o=Math.max,i=Math.min;t.exports=function(t,e){var r=n(t);return r<0?o(r+e,0):i(r,e)}},1059:function(t,e,r){"use strict";var n=r(9213),o=r(1308);t.exports=function(t){return n(o(t))}},7105:function(t,e,r){"use strict";var n=r(7443);t.exports=function(t){var e=+t;return e!=e||0===e?0:n(e)}},9800:function(t,e,r){"use strict";var n=r(7105),o=Math.min;t.exports=function(t){var e=n(t);return e>0?o(e,9007199254740991):0}},6079:function(t,e,r){"use strict";var n=r(1308),o=Object;t.exports=function(t){return o(n(t))}},8167:function(t,e,r){"use strict";var n=r(9707),o=r(6220),i=r(3443),a=r(2968),s=r(5720),u=r(7709),l=TypeError,c=u("toPrimitive");t.exports=function(t,e){if(!o(t)||i(t))return t;var r,u=a(t,c);if(u){if(void 0===e&&(e="default"),r=n(u,t,e),!o(r)||i(r))return r;throw new l("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},6779:function(t,e,r){"use strict";var n=r(8167),o=r(3443);t.exports=function(t){var e=n(t,"string");return o(e)?e:e+""}},4861:function(t){"use strict";var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},606:function(t,e,r){"use strict";var n=r(398),o=0,i=Math.random(),a=n(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++o+i,36)}},5970:function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=r(7161);t.exports=o&&!Symbol.sham&&"symbol"==n(Symbol.iterator)},4796:function(t,e,r){"use strict";var n=r(9234),o=r(4877);t.exports=n&&o(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},5032:function(t,e,r){"use strict";var n=r(1697),o=r(2631),i=n.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},2461:function(t,e,r){"use strict";var n=r(5329),o=r(2791),i=r(9385),a=r(1807).f;t.exports=function(t){var e=n.Symbol||(n.Symbol={});o(e,t)||a(e,t,{value:i.f(t)})}},9385:function(t,e,r){"use strict";var n=r(7709);e.f=n},7709:function(t,e,r){"use strict";var n=r(1697),o=r(4499),i=r(2791),a=r(606),s=r(7161),u=r(5970),l=n.Symbol,c=o("wks"),f=u?l.for||l:l&&l.withoutSetter||a;t.exports=function(t){return i(c,t)||(c[t]=s&&i(l,t)?l[t]:f("Symbol."+t)),c[t]}},7851:function(t,e,r){"use strict";var n=r(3768),o=r(6355);n({target:"Object",stat:!0,arity:2,forced:Object.assign!==o},{assign:o})},494:function(t,e,r){"use strict";r(2461)("asyncIterator")},3712:function(t,e,r){"use strict";var n=r(9435);t.exports=n},6433:function(t,e,r){"use strict";var n=r(8142);t.exports=n},1635:function(t,e,r){"use strict";r.r(e),r.d(e,{__addDisposableResource:function(){return N},__assign:function(){return i},__asyncDelegator:function(){return O},__asyncGenerator:function(){return E},__asyncValues:function(){return P},__await:function(){return _},__awaiter:function(){return d},__classPrivateFieldGet:function(){return M},__classPrivateFieldIn:function(){return I},__classPrivateFieldSet:function(){return j},__createBinding:function(){return v},__decorate:function(){return s},__disposeResources:function(){return R},__esDecorate:function(){return l},__exportStar:function(){return g},__extends:function(){return o},__generator:function(){return y},__importDefault:function(){return A},__importStar:function(){return T},__makeTemplateObject:function(){return k},__metadata:function(){return p},__param:function(){return u},__propKey:function(){return f},__read:function(){return b},__rest:function(){return a},__runInitializers:function(){return c},__setFunctionName:function(){return h},__spread:function(){return w},__spreadArray:function(){return x},__spreadArrays:function(){return S},__values:function(){return m}});var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function u(t,e){return function(r,n){e(r,n,t)}}function l(t,e,r,n,o,i){function a(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var s,u=n.kind,l="getter"===u?"get":"setter"===u?"set":"value",c=!e&&t?n.static?t:t.prototype:null,f=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),h=!1,p=r.length-1;p>=0;p--){var d={};for(var y in n)d[y]="access"===y?{}:n[y];for(var y in n.access)d.access[y]=n.access[y];d.addInitializer=function(t){if(h)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(t||null))};var v=(0,r[p])("accessor"===u?{get:f.get,set:f.set}:f[l],d);if("accessor"===u){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(s=a(v.get))&&(f.get=s),(s=a(v.set))&&(f.set=s),(s=a(v.init))&&o.unshift(s)}else(s=a(v))&&("field"===u?o.unshift(s):f[l]=s)}c&&Object.defineProperty(c,n.name,f),h=!0}function c(t,e,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function w(){for(var t=[],e=0;e1||s(t,e)})})}function s(t,e){try{(r=o[t](e)).value instanceof _?Promise.resolve(r.value.v).then(u,l):c(i[0][2],r)}catch(t){c(i[0][3],t)}var r}function u(t){s("next",t)}function l(t){s("throw",t)}function c(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}}function O(t){var e,r;return e={},n("next"),n("throw",function(t){throw t}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,o){e[n]=t[n]?function(e){return(r=!r)?{value:_(t[n](e)),done:!1}:o?o(e):e}:o}}function P(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=m(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise(function(n,o){(function(t,e,r,n){Promise.resolve(n).then(function(e){t({value:e,done:r})},e)})(n,o,(e=t[r](e)).done,e.value)})}}}function k(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var C=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function T(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&v(e,t,r);return C(e,t),e}function A(t){return t&&t.__esModule?t:{default:t}}function M(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}function j(t,e,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,r):o?o.value=r:e.set(t,r),r}function I(t,e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof t?e===t:t.has(e)}function N(t,e,r){if(null!==e&&void 0!==e){if("object"!=typeof e&&"function"!=typeof e)throw new TypeError("Object expected.");var n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose]}if("function"!=typeof n)throw new TypeError("Object not disposable.");t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}var L="function"==typeof SuppressedError?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};function R(t){function e(e){t.error=t.hasError?new L(e,t.error,"An error was suppressed during disposal."):e,t.hasError=!0}return function r(){for(;t.stack.length;){var n=t.stack.pop();try{var o=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(o).then(r,function(t){return e(t),r()})}catch(t){e(t)}}if(t.hasError)throw t.error}()}e.default={__extends:o,__assign:i,__rest:a,__decorate:s,__param:u,__metadata:p,__awaiter:d,__generator:y,__createBinding:v,__exportStar:g,__values:m,__read:b,__spread:w,__spreadArrays:S,__spreadArray:x,__await:_,__asyncGenerator:E,__asyncDelegator:O,__asyncValues:P,__makeTemplateObject:k,__importStar:T,__importDefault:A,__classPrivateFieldGet:M,__classPrivateFieldSet:j,__classPrivateFieldIn:I,__addDisposableResource:N,__disposeResources:R}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.amdO={},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},r(9784),r(961),r(5417);r(4539)}(); diff --git a/test/unit/createEmptyMap.js b/test/unit/createEmptyMap.js index 370f1532..c585847c 100644 --- a/test/unit/createEmptyMap.js +++ b/test/unit/createEmptyMap.js @@ -1,5 +1,6 @@ import { mount } from '@vue/test-utils'; import SmWebMap from '../../src/mapboxgl/web-map/WebMap.vue'; +import flushPromises from 'flush-promises'; const mapInfo = { extent: { leftBottom: { x: 0, y: 0 }, @@ -19,13 +20,13 @@ const mapInfo = { version: '1.0' }; -export default function createEmptyMap() { - const wrapper = mount(SmWebMap, { - propsData: { - mapId: mapInfo - }, - }); +export default async function createEmptyMap(options = { mapId: mapInfo }) { + jest.useFakeTimers(); + const wrapper = mount(SmWebMap, options); + await wrapper.vm.$nextTick(); + await flushPromises(); + jest.advanceTimersByTime(120); wrapper.vm.viewModel.map.fire('load'); + jest.useRealTimers(); return wrapper; } - diff --git a/test/unit/mapLoaded.js b/test/unit/mapLoaded.js index 1b78b0c0..e6f75d01 100644 --- a/test/unit/mapLoaded.js +++ b/test/unit/mapLoaded.js @@ -1,6 +1,10 @@ import flushPromises from 'flush-promises'; export default async function mapLoaded(mapVm) { + jest.useFakeTimers(); + await mapVm.$nextTick(); await flushPromises(); + jest.advanceTimersByTime(120); mapVm.viewModel.map.fire('load'); + jest.useRealTimers(); } diff --git a/test/unit/mapSubComponentLoaded.js b/test/unit/mapSubComponentLoaded.js index d0e09562..d0697bcf 100644 --- a/test/unit/mapSubComponentLoaded.js +++ b/test/unit/mapSubComponentLoaded.js @@ -1,5 +1,9 @@ -export default function mapSubComponentLoaded(wrapper) { +import flushPromises from "flush-promises"; + +export default async function mapSubComponentLoaded(wrapper) { const loadedFn = jest.fn(); - wrapper.vm.$on({ loaded: loadedFn }); - expect(loadedFn.mock.called).toBeTruthy; + wrapper.vm.$on('loaded', loadedFn); + await wrapper.vm.$nextTick(); + await flushPromises(); + expect(loadedFn.mock.calls).toHaveLength(1); } diff --git a/test/unit/mapWrapperLoaded.js b/test/unit/mapWrapperLoaded.js index 2b8c8d2f..60811b75 100644 --- a/test/unit/mapWrapperLoaded.js +++ b/test/unit/mapWrapperLoaded.js @@ -1,7 +1,10 @@ import flushPromises from 'flush-promises'; -export default async function mapWrapperLoaded(mapVm) { - await flushPromises(); - mapVm.vm.viewModel.map.fire('load'); +export default async function mapWrapperLoaded(wrapper) { + jest.useFakeTimers(); + await wrapper.vm.$nextTick(); await flushPromises(); + jest.advanceTimersByTime(120); + wrapper.vm.viewModel.map.fire('load'); + jest.useRealTimers(); } diff --git a/test/unit/mocks/data/WebMap/layer_v3.json b/test/unit/mocks/data/WebMap/layer_v3.json new file mode 100644 index 00000000..71e33566 --- /dev/null +++ b/test/unit/mocks/data/WebMap/layer_v3.json @@ -0,0 +1,82 @@ +{ + "metadata": { + "layerCatalog": [ + { + "visible": true, + "id": "北京市小学", + "title": "北京市小学123", + "type": "basic" + } + ] + }, + "sources": { + "ms_1338191620_1711937658391_18": { + "tiles": [ + "http://fackiportal/web/datas/1338191620/structureddata/tiles/{z}/{x}/{y}.mvt?epsgCode=3857&returnedFieldNames=%5B%22smpid%22%2C%22SmID%22%2C%22SmX%22%2C%22SmY%22%2C%22SmLibTileID%22%2C%22SmUserID%22%2C%22SmGeometrySize%22%2C%22%E5%90%8D%E7%A7%B0%22%2C%22%E5%AD%A6%E6%A0%A1%E7%B1%BB%E5%88%AB%22%2C%22%E7%94%B5%E8%AF%9D%22%2C%22%E5%9C%B0%E5%9D%80%22%2C%22msgeometry%22%5D&geometryFieldName=msgeometry" + ], + "bounds": [ + 115.594446040963, + 39.4576423716415, + 117.322162217816, + 40.899372856284 + ], + "type": "vector" + }, + "CHINA_DARK": { + "tiles": [ + "https://maptiles.supermapol.com/iserver/services/map_China/rest/maps/China_Dark/tileimage.png?scale={scale}&x={x}&y={y}&width={width}&height={height}&transparent=true&redirect=false&cacheEnabled=true" + ], + "tileSize": 256, + "attribution": "", + "bounds": [ + -180, + -90, + 180, + 90 + ], + "type": "raster" + } + }, + "crs": "EPSG:3857", + "center": [ + 12978882.992135866, + 4817539.5448938105 + ], + "zoom": 7.531648800092899, + "glyphs": {}, + "version": "3.1.4", + "rootUrl": "http://fackiportal/services/../", + "maxzoom": 22, + "name": "无标题地图layers", + "viewExtent": [ + 113.56651234883503, + 40.91674111392223, + 119.61606690385673, + 38.39241621316566 + ], + "layers": [ + { + "maxzoom": 12, + "id": "CHINA_DARK", + "source": "CHINA_DARK", + "type": "raster", + "minzoom": 0 + }, + { + "layout": {}, + "metadata": {}, + "paint": { + "circle-color": "#EE4D5A", + "circle-opacity": 0.9, + "circle-radius": 4 + }, + "id": "北京市小学", + "source": "ms_1338191620_1711937658391_18", + "source-layer": "1338191620$msgeometry", + "type": "circle" + } + ], + "sprite": {}, + "pitch": 0, + "minzoom": 0 +} \ No newline at end of file diff --git a/test/unit/mocks/data/WebMap/map_legends.json b/test/unit/mocks/data/WebMap/map_legends.json new file mode 100644 index 00000000..de59bb1e --- /dev/null +++ b/test/unit/mocks/data/WebMap/map_legends.json @@ -0,0 +1,142 @@ +[ + { + "themeField": "smpid", + "styleGroup": [ + { + "style": { + "type": "style", + "colors": [ + { + "value": "#0000ff", + "key": 0 + }, + { + "value": "#00ffff", + "key": 0.4 + }, + { + "value": "#00ff00", + "key": 0.6 + }, + { + "value": "#ffff00", + "key": 0.8 + }, + { + "value": "#ff0000", + "key": 1 + } + ] + } + } + ], + "layerId": "上海疫情点标注" + }, + { + "styleGroup": [ + { + "style": { + "type": "style", + "fontSize": "8px", + "color": "#EE4D5A", + "opacity": 0.9, + "shape": "POINT" + } + } + ], + "layerId": "站点3" + }, + { + "themeField": "smpid", + "styleField": "color", + "styleGroup": [ + { + "styleField": null, + "style": { + "type": "style", + "shape": "POINT", + "sprite": { "sdf": false, "pixelRatio": 1, "width": 9, "x": 0, "y": 0, "height": 9 }, + "url": "http://localhost:8190/iportal/web/maps/168769956/sprites/sprite.png" + } + } + ], + "layerId": "未命名数据" + }, + { + "themeField": "smpid", + "styleField": "symbolsContent", + "styleGroup": [ + { + "styleField": null, + "style": { + "type": "style", + "shape": "fill", + "sprite": { "sdf": false, "pixelRatio": 1, "width": 9, "x": 0, "y": 0, "height": 9 }, + "url": "http://localhost:8190/iportal/web/maps/168769956/sprites/sprite.png", + "width": 9, + "height": 9, + "backgroudColor": "#000" + } + } + ], + "layerId": "未命名数据" + }, + { + "themeField": "smpid", + "styleField": "width", + "styleGroup": [ + { + "fieldValue": 1, + "style": { + "type": "style", + "color": "#4CC8A3", + "opacity": 1, + "lineDasharray": [1, 0], + "width": 100, + "height": 8, + "lineWidth": 8, + "shape": "LINE" + } + }, + { + "fieldValue": 2, + "style": { + "type": "style", + "color": "#4CC8A3", + "opacity": 1, + "lineDasharray": [1, 0], + "width": 100, + "height": 50, + "lineWidth": 50, + "shape": "LINE" + } + } + ], + "layerId": "未命名数据(1)" + }, + { + "themeField": "smpid", + "styleField": "color", + "styleGroup": [ + { + "styleField": null, + "style": { + "type": "style", + "shape": "FILL", + "colors": [ + { + "value": "#D53E4F", + "key": 1 + }, + { + "value": "#3288BD", + "key": 2 + } + ] + } + } + ], + "layerId": "未命名数据(3)" + } +] +