diff --git a/openwisp_monitoring/device/admin.py b/openwisp_monitoring/device/admin.py index 1e78243d8..23354ed24 100644 --- a/openwisp_monitoring/device/admin.py +++ b/openwisp_monitoring/device/admin.py @@ -1,6 +1,7 @@ import uuid from urllib.parse import urljoin +from django import forms from django.contrib import admin from django.contrib.contenttypes.admin import GenericStackedInline from django.contrib.contenttypes.forms import BaseGenericInlineFormSet @@ -24,6 +25,7 @@ from openwisp_controller.config.admin import DeactivatedDeviceReadOnlyMixin from openwisp_controller.config.admin import DeviceAdmin as BaseDeviceAdmin +from openwisp_controller.geo.admin import DeviceLocationInline from openwisp_users.multitenancy import MultitenantAdminMixin from openwisp_utils.admin import ReadOnlyAdmin @@ -567,6 +569,19 @@ def has_delete_permission(self, request, obj=None): return super(admin.ModelAdmin, self).has_delete_permission(request, obj) +def patch_device_location_inline(self): + base = super(DeviceLocationInline, self).media + extra = forms.Media( + js=( + "admin/js/jquery.init.js", + "monitoring/js/location-inline.js", + ) + ) + return base + extra + + +DeviceLocationInline.media = property(patch_device_location_inline) + admin.site.unregister(Device) admin.site.register(Device, DeviceAdminExportable) diff --git a/openwisp_monitoring/device/static/monitoring/js/device-map.js b/openwisp_monitoring/device/static/monitoring/js/device-map.js index 928c86318..bd877f77f 100644 --- a/openwisp_monitoring/device/static/monitoring/js/device-map.js +++ b/openwisp_monitoring/device/static/monitoring/js/device-map.js @@ -257,7 +257,11 @@ }); $(".floorplan-btn").on("click", function () { const floorplanUrl = getIndoorCoordinatesUrl(locationId); - window.openFloorPlan(floorplanUrl); + window.openFloorPlan(floorplanUrl, locationId); + }); + el.find(".leaflet-popup-close-button").on("click", function () { + const id = netjsongraphInstance.config.bookmarkableActions.id; + netjsongraphInstance.utils.removeUrlFragment(id); }); loadingOverlay.hide(); }, @@ -329,6 +333,10 @@ ], }, }, + bookmarkableActions: { + enabled: true, + id: "dashboard-geo-map", + }, mapTileConfig: tiles, nodeCategories: Object.keys(STATUS_COLORS).map((status) => ({ name: status, @@ -535,8 +543,31 @@ }, // Added to open popup for a specific location Id in selenium tests openPopup: function (locationId) { - const nodeData = map?.data?.nodes?.find((n) => n.id === locationId); - loadPopUpContent(nodeData, map); + const index = map?.data?.nodes?.findIndex((n) => n.id === locationId); + const nodeData = map?.data?.nodes?.[index]; + if (index === -1 || !nodeData) { + const id = map.config.bookmarkableActions.id; + map.utils.removeUrlFragment(id); + console.error(`Node with ID "${locationId}" not found.`); + return; + } + const option = map.echarts.getOption(); + const series = option.series.find( + (s) => s.type === "scatter" || "effectScatter", + ); + const seriesIndex = option.series.indexOf(series); + + const params = { + componentType: "series", + componentSubType: series.type, + seriesIndex: seriesIndex, + dataIndex: index, + data: { + ...series.data[index], + node: nodeData, + }, + }; + map.echarts.trigger("click", params); }, }); map.render(); diff --git a/openwisp_monitoring/device/static/monitoring/js/floorplan.js b/openwisp_monitoring/device/static/monitoring/js/floorplan.js index dbd4b6e65..cd7efdd80 100644 --- a/openwisp_monitoring/device/static/monitoring/js/floorplan.js +++ b/openwisp_monitoring/device/static/monitoring/js/floorplan.js @@ -11,9 +11,40 @@ let selectedIndex = 0; let isFullScreen = false; let maps = {}; + let locationId = null; + + // Use case: we support overlaying two maps. The URL hash contains up to two + // fragments separated by ';' — one is the geo map and the other is an indoor map. + // + // The geo map fragment has id="dashboard-geo-map". Any fragment whose id is + // NOT "dashboard-geo-map" is treated as the indoor map fragment. + // + // When switching maps we expect only two maps at most; the previous map should + // be removed before adding the new one. + // Note: future logic to manage this will be implemented in netjsongraph.js. + const rawUrlFragments = window.location.hash.replace(/^#/, ""); + const fragments = rawUrlFragments.split(";").filter((f) => f.trim() !== ""); + + const indoorMapFragment = fragments.find((fragment) => { + const params = new URLSearchParams(fragment); + return params.get("id") !== "dashboard-geo-map"; + }); + + const params = new URLSearchParams(indoorMapFragment); + const fragmentId = params.get("id"); + // fragments format is expected to be ":" + const [fragmentLocationId, fragmentFloor] = fragmentId?.split(":") || []; + if (fragmentLocationId && fragmentFloor != null) { + const floorplanUrl = window._owGeoMapConfig.indoorCoordinatesUrl.replace( + "000", + fragmentLocationId, + ); + openFloorPlan(`${floorplanUrl}`, fragmentLocationId, fragmentFloor); + } - async function openFloorPlan(url) { - await fetchData(url); + async function openFloorPlan(url, id = null, floor = currentFloor) { + locationId = id; + await fetchData(url, floor); selectedIndex = floors.indexOf(currentFloor) || 0; // Calculate the starting index of the navigation window so the selected floor is positioned @@ -33,10 +64,10 @@ updateBackdrop(); - $("#device-map-container").append($floorPlanContainer); + $("#dashboard-map-overlay").append($floorPlanContainer); $("#floorplan-overlay").append($floorNavigation); - closeButtonHandler(); + $("#floorplan-close-btn").on("click", closeButtonHandler); addFloorButtons(selectedIndex, navWindowStart); addNavigationHandlers(url); await showFloor(url, currentFloor); @@ -58,15 +89,12 @@ dataType: "json", xhrFields: { withCredentials: true }, success: async (data) => { - // To make this run only one time as only in the first call floor will not be provided - if (!floor) { - floors = data.floors; - floor = data.results[0].floor; - } if (!allResults[floor]) { allResults[floor] = []; } allResults[floor] = [...allResults[floor], ...data.results]; + floors = data.floors; + floor = data.results[0].floor; if (!currentFloor && data.results.length) { currentFloor = data.results[0].floor; } @@ -110,19 +138,27 @@ } function closeButtonHandler() { - $("#floorplan-close-btn").on("click", () => { - $("#floorplan-container, #floorplan-navigation").remove(); - $("#floorplan-overlay").remove(); - updateBackdrop(); - allResults = {}; - currentFloor = null; - }); + $("#floorplan-container, #floorplan-navigation").remove(); + $("#floorplan-overlay").remove(); + updateBackdrop(); + removeUrlFragment(locationId); + allResults = {}; + currentFloor = null; + maps = {}; + locationId = null; } function updateBackdrop() { $(".menu-backdrop").toggleClass("active"); } + function removeUrlFragment(locationId) { + if (locationId != null) { + const id = maps[currentFloor].config.bookmarkableActions.id; + maps[currentFloor].utils.removeUrlFragment(id); + } + } + function addFloorButtons(selectedIndex, navWindowStart) { const $navBody = $(".floorplan-navigation-body").empty(); const slicedFloors = floors.slice(navWindowStart, navWindowStart + NAV_WINDOW_SIZE); @@ -152,6 +188,7 @@ selectedIndex = +e.currentTarget.dataset.index; const center = Math.floor(NAV_WINDOW_SIZE / 2); navWindowStart = Math.max(0, Math.min(selectedIndex - center, maxStart)); + removeUrlFragment(locationId); addFloorButtons(selectedIndex, navWindowStart); currentFloor = floors[selectedIndex]; await showFloor(url, currentFloor); @@ -162,6 +199,7 @@ selectedIndex++; const center = Math.floor(NAV_WINDOW_SIZE / 2); navWindowStart = Math.max(0, Math.min(selectedIndex - center, maxStart)); + removeUrlFragment(locationId); addFloorButtons(selectedIndex, navWindowStart); currentFloor = floors[selectedIndex]; await showFloor(url, currentFloor); @@ -173,6 +211,7 @@ selectedIndex--; const center = Math.floor(NAV_WINDOW_SIZE / 2); navWindowStart = Math.max(0, Math.min(selectedIndex - center, maxStart)); + removeUrlFragment(locationId); addFloorButtons(selectedIndex, navWindowStart); currentFloor = floors[selectedIndex]; await showFloor(url, currentFloor); @@ -203,10 +242,10 @@ if (!$floorDiv.length) { $floorDiv = $(`
`); root.append($floorDiv); - renderIndoorMap(nodesThisFloor, imageUrl, $floorDiv[0].id); + renderIndoorMap(nodesThisFloor, imageUrl, $floorDiv[0].id, floor); } $floorDiv.show(); - maps[currentFloor]?.invalidateSize(); + maps[currentFloor]?.leaflet.invalidateSize(); } let currentPopup = null; @@ -249,7 +288,7 @@ .openOn(map); } - function renderIndoorMap(allResults, imageUrl, divId) { + function renderIndoorMap(allResults, imageUrl, divId, floor) { const indoorMap = new NetJSONGraph(allResults, { el: `#${divId}`, render: "map", @@ -275,12 +314,17 @@ }, baseOptions: { media: [{ option: { tooltip: { show: false } } }] }, }, + bookmarkableActions: { + enabled: true, + id: `${locationId}:${floor}`, + }, nodeCategories: Object.keys(status_colors).map((status) => ({ name: status, nodeStyle: { color: status_colors[status] }, })), prepareData(data) { data.nodes.forEach((node) => { + node.location = node.coordinates; node.properties = { ...node.properties, name: node.device_name, @@ -294,62 +338,66 @@ return data; }, - onReady() { + async onReady() { const map = this.leaflet; - maps[currentFloor] = map; + maps[currentFloor] = indoorMap; // remove default geo map tiles map.eachLayer((layer) => layer._url && map.removeLayer(layer)); const img = new Image(); img.src = imageUrl; + await img.decode(); let initialZoom; - img.onload = () => { - const aspectRatio = img.width / img.height; - const h = img.height; - const w = h * aspectRatio; - const zoom = map.getMaxZoom() - 1; - - // To make the image center in the map at (0,0) coordinates - const anchorLatLng = L.latLng(0, 0); - const anchorPoint = map.project(anchorLatLng, zoom); - - // Calculate the bounds of the image, with respect to the anchor point (0, 0) - // Leaflet's pixel coordinates increase to the right and downwards - // Unlike cartesian system where y increases upwards - // So top-left will have negative y and bottom-right will have positive y - // Similarly left will have negative x and right will have positive x - const topLeft = L.point(anchorPoint.x - w / 2, anchorPoint.y - h / 2); - const bottomRight = L.point(anchorPoint.x + w / 2, anchorPoint.y + h / 2); - - // Update node coordinates to fit the image overlay - // We get the node coordinates from the API in the format for L.CRS.Simple - // So the coordinates is in for cartesian system with origin at top left corner - // Rendering image in the third quadrant with topLeft as (0,0) and bottomRight as (w,-h) - // So we convert py to positive and then project the point to get the corresponding topLeft - // Then unproject the point to get the corresponding latlng on the map - const mapOptions = this.echarts.getOption(); - // series[0]: nodes config, series[1]: links config and both are always present - mapOptions.series[0].data.forEach((data) => { - const node = data.node; - const px = Number(node.coordinates.lng); - const py = -Number(node.coordinates.lat); - const nodeProjected = L.point(topLeft.x + px, topLeft.y + py); - // This requrires an map instance to unproject coordinates so it cann't be done in prepareData - const nodeLatLng = map.unproject(nodeProjected, zoom); - node.properties.location = nodeLatLng; - data.value = [nodeLatLng.lng, nodeLatLng.lat]; - }); - this.echarts.setOption(mapOptions); - - // Unproject the topLeft and bottomRight points to get northWest and southEast latlngs - const nw = map.unproject(topLeft, zoom); - const se = map.unproject(bottomRight, zoom); - const bnds = L.latLngBounds(nw, se); - L.imageOverlay(imageUrl, bnds).addTo(map); - map.fitBounds(bnds); - map.setMaxBounds(bnds.pad(1)); - initialZoom = map.getZoom(); - map.invalidateSize(); - }; + + const aspectRatio = img.width / img.height; + const h = img.height; + const w = h * aspectRatio; + const zoom = map.getMaxZoom() - 1; + + // To make the image center in the map at (0,0) coordinates + const anchorLatLng = L.latLng(0, 0); + const anchorPoint = map.project(anchorLatLng, zoom); + + // Calculate the bounds of the image, with respect to the anchor point (0, 0) + // Leaflet's pixel coordinates increase to the right and downwards + // Unlike cartesian system where y increases upwards + // So top-left will have negative y and bottom-right will have positive y + // Similarly left will have negative x and right will have positive x + const topLeft = L.point(anchorPoint.x - w / 2, anchorPoint.y - h / 2); + const bottomRight = L.point(anchorPoint.x + w / 2, anchorPoint.y + h / 2); + + // Update node coordinates to fit the image overlay + // We get the node coordinates from the API in the format for L.CRS.Simple + // So the coordinates is in for cartesian system with origin at top left corner + // Rendering image in the third quadrant with topLeft as (0,0) and bottomRight as (w,-h) + // So we convert py to positive and then project the point to get the corresponding topLeft + // Then unproject the point to get the corresponding latlng on the map + const mapOptions = this.echarts.getOption(); + const series = mapOptions.series.find((s) => s.type === "scatter"); + series.data.forEach((data, index) => { + const node = data.node; + const px = Number(node.coordinates.lng); + const py = -Number(node.coordinates.lat); + const nodeProjected = L.point(topLeft.x + px, topLeft.y + py); + // This requrires an map instance to unproject coordinates so it cann't be done in prepareData + const nodeLatLng = map.unproject(nodeProjected, zoom); + // Also updating this.data so that after onReady when applyUrlFragmentState is called it whould + // have the correct coordinates data points to trigger the popup at right place. + this.data.nodes[index].location = nodeLatLng; + this.data.nodes[index].properties.location = nodeLatLng; + node.properties.location = nodeLatLng; + data.value = [nodeLatLng.lng, nodeLatLng.lat]; + }); + this.echarts.setOption(mapOptions); + + // Unproject the topLeft and bottomRight points to get northWest and southEast latlngs + const nw = map.unproject(topLeft, zoom); + const se = map.unproject(bottomRight, zoom); + const bnds = L.latLngBounds(nw, se); + L.imageOverlay(imageUrl, bnds).addTo(map); + map.fitBounds(bnds); + map.setMaxBounds(bnds.pad(1)); + initialZoom = map.getZoom(); + map.invalidateSize(); map.on("fullscreenchange", () => { const floorNavigation = $("#floorplan-navigation"); @@ -377,16 +425,42 @@ indoorMap.setUtils({ // Added to open popup for a specific location Id in selenium tests openPopup: function (deviceId) { - const mapOptions = indoorMap.echarts.getOption(); - const data = mapOptions.series[0].data.find( - (data) => data.node.device_id === deviceId, + const index = indoorMap?.data?.nodes?.findIndex( + (n) => n.device_id === deviceId, ); - loadPopUpContent(data?.node, indoorMap); + const nodeData = indoorMap?.data?.nodes?.[index]; + if (index === -1 || !nodeData) { + const id = indoorMap.config.bookmarkableActions.id; + indoorMap.utils.removeUrlFragment(id); + console.error(`Node with ID "${deviceId}" not found.`); + return; + } + const option = indoorMap.echarts.getOption(); + const series = option.series.find((s) => s.type === "scatter"); + const seriesIndex = option.series.indexOf(series); + + const params = { + componentType: "series", + componentSubType: series.type, + seriesIndex: seriesIndex, + dataIndex: index, + data: { + ...series.data[index], + node: nodeData, + }, + }; + indoorMap.echarts.trigger("click", params); }, }); indoorMap.render(); $(".ow-loading-spinner").hide(); window._owIndoorMap = indoorMap; + window.addEventListener("popstate", () => { + const fragments = indoorMap.utils.parseUrlFragments(); + if (!fragments[`${locationId}:${floor}`]) { + closeButtonHandler(); + } + }); } window.openFloorPlan = openFloorPlan; diff --git a/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js b/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js index 92f929603..b8c4b0994 100644 --- a/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js +++ b/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js @@ -1,17 +1,9 @@ -(()=>{var t={26:(t,e,n)=>{"use strict";n.r(e),n.d(e,{HashMap:()=>st,RADIAN_TO_DEGREE:()=>pt,assert:()=>tt,bind:()=>N,clone:()=>_,concatArray:()=>ut,createCanvas:()=>S,createHashMap:()=>lt,createObject:()=>ht,curry:()=>R,defaults:()=>w,disableUserSelect:()=>ct,each:()=>L,eqNaN:()=>q,extend:()=>b,filter:()=>P,find:()=>E,guid:()=>m,hasOwn:()=>dt,indexOf:()=>T,inherits:()=>M,isArray:()=>k,isArrayLike:()=>A,isBuiltInObject:()=>G,isDom:()=>W,isFunction:()=>z,isGradientObject:()=>j,isImagePatternObject:()=>Z,isNumber:()=>H,isObject:()=>V,isPrimitive:()=>rt,isRegExp:()=>X,isString:()=>B,isStringSafe:()=>F,isTypedArray:()=>U,keys:()=>O,logError:()=>v,map:()=>D,merge:()=>y,mergeAll:()=>x,mixin:()=>C,noop:()=>ft,normalizeCssArray:()=>Q,reduce:()=>I,retrieve:()=>Y,retrieve2:()=>K,retrieve3:()=>J,setAsPrimitive:()=>it,slice:()=>$,trim:()=>et});var i=n(741),r=I(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],(function(t,e){return t["[object "+e+"]"]=!0,t}),{}),o=I(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],(function(t,e){return t["[object "+e+"Array]"]=!0,t}),{}),a=Object.prototype.toString,s=Array.prototype,l=s.forEach,u=s.filter,h=s.slice,c=s.map,d=function(){}.constructor,f=d?d.prototype:null,p="__proto__",g=2311;function m(){return g++}function v(){for(var t=[],e=0;e{"use strict";n.r(e),n.d(e,{default:()=>o});var i=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},r=new function(){this.browser=new i,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(r.wxa=!0,r.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?r.worker=!0:!r.hasGlobalWindow||"Deno"in window?(r.node=!0,r.svgSupported=!0):function(t,e){var n=e.browser,i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);i&&(n.firefox=!0,n.version=i[1]);r&&(n.ie=!0,n.version=r[1]);o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18);a&&(n.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}(navigator.userAgent,r);const o=r},214:function(t,e){ +(()=>{var t={123:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>o});var i=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},r=new function(){this.browser=new i,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(r.wxa=!0,r.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?r.worker=!0:!r.hasGlobalWindow||"Deno"in window||"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Node.js")>-1?(r.node=!0,r.svgSupported=!0):function(t,e){var n=e.browser,i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);i&&(n.firefox=!0,n.version=i[1]);r&&(n.ie=!0,n.version=r[1]);o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18);a&&(n.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11);var s=e.domSupported="undefined"!=typeof document;if(s){var l=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in l||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in l)&&!("OTransition"in l),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}}(navigator.userAgent,r);const o=r},214:function(t,e){ /* @preserve * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade */ -!function(t){"use strict";function e(t){for(var e,n,i=1,r=arguments.length;i=this.min.x&&n.x<=this.max.x&&e.y>=this.min.y&&n.y<=this.max.y},intersects:function(t){t=k(t);var e=this.min,n=this.max,i=t.min,r=(t=t.max).x>=e.x&&i.x<=n.x;return t=t.y>=e.y&&i.y<=n.y,r&&t},overlaps:function(t){t=k(t);var e=this.min,n=this.max,i=t.min,r=(t=t.max).x>e.x&&i.xe.y&&i.y=i.lat&&n.lat<=r.lat&&e.lng>=i.lng&&n.lng<=r.lng},intersects:function(t){t=B(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=(t=t.getNorthEast()).lat>=e.lat&&i.lat<=n.lat;return t=t.lng>=e.lng&&i.lng<=n.lng,r&&t},overlaps:function(t){t=B(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=(t=t.getNorthEast()).lat>e.lat&&i.late.lng&&i.lng","http://www.w3.org/2000/svg"===(Ct.firstChild&&Ct.firstChild.namespaceURI));function At(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var Lt={ie:J,ielt9:$,edge:Q,webkit:tt,android:et,android23:nt,androidStock:it,opera:rt,chrome:ot,gecko:at,safari:st,phantom:lt,opera12:ut,win:ht,ie3d:ct,webkit3d:dt,gecko3d:K,any3d:ft,mobile:Kn,mobileWebkit:pt,mobileWebkit3d:gt,msPointer:mt,pointer:vt,touch:yt,touchNative:_t,mobileOpera:xt,mobileGecko:bt,retina:wt,passiveEvents:St,canvas:Tt,svg:Mt,vml:!Mt&&function(){try{var t=document.createElement("div"),e=(t.innerHTML='',t.firstChild);return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}(),inlineSvg:Ct,mac:0===navigator.platform.indexOf("Mac"),linux:0===navigator.platform.indexOf("Linux")},Dt=Lt.msPointer?"MSPointerDown":"pointerdown",It=Lt.msPointer?"MSPointerMove":"pointermove",Pt=Lt.msPointer?"MSPointerUp":"pointerup",Et=Lt.msPointer?"MSPointerCancel":"pointercancel",Ot={touchstart:Dt,touchmove:It,touchend:Pt,touchcancel:Et},Nt={touchstart:function(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&Ee(e),Vt(t,e)},touchmove:Vt,touchend:Vt,touchcancel:Vt},Rt={},kt=!1;function zt(t,e,n){return"touchstart"!==e||kt||(document.addEventListener(Dt,Bt,!0),document.addEventListener(It,Ft,!0),document.addEventListener(Pt,Ht,!0),document.addEventListener(Et,Ht,!0),kt=!0),Nt[e]?(n=Nt[e].bind(this,n),t.addEventListener(Ot[e],n,!1),n):(console.warn("wrong event specified:",e),u)}function Bt(t){Rt[t.pointerId]=t}function Ft(t){Rt[t.pointerId]&&(Rt[t.pointerId]=t)}function Ht(t){delete Rt[t.pointerId]}function Vt(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){for(var n in e.touches=[],Rt)e.touches.push(Rt[n]);e.changedTouches=[e],t(e)}}var Gt=200;function Ut(t,e){t.addEventListener("dblclick",e);var n,i=0;function r(t){var r;1!==t.detail?n=t.detail:"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||(r=Ne(t)).some((function(t){return t instanceof HTMLLabelElement&&t.attributes.for}))&&!r.some((function(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement}))||((r=Date.now())-i<=Gt?2==++n&&e(function(t){var e,n,i={};for(n in t)e=t[n],i[n]=e&&e.bind?e.bind(t):e;return(t=i).type="dblclick",i.detail=2,i.isTrusted=!1,i._simulated=!0,i}(t)):n=1,i=r)}return t.addEventListener("click",r),{dblclick:e,simDblclick:r}}var Wt,jt,Zt,Xt,qt,Yt,Kt=de(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Jt=de(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),$t="webkitTransition"===Jt||"OTransition"===Jt?Jt+"End":"transitionend";function Qt(t){return"string"==typeof t?document.getElementById(t):t}function te(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];return"auto"===(n=n&&"auto"!==n||!document.defaultView?n:(t=document.defaultView.getComputedStyle(t,null))?t[e]:null)?null:n}function ee(t,e,n){return(t=document.createElement(t)).className=e||"",n&&n.appendChild(t),t}function ne(t){var e=t.parentNode;e&&e.removeChild(t)}function ie(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function re(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function oe(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ae(t,e){return void 0!==t.classList?t.classList.contains(e):0<(t=he(t)).length&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(t)}function se(t,e){var n;if(void 0!==t.classList)for(var i=d(e),r=0,o=i.length;rthis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var n=this.getCenter();return t=this._limitCenter(n,this._zoom,B(t)),n.equals(t)||this.panTo(t,e),this._enforcingBounds=!1,this},panInside:function(t,e){var n=N((e=e||{}).paddingTopLeft||e.padding||[0,0]),i=N(e.paddingBottomRight||e.padding||[0,0]),r=this.project(this.getCenter()),o=(t=this.project(t),(n=k([(o=this.getPixelBounds()).min.add(n),o.max.subtract(i)])).getSize());return n.contains(t)||(this._enforcingBounds=!0,i=t.subtract(n.getCenter()),n=n.extend(t).getSize().subtract(o),r.x+=i.x<0?-n.x:n.x,r.y+=i.y<0?-n.y:n.y,this.panTo(this.unproject(r),e),this._enforcingBounds=!1),this},invalidateSize:function(t){if(!this._loaded)return this;t=e({animate:!1,pan:!0},!0===t?{animate:!0}:t);var n=this.getSize(),i=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),o=n.divideBy(2).round(),a=i.divideBy(2).round();return(o=o.subtract(a)).x||o.y?(t.animate&&t.pan?this.panBy(o):(t.pan&&this._rawPanBy(o),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:n,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){var n,i;return t=this._locateOptions=e({timeout:1e4,watch:!1},t),"geolocation"in navigator?(n=r(this._handleGeolocationResponse,this),i=r(this._handleGeolocationError,this),t.watch?this._locationWatchId=navigator.geolocation.watchPosition(n,i,t):navigator.geolocation.getCurrentPosition(n,i,t)):this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e;this._container._leaflet_id&&(e=t.code,t=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout"),this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+t+"."}))},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e,n,i=new F(t.coords.latitude,t.coords.longitude),r=i.toBounds(2*t.coords.accuracy),o=this._locateOptions,a=(o.setView&&(e=this.getBoundsZoom(r),this.setView(i,o.maxZoom?Math.min(e,o.maxZoom):e)),{latlng:i,bounds:r,timestamp:t.timestamp});for(n in t.coords)"number"==typeof t.coords[n]&&(a[n]=t.coords[n]);this.fire("locationfound",a)}},addHandler:function(t,e){return e&&(e=this[t]=new e(this),this._handlers.push(e),this.options[t]&&e.enable()),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}for(var t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ne(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(C(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ne(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){return e=ee("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane),t&&(this._panes[t]=e),e},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new z(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,n){t=B(t),n=N(n||[0,0]);var i=this.getZoom()||0,r=this.getMinZoom(),o=this.getMaxZoom(),a=t.getNorthWest(),s=(t=t.getSouthEast(),n=this.getSize().subtract(n),t=k(this.project(t,i),this.project(a,i)).getSize(),a=Lt.any3d?this.options.zoomSnap:1,n.x/t.x);return n=n.y/t.y,t=e?Math.max(s,n):Math.min(s,n),i=this.getScaleZoom(t,i),a&&(i=Math.round(i/(a/100))*(a/100),i=e?Math.ceil(i/a)*a:Math.floor(i/a)*a),Math.max(r,Math.min(o,i))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new E(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){return new R(t=this._getTopLeftPoint(t,e),t.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,n.scale(t)/n.scale(e)},getScaleZoom:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,t=n.zoom(t*n.scale(e)),isNaN(t)?1/0:t},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(H(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(N(t),e)},layerPointToLatLng:function(t){return t=N(t).add(this.getPixelOrigin()),this.unproject(t)},latLngToLayerPoint:function(t){return this.project(H(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(H(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(B(t))},distance:function(t,e){return this.options.crs.distance(H(t),H(e))},containerPointToLayerPoint:function(t){return N(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return N(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){return t=this.containerPointToLayerPoint(N(t)),this.layerPointToLatLng(t)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(H(t)))},mouseEventToContainerPoint:function(t){return Re(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){if(!(t=this._container=Qt(t)))throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");we(t,"scroll",this._onScroll,this),this._containerId=a(t)},_initLayout:function(){var t=this._container,e=(this._fadeAnimated=this.options.fadeAnimation&&Lt.any3d,se(t,"leaflet-container"+(Lt.touch?" leaflet-touch":"")+(Lt.retina?" leaflet-retina":"")+(Lt.ielt9?" leaflet-oldie":"")+(Lt.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":"")),te(t,"position"));"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),pe(this._mapPane,new E(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(se(t.markerPane,"leaflet-zoom-hide"),se(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,n){pe(this._mapPane,new E(0,0));var i=!this._loaded,r=(this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset"),this._zoom!==e);this._moveStart(r,n)._move(t,e)._moveEnd(r),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,n,i){void 0===e&&(e=this._zoom);var r=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),i?n&&n.pinch&&this.fire("zoom",n):((r||n&&n.pinch)&&this.fire("zoom",n),this.fire("move",n)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return C(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){pe(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={};var e=t?Te:we;e((this._targets[a(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),Lt.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){C(this._resizeRequest),this._resizeRequest=M((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var n,i=[],r="mouseout"===e||"mouseover"===e,o=t.target||t.srcElement,s=!1;o;){if((n=this._targets[a(o)])&&("click"===e||"preclick"===e)&&this._draggableMoved(n)){s=!0;break}if(n&&n.listens(e,!0)){if(r&&!Be(o,t))break;if(i.push(n),r)break}if(o===this._container)break;o=o.parentNode}return i.length||s||r||!this.listens(e,!0)?i:[this]},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e,n=t.target||t.srcElement;!this._loaded||n._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(n)||("mousedown"===(e=t.type)&&_e(n),this._fireDOMEvent(t,e))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,n,i){"click"===t.type&&((l=e({},t)).type="preclick",this._fireDOMEvent(l,l.type,i));var r=this._findEventTargets(t,n);if(i){for(var o=[],a=0;athis.options.zoomAnimationThreshold)return!1;var i=this.getZoomScale(e);if(i=this._getCenterOffset(t)._divideBy(1-1/i),!0!==n.animate&&!this.getSize().contains(i))return!1;M((function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(t,e,!0)}),this)}return!0},_animateZoom:function(t,e,n,i){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,se(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:i}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&le(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Ve(t){return new Ue(t)}var Ge,Ue=D.extend({options:{position:"topright"},initialize:function(t){f(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),n=this.getPosition();return t=t._controlCorners[n],se(e,"leaflet-control"),-1!==n.indexOf("bottom")?t.insertBefore(e,t.firstChild):t.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(ne(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",(e=document.createElement("div")).innerHTML=t,e.firstChild},_addItem:function(t){var e,n=document.createElement("label"),i=this._map.hasLayer(t.layer),r=((t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=i):e=this._createRadioElement("leaflet-base-layers_"+a(this),i),this._layerControlInputs.push(e),e.layerId=a(t.layer),we(e,"click",this._onInputClick,this),i=document.createElement("span")).innerHTML=" "+t.name,document.createElement("span"));return n.appendChild(r),r.appendChild(e),r.appendChild(i),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var t,e,n=this._layerControlInputs,i=[],r=[];this._handlingClick=!0;for(var o=n.length-1;0<=o;o--)t=n[o],e=this._getLayer(t.layerId).layer,t.checked?i.push(e):t.checked||r.push(e);for(o=0;oe.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section,e=(this._preventClick=!0,we(t,"click",Ee),this.expand(),this);setTimeout((function(){Te(t,"click",Ee),e._preventClick=!1}))}})),je=Ue.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",n=ee("div",e+" leaflet-bar"),i=this.options;return this._zoomInButton=this._createButton(i.zoomInText,i.zoomInTitle,e+"-in",n,this._zoomIn),this._zoomOutButton=this._createButton(i.zoomOutText,i.zoomOutTitle,e+"-out",n,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),n},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,n,i,r){return(n=ee("a",n,i)).innerHTML=t,n.href="#",n.title=e,n.setAttribute("role","button"),n.setAttribute("aria-label",e),Pe(n),we(n,"click",Oe),we(n,"click",r,this),we(n,"click",this._refocusOnMap,this),n},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";le(this._zoomInButton,e),le(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),!this._disabled&&t._zoom!==t.getMinZoom()||(se(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),!this._disabled&&t._zoom!==t.getMaxZoom()||(se(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}}),Ze=(He.mergeOptions({zoomControl:!0}),He.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new je,this.addControl(this.zoomControl))})),Ue.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",n=ee("div",e),i=this.options;return this._addScales(i,e+"-line",n),t.on(i.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),n},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,n){t.metric&&(this._mScale=ee("div",e,n)),t.imperial&&(this._iScale=ee("div",e,n))},_update:function(){var t=(e=this._map).getSize().y/2,e=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t);this._updateScale(this._mScale,e<1e3?e+" m":e/1e3+" km",e/t)},_updateImperial:function(t){var e,n;5280<(t*=3.2808399)?(n=this._getRoundNum(e=t/5280),this._updateScale(this._iScale,n+" mi",n/e)):(n=this._getRoundNum(t),this._updateScale(this._iScale,n+" ft",n/t))},_updateScale:function(t,e,n){t.style.width=Math.round(this.options.maxWidth*n)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1);return e*(10<=(t/=e)?10:5<=t?5:3<=t?3:2<=t?2:1)}})),Xe=Ue.extend({options:{position:"bottomright",prefix:''+(Lt.inlineSvg?' ':"")+"Leaflet"},initialize:function(t){f(this,t),this._attributions={}},onAdd:function(t){for(var e in(t.attributionControl=this)._container=ee("div","leaflet-control-attribution"),Pe(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",(function(){this.removeAttribution(t.layer.getAttribution())}),this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t,e=[];for(t in this._attributions)this._attributions[t]&&e.push(t);var n=[];this.options.prefix&&n.push(this.options.prefix),e.length&&n.push(e.join(", ")),this._container.innerHTML=n.join(' ')}}}),qe=(He.mergeOptions({attributionControl:!0}),He.addInitHook((function(){this.options.attributionControl&&(new Xe).addTo(this)})),Ue.Layers=We,Ue.Zoom=je,Ue.Scale=Ze,Ue.Attribution=Xe,Ve.layers=function(t,e,n){return new We(t,e,n)},Ve.zoom=function(t){return new je(t)},Ve.scale=function(t){return new Ze(t)},Ve.attribution=function(t){return new Xe(t)},Q=D.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}}),Q.addTo=function(t,e){return t.addHandler(e,this),this},tt={Events:I},Lt.touch?"touchstart mousedown":"mousedown"),Ye=P.extend({options:{clickTolerance:3},initialize:function(t,e,n,i){f(this,i),this._element=t,this._dragStartTarget=e||t,this._preventOutline=n},enable:function(){this._enabled||(we(this._dragStartTarget,qe,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ye._dragging===this&&this.finishDrag(!0),Te(this._dragStartTarget,qe,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){var e,n;this._enabled&&(this._moved=!1,ae(this._element,"leaflet-zoom-anim")||(t.touches&&1!==t.touches.length?Ye._dragging===this&&this.finishDrag():Ye._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((Ye._dragging=this)._preventOutline&&_e(this._element),me(),Zt(),this._moving||(this.fire("down"),n=t.touches?t.touches[0]:t,e=xe(this._element),this._startPoint=new E(n.clientX,n.clientY),this._startPos=ge(this._element),this._parentScale=be(e),n="mousedown"===t.type,we(document,n?"mousemove":"touchmove",this._onMove,this),we(document,n?"mouseup":"touchend touchcancel",this._onUp,this)))))},_onMove:function(t){var e;this._enabled&&(t.touches&&1e&&(n.push(t[i]),r=i);return re.max.x&&(n|=2),t.ye.max.y&&(n|=8),n}function on(t,e,n,i){var r=e.x,o=(e=e.y,n.x-r),a=n.y-e,s=o*o+a*a;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(u=!u);return u||yn.prototype._containsPoint.call(this,t,!0)}}),bn=cn.extend({initialize:function(t,e){f(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,n,i,r=v(t)?t:t.features;if(r){for(e=0,n=r.length;eo.x&&(a=n.x+s-o.x+r.x),n.x-a-i.x<(s=0)&&(a=n.x-i.x),n.y+e+r.y>o.y&&(s=n.y+e-o.y+r.y),n.y-s-i.y<0&&(s=n.y-i.y),(a||s)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([a,s]))))},_getAnchor:function(){return N(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}})),kn=(He.mergeOptions({closePopupOnClick:!0}),He.include({openPopup:function(t,e,n){return this._initOverlay(Rn,t,e,n).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),ut.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Rn,this._popup,t,e),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof cn||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e;this._popup&&this._map&&(Oe(t),e=t.layer||t.target,this._popup._source!==e||e instanceof mn?(this._popup._source=e,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}}),Nn.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Nn.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Nn.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Nn.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ee("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+a(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,n=this._map,i=this._container,r=n.latLngToContainerPoint(n.getCenter()),o=(n=n.layerPointToContainerPoint(t),this.options.direction),a=i.offsetWidth,s=i.offsetHeight,l=N(this.options.offset),u=this._getAnchor();n="top"===o?(e=a/2,s):"bottom"===o?(e=a/2,0):(e="center"===o?a/2:"right"===o?0:"left"===o?a:n.xthis.options.maxZoom||ithis.options.maxZoom||void 0!==this.options.minZoom&&rn.max.x)||!e.wrapLat&&(t.yn.max.y))return!1}return!this.options.bounds||(e=this._tileCoordsToBounds(t),B(this.options.bounds).overlaps(e))},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,n=this.getTileSize(),i=t.scaleBy(n);return n=i.add(n),[e.unproject(i,t.z),e.unproject(n,t.z)]},_tileCoordsToBounds:function(t){return t=new z((t=this._tileCoordsToNwSe(t))[0],t[1]),this.options.noWrap?t:this._map.wrapLatLngBounds(t)},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=new E(+(t=t.split(":"))[0],+t[1]);return e.z=+t[2],e},_removeTile:function(t){var e=this._tiles[t];e&&(ne(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){se(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=u,t.onmousemove=u,Lt.ielt9&&this.options.opacity<1&&ce(t,this.options.opacity)},_addTile:function(t,e){var n=this._getTilePos(t),i=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),r(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(r(this._tileReady,this,t,null,o)),pe(o,n),this._tiles[i]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,n){e&&this.fire("tileerror",{error:e,tile:n,coords:t});var i=this._tileCoordsToKey(t);(n=this._tiles[i])&&(n.loaded=+new Date,this._map._fadeAnimated?(ce(n.el,0),C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),e||(se(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Lt.ielt9||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new E(this._wrapX?l(t.x,this._wrapX):t.x,this._wrapY?l(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new R(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}}),Fn=Bn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,(e=f(this,e)).detectRetina&&Lt.retina&&0')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Zn=(dt={_initContainer:function(){this._container=ee("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Gn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=jn("shape");se(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=jn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ne(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,n=t._fill,i=t.options,r=t._container;r.stroked=!!i.stroke,r.filled=!!i.fill,i.stroke?(e=e||(t._stroke=jn("stroke")),r.appendChild(e),e.weight=i.weight+"px",e.color=i.color,e.opacity=i.opacity,i.dashArray?e.dashStyle=v(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=i.lineCap.replace("butt","flat"),e.joinstyle=i.lineJoin):e&&(r.removeChild(e),t._stroke=null),i.fill?(n=n||(t._fill=jn("fill")),r.appendChild(n),n.color=i.fillColor||i.color,n.opacity=i.fillOpacity):n&&(r.removeChild(n),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),n=Math.round(t._radius),i=Math.round(t._radiusY||n);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+n+","+i+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){re(t._container)},_bringToBack:function(t){oe(t._container)}},Lt.vml?jn:q),Xn=Gn.extend({_initContainer:function(){this._container=Zn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Zn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ne(this._container),Te(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){var t,e,n;this._map._animatingZoom&&this._bounds||(Gn.prototype._update.call(this),e=(t=this._bounds).getSize(),n=this._container,this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,n.setAttribute("width",e.x),n.setAttribute("height",e.y)),pe(n,t.min),n.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update"))},_initPath:function(t){var e=t._path=Zn("path");t.options.className&&se(e,t.options.className),t.options.interactive&&se(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ne(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path;t=t.options,e&&(t.stroke?(e.setAttribute("stroke",t.color),e.setAttribute("stroke-opacity",t.opacity),e.setAttribute("stroke-width",t.weight),e.setAttribute("stroke-linecap",t.lineCap),e.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?e.setAttribute("stroke-dasharray",t.dashArray):e.removeAttribute("stroke-dasharray"),t.dashOffset?e.setAttribute("stroke-dashoffset",t.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),t.fill?(e.setAttribute("fill",t.fillColor||t.color),e.setAttribute("fill-opacity",t.fillOpacity),e.setAttribute("fill-rule",t.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Y(t._parts,e))},_updateCircle:function(t){var e=t._point,n=Math.max(Math.round(t._radius),1),i="a"+n+","+(Math.max(Math.round(t._radiusY),1)||n)+" 0 1,0 ";e=t._empty()?"M0 0":"M"+(e.x-n)+","+e.y+i+2*n+",0 "+i+2*-n+",0 ",this._setPath(t,e)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){re(t._path)},_bringToBack:function(t){oe(t._path)}});function qn(t){return Lt.svg||Lt.vml?new Xn(t):null}Lt.vml&&Xn.include(dt),He.include({getRenderer:function(t){return t=(t=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(t){var e;return"overlayPane"!==t&&void 0!==t&&(void 0===(e=this._paneRenderers[t])&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e)},_createRenderer:function(t){return this.options.preferCanvas&&Wn(t)||qn(t)}});var Yn=xn.extend({initialize:function(t,e){xn.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=B(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});Xn.create=Zn,Xn.pointsToPath=Y,bn.geometryToLayer=wn,bn.coordsToLatLng=Tn,bn.coordsToLatLngs=Mn,bn.latLngToCoords=Cn,bn.latLngsToCoords=An,bn.getFeature=Ln,bn.asFeature=Dn,He.mergeOptions({boxZoom:!0}),K=Q.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){we(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Te(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ne(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),Zt(),me(),this._startPoint=this._map.mouseEventToContainerPoint(t),we(document,{contextmenu:Oe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=ee("div","leaflet-zoom-box",this._container),se(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=(t=new R(this._point,this._startPoint)).getSize();pe(this._box,t.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ne(this._box),le(this._container,"leaflet-crosshair")),Xt(),ve(),Te(document,{contextmenu:Oe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){1!==t.which&&1!==t.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0),t=new z(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})))},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}}),He.addInitHook("addHandler","boxZoom",K),He.mergeOptions({doubleClickZoom:!0}),ft=Q.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,n=e.getZoom(),i=e.options.zoomDelta;n=t.originalEvent.shiftKey?n-i:n+i,"center"===e.options.doubleClickZoom?e.setZoom(n):e.setZoomAround(t.containerPoint,n)}});var Kn=(He.addInitHook("addHandler","doubleClickZoom",ft),He.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0}),Q.extend({addHooks:function(){var t;this._draggable||(t=this._map,this._draggable=new Ye(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))),se(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){le(this._map._container,"leaflet-grab"),le(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t,e=this._map;e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(t=B(this._map.options.maxBounds),this._offsetLimit=k(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null,e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){var e,n;this._map.options.inertia&&(e=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(n),this._times.push(e),this._prunePositions(e)),this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t))},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),n=this._initialWorldOffset,i=((r=this._draggable._newPos.x)-e+n)%t+e-n,r=(r+e+n)%t-e-n;t=Math.abs(i+n)e.getMaxZoom()&&1{"use strict";n.d(e,{Ay:()=>o});var i=function(t){this.value=t},r=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new i(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}();const o=function(){function t(t){this._list=new r,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var n=this._list,r=this._map,o=null;if(null==r[t]){var a=n.len(),s=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var l=n.head;n.remove(l),delete r[l.key],o=l.value,this._lastRemovedEntry=l}s?s.value=e:s=new i(e),s.key=t,n.insertEntry(s),r[t]=s}return o},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}()},543:function(t,e,n){var i; -/** - * @license - * Lodash - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */t=n.nmd(t),function(){var r,o="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",l=16,u=32,h=64,c=128,d=256,f=1/0,p=9007199254740991,g=NaN,m=4294967295,v=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",l],["flip",512],["partial",u],["partialRight",h],["rearg",d]],_="[object Arguments]",y="[object Array]",x="[object Boolean]",b="[object Date]",w="[object Error]",S="[object Function]",T="[object GeneratorFunction]",M="[object Map]",C="[object Number]",A="[object Object]",L="[object Promise]",D="[object RegExp]",I="[object Set]",P="[object String]",E="[object Symbol]",O="[object WeakMap]",N="[object ArrayBuffer]",R="[object DataView]",k="[object Float32Array]",z="[object Float64Array]",B="[object Int8Array]",F="[object Int16Array]",H="[object Int32Array]",V="[object Uint8Array]",G="[object Uint8ClampedArray]",U="[object Uint16Array]",W="[object Uint32Array]",j=/\b__p \+= '';/g,Z=/\b(__p \+=) '' \+/g,X=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,Y=/[&<>"']/g,K=RegExp(q.source),J=RegExp(Y.source),$=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,it=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rt=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(rt.source),at=/^\s+/,st=/\s/,lt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ut=/\{\n\/\* \[wrapped with (.+)\] \*/,ht=/,? & /,ct=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,dt=/[()=,{}\[\]\/\s]/,ft=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,gt=/\w*$/,mt=/^[-+]0x[0-9a-f]+$/i,vt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,yt=/^0o[0-7]+$/i,xt=/^(?:0|[1-9]\d*)$/,bt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,wt=/($^)/,St=/['\n\r\u2028\u2029\\]/g,Tt="\\ud800-\\udfff",Mt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ct="\\u2700-\\u27bf",At="a-z\\xdf-\\xf6\\xf8-\\xff",Lt="A-Z\\xc0-\\xd6\\xd8-\\xde",Dt="\\ufe0e\\ufe0f",It="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Pt="['’]",Et="["+Tt+"]",Ot="["+It+"]",Nt="["+Mt+"]",Rt="\\d+",kt="["+Ct+"]",zt="["+At+"]",Bt="[^"+Tt+It+Rt+Ct+At+Lt+"]",Ft="\\ud83c[\\udffb-\\udfff]",Ht="[^"+Tt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",Gt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ut="["+Lt+"]",Wt="\\u200d",jt="(?:"+zt+"|"+Bt+")",Zt="(?:"+Ut+"|"+Bt+")",Xt="(?:['’](?:d|ll|m|re|s|t|ve))?",qt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Yt="(?:"+Nt+"|"+Ft+")"+"?",Kt="["+Dt+"]?",Jt=Kt+Yt+("(?:"+Wt+"(?:"+[Ht,Vt,Gt].join("|")+")"+Kt+Yt+")*"),$t="(?:"+[kt,Vt,Gt].join("|")+")"+Jt,Qt="(?:"+[Ht+Nt+"?",Nt,Vt,Gt,Et].join("|")+")",te=RegExp(Pt,"g"),ee=RegExp(Nt,"g"),ne=RegExp(Ft+"(?="+Ft+")|"+Qt+Jt,"g"),ie=RegExp([Ut+"?"+zt+"+"+Xt+"(?="+[Ot,Ut,"$"].join("|")+")",Zt+"+"+qt+"(?="+[Ot,Ut+jt,"$"].join("|")+")",Ut+"?"+jt+"+"+Xt,Ut+"+"+qt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Rt,$t].join("|"),"g"),re=RegExp("["+Wt+Tt+Mt+Dt+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ae=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],se=-1,le={};le[k]=le[z]=le[B]=le[F]=le[H]=le[V]=le[G]=le[U]=le[W]=!0,le[_]=le[y]=le[N]=le[x]=le[R]=le[b]=le[w]=le[S]=le[M]=le[C]=le[A]=le[D]=le[I]=le[P]=le[O]=!1;var ue={};ue[_]=ue[y]=ue[N]=ue[R]=ue[x]=ue[b]=ue[k]=ue[z]=ue[B]=ue[F]=ue[H]=ue[M]=ue[C]=ue[A]=ue[D]=ue[I]=ue[P]=ue[E]=ue[V]=ue[G]=ue[U]=ue[W]=!0,ue[w]=ue[S]=ue[O]=!1;var he={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ce=parseFloat,de=parseInt,fe="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,pe="object"==typeof self&&self&&self.Object===Object&&self,ge=fe||pe||Function("return this")(),me=e&&!e.nodeType&&e,ve=me&&t&&!t.nodeType&&t,_e=ve&&ve.exports===me,ye=_e&&fe.process,xe=function(){try{var t=ve&&ve.require&&ve.require("util").types;return t||ye&&ye.binding&&ye.binding("util")}catch(t){}}(),be=xe&&xe.isArrayBuffer,we=xe&&xe.isDate,Se=xe&&xe.isMap,Te=xe&&xe.isRegExp,Me=xe&&xe.isSet,Ce=xe&&xe.isTypedArray;function Ae(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Le(t,e,n,i){for(var r=-1,o=null==t?0:t.length;++r-1}function Ne(t,e,n){for(var i=-1,r=null==t?0:t.length;++i-1;);return n}function rn(t,e){for(var n=t.length;n--&&Ue(e,t[n],0)>-1;);return n}var on=qe({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),an=qe({"&":"&","<":"<",">":">",'"':""","'":"'"});function sn(t){return"\\"+he[t]}function ln(t){return re.test(t)}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t,i){n[++e]=[i,t]})),n}function hn(t,e){return function(n){return t(e(n))}}function cn(t,e){for(var n=-1,i=t.length,r=0,o=[];++n",""":'"',"'":"'"});var _n=function t(e){var n,i=(e=null==e?ge:_n.defaults(ge.Object(),e,_n.pick(ge,ae))).Array,st=e.Date,Tt=e.Error,Mt=e.Function,Ct=e.Math,At=e.Object,Lt=e.RegExp,Dt=e.String,It=e.TypeError,Pt=i.prototype,Et=Mt.prototype,Ot=At.prototype,Nt=e["__core-js_shared__"],Rt=Et.toString,kt=Ot.hasOwnProperty,zt=0,Bt=(n=/[^.]+$/.exec(Nt&&Nt.keys&&Nt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ft=Ot.toString,Ht=Rt.call(At),Vt=ge._,Gt=Lt("^"+Rt.call(kt).replace(rt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ut=_e?e.Buffer:r,Wt=e.Symbol,jt=e.Uint8Array,Zt=Ut?Ut.allocUnsafe:r,Xt=hn(At.getPrototypeOf,At),qt=At.create,Yt=Ot.propertyIsEnumerable,Kt=Pt.splice,Jt=Wt?Wt.isConcatSpreadable:r,$t=Wt?Wt.iterator:r,Qt=Wt?Wt.toStringTag:r,ne=function(){try{var t=fo(At,"defineProperty");return t({},"",{}),t}catch(t){}}(),re=e.clearTimeout!==ge.clearTimeout&&e.clearTimeout,he=st&&st.now!==ge.Date.now&&st.now,fe=e.setTimeout!==ge.setTimeout&&e.setTimeout,pe=Ct.ceil,me=Ct.floor,ve=At.getOwnPropertySymbols,ye=Ut?Ut.isBuffer:r,xe=e.isFinite,He=Pt.join,qe=hn(At.keys,At),yn=Ct.max,xn=Ct.min,bn=st.now,wn=e.parseInt,Sn=Ct.random,Tn=Pt.reverse,Mn=fo(e,"DataView"),Cn=fo(e,"Map"),An=fo(e,"Promise"),Ln=fo(e,"Set"),Dn=fo(e,"WeakMap"),In=fo(At,"create"),Pn=Dn&&new Dn,En={},On=Fo(Mn),Nn=Fo(Cn),Rn=Fo(An),kn=Fo(Ln),zn=Fo(Dn),Bn=Wt?Wt.prototype:r,Fn=Bn?Bn.valueOf:r,Hn=Bn?Bn.toString:r;function Vn(t){if(ns(t)&&!ja(t)&&!(t instanceof jn)){if(t instanceof Wn)return t;if(kt.call(t,"__wrapped__"))return Ho(t)}return new Wn(t)}var Gn=function(){function t(){}return function(e){if(!es(e))return{};if(qt)return qt(e);t.prototype=e;var n=new t;return t.prototype=r,n}}();function Un(){}function Wn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=r}function jn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Zn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function ui(t,e,n,i,o,a){var s,l=1&e,u=2&e,h=4&e;if(n&&(s=o?n(t,i,o,a):n(t)),s!==r)return s;if(!es(t))return t;var c=ja(t);if(c){if(s=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&kt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!l)return Ir(t,s)}else{var d=mo(t),f=d==S||d==T;if(Ya(t))return Tr(t,l);if(d==A||d==_||f&&!o){if(s=u||f?{}:_o(t),!l)return u?function(t,e){return Pr(t,go(t),e)}(t,function(t,e){return t&&Pr(e,Os(e),t)}(s,t)):function(t,e){return Pr(t,po(t),e)}(t,oi(s,t))}else{if(!ue[d])return o?t:{};s=function(t,e,n){var i=t.constructor;switch(e){case N:return Mr(t);case x:case b:return new i(+t);case R:return function(t,e){var n=e?Mr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case k:case z:case B:case F:case H:case V:case G:case U:case W:return Cr(t,n);case M:return new i;case C:case P:return new i(t);case D:return function(t){var e=new t.constructor(t.source,gt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case I:return new i;case E:return r=t,Fn?At(Fn.call(r)):{}}var r}(t,d,l)}}a||(a=new Kn);var p=a.get(t);if(p)return p;a.set(t,s),ss(t)?t.forEach((function(i){s.add(ui(i,e,n,i,t,a))})):is(t)&&t.forEach((function(i,r){s.set(r,ui(i,e,n,r,t,a))}));var g=c?r:(h?u?oo:ro:u?Os:Es)(t);return De(g||t,(function(i,r){g&&(i=t[r=i]),ni(s,r,ui(i,e,n,r,t,a))})),s}function hi(t,e,n){var i=n.length;if(null==t)return!i;for(t=At(t);i--;){var o=n[i],a=e[o],s=t[o];if(s===r&&!(o in t)||!a(s))return!1}return!0}function ci(t,e,n){if("function"!=typeof t)throw new It(o);return Eo((function(){t.apply(r,n)}),e)}function di(t,e,n,i){var r=-1,o=Oe,a=!0,s=t.length,l=[],u=e.length;if(!s)return l;n&&(e=Re(e,Qe(n))),i?(o=Ne,a=!1):e.length>=200&&(o=en,a=!1,e=new Yn(e));t:for(;++r-1},Xn.prototype.set=function(t,e){var n=this.__data__,i=ii(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new Zn,map:new(Cn||Xn),string:new Zn}},qn.prototype.delete=function(t){var e=ho(this,t).delete(t);return this.size-=e?1:0,e},qn.prototype.get=function(t){return ho(this,t).get(t)},qn.prototype.has=function(t){return ho(this,t).has(t)},qn.prototype.set=function(t,e){var n=ho(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this},Yn.prototype.add=Yn.prototype.push=function(t){return this.__data__.set(t,a),this},Yn.prototype.has=function(t){return this.__data__.has(t)},Kn.prototype.clear=function(){this.__data__=new Xn,this.size=0},Kn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Kn.prototype.get=function(t){return this.__data__.get(t)},Kn.prototype.has=function(t){return this.__data__.has(t)},Kn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Xn){var i=n.__data__;if(!Cn||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new qn(i)}return n.set(t,e),this.size=n.size,this};var fi=Nr(bi),pi=Nr(wi,!0);function gi(t,e){var n=!0;return fi(t,(function(t,i,r){return n=!!e(t,i,r)})),n}function mi(t,e,n){for(var i=-1,o=t.length;++i0&&n(s)?e>1?_i(s,e-1,n,i,r):ke(r,s):i||(r[r.length]=s)}return r}var yi=Rr(),xi=Rr(!0);function bi(t,e){return t&&yi(t,e,Es)}function wi(t,e){return t&&xi(t,e,Es)}function Si(t,e){return Ee(e,(function(e){return $a(t[e])}))}function Ti(t,e){for(var n=0,i=(e=xr(e,t)).length;null!=t&&ne}function Li(t,e){return null!=t&&kt.call(t,e)}function Di(t,e){return null!=t&&e in At(t)}function Ii(t,e,n){for(var o=n?Ne:Oe,a=t[0].length,s=t.length,l=s,u=i(s),h=1/0,c=[];l--;){var d=t[l];l&&e&&(d=Re(d,Qe(e))),h=xn(d.length,h),u[l]=!n&&(e||a>=120&&d.length>=120)?new Yn(l&&d):r}d=t[0];var f=-1,p=u[0];t:for(;++f=s?l:l*("desc"==n[i]?-1:1)}return t.index-e.index}(t,e,n)}))}function Zi(t,e,n){for(var i=-1,r=e.length,o={};++i-1;)s!==t&&Kt.call(s,l,1),Kt.call(t,l,1);return t}function qi(t,e){for(var n=t?e.length:0,i=n-1;n--;){var r=e[n];if(n==i||r!==o){var o=r;xo(r)?Kt.call(t,r,1):dr(t,r)}}return t}function Yi(t,e){return t+me(Sn()*(e-t+1))}function Ki(t,e){var n="";if(!t||e<1||e>p)return n;do{e%2&&(n+=t),(e=me(e/2))&&(t+=t)}while(e);return n}function Ji(t,e){return Oo(Lo(t,e,rl),t+"")}function $i(t){return $n(Vs(t))}function Qi(t,e){var n=Vs(t);return ko(n,li(e,0,n.length))}function tr(t,e,n,i){if(!es(t))return t;for(var o=-1,a=(e=xr(e,t)).length,s=a-1,l=t;null!=l&&++oo?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var a=i(o);++r>>1,a=t[o];null!==a&&!us(a)&&(n?a<=e:a=200){var u=e?null:Kr(t);if(u)return dn(u);a=!1,r=en,l=new Yn}else l=e?[]:s;t:for(;++i=i?t:rr(t,e,n)}var Sr=re||function(t){return ge.clearTimeout(t)};function Tr(t,e){if(e)return t.slice();var n=t.length,i=Zt?Zt(n):new t.constructor(n);return t.copy(i),i}function Mr(t){var e=new t.constructor(t.byteLength);return new jt(e).set(new jt(t)),e}function Cr(t,e){var n=e?Mr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ar(t,e){if(t!==e){var n=t!==r,i=null===t,o=t==t,a=us(t),s=e!==r,l=null===e,u=e==e,h=us(e);if(!l&&!h&&!a&&t>e||a&&s&&u&&!l&&!h||i&&s&&u||!n&&u||!o)return 1;if(!i&&!a&&!h&&t1?n[o-1]:r,s=o>2?n[2]:r;for(a=t.length>3&&"function"==typeof a?(o--,a):r,s&&bo(n[0],n[1],s)&&(a=o<3?r:a,o=1),e=At(e);++i-1?o[a?e[s]:s]:r}}function Hr(t){return io((function(e){var n=e.length,i=n,a=Wn.prototype.thru;for(t&&e.reverse();i--;){var s=e[i];if("function"!=typeof s)throw new It(o);if(a&&!l&&"wrapper"==so(s))var l=new Wn([],!0)}for(i=l?i:n;++i1&&x.reverse(),f&&hl))return!1;var h=a.get(t),c=a.get(e);if(h&&c)return h==e&&c==t;var d=-1,f=!0,p=2&n?new Yn:r;for(a.set(t,e),a.set(e,t);++d-1&&t%1==0&&t1?"& ":"")+e[i],e=e.join(n>2?", ":" "),t.replace(lt,"{\n/* [wrapped with "+e+"] */\n")}(i,function(t,e){return De(v,(function(n){var i="_."+n[0];e&n[1]&&!Oe(t,i)&&t.push(i)})),t.sort()}(function(t){var e=t.match(ut);return e?e[1].split(ht):[]}(i),n)))}function Ro(t){var e=0,n=0;return function(){var i=bn(),o=16-(i-n);if(n=i,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(r,arguments)}}function ko(t,e){var n=-1,i=t.length,o=i-1;for(e=e===r?i:e;++n1?t[e-1]:r;return n="function"==typeof n?(t.pop(),n):r,aa(t,n)}));function fa(t){var e=Vn(t);return e.__chain__=!0,e}function pa(t,e){return e(t)}var ga=io((function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,o=function(e){return si(e,t)};return!(e>1||this.__actions__.length)&&i instanceof jn&&xo(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:pa,args:[o],thisArg:r}),new Wn(i,this.__chain__).thru((function(t){return e&&!t.length&&t.push(r),t}))):this.thru(o)}));var ma=Er((function(t,e,n){kt.call(t,n)?++t[n]:ai(t,n,1)}));var va=Fr(Wo),_a=Fr(jo);function ya(t,e){return(ja(t)?De:fi)(t,uo(e,3))}function xa(t,e){return(ja(t)?Ie:pi)(t,uo(e,3))}var ba=Er((function(t,e,n){kt.call(t,n)?t[n].push(e):ai(t,n,[e])}));var wa=Ji((function(t,e,n){var r=-1,o="function"==typeof e,a=Xa(t)?i(t.length):[];return fi(t,(function(t){a[++r]=o?Ae(e,t,n):Pi(t,e,n)})),a})),Sa=Er((function(t,e,n){ai(t,n,e)}));function Ta(t,e){return(ja(t)?Re:Hi)(t,uo(e,3))}var Ma=Er((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Ca=Ji((function(t,e){if(null==t)return[];var n=e.length;return n>1&&bo(t,e[0],e[1])?e=[]:n>2&&bo(e[0],e[1],e[2])&&(e=[e[0]]),ji(t,_i(e,1),[])})),Aa=he||function(){return ge.Date.now()};function La(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,$r(t,c,r,r,r,r,e)}function Da(t,e){var n;if("function"!=typeof e)throw new It(o);return t=gs(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=r),n}}var Ia=Ji((function(t,e,n){var i=1;if(n.length){var r=cn(n,lo(Ia));i|=u}return $r(t,i,e,n,r)})),Pa=Ji((function(t,e,n){var i=3;if(n.length){var r=cn(n,lo(Pa));i|=u}return $r(e,i,t,n,r)}));function Ea(t,e,n){var i,a,s,l,u,h,c=0,d=!1,f=!1,p=!0;if("function"!=typeof t)throw new It(o);function g(e){var n=i,o=a;return i=a=r,c=e,l=t.apply(o,n)}function m(t){var n=t-h;return h===r||n>=e||n<0||f&&t-c>=s}function v(){var t=Aa();if(m(t))return _(t);u=Eo(v,function(t){var n=e-(t-h);return f?xn(n,s-(t-c)):n}(t))}function _(t){return u=r,p&&i?g(t):(i=a=r,l)}function y(){var t=Aa(),n=m(t);if(i=arguments,a=this,h=t,n){if(u===r)return function(t){return c=t,u=Eo(v,e),d?g(t):l}(h);if(f)return Sr(u),u=Eo(v,e),g(h)}return u===r&&(u=Eo(v,e)),l}return e=vs(e)||0,es(n)&&(d=!!n.leading,s=(f="maxWait"in n)?yn(vs(n.maxWait)||0,e):s,p="trailing"in n?!!n.trailing:p),y.cancel=function(){u!==r&&Sr(u),c=0,i=h=a=u=r},y.flush=function(){return u===r?l:_(Aa())},y}var Oa=Ji((function(t,e){return ci(t,1,e)})),Na=Ji((function(t,e,n){return ci(t,vs(e)||0,n)}));function Ra(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new It(o);var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var a=t.apply(this,i);return n.cache=o.set(r,a)||o,a};return n.cache=new(Ra.Cache||qn),n}function ka(t){if("function"!=typeof t)throw new It(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ra.Cache=qn;var za=br((function(t,e){var n=(e=1==e.length&&ja(e[0])?Re(e[0],Qe(uo())):Re(_i(e,1),Qe(uo()))).length;return Ji((function(i){for(var r=-1,o=xn(i.length,n);++r=e})),Wa=Ei(function(){return arguments}())?Ei:function(t){return ns(t)&&kt.call(t,"callee")&&!Yt.call(t,"callee")},ja=i.isArray,Za=be?Qe(be):function(t){return ns(t)&&Ci(t)==N};function Xa(t){return null!=t&&ts(t.length)&&!$a(t)}function qa(t){return ns(t)&&Xa(t)}var Ya=ye||vl,Ka=we?Qe(we):function(t){return ns(t)&&Ci(t)==b};function Ja(t){if(!ns(t))return!1;var e=Ci(t);return e==w||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!os(t)}function $a(t){if(!es(t))return!1;var e=Ci(t);return e==S||e==T||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Qa(t){return"number"==typeof t&&t==gs(t)}function ts(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=p}function es(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ns(t){return null!=t&&"object"==typeof t}var is=Se?Qe(Se):function(t){return ns(t)&&mo(t)==M};function rs(t){return"number"==typeof t||ns(t)&&Ci(t)==C}function os(t){if(!ns(t)||Ci(t)!=A)return!1;var e=Xt(t);if(null===e)return!0;var n=kt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Rt.call(n)==Ht}var as=Te?Qe(Te):function(t){return ns(t)&&Ci(t)==D};var ss=Me?Qe(Me):function(t){return ns(t)&&mo(t)==I};function ls(t){return"string"==typeof t||!ja(t)&&ns(t)&&Ci(t)==P}function us(t){return"symbol"==typeof t||ns(t)&&Ci(t)==E}var hs=Ce?Qe(Ce):function(t){return ns(t)&&ts(t.length)&&!!le[Ci(t)]};var cs=Xr(Fi),ds=Xr((function(t,e){return t<=e}));function fs(t){if(!t)return[];if(Xa(t))return ls(t)?gn(t):Ir(t);if($t&&t[$t])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[$t]());var e=mo(t);return(e==M?un:e==I?dn:Vs)(t)}function ps(t){return t?(t=vs(t))===f||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function gs(t){var e=ps(t),n=e%1;return e==e?n?e-n:e:0}function ms(t){return t?li(gs(t),0,m):0}function vs(t){if("number"==typeof t)return t;if(us(t))return g;if(es(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=es(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=$e(t);var n=vt.test(t);return n||yt.test(t)?de(t.slice(2),n?2:8):mt.test(t)?g:+t}function _s(t){return Pr(t,Os(t))}function ys(t){return null==t?"":hr(t)}var xs=Or((function(t,e){if(Mo(e)||Xa(e))Pr(e,Es(e),t);else for(var n in e)kt.call(e,n)&&ni(t,n,e[n])})),bs=Or((function(t,e){Pr(e,Os(e),t)})),ws=Or((function(t,e,n,i){Pr(e,Os(e),t,i)})),Ss=Or((function(t,e,n,i){Pr(e,Es(e),t,i)})),Ts=io(si);var Ms=Ji((function(t,e){t=At(t);var n=-1,i=e.length,o=i>2?e[2]:r;for(o&&bo(e[0],e[1],o)&&(i=1);++n1),e})),Pr(t,oo(t),n),i&&(n=ui(n,7,eo));for(var r=e.length;r--;)dr(n,e[r]);return n}));var zs=io((function(t,e){return null==t?{}:function(t,e){return Zi(t,e,(function(e,n){return Ls(t,n)}))}(t,e)}));function Bs(t,e){if(null==t)return{};var n=Re(oo(t),(function(t){return[t]}));return e=uo(e),Zi(t,n,(function(t,n){return e(t,n[0])}))}var Fs=Jr(Es),Hs=Jr(Os);function Vs(t){return null==t?[]:tn(t,Es(t))}var Gs=zr((function(t,e,n){return e=e.toLowerCase(),t+(n?Us(e):e)}));function Us(t){return Js(ys(t).toLowerCase())}function Ws(t){return(t=ys(t))&&t.replace(bt,on).replace(ee,"")}var js=zr((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Zs=zr((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Xs=kr("toLowerCase");var qs=zr((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Ys=zr((function(t,e,n){return t+(n?" ":"")+Js(e)}));var Ks=zr((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Js=kr("toUpperCase");function $s(t,e,n){return t=ys(t),(e=n?r:e)===r?function(t){return oe.test(t)}(t)?function(t){return t.match(ie)||[]}(t):function(t){return t.match(ct)||[]}(t):t.match(e)||[]}var Qs=Ji((function(t,e){try{return Ae(t,r,e)}catch(t){return Ja(t)?t:new Tt(t)}})),tl=io((function(t,e){return De(e,(function(e){e=Bo(e),ai(t,e,Ia(t[e],t))})),t}));function el(t){return function(){return t}}var nl=Hr(),il=Hr(!0);function rl(t){return t}function ol(t){return ki("function"==typeof t?t:ui(t,1))}var al=Ji((function(t,e){return function(n){return Pi(n,t,e)}})),sl=Ji((function(t,e){return function(n){return Pi(t,n,e)}}));function ll(t,e,n){var i=Es(e),r=Si(e,i);null!=n||es(e)&&(r.length||!i.length)||(n=e,e=t,t=this,r=Si(e,Es(e)));var o=!(es(n)&&"chain"in n&&!n.chain),a=$a(t);return De(r,(function(n){var i=e[n];t[n]=i,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Ir(this.__actions__)).push({func:i,args:arguments,thisArg:t}),n.__chain__=e,n}return i.apply(t,ke([this.value()],arguments))})})),t}function ul(){}var hl=Wr(Re),cl=Wr(Pe),dl=Wr(Fe);function fl(t){return wo(t)?Xe(Bo(t)):function(t){return function(e){return Ti(e,t)}}(t)}var pl=Zr(),gl=Zr(!0);function ml(){return[]}function vl(){return!1}var _l=Ur((function(t,e){return t+e}),0),yl=Yr("ceil"),xl=Ur((function(t,e){return t/e}),1),bl=Yr("floor");var wl,Sl=Ur((function(t,e){return t*e}),1),Tl=Yr("round"),Ml=Ur((function(t,e){return t-e}),0);return Vn.after=function(t,e){if("function"!=typeof e)throw new It(o);return t=gs(t),function(){if(--t<1)return e.apply(this,arguments)}},Vn.ary=La,Vn.assign=xs,Vn.assignIn=bs,Vn.assignInWith=ws,Vn.assignWith=Ss,Vn.at=Ts,Vn.before=Da,Vn.bind=Ia,Vn.bindAll=tl,Vn.bindKey=Pa,Vn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return ja(t)?t:[t]},Vn.chain=fa,Vn.chunk=function(t,e,n){e=(n?bo(t,e,n):e===r)?1:yn(gs(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var a=0,s=0,l=i(pe(o/e));ao?0:o+n),(i=i===r||i>o?o:gs(i))<0&&(i+=o),i=n>i?0:ms(i);n>>0)?(t=ys(t))&&("string"==typeof e||null!=e&&!as(e))&&!(e=hr(e))&&ln(t)?wr(gn(t),0,n):t.split(e,n):[]},Vn.spread=function(t,e){if("function"!=typeof t)throw new It(o);return e=null==e?0:yn(gs(e),0),Ji((function(n){var i=n[e],r=wr(n,0,e);return i&&ke(r,i),Ae(t,this,r)}))},Vn.tail=function(t){var e=null==t?0:t.length;return e?rr(t,1,e):[]},Vn.take=function(t,e,n){return t&&t.length?rr(t,0,(e=n||e===r?1:gs(e))<0?0:e):[]},Vn.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?rr(t,(e=i-(e=n||e===r?1:gs(e)))<0?0:e,i):[]},Vn.takeRightWhile=function(t,e){return t&&t.length?pr(t,uo(e,3),!1,!0):[]},Vn.takeWhile=function(t,e){return t&&t.length?pr(t,uo(e,3)):[]},Vn.tap=function(t,e){return e(t),t},Vn.throttle=function(t,e,n){var i=!0,r=!0;if("function"!=typeof t)throw new It(o);return es(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),Ea(t,e,{leading:i,maxWait:e,trailing:r})},Vn.thru=pa,Vn.toArray=fs,Vn.toPairs=Fs,Vn.toPairsIn=Hs,Vn.toPath=function(t){return ja(t)?Re(t,Bo):us(t)?[t]:Ir(zo(ys(t)))},Vn.toPlainObject=_s,Vn.transform=function(t,e,n){var i=ja(t),r=i||Ya(t)||hs(t);if(e=uo(e,4),null==n){var o=t&&t.constructor;n=r?i?new o:[]:es(t)&&$a(o)?Gn(Xt(t)):{}}return(r?De:bi)(t,(function(t,i,r){return e(n,t,i,r)})),n},Vn.unary=function(t){return La(t,1)},Vn.union=na,Vn.unionBy=ia,Vn.unionWith=ra,Vn.uniq=function(t){return t&&t.length?cr(t):[]},Vn.uniqBy=function(t,e){return t&&t.length?cr(t,uo(e,2)):[]},Vn.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?cr(t,r,e):[]},Vn.unset=function(t,e){return null==t||dr(t,e)},Vn.unzip=oa,Vn.unzipWith=aa,Vn.update=function(t,e,n){return null==t?t:fr(t,e,yr(n))},Vn.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:fr(t,e,yr(n),i)},Vn.values=Vs,Vn.valuesIn=function(t){return null==t?[]:tn(t,Os(t))},Vn.without=sa,Vn.words=$s,Vn.wrap=function(t,e){return Ba(yr(e),t)},Vn.xor=la,Vn.xorBy=ua,Vn.xorWith=ha,Vn.zip=ca,Vn.zipObject=function(t,e){return vr(t||[],e||[],ni)},Vn.zipObjectDeep=function(t,e){return vr(t||[],e||[],tr)},Vn.zipWith=da,Vn.entries=Fs,Vn.entriesIn=Hs,Vn.extend=bs,Vn.extendWith=ws,ll(Vn,Vn),Vn.add=_l,Vn.attempt=Qs,Vn.camelCase=Gs,Vn.capitalize=Us,Vn.ceil=yl,Vn.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=vs(n))==n?n:0),e!==r&&(e=(e=vs(e))==e?e:0),li(vs(t),e,n)},Vn.clone=function(t){return ui(t,4)},Vn.cloneDeep=function(t){return ui(t,5)},Vn.cloneDeepWith=function(t,e){return ui(t,5,e="function"==typeof e?e:r)},Vn.cloneWith=function(t,e){return ui(t,4,e="function"==typeof e?e:r)},Vn.conformsTo=function(t,e){return null==e||hi(t,e,Es(e))},Vn.deburr=Ws,Vn.defaultTo=function(t,e){return null==t||t!=t?e:t},Vn.divide=xl,Vn.endsWith=function(t,e,n){t=ys(t),e=hr(e);var i=t.length,o=n=n===r?i:li(gs(n),0,i);return(n-=e.length)>=0&&t.slice(n,o)==e},Vn.eq=Va,Vn.escape=function(t){return(t=ys(t))&&J.test(t)?t.replace(Y,an):t},Vn.escapeRegExp=function(t){return(t=ys(t))&&ot.test(t)?t.replace(rt,"\\$&"):t},Vn.every=function(t,e,n){var i=ja(t)?Pe:gi;return n&&bo(t,e,n)&&(e=r),i(t,uo(e,3))},Vn.find=va,Vn.findIndex=Wo,Vn.findKey=function(t,e){return Ve(t,uo(e,3),bi)},Vn.findLast=_a,Vn.findLastIndex=jo,Vn.findLastKey=function(t,e){return Ve(t,uo(e,3),wi)},Vn.floor=bl,Vn.forEach=ya,Vn.forEachRight=xa,Vn.forIn=function(t,e){return null==t?t:yi(t,uo(e,3),Os)},Vn.forInRight=function(t,e){return null==t?t:xi(t,uo(e,3),Os)},Vn.forOwn=function(t,e){return t&&bi(t,uo(e,3))},Vn.forOwnRight=function(t,e){return t&&wi(t,uo(e,3))},Vn.get=As,Vn.gt=Ga,Vn.gte=Ua,Vn.has=function(t,e){return null!=t&&vo(t,e,Li)},Vn.hasIn=Ls,Vn.head=Xo,Vn.identity=rl,Vn.includes=function(t,e,n,i){t=Xa(t)?t:Vs(t),n=n&&!i?gs(n):0;var r=t.length;return n<0&&(n=yn(r+n,0)),ls(t)?n<=r&&t.indexOf(e,n)>-1:!!r&&Ue(t,e,n)>-1},Vn.indexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var r=null==n?0:gs(n);return r<0&&(r=yn(i+r,0)),Ue(t,e,r)},Vn.inRange=function(t,e,n){return e=ps(e),n===r?(n=e,e=0):n=ps(n),function(t,e,n){return t>=xn(e,n)&&t=-9007199254740991&&t<=p},Vn.isSet=ss,Vn.isString=ls,Vn.isSymbol=us,Vn.isTypedArray=hs,Vn.isUndefined=function(t){return t===r},Vn.isWeakMap=function(t){return ns(t)&&mo(t)==O},Vn.isWeakSet=function(t){return ns(t)&&"[object WeakSet]"==Ci(t)},Vn.join=function(t,e){return null==t?"":He.call(t,e)},Vn.kebabCase=js,Vn.last=Jo,Vn.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=gs(n))<0?yn(i+o,0):xn(o,i-1)),e==e?function(t,e,n){for(var i=n+1;i--;)if(t[i]===e)return i;return i}(t,e,o):Ge(t,je,o,!0)},Vn.lowerCase=Zs,Vn.lowerFirst=Xs,Vn.lt=cs,Vn.lte=ds,Vn.max=function(t){return t&&t.length?mi(t,rl,Ai):r},Vn.maxBy=function(t,e){return t&&t.length?mi(t,uo(e,2),Ai):r},Vn.mean=function(t){return Ze(t,rl)},Vn.meanBy=function(t,e){return Ze(t,uo(e,2))},Vn.min=function(t){return t&&t.length?mi(t,rl,Fi):r},Vn.minBy=function(t,e){return t&&t.length?mi(t,uo(e,2),Fi):r},Vn.stubArray=ml,Vn.stubFalse=vl,Vn.stubObject=function(){return{}},Vn.stubString=function(){return""},Vn.stubTrue=function(){return!0},Vn.multiply=Sl,Vn.nth=function(t,e){return t&&t.length?Wi(t,gs(e)):r},Vn.noConflict=function(){return ge._===this&&(ge._=Vt),this},Vn.noop=ul,Vn.now=Aa,Vn.pad=function(t,e,n){t=ys(t);var i=(e=gs(e))?pn(t):0;if(!e||i>=e)return t;var r=(e-i)/2;return jr(me(r),n)+t+jr(pe(r),n)},Vn.padEnd=function(t,e,n){t=ys(t);var i=(e=gs(e))?pn(t):0;return e&&ie){var i=t;t=e,e=i}if(n||t%1||e%1){var o=Sn();return xn(t+o*(e-t+ce("1e-"+((o+"").length-1))),e)}return Yi(t,e)},Vn.reduce=function(t,e,n){var i=ja(t)?ze:Ye,r=arguments.length<3;return i(t,uo(e,4),n,r,fi)},Vn.reduceRight=function(t,e,n){var i=ja(t)?Be:Ye,r=arguments.length<3;return i(t,uo(e,4),n,r,pi)},Vn.repeat=function(t,e,n){return e=(n?bo(t,e,n):e===r)?1:gs(e),Ki(ys(t),e)},Vn.replace=function(){var t=arguments,e=ys(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Vn.result=function(t,e,n){var i=-1,o=(e=xr(e,t)).length;for(o||(o=1,t=r);++ip)return[];var n=m,i=xn(t,m);e=uo(e),t-=m;for(var r=Je(i,e);++n=a)return t;var l=n-pn(i);if(l<1)return i;var u=s?wr(s,0,l).join(""):t.slice(0,l);if(o===r)return u+i;if(s&&(l+=u.length-l),as(o)){if(t.slice(l).search(o)){var h,c=u;for(o.global||(o=Lt(o.source,ys(gt.exec(o))+"g")),o.lastIndex=0;h=o.exec(c);)var d=h.index;u=u.slice(0,d===r?l:d)}}else if(t.indexOf(hr(o),l)!=l){var f=u.lastIndexOf(o);f>-1&&(u=u.slice(0,f))}return u+i},Vn.unescape=function(t){return(t=ys(t))&&K.test(t)?t.replace(q,vn):t},Vn.uniqueId=function(t){var e=++zt;return ys(t)+e},Vn.upperCase=Ks,Vn.upperFirst=Js,Vn.each=ya,Vn.eachRight=xa,Vn.first=Xo,ll(Vn,(wl={},bi(Vn,(function(t,e){kt.call(Vn.prototype,e)||(wl[e]=t)})),wl),{chain:!1}),Vn.VERSION="4.17.21",De(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Vn[t].placeholder=Vn})),De(["drop","take"],(function(t,e){jn.prototype[t]=function(n){n=n===r?1:yn(gs(n),0);var i=this.__filtered__&&!e?new jn(this):this.clone();return i.__filtered__?i.__takeCount__=xn(n,i.__takeCount__):i.__views__.push({size:xn(n,m),type:t+(i.__dir__<0?"Right":"")}),i},jn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),De(["filter","map","takeWhile"],(function(t,e){var n=e+1,i=1==n||3==n;jn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:uo(t,3),type:n}),e.__filtered__=e.__filtered__||i,e}})),De(["head","last"],(function(t,e){var n="take"+(e?"Right":"");jn.prototype[t]=function(){return this[n](1).value()[0]}})),De(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");jn.prototype[t]=function(){return this.__filtered__?new jn(this):this[n](1)}})),jn.prototype.compact=function(){return this.filter(rl)},jn.prototype.find=function(t){return this.filter(t).head()},jn.prototype.findLast=function(t){return this.reverse().find(t)},jn.prototype.invokeMap=Ji((function(t,e){return"function"==typeof t?new jn(this):this.map((function(n){return Pi(n,t,e)}))})),jn.prototype.reject=function(t){return this.filter(ka(uo(t)))},jn.prototype.slice=function(t,e){t=gs(t);var n=this;return n.__filtered__&&(t>0||e<0)?new jn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==r&&(n=(e=gs(e))<0?n.dropRight(-e):n.take(e-t)),n)},jn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},jn.prototype.toArray=function(){return this.take(m)},bi(jn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Vn[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);o&&(Vn.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,l=e instanceof jn,u=s[0],h=l||ja(e),c=function(t){var e=o.apply(Vn,ke([t],s));return i&&d?e[0]:e};h&&n&&"function"==typeof u&&1!=u.length&&(l=h=!1);var d=this.__chain__,f=!!this.__actions__.length,p=a&&!d,g=l&&!f;if(!a&&h){e=g?e:new jn(this);var m=t.apply(e,s);return m.__actions__.push({func:pa,args:[c],thisArg:r}),new Wn(m,d)}return p&&g?t.apply(this,s):(m=this.thru(c),p?i?m.value()[0]:m.value():m)})})),De(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Pt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);Vn.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var r=this.value();return e.apply(ja(r)?r:[],t)}return this[n]((function(n){return e.apply(ja(n)?n:[],t)}))}})),bi(jn.prototype,(function(t,e){var n=Vn[e];if(n){var i=n.name+"";kt.call(En,i)||(En[i]=[]),En[i].push({name:e,func:n})}})),En[Vr(r,2).name]=[{name:"wrapper",func:r}],jn.prototype.clone=function(){var t=new jn(this.__wrapped__);return t.__actions__=Ir(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ir(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ir(this.__views__),t},jn.prototype.reverse=function(){if(this.__filtered__){var t=new jn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},jn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=ja(t),i=e<0,r=n?t.length:0,o=function(t,e,n){var i=-1,r=n.length;for(;++i=this.__values__.length;return{done:t,value:t?r:this.__values__[this.__index__++]}},Vn.prototype.plant=function(t){for(var e,n=this;n instanceof Un;){var i=Ho(n);i.__index__=0,i.__values__=r,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e},Vn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof jn){var e=t;return this.__actions__.length&&(e=new jn(this)),(e=e.reverse()).__actions__.push({func:pa,args:[ea],thisArg:r}),new Wn(e,this.__chain__)}return this.thru(ea)},Vn.prototype.toJSON=Vn.prototype.valueOf=Vn.prototype.value=function(){return gr(this.__wrapped__,this.__actions__)},Vn.prototype.first=Vn.prototype.head,$t&&(Vn.prototype[$t]=function(){return this}),Vn}();ge._=_n,(i=function(){return _n}.call(e,n,e,t))===r||(t.exports=i)}.call(this)},698:(t,e,n)=>{"use strict";n.r(e),n.d(e,{fastLerp:()=>b,fastMapToColor:()=>w,lerp:()=>S,lift:()=>y,liftColor:()=>P,lum:()=>L,mapToColor:()=>T,modifyAlpha:()=>C,modifyHSL:()=>M,parse:()=>v,random:()=>D,stringify:()=>A,toHex:()=>x});var i=n(501),r=n(26),o={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function a(t){return(t=Math.round(t))<0?0:t>255?255:t}function s(t){return t<0?0:t>1?1:t}function l(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?a(parseFloat(e)/100*255):a(parseInt(e,10))}function u(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?s(parseFloat(e)/100):s(parseFloat(e))}function h(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function c(t,e,n){return t+(e-t)*n}function d(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function f(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var p=new i.Ay(20),g=null;function m(t,e){g&&f(g,e),g=p.put(t,g||e.slice())}function v(t,e){if(t){e=e||[];var n=p.get(t);if(n)return f(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in o)return f(e,o[i]),m(t,e),e;var r,a=i.length;if("#"===i.charAt(0))return 4===a||5===a?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(d(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===a?parseInt(i.slice(4),16)/15:1),m(t,e),e):void d(e,0,0,0,1):7===a||9===a?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(d(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===a?parseInt(i.slice(7),16)/255:1),m(t,e),e):void d(e,0,0,0,1):void 0;var s=i.indexOf("("),h=i.indexOf(")");if(-1!==s&&h+1===a){var c=i.substr(0,s),g=i.substr(s+1,h-(s+1)).split(","),v=1;switch(c){case"rgba":if(4!==g.length)return 3===g.length?d(e,+g[0],+g[1],+g[2],1):d(e,0,0,0,1);v=u(g.pop());case"rgb":return g.length>=3?(d(e,l(g[0]),l(g[1]),l(g[2]),3===g.length?v:u(g[3])),m(t,e),e):void d(e,0,0,0,1);case"hsla":return 4!==g.length?void d(e,0,0,0,1):(g[3]=u(g[3]),_(g,e),m(t,e),e);case"hsl":return 3!==g.length?void d(e,0,0,0,1):(_(g,e),m(t,e),e);default:return}}d(e,0,0,0,1)}}function _(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=u(t[1]),r=u(t[2]),o=r<=.5?r*(i+1):r+i-r*i,s=2*r-o;return d(e=e||[],a(255*h(s,o,n+1/3)),a(255*h(s,o,n)),a(255*h(s,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function y(t,e){var n=v(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return A(n,4===n.length?"rgba":"rgb")}}function x(t){var e=v(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function b(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),l=e[r],u=e[o],h=i-r;return n[0]=a(c(l[0],u[0],h)),n[1]=a(c(l[1],u[1],h)),n[2]=a(c(l[2],u[2],h)),n[3]=s(c(l[3],u[3],h)),n}}var w=b;function S(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),l=v(e[r]),u=v(e[o]),h=i-r,d=A([a(c(l[0],u[0],h)),a(c(l[1],u[1],h)),a(c(l[2],u[2],h)),s(c(l[3],u[3],h))],"rgba");return n?{color:d,leftIndex:r,rightIndex:o,value:i}:d}}var T=S;function M(t,e,n,i){var r,o=v(t);if(t)return o=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(o),null!=e&&(o[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(o[1]=u(n)),null!=i&&(o[2]=u(i)),A(_(o),"rgba")}function C(t,e){var n=v(t);if(n&&null!=e)return n[3]=s(e),A(n,"rgba")}function A(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}}function L(t,e){var n=v(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function D(){return A([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}var I=new i.Ay(100);function P(t){if((0,r.isString)(t)){var e=I.get(t);return e||(e=y(t,-.1),I.put(t,e)),e}if((0,r.isGradientObject)(t)){var n=(0,r.extend)({},t);return n.colorStops=(0,r.map)(t.colorStops,(function(t){return{offset:t.offset,color:y(t.color,-.1)}})),n}return t}},741:(t,e,n)=>{"use strict";n.d(e,{Gs:()=>h,OH:()=>o,gI:()=>i,yh:()=>u,zs:()=>r});var i=12,r="sans-serif",o=i+"px "+r;var a,s,l=function(t){var e={};if("undefined"==typeof JSON)return e;for(var n=0;n=0)c=h*t.length;else for(var d=0;d{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{"use strict";var t={};n.r(t),n.d(t,{add:()=>B,applyTransform:()=>nt,clone:()=>k,copy:()=>R,create:()=>N,dist:()=>J,distSquare:()=>Q,distance:()=>K,distanceSquare:()=>$,div:()=>Z,dot:()=>X,len:()=>V,lenSquare:()=>U,length:()=>G,lengthSquare:()=>W,lerp:()=>et,max:()=>rt,min:()=>it,mul:()=>j,negate:()=>tt,normalize:()=>Y,scale:()=>q,scaleAndAdd:()=>F,set:()=>z,sub:()=>H});var e={};n.r(e),n.d(e,{clone:()=>Vt,copy:()=>Rt,create:()=>Ot,identity:()=>Nt,invert:()=>Ht,mul:()=>kt,rotate:()=>Bt,scale:()=>Ft,translate:()=>zt});var i={};n.r(i),n.d(i,{dispose:()=>ji,disposeAll:()=>Zi,getElementSSRData:()=>Yi,getInstance:()=>Xi,init:()=>Wi,registerPainter:()=>qi,registerSSRDataGetter:()=>Ki,version:()=>Ji});var r={};n.r(r),n.d(r,{Arc:()=>Gf,BezierCurve:()=>Ff,BoundingRect:()=>Qt,Circle:()=>tf,CompoundPath:()=>Wf,Ellipse:()=>rf,Group:()=>Fi,Image:()=>Fa,IncrementalDisplayable:()=>op,Line:()=>Nf,LinearGradient:()=>qf,OrientedBoundingRect:()=>np,Path:()=>Ea,Point:()=>Ut,Polygon:()=>Af,Polyline:()=>If,RadialGradient:()=>Kf,Rect:()=>Xa,Ring:()=>Sf,Sector:()=>xf,Text:()=>us,applyTransform:()=>Sp,clipPointsByRect:()=>Ap,clipRectByRect:()=>Lp,createIcon:()=>Dp,extendPath:()=>cp,extendShape:()=>up,getShapeClass:()=>fp,getTransform:()=>wp,groupTransition:()=>Cp,initProps:()=>ol,isElementRemoved:()=>al,lineLineIntersect:()=>Pp,linePolygonIntersect:()=>Ip,makeImage:()=>gp,makePath:()=>pp,mergePath:()=>vp,registerShape:()=>dp,removeElement:()=>sl,removeElementWithFadeOut:()=>ul,resizePath:()=>_p,setTooltipConfig:()=>Op,subPixelOptimize:()=>bp,subPixelOptimizeLine:()=>yp,subPixelOptimizeRect:()=>xp,transformDirection:()=>Tp,traverseElements:()=>Rp,updateProps:()=>rl});var o={};n.r(o),n.d(o,{createDimensions:()=>O_,createList:()=>Jy,createScale:()=>Qy,createSymbol:()=>Jg,createTextStyle:()=>ex,dataStack:()=>$y,enableHoverEmphasis:()=>Ks,getECData:()=>hs,getLayoutRect:()=>Hu,mixinAxisModelCommonMethods:()=>tx});var a={};n.r(a),n.d(a,{MAX_SAFE_INTEGER:()=>ur,asc:()=>ir,getPercentWithPrecision:()=>sr,getPixelPrecision:()=>ar,getPrecision:()=>rr,getPrecisionSafe:()=>or,isNumeric:()=>xr,isRadianAroundZero:()=>cr,linearMap:()=>tr,nice:()=>mr,numericToNumber:()=>yr,parseDate:()=>fr,quantile:()=>vr,quantity:()=>pr,quantityExponent:()=>gr,reformIntervals:()=>_r,remRadian:()=>hr,round:()=>nr});var s={};n.r(s),n.d(s,{format:()=>au,parse:()=>fr});var l={};n.r(l),n.d(l,{Arc:()=>Gf,BezierCurve:()=>Ff,BoundingRect:()=>Qt,Circle:()=>tf,CompoundPath:()=>Wf,Ellipse:()=>rf,Group:()=>Fi,Image:()=>Fa,IncrementalDisplayable:()=>op,Line:()=>Nf,LinearGradient:()=>qf,Polygon:()=>Af,Polyline:()=>If,RadialGradient:()=>Kf,Rect:()=>Xa,Ring:()=>Sf,Sector:()=>xf,Text:()=>us,clipPointsByRect:()=>Ap,clipRectByRect:()=>Lp,createIcon:()=>Dp,extendPath:()=>cp,extendShape:()=>up,getShapeClass:()=>fp,getTransform:()=>wp,initProps:()=>ol,makeImage:()=>gp,makePath:()=>pp,mergePath:()=>vp,registerShape:()=>dp,resizePath:()=>_p,updateProps:()=>rl});var u={};n.r(u),n.d(u,{addCommas:()=>Su,capitalFirst:()=>Eu,encodeHTML:()=>yt,formatTime:()=>Pu,formatTpl:()=>Du,getTextRect:()=>vx,getTooltipMarker:()=>Iu,normalizeCssArray:()=>Mu,toCamelCase:()=>Tu,truncateText:()=>co});var h={};n.r(h),n.d(h,{bind:()=>P.bind,clone:()=>P.clone,curry:()=>P.curry,defaults:()=>P.defaults,each:()=>P.each,extend:()=>P.extend,filter:()=>P.filter,indexOf:()=>P.indexOf,inherits:()=>P.inherits,isArray:()=>P.isArray,isFunction:()=>P.isFunction,isObject:()=>P.isObject,isString:()=>P.isString,map:()=>P.map,merge:()=>P.merge,reduce:()=>P.reduce});var c={};n.r(c),n.d(c,{Axis:()=>Px,ChartView:()=>Wp,ComponentModel:()=>Zu,ComponentView:()=>Od,List:()=>E_,Model:()=>zl,PRIORITY:()=>Gm,SeriesModel:()=>Pd,color:()=>tn,connect:()=>Nv,dataTool:()=>r_,dependencies:()=>km,disConnect:()=>kv,disconnect:()=>Rv,dispose:()=>zv,env:()=>I.default,extendChartView:()=>Rx,extendComponentModel:()=>Ex,extendComponentView:()=>Ox,extendSeriesModel:()=>Nx,format:()=>u,getCoordinateSystemDimensions:()=>qv,getInstanceByDom:()=>Bv,getInstanceById:()=>Fv,getMap:()=>n_,graphic:()=>l,helper:()=>o,init:()=>Ov,innerDrawElementOnCanvas:()=>Sm,matrix:()=>e,number:()=>a,parseGeoJSON:()=>mx,parseGeoJson:()=>mx,registerAction:()=>Zv,registerCoordinateSystem:()=>Xv,registerLayout:()=>Yv,registerLoading:()=>Qv,registerLocale:()=>Zl,registerMap:()=>e_,registerPostInit:()=>Uv,registerPostUpdate:()=>Wv,registerPreprocessor:()=>Vv,registerProcessor:()=>Gv,registerTheme:()=>Hv,registerTransform:()=>i_,registerUpdateLifecycle:()=>jv,registerVisual:()=>Kv,setCanvasCreator:()=>t_,setPlatformAPI:()=>vi.Gs,throttle:()=>qp,time:()=>s,use:()=>rx,util:()=>h,vector:()=>t,version:()=>Rm,zrUtil:()=>P,zrender:()=>i});var d=n(543),f=n(214),p=n.n(f);const g={metadata:!0,svgRender:!1,switchMode:!1,maxPointsFetched:1e4,loadMoreAtZoomLevel:9,clustering:!1,clusteringThreshold:100,disableClusteringAtLevel:8,clusterRadius:80,clusterSeparation:20,showMetaOnNarrowScreens:!1,showLabelsAtZoomLevel:13,crs:p().CRS.EPSG3857,echartsOption:{aria:{show:!0,description:"This is a force-oriented graph chart that depicts the relationship between ip nodes."},toolbox:{show:!0,iconStyle:{borderColor:"#fff"},feature:{restore:{show:!0,title:"Restore view"},saveAsImage:{show:!0,title:"Save image"}}}},graphConfig:{series:{layout:"force",label:{show:!0,color:"#fff",position:"top"},labelLayout:{hideOverlap:!0},force:{gravity:.1,edgeLength:[20,60],repulsion:120},roam:!0,draggable:!0,legendHoverLink:!0,emphasis:{focus:"none",lineStyle:{color:"#3acc38",opacity:1}},nodeStyle:{color:"#ffebc4"},linkStyle:{width:6,color:"#1ba619"},nodeSize:"15"},baseOptions:{backgroundColor:"#282222",media:[{query:{minWidth:320,maxWidth:500},option:{series:[{zoom:.7}],toolbox:{itemSize:18}}},{query:{minWidth:501},option:{series:[{zoom:1}],toolbox:{itemSize:15}}},{query:{minWidth:320,maxWidth:850},option:{tooltip:{show:!1}}},{query:{minWidth:851},option:{tooltip:{show:!0}}}]}},mapOptions:{roam:!0,zoomAnimation:!1,minZoom:3,maxZoom:18,nodeConfig:{type:"scatter",label:{show:!1,color:"#000000",position:"top",formatter:"{b}",fontSize:13,backgroundColor:"rgba(255, 255, 255, 0.8)",padding:[6,8],borderRadius:5},emphasis:{scale:1},nodeStyle:{color:"#1566a9"},nodeSize:"17"},linkConfig:{linkStyle:{width:5,color:"#1ba619"},emphasis:{focus:"none",lineStyle:{color:"#3acc38",opacity:1}}},clusterConfig:{symbolSize:30,itemStyle:{color:"#1566a9"},tooltip:{show:!1},label:{show:!0,position:"inside",color:"#fff",offset:[0,0],backgroundColor:"transparent"}},baseOptions:{toolbox:{show:!1},media:[{query:{minWidth:320,maxWidth:850},option:{tooltip:{show:!1}}},{query:{minWidth:851},option:{tooltip:{show:!0}}}]}},mapTileConfig:[{urlTemplate:"MISSING_ENV_VAR".MAPBOX_URL_TEMPLATE||"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",options:{attribution:'© OpenStreetMap contributors,\n tiles offered by Mapbox'}}],geoOptions:{style:{fillColor:"#1566a9",weight:0,fillOpacity:.8,radius:8}},nodeCategories:[{name:"ok",nodeStyle:{color:"#28a745"}},{name:"problem",nodeStyle:{color:"#ffc107"}},{name:"critical",nodeStyle:{color:"#dc3545"}}],linkCategories:[],prepareData(t){t&&t.nodes&&t.nodes.forEach((t=>{if(t.properties&&t.properties.status){const e=t.properties.status.toLowerCase();"ok"!==e&&"problem"!==e&&"critical"!==e||(t.category=e)}}))},onClickElement(t,e){let n;this.utils&&this.utils.isNetJSON(this.data)?(n="node"===t?this.utils.nodeInfo(e):"link"===t?this.utils.linkInfo(e):e,(this.config.showMetaOnNarrowScreens||this.el.clientWidth>850)&&(this.gui.metaInfoContainer.style.display="flex")):({nodeLinkData:n}={nodeLinkData:e}),this.gui.getNodeLinkInfo(t,n),this.gui.sideBar.classList.remove("hidden")},onReady(){}},{prepareData:m}=g,v={...g},_=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class y{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,n]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const i=n>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const r=_[15&n];if(!r)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new y(a,o,r,t)}constructor(t,e=64,n=Float64Array,i){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const r=_.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+r]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=e,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return x(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:o,nodeSize:a}=this,s=[0,r.length-1,0],l=[];for(;s.length;){const u=s.pop()||0,h=s.pop()||0,c=s.pop()||0;if(h-c<=a){for(let a=c;a<=h;a++){const s=o[2*a],u=o[2*a+1];s>=t&&s<=n&&u>=e&&u<=i&&l.push(r[a])}continue}const d=c+h>>1,f=o[2*d],p=o[2*d+1];f>=t&&f<=n&&p>=e&&p<=i&&l.push(r[d]),(0===u?t<=f:e<=p)&&(s.push(c),s.push(d-1),s.push(1-u)),(0===u?n>=f:i>=p)&&(s.push(d+1),s.push(h),s.push(1-u))}return l}within(t,e,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:r,nodeSize:o}=this,a=[0,i.length-1,0],s=[],l=n*n;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,c=a.pop()||0;if(h-c<=o){for(let n=c;n<=h;n++)T(r[2*n],r[2*n+1],t,e)<=l&&s.push(i[n]);continue}const d=c+h>>1,f=r[2*d],p=r[2*d+1];T(f,p,t,e)<=l&&s.push(i[d]),(0===u?t-n<=f:e-n<=p)&&(a.push(c),a.push(d-1),a.push(1-u)),(0===u?t+n>=f:e+n>=p)&&(a.push(d+1),a.push(h),a.push(1-u))}return s}}function x(t,e,n,i,r,o){if(r-i<=n)return;const a=i+r>>1;b(t,e,a,i,r,o),x(t,e,n,i,a-1,1-o),x(t,e,n,a+1,r,1-o)}function b(t,e,n,i,r,o){for(;r>i;){if(r-i>600){const a=r-i+1,s=n-i+1,l=Math.log(a),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);b(t,e,n,Math.max(i,Math.floor(n-s*u/a+h)),Math.min(r,Math.floor(n+(a-s)*u/a+h)),o)}const a=e[2*n+o];let s=i,l=r;for(w(t,e,i,n),e[2*r+o]>a&&w(t,e,i,r);sa;)l--}e[2*i+o]===a?w(t,e,i,l):(l++,w(t,e,l,r)),l<=n&&(i=l+1),n<=l&&(r=l-1)}}function w(t,e,n,i){S(t,n,i),S(e,2*n,2*i),S(e,2*n+1,2*i+1)}function S(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function T(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}const M=class{JSONParamParse(t){return"string"==typeof t?fetch(t,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include"}).then((t=>t)).catch((t=>{console.error(t)})):Promise.resolve(t)}async paginatedDataParse(t){let e,n;try{let i=await this.utils.JSONParamParse(t);if(i.json)for(e=await i.json(),n=e.results?e.results:e;e.next&&n.nodes.length<=this.config.maxPointsFetched;)i=await this.utils.JSONParamParse(e.next),e=await i.json(),n.nodes=n.nodes.concat(e.results.nodes),n.links=n.links.concat(e.results.links),e.next?this.hasMoreData=!0:this.hasMoreData=!1;else n=i}catch(t){console.error(t)}return n}async getBBoxData(t,e){let n;try{const i=`${t=t[0].split("?")[0]}bbox?swLat=${e._southWest.lat}&swLng=${e._southWest.lng}&neLat=${e._northEast.lat}&neLng=${e._northEast.lng}`,r=await this.utils.JSONParamParse(i);n=await r.json()}catch(t){console.error(t)}return n}dateParse({dateString:t,parseRegular:e=/^([1-9]\d{3})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2})(?:\.(\d{1,3}))?Z$/,hourDiffer:n=(new Date).getTimezoneOffset()/60}){const i=e.exec(t);if(!i||i.length<7)return console.error("Date doesn't meet the specifications."),"";const r=["dateYear","dateMonth","dateDay","dateHour"],o={},a=i[1]%4==0&&i[1]%100!=0||i[1]%400==0,s=new Map([["dateMonth",12],["dateDay",[31,a?29:28,31,30,31,30,31,31,30,31,30,31]],["dateHour",24]]);for(let t=r.length;t>0;t-=1)o[r[t-1]]=parseInt(i[t],10);let l,u=-n;for(let t=r.length;t>0;t-=1){if("dateYear"===r[t-1]){o[r[t-1]]+=u;break}l="dateDay"===r[t-1]?s.get("dateDay")[o.dateMonth-1]:s.get(r[t-1]);let e=o[r[t-1]]+u;u="dateHour"===r[t-1]?e<0?-1:e>=l?1:0:e<=0?-1:e>l?1:0,1===u?e-=l:u<0&&("dateDay"===r[t-1]&&(l=s.get("dateDay")[(o[r[t-1]]+10)%11]),e+=l),o[r[t-1]]=e}return`${o.dateYear}.${this.numberMinDigit(o.dateMonth)}.${this.numberMinDigit(o.dateDay)} ${this.numberMinDigit(o.dateHour)}:${this.numberMinDigit(i[5])}:${this.numberMinDigit(i[6])}${i[7]?`.${this.numberMinDigit(i[7],3)}`:""}`}numberMinDigit(t,e=2,n="0"){return(Array(e).join(n)+t).slice(-e)}isObject(t){return"Object"===Object.prototype.toString.call(t).slice(8,14)}isArray(t){return"Array"===Object.prototype.toString.call(t).slice(8,13)}isElement(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName}isNetJSON(t){return!(!t.nodes||!t.links)&&(this.isObject(t)&&this.isArray(t.nodes)&&this.isArray(t.links))}isGeoJSON(t){return t.type&&"FeatureCollection"===t.type?this.isObject(t)&&this.isArray(t.features):!(!t.type||"Feature"!==t.type)&&(this.isObject(t)&&this.isArray(t.geometry))}geojsonToNetjson(t){return function(t){const e=[],n=[];if(!t||!Array.isArray(t.features))return{nodes:e,links:n};const i=new Map,r=(t,n={})=>{const r=`${t[0]},${t[1]}`;if(i.has(r))return i.get(r);const o=n.id||n.node_id||null,a=n.label||n.name||o||null,s=o?String(o):`gjn_${e.length}`,l=!o,u={id:s,...a?{label:String(a)}:{},location:{lng:t[0],lat:t[1]},properties:{...n,location:{lng:t[0],lat:t[1]}},_generatedIdentity:l};return e.push(u),i.set(r,s),s},o=(t,e,i={})=>{n.push({source:t,target:e,properties:i})},a=(t,e,n=!1)=>{for(let n=0;n2){const n=r(t[0],e),i=r(t[t.length-1],e);o(i,n,e)}},s=(t,e)=>{if(!t)return;const{type:n,coordinates:i,geometries:o}=t;switch(n){case"Point":r(i,{...e,_featureType:"Point"});break;case"MultiPoint":i.forEach((t=>r(t,{...e,_featureType:"Point"})));break;case"LineString":a(i,{...e,_featureType:"LineString"},!1);break;case"MultiLineString":i.forEach((t=>a(t,{...e,_featureType:"LineString"},!1)));break;case"Polygon":case"MultiPolygon":break;case"GeometryCollection":o.forEach((t=>s(t,e)));break;default:console.warn(`Unsupported GeoJSON geometry type: ${n}`)}};return t.features.forEach((t=>{const e={...t.properties||{},...void 0!==t.id&&null!==t.id?{id:t.id}:{}};s(t.geometry,e)})),{nodes:e,links:n}}(t)}deepMergeObj(...t){const e=[...t].reverse(),n=e.length;for(let t=0;t{i[t]&&this.isObject(i[t])&&this.isObject(n[t])?this.deepMergeObj(i[t],n[t]):i[t]=n[t]})):i||(e[t+1]=n)}return e[n-1]}makeCluster(t){const{nodes:e,links:n}=t.data,i=t=>!(t.properties&&t.properties._featureType)||"Point"===t.properties._featureType,r=e.filter(i),o=e.filter((t=>!i(t))),a=[],s=[],l=new Map;o.forEach((t=>l.set(t.id,null)));let u=0;r.forEach((e=>{const n=e.properties&&e.properties.location||e.location;if(!n||void 0===n.lat||void 0===n.lng)return;e.location=n,e._origLocation?(n.lat=e._origLocation.lat,n.lng=e._origLocation.lng):e._origLocation={lat:n.lat,lng:n.lng};const i=t.leaflet.latLngToContainerPoint([n.lat,n.lng]);e.x=i.x,e.y=i.y,e.visited=!1,e.cluster=null}));const h=new y(r.length);r.forEach((({x:t,y:e})=>h.add(t,e))),h.finish();const c=t.config&&t.config.mapOptions&&t.config.mapOptions.clusterConfig&&t.config.mapOptions.clusterConfig.symbolSize,d=t=>{if("function"==typeof c)try{return c(t)}catch(t){return 30}return Array.isArray(c)?c[0]||30:"number"==typeof c?c:30},f=new Map;r.forEach((e=>{if(e.visited)return;const n=h.within(e.x,e.y,t.config.clusterRadius).map((t=>r[t]));if(n.length>1){const i=`${Math.round(e.x)},${Math.round(e.y)}`;f.has(i)||f.set(i,new Map);const r=f.get(i);n.forEach((e=>{if(e.visited)return;const n=t.config.clusteringAttribute?e.properties[t.config.clusteringAttribute]:"default";r.has(n)||r.set(n,[]),r.get(n).push(e),e.visited=!0}))}else e.visited=!0,l.set(e.id,null),o.push(e)})),f.forEach((e=>{const n=Array.from(e.entries()),i=n.length;let r=0;n.forEach((([,t])=>{const e=d(t.length);e>r&&(r=e)}));const a="number"==typeof t.config.clusterSeparation?t.config.clusterSeparation:Math.max(10,Math.floor(t.config.clusterRadius/2));let h=0;if(i>1){const t=Math.PI/i,e=Math.sin(t);e>0&&(h=r/(2*e))}const c=Math.max(a,h+4);n.forEach((([,e],n)=>{if(e.length>1){let r=0,o=0;if(e.forEach((t=>{t.cluster=u,l.set(t.id,t.cluster),r+=t.location.lng,o+=t.location.lat})),r/=e.length,o/=e.length,i>1){const e=2*Math.PI*n/i,a=t.leaflet.latLngToContainerPoint([o,r]),s=[a.x+c*Math.cos(e),a.y+c*Math.sin(e)],l=t.leaflet.containerPointToLatLng(s);r=l.lng,o=l.lat}const a={id:u,cluster:!0,name:e.length,value:[r,o],childNodes:e,...t.config.mapOptions.clusterConfig};if(t.config.clusteringAttribute){const n=t.config.nodeCategories.find((n=>n.name===e[0].properties[t.config.clusteringAttribute]));n&&(a.itemStyle={...a.itemStyle,color:n.nodeStyle.color})}s.push(a),u+=1}else if(1===e.length){const t=e[0];l.set(t.id,null),o.push(t)}}))})),n.forEach((t=>{null===l.get(t.source)&&null===l.get(t.target)&&a.push(t)}));const p=[...s.map((t=>({ref:t,isCluster:!0,count:t.childNodes.length,get value(){return t.value},set value([e,n]){t.value=[e,n]}}))),...o.filter(i).map((t=>({ref:t,isCluster:!1,count:1,get value(){return[t.location.lng,t.location.lat]},set value([e,n]){t.location.lng=e,t.location.lat=n}})))];if(p.length>1){const e=p.map((e=>{const[n,i]=e.value,r=t.leaflet.latLngToContainerPoint([i,n]);return{ref:e.ref,isCluster:e.isCluster,x:r.x,y:r.y,r:d(e.count)/2,setValue:([t,n])=>{e.value=[t,n]}}})),n=4,i=5;for(let t=0;t0&&s{const n=t.leaflet.containerPointToLatLng([e.x,e.y]);e.isCluster?e.ref.value=[n.lng,n.lat]:(e.ref.location.lng=n.lng,e.ref.location.lat=n.lat)}))}return{clusters:s,nonClusterNodes:o,nonClusterLinks:a}}updateMetadata(){if(this.config.metadata){const t=this.utils.getMetadata(this.data),e=document.querySelector(".njg-metaData"),n=document.querySelectorAll(".njg-metaDataItems");for(let t=0;t{const i=document.createElement("div");i.classList.add("njg-metaDataItems");const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");o.setAttribute("class","njg-valueLabel"),r.innerHTML=n,o.innerHTML=t[n],i.appendChild(r),i.appendChild(o),e.appendChild(i)}))}}getMetadata(t){const e=t,n={};return e.label&&(n.label=e.label),["protocol","version","revision","metric","router_id","topology_id"].forEach((t=>{e[t]&&(n[t]=e[t])})),n.nodes=e.nodes.length,n.links=e.links.length,n}nodeInfo(t){const e={};return!t._generatedIdentity&&(e.id=t.id,t.label&&"string"==typeof t.label&&(e.label=t.label)),t.name&&(e.name=t.name),t.location&&(e.location=t.location),t.properties&&Object.keys(t.properties).forEach((n=>{if("location"===n)e[n]={lat:t.properties.location.lat,lng:t.properties.location.lng};else if("time"===n){const i=this.dateParse({dateString:t.properties[n]});e[n]=i}else{if("object"==typeof t.properties[n]||n.startsWith("_"))return;e[n.replace(/_/g," ")]=t.properties[n]}})),t.linkCount&&(e.links=t.linkCount),t.local_addresses&&(e.localAddresses=t.local_addresses),e}createTooltipItem(t,e){const n=document.createElement("div");n.classList.add("njg-tooltip-item");const i=document.createElement("span");i.setAttribute("class","njg-tooltip-key");const r=document.createElement("span");return r.setAttribute("class","njg-tooltip-value"),i.innerHTML=t,r.innerHTML=e,n.appendChild(i),n.appendChild(r),n}getNodeTooltipInfo(t){const e=document.createElement("div");e.classList.add("njg-tooltip-inner");const n=!t._generatedIdentity;return n&&t.id&&e.appendChild(this.createTooltipItem("id",t.id)),n&&t.label&&"string"==typeof t.label&&e.appendChild(this.createTooltipItem("label",t.label)),t.properties&&Object.keys(t.properties).forEach((i=>{if("object"!=typeof t.properties[i]&&!i.startsWith("_")&&("id"!==i&&"label"!==i||!n))if("location"===i)e.appendChild(this.createTooltipItem("location",`${Math.round(1e3*t.properties.location.lat)/1e3}, ${Math.round(1e3*t.properties.location.lng)/1e3}`));else if("time"===i){const n=this.dateParse({dateString:t.properties[i]});e.appendChild(this.createTooltipItem("time",n))}else e.appendChild(this.createTooltipItem(`${i.replace(/_/g," ")}`,t.properties[i]))})),t.linkCount&&e.appendChild(this.createTooltipItem("Links",t.linkCount)),t.local_addresses&&e.appendChild(this.createTooltipItem("Local Addresses",t.local_addresses.join("
"))),e}getLinkTooltipInfo(t){const e=document.createElement("div");e.classList.add("njg-tooltip-inner");const n=t=>"string"==typeof t&&t.startsWith("gjn_");return n(t.source)||e.appendChild(this.createTooltipItem("source",t.source)),n(t.target)||e.appendChild(this.createTooltipItem("target",t.target)),void 0!==t.cost&&null!==t.cost&&e.appendChild(this.createTooltipItem("cost",t.cost)),t.properties&&Object.keys(t.properties).forEach((n=>{const i=t.properties[n];if(null!=i)if("time"===n){const t=this.dateParse({dateString:i});e.appendChild(this.createTooltipItem("time",t))}else{const t="string"==typeof i?i.replace(/\n/g,"
"):i;e.appendChild(this.createTooltipItem(`${n.replace(/_/g," ")}`,t))}})),e}linkInfo(t){const e={},n=t=>"string"==typeof t&&t.startsWith("gjn_");return n(t.source)||(e.source=t.source),n(t.target)||(e.target=t.target),void 0!==t.cost&&null!==t.cost&&(e.cost=t.cost),t.properties&&Object.keys(t.properties).forEach((n=>{const i=t.properties[n];if(null!=i)if("time"===n){const t=this.dateParse({dateString:i});e[n]=t}else{const t="string"==typeof i?i.replace(/\n/g,"
"):i;e[n.replace(/_/g," ")]=t}})),e}generateStyle(t,e){return"function"==typeof t?t(e):t}getNodeStyle(t,e,n){let i,r={},o={},a=!1;if(t.category&&e.nodeCategories&&e.nodeCategories.length){const n=e.nodeCategories.find((e=>e.name===t.category));if(n){a=!0,i=this.generateStyle(n.nodeStyle||{},t),r=this.generateStyle(n.nodeSize||{},t);let e={},s={};n.emphasis&&(e=this.generateStyle(n.emphasis.nodeStyle||{},t),s=this.generateStyle(n.emphasis.nodeSize||{},t),o={nodeStyle:e,nodeSize:s})}}if(!a)if("map"===n){const n=e.mapOptions&&e.mapOptions.nodeConfig;i=this.generateStyle(n&&n.nodeStyle||{},t),r=this.generateStyle(n&&n.nodeSize||{},t);const a=n&&n.emphasis;a&&(o={nodeStyle:this.generateStyle(a&&a.nodeStyle||{},t),nodeSize:this.generateStyle(a&&a.nodeSize||{},t)})}else{const n=e.graphConfig&&e.graphConfig.series;i=this.generateStyle(n&&n.nodeStyle||{},t),r=this.generateStyle(n&&n.nodeSize||{},t);const a=n&&n.emphasis;a&&(o={nodeStyle:this.generateStyle(a&&a.itemStyle||{},t),nodeSize:this.generateStyle(a&&a.symbolSize||r||{},t)})}return{nodeStyleConfig:i,nodeSizeConfig:r,nodeEmphasisConfig:o}}getLinkStyle(t,e,n){let i,r={};if(t.category&&e.linkCategories.length){const n=e.linkCategories.find((e=>e.name===t.category));i=this.generateStyle(n.linkStyle||{},t),r={...r,linkStyle:n.emphasis?this.generateStyle(n.emphasis.linkStyle||{},t):{}}}else i="map"===n?this.generateStyle(e.mapOptions.linkConfig.linkStyle,t):this.generateStyle(e.graphConfig.series.linkStyle,t);return{linkStyleConfig:i,linkEmphasisConfig:r}}showLoading(){let t=this.el.querySelector(".njg-loadingContainer");return t?t.style.visibility="visible":(t=document.createElement("div"),t.classList.add("njg-loadingContainer"),t.innerHTML='\n
\n
\n

Loading...

\n
\n ',this.el.appendChild(t)),t}hideLoading(){const t=this.el.querySelector(".njg-loadingContainer");return t&&(t.style.visibility="hidden"),t}createEvent(){const t=new Map,e=new Map;return{on(e,...n){t.set(e,[...t.get(e)||[],...n])},once(t,...n){e.set(t,[...e.get(t)||[],...n])},emit(n){const i=t.get(n)||[],r=e.get(n)||[],o=i.map((t=>t())),a=r.map((t=>t()));return e.delete(n),[...o,...a]},delete(n){t.delete(n),e.delete(n)}}}};const C=class extends M{searchElements(t){const e=this,n={"":{data:{...e.data},param:[...e.JSONParam]}};return window.history.pushState({searchValue:""},""),window.onpopstate=i=>{n[i.state.searchValue]?e.utils.JSONDataUpdate.call(e,n[i.state.searchValue].data).then((()=>{e.JSONParam=n[i.state.searchValue].param})):e.utils.JSONDataUpdate.call(e,t+i.state.searchValue)},function(i,r=!0,o=!0){const a=i.trim();if(!window.history.state||window.history.state&&window.history.state.searchValue!==a)return window.history.pushState({searchValue:a},""),e.utils.JSONDataUpdate.call(e,t+a,r,o).then((()=>{n[a]={data:{...e.data},param:[...e.JSONParam]}}))}}JSONDataUpdate(t,e=!0,n=!0){const i=this;return i.config.onUpdate.call(i),i.utils.paginatedDataParse.call(i,t).then((r=>{function o(){e?(i.JSONParam=[t],i.utils.overrideData(r,i)):(i.JSONParam.push(t),i.config.render===i.utils.mapRender?i.utils.appendData(r,i):i.utils.addData(r,i)),i.utils.isNetJSON(i.data)&&i.utils.updateMetadata.call(i)}return n?(i.utils.isNetJSON(i.data)&&i.config.prepareData.call(i,r),i.config.dealDataByWorker?i.utils.dealDataByWorker.call(i,r,i.config.dealDataByWorker,o):o()):o(),r})).catch((t=>{console.error(t)}))}dealDataByWorker(t,e,n){const i=new Worker(e),r=this;i.postMessage(t),i.addEventListener("error",(t=>{console.error(t),console.error("Error in dealing JSONData!")})),i.addEventListener("message",(t=>{n?n():(r.utils.overrideData(t.data,r),r.utils.isNetJSON(r.data)&&r.utils.updateMetadata.call(r))}))}overrideData(t,e){e.data=t,e.utils.isNetJSON(e.data)||e.leaflet.geoJSON.removeFrom(e.leaflet),e.utils.render(),e.config.afterUpdate.call(e)}};const A=class{constructor(t){this.utils=new C,this.config=(0,d.cloneDeep)(v),this.JSONParam=this.utils.isArray(t)?t:[t]}setConfig(t){if(this.utils.deepMergeObj(this.config,t),this.el)t&&t.el&&console.error("Can't change el again!");else if(this.config.el?this.utils.isElement(this.config.el)?this.el=this.config.el:this.el=document.querySelector(this.config.el):this.el=document.body,this.el){if(this.el.classList.add("njg-container"),this.el===document.body){const t=document.documentElement;t.style.width="100%",t.style.height="100%",this.el.classList.add("njg-relativePosition")}}else console.error("NetJSONGraph: The specified element for rendering was not found and could not be set.");return this.config}render(){const[t,...e]=this.JSONParam;if(this.config.onRender.call(this),this.event.once("onReady",this.config.onReady.bind(this)),this.event.once("onLoad",this.config.onLoad.bind(this)),this.utils.paginatedDataParse.call(this,t).then((t=>{if(this.utils.isNetJSON(t))this.type="netjson";else{if(!this.utils.isGeoJSON(t))throw new Error("Invalid data format!");this.type="geojson",this.originalGeoJSON=JSON.parse(JSON.stringify(t)),t=this.utils.geojsonToNetjson(t)}if(this.utils.isNetJSON(t)){t.nodes.length>this.config.maxPointsFetched&&(this.hasMoreData=!0),t.nodes.splice(this.config.maxPointsFetched-1,t.nodes.length-this.config.maxPointsFetched);const e=new Set(t.nodes.map((t=>t.id)));t.links=t.links.filter((t=>!(!e.has(t.source)||!e.has(t.target))||(e.has(t.source)?console.warn(`Node ${t.target} does not exist!`):console.warn(`Node ${t.source} does not exist!`),!1)))}this.config.prepareData.call(this,t),this.data=t,this.config.dealDataByWorker?this.utils.dealDataByWorker.call(this,t,this.config.dealDataByWorker):(this.data=t,this.utils.render())})).catch((t=>{console.error(t)})),e.length){const n=function(){e.map((t=>this.utils.JSONDataUpdate.call(this,t,!1)))};this.JSONParam=[t],this.event.once("renderArray",n.bind(this))}}setUtils(t={}){const e=this;return e.utils=Object.assign(e.utils,{...t},{render(){if(!e.config.render)throw new Error("No render function!");e.config.render(e.data,e)}}),e.utils}}; +!function(t){"use strict";function e(t){for(var e,n,i=1,r=arguments.length;i=this.min.x&&n.x<=this.max.x&&e.y>=this.min.y&&n.y<=this.max.y},intersects:function(t){t=k(t);var e=this.min,n=this.max,i=t.min,r=(t=t.max).x>=e.x&&i.x<=n.x;return t=t.y>=e.y&&i.y<=n.y,r&&t},overlaps:function(t){t=k(t);var e=this.min,n=this.max,i=t.min,r=(t=t.max).x>e.x&&i.xe.y&&i.y=i.lat&&n.lat<=r.lat&&e.lng>=i.lng&&n.lng<=r.lng},intersects:function(t){t=B(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=(t=t.getNorthEast()).lat>=e.lat&&i.lat<=n.lat;return t=t.lng>=e.lng&&i.lng<=n.lng,r&&t},overlaps:function(t){t=B(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=(t=t.getNorthEast()).lat>e.lat&&i.late.lng&&i.lng","http://www.w3.org/2000/svg"===(Ct.firstChild&&Ct.firstChild.namespaceURI));function Lt(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var At={ie:J,ielt9:Q,edge:$,webkit:tt,android:et,android23:nt,androidStock:it,opera:rt,chrome:ot,gecko:at,safari:st,phantom:lt,opera12:ut,win:ht,ie3d:ct,webkit3d:dt,gecko3d:K,any3d:ft,mobile:Kn,mobileWebkit:pt,mobileWebkit3d:gt,msPointer:mt,pointer:vt,touch:yt,touchNative:_t,mobileOpera:xt,mobileGecko:wt,retina:bt,passiveEvents:St,canvas:Tt,svg:Mt,vml:!Mt&&function(){try{var t=document.createElement("div"),e=(t.innerHTML='',t.firstChild);return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}(),inlineSvg:Ct,mac:0===navigator.platform.indexOf("Mac"),linux:0===navigator.platform.indexOf("Linux")},Dt=At.msPointer?"MSPointerDown":"pointerdown",It=At.msPointer?"MSPointerMove":"pointermove",Pt=At.msPointer?"MSPointerUp":"pointerup",Et=At.msPointer?"MSPointerCancel":"pointercancel",Ot={touchstart:Dt,touchmove:It,touchend:Pt,touchcancel:Et},Nt={touchstart:function(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&Ee(e),Gt(t,e)},touchmove:Gt,touchend:Gt,touchcancel:Gt},Rt={},kt=!1;function zt(t,e,n){return"touchstart"!==e||kt||(document.addEventListener(Dt,Bt,!0),document.addEventListener(It,Ft,!0),document.addEventListener(Pt,Vt,!0),document.addEventListener(Et,Vt,!0),kt=!0),Nt[e]?(n=Nt[e].bind(this,n),t.addEventListener(Ot[e],n,!1),n):(console.warn("wrong event specified:",e),u)}function Bt(t){Rt[t.pointerId]=t}function Ft(t){Rt[t.pointerId]&&(Rt[t.pointerId]=t)}function Vt(t){delete Rt[t.pointerId]}function Gt(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){for(var n in e.touches=[],Rt)e.touches.push(Rt[n]);e.changedTouches=[e],t(e)}}var Ht=200;function Ut(t,e){t.addEventListener("dblclick",e);var n,i=0;function r(t){var r;1!==t.detail?n=t.detail:"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||(r=Ne(t)).some((function(t){return t instanceof HTMLLabelElement&&t.attributes.for}))&&!r.some((function(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement}))||((r=Date.now())-i<=Ht?2==++n&&e(function(t){var e,n,i={};for(n in t)e=t[n],i[n]=e&&e.bind?e.bind(t):e;return(t=i).type="dblclick",i.detail=2,i.isTrusted=!1,i._simulated=!0,i}(t)):n=1,i=r)}return t.addEventListener("click",r),{dblclick:e,simDblclick:r}}var Wt,jt,Zt,Xt,qt,Yt,Kt=de(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Jt=de(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Qt="webkitTransition"===Jt||"OTransition"===Jt?Jt+"End":"transitionend";function $t(t){return"string"==typeof t?document.getElementById(t):t}function te(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];return"auto"===(n=n&&"auto"!==n||!document.defaultView?n:(t=document.defaultView.getComputedStyle(t,null))?t[e]:null)?null:n}function ee(t,e,n){return(t=document.createElement(t)).className=e||"",n&&n.appendChild(t),t}function ne(t){var e=t.parentNode;e&&e.removeChild(t)}function ie(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function re(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function oe(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ae(t,e){return void 0!==t.classList?t.classList.contains(e):0<(t=he(t)).length&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(t)}function se(t,e){var n;if(void 0!==t.classList)for(var i=d(e),r=0,o=i.length;rthis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var n=this.getCenter();return t=this._limitCenter(n,this._zoom,B(t)),n.equals(t)||this.panTo(t,e),this._enforcingBounds=!1,this},panInside:function(t,e){var n=N((e=e||{}).paddingTopLeft||e.padding||[0,0]),i=N(e.paddingBottomRight||e.padding||[0,0]),r=this.project(this.getCenter()),o=(t=this.project(t),(n=k([(o=this.getPixelBounds()).min.add(n),o.max.subtract(i)])).getSize());return n.contains(t)||(this._enforcingBounds=!0,i=t.subtract(n.getCenter()),n=n.extend(t).getSize().subtract(o),r.x+=i.x<0?-n.x:n.x,r.y+=i.y<0?-n.y:n.y,this.panTo(this.unproject(r),e),this._enforcingBounds=!1),this},invalidateSize:function(t){if(!this._loaded)return this;t=e({animate:!1,pan:!0},!0===t?{animate:!0}:t);var n=this.getSize(),i=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),o=n.divideBy(2).round(),a=i.divideBy(2).round();return(o=o.subtract(a)).x||o.y?(t.animate&&t.pan?this.panBy(o):(t.pan&&this._rawPanBy(o),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:n,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){var n,i;return t=this._locateOptions=e({timeout:1e4,watch:!1},t),"geolocation"in navigator?(n=r(this._handleGeolocationResponse,this),i=r(this._handleGeolocationError,this),t.watch?this._locationWatchId=navigator.geolocation.watchPosition(n,i,t):navigator.geolocation.getCurrentPosition(n,i,t)):this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e;this._container._leaflet_id&&(e=t.code,t=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout"),this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+t+"."}))},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e,n,i=new F(t.coords.latitude,t.coords.longitude),r=i.toBounds(2*t.coords.accuracy),o=this._locateOptions,a=(o.setView&&(e=this.getBoundsZoom(r),this.setView(i,o.maxZoom?Math.min(e,o.maxZoom):e)),{latlng:i,bounds:r,timestamp:t.timestamp});for(n in t.coords)"number"==typeof t.coords[n]&&(a[n]=t.coords[n]);this.fire("locationfound",a)}},addHandler:function(t,e){return e&&(e=this[t]=new e(this),this._handlers.push(e),this.options[t]&&e.enable()),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}for(var t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ne(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(C(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ne(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){return e=ee("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane),t&&(this._panes[t]=e),e},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new z(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,n){t=B(t),n=N(n||[0,0]);var i=this.getZoom()||0,r=this.getMinZoom(),o=this.getMaxZoom(),a=t.getNorthWest(),s=(t=t.getSouthEast(),n=this.getSize().subtract(n),t=k(this.project(t,i),this.project(a,i)).getSize(),a=At.any3d?this.options.zoomSnap:1,n.x/t.x);return n=n.y/t.y,t=e?Math.max(s,n):Math.min(s,n),i=this.getScaleZoom(t,i),a&&(i=Math.round(i/(a/100))*(a/100),i=e?Math.ceil(i/a)*a:Math.floor(i/a)*a),Math.max(r,Math.min(o,i))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new E(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){return new R(t=this._getTopLeftPoint(t,e),t.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,n.scale(t)/n.scale(e)},getScaleZoom:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,t=n.zoom(t*n.scale(e)),isNaN(t)?1/0:t},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(V(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(N(t),e)},layerPointToLatLng:function(t){return t=N(t).add(this.getPixelOrigin()),this.unproject(t)},latLngToLayerPoint:function(t){return this.project(V(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(V(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(B(t))},distance:function(t,e){return this.options.crs.distance(V(t),V(e))},containerPointToLayerPoint:function(t){return N(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return N(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){return t=this.containerPointToLayerPoint(N(t)),this.layerPointToLatLng(t)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(V(t)))},mouseEventToContainerPoint:function(t){return Re(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){if(!(t=this._container=$t(t)))throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");be(t,"scroll",this._onScroll,this),this._containerId=a(t)},_initLayout:function(){var t=this._container,e=(this._fadeAnimated=this.options.fadeAnimation&&At.any3d,se(t,"leaflet-container"+(At.touch?" leaflet-touch":"")+(At.retina?" leaflet-retina":"")+(At.ielt9?" leaflet-oldie":"")+(At.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":"")),te(t,"position"));"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),pe(this._mapPane,new E(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(se(t.markerPane,"leaflet-zoom-hide"),se(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,n){pe(this._mapPane,new E(0,0));var i=!this._loaded,r=(this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset"),this._zoom!==e);this._moveStart(r,n)._move(t,e)._moveEnd(r),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,n,i){void 0===e&&(e=this._zoom);var r=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),i?n&&n.pinch&&this.fire("zoom",n):((r||n&&n.pinch)&&this.fire("zoom",n),this.fire("move",n)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return C(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){pe(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={};var e=t?Te:be;e((this._targets[a(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),At.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){C(this._resizeRequest),this._resizeRequest=M((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var n,i=[],r="mouseout"===e||"mouseover"===e,o=t.target||t.srcElement,s=!1;o;){if((n=this._targets[a(o)])&&("click"===e||"preclick"===e)&&this._draggableMoved(n)){s=!0;break}if(n&&n.listens(e,!0)){if(r&&!Be(o,t))break;if(i.push(n),r)break}if(o===this._container)break;o=o.parentNode}return i.length||s||r||!this.listens(e,!0)?i:[this]},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e,n=t.target||t.srcElement;!this._loaded||n._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(n)||("mousedown"===(e=t.type)&&_e(n),this._fireDOMEvent(t,e))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,n,i){"click"===t.type&&((l=e({},t)).type="preclick",this._fireDOMEvent(l,l.type,i));var r=this._findEventTargets(t,n);if(i){for(var o=[],a=0;athis.options.zoomAnimationThreshold)return!1;var i=this.getZoomScale(e);if(i=this._getCenterOffset(t)._divideBy(1-1/i),!0!==n.animate&&!this.getSize().contains(i))return!1;M((function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(t,e,!0)}),this)}return!0},_animateZoom:function(t,e,n,i){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,se(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:i}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&le(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Ge(t){return new Ue(t)}var He,Ue=D.extend({options:{position:"topright"},initialize:function(t){f(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),n=this.getPosition();return t=t._controlCorners[n],se(e,"leaflet-control"),-1!==n.indexOf("bottom")?t.insertBefore(e,t.firstChild):t.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(ne(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",(e=document.createElement("div")).innerHTML=t,e.firstChild},_addItem:function(t){var e,n=document.createElement("label"),i=this._map.hasLayer(t.layer),r=((t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=i):e=this._createRadioElement("leaflet-base-layers_"+a(this),i),this._layerControlInputs.push(e),e.layerId=a(t.layer),be(e,"click",this._onInputClick,this),i=document.createElement("span")).innerHTML=" "+t.name,document.createElement("span"));return n.appendChild(r),r.appendChild(e),r.appendChild(i),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var t,e,n=this._layerControlInputs,i=[],r=[];this._handlingClick=!0;for(var o=n.length-1;0<=o;o--)t=n[o],e=this._getLayer(t.layerId).layer,t.checked?i.push(e):t.checked||r.push(e);for(o=0;oe.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section,e=(this._preventClick=!0,be(t,"click",Ee),this.expand(),this);setTimeout((function(){Te(t,"click",Ee),e._preventClick=!1}))}})),je=Ue.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",n=ee("div",e+" leaflet-bar"),i=this.options;return this._zoomInButton=this._createButton(i.zoomInText,i.zoomInTitle,e+"-in",n,this._zoomIn),this._zoomOutButton=this._createButton(i.zoomOutText,i.zoomOutTitle,e+"-out",n,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),n},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,n,i,r){return(n=ee("a",n,i)).innerHTML=t,n.href="#",n.title=e,n.setAttribute("role","button"),n.setAttribute("aria-label",e),Pe(n),be(n,"click",Oe),be(n,"click",r,this),be(n,"click",this._refocusOnMap,this),n},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";le(this._zoomInButton,e),le(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),!this._disabled&&t._zoom!==t.getMinZoom()||(se(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),!this._disabled&&t._zoom!==t.getMaxZoom()||(se(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}}),Ze=(Ve.mergeOptions({zoomControl:!0}),Ve.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new je,this.addControl(this.zoomControl))})),Ue.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",n=ee("div",e),i=this.options;return this._addScales(i,e+"-line",n),t.on(i.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),n},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,n){t.metric&&(this._mScale=ee("div",e,n)),t.imperial&&(this._iScale=ee("div",e,n))},_update:function(){var t=(e=this._map).getSize().y/2,e=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t);this._updateScale(this._mScale,e<1e3?e+" m":e/1e3+" km",e/t)},_updateImperial:function(t){var e,n;5280<(t*=3.2808399)?(n=this._getRoundNum(e=t/5280),this._updateScale(this._iScale,n+" mi",n/e)):(n=this._getRoundNum(t),this._updateScale(this._iScale,n+" ft",n/t))},_updateScale:function(t,e,n){t.style.width=Math.round(this.options.maxWidth*n)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1);return e*(10<=(t/=e)?10:5<=t?5:3<=t?3:2<=t?2:1)}})),Xe=Ue.extend({options:{position:"bottomright",prefix:''+(At.inlineSvg?' ':"")+"Leaflet"},initialize:function(t){f(this,t),this._attributions={}},onAdd:function(t){for(var e in(t.attributionControl=this)._container=ee("div","leaflet-control-attribution"),Pe(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",(function(){this.removeAttribution(t.layer.getAttribution())}),this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t,e=[];for(t in this._attributions)this._attributions[t]&&e.push(t);var n=[];this.options.prefix&&n.push(this.options.prefix),e.length&&n.push(e.join(", ")),this._container.innerHTML=n.join(' ')}}}),qe=(Ve.mergeOptions({attributionControl:!0}),Ve.addInitHook((function(){this.options.attributionControl&&(new Xe).addTo(this)})),Ue.Layers=We,Ue.Zoom=je,Ue.Scale=Ze,Ue.Attribution=Xe,Ge.layers=function(t,e,n){return new We(t,e,n)},Ge.zoom=function(t){return new je(t)},Ge.scale=function(t){return new Ze(t)},Ge.attribution=function(t){return new Xe(t)},$=D.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}}),$.addTo=function(t,e){return t.addHandler(e,this),this},tt={Events:I},At.touch?"touchstart mousedown":"mousedown"),Ye=P.extend({options:{clickTolerance:3},initialize:function(t,e,n,i){f(this,i),this._element=t,this._dragStartTarget=e||t,this._preventOutline=n},enable:function(){this._enabled||(be(this._dragStartTarget,qe,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ye._dragging===this&&this.finishDrag(!0),Te(this._dragStartTarget,qe,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){var e,n;this._enabled&&(this._moved=!1,ae(this._element,"leaflet-zoom-anim")||(t.touches&&1!==t.touches.length?Ye._dragging===this&&this.finishDrag():Ye._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((Ye._dragging=this)._preventOutline&&_e(this._element),me(),Zt(),this._moving||(this.fire("down"),n=t.touches?t.touches[0]:t,e=xe(this._element),this._startPoint=new E(n.clientX,n.clientY),this._startPos=ge(this._element),this._parentScale=we(e),n="mousedown"===t.type,be(document,n?"mousemove":"touchmove",this._onMove,this),be(document,n?"mouseup":"touchend touchcancel",this._onUp,this)))))},_onMove:function(t){var e;this._enabled&&(t.touches&&1e&&(n.push(t[i]),r=i);return re.max.x&&(n|=2),t.ye.max.y&&(n|=8),n}function on(t,e,n,i){var r=e.x,o=(e=e.y,n.x-r),a=n.y-e,s=o*o+a*a;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(u=!u);return u||yn.prototype._containsPoint.call(this,t,!0)}}),wn=cn.extend({initialize:function(t,e){f(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,n,i,r=v(t)?t:t.features;if(r){for(e=0,n=r.length;eo.x&&(a=n.x+s-o.x+r.x),n.x-a-i.x<(s=0)&&(a=n.x-i.x),n.y+e+r.y>o.y&&(s=n.y+e-o.y+r.y),n.y-s-i.y<0&&(s=n.y-i.y),(a||s)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([a,s]))))},_getAnchor:function(){return N(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}})),kn=(Ve.mergeOptions({closePopupOnClick:!0}),Ve.include({openPopup:function(t,e,n){return this._initOverlay(Rn,t,e,n).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),ut.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Rn,this._popup,t,e),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof cn||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e;this._popup&&this._map&&(Oe(t),e=t.layer||t.target,this._popup._source!==e||e instanceof mn?(this._popup._source=e,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}}),Nn.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Nn.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Nn.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Nn.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ee("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+a(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,n=this._map,i=this._container,r=n.latLngToContainerPoint(n.getCenter()),o=(n=n.layerPointToContainerPoint(t),this.options.direction),a=i.offsetWidth,s=i.offsetHeight,l=N(this.options.offset),u=this._getAnchor();n="top"===o?(e=a/2,s):"bottom"===o?(e=a/2,0):(e="center"===o?a/2:"right"===o?0:"left"===o?a:n.xthis.options.maxZoom||ithis.options.maxZoom||void 0!==this.options.minZoom&&rn.max.x)||!e.wrapLat&&(t.yn.max.y))return!1}return!this.options.bounds||(e=this._tileCoordsToBounds(t),B(this.options.bounds).overlaps(e))},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,n=this.getTileSize(),i=t.scaleBy(n);return n=i.add(n),[e.unproject(i,t.z),e.unproject(n,t.z)]},_tileCoordsToBounds:function(t){return t=new z((t=this._tileCoordsToNwSe(t))[0],t[1]),this.options.noWrap?t:this._map.wrapLatLngBounds(t)},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=new E(+(t=t.split(":"))[0],+t[1]);return e.z=+t[2],e},_removeTile:function(t){var e=this._tiles[t];e&&(ne(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){se(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=u,t.onmousemove=u,At.ielt9&&this.options.opacity<1&&ce(t,this.options.opacity)},_addTile:function(t,e){var n=this._getTilePos(t),i=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),r(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(r(this._tileReady,this,t,null,o)),pe(o,n),this._tiles[i]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,n){e&&this.fire("tileerror",{error:e,tile:n,coords:t});var i=this._tileCoordsToKey(t);(n=this._tiles[i])&&(n.loaded=+new Date,this._map._fadeAnimated?(ce(n.el,0),C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),e||(se(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),At.ielt9||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new E(this._wrapX?l(t.x,this._wrapX):t.x,this._wrapY?l(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new R(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}}),Fn=Bn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,(e=f(this,e)).detectRetina&&At.retina&&0')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Zn=(dt={_initContainer:function(){this._container=ee("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Hn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=jn("shape");se(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=jn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ne(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,n=t._fill,i=t.options,r=t._container;r.stroked=!!i.stroke,r.filled=!!i.fill,i.stroke?(e=e||(t._stroke=jn("stroke")),r.appendChild(e),e.weight=i.weight+"px",e.color=i.color,e.opacity=i.opacity,i.dashArray?e.dashStyle=v(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=i.lineCap.replace("butt","flat"),e.joinstyle=i.lineJoin):e&&(r.removeChild(e),t._stroke=null),i.fill?(n=n||(t._fill=jn("fill")),r.appendChild(n),n.color=i.fillColor||i.color,n.opacity=i.fillOpacity):n&&(r.removeChild(n),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),n=Math.round(t._radius),i=Math.round(t._radiusY||n);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+n+","+i+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){re(t._container)},_bringToBack:function(t){oe(t._container)}},At.vml?jn:q),Xn=Hn.extend({_initContainer:function(){this._container=Zn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Zn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ne(this._container),Te(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){var t,e,n;this._map._animatingZoom&&this._bounds||(Hn.prototype._update.call(this),e=(t=this._bounds).getSize(),n=this._container,this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,n.setAttribute("width",e.x),n.setAttribute("height",e.y)),pe(n,t.min),n.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update"))},_initPath:function(t){var e=t._path=Zn("path");t.options.className&&se(e,t.options.className),t.options.interactive&&se(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ne(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path;t=t.options,e&&(t.stroke?(e.setAttribute("stroke",t.color),e.setAttribute("stroke-opacity",t.opacity),e.setAttribute("stroke-width",t.weight),e.setAttribute("stroke-linecap",t.lineCap),e.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?e.setAttribute("stroke-dasharray",t.dashArray):e.removeAttribute("stroke-dasharray"),t.dashOffset?e.setAttribute("stroke-dashoffset",t.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),t.fill?(e.setAttribute("fill",t.fillColor||t.color),e.setAttribute("fill-opacity",t.fillOpacity),e.setAttribute("fill-rule",t.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Y(t._parts,e))},_updateCircle:function(t){var e=t._point,n=Math.max(Math.round(t._radius),1),i="a"+n+","+(Math.max(Math.round(t._radiusY),1)||n)+" 0 1,0 ";e=t._empty()?"M0 0":"M"+(e.x-n)+","+e.y+i+2*n+",0 "+i+2*-n+",0 ",this._setPath(t,e)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){re(t._path)},_bringToBack:function(t){oe(t._path)}});function qn(t){return At.svg||At.vml?new Xn(t):null}At.vml&&Xn.include(dt),Ve.include({getRenderer:function(t){return t=(t=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(t){var e;return"overlayPane"!==t&&void 0!==t&&(void 0===(e=this._paneRenderers[t])&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e)},_createRenderer:function(t){return this.options.preferCanvas&&Wn(t)||qn(t)}});var Yn=xn.extend({initialize:function(t,e){xn.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=B(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});Xn.create=Zn,Xn.pointsToPath=Y,wn.geometryToLayer=bn,wn.coordsToLatLng=Tn,wn.coordsToLatLngs=Mn,wn.latLngToCoords=Cn,wn.latLngsToCoords=Ln,wn.getFeature=An,wn.asFeature=Dn,Ve.mergeOptions({boxZoom:!0}),K=$.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){be(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Te(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ne(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),Zt(),me(),this._startPoint=this._map.mouseEventToContainerPoint(t),be(document,{contextmenu:Oe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=ee("div","leaflet-zoom-box",this._container),se(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=(t=new R(this._point,this._startPoint)).getSize();pe(this._box,t.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ne(this._box),le(this._container,"leaflet-crosshair")),Xt(),ve(),Te(document,{contextmenu:Oe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){1!==t.which&&1!==t.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0),t=new z(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})))},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}}),Ve.addInitHook("addHandler","boxZoom",K),Ve.mergeOptions({doubleClickZoom:!0}),ft=$.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,n=e.getZoom(),i=e.options.zoomDelta;n=t.originalEvent.shiftKey?n-i:n+i,"center"===e.options.doubleClickZoom?e.setZoom(n):e.setZoomAround(t.containerPoint,n)}});var Kn=(Ve.addInitHook("addHandler","doubleClickZoom",ft),Ve.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0}),$.extend({addHooks:function(){var t;this._draggable||(t=this._map,this._draggable=new Ye(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))),se(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){le(this._map._container,"leaflet-grab"),le(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t,e=this._map;e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(t=B(this._map.options.maxBounds),this._offsetLimit=k(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null,e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){var e,n;this._map.options.inertia&&(e=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(n),this._times.push(e),this._prunePositions(e)),this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t))},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),n=this._initialWorldOffset,i=((r=this._draggable._newPos.x)-e+n)%t+e-n,r=(r+e+n)%t-e-n;t=Math.abs(i+n)e.getMaxZoom()&&1{"use strict";n.r(e),n.d(e,{EPSILON:()=>yt,HashMap:()=>ct,RADIAN_TO_DEGREE:()=>_t,assert:()=>rt,bind:()=>B,clone:()=>b,concatArray:()=>ft,createCanvas:()=>L,createHashMap:()=>dt,createObject:()=>pt,curry:()=>F,defaults:()=>C,disableUserSelect:()=>gt,each:()=>E,eqNaN:()=>Q,extend:()=>M,filter:()=>R,find:()=>k,guid:()=>x,hasOwn:()=>mt,indexOf:()=>A,inherits:()=>D,isArray:()=>V,isArrayLike:()=>P,isBuiltInObject:()=>Z,isDom:()=>q,isFunction:()=>G,isGradientObject:()=>Y,isImagePatternObject:()=>K,isNumber:()=>W,isObject:()=>j,isPrimitive:()=>lt,isRegExp:()=>J,isString:()=>H,isStringSafe:()=>U,isTypedArray:()=>X,keys:()=>z,logError:()=>w,map:()=>O,merge:()=>S,mergeAll:()=>T,mixin:()=>I,noop:()=>vt,normalizeCssArray:()=>it,reduce:()=>N,retrieve:()=>$,retrieve2:()=>tt,retrieve3:()=>et,setAsPrimitive:()=>st,slice:()=>nt,trim:()=>ot});var i="12px sans-serif";var r,o,a=function(t){var e={};if("undefined"==typeof JSON)return e;for(var n=0;n=0)h=u*t.length;else for(var c=0;c{"use strict";n.r(e),n.d(e,{fastLerp:()=>S,fastMapToColor:()=>T,lerp:()=>M,lift:()=>w,liftColor:()=>O,lum:()=>I,mapToColor:()=>C,modifyAlpha:()=>A,modifyHSL:()=>L,parse:()=>y,parseCssFloat:()=>c,parseCssInt:()=>h,random:()=>P,stringify:()=>D,toHex:()=>b});var i=function(t){this.value=t},r=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new i(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}();const o=function(){function t(t){this._list=new r,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var n=this._list,r=this._map,o=null;if(null==r[t]){var a=n.len(),s=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var l=n.head;n.remove(l),delete r[l.key],o=l.value,this._lastRemovedEntry=l}s?s.value=e:s=new i(e),s.key=t,n.insertEntry(s),r[t]=s}return o},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();var a=n(627),s={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function l(t){return(t=Math.round(t))<0?0:t>255?255:t}function u(t){return t<0?0:t>1?1:t}function h(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?l(parseFloat(e)/100*255):l(parseInt(e,10))}function c(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?u(parseFloat(e)/100):u(parseFloat(e))}function d(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function f(t,e,n){return t+(e-t)*n}function p(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function g(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var m=new o(20),v=null;function _(t,e){v&&g(v,e),v=m.put(t,v||e.slice())}function y(t,e){if(t){e=e||[];var n=m.get(t);if(n)return g(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in s)return g(e,s[i]),_(t,e),e;var r,o=i.length;if("#"===i.charAt(0))return 4===o||5===o?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(p(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(i.slice(4),16)/15:1),_(t,e),e):void p(e,0,0,0,1):7===o||9===o?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(p(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(i.slice(7),16)/255:1),_(t,e),e):void p(e,0,0,0,1):void 0;var a=i.indexOf("("),l=i.indexOf(")");if(-1!==a&&l+1===o){var u=i.substr(0,a),d=i.substr(a+1,l-(a+1)).split(","),f=1;switch(u){case"rgba":if(4!==d.length)return 3===d.length?p(e,+d[0],+d[1],+d[2],1):p(e,0,0,0,1);f=c(d.pop());case"rgb":return d.length>=3?(p(e,h(d[0]),h(d[1]),h(d[2]),3===d.length?f:c(d[3])),_(t,e),e):void p(e,0,0,0,1);case"hsla":return 4!==d.length?void p(e,0,0,0,1):(d[3]=c(d[3]),x(d,e),_(t,e),e);case"hsl":return 3!==d.length?void p(e,0,0,0,1):(x(d,e),_(t,e),e);default:return}}p(e,0,0,0,1)}}function x(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=c(t[1]),r=c(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return p(e=e||[],l(255*d(a,o,n+1/3)),l(255*d(a,o,n)),l(255*d(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function w(t,e){var n=y(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return D(n,4===n.length?"rgba":"rgb")}}function b(t){var e=y(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function S(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],h=i-r;return n[0]=l(f(a[0],s[0],h)),n[1]=l(f(a[1],s[1],h)),n[2]=l(f(a[2],s[2],h)),n[3]=u(f(a[3],s[3],h)),n}}var T=S;function M(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=y(e[r]),s=y(e[o]),h=i-r,c=D([l(f(a[0],s[0],h)),l(f(a[1],s[1],h)),l(f(a[2],s[2],h)),u(f(a[3],s[3],h))],"rgba");return n?{color:c,leftIndex:r,rightIndex:o,value:i}:c}}var C=M;function L(t,e,n,i){var r,o=y(t);if(t)return o=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(o),null!=e&&(o[0]=(r=(0,a.isFunction)(e)?e(o[0]):e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(o[1]=c((0,a.isFunction)(n)?n(o[1]):n)),null!=i&&(o[2]=c((0,a.isFunction)(i)?i(o[2]):i)),D(x(o),"rgba")}function A(t,e){var n=y(t);if(n&&null!=e)return n[3]=u(e),D(n,"rgba")}function D(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}}function I(t,e){var n=y(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function P(){return D([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}var E=new o(100);function O(t){if((0,a.isString)(t)){var e=E.get(t);return e||(e=w(t,-.1),E.put(t,e)),e}if((0,a.isGradientObject)(t)){var n=(0,a.extend)({},t);return n.colorStops=(0,a.map)(t.colorStops,(function(t){return{offset:t.offset,color:w(t.color,-.1)}})),n}return t}}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};n.r(t),n.d(t,{HashMap:()=>Wt,RADIAN_TO_DEGREE:()=>Jt,assert:()=>zt,bind:()=>vt,clone:()=>et,concatArray:()=>Zt,createCanvas:()=>at,createHashMap:()=>jt,createObject:()=>Xt,curry:()=>_t,defaults:()=>ot,disableUserSelect:()=>qt,each:()=>ct,eqNaN:()=>Pt,extend:()=>rt,filter:()=>pt,find:()=>gt,guid:()=>$,hasOwn:()=>Yt,indexOf:()=>st,inherits:()=>lt,isArray:()=>yt,isArrayLike:()=>ht,isBuiltInObject:()=>Mt,isDom:()=>Lt,isFunction:()=>xt,isGradientObject:()=>At,isImagePatternObject:()=>Dt,isNumber:()=>St,isObject:()=>Tt,isPrimitive:()=>Gt,isRegExp:()=>It,isString:()=>wt,isStringSafe:()=>bt,isTypedArray:()=>Ct,keys:()=>mt,logError:()=>tt,map:()=>dt,merge:()=>nt,mergeAll:()=>it,mixin:()=>ut,noop:()=>Kt,normalizeCssArray:()=>kt,reduce:()=>ft,retrieve:()=>Et,retrieve2:()=>Ot,retrieve3:()=>Nt,setAsPrimitive:()=>Vt,slice:()=>Rt,trim:()=>Bt});var e={};n.r(e),n.d(e,{add:()=>ne,applyTransform:()=>xe,clone:()=>te,copy:()=>$t,create:()=>Qt,dist:()=>ge,distSquare:()=>ve,distance:()=>pe,distanceSquare:()=>me,div:()=>he,dot:()=>ce,len:()=>oe,lenSquare:()=>se,length:()=>ae,lengthSquare:()=>le,lerp:()=>ye,max:()=>be,min:()=>we,mul:()=>ue,negate:()=>_e,normalize:()=>fe,scale:()=>de,scaleAndAdd:()=>ie,set:()=>ee,sub:()=>re});var i={};n.r(i),n.d(i,{clone:()=>an,copy:()=>$e,create:()=>Je,identity:()=>Qe,invert:()=>on,mul:()=>tn,rotate:()=>nn,scale:()=>rn,translate:()=>en});var r={};n.r(r),n.d(r,{fastLerp:()=>Fi,fastMapToColor:()=>Vi,lerp:()=>Gi,lift:()=>zi,liftColor:()=>Yi,lum:()=>Zi,mapToColor:()=>Hi,modifyAlpha:()=>Wi,modifyHSL:()=>Ui,parse:()=>Ri,random:()=>Xi,stringify:()=>ji,toHex:()=>Bi});var o={};n.r(o),n.d(o,{dispose:()=>Bo,disposeAll:()=>Fo,getElementSSRData:()=>Ho,getInstance:()=>Vo,init:()=>zo,registerPainter:()=>Go,registerSSRDataGetter:()=>Uo,version:()=>Wo});var a={};n.r(a),n.d(a,{Arc:()=>zg,BezierCurve:()=>Ng,BoundingRect:()=>_n,Circle:()=>Kp,CompoundPath:()=>Fg,Ellipse:()=>$p,Group:()=>Eo,Image:()=>Pl,IncrementalDisplayable:()=>tm,Line:()=>Dg,LinearGradient:()=>Ug,OrientedBoundingRect:()=>Jg,Path:()=>Tl,Point:()=>ln,Polygon:()=>bg,Polyline:()=>Mg,RadialGradient:()=>jg,Rect:()=>Fl,Ring:()=>_g,Sector:()=>gg,Text:()=>eu,applyTransform:()=>_m,clipPointsByRect:()=>bm,clipRectByRect:()=>Sm,createIcon:()=>Tm,extendPath:()=>am,extendShape:()=>rm,getShapeClass:()=>lm,getTransform:()=>vm,groupTransition:()=>wm,initProps:()=>Qu,isElementRemoved:()=>$u,lineLineIntersect:()=>Cm,linePolygonIntersect:()=>Mm,makeImage:()=>hm,makePath:()=>um,mergePath:()=>dm,registerShape:()=>sm,removeElement:()=>th,removeElementWithFadeOut:()=>nh,resizePath:()=>fm,setTooltipConfig:()=>Am,subPixelOptimize:()=>mm,subPixelOptimizeLine:()=>pm,subPixelOptimizeRect:()=>gm,transformDirection:()=>ym,traverseElements:()=>Im,updateProps:()=>Ju});var s={};n.r(s),n.d(s,{createDimensions:()=>Lx,createList:()=>Ww,createScale:()=>Zw,createSymbol:()=>jv,createTextStyle:()=>qw,dataStack:()=>jw,enableHoverEmphasis:()=>Hu,getECData:()=>nu,getLayoutRect:()=>Oc,mixinAxisModelCommonMethods:()=>Xw});var l={};n.r(l),n.d(l,{MAX_SAFE_INTEGER:()=>na,asc:()=>Ko,getPercentWithPrecision:()=>ta,getPixelPrecision:()=>$o,getPrecision:()=>Jo,getPrecisionSafe:()=>Qo,isNumeric:()=>fa,isRadianAroundZero:()=>ra,linearMap:()=>Xo,nice:()=>ua,numericToNumber:()=>da,parseDate:()=>aa,quantile:()=>ha,quantity:()=>sa,quantityExponent:()=>la,reformIntervals:()=>ca,remRadian:()=>ia,round:()=>Yo});var u={};n.r(u),n.d(u,{format:()=>$h,parse:()=>aa});var h={};n.r(h),n.d(h,{Arc:()=>zg,BezierCurve:()=>Ng,BoundingRect:()=>_n,Circle:()=>Kp,CompoundPath:()=>Fg,Ellipse:()=>$p,Group:()=>Eo,Image:()=>Pl,IncrementalDisplayable:()=>tm,Line:()=>Dg,LinearGradient:()=>Ug,Polygon:()=>bg,Polyline:()=>Mg,RadialGradient:()=>jg,Rect:()=>Fl,Ring:()=>_g,Sector:()=>gg,Text:()=>eu,clipPointsByRect:()=>bm,clipRectByRect:()=>Sm,createIcon:()=>Tm,extendPath:()=>am,extendShape:()=>rm,getShapeClass:()=>lm,getTransform:()=>vm,initProps:()=>Qu,makeImage:()=>hm,makePath:()=>um,mergePath:()=>dm,registerShape:()=>sm,resizePath:()=>fm,updateProps:()=>Ju});var c={};n.r(c),n.d(c,{addCommas:()=>mc,capitalFirst:()=>Mc,encodeHTML:()=>ze,formatTime:()=>Tc,formatTpl:()=>bc,getTextRect:()=>hb,getTooltipMarker:()=>Sc,normalizeCssArray:()=>_c,toCamelCase:()=>vc,truncateText:()=>rs});var d={};n.r(d),n.d(d,{bind:()=>vt,clone:()=>et,curry:()=>_t,defaults:()=>ot,each:()=>ct,extend:()=>rt,filter:()=>pt,indexOf:()=>st,inherits:()=>lt,isArray:()=>yt,isFunction:()=>xt,isObject:()=>Tt,isString:()=>wt,map:()=>dt,merge:()=>nt,reduce:()=>ft});var f={};n.r(f),n.d(f,{Axis:()=>Tb,ChartView:()=>Fm,ComponentModel:()=>Gc,ComponentView:()=>Dp,List:()=>Cx,Model:()=>Ih,PRIORITY:()=>k_,SeriesModel:()=>Lp,color:()=>r,connect:()=>Ay,dataTool:()=>Qy,dependencies:()=>I_,disConnect:()=>Iy,disconnect:()=>Dy,dispose:()=>Py,env:()=>O,extendChartView:()=>Ab,extendComponentModel:()=>Mb,extendComponentView:()=>Cb,extendSeriesModel:()=>Lb,format:()=>c,getCoordinateSystemDimensions:()=>Hy,getInstanceByDom:()=>Ey,getInstanceById:()=>Oy,getMap:()=>Ky,graphic:()=>h,helper:()=>s,init:()=>Ly,innerDrawElementOnCanvas:()=>v_,matrix:()=>i,number:()=>l,parseGeoJSON:()=>ub,parseGeoJson:()=>ub,registerAction:()=>Vy,registerCoordinateSystem:()=>Gy,registerLayout:()=>Uy,registerLoading:()=>Xy,registerLocale:()=>Fh,registerMap:()=>Yy,registerPostInit:()=>zy,registerPostUpdate:()=>By,registerPreprocessor:()=>Ry,registerProcessor:()=>ky,registerTheme:()=>Ny,registerTransform:()=>Jy,registerUpdateLifecycle:()=>Fy,registerVisual:()=>Wy,setCanvasCreator:()=>qy,setPlatformAPI:()=>V,throttle:()=>Um,time:()=>u,use:()=>Jw,util:()=>d,vector:()=>e,version:()=>D_,zrUtil:()=>t,zrender:()=>o});var p=n(214),g=n.n(p);const m={metadata:!0,svgRender:!1,switchMode:!1,maxPointsFetched:1e4,loadMoreAtZoomLevel:9,clustering:!1,clusteringThreshold:100,disableClusteringAtLevel:8,clusterRadius:80,clusterSeparation:20,showMetaOnNarrowScreens:!1,showLabelsAtZoomLevel:13,showGraphLabelsAtZoom:null,crs:g().CRS.EPSG3857,echartsOption:{aria:{show:!0,description:"This is a force-oriented graph chart that depicts the relationship between ip nodes."},toolbox:{show:!0,iconStyle:{borderColor:"#fff"},feature:{restore:{show:!0,title:"Restore view"},saveAsImage:{show:!0,title:"Save image"}}}},graphConfig:{series:{layout:"force",label:{show:!0,color:"#fff",position:"top"},labelLayout:{hideOverlap:!0},force:{gravity:.1,edgeLength:[20,60],repulsion:120},roam:!0,draggable:!0,legendHoverLink:!0,emphasis:{focus:"none",lineStyle:{color:"#3acc38",opacity:1}},nodeStyle:{color:"#ffebc4"},linkStyle:{width:6,color:"#1ba619"},nodeSize:"15"},baseOptions:{backgroundColor:"#282222",media:[{query:{minWidth:320,maxWidth:500},option:{series:[{zoom:.7}],toolbox:{itemSize:18}}},{query:{minWidth:501},option:{series:[{zoom:1}],toolbox:{itemSize:15}}},{query:{minWidth:320,maxWidth:850},option:{tooltip:{show:!1}}},{query:{minWidth:851},option:{tooltip:{show:!0}}}]}},mapOptions:{roam:!0,zoomAnimation:!1,minZoom:3,maxZoom:18,nodeConfig:{type:"scatter",label:{show:!1,color:"#000000",position:"top",formatter:"{b}",fontSize:13,backgroundColor:"rgba(255, 255, 255, 0.8)",padding:[6,8],borderRadius:5},emphasis:{scale:1},nodeStyle:{color:"#1566a9"},nodeSize:"17"},linkConfig:{linkStyle:{width:5,color:"#1ba619"},emphasis:{focus:"none",lineStyle:{color:"#3acc38",opacity:1}}},clusterConfig:{symbolSize:30,itemStyle:{color:"#1566a9"},tooltip:{show:!1},label:{show:!0,position:"inside",color:"#fff",offset:[0,0],backgroundColor:"transparent"}},baseOptions:{toolbox:{show:!1},media:[{query:{minWidth:320,maxWidth:850},option:{tooltip:{show:!1}}},{query:{minWidth:851},option:{tooltip:{show:!0}}}]}},mapTileConfig:[{urlTemplate:"MISSING_ENV_VAR".MAPBOX_URL_TEMPLATE||"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",options:{attribution:'© OpenStreetMap contributors,\n tiles offered by Mapbox'}}],geoOptions:{style:{fillColor:"#1566a9",weight:0,fillOpacity:.8,radius:8}},nodeCategories:[{name:"ok",nodeStyle:{color:"#28a745"}},{name:"problem",nodeStyle:{color:"#ffc107"}},{name:"critical",nodeStyle:{color:"#dc3545"}}],linkCategories:[],bookmarkableActions:{enabled:!1,id:null},prepareData(t){t&&t.nodes&&t.nodes.forEach((t=>{if(t.properties&&t.properties.status){const e=t.properties.status.toLowerCase();"ok"!==e&&"problem"!==e&&"critical"!==e||(t.category=e)}}))},onClickElement(t,e){let n;this.utils&&this.utils.isNetJSON(this.data)?(n="node"===t?this.utils.nodeInfo(e):"link"===t?this.utils.linkInfo(e):e,(this.config.showMetaOnNarrowScreens||this.el.clientWidth>850)&&(this.gui.metaInfoContainer.style.display="flex")):({nodeLinkData:n}={nodeLinkData:e}),this.gui.getNodeLinkInfo(t,n),this.gui.sideBar.classList.remove("hidden")},onReady(){}},{prepareData:v}=m,_={...m},y=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class x{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,n]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const i=n>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const r=y[15&n];if(!r)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new x(a,o,r,t)}constructor(t,e=64,n=Float64Array,i){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const r=y.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+r]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=e,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return w(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:o,nodeSize:a}=this,s=[0,r.length-1,0],l=[];for(;s.length;){const u=s.pop()||0,h=s.pop()||0,c=s.pop()||0;if(h-c<=a){for(let a=c;a<=h;a++){const s=o[2*a],u=o[2*a+1];s>=t&&s<=n&&u>=e&&u<=i&&l.push(r[a])}continue}const d=c+h>>1,f=o[2*d],p=o[2*d+1];f>=t&&f<=n&&p>=e&&p<=i&&l.push(r[d]),(0===u?t<=f:e<=p)&&(s.push(c),s.push(d-1),s.push(1-u)),(0===u?n>=f:i>=p)&&(s.push(d+1),s.push(h),s.push(1-u))}return l}within(t,e,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:r,nodeSize:o}=this,a=[0,i.length-1,0],s=[],l=n*n;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,c=a.pop()||0;if(h-c<=o){for(let n=c;n<=h;n++)M(r[2*n],r[2*n+1],t,e)<=l&&s.push(i[n]);continue}const d=c+h>>1,f=r[2*d],p=r[2*d+1];M(f,p,t,e)<=l&&s.push(i[d]),(0===u?t-n<=f:e-n<=p)&&(a.push(c),a.push(d-1),a.push(1-u)),(0===u?t+n>=f:e+n>=p)&&(a.push(d+1),a.push(h),a.push(1-u))}return s}}function w(t,e,n,i,r,o){if(r-i<=n)return;const a=i+r>>1;b(t,e,a,i,r,o),w(t,e,n,i,a-1,1-o),w(t,e,n,a+1,r,1-o)}function b(t,e,n,i,r,o){for(;r>i;){if(r-i>600){const a=r-i+1,s=n-i+1,l=Math.log(a),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);b(t,e,n,Math.max(i,Math.floor(n-s*u/a+h)),Math.min(r,Math.floor(n+(a-s)*u/a+h)),o)}const a=e[2*n+o];let s=i,l=r;for(S(t,e,i,n),e[2*r+o]>a&&S(t,e,i,r);sa;)l--}e[2*i+o]===a?S(t,e,i,l):(l++,S(t,e,l,r)),l<=n&&(i=l+1),n<=l&&(r=l-1)}}function S(t,e,n,i){T(t,n,i),T(e,2*n,2*i),T(e,2*n+1,2*i+1)}function T(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function M(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}const C=class{JSONParamParse(t){return"string"==typeof t?fetch(t,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"include"}).then((t=>t)).catch((t=>{console.error(t)})):Promise.resolve(t)}async paginatedDataParse(t){let e,n;try{let i=await this.utils.JSONParamParse(t);if(i.json)for(e=await i.json(),n=e.results?e.results:e;e.next&&n.nodes.length<=this.config.maxPointsFetched;)i=await this.utils.JSONParamParse(e.next),e=await i.json(),n.nodes=n.nodes.concat(e.results.nodes),n.links=n.links.concat(e.results.links),e.next?this.hasMoreData=!0:this.hasMoreData=!1;else n=i}catch(t){console.error(t)}return n}async getBBoxData(t,e){let n;try{const i=`${t=t[0].split("?")[0]}bbox?swLat=${e._southWest.lat}&swLng=${e._southWest.lng}&neLat=${e._northEast.lat}&neLng=${e._northEast.lng}`,r=await this.utils.JSONParamParse(i);n=await r.json()}catch(t){console.error(t)}return n}dateParse({dateString:t,parseRegular:e=/^([1-9]\d{3})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2})(?:\.(\d{1,3}))?Z$/,hourDiffer:n=(new Date).getTimezoneOffset()/60}){const i=e.exec(t);if(!i||i.length<7)return console.error("Date doesn't meet the specifications."),"";const r=["dateYear","dateMonth","dateDay","dateHour"],o={},a=i[1]%4==0&&i[1]%100!=0||i[1]%400==0,s=new Map([["dateMonth",12],["dateDay",[31,a?29:28,31,30,31,30,31,31,30,31,30,31]],["dateHour",24]]);for(let t=r.length;t>0;t-=1)o[r[t-1]]=parseInt(i[t],10);let l,u=-n;for(let t=r.length;t>0;t-=1){if("dateYear"===r[t-1]){o[r[t-1]]+=u;break}l="dateDay"===r[t-1]?s.get("dateDay")[o.dateMonth-1]:s.get(r[t-1]);let e=o[r[t-1]]+u;u="dateHour"===r[t-1]?e<0?-1:e>=l?1:0:e<=0?-1:e>l?1:0,1===u?e-=l:u<0&&("dateDay"===r[t-1]&&(l=s.get("dateDay")[(o[r[t-1]]+10)%11]),e+=l),o[r[t-1]]=e}return`${o.dateYear}.${this.numberMinDigit(o.dateMonth)}.${this.numberMinDigit(o.dateDay)} ${this.numberMinDigit(o.dateHour)}:${this.numberMinDigit(i[5])}:${this.numberMinDigit(i[6])}${i[7]?`.${this.numberMinDigit(i[7],3)}`:""}`}numberMinDigit(t,e=2,n="0"){return(Array(e).join(n)+t).slice(-e)}isObject(t){return"Object"===Object.prototype.toString.call(t).slice(8,14)}isArray(t){return"Array"===Object.prototype.toString.call(t).slice(8,13)}isElement(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName}isNetJSON(t){return!(!t.nodes||!t.links)&&(this.isObject(t)&&this.isArray(t.nodes)&&this.isArray(t.links))}isGeoJSON(t){return t.type&&"FeatureCollection"===t.type?this.isObject(t)&&this.isArray(t.features):!(!t.type||"Feature"!==t.type)&&(this.isObject(t)&&this.isArray(t.geometry))}geojsonToNetjson(t){return function(t){const e=[],n=[];if(!t||!Array.isArray(t.features))return{nodes:e,links:n};const i=new Map,r=(t,n={})=>{const r=`${t[0]},${t[1]}`;if(i.has(r))return i.get(r);const o=n.id||n.node_id||null,a=n.label||n.name||o||null,s=o?String(o):`gjn_${e.length}`,l=!o,u={id:s,...a?{label:String(a)}:{},location:{lng:t[0],lat:t[1]},properties:{...n,location:{lng:t[0],lat:t[1]}},_generatedIdentity:l};return e.push(u),i.set(r,s),s},o=(t,e,i={})=>{n.push({source:t,target:e,properties:i})},a=(t,e,n=!1)=>{for(let n=0;n2){const n=r(t[0],e),i=r(t[t.length-1],e);o(i,n,e)}},s=(t,e)=>{if(!t)return;const{type:n,coordinates:i,geometries:o}=t;switch(n){case"Point":r(i,{...e,_featureType:"Point"});break;case"MultiPoint":i.forEach((t=>r(t,{...e,_featureType:"Point"})));break;case"LineString":a(i,{...e,_featureType:"LineString"},!1);break;case"MultiLineString":i.forEach((t=>a(t,{...e,_featureType:"LineString"},!1)));break;case"Polygon":case"MultiPolygon":break;case"GeometryCollection":o.forEach((t=>s(t,e)));break;default:console.warn(`Unsupported GeoJSON geometry type: ${n}`)}};return t.features.forEach((t=>{const e={...t.properties||{},...void 0!==t.id&&null!==t.id?{id:t.id}:{}};s(t.geometry,e)})),{nodes:e,links:n}}(t)}deepCopy(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>this.deepCopy(t)));const e={};return Object.keys(t).forEach((n=>{e[n]=this.deepCopy(t[n])})),e}deepMergeObj(...t){const e=[...t].reverse(),n=e.length;for(let t=0;t{i[t]&&this.isObject(i[t])&&this.isObject(n[t])?this.deepMergeObj(i[t],n[t]):i[t]=n[t]})):i||(e[t+1]=n)}return e[n-1]}makeCluster(t){const{nodes:e,links:n}=t.data,i=t=>!(t.properties&&t.properties._featureType)||"Point"===t.properties._featureType,r=e.filter(i),o=e.filter((t=>!i(t))),a=[],s=[],l=new Map;o.forEach((t=>l.set(t.id,null)));let u=0;r.forEach((e=>{const n=e.properties&&e.properties.location||e.location;if(!n||void 0===n.lat||void 0===n.lng)return;e.location=n,e._origLocation?(n.lat=e._origLocation.lat,n.lng=e._origLocation.lng):e._origLocation={lat:n.lat,lng:n.lng};const i=t.leaflet.latLngToContainerPoint([n.lat,n.lng]);e.x=i.x,e.y=i.y,e.visited=!1,e.cluster=null}));const h=new x(r.length);r.forEach((({x:t,y:e})=>h.add(t,e))),h.finish();const c=t.config&&t.config.mapOptions&&t.config.mapOptions.clusterConfig&&t.config.mapOptions.clusterConfig.symbolSize,d=t=>{if("function"==typeof c)try{return c(t)}catch(t){return 30}return Array.isArray(c)?c[0]||30:"number"==typeof c?c:30},f=new Map;r.forEach((e=>{if(e.visited)return;const n=h.within(e.x,e.y,t.config.clusterRadius).map((t=>r[t]));if(n.length>1){const i=`${Math.round(e.x)},${Math.round(e.y)}`;f.has(i)||f.set(i,new Map);const r=f.get(i);n.forEach((e=>{if(e.visited)return;const n=t.config.clusteringAttribute?e.properties[t.config.clusteringAttribute]:"default";r.has(n)||r.set(n,[]),r.get(n).push(e),e.visited=!0}))}else e.visited=!0,l.set(e.id,null),o.push(e)})),f.forEach((e=>{const n=Array.from(e.entries()),i=n.length;let r=0;n.forEach((([,t])=>{const e=d(t.length);e>r&&(r=e)}));const a="number"==typeof t.config.clusterSeparation?t.config.clusterSeparation:Math.max(10,Math.floor(t.config.clusterRadius/2));let h=0;if(i>1){const t=Math.PI/i,e=Math.sin(t);e>0&&(h=r/(2*e))}const c=Math.max(a,h+4);n.forEach((([,e],n)=>{if(e.length>1){let r=0,o=0;if(e.forEach((t=>{t.cluster=u,l.set(t.id,t.cluster),r+=t.location.lng,o+=t.location.lat})),r/=e.length,o/=e.length,i>1){const e=2*Math.PI*n/i,a=t.leaflet.latLngToContainerPoint([o,r]),s=[a.x+c*Math.cos(e),a.y+c*Math.sin(e)],l=t.leaflet.containerPointToLatLng(s);r=l.lng,o=l.lat}const a={id:u,cluster:!0,name:e.length,value:[r,o],childNodes:e,...t.config.mapOptions.clusterConfig};if(t.config.clusteringAttribute){const n=t.config.nodeCategories.find((n=>n.name===e[0].properties[t.config.clusteringAttribute]));n&&(a.itemStyle={...a.itemStyle,color:n.nodeStyle.color})}s.push(a),u+=1}else if(1===e.length){const t=e[0];l.set(t.id,null),o.push(t)}}))})),n.forEach((t=>{null===l.get(t.source)&&null===l.get(t.target)&&a.push(t)}));const p=[...s.map((t=>({ref:t,isCluster:!0,count:t.childNodes.length,get value(){return t.value},set value([e,n]){t.value=[e,n]}}))),...o.filter(i).map((t=>({ref:t,isCluster:!1,count:1,get value(){return[t.location.lng,t.location.lat]},set value([e,n]){t.location.lng=e,t.location.lat=n}})))];if(p.length>1){const e=p.map((e=>{const[n,i]=e.value,r=t.leaflet.latLngToContainerPoint([i,n]);return{ref:e.ref,isCluster:e.isCluster,x:r.x,y:r.y,r:d(e.count)/2,setValue:([t,n])=>{e.value=[t,n]}}})),n=4,i=5;for(let t=0;t0&&s{const n=t.leaflet.containerPointToLatLng([e.x,e.y]);e.isCluster?e.ref.value=[n.lng,n.lat]:(e.ref.location.lng=n.lng,e.ref.location.lat=n.lat)}))}return{clusters:s,nonClusterNodes:o,nonClusterLinks:a}}updateMetadata(){if(this.config.metadata){const t=this.utils.getMetadata(this.data),e=document.querySelector(".njg-metaData"),n=document.querySelectorAll(".njg-metaDataItems");for(let t=0;t{const i=document.createElement("div");i.classList.add("njg-metaDataItems");const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");o.setAttribute("class","njg-valueLabel"),r.innerHTML=n,o.innerHTML=t[n],i.appendChild(r),i.appendChild(o),e.appendChild(i)}))}}getMetadata(t){const e=t,n={};return e.label&&(n.label=e.label),["protocol","version","revision","metric","router_id","topology_id"].forEach((t=>{e[t]&&(n[t]=e[t])})),n.nodes=e.nodes.length,n.links=e.links.length,n}nodeInfo(t){const e={};!t._generatedIdentity&&(e.id=t.id,t.label&&"string"==typeof t.label&&(e.label=t.label)),t.name&&(e.name=t.name),t.location&&(e.location=t.location);let n=null;Array.isArray(t.clients)?n=t.clients:t.properties&&Array.isArray(t.properties.clients)&&(n=t.properties.clients);let i=0;n?i=n.length:"number"==typeof t.clients?i=t.clients:t.properties&&"number"==typeof t.properties.clients&&(i=t.properties.clients),i>0&&(e.clients=i),n&&n.length&&n.forEach(((t,n)=>{e[`clients [${n+1}]`]=t}));const r=(t,e)=>"location"===t&&e&&"object"==typeof e?{lat:e.lat,lng:e.lng}:"time"===t&&"string"==typeof e?this.dateParse({dateString:e}):e,o=t._source&&this.isObject(t._source)?t._source:t;if(Object.keys(o).forEach((t=>{if("properties"===t||"clients"===t||"_source"===t||"_generatedIdentity"===t||"local_addresses"===t||"linkCount"===t)return;const n=r(t,o[t]);null!=n&&""!==n&&(e[t]=n)})),o.properties&&this.isObject(o.properties)&&Object.keys(o.properties).forEach((t=>{if("clients"===t)return;const n=r(t,o.properties[t]);null==n||"string"==typeof n&&""===n.trim()||(e[t]=n)})),t.linkCount&&(e.links=t.linkCount),Array.isArray(o.local_addresses)){const t=o.local_addresses.map((t=>"string"==typeof t?t:t&&"string"==typeof t.address?t.address:null)).filter((t=>t));t.length&&(e.localAddresses=t)}return t.local_addresses&&(e.localAddresses=t.local_addresses),e}createTooltipItem(t,e){const n=document.createElement("div");n.classList.add("njg-tooltip-item");const i=document.createElement("span");i.setAttribute("class","njg-tooltip-key");const r=document.createElement("span");return r.setAttribute("class","njg-tooltip-value"),i.innerHTML=t,r.innerHTML=e,n.appendChild(i),n.appendChild(r),n}getNodeTooltipInfo(t){const e=document.createElement("div");e.classList.add("njg-tooltip-inner");const n=!t._generatedIdentity;return n&&t.id&&e.appendChild(this.createTooltipItem("id",t.id)),n&&t.label&&"string"==typeof t.label&&e.appendChild(this.createTooltipItem("label",t.label)),t.properties&&Object.keys(t.properties).forEach((i=>{if("object"!=typeof t.properties[i]&&!i.startsWith("_")&&("id"!==i&&"label"!==i||!n))if("location"===i)e.appendChild(this.createTooltipItem("location",`${Math.round(1e3*t.properties.location.lat)/1e3}, ${Math.round(1e3*t.properties.location.lng)/1e3}`));else if("time"===i){const n=this.dateParse({dateString:t.properties[i]});e.appendChild(this.createTooltipItem("time",n))}else e.appendChild(this.createTooltipItem(`${i.replace(/_/g," ")}`,t.properties[i]))})),t.linkCount&&e.appendChild(this.createTooltipItem("Links",t.linkCount)),t.local_addresses&&e.appendChild(this.createTooltipItem("Local Addresses",t.local_addresses.join("
"))),e}getLinkTooltipInfo(t){const e=document.createElement("div");e.classList.add("njg-tooltip-inner");const n=t=>"string"==typeof t&&t.startsWith("gjn_");return n(t.source)||e.appendChild(this.createTooltipItem("source",t.source)),n(t.target)||e.appendChild(this.createTooltipItem("target",t.target)),void 0!==t.cost&&null!==t.cost&&e.appendChild(this.createTooltipItem("cost",t.cost)),t.properties&&Object.keys(t.properties).forEach((n=>{const i=t.properties[n];if(null!=i)if("time"===n){const t=this.dateParse({dateString:i});e.appendChild(this.createTooltipItem("time",t))}else{const t="string"==typeof i?i.replace(/\n/g,"
"):i;e.appendChild(this.createTooltipItem(`${n.replace(/_/g," ")}`,t))}})),e}linkInfo(t){const e={},n=t=>"string"==typeof t&&t.startsWith("gjn_");return n(t.source)||(e.source=t.source),n(t.target)||(e.target=t.target),void 0!==t.cost&&null!==t.cost&&(e.cost=t.cost),t.properties&&Object.keys(t.properties).forEach((n=>{const i=t.properties[n];if(null!=i)if("time"===n){const t=this.dateParse({dateString:i});e[n]=t}else{const t="string"==typeof i?i.replace(/\n/g,"
"):i;e[n.replace(/_/g," ")]=t}})),e}generateStyle(t,e){return"function"==typeof t?t(e):t}getNodeStyle(t,e,n){let i,r={},o={},a=!1;if(t.category&&e.nodeCategories&&e.nodeCategories.length){const n=e.nodeCategories.find((e=>e.name===t.category));if(n){a=!0,i=this.generateStyle(n.nodeStyle||{},t),r=this.generateStyle(n.nodeSize||{},t);let e={},s={};n.emphasis&&(e=this.generateStyle(n.emphasis.nodeStyle||{},t),s=this.generateStyle(n.emphasis.nodeSize||{},t),o={nodeStyle:e,nodeSize:s})}}if(!a)if("map"===n){const n=e.mapOptions&&e.mapOptions.nodeConfig;i=this.generateStyle(n&&n.nodeStyle||{},t),r=this.generateStyle(n&&n.nodeSize||{},t);const a=n&&n.emphasis;a&&(o={nodeStyle:this.generateStyle(a&&a.nodeStyle||{},t),nodeSize:this.generateStyle(a&&a.nodeSize||{},t)})}else{const n=e.graphConfig&&e.graphConfig.series;i=this.generateStyle(n&&n.nodeStyle||{},t),r=this.generateStyle(n&&n.nodeSize||{},t);const a=n&&n.emphasis;a&&(o={nodeStyle:this.generateStyle(a&&a.itemStyle||{},t),nodeSize:this.generateStyle(a&&a.symbolSize||r||{},t)})}return{nodeStyleConfig:i,nodeSizeConfig:r,nodeEmphasisConfig:o}}getLinkStyle(t,e,n){let i,r={};if(t.category&&e.linkCategories.length){const n=e.linkCategories.find((e=>e.name===t.category));i=this.generateStyle(n.linkStyle||{},t),r={...r,linkStyle:n.emphasis?this.generateStyle(n.emphasis.linkStyle||{},t):{}}}else i="map"===n?this.generateStyle(e.mapOptions.linkConfig.linkStyle,t):this.generateStyle(e.graphConfig.series.linkStyle,t);return{linkStyleConfig:i,linkEmphasisConfig:r}}showLoading(){let t=this.el.querySelector(".njg-loadingContainer");return t?t.style.visibility="visible":(t=document.createElement("div"),t.classList.add("njg-loadingContainer"),t.innerHTML='\n
\n
\n

Loading...

\n
\n ',this.el.appendChild(t)),t}hideLoading(){const t=this.el.querySelector(".njg-loadingContainer");return t&&(t.style.visibility="hidden"),t}createEvent(){const t=new Map,e=new Map;return{on(e,...n){t.set(e,[...t.get(e)||[],...n])},once(t,...n){e.set(t,[...e.get(t)||[],...n])},emit(n){const i=t.get(n)||[],r=e.get(n)||[],o=i.map((t=>t())),a=r.map((t=>t()));return e.delete(n),[...o,...a]},delete(n){t.delete(n),e.delete(n)}}}parseUrlFragments(){const t=window.location.hash.replace(/^#/,""),e={};return t.split(";").forEach((t=>{const n=new URLSearchParams(t),i=n.get("id");null!=i&&(e[i]=n)})),e}updateUrlFragments(t,e){const n=Object.values(t).map((t=>t.toString())).join(";");window.history.pushState(e,"",`#${n}`)}addActionToUrl(t,e){if(console.log(e),!t.config.bookmarkableActions.enabled||e.data.cluster)return;const n=this.parseUrlFragments(),{id:i}=t.config.bookmarkableActions;let r;if(t.indexedNode=t.indexedNode||{},t.config.render===t.utils.graphRender&&(r=e.data.id,t.indexedNode[r]=e.data),t.config.render===t.utils.mapRender&&(r=e.data.node.id,t.indexedNode[r]=e.data.node),n[i]||(n[i]=new URLSearchParams,n[i].set("id",i)),r){n[i].set("nodeId",r);const e=t.indexedNode[r];this.updateUrlFragments(n,e)}}removeUrlFragment(t){const e=this.parseUrlFragments();e[t]&&delete e[t];const n={id:t};this.updateUrlFragments(e,n)}setIndexedNodeFromUrlFragments(t,e,n){if(!t.config.bookmarkableActions.enabled||!Object.keys(e).length)return;const{id:i}=t.config.bookmarkableActions,r=e[i]&&e[i].get?e[i]:null,o=r&&r.get?r.get("nodeId"):void 0;o===n.id&&(t.indexedNode=t.indexedNode||{},t.indexedNode[o]=n)}applyUrlFragmentState(t){if(!t.config.bookmarkableActions.enabled)return;const{id:e}=t.config.bookmarkableActions,n=t.utils.parseUrlFragments(),i=n[e]&&n[e].get?n[e]:null,r=i&&i.get?i.get("nodeId"):void 0;if(!t.indexedNode||!t.indexedNode[r])return;const o=t.indexedNode[r],a=t.config.graphConfig.series.type||t.config.mapOptions.nodeConfig.type,{location:s,cluster:l}=o;if(["scatter","effectScatter"].includes(a)){const e=null!=l?t.config.disableClusteringAtLevel:t.leaflet?.getZoom();t.leaflet?.setView([s.lat,s.lng],e)}t.config.onClickElement.call(t,"node",o)}setupHashChangeHandler(t){window.addEventListener("popstate",(()=>{const e=history.state;null==e||t.indexedNode[e.id]||(t.indexedNode[e.id]=e),this.applyUrlFragmentState(t)}))}};const L=class extends C{searchElements(t){const e=this,n={"":{data:{...e.data},param:[...e.JSONParam]}};return window.history.pushState({searchValue:""},""),window.onpopstate=i=>{n[i.state.searchValue]?e.utils.JSONDataUpdate.call(e,n[i.state.searchValue].data).then((()=>{e.JSONParam=n[i.state.searchValue].param})):e.utils.JSONDataUpdate.call(e,t+i.state.searchValue)},function(i,r=!0,o=!0){const a=i.trim();if(!window.history.state||window.history.state&&window.history.state.searchValue!==a)return window.history.pushState({searchValue:a},""),e.utils.JSONDataUpdate.call(e,t+a,r,o).then((()=>{n[a]={data:{...e.data},param:[...e.JSONParam]}}))}}JSONDataUpdate(t,e=!0,n=!0){const i=this;return i.config.onUpdate.call(i),i.utils.paginatedDataParse.call(i,t).then((r=>{function o(){e?(i.JSONParam=[t],i.utils.overrideData(r,i)):(i.JSONParam.push(t),i.config.render===i.utils.mapRender?i.utils.appendData(r,i):i.utils.addData(r,i)),i.utils.isNetJSON(i.data)&&i.utils.updateMetadata.call(i)}return n?(i.utils.isNetJSON(i.data)&&i.config.prepareData.call(i,r),i.config.dealDataByWorker?i.utils.dealDataByWorker.call(i,r,i.config.dealDataByWorker,o):o()):o(),r})).catch((t=>{console.error(t)}))}dealDataByWorker(t,e,n){const i=new Worker(e),r=this;i.postMessage(t),i.addEventListener("error",(t=>{console.error(t),console.error("Error in dealing JSONData!")})),i.addEventListener("message",(t=>{n?n():(r.utils.overrideData(t.data,r),r.utils.isNetJSON(r.data)&&r.utils.updateMetadata.call(r))}))}overrideData(t,e){e.data=t,e.utils.isNetJSON(e.data)||e.leaflet.geoJSON.removeFrom(e.leaflet),e.utils.render(),e.config.afterUpdate.call(e)}};const A=class{constructor(t){this.utils=new L,this.config=this.utils.deepCopy(_),this.config.crs=_.crs,this.JSONParam=this.utils.isArray(t)?t:[t]}setConfig(t){if(this.utils.deepMergeObj(this.config,t),this.el)t&&t.el&&console.error("Can't change el again!");else if(this.config.el?this.utils.isElement(this.config.el)?this.el=this.config.el:this.el=document.querySelector(this.config.el):this.el=document.body,this.el){if(this.el.classList.add("njg-container"),this.el===document.body){const t=document.documentElement;t.style.width="100%",t.style.height="100%",this.el.classList.add("njg-relativePosition")}}else console.error("NetJSONGraph: The specified element for rendering was not found and could not be set.");return this.config}render(){const[t,...e]=this.JSONParam;this.config.onRender.call(this);const n=new Promise((t=>{this.event.once("onReady",(async()=>{await this.config.onReady.call(this),t()}))}));if(this.event.once("onLoad",this.config.onLoad.bind(this)),this.event.once("applyUrlFragmentState",(async()=>{await n,this.utils.applyUrlFragmentState.call(this,this)})),this.utils.paginatedDataParse.call(this,t).then((t=>{if(this.utils.isNetJSON(t))this.type="netjson";else{if(!this.utils.isGeoJSON(t))throw new Error("Invalid data format!");this.type="geojson",this.originalGeoJSON=JSON.parse(JSON.stringify(t)),t=this.utils.geojsonToNetjson(t)}if(this.utils.isNetJSON(t)){t.nodes.length>this.config.maxPointsFetched&&(this.hasMoreData=!0),t.nodes.splice(this.config.maxPointsFetched-1,t.nodes.length-this.config.maxPointsFetched);const e=new Set(t.nodes.map((t=>t.id)));t.links=t.links.filter((t=>!(!e.has(t.source)||!e.has(t.target))||(e.has(t.source)?console.warn(`Node ${t.target} does not exist!`):console.warn(`Node ${t.source} does not exist!`),!1)))}this.config.prepareData.call(this,t),this.data=t,this.config.dealDataByWorker?this.utils.dealDataByWorker.call(this,t,this.config.dealDataByWorker):(this.data=t,this.utils.render())})).catch((t=>{console.error(t)})),e.length){const n=function(){e.map((t=>this.utils.JSONDataUpdate.call(this,t,!1)))};this.JSONParam=[t],this.event.once("renderArray",n.bind(this))}}setUtils(t={}){const e=this;return e.utils=Object.assign(e.utils,{...t},{render(){if(!e.config.render)throw new Error("No render function!");e.config.render(e.data,e)}}),e.utils}}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -26,7 +18,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -var L=function(t,e){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},L(t,e)};function D(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}L(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}Object.create;Object.create;var I=n(123),P=n(26),E=function(t,e){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},E(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 n(){this.constructor=t}E(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}Object.create;Object.create;function N(t,e){return null==t&&(t=0),null==e&&(e=0),[t,e]}function R(t,e){return t[0]=e[0],t[1]=e[1],t}function k(t){return[t[0],t[1]]}function z(t,e,n){return t[0]=e,t[1]=n,t}function B(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function F(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t}function H(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function V(t){return Math.sqrt(U(t))}var G=V;function U(t){return t[0]*t[0]+t[1]*t[1]}var W=U;function j(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function Z(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function X(t,e){return t[0]*e[0]+t[1]*e[1]}function q(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function Y(t,e){var n=V(e);return 0===n?(t[0]=0,t[1]=0):(t[0]=e[0]/n,t[1]=e[1]/n),t}function K(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var J=K;function $(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}var Q=$;function tt(t,e){return t[0]=-e[0],t[1]=-e[1],t}function et(t,e,n,i){return t[0]=e[0]+i*(n[0]-e[0]),t[1]=e[1]+i*(n[1]-e[1]),t}function nt(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r+n[4],t[1]=n[1]*i+n[3]*r+n[5],t}function it(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}function rt(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}var ot=function(t,e){this.target=t,this.topTarget=e&&e.topTarget},at=function(){function t(t){this.handler=t,t.on("mousedown",this._dragStart,this),t.on("mousemove",this._drag,this),t.on("mouseup",this._dragEnd,this)}return t.prototype._dragStart=function(t){for(var e=t.target;e&&!e.draggable;)e=e.parent||e.__hostTarget;e&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.handler.dispatchToElement(new ot(e,t),"dragstart",t.event))},t.prototype._drag=function(t){var e=this._draggingTarget;if(e){var n=t.offsetX,i=t.offsetY,r=n-this._x,o=i-this._y;this._x=n,this._y=i,e.drift(r,o,t),this.handler.dispatchToElement(new ot(e,t),"drag",t.event);var a=this.handler.findHover(n,i,e).target,s=this._dropTarget;this._dropTarget=a,e!==a&&(s&&a!==s&&this.handler.dispatchToElement(new ot(s,t),"dragleave",t.event),a&&a!==s&&this.handler.dispatchToElement(new ot(a,t),"dragenter",t.event))}},t.prototype._dragEnd=function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.handler.dispatchToElement(new ot(e,t),"dragend",t.event),this._dropTarget&&this.handler.dispatchToElement(new ot(this._dropTarget,t),"drop",t.event),this._draggingTarget=null,this._dropTarget=null},t}();const st=at;var lt=function(){function t(t){t&&(this._$eventProcessor=t)}return t.prototype.on=function(t,e,n,i){this._$handlers||(this._$handlers={});var r=this._$handlers;if("function"==typeof e&&(i=n,n=e,e=null),!n||!t)return this;var o=this._$eventProcessor;null!=e&&o&&o.normalizeQuery&&(e=o.normalizeQuery(e)),r[t]||(r[t]=[]);for(var a=0;a>1)%2;a.style.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[s]+":0",r[l]+":0",i[1-s]+":auto",r[1-l]+":auto",""].join("!important;"),t.appendChild(a),n.push(a)}return n}(e,o),s=function(t,e,n){for(var i=n?"invTrans":"trans",r=e[i],o=e.srcCoords,a=[],s=[],l=!0,u=0;u<4;u++){var h=t[u].getBoundingClientRect(),c=2*u,d=h.left,f=h.top;a.push(d,f),l=l&&o&&d===o[c]&&f===o[c+1],s.push(t[u].offsetLeft,t[u].offsetTop)}return l&&r?r:(e.srcCoords=a,e[i]=n?dt(s,a):dt(a,s))}(a,o,r);if(s)return s(t,n,i),!0}return!1}function mt(t){return"CANVAS"===t.nodeName.toUpperCase()}var vt=/([&<>"'])/g,_t={"&":"&","<":"<",">":">",'"':""","'":"'"};function yt(t){return null==t?"":(t+"").replace(vt,(function(t,e){return _t[e]}))}var xt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,bt=[],wt=I.default.browser.firefox&&+I.default.browser.version.split(".")[0]<39;function St(t,e,n,i){return n=n||{},i?Tt(t,e,n):wt&&null!=e.layerX&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):null!=e.offsetX?(n.zrX=e.offsetX,n.zrY=e.offsetY):Tt(t,e,n),n}function Tt(t,e,n){if(I.default.domSupported&&t.getBoundingClientRect){var i=e.clientX,r=e.clientY;if(mt(t)){var o=t.getBoundingClientRect();return n.zrX=i-o.left,void(n.zrY=r-o.top)}if(gt(bt,t,i,r))return n.zrX=bt[0],void(n.zrY=bt[1])}n.zrX=n.zrY=0}function Mt(t){return t||window.event}function Ct(t,e,n){if(null!=(e=Mt(e)).zrX)return e;var i=e.type;if(i&&i.indexOf("touch")>=0){var r="touchend"!==i?e.targetTouches[0]:e.changedTouches[0];r&&St(t,r,e,n)}else{St(t,e,e,n);var o=function(t){var e=t.wheelDelta;if(e)return e;var n=t.deltaX,i=t.deltaY;if(null==n||null==i)return e;var r=0!==i?Math.abs(i):Math.abs(n),o=i>0?-1:i<0?1:n>0?-1:1;return 3*r*o}(e);e.zrDelta=o?o/120:-(e.detail||0)/3}var a=e.button;return null==e.which&&void 0!==a&&xt.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}function At(t,e,n,i){t.addEventListener(e,n,i)}var Lt=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0};function Dt(t){return 2===t.which||3===t.which}var It=function(){function t(){this._track=[]}return t.prototype.recognize=function(t,e,n){return this._doTrack(t,e,n),this._recognize(t)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(t,e,n){var i=t.touches;if(i){for(var r={points:[],touches:[],target:e,event:t},o=0,a=i.length;o1&&r&&r.length>1){var a=Pt(r)/Pt(o);!isFinite(a)&&(a=1),e.pinchScale=a;var s=[((i=r)[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2];return e.pinchX=s[0],e.pinchY=s[1],{type:"pinch",target:t[0].target,event:e}}}}};function Ot(){return[1,0,0,1,0,0]}function Nt(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function Rt(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 kt(t,e,n){var i=e[0]*n[0]+e[2]*n[1],r=e[1]*n[0]+e[3]*n[1],o=e[0]*n[2]+e[2]*n[3],a=e[1]*n[2]+e[3]*n[3],s=e[0]*n[4]+e[2]*n[5]+e[4],l=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t}function zt(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t}function Bt(t,e,n,i){void 0===i&&(i=[0,0]);var r=e[0],o=e[2],a=e[4],s=e[1],l=e[3],u=e[5],h=Math.sin(n),c=Math.cos(n);return t[0]=r*c+s*h,t[1]=-r*h+s*c,t[2]=o*c+l*h,t[3]=-o*h+c*l,t[4]=c*(a-i[0])+h*(u-i[1])+i[0],t[5]=c*(u-i[1])-h*(a-i[0])+i[1],t}function Ft(t,e,n){var i=n[0],r=n[1];return t[0]=e[0]*i,t[1]=e[1]*r,t[2]=e[2]*i,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*r,t}function Ht(t,e){var n=e[0],i=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=n*a-o*i;return l?(l=1/l,t[0]=a*l,t[1]=-o*l,t[2]=-i*l,t[3]=n*l,t[4]=(i*s-a*r)*l,t[5]=(o*r-n*s)*l,t):null}function Vt(t){var e=[1,0,0,1,0,0];return Rt(e,t),e}var Gt=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.scale=function(t){this.x*=t,this.y*=t},t.prototype.scaleAndAdd=function(t,e){this.x+=t.x*e,this.y+=t.y*e},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},t.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},t.prototype.distanceSquare=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(t){if(t){var e=this.x,n=this.y;return this.x=t[0]*e+t[2]*n+t[4],this.y=t[1]*e+t[3]*n+t[5],this}},t.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},t.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},t.set=function(t,e,n){t.x=e,t.y=n},t.copy=function(t,e){t.x=e.x,t.y=e.y},t.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.lenSquare=function(t){return t.x*t.x+t.y*t.y},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.add=function(t,e,n){t.x=e.x+n.x,t.y=e.y+n.y},t.sub=function(t,e,n){t.x=e.x-n.x,t.y=e.y-n.y},t.scale=function(t,e,n){t.x=e.x*n,t.y=e.y*n},t.scaleAndAdd=function(t,e,n,i){t.x=e.x+n.x*i,t.y=e.y+n.y*i},t.lerp=function(t,e,n,i){var r=1-i;t.x=r*e.x+i*n.x,t.y=r*e.y+i*n.y},t}();const Ut=Gt;var Wt=Math.min,jt=Math.max,Zt=new Ut,Xt=new Ut,qt=new Ut,Yt=new Ut,Kt=new Ut,Jt=new Ut,$t=function(){function t(t,e,n,i){n<0&&(t+=n,n=-n),i<0&&(e+=i,i=-i),this.x=t,this.y=e,this.width=n,this.height=i}return t.prototype.union=function(t){var e=Wt(t.x,this.x),n=Wt(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=jt(t.x+t.width,this.x+this.width)-e:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=jt(t.y+t.height,this.y+this.height)-n:this.height=t.height,this.x=e,this.y=n},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(t){var e=this,n=t.width/e.width,i=t.height/e.height,r=[1,0,0,1,0,0];return zt(r,r,[-e.x,-e.y]),Ft(r,r,[n,i]),zt(r,r,[t.x,t.y]),r},t.prototype.intersect=function(e,n){if(!e)return!1;e instanceof t||(e=t.create(e));var i=this,r=i.x,o=i.x+i.width,a=i.y,s=i.y+i.height,l=e.x,u=e.x+e.width,h=e.y,c=e.y+e.height,d=!(op&&(p=y,gp&&(p=x,v<_?Ut.set(Jt,0,-v):Ut.set(Jt,0,_)):y=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},t.applyTransform=function(e,n,i){if(i){if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var r=i[0],o=i[3],a=i[4],s=i[5];return e.x=n.x*r+a,e.y=n.y*o+s,e.width=n.width*r,e.height=n.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}Zt.x=qt.x=n.x,Zt.y=Yt.y=n.y,Xt.x=Yt.x=n.x+n.width,Xt.y=qt.y=n.y+n.height,Zt.transform(i),Yt.transform(i),Xt.transform(i),qt.transform(i),e.x=Wt(Zt.x,Xt.x,qt.x,Yt.x),e.y=Wt(Zt.y,Xt.y,qt.y,Yt.y);var l=jt(Zt.x,Xt.x,qt.x,Yt.x),u=jt(Zt.y,Xt.y,qt.y,Yt.y);e.width=l-e.x,e.height=u-e.y}else e!==n&&t.copy(e,n)},t}();const Qt=$t;var te="silent";function ee(){Lt(this.event)}var ne=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handler=null,e}return O(e,t),e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(ut),ie=function(t,e){this.x=t,this.y=e},re=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],oe=new Qt(0,0,0,0),ae=function(t){function e(e,n,i,r,o){var a=t.call(this)||this;return a._hovered=new ie(0,0),a.storage=e,a.painter=n,a.painterRoot=r,a._pointerSize=o,i=i||new ne,a.proxy=null,a.setHandlerProxy(i),a._draggingMgr=new st(a),a}return O(e,t),e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(P.each(re,(function(e){t.on&&t.on(e,this[e],this)}),this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var e=t.zrX,n=t.zrY,i=ue(this,e,n),r=this._hovered,o=r.target;o&&!o.__zr&&(o=(r=this.findHover(r.x,r.y)).target);var a=this._hovered=i?new ie(e,n):this.findHover(e,n),s=a.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),o&&s!==o&&this.dispatchToElement(r,"mouseout",t),this.dispatchToElement(a,"mousemove",t),s&&s!==o&&this.dispatchToElement(a,"mouseover",t)},e.prototype.mouseout=function(t){var e=t.zrEventControl;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new ie(0,0)},e.prototype.dispatch=function(t,e){var n=this[t];n&&n.call(this,e)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},e.prototype.dispatchToElement=function(t,e,n){var i=(t=t||{}).target;if(!i||!i.silent){for(var r="on"+e,o=function(t,e,n){return{type:t,event:n,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:ee}}(e,t,n);i&&(i[r]&&(o.cancelBubble=!!i[r].call(i,o)),i.trigger(e,o),i=i.__hostTarget?i.__hostTarget:i.parent,!o.cancelBubble););o.cancelBubble||(this.trigger(e,o),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer((function(t){"function"==typeof t[r]&&t[r].call(t,o),t.trigger&&t.trigger(e,o)})))}},e.prototype.findHover=function(t,e,n){var i=this.storage.getDisplayList(),r=new ie(t,e);if(le(i,r,t,e,n),this._pointerSize&&!r.target){for(var o=[],a=this._pointerSize,s=a/2,l=new Qt(t-s,e-s,a,a),u=i.length-1;u>=0;u--){var h=i[u];h===n||h.ignore||h.ignoreCoarsePointer||h.parent&&h.parent.ignoreCoarsePointer||(oe.copy(h.getBoundingRect()),h.transform&&oe.applyTransform(h.transform),oe.intersect(l)&&o.push(h))}if(o.length)for(var c=Math.PI/12,d=2*Math.PI,f=0;f=0;o--){var a=t[o],s=void 0;if(a!==r&&!a.ignore&&(s=se(a,n,i))&&(!e.topTarget&&(e.topTarget=a),s!==te)){e.target=a;break}}}function ue(t,e,n){var i=t.painter;return e<0||e>i.getWidth()||n<0||n>i.getHeight()}P.each(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(t){ae.prototype[t]=function(e){var n,i,r=e.zrX,o=e.zrY,a=ue(this,r,o);if("mouseup"===t&&a||(i=(n=this.findHover(r,o)).target),"mousedown"===t)this._downEl=i,this._downPoint=[e.zrX,e.zrY],this._upEl=i;else if("mouseup"===t)this._upEl=i;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||J(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,t,e)}}));const he=ae;function ce(t,e,n,i){var r=e+1;if(r===n)return 1;if(i(t[r++],t[e])<0){for(;r=0;)r++;return r-e}function de(t,e,n,i,r){for(i===e&&i++;i>>1])<0?l=o:s=o+1;var u=i-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function fe(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])>0){for(s=i-r;l0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}for(a++;a>>1);o(t,e[n+h])>0?a=h+1:l=h}return l}function pe(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])<0){for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}else{for(s=i-r;l=0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;a>>1);o(t,e[n+h])<0?l=h:a=h+1}return l}function ge(t,e){var n,i,r=7,o=0,a=[];function s(s){var l=n[s],u=i[s],h=n[s+1],c=i[s+1];i[s]=u+c,s===o-3&&(n[s+1]=n[s+2],i[s+1]=i[s+2]),o--;var d=pe(t[h],t,l,u,0,e);l+=d,0!==(u-=d)&&0!==(c=fe(t[l+u-1],t,h,c,c-1,e))&&(u<=c?function(n,i,o,s){var l=0;for(l=0;l=7||f>=7);if(p)break;g<0&&(g=0),g+=2}if((r=g)<1&&(r=1),1===i){for(l=0;l=0;l--)t[f+l]=t[d+l];return void(t[c]=a[h])}var p=r;for(;;){var g=0,m=0,v=!1;do{if(e(a[h],t[u])<0){if(t[c--]=t[u--],g++,m=0,0==--i){v=!0;break}}else if(t[c--]=a[h--],m++,g=0,1==--s){v=!0;break}}while((g|m)=0;l--)t[f+l]=t[d+l];if(0===i){v=!0;break}}if(t[c--]=a[h--],1==--s){v=!0;break}if(0!==(m=s-fe(t[u],a,0,s,s-1,e))){for(s-=m,f=(c-=m)+1,d=(h-=m)+1,l=0;l=7||m>=7);if(v)break;p<0&&(p=0),p+=2}(r=p)<1&&(r=1);if(1===s){for(f=(c-=i)+1,d=(u-=i)+1,l=i-1;l>=0;l--)t[f+l]=t[d+l];t[c]=a[h]}else{if(0===s)throw new Error;for(d=c-(s-1),l=0;l1;){var t=o-2;if(t>=1&&i[t-1]<=i[t]+i[t+1]||t>=2&&i[t-2]<=i[t]+i[t-1])i[t-1]i[t+1])break;s(t)}},forceMergeRuns:function(){for(;o>1;){var t=o-2;t>0&&i[t-1]=32;)e|=1&t,t>>=1;return t+e}(r);do{if((o=ce(t,n,i,e))s&&(l=s),de(t,n,n+l,n+o,e),o=l}a.pushRun(n,o),a.mergeRuns(),r-=o,n+=o}while(0!==r);a.forceMergeRuns()}}}var ve=1,_e=4,ye=!1;function xe(){ye||(ye=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function be(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}var we=function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=be}return t.prototype.traverse=function(t,e){for(var n=0;n0&&(u.__clipPaths=[]),isNaN(u.z)&&(xe(),u.z=0),isNaN(u.z2)&&(xe(),u.z2=0),isNaN(u.zlevel)&&(xe(),u.zlevel=0),this._displayList[this._displayListLen++]=u}var h=t.getDecalElement&&t.getDecalElement();h&&this._updateAndAddDisplayable(h,e,n);var c=t.getTextGuideLine();c&&this._updateAndAddDisplayable(c,e,n);var d=t.getTextContent();d&&this._updateAndAddDisplayable(d,e,n)}},t.prototype.addRoot=function(t){t.__zr&&t.__zr.storage===this||this._roots.push(t)},t.prototype.delRoot=function(t){if(t instanceof Array)for(var e=0,n=t.length;e=0&&this._roots.splice(i,1)}},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}();const Se=we;const Te=I.default.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var Me={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),-n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,n=.1,i=.4;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=i*Math.asin(1/n)/(2*Math.PI),(t*=2)<1?n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*-.5:n*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-Me.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*Me.bounceIn(2*t):.5*Me.bounceOut(2*t-1)+.5}};const Ce=Me;var Ae=Math.pow,Le=Math.sqrt,De=1e-8,Ie=1e-4,Pe=Le(3),Ee=1/3,Oe=N(),Ne=N(),Re=N();function ke(t){return t>-1e-8&&tDe||t<-1e-8}function Be(t,e,n,i,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*i+3*o*n)}function Fe(t,e,n,i,r){var o=1-r;return 3*(((e-t)*o+2*(n-e)*r)*o+(i-n)*r*r)}function He(t,e,n,i,r,o){var a=i+3*(e-n)-t,s=3*(n-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,d=l*l-3*s*u,f=0;if(ke(h)&&ke(c)){if(ke(s))o[0]=0;else(T=-l/s)>=0&&T<=1&&(o[f++]=T)}else{var p=c*c-4*h*d;if(ke(p)){var g=c/h,m=-g/2;(T=-s/a+g)>=0&&T<=1&&(o[f++]=T),m>=0&&m<=1&&(o[f++]=m)}else if(p>0){var v=Le(p),_=h*s+1.5*a*(-c+v),y=h*s+1.5*a*(-c-v);(T=(-s-((_=_<0?-Ae(-_,Ee):Ae(_,Ee))+(y=y<0?-Ae(-y,Ee):Ae(y,Ee))))/(3*a))>=0&&T<=1&&(o[f++]=T)}else{var x=(2*h*s-3*a*c)/(2*Le(h*h*h)),b=Math.acos(x)/3,w=Le(h),S=Math.cos(b),T=(-s-2*w*S)/(3*a),M=(m=(-s+w*(S+Pe*Math.sin(b)))/(3*a),(-s+w*(S-Pe*Math.sin(b)))/(3*a));T>=0&&T<=1&&(o[f++]=T),m>=0&&m<=1&&(o[f++]=m),M>=0&&M<=1&&(o[f++]=M)}}return f}function Ve(t,e,n,i,r){var o=6*n-12*e+6*t,a=9*e+3*i-3*t-9*n,s=3*e-3*t,l=0;if(ke(a)){if(ze(o))(h=-s/o)>=0&&h<=1&&(r[l++]=h)}else{var u=o*o-4*a*s;if(ke(u))r[0]=-o/(2*a);else if(u>0){var h,c=Le(u),d=(-o-c)/(2*a);(h=(-o+c)/(2*a))>=0&&h<=1&&(r[l++]=h),d>=0&&d<=1&&(r[l++]=d)}}return l}function Ge(t,e,n,i,r,o){var a=(e-t)*r+t,s=(n-e)*r+e,l=(i-n)*r+n,u=(s-a)*r+a,h=(l-s)*r+s,c=(h-u)*r+u;o[0]=t,o[1]=a,o[2]=u,o[3]=c,o[4]=c,o[5]=h,o[6]=l,o[7]=i}function Ue(t,e,n,i,r,o,a,s,l,u,h){var c,d,f,p,g,m=.005,v=1/0;Oe[0]=l,Oe[1]=u;for(var _=0;_<1;_+=.05)Ne[0]=Be(t,n,r,a,_),Ne[1]=Be(e,i,o,s,_),(p=Q(Oe,Ne))=0&&p=0&&m=1?1:He(0,i,o,1,t,s)&&Be(0,r,a,1,s[0])}}}const Qe=function(){function t(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||P.noop,this.ondestroy=t.ondestroy||P.noop,this.onrestart=t.onrestart||P.noop,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var n=this._life,i=t-this._startTime-this._pausedTime,r=i/n;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=i%n;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=(0,P.isFunction)(t)?t:Ce[t]||$e(t)},t}();var tn=n(698),en=Math.round;function nn(t){var e;if(t&&"transparent"!==t){if("string"==typeof t&&t.indexOf("rgba")>-1){var n=(0,tn.parse)(t);n&&(t="rgb("+n[0]+","+n[1]+","+n[2]+")",e=n[3])}}else t="none";return{color:t,opacity:null==e?1:e}}var rn=1e-4;function on(t){return t-1e-4}function an(t){return en(1e3*t)/1e3}function sn(t){return en(1e4*t)/1e4}var ln={left:"start",right:"end",center:"middle",middle:"middle"};function un(t){return t&&!!t.image}function hn(t){return un(t)||function(t){return t&&!!t.svgElement}(t)}function cn(t){return"linear"===t.type}function dn(t){return"radial"===t.type}function fn(t){return t&&("linear"===t.type||"radial"===t.type)}function pn(t){return"url(#"+t+")"}function gn(t){var e=t.getGlobalScale(),n=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function mn(t){var e=t.x||0,n=t.y||0,i=(t.rotation||0)*P.RADIAN_TO_DEGREE,r=(0,P.retrieve2)(t.scaleX,1),o=(0,P.retrieve2)(t.scaleY,1),a=t.skewX||0,s=t.skewY||0,l=[];return(e||n)&&l.push("translate("+e+"px,"+n+"px)"),i&&l.push("rotate("+i+")"),1===r&&1===o||l.push("scale("+r+","+o+")"),(a||s)&&l.push("skew("+en(a*P.RADIAN_TO_DEGREE)+"deg, "+en(s*P.RADIAN_TO_DEGREE)+"deg)"),l.join(" ")}var vn=I.default.hasGlobalWindow&&(0,P.isFunction)(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:"undefined"!=typeof Buffer?function(t){return Buffer.from(t).toString("base64")}:function(t){return null},_n=Array.prototype.slice;function yn(t,e,n){return(e-t)*n+t}function xn(t,e,n,i){for(var r=e.length,o=0;oi?e:t,o=Math.min(n,i),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa)i.length=a;else for(var s=o;s=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,n){this._needsSort=!0;var i=this.keyframes,r=i.length,o=!1,a=6,s=e;if((0,P.isArrayLike)(e)){var l=function(t){return(0,P.isArrayLike)(t&&t[0])?2:1}(e);a=l,(1===l&&!(0,P.isNumber)(e[0])||2===l&&!(0,P.isNumber)(e[0][0]))&&(o=!0)}else if((0,P.isNumber)(e)&&!(0,P.eqNaN)(e))a=0;else if((0,P.isString)(e))if(isNaN(+e)){var u=tn.parse(e);u&&(s=u,a=3)}else a=0;else if((0,P.isGradientObject)(e)){var h=(0,P.extend)({},s);h.colorStops=(0,P.map)(e.colorStops,(function(t){return{offset:t.offset,color:tn.parse(t.color)}})),cn(e)?a=4:dn(e)&&(a=5),s=h}0===r?this.valType=a:a===this.valType&&6!==a||(o=!0),this.discrete=this.discrete||o;var c={time:t,value:s,rawValue:e,percent:0};return n&&(c.easing=n,c.easingFunc=(0,P.isFunction)(n)?n:Ce[n]||$e(n)),i.push(c),c},t.prototype.prepare=function(t,e){var n=this.keyframes;this._needsSort&&n.sort((function(t,e){return t.time-e.time}));for(var i=this.valType,r=n.length,o=n[r-1],a=this.discrete,s=Ln(i),l=An(i),u=0;u=0&&!(l[n].percent<=e);n--);n=f(n,u-2)}else{for(n=d;ne);n++);n=f(n-1,u-2)}r=l[n+1],i=l[n]}if(i&&r){this._lastFr=n,this._lastFrP=e;var p=r.percent-i.percent,g=0===p?1:f((e-i.percent)/p,1);r.easingFunc&&(g=r.easingFunc(g));var m=o?this._additiveValue:c?Dn:t[h];if(!Ln(s)&&!c||m||(m=this._additiveValue=[]),this.discrete)t[h]=g<1?i.rawValue:r.rawValue;else if(Ln(s))1===s?xn(m,i[a],r[a],g):function(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;a0&&s.addKeyframe(0,Mn(l),i),this._trackKeys.push(a)}s.addKeyframe(t,Mn(e[a]),i)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,n=0;n0)){this._started=1;for(var e=this,n=[],i=this._maxTime||0,r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[i]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}();const En=Pn;function On(){return(new Date).getTime()}var Nn=function(t){function e(e){var n=t.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,e=e||{},n.stage=e.stage||{},n}return O(e,t),e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var e=t.getClip();e&&this.addClip(e)},e.prototype.removeClip=function(t){if(t.animation){var e=t.prev,n=t.next;e?e.next=n:this._head=n,n?n.prev=e:this._tail=e,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var e=t.getClip();e&&this.removeClip(e),t.animation=null},e.prototype.update=function(t){for(var e=On()-this._pausedTime,n=e-this._time,i=this._head;i;){var r=i.next;i.step(e,n)?(i.ondestroy(),this.removeClip(i),i=r):i=r}this._time=e,t||(this.trigger("frame",n),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;this._running=!0,Te((function e(){t._running&&(Te(e),!t._paused&&t.update())}))},e.prototype.start=function(){this._running||(this._time=On(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=On(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=On()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var e=t.next;t.prev=t.next=t.animation=null,t=e}this._head=this._tail=null},e.prototype.isFinished=function(){return null==this._head},e.prototype.animate=function(t,e){e=e||{},this.start();var n=new En(t,e.loop);return this.addAnimator(n),n},e}(ut);const Rn=Nn;var kn,zn,Bn=I.default.domSupported,Fn=(zn={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:kn=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:P.map(kn,(function(t){var e=t.replace("mouse","pointer");return zn.hasOwnProperty(e)?e:t}))}),Hn=["mousemove","mouseup"],Vn=["pointermove","pointerup"],Gn=!1;function Un(t){var e=t.pointerType;return"pen"===e||"touch"===e}function Wn(t){t&&(t.zrByTouch=!0)}function jn(t,e){for(var n=e,i=!1;n&&9!==n.nodeType&&!(i=n.domBelongToZr||n!==e&&n===t.painterRoot);)n=n.parentNode;return i}var Zn=function(t,e){this.stopPropagation=P.noop,this.stopImmediatePropagation=P.noop,this.preventDefault=P.noop,this.type=e.type,this.target=this.currentTarget=t.dom,this.pointerType=e.pointerType,this.clientX=e.clientX,this.clientY=e.clientY},Xn={mousedown:function(t){t=Ct(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=Ct(this.dom,t);var e=this.__mayPointerCapture;!e||t.zrX===e[0]&&t.zrY===e[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=Ct(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){jn(this,(t=Ct(this.dom,t)).toElement||t.relatedTarget)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){Gn=!0,t=Ct(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){Gn||(t=Ct(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){Wn(t=Ct(this.dom,t)),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),Xn.mousemove.call(this,t),Xn.mousedown.call(this,t)},touchmove:function(t){Wn(t=Ct(this.dom,t)),this.handler.processGesture(t,"change"),Xn.mousemove.call(this,t)},touchend:function(t){Wn(t=Ct(this.dom,t)),this.handler.processGesture(t,"end"),Xn.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<300&&Xn.click.call(this,t)},pointerdown:function(t){Xn.mousedown.call(this,t)},pointermove:function(t){Un(t)||Xn.mousemove.call(this,t)},pointerup:function(t){Xn.mouseup.call(this,t)},pointerout:function(t){Un(t)||Xn.mouseout.call(this,t)}};P.each(["click","dblclick","contextmenu"],(function(t){Xn[t]=function(e){e=Ct(this.dom,e),this.trigger(t,e)}}));var qn={pointermove:function(t){Un(t)||qn.mousemove.call(this,t)},pointerup:function(t){qn.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function Yn(t,e){var n=e.domHandlers;I.default.pointerEventsSupported?P.each(Fn.pointer,(function(i){Jn(e,i,(function(e){n[i].call(t,e)}))})):(I.default.touchEventsSupported&&P.each(Fn.touch,(function(i){Jn(e,i,(function(r){n[i].call(t,r),function(t){t.touching=!0,null!=t.touchTimer&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout((function(){t.touching=!1,t.touchTimer=null}),700)}(e)}))})),P.each(Fn.mouse,(function(i){Jn(e,i,(function(r){r=Mt(r),e.touching||n[i].call(t,r)}))})))}function Kn(t,e){function n(n){Jn(e,n,(function(i){i=Mt(i),jn(t,i.target)||(i=function(t,e){return Ct(t.dom,new Zn(t,e),!0)}(t,i),e.domHandlers[n].call(t,i))}),{capture:!0})}I.default.pointerEventsSupported?P.each(Vn,n):I.default.touchEventsSupported||P.each(Hn,n)}function Jn(t,e,n,i){t.mounted[e]=n,t.listenerOpts[e]=i,At(t.domTarget,e,n,i)}function $n(t){var e,n,i,r,o=t.mounted;for(var a in o)o.hasOwnProperty(a)&&(e=t.domTarget,n=a,i=o[a],r=t.listenerOpts[a],e.removeEventListener(n,i,r));t.mounted={}}var Qn=function(t,e){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=t,this.domHandlers=e};const ti=function(t){function e(e,n){var i=t.call(this)||this;return i.__pointerCapturing=!1,i.dom=e,i.painterRoot=n,i._localHandlerScope=new Qn(e,Xn),Bn&&(i._globalHandlerScope=new Qn(document,qn)),Yn(i,i._localHandlerScope),i}return O(e,t),e.prototype.dispose=function(){$n(this._localHandlerScope),Bn&&$n(this._globalHandlerScope)},e.prototype.setCursor=function(t){this.dom.style&&(this.dom.style.cursor=t||"default")},e.prototype.__togglePointerCapture=function(t){if(this.__mayPointerCapture=null,Bn&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var e=this._globalHandlerScope;t?Kn(this,e):$n(e)}},e}(ut);var ei=1;I.default.hasGlobalWindow&&(ei=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var ni=ei,ii="#333",ri="#ccc",oi=Nt,ai=5e-5;function si(t){return t>ai||t<-5e-5}var li=[],ui=[],hi=[1,0,0,1,0,0],ci=Math.abs,di=function(){function t(){}return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},t.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},t.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},t.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},t.prototype.needLocalTransform=function(){return si(this.rotation)||si(this.x)||si(this.y)||si(this.scaleX-1)||si(this.scaleY-1)||si(this.skewX)||si(this.skewY)},t.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,e=this.needLocalTransform(),n=this.transform;e||t?(n=n||[1,0,0,1,0,0],e?this.getLocalTransform(n):oi(n),t&&(e?kt(n,t,n):Rt(n,t)),this.transform=n,this._resolveGlobalScaleRatio(n)):n&&(oi(n),this.invTransform=null)},t.prototype._resolveGlobalScaleRatio=function(t){var e=this.globalScaleRatio;if(null!=e&&1!==e){this.getGlobalScale(li);var n=li[0]<0?-1:1,i=li[1]<0?-1:1,r=((li[0]-n)*e+n)/li[0]||0,o=((li[1]-i)*e+i)/li[1]||0;t[0]*=r,t[1]*=r,t[2]*=o,t[3]*=o}this.invTransform=this.invTransform||[1,0,0,1,0,0],Ht(this.invTransform,t)},t.prototype.getComputedTransform=function(){for(var t=this,e=[];t;)e.push(t),t=t.parent;for(;t=e.pop();)t.updateTransform();return this.transform},t.prototype.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],n=t[2]*t[2]+t[3]*t[3],i=Math.atan2(t[1],t[0]),r=Math.PI/2+i-Math.atan2(t[3],t[2]);n=Math.sqrt(n)*Math.cos(r),e=Math.sqrt(e),this.skewX=r,this.skewY=0,this.rotation=-i,this.x=+t[4],this.y=+t[5],this.scaleX=e,this.scaleY=n,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(t.invTransform=t.invTransform||[1,0,0,1,0,0],kt(ui,t.invTransform,e),e=ui);var n=this.originX,i=this.originY;(n||i)&&(hi[4]=n,hi[5]=i,kt(ui,e,hi),ui[4]-=n,ui[5]-=i,e=ui),this.setLocalTransform(e)}},t.prototype.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},t.prototype.transformCoordToLocal=function(t,e){var n=[t,e],i=this.invTransform;return i&&nt(n,n,i),n},t.prototype.transformCoordToGlobal=function(t,e){var n=[t,e],i=this.transform;return i&&nt(n,n,i),n},t.prototype.getLineScale=function(){var t=this.transform;return t&&ci(t[0]-1)>1e-10&&ci(t[3]-1)>1e-10?Math.sqrt(ci(t[0]*t[3]-t[2]*t[1])):1},t.prototype.copyTransform=function(t){pi(this,t)},t.getLocalTransform=function(t,e){e=e||[];var n=t.originX||0,i=t.originY||0,r=t.scaleX,o=t.scaleY,a=t.anchorX,s=t.anchorY,l=t.rotation||0,u=t.x,h=t.y,c=t.skewX?Math.tan(t.skewX):0,d=t.skewY?Math.tan(-t.skewY):0;if(n||i||a||s){var f=n+a,p=i+s;e[4]=-f*r-c*p*o,e[5]=-p*o-d*f*r}else e[4]=e[5]=0;return e[0]=r,e[3]=o,e[1]=d*r,e[2]=c*o,l&&Bt(e,e,l),e[4]+=n+u,e[5]+=i+h,e},t.initDefaultProps=function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0}(),t}(),fi=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function pi(t,e){for(var n=0;n=0?parseFloat(t)/100*e:parseFloat(t):t}function Ci(t,e,n){var i=e.position||"inside",r=null!=e.distance?e.distance:5,o=n.height,a=n.width,s=o/2,l=n.x,u=n.y,h="left",c="top";if(i instanceof Array)l+=Mi(i[0],n.width),u+=Mi(i[1],n.height),h=null,c=null;else switch(i){case"left":l-=r,u+=s,h="right",c="middle";break;case"right":l+=r+a,u+=s,c="middle";break;case"top":l+=a/2,u-=r,h="center",c="bottom";break;case"bottom":l+=a/2,u+=o+r,h="center";break;case"inside":l+=a/2,u+=s,h="center",c="middle";break;case"insideLeft":l+=r,u+=s,c="middle";break;case"insideRight":l+=a-r,u+=s,h="right",c="middle";break;case"insideTop":l+=a/2,u+=r,h="center";break;case"insideBottom":l+=a/2,u+=o-r,h="center",c="bottom";break;case"insideTopLeft":l+=r,u+=r;break;case"insideTopRight":l+=a-r,u+=r,h="right";break;case"insideBottomLeft":l+=r,u+=o-r,c="bottom";break;case"insideBottomRight":l+=a-r,u+=o-r,h="right",c="bottom"}return(t=t||{}).x=l,t.y=u,t.align=h,t.verticalAlign=c,t}var Ai="__zr_normal__",Li=fi.concat(["ignore"]),Di=(0,P.reduce)(fi,(function(t,e){return t[e]=!0,t}),{ignore:!1}),Ii={},Pi=new Qt(0,0,0,0),Ei=function(){function t(t){this.id=(0,P.guid)(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return t.prototype._init=function(t){this.attr(t)},t.prototype.drift=function(t,e,n){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var i=this.transform;i||(i=this.transform=[1,0,0,1,0,0]),i[4]+=t,i[5]+=e,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(t){var e=this._textContent;if(e&&(!e.ignore||t)){this.textConfig||(this.textConfig={});var n=this.textConfig,i=n.local,r=e.innerTransformable,o=void 0,a=void 0,s=!1;r.parent=i?this:null;var l=!1;if(r.copyTransform(e),null!=n.position){var u=Pi;n.layoutRect?u.copy(n.layoutRect):u.copy(this.getBoundingRect()),i||u.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(Ii,n,u):Ci(Ii,n,u),r.x=Ii.x,r.y=Ii.y,o=Ii.align,a=Ii.verticalAlign;var h=n.origin;if(h&&null!=n.rotation){var c=void 0,d=void 0;"center"===h?(c=.5*u.width,d=.5*u.height):(c=Mi(h[0],u.width),d=Mi(h[1],u.height)),l=!0,r.originX=-r.x+c+(i?0:u.x),r.originY=-r.y+d+(i?0:u.y)}}null!=n.rotation&&(r.rotation=n.rotation);var f=n.offset;f&&(r.x+=f[0],r.y+=f[1],l||(r.originX=-f[0],r.originY=-f[1]));var p=null==n.inside?"string"==typeof n.position&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),m=void 0,v=void 0,_=void 0;p&&this.canBeInsideText()?(m=n.insideFill,v=n.insideStroke,null!=m&&"auto"!==m||(m=this.getInsideTextFill()),null!=v&&"auto"!==v||(v=this.getInsideTextStroke(m),_=!0)):(m=n.outsideFill,v=n.outsideStroke,null!=m&&"auto"!==m||(m=this.getOutsideFill()),null!=v&&"auto"!==v||(v=this.getOutsideStroke(m),_=!0)),(m=m||"#000")===g.fill&&v===g.stroke&&_===g.autoStroke&&o===g.align&&a===g.verticalAlign||(s=!0,g.fill=m,g.stroke=v,g.autoStroke=_,g.align=o,g.verticalAlign=a,e.setDefaultTextStyle(g)),e.__dirty|=ve,s&&e.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(t){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?ri:ii},t.prototype.getOutsideStroke=function(t){var e=this.__zr&&this.__zr.getBackgroundColor(),n="string"==typeof e&&(0,tn.parse)(e);n||(n=[255,255,255,1]);for(var i=n[3],r=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*i+(r?0:255)*(1-i);return n[3]=1,(0,tn.stringify)(n,"rgba")},t.prototype.traverse=function(t,e){},t.prototype.attrKV=function(t,e){"textConfig"===t?this.setTextConfig(e):"textContent"===t?this.setTextContent(e):"clipPath"===t?this.setClipPath(e):"extra"===t?(this.extra=this.extra||{},(0,P.extend)(this.extra,e)):this[t]=e},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(t,e){if("string"==typeof t)this.attrKV(t,e);else if((0,P.isObject)(t))for(var n=t,i=(0,P.keys)(n),r=0;r0},t.prototype.getState=function(t){return this.states[t]},t.prototype.ensureState=function(t){var e=this.states;return e[t]||(e[t]={}),e[t]},t.prototype.clearStates=function(t){this.useState(Ai,!1,t)},t.prototype.useState=function(t,e,n,i){var r=t===Ai;if(this.hasState()||!r){var o=this.currentStates,a=this.stateTransition;if(!((0,P.indexOf)(o,t)>=0)||!e&&1!==o.length){var s;if(this.stateProxy&&!r&&(s=this.stateProxy(t)),s||(s=this.states&&this.states[t]),s||r){r||this.saveCurrentToNormalState(s);var l=!!(s&&s.hoverLayer||i);l&&this._toggleHoverLayerFlag(!0),this._applyStateObj(t,s,this._normalState,e,!n&&!this.__inHover&&a&&a.duration>0,a);var u=this._textContent,h=this._textGuide;return u&&u.useState(t,e,n,l),h&&h.useState(t,e,n,l),r?(this.currentStates=[],this._normalState={}):e?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~ve),s}(0,P.logError)("State "+t+" not exists.")}}},t.prototype.useStates=function(t,e,n){if(t.length){var i=[],r=this.currentStates,o=t.length,a=o===r.length;if(a)for(var s=0;s0,f);var p=this._textContent,g=this._textGuide;p&&p.useStates(t,e,c),g&&g.useStates(t,e,c),this._updateAnimationTargets(),this.currentStates=t.slice(),this.markRedraw(),!c&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~ve)}else this.clearStates()},t.prototype.isSilent=function(){for(var t=this.silent,e=this.parent;!t&&e;){if(e.silent){t=!0;break}e=e.parent}return t},t.prototype._updateAnimationTargets=function(){for(var t=0;t=0){var n=this.currentStates.slice();n.splice(e,1),this.useStates(n)}},t.prototype.replaceState=function(t,e,n){var i=this.currentStates.slice(),r=(0,P.indexOf)(i,t),o=(0,P.indexOf)(i,e)>=0;r>=0?o?i.splice(r,1):i[r]=e:n&&!o&&i.push(e),this.useStates(i)},t.prototype.toggleState=function(t,e){e?this.useState(t,!0):this.removeState(t)},t.prototype._mergeStates=function(t){for(var e,n={},i=0;i=0&&e.splice(n,1)})),this.animators.push(t),n&&n.animation.addAnimator(t),n&&n.wakeUp()},t.prototype.updateDuringAnimation=function(t){this.markRedraw()},t.prototype.stopAnimation=function(t,e){for(var n=this.animators,i=n.length,r=[],o=0;o0&&n.during&&o[0].during((function(t,e){n.during(e)}));for(var d=0;d0||r.force&&!a.length){var w,S=void 0,T=void 0,M=void 0;if(s){T={},d&&(S={});for(x=0;x=0&&(n.splice(i,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,e){var n=P.indexOf(this._children,t);return n>=0&&this.replaceAt(e,n),this},e.prototype.replaceAt=function(t,e){var n=this._children,i=n[e];if(t&&t!==this&&t.parent!==this&&t!==i){n[e]=t,i.parent=null;var r=this.__zr;r&&i.removeSelfFromZr(r),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__zr;e&&e!==t.__zr&&t.addSelfToZr(e),e&&e.refresh()},e.prototype.remove=function(t){var e=this.__zr,n=this._children,i=P.indexOf(n,t);return i<0||(n.splice(i,1),t.parent=null,e&&t.removeSelfFromZr(e),e&&e.refresh()),this},e.prototype.removeAll=function(){for(var t=this._children,e=this.__zr,n=0;n18);a&&(n.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}(navigator.userAgent,E);const O=E;var N="sans-serif",R="12px "+N;var k,z,B=function(t){var e={};if("undefined"==typeof JSON)return e;for(var n=0;n=0)o=r*t.length;else for(var a=0;a>1)%2;a.style.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[s]+":0",r[l]+":0",i[1-s]+":auto",r[1-l]+":auto",""].join("!important;"),t.appendChild(a),n.push(a)}return n}(e,o),s=function(t,e,n){for(var i=n?"invTrans":"trans",r=e[i],o=e.srcCoords,a=[],s=[],l=!0,u=0;u<4;u++){var h=t[u].getBoundingClientRect(),c=2*u,d=h.left,f=h.top;a.push(d,f),l=l&&o&&d===o[c]&&f===o[c+1],s.push(t[u].offsetLeft,t[u].offsetTop)}return l&&r?r:(e.srcCoords=a,e[i]=n?Ie(s,a):Ie(a,s))}(a,o,r);if(s)return s(t,n,i),!0}return!1}function Ne(t){return"CANVAS"===t.nodeName.toUpperCase()}var Re=/([&<>"'])/g,ke={"&":"&","<":"<",">":">",'"':""","'":"'"};function ze(t){return null==t?"":(t+"").replace(Re,(function(t,e){return ke[e]}))}var Be=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Fe=[],Ve=O.browser.firefox&&+O.browser.version.split(".")[0]<39;function Ge(t,e,n,i){return n=n||{},i?He(t,e,n):Ve&&null!=e.layerX&&e.layerX!==e.offsetX?(n.zrX=e.layerX,n.zrY=e.layerY):null!=e.offsetX?(n.zrX=e.offsetX,n.zrY=e.offsetY):He(t,e,n),n}function He(t,e,n){if(O.domSupported&&t.getBoundingClientRect){var i=e.clientX,r=e.clientY;if(Ne(t)){var o=t.getBoundingClientRect();return n.zrX=i-o.left,void(n.zrY=r-o.top)}if(Oe(Fe,t,i,r))return n.zrX=Fe[0],void(n.zrY=Fe[1])}n.zrX=n.zrY=0}function Ue(t){return t||window.event}function We(t,e,n){if(null!=(e=Ue(e)).zrX)return e;var i=e.type;if(i&&i.indexOf("touch")>=0){var r="touchend"!==i?e.targetTouches[0]:e.changedTouches[0];r&&Ge(t,r,e,n)}else{Ge(t,e,e,n);var o=function(t){var e=t.wheelDelta;if(e)return e;var n=t.deltaX,i=t.deltaY;if(null==n||null==i)return e;var r=0!==i?Math.abs(i):Math.abs(n),o=i>0?-1:i<0?1:n>0?-1:1;return 3*r*o}(e);e.zrDelta=o?o/120:-(e.detail||0)/3}var a=e.button;return null==e.which&&void 0!==a&&Be.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}function je(t,e,n,i){t.addEventListener(e,n,i)}var Ze=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0};function Xe(t){return 2===t.which||3===t.which}var qe=function(){function t(){this._track=[]}return t.prototype.recognize=function(t,e,n){return this._doTrack(t,e,n),this._recognize(t)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(t,e,n){var i=t.touches;if(i){for(var r={points:[],touches:[],target:e,event:t},o=0,a=i.length;o1&&r&&r.length>1){var a=Ye(r)/Ye(o);!isFinite(a)&&(a=1),e.pinchScale=a;var s=[((i=r)[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2];return e.pinchX=s[0],e.pinchY=s[1],{type:"pinch",target:t[0].target,event:e}}}}};function Je(){return[1,0,0,1,0,0]}function Qe(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function $e(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 tn(t,e,n){var i=e[0]*n[0]+e[2]*n[1],r=e[1]*n[0]+e[3]*n[1],o=e[0]*n[2]+e[2]*n[3],a=e[1]*n[2]+e[3]*n[3],s=e[0]*n[4]+e[2]*n[5]+e[4],l=e[1]*n[4]+e[3]*n[5]+e[5];return t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t}function en(t,e,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+n[0],t[5]=e[5]+n[1],t}function nn(t,e,n,i){void 0===i&&(i=[0,0]);var r=e[0],o=e[2],a=e[4],s=e[1],l=e[3],u=e[5],h=Math.sin(n),c=Math.cos(n);return t[0]=r*c+s*h,t[1]=-r*h+s*c,t[2]=o*c+l*h,t[3]=-o*h+c*l,t[4]=c*(a-i[0])+h*(u-i[1])+i[0],t[5]=c*(u-i[1])-h*(a-i[0])+i[1],t}function rn(t,e,n){var i=n[0],r=n[1];return t[0]=e[0]*i,t[1]=e[1]*r,t[2]=e[2]*i,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*r,t}function on(t,e){var n=e[0],i=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=n*a-o*i;return l?(l=1/l,t[0]=a*l,t[1]=-o*l,t[2]=-i*l,t[3]=n*l,t[4]=(i*s-a*r)*l,t[5]=(o*r-n*s)*l,t):null}function an(t){var e=[1,0,0,1,0,0];return $e(e,t),e}var sn=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.scale=function(t){this.x*=t,this.y*=t},t.prototype.scaleAndAdd=function(t,e){this.x+=t.x*e,this.y+=t.y*e},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},t.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},t.prototype.distanceSquare=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(t){if(t){var e=this.x,n=this.y;return this.x=t[0]*e+t[2]*n+t[4],this.y=t[1]*e+t[3]*n+t[5],this}},t.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},t.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},t.set=function(t,e,n){t.x=e,t.y=n},t.copy=function(t,e){t.x=e.x,t.y=e.y},t.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.lenSquare=function(t){return t.x*t.x+t.y*t.y},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.add=function(t,e,n){t.x=e.x+n.x,t.y=e.y+n.y},t.sub=function(t,e,n){t.x=e.x-n.x,t.y=e.y-n.y},t.scale=function(t,e,n){t.x=e.x*n,t.y=e.y*n},t.scaleAndAdd=function(t,e,n,i){t.x=e.x+n.x*i,t.y=e.y+n.y*i},t.lerp=function(t,e,n,i){var r=1-i;t.x=r*e.x+i*n.x,t.y=r*e.y+i*n.y},t}();const ln=sn;var un=Math.min,hn=Math.max,cn=new ln,dn=new ln,fn=new ln,pn=new ln,gn=new ln,mn=new ln,vn=function(){function t(t,e,n,i){n<0&&(t+=n,n=-n),i<0&&(e+=i,i=-i),this.x=t,this.y=e,this.width=n,this.height=i}return t.prototype.union=function(t){var e=un(t.x,this.x),n=un(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=hn(t.x+t.width,this.x+this.width)-e:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=hn(t.y+t.height,this.y+this.height)-n:this.height=t.height,this.x=e,this.y=n},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(t){var e=this,n=t.width/e.width,i=t.height/e.height,r=[1,0,0,1,0,0];return en(r,r,[-e.x,-e.y]),rn(r,r,[n,i]),en(r,r,[t.x,t.y]),r},t.prototype.intersect=function(e,n){if(!e)return!1;e instanceof t||(e=t.create(e));var i=this,r=i.x,o=i.x+i.width,a=i.y,s=i.y+i.height,l=e.x,u=e.x+e.width,h=e.y,c=e.y+e.height,d=!(op&&(p=y,gp&&(p=x,v<_?ln.set(mn,0,-v):ln.set(mn,0,_)):y=n.x&&t<=n.x+n.width&&e>=n.y&&e<=n.y+n.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},t.applyTransform=function(e,n,i){if(i){if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var r=i[0],o=i[3],a=i[4],s=i[5];return e.x=n.x*r+a,e.y=n.y*o+s,e.width=n.width*r,e.height=n.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}cn.x=fn.x=n.x,cn.y=pn.y=n.y,dn.x=pn.x=n.x+n.width,dn.y=fn.y=n.y+n.height,cn.transform(i),pn.transform(i),dn.transform(i),fn.transform(i),e.x=un(cn.x,dn.x,fn.x,pn.x),e.y=un(cn.y,dn.y,fn.y,pn.y);var l=hn(cn.x,dn.x,fn.x,pn.x),u=hn(cn.y,dn.y,fn.y,pn.y);e.width=l-e.x,e.height=u-e.y}else e!==n&&t.copy(e,n)},t}();const _n=vn;var yn="silent";function xn(){Ze(this.event)}var wn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handler=null,e}return I(e,t),e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(Le),bn=function(t,e){this.x=t,this.y=e},Sn=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],Tn=new _n(0,0,0,0),Mn=function(t){function e(e,n,i,r,o){var a=t.call(this)||this;return a._hovered=new bn(0,0),a.storage=e,a.painter=n,a.painterRoot=r,a._pointerSize=o,i=i||new wn,a.proxy=null,a.setHandlerProxy(i),a._draggingMgr=new Me(a),a}return I(e,t),e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(ct(Sn,(function(e){t.on&&t.on(e,this[e],this)}),this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var e=t.zrX,n=t.zrY,i=An(this,e,n),r=this._hovered,o=r.target;o&&!o.__zr&&(o=(r=this.findHover(r.x,r.y)).target);var a=this._hovered=i?new bn(e,n):this.findHover(e,n),s=a.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),o&&s!==o&&this.dispatchToElement(r,"mouseout",t),this.dispatchToElement(a,"mousemove",t),s&&s!==o&&this.dispatchToElement(a,"mouseover",t)},e.prototype.mouseout=function(t){var e=t.zrEventControl;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new bn(0,0)},e.prototype.dispatch=function(t,e){var n=this[t];n&&n.call(this,e)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},e.prototype.dispatchToElement=function(t,e,n){var i=(t=t||{}).target;if(!i||!i.silent){for(var r="on"+e,o=function(t,e,n){return{type:t,event:n,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:xn}}(e,t,n);i&&(i[r]&&(o.cancelBubble=!!i[r].call(i,o)),i.trigger(e,o),i=i.__hostTarget?i.__hostTarget:i.parent,!o.cancelBubble););o.cancelBubble||(this.trigger(e,o),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer((function(t){"function"==typeof t[r]&&t[r].call(t,o),t.trigger&&t.trigger(e,o)})))}},e.prototype.findHover=function(t,e,n){var i=this.storage.getDisplayList(),r=new bn(t,e);if(Ln(i,r,t,e,n),this._pointerSize&&!r.target){for(var o=[],a=this._pointerSize,s=a/2,l=new _n(t-s,e-s,a,a),u=i.length-1;u>=0;u--){var h=i[u];h===n||h.ignore||h.ignoreCoarsePointer||h.parent&&h.parent.ignoreCoarsePointer||(Tn.copy(h.getBoundingRect()),h.transform&&Tn.applyTransform(h.transform),Tn.intersect(l)&&o.push(h))}if(o.length)for(var c=Math.PI/12,d=2*Math.PI,f=0;f=0;o--){var a=t[o],s=void 0;if(a!==r&&!a.ignore&&(s=Cn(a,n,i))&&(!e.topTarget&&(e.topTarget=a),s!==yn)){e.target=a;break}}}function An(t,e,n){var i=t.painter;return e<0||e>i.getWidth()||n<0||n>i.getHeight()}ct(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(t){Mn.prototype[t]=function(e){var n,i,r=e.zrX,o=e.zrY,a=An(this,r,o);if("mouseup"===t&&a||(i=(n=this.findHover(r,o)).target),"mousedown"===t)this._downEl=i,this._downPoint=[e.zrX,e.zrY],this._upEl=i;else if("mouseup"===t)this._upEl=i;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||ge(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,t,e)}}));const Dn=Mn;function In(t,e,n,i){var r=e+1;if(r===n)return 1;if(i(t[r++],t[e])<0){for(;r=0;)r++;return r-e}function Pn(t,e,n,i,r){for(i===e&&i++;i>>1])<0?l=o:s=o+1;var u=i-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function En(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])>0){for(s=i-r;l0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}for(a++;a>>1);o(t,e[n+h])>0?a=h+1:l=h}return l}function On(t,e,n,i,r,o){var a=0,s=0,l=1;if(o(t,e[n+r])<0){for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}else{for(s=i-r;l=0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;a>>1);o(t,e[n+h])<0?l=h:a=h+1}return l}function Nn(t,e){var n,i,r=7,o=0,a=[];function s(s){var l=n[s],u=i[s],h=n[s+1],c=i[s+1];i[s]=u+c,s===o-3&&(n[s+1]=n[s+2],i[s+1]=i[s+2]),o--;var d=On(t[h],t,l,u,0,e);l+=d,0!==(u-=d)&&0!==(c=En(t[l+u-1],t,h,c,c-1,e))&&(u<=c?function(n,i,o,s){var l=0;for(l=0;l=7||f>=7);if(p)break;g<0&&(g=0),g+=2}if((r=g)<1&&(r=1),1===i){for(l=0;l=0;l--)t[f+l]=t[d+l];return void(t[c]=a[h])}var p=r;for(;;){var g=0,m=0,v=!1;do{if(e(a[h],t[u])<0){if(t[c--]=t[u--],g++,m=0,0==--i){v=!0;break}}else if(t[c--]=a[h--],m++,g=0,1==--s){v=!0;break}}while((g|m)=0;l--)t[f+l]=t[d+l];if(0===i){v=!0;break}}if(t[c--]=a[h--],1==--s){v=!0;break}if(0!==(m=s-En(t[u],a,0,s,s-1,e))){for(s-=m,f=(c-=m)+1,d=(h-=m)+1,l=0;l=7||m>=7);if(v)break;p<0&&(p=0),p+=2}(r=p)<1&&(r=1);if(1===s){for(f=(c-=i)+1,d=(u-=i)+1,l=i-1;l>=0;l--)t[f+l]=t[d+l];t[c]=a[h]}else{if(0===s)throw new Error;for(d=c-(s-1),l=0;l1;){var t=o-2;if(t>=1&&i[t-1]<=i[t]+i[t+1]||t>=2&&i[t-2]<=i[t]+i[t-1])i[t-1]i[t+1])break;s(t)}},forceMergeRuns:function(){for(;o>1;){var t=o-2;t>0&&i[t-1]=32;)e|=1&t,t>>=1;return t+e}(r);do{if((o=In(t,n,i,e))s&&(l=s),Pn(t,n,n+l,n+o,e),o=l}a.pushRun(n,o),a.mergeRuns(),r-=o,n+=o}while(0!==r);a.forceMergeRuns()}}}var kn=1,zn=4,Bn=!1;function Fn(){Bn||(Bn=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function Vn(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}var Gn=function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=Vn}return t.prototype.traverse=function(t,e){for(var n=0;n0&&(u.__clipPaths=[]),isNaN(u.z)&&(Fn(),u.z=0),isNaN(u.z2)&&(Fn(),u.z2=0),isNaN(u.zlevel)&&(Fn(),u.zlevel=0),this._displayList[this._displayListLen++]=u}var h=t.getDecalElement&&t.getDecalElement();h&&this._updateAndAddDisplayable(h,e,n);var c=t.getTextGuideLine();c&&this._updateAndAddDisplayable(c,e,n);var d=t.getTextContent();d&&this._updateAndAddDisplayable(d,e,n)}},t.prototype.addRoot=function(t){t.__zr&&t.__zr.storage===this||this._roots.push(t)},t.prototype.delRoot=function(t){if(t instanceof Array)for(var e=0,n=t.length;e=0&&this._roots.splice(i,1)}},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}();const Hn=Gn;const Un=O.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var Wn={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),-n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,n=.1;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=.4*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,n=.1,i=.4;return 0===t?0:1===t?1:(!n||n<1?(n=1,e=.1):e=i*Math.asin(1/n)/(2*Math.PI),(t*=2)<1?n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*-.5:n*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-Wn.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*Wn.bounceIn(2*t):.5*Wn.bounceOut(2*t-1)+.5}};const jn=Wn;var Zn=Math.pow,Xn=Math.sqrt,qn=1e-8,Yn=1e-4,Kn=Xn(3),Jn=1/3,Qn=Qt(),$n=Qt(),ti=Qt();function ei(t){return t>-1e-8&&tqn||t<-1e-8}function ii(t,e,n,i,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*i+3*o*n)}function ri(t,e,n,i,r){var o=1-r;return 3*(((e-t)*o+2*(n-e)*r)*o+(i-n)*r*r)}function oi(t,e,n,i,r,o){var a=i+3*(e-n)-t,s=3*(n-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,d=l*l-3*s*u,f=0;if(ei(h)&&ei(c)){if(ei(s))o[0]=0;else(T=-l/s)>=0&&T<=1&&(o[f++]=T)}else{var p=c*c-4*h*d;if(ei(p)){var g=c/h,m=-g/2;(T=-s/a+g)>=0&&T<=1&&(o[f++]=T),m>=0&&m<=1&&(o[f++]=m)}else if(p>0){var v=Xn(p),_=h*s+1.5*a*(-c+v),y=h*s+1.5*a*(-c-v);(T=(-s-((_=_<0?-Zn(-_,Jn):Zn(_,Jn))+(y=y<0?-Zn(-y,Jn):Zn(y,Jn))))/(3*a))>=0&&T<=1&&(o[f++]=T)}else{var x=(2*h*s-3*a*c)/(2*Xn(h*h*h)),w=Math.acos(x)/3,b=Xn(h),S=Math.cos(w),T=(-s-2*b*S)/(3*a),M=(m=(-s+b*(S+Kn*Math.sin(w)))/(3*a),(-s+b*(S-Kn*Math.sin(w)))/(3*a));T>=0&&T<=1&&(o[f++]=T),m>=0&&m<=1&&(o[f++]=m),M>=0&&M<=1&&(o[f++]=M)}}return f}function ai(t,e,n,i,r){var o=6*n-12*e+6*t,a=9*e+3*i-3*t-9*n,s=3*e-3*t,l=0;if(ei(a)){if(ni(o))(h=-s/o)>=0&&h<=1&&(r[l++]=h)}else{var u=o*o-4*a*s;if(ei(u))r[0]=-o/(2*a);else if(u>0){var h,c=Xn(u),d=(-o-c)/(2*a);(h=(-o+c)/(2*a))>=0&&h<=1&&(r[l++]=h),d>=0&&d<=1&&(r[l++]=d)}}return l}function si(t,e,n,i,r,o){var a=(e-t)*r+t,s=(n-e)*r+e,l=(i-n)*r+n,u=(s-a)*r+a,h=(l-s)*r+s,c=(h-u)*r+u;o[0]=t,o[1]=a,o[2]=u,o[3]=c,o[4]=c,o[5]=h,o[6]=l,o[7]=i}function li(t,e,n,i,r,o,a,s,l,u,h){var c,d,f,p,g,m=.005,v=1/0;Qn[0]=l,Qn[1]=u;for(var _=0;_<1;_+=.05)$n[0]=ii(t,n,r,a,_),$n[1]=ii(e,i,o,s,_),(p=ve(Qn,$n))=0&&p=0&&m=1?1:oi(0,i,o,1,t,s)&&ii(0,r,a,1,s[0])}}}const _i=function(){function t(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||Kt,this.ondestroy=t.ondestroy||Kt,this.onrestart=t.onrestart||Kt,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var n=this._life,i=t-this._startTime-this._pausedTime,r=i/n;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=i%n;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=xt(t)?t:jn[t]||vi(t)},t}();var yi=function(t){this.value=t},xi=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new yi(t);return this.insertEntry(e),e},t.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},t.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}(),wi=function(){function t(t){this._list=new xi,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var n=this._list,i=this._map,r=null;if(null==i[t]){var o=n.len(),a=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var s=n.head;n.remove(s),delete i[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new yi(e),a.key=t,n.insertEntry(a),i[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();const bi=wi;var Si={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Ti(t){return(t=Math.round(t))<0?0:t>255?255:t}function Mi(t){return t<0?0:t>1?1:t}function Ci(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?Ti(parseFloat(e)/100*255):Ti(parseInt(e,10))}function Li(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?Mi(parseFloat(e)/100):Mi(parseFloat(e))}function Ai(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function Di(t,e,n){return t+(e-t)*n}function Ii(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function Pi(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var Ei=new bi(20),Oi=null;function Ni(t,e){Oi&&Pi(Oi,e),Oi=Ei.put(t,Oi||e.slice())}function Ri(t,e){if(t){e=e||[];var n=Ei.get(t);if(n)return Pi(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in Si)return Pi(e,Si[i]),Ni(t,e),e;var r,o=i.length;if("#"===i.charAt(0))return 4===o||5===o?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(Ii(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(i.slice(4),16)/15:1),Ni(t,e),e):void Ii(e,0,0,0,1):7===o||9===o?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(Ii(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(i.slice(7),16)/255:1),Ni(t,e),e):void Ii(e,0,0,0,1):void 0;var a=i.indexOf("("),s=i.indexOf(")");if(-1!==a&&s+1===o){var l=i.substr(0,a),u=i.substr(a+1,s-(a+1)).split(","),h=1;switch(l){case"rgba":if(4!==u.length)return 3===u.length?Ii(e,+u[0],+u[1],+u[2],1):Ii(e,0,0,0,1);h=Li(u.pop());case"rgb":return u.length>=3?(Ii(e,Ci(u[0]),Ci(u[1]),Ci(u[2]),3===u.length?h:Li(u[3])),Ni(t,e),e):void Ii(e,0,0,0,1);case"hsla":return 4!==u.length?void Ii(e,0,0,0,1):(u[3]=Li(u[3]),ki(u,e),Ni(t,e),e);case"hsl":return 3!==u.length?void Ii(e,0,0,0,1):(ki(u,e),Ni(t,e),e);default:return}}Ii(e,0,0,0,1)}}function ki(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=Li(t[1]),r=Li(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return Ii(e=e||[],Ti(255*Ai(a,o,n+1/3)),Ti(255*Ai(a,o,n)),Ti(255*Ai(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}function zi(t,e){var n=Ri(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return ji(n,4===n.length?"rgba":"rgb")}}function Bi(t){var e=Ri(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function Fi(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],l=i-r;return n[0]=Ti(Di(a[0],s[0],l)),n[1]=Ti(Di(a[1],s[1],l)),n[2]=Ti(Di(a[2],s[2],l)),n[3]=Mi(Di(a[3],s[3],l)),n}}var Vi=Fi;function Gi(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=Ri(e[r]),s=Ri(e[o]),l=i-r,u=ji([Ti(Di(a[0],s[0],l)),Ti(Di(a[1],s[1],l)),Ti(Di(a[2],s[2],l)),Mi(Di(a[3],s[3],l))],"rgba");return n?{color:u,leftIndex:r,rightIndex:o,value:i}:u}}var Hi=Gi;function Ui(t,e,n,i){var r,o=Ri(t);if(t)return o=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(o),null!=e&&(o[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(o[1]=Li(n)),null!=i&&(o[2]=Li(i)),ji(ki(o),"rgba")}function Wi(t,e){var n=Ri(t);if(n&&null!=e)return n[3]=Mi(e),ji(n,"rgba")}function ji(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}}function Zi(t,e){var n=Ri(t);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*e:0}function Xi(){return ji([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}var qi=new bi(100);function Yi(t){if(wt(t)){var e=qi.get(t);return e||(e=zi(t,-.1),qi.put(t,e)),e}if(At(t)){var n=rt({},t);return n.colorStops=dt(t.colorStops,(function(t){return{offset:t.offset,color:zi(t.color,-.1)}})),n}return t}var Ki=Math.round;function Ji(t){var e;if(t&&"transparent"!==t){if("string"==typeof t&&t.indexOf("rgba")>-1){var n=Ri(t);n&&(t="rgb("+n[0]+","+n[1]+","+n[2]+")",e=n[3])}}else t="none";return{color:t,opacity:null==e?1:e}}var Qi=1e-4;function $i(t){return t-1e-4}function tr(t){return Ki(1e3*t)/1e3}function er(t){return Ki(1e4*t)/1e4}var nr={left:"start",right:"end",center:"middle",middle:"middle"};function ir(t){return t&&!!t.image}function rr(t){return ir(t)||function(t){return t&&!!t.svgElement}(t)}function or(t){return"linear"===t.type}function ar(t){return"radial"===t.type}function sr(t){return t&&("linear"===t.type||"radial"===t.type)}function lr(t){return"url(#"+t+")"}function ur(t){var e=t.getGlobalScale(),n=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function hr(t){var e=t.x||0,n=t.y||0,i=(t.rotation||0)*Jt,r=Ot(t.scaleX,1),o=Ot(t.scaleY,1),a=t.skewX||0,s=t.skewY||0,l=[];return(e||n)&&l.push("translate("+e+"px,"+n+"px)"),i&&l.push("rotate("+i+")"),1===r&&1===o||l.push("scale("+r+","+o+")"),(a||s)&&l.push("skew("+Ki(a*Jt)+"deg, "+Ki(s*Jt)+"deg)"),l.join(" ")}var cr=O.hasGlobalWindow&&xt(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:"undefined"!=typeof Buffer?function(t){return Buffer.from(t).toString("base64")}:function(t){return null},dr=Array.prototype.slice;function fr(t,e,n){return(e-t)*n+t}function pr(t,e,n,i){for(var r=e.length,o=0;oi?e:t,o=Math.min(n,i),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa)i.length=a;else for(var s=o;s=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,n){this._needsSort=!0;var i=this.keyframes,r=i.length,o=!1,a=6,s=e;if(ht(e)){var l=function(t){return ht(t&&t[0])?2:1}(e);a=l,(1===l&&!St(e[0])||2===l&&!St(e[0][0]))&&(o=!0)}else if(St(e)&&!Pt(e))a=0;else if(wt(e))if(isNaN(+e)){var u=Ri(e);u&&(s=u,a=3)}else a=0;else if(At(e)){var h=rt({},s);h.colorStops=dt(e.colorStops,(function(t){return{offset:t.offset,color:Ri(t.color)}})),or(e)?a=4:ar(e)&&(a=5),s=h}0===r?this.valType=a:a===this.valType&&6!==a||(o=!0),this.discrete=this.discrete||o;var c={time:t,value:s,rawValue:e,percent:0};return n&&(c.easing=n,c.easingFunc=xt(n)?n:jn[n]||vi(n)),i.push(c),c},t.prototype.prepare=function(t,e){var n=this.keyframes;this._needsSort&&n.sort((function(t,e){return t.time-e.time}));for(var i=this.valType,r=n.length,o=n[r-1],a=this.discrete,s=br(i),l=wr(i),u=0;u=0&&!(l[n].percent<=e);n--);n=f(n,u-2)}else{for(n=d;ne);n++);n=f(n-1,u-2)}r=l[n+1],i=l[n]}if(i&&r){this._lastFr=n,this._lastFrP=e;var p=r.percent-i.percent,g=0===p?1:f((e-i.percent)/p,1);r.easingFunc&&(g=r.easingFunc(g));var m=o?this._additiveValue:c?Sr:t[h];if(!br(s)&&!c||m||(m=this._additiveValue=[]),this.discrete)t[h]=g<1?i.rawValue:r.rawValue;else if(br(s))1===s?pr(m,i[a],r[a],g):function(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;a0&&s.addKeyframe(0,yr(l),i),this._trackKeys.push(a)}s.addKeyframe(t,yr(e[a]),i)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,n=0;n0)){this._started=1;for(var e=this,n=[],i=this._maxTime||0,r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[i]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}();const Cr=Mr;function Lr(){return(new Date).getTime()}var Ar=function(t){function e(e){var n=t.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,e=e||{},n.stage=e.stage||{},n}return I(e,t),e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var e=t.getClip();e&&this.addClip(e)},e.prototype.removeClip=function(t){if(t.animation){var e=t.prev,n=t.next;e?e.next=n:this._head=n,n?n.prev=e:this._tail=e,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var e=t.getClip();e&&this.removeClip(e),t.animation=null},e.prototype.update=function(t){for(var e=Lr()-this._pausedTime,n=e-this._time,i=this._head;i;){var r=i.next;i.step(e,n)?(i.ondestroy(),this.removeClip(i),i=r):i=r}this._time=e,t||(this.trigger("frame",n),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;this._running=!0,Un((function e(){t._running&&(Un(e),!t._paused&&t.update())}))},e.prototype.start=function(){this._running||(this._time=Lr(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=Lr(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=Lr()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var e=t.next;t.prev=t.next=t.animation=null,t=e}this._head=this._tail=null},e.prototype.isFinished=function(){return null==this._head},e.prototype.animate=function(t,e){e=e||{},this.start();var n=new Cr(t,e.loop);return this.addAnimator(n),n},e}(Le);const Dr=Ar;var Ir,Pr,Er=O.domSupported,Or=(Pr={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:Ir=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:dt(Ir,(function(t){var e=t.replace("mouse","pointer");return Pr.hasOwnProperty(e)?e:t}))}),Nr=["mousemove","mouseup"],Rr=["pointermove","pointerup"],kr=!1;function zr(t){var e=t.pointerType;return"pen"===e||"touch"===e}function Br(t){t&&(t.zrByTouch=!0)}function Fr(t,e){for(var n=e,i=!1;n&&9!==n.nodeType&&!(i=n.domBelongToZr||n!==e&&n===t.painterRoot);)n=n.parentNode;return i}var Vr=function(t,e){this.stopPropagation=Kt,this.stopImmediatePropagation=Kt,this.preventDefault=Kt,this.type=e.type,this.target=this.currentTarget=t.dom,this.pointerType=e.pointerType,this.clientX=e.clientX,this.clientY=e.clientY},Gr={mousedown:function(t){t=We(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=We(this.dom,t);var e=this.__mayPointerCapture;!e||t.zrX===e[0]&&t.zrY===e[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=We(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){Fr(this,(t=We(this.dom,t)).toElement||t.relatedTarget)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){kr=!0,t=We(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){kr||(t=We(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){Br(t=We(this.dom,t)),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),Gr.mousemove.call(this,t),Gr.mousedown.call(this,t)},touchmove:function(t){Br(t=We(this.dom,t)),this.handler.processGesture(t,"change"),Gr.mousemove.call(this,t)},touchend:function(t){Br(t=We(this.dom,t)),this.handler.processGesture(t,"end"),Gr.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<300&&Gr.click.call(this,t)},pointerdown:function(t){Gr.mousedown.call(this,t)},pointermove:function(t){zr(t)||Gr.mousemove.call(this,t)},pointerup:function(t){Gr.mouseup.call(this,t)},pointerout:function(t){zr(t)||Gr.mouseout.call(this,t)}};ct(["click","dblclick","contextmenu"],(function(t){Gr[t]=function(e){e=We(this.dom,e),this.trigger(t,e)}}));var Hr={pointermove:function(t){zr(t)||Hr.mousemove.call(this,t)},pointerup:function(t){Hr.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function Ur(t,e){var n=e.domHandlers;O.pointerEventsSupported?ct(Or.pointer,(function(i){jr(e,i,(function(e){n[i].call(t,e)}))})):(O.touchEventsSupported&&ct(Or.touch,(function(i){jr(e,i,(function(r){n[i].call(t,r),function(t){t.touching=!0,null!=t.touchTimer&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout((function(){t.touching=!1,t.touchTimer=null}),700)}(e)}))})),ct(Or.mouse,(function(i){jr(e,i,(function(r){r=Ue(r),e.touching||n[i].call(t,r)}))})))}function Wr(t,e){function n(n){jr(e,n,(function(i){i=Ue(i),Fr(t,i.target)||(i=function(t,e){return We(t.dom,new Vr(t,e),!0)}(t,i),e.domHandlers[n].call(t,i))}),{capture:!0})}O.pointerEventsSupported?ct(Rr,n):O.touchEventsSupported||ct(Nr,n)}function jr(t,e,n,i){t.mounted[e]=n,t.listenerOpts[e]=i,je(t.domTarget,e,n,i)}function Zr(t){var e,n,i,r,o=t.mounted;for(var a in o)o.hasOwnProperty(a)&&(e=t.domTarget,n=a,i=o[a],r=t.listenerOpts[a],e.removeEventListener(n,i,r));t.mounted={}}var Xr=function(t,e){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=t,this.domHandlers=e};const qr=function(t){function e(e,n){var i=t.call(this)||this;return i.__pointerCapturing=!1,i.dom=e,i.painterRoot=n,i._localHandlerScope=new Xr(e,Gr),Er&&(i._globalHandlerScope=new Xr(document,Hr)),Ur(i,i._localHandlerScope),i}return I(e,t),e.prototype.dispose=function(){Zr(this._localHandlerScope),Er&&Zr(this._globalHandlerScope)},e.prototype.setCursor=function(t){this.dom.style&&(this.dom.style.cursor=t||"default")},e.prototype.__togglePointerCapture=function(t){if(this.__mayPointerCapture=null,Er&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var e=this._globalHandlerScope;t?Wr(this,e):Zr(e)}},e}(Le);var Yr=1;O.hasGlobalWindow&&(Yr=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var Kr=Yr,Jr="#333",Qr="#ccc",$r=Qe,to=5e-5;function eo(t){return t>to||t<-5e-5}var no=[],io=[],ro=[1,0,0,1,0,0],oo=Math.abs,ao=function(){function t(){}return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},t.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},t.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},t.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},t.prototype.needLocalTransform=function(){return eo(this.rotation)||eo(this.x)||eo(this.y)||eo(this.scaleX-1)||eo(this.scaleY-1)||eo(this.skewX)||eo(this.skewY)},t.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,e=this.needLocalTransform(),n=this.transform;e||t?(n=n||[1,0,0,1,0,0],e?this.getLocalTransform(n):$r(n),t&&(e?tn(n,t,n):$e(n,t)),this.transform=n,this._resolveGlobalScaleRatio(n)):n&&($r(n),this.invTransform=null)},t.prototype._resolveGlobalScaleRatio=function(t){var e=this.globalScaleRatio;if(null!=e&&1!==e){this.getGlobalScale(no);var n=no[0]<0?-1:1,i=no[1]<0?-1:1,r=((no[0]-n)*e+n)/no[0]||0,o=((no[1]-i)*e+i)/no[1]||0;t[0]*=r,t[1]*=r,t[2]*=o,t[3]*=o}this.invTransform=this.invTransform||[1,0,0,1,0,0],on(this.invTransform,t)},t.prototype.getComputedTransform=function(){for(var t=this,e=[];t;)e.push(t),t=t.parent;for(;t=e.pop();)t.updateTransform();return this.transform},t.prototype.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],n=t[2]*t[2]+t[3]*t[3],i=Math.atan2(t[1],t[0]),r=Math.PI/2+i-Math.atan2(t[3],t[2]);n=Math.sqrt(n)*Math.cos(r),e=Math.sqrt(e),this.skewX=r,this.skewY=0,this.rotation=-i,this.x=+t[4],this.y=+t[5],this.scaleX=e,this.scaleY=n,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(t.invTransform=t.invTransform||[1,0,0,1,0,0],tn(io,t.invTransform,e),e=io);var n=this.originX,i=this.originY;(n||i)&&(ro[4]=n,ro[5]=i,tn(io,e,ro),io[4]-=n,io[5]-=i,e=io),this.setLocalTransform(e)}},t.prototype.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},t.prototype.transformCoordToLocal=function(t,e){var n=[t,e],i=this.invTransform;return i&&xe(n,n,i),n},t.prototype.transformCoordToGlobal=function(t,e){var n=[t,e],i=this.transform;return i&&xe(n,n,i),n},t.prototype.getLineScale=function(){var t=this.transform;return t&&oo(t[0]-1)>1e-10&&oo(t[3]-1)>1e-10?Math.sqrt(oo(t[0]*t[3]-t[2]*t[1])):1},t.prototype.copyTransform=function(t){lo(this,t)},t.getLocalTransform=function(t,e){e=e||[];var n=t.originX||0,i=t.originY||0,r=t.scaleX,o=t.scaleY,a=t.anchorX,s=t.anchorY,l=t.rotation||0,u=t.x,h=t.y,c=t.skewX?Math.tan(t.skewX):0,d=t.skewY?Math.tan(-t.skewY):0;if(n||i||a||s){var f=n+a,p=i+s;e[4]=-f*r-c*p*o,e[5]=-p*o-d*f*r}else e[4]=e[5]=0;return e[0]=r,e[3]=o,e[1]=d*r,e[2]=c*o,l&&nn(e,e,l),e[4]+=n+u,e[5]+=i+h,e},t.initDefaultProps=function(){var e=t.prototype;e.scaleX=e.scaleY=e.globalScaleRatio=1,e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0}(),t}(),so=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function lo(t,e){for(var n=0;n=0?parseFloat(t)/100*e:parseFloat(t):t}function yo(t,e,n){var i=e.position||"inside",r=null!=e.distance?e.distance:5,o=n.height,a=n.width,s=o/2,l=n.x,u=n.y,h="left",c="top";if(i instanceof Array)l+=_o(i[0],n.width),u+=_o(i[1],n.height),h=null,c=null;else switch(i){case"left":l-=r,u+=s,h="right",c="middle";break;case"right":l+=r+a,u+=s,c="middle";break;case"top":l+=a/2,u-=r,h="center",c="bottom";break;case"bottom":l+=a/2,u+=o+r,h="center";break;case"inside":l+=a/2,u+=s,h="center",c="middle";break;case"insideLeft":l+=r,u+=s,c="middle";break;case"insideRight":l+=a-r,u+=s,h="right",c="middle";break;case"insideTop":l+=a/2,u+=r,h="center";break;case"insideBottom":l+=a/2,u+=o-r,h="center",c="bottom";break;case"insideTopLeft":l+=r,u+=r;break;case"insideTopRight":l+=a-r,u+=r,h="right";break;case"insideBottomLeft":l+=r,u+=o-r,c="bottom";break;case"insideBottomRight":l+=a-r,u+=o-r,h="right",c="bottom"}return(t=t||{}).x=l,t.y=u,t.align=h,t.verticalAlign=c,t}var xo="__zr_normal__",wo=so.concat(["ignore"]),bo=ft(so,(function(t,e){return t[e]=!0,t}),{ignore:!1}),So={},To=new _n(0,0,0,0),Mo=function(){function t(t){this.id=$(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return t.prototype._init=function(t){this.attr(t)},t.prototype.drift=function(t,e,n){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var i=this.transform;i||(i=this.transform=[1,0,0,1,0,0]),i[4]+=t,i[5]+=e,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(t){var e=this._textContent;if(e&&(!e.ignore||t)){this.textConfig||(this.textConfig={});var n=this.textConfig,i=n.local,r=e.innerTransformable,o=void 0,a=void 0,s=!1;r.parent=i?this:null;var l=!1;if(r.copyTransform(e),null!=n.position){var u=To;n.layoutRect?u.copy(n.layoutRect):u.copy(this.getBoundingRect()),i||u.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(So,n,u):yo(So,n,u),r.x=So.x,r.y=So.y,o=So.align,a=So.verticalAlign;var h=n.origin;if(h&&null!=n.rotation){var c=void 0,d=void 0;"center"===h?(c=.5*u.width,d=.5*u.height):(c=_o(h[0],u.width),d=_o(h[1],u.height)),l=!0,r.originX=-r.x+c+(i?0:u.x),r.originY=-r.y+d+(i?0:u.y)}}null!=n.rotation&&(r.rotation=n.rotation);var f=n.offset;f&&(r.x+=f[0],r.y+=f[1],l||(r.originX=-f[0],r.originY=-f[1]));var p=null==n.inside?"string"==typeof n.position&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),m=void 0,v=void 0,_=void 0;p&&this.canBeInsideText()?(m=n.insideFill,v=n.insideStroke,null!=m&&"auto"!==m||(m=this.getInsideTextFill()),null!=v&&"auto"!==v||(v=this.getInsideTextStroke(m),_=!0)):(m=n.outsideFill,v=n.outsideStroke,null!=m&&"auto"!==m||(m=this.getOutsideFill()),null!=v&&"auto"!==v||(v=this.getOutsideStroke(m),_=!0)),(m=m||"#000")===g.fill&&v===g.stroke&&_===g.autoStroke&&o===g.align&&a===g.verticalAlign||(s=!0,g.fill=m,g.stroke=v,g.autoStroke=_,g.align=o,g.verticalAlign=a,e.setDefaultTextStyle(g)),e.__dirty|=kn,s&&e.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(t){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?Qr:Jr},t.prototype.getOutsideStroke=function(t){var e=this.__zr&&this.__zr.getBackgroundColor(),n="string"==typeof e&&Ri(e);n||(n=[255,255,255,1]);for(var i=n[3],r=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*i+(r?0:255)*(1-i);return n[3]=1,ji(n,"rgba")},t.prototype.traverse=function(t,e){},t.prototype.attrKV=function(t,e){"textConfig"===t?this.setTextConfig(e):"textContent"===t?this.setTextContent(e):"clipPath"===t?this.setClipPath(e):"extra"===t?(this.extra=this.extra||{},rt(this.extra,e)):this[t]=e},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(t,e){if("string"==typeof t)this.attrKV(t,e);else if(Tt(t))for(var n=mt(t),i=0;i0},t.prototype.getState=function(t){return this.states[t]},t.prototype.ensureState=function(t){var e=this.states;return e[t]||(e[t]={}),e[t]},t.prototype.clearStates=function(t){this.useState(xo,!1,t)},t.prototype.useState=function(t,e,n,i){var r=t===xo;if(this.hasState()||!r){var o=this.currentStates,a=this.stateTransition;if(!(st(o,t)>=0)||!e&&1!==o.length){var s;if(this.stateProxy&&!r&&(s=this.stateProxy(t)),s||(s=this.states&&this.states[t]),s||r){r||this.saveCurrentToNormalState(s);var l=!!(s&&s.hoverLayer||i);l&&this._toggleHoverLayerFlag(!0),this._applyStateObj(t,s,this._normalState,e,!n&&!this.__inHover&&a&&a.duration>0,a);var u=this._textContent,h=this._textGuide;return u&&u.useState(t,e,n,l),h&&h.useState(t,e,n,l),r?(this.currentStates=[],this._normalState={}):e?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~kn),s}tt("State "+t+" not exists.")}}},t.prototype.useStates=function(t,e,n){if(t.length){var i=[],r=this.currentStates,o=t.length,a=o===r.length;if(a)for(var s=0;s0,f);var p=this._textContent,g=this._textGuide;p&&p.useStates(t,e,c),g&&g.useStates(t,e,c),this._updateAnimationTargets(),this.currentStates=t.slice(),this.markRedraw(),!c&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~kn)}else this.clearStates()},t.prototype.isSilent=function(){for(var t=this.silent,e=this.parent;!t&&e;){if(e.silent){t=!0;break}e=e.parent}return t},t.prototype._updateAnimationTargets=function(){for(var t=0;t=0){var n=this.currentStates.slice();n.splice(e,1),this.useStates(n)}},t.prototype.replaceState=function(t,e,n){var i=this.currentStates.slice(),r=st(i,t),o=st(i,e)>=0;r>=0?o?i.splice(r,1):i[r]=e:n&&!o&&i.push(e),this.useStates(i)},t.prototype.toggleState=function(t,e){e?this.useState(t,!0):this.removeState(t)},t.prototype._mergeStates=function(t){for(var e,n={},i=0;i=0&&e.splice(n,1)})),this.animators.push(t),n&&n.animation.addAnimator(t),n&&n.wakeUp()},t.prototype.updateDuringAnimation=function(t){this.markRedraw()},t.prototype.stopAnimation=function(t,e){for(var n=this.animators,i=n.length,r=[],o=0;o0&&n.during&&o[0].during((function(t,e){n.during(e)}));for(var d=0;d0||r.force&&!a.length){var b,S=void 0,T=void 0,M=void 0;if(s){T={},d&&(S={});for(x=0;x=0&&(n.splice(i,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,e){var n=st(this._children,t);return n>=0&&this.replaceAt(e,n),this},e.prototype.replaceAt=function(t,e){var n=this._children,i=n[e];if(t&&t!==this&&t.parent!==this&&t!==i){n[e]=t,i.parent=null;var r=this.__zr;r&&i.removeSelfFromZr(r),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__zr;e&&e!==t.__zr&&t.addSelfToZr(e),e&&e.refresh()},e.prototype.remove=function(t){var e=this.__zr,n=this._children,i=st(n,t);return i<0||(n.splice(i,1),t.parent=null,e&&t.removeSelfFromZr(e),e&&e.refresh()),this},e.prototype.removeAll=function(){for(var t=this._children,e=this.__zr,n=0;n0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},t.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover())},t.prototype.resize=function(t){this._disposed||(t=t||{},this.painter.resize(t.width,t.height),this.handler.resize())},t.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},t.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},t.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},t.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},t.prototype.findHover=function(t,e){if(!this._disposed)return this.handler.findHover(t,e)},t.prototype.on=function(t,e,n){return this._disposed||this.handler.on(t,e,n),this},t.prototype.off=function(t,e){this._disposed||this.handler.off(t,e)},t.prototype.trigger=function(t,e){this._disposed||this.handler.trigger(t,e)},t.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),e=0;e0){if(t<=r)return a;if(t>=o)return s}else{if(t>=r)return a;if(t<=o)return s}else{if(t===r)return a;if(t===o)return s}return(t-r)/l*u+a}function er(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return P.isString(t)?(n=t,n.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t;var n}function nr(t,e,n){return null==e&&(e=10),e=Math.min(Math.max(0,e),Qi),t=(+t).toFixed(e),n?t:+t}function ir(t){return t.sort((function(t,e){return t-e})),t}function rr(t){if(t=+t,isNaN(t))return 0;if(t>1e-14)for(var e=1,n=0;n<15;n++,e*=10)if(Math.round(t*e)/e===t)return n;return or(t)}function or(t){var e=t.toString().toLowerCase(),n=e.indexOf("e"),i=n>0?+e.slice(n+1):0,r=n>0?n:e.length,o=e.indexOf("."),a=o<0?0:r-1-o;return Math.max(0,a-i)}function ar(t,e){var n=Math.log,i=Math.LN10,r=Math.floor(n(t[1]-t[0])/i),o=Math.round(n(Math.abs(e[1]-e[0]))/i),a=Math.min(Math.max(-r+o,0),20);return isFinite(a)?a:20}function sr(t,e,n){if(!t[e])return 0;var i=function(t,e){var n=P.reduce(t,(function(t,e){return t+(isNaN(e)?0:e)}),0);if(0===n)return[];var i=Math.pow(10,e),r=P.map(t,(function(t){return(isNaN(t)?0:t)/n*i*100})),o=100*i,a=P.map(r,(function(t){return Math.floor(t)})),s=P.reduce(a,(function(t,e){return t+e}),0),l=P.map(r,(function(t,e){return t-a[e]}));for(;su&&(u=l[c],h=c);++a[h],l[h]=0,++s}return P.map(a,(function(t){return t/i}))}(t,n);return i[e]||0}function lr(t,e){var n=Math.max(rr(t),rr(e)),i=t+e;return n>Qi?i:nr(i,n)}var ur=9007199254740991;function hr(t){var e=2*Math.PI;return(t%e+e)%e}function cr(t){return t>-$i&&t<$i}var dr=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function fr(t){if(t instanceof Date)return t;if(P.isString(t)){var e=dr.exec(t);if(!e)return new Date(NaN);if(e[8]){var n=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(n-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,n,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0)}return null==t?new Date(NaN):new Date(Math.round(t))}function pr(t){return Math.pow(10,gr(t))}function gr(t){if(0===t)return 0;var e=Math.floor(Math.log(t)/Math.LN10);return t/Math.pow(10,e)>=10&&e++,e}function mr(t,e){var n=gr(t),i=Math.pow(10,n),r=t/i;return t=(e?r<1.5?1:r<2.5?2:r<4?3:r<7?5:10:r<1?1:r<2?2:r<3?3:r<5?5:10)*i,n>=-20?+t.toFixed(n<0?-n:0):t}function vr(t,e){var n=(t.length-1)*e+1,i=Math.floor(n),r=+t[i-1],o=n-i;return o?r+o*(t[i]-r):r}function _r(t){t.sort((function(t,e){return s(t,e,0)?-1:1}));for(var e=-1/0,n=1,i=0;i=0||r&&P.indexOf(r,s)<0)){var l=n.getShallow(s,e);null!=l&&(o[t[a][0]]=l)}}return o}}var io=no([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),ro=function(){function t(){}return t.prototype.getAreaStyle=function(t,e){return io(this,t,e)},t}(),oo=new mi.Ay(50);function ao(t){if("string"==typeof t){var e=oo.get(t);return e&&e.image}return t}function so(t,e,n,i,r){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!n)return e;var o=oo.get(t),a={hostEl:n,cb:i,cbPayload:r};return o?!uo(e=o.image)&&o.pending.push(a):((e=vi.yh.loadImage(t,lo,lo)).__zrImageSrc=t,oo.put(t,e.__cachedImgObj={image:e,pending:[a]})),e}return t}return e}function lo(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e=a;l++)s-=a;var u=yi(n,e);return u>s&&(n="",u=0),s=t-u,r.ellipsis=n,r.ellipsisWidth=u,r.contentWidth=s,r.containerWidth=t,r}function go(t,e,n){var i=n.containerWidth,r=n.font,o=n.contentWidth;if(!i)return t.textLine="",void(t.isTruncated=!1);var a=yi(e,r);if(a<=i)return t.textLine=e,void(t.isTruncated=!1);for(var s=0;;s++){if(a<=o||s>=n.maxIterations){e+=n.ellipsis;break}var l=0===s?mo(e,o,n.ascCharWidth,n.cnCharWidth):a>0?Math.floor(e.length*o/a):0;a=yi(e=e.substr(0,l),r)}""===e&&(e=n.placeholder),t.textLine=e,t.isTruncated=!0}function mo(t,e,n,i){for(var r=0,o=0,a=t.length;o0&&p+i.accumWidth>i.width&&(o=e.split("\n"),c=!0),i.accumWidth=p}else{var g=So(e,h,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+f,a=g.linesWidths,o=g.lines}}else o=e.split("\n");for(var m=0;m=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}(t)||!!bo[t]}function So(t,e,n,i,r){for(var o=[],a=[],s="",l="",u=0,h=0,c=0;cn:r+h+f>n)?h?(s||l)&&(p?(s||(s=l,l="",h=u=0),o.push(s),a.push(h-u),l+=d,s="",h=u+=f):(l&&(s+=l,l="",u=0),o.push(s),a.push(h),s=d,h=f)):p?(o.push(l),a.push(u),l=d,u=f):(o.push(d),a.push(f)):(h+=f,p?(l+=d,u+=f):(l&&(s+=l,l="",u=0),s+=d))}else l&&(s+=l,h+=u),o.push(s),a.push(h),s="",l="",u=0,h=0}return o.length||s||(s=t,l="",u=0),l&&(s+=l),s&&(o.push(s),a.push(h)),1===o.length&&(h+=r),{accumWidth:h,lines:o,linesWidths:a}}var To="__zr_style_"+Math.round(10*Math.random()),Mo={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},Co={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};Mo[To]=!0;var Ao=["z","z2","invisible"],Lo=["invisible"],Do=function(t){function e(e){return t.call(this,e)||this}var n;return O(e,t),e.prototype._init=function(e){for(var n=(0,P.keys)(e),i=0;i1e-4)return s[0]=t-n,s[1]=e-i,l[0]=t+n,void(l[1]=e+i);if(Bo[0]=ko(r)*n+t,Bo[1]=Ro(r)*i+e,Fo[0]=ko(o)*n+t,Fo[1]=Ro(o)*i+e,u(s,Bo,Fo),h(l,Bo,Fo),(r%=zo)<0&&(r+=zo),(o%=zo)<0&&(o+=zo),r>o&&!a?o+=zo:rr&&(Ho[0]=ko(f)*n+t,Ho[1]=Ro(f)*i+e,u(s,Ho,s),h(l,Ho,l))}var Xo={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},qo=[],Yo=[],Ko=[],Jo=[],$o=[],Qo=[],ta=Math.min,ea=Math.max,na=Math.cos,ia=Math.sin,ra=Math.abs,oa=Math.PI,aa=2*oa,sa="undefined"!=typeof Float32Array,la=[];function ua(t){return Math.round(t/oa*1e8)/1e8%2*oa}var ha=function(){function t(t){this.dpr=1,this._xi=0,this._yi=0,this._x0=0,this._y0=0,this._len=0,t&&(this._saveData=!1),this._saveData&&(this.data=[])}return t.prototype.increaseVersion=function(){this._version++},t.prototype.getVersion=function(){return this._version},t.prototype.setScale=function(t,e,n){(n=n||0)>0&&(this._ux=ra(n/ni/t)||0,this._uy=ra(n/ni/e)||0)},t.prototype.setDPR=function(t){this.dpr=t},t.prototype.setContext=function(t){this._ctx=t},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(t,e){return this._drawPendingPt(),this.addData(Xo.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},t.prototype.lineTo=function(t,e){var n=ra(t-this._xi),i=ra(e-this._yi),r=n>this._ux||i>this._uy;if(this.addData(Xo.L,t,e),this._ctx&&r&&this._ctx.lineTo(t,e),r)this._xi=t,this._yi=e,this._pendingPtDist=0;else{var o=n*n+i*i;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){return this._drawPendingPt(),this.addData(Xo.C,t,e,n,i,r,o),this._ctx&&this._ctx.bezierCurveTo(t,e,n,i,r,o),this._xi=r,this._yi=o,this},t.prototype.quadraticCurveTo=function(t,e,n,i){return this._drawPendingPt(),this.addData(Xo.Q,t,e,n,i),this._ctx&&this._ctx.quadraticCurveTo(t,e,n,i),this._xi=n,this._yi=i,this},t.prototype.arc=function(t,e,n,i,r,o){this._drawPendingPt(),la[0]=i,la[1]=r,function(t,e){var n=ua(t[0]);n<0&&(n+=aa);var i=n-t[0],r=t[1];r+=i,!e&&r-n>=aa?r=n+aa:e&&n-r>=aa?r=n-aa:!e&&n>r?r=n+(aa-ua(n-r)):e&&nu.length&&(this._expandData(),u=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],e=0;e11&&(this.data=new Float32Array(t)))}},t.prototype.getBoundingRect=function(){Ko[0]=Ko[1]=$o[0]=$o[1]=Number.MAX_VALUE,Jo[0]=Jo[1]=Qo[0]=Qo[1]=-Number.MAX_VALUE;var t,e=this.data,n=0,i=0,r=0,o=0;for(t=0;tn||ra(m)>i||c===e-1)&&(p=Math.sqrt(D*D+m*m),r=g,o=y);break;case Xo.C:var v=t[c++],_=t[c++],y=(g=t[c++],t[c++]),x=t[c++],b=t[c++];p=We(r,o,v,_,g,y,x,b,10),r=x,o=b;break;case Xo.Q:p=Ke(r,o,v=t[c++],_=t[c++],g=t[c++],y=t[c++],10),r=g,o=y;break;case Xo.A:var w=t[c++],S=t[c++],T=t[c++],M=t[c++],C=t[c++],A=t[c++],L=A+C;c+=1,f&&(a=na(C)*T+w,s=ia(C)*M+S),p=ea(T,M)*ta(aa,Math.abs(A)),r=na(L)*T+w,o=ia(L)*M+S;break;case Xo.R:a=r=t[c++],s=o=t[c++],p=2*t[c++]+2*t[c++];break;case Xo.Z:var D=a-r;m=s-o;p=Math.sqrt(D*D+m*m),r=a,o=s}p>=0&&(l[h++]=p,u+=p)}return this._pathLen=u,u},t.prototype.rebuildPath=function(t,e){var n,i,r,o,a,s,l,u,h,c,d=this.data,f=this._ux,p=this._uy,g=this._len,m=e<1,v=0,_=0,y=0;if(!m||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,u=e*this._pathLen))t:for(var x=0;x0&&(t.lineTo(h,c),y=0),b){case Xo.M:n=r=d[x++],i=o=d[x++],t.moveTo(r,o);break;case Xo.L:a=d[x++],s=d[x++];var S=ra(a-r),T=ra(s-o);if(S>f||T>p){if(m){if(v+(q=l[_++])>u){var M=(u-v)/q;t.lineTo(r*(1-M)+a*M,o*(1-M)+s*M);break t}v+=q}t.lineTo(a,s),r=a,o=s,y=0}else{var C=S*S+T*T;C>y&&(h=a,c=s,y=C)}break;case Xo.C:var A=d[x++],L=d[x++],D=d[x++],I=d[x++],P=d[x++],E=d[x++];if(m){if(v+(q=l[_++])>u){Ge(r,A,D,P,M=(u-v)/q,qo),Ge(o,L,I,E,M,Yo),t.bezierCurveTo(qo[1],Yo[1],qo[2],Yo[2],qo[3],Yo[3]);break t}v+=q}t.bezierCurveTo(A,L,D,I,P,E),r=P,o=E;break;case Xo.Q:A=d[x++],L=d[x++],D=d[x++],I=d[x++];if(m){if(v+(q=l[_++])>u){qe(r,A,D,M=(u-v)/q,qo),qe(o,L,I,M,Yo),t.quadraticCurveTo(qo[1],Yo[1],qo[2],Yo[2]);break t}v+=q}t.quadraticCurveTo(A,L,D,I),r=D,o=I;break;case Xo.A:var O=d[x++],N=d[x++],R=d[x++],k=d[x++],z=d[x++],B=d[x++],F=d[x++],H=!d[x++],V=R>k?R:k,G=ra(R-k)>.001,U=z+B,W=!1;if(m)v+(q=l[_++])>u&&(U=z+B*(u-v)/q,W=!0),v+=q;if(G&&t.ellipse?t.ellipse(O,N,R,k,F,z,U,H):t.arc(O,N,V,z,U,H),W)break t;w&&(n=na(z)*R+O,i=ia(z)*k+N),r=na(U)*R+O,o=ia(U)*k+N;break;case Xo.R:n=r=d[x],i=o=d[x+1],a=d[x++],s=d[x++];var j=d[x++],Z=d[x++];if(m){if(v+(q=l[_++])>u){var X=u-v;t.moveTo(a,s),t.lineTo(a+ta(X,j),s),(X-=j)>0&&t.lineTo(a+j,s+ta(X,Z)),(X-=Z)>0&&t.lineTo(a+ea(j-X,0),s+Z),(X-=j)>0&&t.lineTo(a,s+ea(Z-X,0));break t}v+=q}t.rect(a,s,j,Z);break;case Xo.Z:if(m){var q;if(v+(q=l[_++])>u){M=(u-v)/q;t.lineTo(r*(1-M)+n*M,o*(1-M)+i*M);break t}v+=q}t.closePath(),r=n,o=i}}},t.prototype.clone=function(){var e=new t,n=this.data;return e.data=n.slice?n.slice():Array.prototype.slice.call(n),e._len=this._len,e},t.CMD=Xo,t.initDefaultProps=function(){var e=t.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),t}();const ca=ha;function da(t,e,n,i,r,o,a){if(0===r)return!1;var s=r,l=0;if(a>e+s&&a>i+s||at+s&&o>n+s||oe+c&&h>i+c&&h>o+c&&h>s+c||ht+c&&u>n+c&&u>r+c&&u>a+c||ue+u&&l>i+u&&l>o+u||lt+u&&s>n+u&&s>r+u||sn||h+ur&&(r+=va);var d=Math.atan2(l,s);return d<0&&(d+=va),d>=i&&d<=r||d+va>=i&&d+va<=r}function ya(t,e,n,i,r,o){if(o>e&&o>i||or?s:0}var xa=ca.CMD,ba=2*Math.PI;var wa=[-1,-1,-1],Sa=[-1,-1];function Ta(t,e,n,i,r,o,a,s,l,u){if(u>e&&u>i&&u>o&&u>s||u1&&(h=void 0,h=Sa[0],Sa[0]=Sa[1],Sa[1]=h),p=Be(e,i,o,s,Sa[0]),f>1&&(g=Be(e,i,o,s,Sa[1]))),2===f?ve&&s>i&&s>o||s=0&&h<=1&&(r[l++]=h);else{var u=a*a-4*o*s;if(ke(u))(h=-a/(2*o))>=0&&h<=1&&(r[l++]=h);else if(u>0){var h,c=Le(u),d=(-a-c)/(2*o);(h=(-a+c)/(2*o))>=0&&h<=1&&(r[l++]=h),d>=0&&d<=1&&(r[l++]=d)}}return l}(e,i,o,s,wa);if(0===l)return 0;var u=Xe(e,i,o);if(u>=0&&u<=1){for(var h=0,c=je(e,i,o,u),d=0;dn||s<-n)return 0;var l=Math.sqrt(n*n-s*s);wa[0]=-l,wa[1]=l;var u=Math.abs(i-r);if(u<1e-4)return 0;if(u>=ba-1e-4){i=0,r=ba;var h=o?1:-1;return a>=wa[0]+t&&a<=wa[1]+t?h:0}if(i>r){var c=i;i=r,r=c}i<0&&(i+=ba,r+=ba);for(var d=0,f=0;f<2;f++){var p=wa[f];if(p+t>a){var g=Math.atan2(s,p);h=o?1:-1;g<0&&(g=ba+g),(g>=i&&g<=r||g+ba>=i&&g+ba<=r)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),d+=h)}}return d}function Aa(t,e,n,i,r){for(var o,a,s,l,u=t.data,h=t.len(),c=0,d=0,f=0,p=0,g=0,m=0;m1&&(n||(c+=ya(d,f,p,g,i,r))),_&&(p=d=u[m],g=f=u[m+1]),v){case xa.M:d=p=u[m++],f=g=u[m++];break;case xa.L:if(n){if(da(d,f,u[m],u[m+1],e,i,r))return!0}else c+=ya(d,f,u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case xa.C:if(n){if(fa(d,f,u[m++],u[m++],u[m++],u[m++],u[m],u[m+1],e,i,r))return!0}else c+=Ta(d,f,u[m++],u[m++],u[m++],u[m++],u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case xa.Q:if(n){if(pa(d,f,u[m++],u[m++],u[m],u[m+1],e,i,r))return!0}else c+=Ma(d,f,u[m++],u[m++],u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case xa.A:var y=u[m++],x=u[m++],b=u[m++],w=u[m++],S=u[m++],T=u[m++];m+=1;var M=!!(1-u[m++]);o=Math.cos(S)*b+y,a=Math.sin(S)*w+x,_?(p=o,g=a):c+=ya(d,f,o,a,i,r);var C=(i-y)*w/b+y;if(n){if(_a(y,x,w,S,S+T,M,e,C,r))return!0}else c+=Ca(y,x,w,S,S+T,M,C,r);d=Math.cos(S+T)*b+y,f=Math.sin(S+T)*w+x;break;case xa.R:if(p=d=u[m++],g=f=u[m++],o=p+u[m++],a=g+u[m++],n){if(da(p,g,o,g,e,i,r)||da(o,g,o,a,e,i,r)||da(o,a,p,a,e,i,r)||da(p,a,p,g,e,i,r))return!0}else c+=ya(o,g,o,a,i,r),c+=ya(p,a,p,g,i,r);break;case xa.Z:if(n){if(da(d,f,p,g,e,i,r))return!0}else c+=ya(d,f,p,g,i,r);d=p,f=g}}return n||(s=f,l=g,Math.abs(s-l)<1e-4)||(c+=ya(d,f,p,g,i,r)||0),0!==c}var La=(0,P.defaults)({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Mo),Da={style:(0,P.defaults)({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},Co.style)},Ia=fi.concat(["invisible","culling","z","z2","zlevel","parent"]),Pa=function(t){function e(e){return t.call(this,e)||this}var n;return O(e,t),e.prototype.update=function(){var n=this;t.prototype.update.call(this);var i=this.style;if(i.decal){var r=this._decalEl=this._decalEl||new e;r.buildPath===e.prototype.buildPath&&(r.buildPath=function(t){n.buildPath(t,n.shape)}),r.silent=!0;var o=r.style;for(var a in i)o[a]!==i[a]&&(o[a]=i[a]);o.fill=i.fill?i.decal:null,o.decal=null,o.shadowColor=null,i.strokeFirst&&(o.stroke=null);for(var s=0;s.5?ii:e>.2?"#eee":ri}if(t)return ri}return ii},e.prototype.getInsideTextStroke=function(t){var e=this.style.fill;if((0,P.isString)(e)){var n=this.__zr;if(!(!n||!n.isDarkMode())===(0,tn.lum)(t,0)<.4)return e}},e.prototype.buildPath=function(t,e,n){},e.prototype.pathUpdated=function(){this.__dirty&=~_e},e.prototype.getUpdatedPathProxy=function(t){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,t),this.path},e.prototype.createPathProxy=function(){this.path=new ca(!1)},e.prototype.hasStroke=function(){var t=this.style,e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.getBoundingRect=function(){var t=this._rect,e=this.style,n=!t;if(n){var i=!1;this.path||(i=!0,this.createPathProxy());var r=this.path;(i||this.__dirty&_e)&&(r.beginPath(),this.buildPath(r,this.shape,!1),this.pathUpdated()),t=r.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var o=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||n){o.copy(t);var a=e.strokeNoScale?this.getLineScale():1,s=e.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}a>1e-10&&(o.width+=s/a,o.height+=s/a,o.x-=s/a/2,o.y-=s/a/2)}return o}return t},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect(),r=this.style;if(t=n[0],e=n[1],i.contain(t,e)){var o=this.path;if(this.hasStroke()){var a=r.lineWidth,s=r.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),function(t,e,n,i){return Aa(t,e,!0,n,i)}(o,a/s,t,e)))return!0}if(this.hasFill())return function(t,e,n){return Aa(t,0,!1,e,n)}(o,t,e)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=_e,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():"shape"===t?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(e,n){"shape"===e?this.setShape(n):t.prototype.attrKV.call(this,e,n)},e.prototype.setShape=function(t,e){var n=this.shape;return n||(n=this.shape={}),"string"==typeof t?n[t]=e:(0,P.extend)(n,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&_e)},e.prototype.createStyle=function(t){return(0,P.createObject)(La,t)},e.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var n=this._normalState;e.shape&&!n.shape&&(n.shape=(0,P.extend)({},this.shape))},e.prototype._applyStateObj=function(e,n,i,r,o,a){t.prototype._applyStateObj.call(this,e,n,i,r,o,a);var s,l=!(n&&r);if(n&&n.shape?o?r?s=n.shape:(s=(0,P.extend)({},i.shape),(0,P.extend)(s,n.shape)):(s=(0,P.extend)({},r?this.shape:i.shape),(0,P.extend)(s,n.shape)):l&&(s=i.shape),s)if(o){this.shape=(0,P.extend)({},this.shape);for(var u={},h=(0,P.keys)(s),c=0;c0},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.createStyle=function(t){return(0,P.createObject)(Oa,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var e=t.text;null!=e?e+="":e="";var n=bi(e,t.font,t.textAlign,t.textBaseline);if(n.x+=t.x||0,n.y+=t.y||0,this.hasStroke()){var i=t.lineWidth;n.x-=i/2,n.y-=i/2,n.width+=i,n.height+=i}this._rect=n}return this._rect},e.initDefaultProps=void(e.prototype.dirtyRectTolerance=10),e}(Eo);Na.prototype.type="tspan";const Ra=Na;var ka=(0,P.defaults)({x:0,y:0},Mo),za={style:(0,P.defaults)({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},Co.style)};var Ba=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return O(e,t),e.prototype.createStyle=function(t){return(0,P.createObject)(ka,t)},e.prototype._getSize=function(t){var e=this.style,n=e[t];if(null!=n)return n;var i,r=(i=e.image)&&"string"!=typeof i&&i.width&&i.height?e.image:this.__image;if(!r)return 0;var o="width"===t?"height":"width",a=e[o];return null==a?r[t]:r[t]/r[o]*a},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return za},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new Qt(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(Eo);Ba.prototype.type="image";const Fa=Ba;var Ha=Math.round;function Va(t,e,n){if(e){var i=e.x1,r=e.x2,o=e.y1,a=e.y2;t.x1=i,t.x2=r,t.y1=o,t.y2=a;var s=n&&n.lineWidth;return s?(Ha(2*i)===Ha(2*r)&&(t.x1=t.x2=Ua(i,s,!0)),Ha(2*o)===Ha(2*a)&&(t.y1=t.y2=Ua(o,s,!0)),t):t}}function Ga(t,e,n){if(e){var i=e.x,r=e.y,o=e.width,a=e.height;t.x=i,t.y=r,t.width=o,t.height=a;var s=n&&n.lineWidth;return s?(t.x=Ua(i,s,!0),t.y=Ua(r,s,!0),t.width=Math.max(Ua(i+o,s,!1)-t.x,0===o?0:1),t.height=Math.max(Ua(r+a,s,!1)-t.y,0===a?0:1),t):t}}function Ua(t,e,n){if(!e)return t;var i=Ha(2*t);return(i+Ha(e))%2==0?i/2:(i+(n?1:-1))/2}var Wa=function(){this.x=0,this.y=0,this.width=0,this.height=0},ja={},Za=function(t){function e(e){return t.call(this,e)||this}return O(e,t),e.prototype.getDefaultShape=function(){return new Wa},e.prototype.buildPath=function(t,e){var n,i,r,o;if(this.subPixelOptimize){var a=Ga(ja,e,this.style);n=a.x,i=a.y,r=a.width,o=a.height,a.r=e.r,e=a}else n=e.x,i=e.y,r=e.width,o=e.height;e.r?function(t,e){var n,i,r,o,a,s=e.x,l=e.y,u=e.width,h=e.height,c=e.r;u<0&&(s+=u,u=-u),h<0&&(l+=h,h=-h),"number"==typeof c?n=i=r=o=c:c instanceof Array?1===c.length?n=i=r=o=c[0]:2===c.length?(n=r=c[0],i=o=c[1]):3===c.length?(n=c[0],i=o=c[1],r=c[2]):(n=c[0],i=c[1],r=c[2],o=c[3]):n=i=r=o=0,n+i>u&&(n*=u/(a=n+i),i*=u/a),r+o>u&&(r*=u/(a=r+o),o*=u/a),i+r>h&&(i*=h/(a=i+r),r*=h/a),n+o>h&&(n*=h/(a=n+o),o*=h/a),t.moveTo(s+n,l),t.lineTo(s+u-i,l),0!==i&&t.arc(s+u-i,l+i,i,-Math.PI/2,0),t.lineTo(s+u,l+h-r),0!==r&&t.arc(s+u-r,l+h-r,r,0,Math.PI/2),t.lineTo(s+o,l+h),0!==o&&t.arc(s+o,l+h-o,o,Math.PI/2,Math.PI),t.lineTo(s,l+n),0!==n&&t.arc(s+n,l+n,n,Math.PI,1.5*Math.PI)}(t,e):t.rect(n,i,r,o)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(Ea);Za.prototype.type="rect";const Xa=Za;var qa={fill:"#000"},Ya={style:(0,P.defaults)({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},Co.style)},Ka=function(t){function e(e){var n=t.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=qa,n.attr(e),n}return O(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var e=0;ep&&h){var g=Math.floor(p/l);c=c||n.length>g,n=n.slice(0,g)}if(t&&a&&null!=d)for(var m=po(d,o,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),v={},_=0;_0,M=null!=t.width&&("truncate"===t.overflow||"break"===t.overflow||"breakAll"===t.overflow),C=i.calculatedLineHeight,A=0;Al&&xo(n,t.substring(l,u),e,s),xo(n,i[2],e,s,i[1]),l=ho.lastIndex}lo){var L=n.lines.length;w>0?(y.tokens=y.tokens.slice(0,w),v(y,b,x),n.lines=n.lines.slice(0,_+1)):n.lines=n.lines.slice(0,_),n.isTruncated=n.isTruncated||n.lines.length=0&&"right"===(A=y[C]).align;)this._placeToken(A,t,b,p,M,"right",m),w-=A.width,M-=A.width,C--;for(T+=(n-(T-f)-(g-M)-w)/2;S<=C;)A=y[S],this._placeToken(A,t,b,p,T+A.width/2,"center",m),T+=A.width,S++;p+=b}},e.prototype._placeToken=function(t,e,n,i,r,o,a){var s=e.rich[t.styleName]||{};s.text=t.text;var l=t.verticalAlign,u=i+n/2;"top"===l?u=i+t.height/2:"bottom"===l&&(u=i+n-t.height/2),!t.isLineHolder&&ls(s)&&this._renderBackground(s,e,"right"===o?r-t.width:"center"===o?r-t.width/2:r,u-t.height/2,t.width,t.height);var h=!!s.backgroundColor,c=t.textPadding;c&&(r=as(r,o,c),u-=t.height/2-c[0]-t.innerHeight/2);var d=this._getOrCreateChild(Ra),f=d.createStyle();d.useStyle(f);var p=this._defaultStyle,g=!1,m=0,v=os("fill"in s?s.fill:"fill"in e?e.fill:(g=!0,p.fill)),_=rs("stroke"in s?s.stroke:"stroke"in e?e.stroke:h||a||p.autoStroke&&!g?null:(m=2,p.stroke)),y=s.textShadowBlur>0||e.textShadowBlur>0;f.text=t.text,f.x=r,f.y=u,y&&(f.shadowBlur=s.textShadowBlur||e.textShadowBlur||0,f.shadowColor=s.textShadowColor||e.textShadowColor||"transparent",f.shadowOffsetX=s.textShadowOffsetX||e.textShadowOffsetX||0,f.shadowOffsetY=s.textShadowOffsetY||e.textShadowOffsetY||0),f.textAlign=o,f.textBaseline="middle",f.font=t.font||vi.OH,f.opacity=(0,P.retrieve3)(s.opacity,e.opacity,1),es(f,s),_&&(f.lineWidth=(0,P.retrieve3)(s.lineWidth,e.lineWidth,m),f.lineDash=(0,P.retrieve2)(s.lineDash,e.lineDash),f.lineDashOffset=e.lineDashOffset||0,f.stroke=_),v&&(f.fill=v);var x=t.contentWidth,b=t.contentHeight;d.setBoundingRect(new Qt(wi(f.x,x,f.textAlign),Si(f.y,b,f.textBaseline),x,b))},e.prototype._renderBackground=function(t,e,n,i,r,o){var a,s,l,u=t.backgroundColor,h=t.borderWidth,c=t.borderColor,d=u&&u.image,f=u&&!d,p=t.borderRadius,g=this;if(f||t.lineHeight||h&&c){(a=this._getOrCreateChild(Xa)).useStyle(a.createStyle()),a.style.fill=null;var m=a.shape;m.x=n,m.y=i,m.width=r,m.height=o,m.r=p,a.dirtyShape()}if(f)(l=a.style).fill=u||null,l.fillOpacity=(0,P.retrieve2)(t.fillOpacity,1);else if(d){(s=this._getOrCreateChild(Fa)).onload=function(){g.dirtyStyle()};var v=s.style;v.image=u.image,v.x=n,v.y=i,v.width=r,v.height=o}h&&c&&((l=a.style).lineWidth=h,l.stroke=c,l.strokeOpacity=(0,P.retrieve2)(t.strokeOpacity,1),l.lineDash=t.borderDash,l.lineDashOffset=t.borderDashOffset||0,a.strokeContainThreshold=0,a.hasFill()&&a.hasStroke()&&(l.strokeFirst=!0,l.lineWidth*=2));var _=(a||s).style;_.shadowBlur=t.shadowBlur||0,_.shadowColor=t.shadowColor||"transparent",_.shadowOffsetX=t.shadowOffsetX||0,_.shadowOffsetY=t.shadowOffsetY||0,_.opacity=(0,P.retrieve3)(t.opacity,e.opacity,1)},e.makeFont=function(t){var e="";return ns(t)&&(e=[t.fontStyle,t.fontWeight,ts(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),e&&(0,P.trim)(e)||t.textFont||t.font},e}(Eo),Ja={left:!0,right:1,center:1},$a={top:1,bottom:1,middle:1},Qa=["fontStyle","fontWeight","fontSize","fontFamily"];function ts(t){return"string"!=typeof t||-1===t.indexOf("px")&&-1===t.indexOf("rem")&&-1===t.indexOf("em")?isNaN(+t)?vi.gI+"px":t+"px":t}function es(t,e){for(var n=0;n=0,o=!1;if(t instanceof Ea){var a=fs(t),s=r&&a.selectFill||a.normalFill,l=r&&a.selectStroke||a.normalStroke;if(Ts(s)||Ts(l)){var u=(i=i||{}).style||{};"inherit"===u.fill?(o=!0,i=(0,P.extend)({},i),(u=(0,P.extend)({},u)).fill=s):!Ts(u.fill)&&Ts(s)?(o=!0,i=(0,P.extend)({},i),(u=(0,P.extend)({},u)).fill=(0,tn.liftColor)(s)):!Ts(u.stroke)&&Ts(l)&&(o||(i=(0,P.extend)({},i),u=(0,P.extend)({},u)),u.stroke=(0,tn.liftColor)(l)),i.style=u}}if(i&&null==i.z2){o||(i=(0,P.extend)({},i));var h=t.z2EmphasisLift;i.z2=t.z2+(null!=h?h:vs)}return i}(this,0,e,n);if("blur"===t)return function(t,e,n){var i=(0,P.indexOf)(t.currentStates,e)>=0,r=t.style.opacity,o=i?null:function(t,e,n,i){for(var r=t.style,o={},a=0;a0){var o={dataIndex:r,seriesIndex:t.seriesIndex};null!=i&&(o.dataType=i),e.push(o)}}))})),e}function Ks(t,e,n){$s(t,!0),Os(t,Rs),function(t,e,n){var i=hs(t);null!=e?(i.focus=e,i.blurScope=n):i.focus&&(i.focus=null)}(t,e,n)}function Js(t,e,n,i){i?function(t){$s(t,!1)}(t):Ks(t,e,n)}function $s(t,e){var n=!1===e,i=t;t.highDownSilentOnTouch&&(i.__highDownSilentOnTouch=t.highDownSilentOnTouch),n&&!i.__highDownDispatcher||(i.__highByOuter=i.__highByOuter||0,i.__highDownDispatcher=!n)}function Qs(t){return!(!t||!t.__highDownDispatcher)}function tl(t){var e=t.type;return e===bs||e===ws||e===Ss}function el(t){var e=t.type;return e===ys||e===xs}var nl=Fr();function il(t,e,n,i,r,o,a){var s,l=!1;(0,P.isFunction)(r)?(a=o,o=r,r=null):(0,P.isObject)(r)&&(o=r.cb,a=r.during,l=r.isFrom,s=r.removeOpt,r=r.dataIndex);var u="leave"===t;u||e.stopAnimation("leave");var h=function(t,e,n,i,r){var o;if(e&&e.ecModel){var a=e.ecModel.getUpdatePayload();o=a&&a.animation}var s="update"===t;if(e&&e.isAnimationEnabled()){var l=void 0,u=void 0,h=void 0;return i?(l=(0,P.retrieve2)(i.duration,200),u=(0,P.retrieve2)(i.easing,"cubicOut"),h=0):(l=e.getShallow(s?"animationDurationUpdate":"animationDuration"),u=e.getShallow(s?"animationEasingUpdate":"animationEasing"),h=e.getShallow(s?"animationDelayUpdate":"animationDelay")),o&&(null!=o.duration&&(l=o.duration),null!=o.easing&&(u=o.easing),null!=o.delay&&(h=o.delay)),(0,P.isFunction)(h)&&(h=h(n,r)),(0,P.isFunction)(l)&&(l=l(n)),{duration:l||0,delay:h,easing:u}}return null}(t,i,r,u?s||{}:null,i&&i.getAnimationDelayParams?i.getAnimationDelayParams(e,r):null);if(h&&h.duration>0){var c={duration:h.duration,delay:h.delay||0,easing:h.easing,done:o,force:!!o||!!a,setToFinal:!u,scope:t,during:a};l?e.animateFrom(n,c):e.animateTo(n,c)}else e.stopAnimation(),!l&&e.attr(n),a&&a(1),o&&o()}function rl(t,e,n,i,r,o){il("update",t,e,n,i,r,o)}function ol(t,e,n,i,r,o){il("enter",t,e,n,i,r,o)}function al(t){if(!t.__zr)return!0;for(var e=0;e-1?Hl:Gl;function Zl(t,e){t=t.toUpperCase(),Wl[t]=new zl(e),Ul[t]=e}Zl(Vl,{time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}}),Zl(Hl,{time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}});var Xl=1e3,ql=6e4,Yl=36e5,Kl=864e5,Jl=31536e6,$l={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},Ql="{yyyy}-{MM}-{dd}",tu={year:"{yyyy}",month:"{yyyy}-{MM}",day:Ql,hour:Ql+" "+$l.hour,minute:Ql+" "+$l.minute,second:Ql+" "+$l.second,millisecond:$l.none},eu=["year","month","day","hour","minute","second","millisecond"],nu=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function iu(t,e){return"0000".substr(0,e-(t+="").length)+t}function ru(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return t}}function ou(t){return t===ru(t)}function au(t,e,n,i){var r=fr(t),o=r[uu(n)](),a=r[hu(n)]()+1,s=Math.floor((a-1)/3)+1,l=r[cu(n)](),u=r["get"+(n?"UTC":"")+"Day"](),h=r[du(n)](),c=(h-1)%12+1,d=r[fu(n)](),f=r[pu(n)](),p=r[gu(n)](),g=h>=12?"pm":"am",m=g.toUpperCase(),v=i instanceof zl?i:function(t){return Wl[t]}(i||jl)||Wl[Gl],_=v.getModel("time"),y=_.get("month"),x=_.get("monthAbbr"),b=_.get("dayOfWeek"),w=_.get("dayOfWeekAbbr");return(e||"").replace(/{a}/g,g+"").replace(/{A}/g,m+"").replace(/{yyyy}/g,o+"").replace(/{yy}/g,iu(o%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,y[a-1]).replace(/{MMM}/g,x[a-1]).replace(/{MM}/g,iu(a,2)).replace(/{M}/g,a+"").replace(/{dd}/g,iu(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,b[u]).replace(/{ee}/g,w[u]).replace(/{e}/g,u+"").replace(/{HH}/g,iu(h,2)).replace(/{H}/g,h+"").replace(/{hh}/g,iu(c+"",2)).replace(/{h}/g,c+"").replace(/{mm}/g,iu(d,2)).replace(/{m}/g,d+"").replace(/{ss}/g,iu(f,2)).replace(/{s}/g,f+"").replace(/{SSS}/g,iu(p,3)).replace(/{S}/g,p+"")}function su(t,e){var n=fr(t),i=n[hu(e)]()+1,r=n[cu(e)](),o=n[du(e)](),a=n[fu(e)](),s=n[pu(e)](),l=0===n[gu(e)](),u=l&&0===s,h=u&&0===a,c=h&&0===o,d=c&&1===r;return d&&1===i?"year":d?"month":c?"day":h?"hour":u?"minute":l?"second":"millisecond"}function lu(t,e,n){var i=P.isNumber(t)?fr(t):t;switch(e=e||su(t,n)){case"year":return i[uu(n)]();case"half-year":return i[hu(n)]()>=6?1:0;case"quarter":return Math.floor((i[hu(n)]()+1)/4);case"month":return i[hu(n)]();case"day":return i[cu(n)]();case"half-day":return i[du(n)]()/24;case"hour":return i[du(n)]();case"minute":return i[fu(n)]();case"second":return i[pu(n)]();case"millisecond":return i[gu(n)]()}}function uu(t){return t?"getUTCFullYear":"getFullYear"}function hu(t){return t?"getUTCMonth":"getMonth"}function cu(t){return t?"getUTCDate":"getDate"}function du(t){return t?"getUTCHours":"getHours"}function fu(t){return t?"getUTCMinutes":"getMinutes"}function pu(t){return t?"getUTCSeconds":"getSeconds"}function gu(t){return t?"getUTCMilliseconds":"getMilliseconds"}function mu(t){return t?"setUTCFullYear":"setFullYear"}function vu(t){return t?"setUTCMonth":"setMonth"}function _u(t){return t?"setUTCDate":"setDate"}function yu(t){return t?"setUTCHours":"setHours"}function xu(t){return t?"setUTCMinutes":"setMinutes"}function bu(t){return t?"setUTCSeconds":"setSeconds"}function wu(t){return t?"setUTCMilliseconds":"setMilliseconds"}function Su(t){if(!xr(t))return P.isString(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function Tu(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()})),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}var Mu=P.normalizeCssArray;function Cu(t,e,n){function i(t){return t&&P.trim(t)?t:"-"}function r(t){return!(null==t||isNaN(t)||!isFinite(t))}var o="time"===e,a=t instanceof Date;if(o||a){var s=o?fr(t):t;if(!isNaN(+s))return au(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n);if(a)return"-"}if("ordinal"===e)return P.isStringSafe(t)?i(t):P.isNumber(t)&&r(t)?t+"":"-";var l=yr(t);return r(l)?Su(l):P.isStringSafe(t)?i(t):"boolean"==typeof t?t+"":"-"}var Au=["a","b","c","d","e","f","g"],Lu=function(t,e){return"{"+t+(null==e?"":e)+"}"};function Du(t,e,n){P.isArray(e)||(e=[e]);var i=e.length;if(!i)return"";for(var r=e[0].$vars||[],o=0;o':'':{renderMode:o,content:"{"+(n.markerId||"markerX")+"|} ",style:"subItem"===r?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}:""}function Pu(t,e,n){"week"!==t&&"month"!==t&&"quarter"!==t&&"half-year"!==t&&"year"!==t||(t="MM-dd\nyyyy");var i=fr(e),r=n?"getUTC":"get",o=i[r+"FullYear"](),a=i[r+"Month"]()+1,s=i[r+"Date"](),l=i[r+"Hours"](),u=i[r+"Minutes"](),h=i[r+"Seconds"](),c=i[r+"Milliseconds"]();return t=t.replace("MM",iu(a,2)).replace("M",a).replace("yyyy",o).replace("yy",iu(o%100+"",2)).replace("dd",iu(s,2)).replace("d",s).replace("hh",iu(l,2)).replace("h",l).replace("mm",iu(u,2)).replace("m",u).replace("ss",iu(h,2)).replace("s",h).replace("SSS",iu(c,3))}function Eu(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t}function Ou(t,e){return e=e||"transparent",P.isString(t)?t:P.isObject(t)&&t.colorStops&&(t.colorStops[0]||{}).color||e}function Nu(t,e){if("_blank"===e||"blank"===e){var n=window.open();n.opener=null,n.location.href=t}else window.open(t,e)}var Ru=P.each,ku=["left","right","top","bottom","width","height"],zu=[["width","left","right"],["height","top","bottom"]];function Bu(t,e,n,i,r){var o=0,a=0;null==i&&(i=1/0),null==r&&(r=1/0);var s=0;e.eachChild((function(l,u){var h,c,d=l.getBoundingRect(),f=e.childAt(u+1),p=f&&f.getBoundingRect();if("horizontal"===t){var g=d.width+(p?-p.x+d.x:0);(h=o+g)>i||l.newline?(o=0,h=g,a+=s+n,s=d.height):s=Math.max(s,d.height)}else{var m=d.height+(p?-p.y+d.y:0);(c=a+m)>r||l.newline?(o+=s+n,a=0,c=m,s=d.width):s=Math.max(s,d.width)}l.newline||(l.x=o,l.y=a,l.markRedraw(),"horizontal"===t?o=h+n:a=c+n)}))}var Fu=Bu;P.curry(Bu,"vertical"),P.curry(Bu,"horizontal");function Hu(t,e,n){n=Mu(n||0);var i=e.width,r=e.height,o=er(t.left,i),a=er(t.top,r),s=er(t.right,i),l=er(t.bottom,r),u=er(t.width,i),h=er(t.height,r),c=n[2]+n[0],d=n[1]+n[3],f=t.aspect;switch(isNaN(u)&&(u=i-s-d-o),isNaN(h)&&(h=r-l-c-a),null!=f&&(isNaN(u)&&isNaN(h)&&(f>i/r?u=.8*i:h=.8*r),isNaN(u)&&(u=f*h),isNaN(h)&&(h=u/f)),isNaN(o)&&(o=i-s-u-d),isNaN(a)&&(a=r-l-h-c),t.left||t.right){case"center":o=i/2-u/2-n[3];break;case"right":o=i-u-d}switch(t.top||t.bottom){case"middle":case"center":a=r/2-h/2-n[0];break;case"bottom":a=r-h-c}o=o||0,a=a||0,isNaN(u)&&(u=i-d-o-(s||0)),isNaN(h)&&(h=r-c-a-(l||0));var p=new Qt(o+n[3],a+n[0],u,h);return p.margin=n,p}function Vu(t){var e=t.layoutMode||t.constructor.layoutMode;return P.isObject(e)?e:e?{type:e}:null}function Gu(t,e,n){var i=n&&n.ignoreSize;!P.isArray(i)&&(i=[i,i]);var r=a(zu[0],0),o=a(zu[1],1);function a(n,r){var o={},a=0,u={},h=0;if(Ru(n,(function(e){u[e]=t[e]})),Ru(n,(function(t){s(e,t)&&(o[t]=u[t]=e[t]),l(o,t)&&a++,l(u,t)&&h++})),i[r])return l(e,n[1])?u[n[2]]=null:l(e,n[2])&&(u[n[1]]=null),u;if(2!==h&&a){if(a>=2)return o;for(var c=0;c=0;a--)o=P.merge(o,n[a],!0);e.defaultOption=o}return e.defaultOption},e.prototype.getReferringComponents=function(t,e){var n=t+"Index",i=t+"Id";return jr(this.ecModel,t,{index:this.get(n,!0),id:this.get(i,!0)},e)},e.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(t){this.option.zlevel=t},e.protoInitialize=function(){var t=e.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),e}(zl);Jr(ju,zl),eo(ju),function(t){var e={};t.registerSubTypeDefaulter=function(t,n){var i=Yr(t);e[i.main]=n},t.determineSubType=function(n,i){var r=i.type;if(!r){var o=Yr(n).main;t.hasSubTypes(n)&&e[o]&&(r=e[o](i))}return r}}(ju),function(t,e){function n(t,e){return t[e]||(t[e]={predecessor:[],successor:[]}),t[e]}t.topologicalTravel=function(t,i,r,o){if(t.length){var a=function(t){var i={},r=[];return P.each(t,(function(o){var a=n(i,o),s=function(t,e){var n=[];return P.each(t,(function(t){P.indexOf(e,t)>=0&&n.push(t)})),n}(a.originalDeps=e(o),t);a.entryCount=s.length,0===a.entryCount&&r.push(o),P.each(s,(function(t){P.indexOf(a.predecessor,t)<0&&a.predecessor.push(t);var e=n(i,t);P.indexOf(e.successor,t)<0&&e.successor.push(o)}))})),{graph:i,noEntryList:r}}(i),s=a.graph,l=a.noEntryList,u={};for(P.each(t,(function(t){u[t]=!0}));l.length;){var h=l.pop(),c=s[h],d=!!u[h];d&&(r.call(o,h,c.originalDeps.slice()),delete u[h]),P.each(c.successor,d?p:f)}P.each(u,(function(){throw new Error("")}))}function f(t){s[t].entryCount--,0===s[t].entryCount&&l.push(t)}function p(t){u[t]=!0,f(t)}}}(ju,(function(t){var e=[];P.each(ju.getClassesByMainType(t),(function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])})),e=P.map(e,(function(t){return Yr(t).main})),"dataset"!==t&&P.indexOf(e,"dataset")<=0&&e.unshift("dataset");return e}));const Zu=ju;var Xu="";"undefined"!=typeof navigator&&(Xu=navigator.platform||"");var qu="rgba(0, 0, 0, 0.2)";const Yu={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:qu,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:qu,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:qu,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:qu,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:qu,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:qu,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:Xu.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var Ku=(0,P.createHashMap)(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),Ju="original",$u="arrayRows",Qu="objectRows",th="keyedColumns",eh="typedArray",nh="unknown",ih="column",rh="row",oh={Must:1,Might:2,Not:3},ah=Fr();function sh(t,e,n){var i={},r=lh(e);if(!r||!t)return i;var o,a,s=[],l=[],u=e.ecModel,h=ah(u).datasetMap,c=r.uid+"_"+n.seriesLayoutBy;t=t.slice(),(0,P.each)(t,(function(e,n){var r=(0,P.isObject)(e)?e:t[n]={name:e};"ordinal"===r.type&&null==o&&(o=n,a=p(r)),i[r.name]=[]}));var d=h.get(c)||h.set(c,{categoryWayDim:a,valueWayDim:0});function f(t,e,n){for(var i=0;ie)return t[i];return t[n-1]}(i,a):n;if((h=h||n)&&h.length){var c=h[l];return r&&(u[r]=c),s.paletteIdx=(l+1)%h.length,c}}var _h="\0_ec_inner";var yh=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return D(e,t),e.prototype.init=function(t,e,n,i,r,o){i=i||{},this.option=null,this._theme=new zl(i),this._locale=new zl(r),this._optionManager=o},e.prototype.setOption=function(t,e,n){var i=wh(e);this._optionManager.setOption(t,n,i),this._resetOption(null,i)},e.prototype.resetOption=function(t,e){return this._resetOption(t,wh(e))},e.prototype._resetOption=function(t,e){var n=!1,i=this._optionManager;if(!t||"recreate"===t){var r=i.mountOption("recreate"===t);0,this.option&&"recreate"!==t?(this.restoreData(),this._mergeOption(r,e)):ph(this,r),n=!0}if("timeline"!==t&&"media"!==t||this.restoreData(),!t||"recreate"===t||"timeline"===t){var o=i.getTimelineOption(this);o&&(n=!0,this._mergeOption(o,e))}if(!t||"recreate"===t||"media"===t){var a=i.getMediaOption(this);a.length&&(0,P.each)(a,(function(t){n=!0,this._mergeOption(t,e)}),this)}return n},e.prototype.mergeOption=function(t){this._mergeOption(t,null)},e.prototype._mergeOption=function(t,e){var n=this.option,i=this._componentsMap,r=this._componentsCount,o=[],a=(0,P.createHashMap)(),s=e&&e.replaceMergeMainTypeMap;ah(this).datasetMap=(0,P.createHashMap)(),(0,P.each)(t,(function(t,e){null!=t&&(Zu.hasClass(e)?e&&(o.push(e),a.set(e,!0)):n[e]=null==n[e]?(0,P.clone)(t):(0,P.merge)(n[e],t,!0))})),s&&s.each((function(t,e){Zu.hasClass(e)&&!a.get(e)&&(o.push(e),a.set(e,!0))})),Zu.topologicalTravel(o,Zu.getAllClassMainTypes(),(function(e){var o=function(t,e,n){var i=ch.get(e);if(!i)return n;var r=i(t);return r?n.concat(r):n}(this,e,Ar(t[e])),a=i.get(e),l=a?s&&s.get(e)?"replaceMerge":"normalMerge":"replaceAll",u=Er(a,o,l);(function(t,e,n){(0,P.each)(t,(function(t){var i=t.newOption;(0,P.isObject)(i)&&(t.keyInfo.mainType=e,t.keyInfo.subType=function(t,e,n,i){return e.type?e.type:n?n.subType:i.determineSubType(t,e)}(e,i,t.existing,n))}))})(u,e,Zu),n[e]=null,i.set(e,null),r.set(e,0);var h,c=[],d=[],f=0;(0,P.each)(u,(function(t,n){var i=t.existing,r=t.newOption;if(r){var o="series"===e,a=Zu.getClass(e,t.keyInfo.subType,!o);if(!a)return;if("tooltip"===e){if(h)return void 0;h=!0}if(i&&i.constructor===a)i.name=t.keyInfo.name,i.mergeOption(r,this),i.optionUpdated(r,!1);else{var s=(0,P.extend)({componentIndex:n},t.keyInfo);i=new a(r,this,this,s),(0,P.extend)(i,s),t.brandNew&&(i.__requireNewView=!0),i.init(r,this,this),i.optionUpdated(null,!0)}}else i&&(i.mergeOption({},this),i.optionUpdated({},!1));i?(c.push(i.option),d.push(i),f++):(c.push(void 0),d.push(void 0))}),this),n[e]=c,i.set(e,d),r.set(e,f),"series"===e&&dh(this)}),this),this._seriesIndices||dh(this)},e.prototype.getOption=function(){var t=(0,P.clone)(this.option);return(0,P.each)(t,(function(e,n){if(Zu.hasClass(n)){for(var i=Ar(e),r=i.length,o=!1,a=r-1;a>=0;a--)i[a]&&!zr(i[a])?o=!0:(i[a]=null,!o&&r--);i.length=r,t[n]=i}})),delete t[_h],t},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(t){this._payload=t},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(t,e){var n=this._componentsMap.get(t);if(n){var i=n[e||0];if(i)return i;if(null==e)for(var r=0;r=e:"max"===n?t<=e:t===e})(i[a],t,o)||(r=!1)}})),r}const Eh=Ih;var Oh=P.each,Nh=P.isObject,Rh=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function kh(t){var e=t&&t.itemStyle;if(e)for(var n=0,i=Rh.length;n=0;g--){var m=t[g];if(s||(d=m.data.rawIndexOf(m.stackedByDimension,c)),d>=0){var v=m.data.getByRawIndex(m.stackResultDimension,d);if("all"===l||"positive"===l&&v>0||"negative"===l&&v<0||"samesign"===l&&f>=0&&v>0||"samesign"===l&&f<=0&&v<0){f=lr(f,v),p=v;break}}}return i[0]=f,i[1]=p,i}))}))}var tc,ec,nc,ic,rc,oc=function(t){this.data=t.data||(t.sourceFormat===th?{}:[]),this.sourceFormat=t.sourceFormat||nh,this.seriesLayoutBy=t.seriesLayoutBy||ih,this.startIndex=t.startIndex||0,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.metaRawOption=t.metaRawOption;var e=this.dimensionsDefine=t.dimensionsDefine;if(e)for(var n=0;nu&&(u=f)}s[0]=l,s[1]=u}},i=function(){return this._data?this._data.length/this._dimSize:0};function r(t){for(var e=0;e=0&&(s=o.interpolatedValue[l])}return null!=s?s+"":""})):void 0},t.prototype.getRawValue=function(t,e){return Tc(this.getData(e),t)},t.prototype.formatTooltip=function(t,e,n){},t}();function Ac(t){var e,n;return P.isObject(t)?t.type&&(n=t):e=t,{text:e,frag:n}}function Lc(t){return new Dc(t)}var Dc=function(){function t(t){t=t||{},this._reset=t.reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0}return t.prototype.perform=function(t){var e,n=this._upstream,i=t&&t.skip;if(this._dirty&&n){var r=this.context;r.data=r.outputData=n.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this),this._plan&&!i&&(e=this._plan(this.context));var o,a=h(this._modBy),s=this._modDataCount||0,l=h(t&&t.modBy),u=t&&t.modDataCount||0;function h(t){return!(t>=1)&&(t=1),t}a===l&&s===u||(e="reset"),(this._dirty||"reset"===e)&&(this._dirty=!1,o=this._doReset(i)),this._modBy=l,this._modDataCount=u;var c=t&&t.step;if(this._dueEnd=n?n._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var d=this._dueIndex,f=Math.min(null!=c?this._dueIndex+c:1/0,this._dueEnd);if(!i&&(o||d1&&i>0?s:a}};return o;function a(){return e=t?null:oe},gte:function(t,e){return t>=e}},Rc=(function(){function t(t,e){if(!(0,P.isNumber)(e)){0,Ec("")}this._opFn=Nc[t],this._rvalFloat=yr(e)}t.prototype.evaluate=function(t){return(0,P.isNumber)(t)?this._opFn(t,this._rvalFloat):this._opFn(yr(t),this._rvalFloat)}}(),function(){function t(t,e){var n="desc"===t;this._resultLT=n?1:-1,null==e&&(e=n?"min":"max"),this._incomparable="min"===e?-1/0:1/0}return t.prototype.evaluate=function(t,e){var n=(0,P.isNumber)(t)?t:yr(t),i=(0,P.isNumber)(e)?e:yr(e),r=isNaN(n),o=isNaN(i);if(r&&(n=this._incomparable),o&&(i=this._incomparable),r&&o){var a=(0,P.isString)(t),s=(0,P.isString)(e);a&&(n=s?t:0),s&&(i=a?e:0)}return ni?-this._resultLT:0},t}());!function(){function t(t,e){this._rval=e,this._isEQ=t,this._rvalTypeof=typeof e,this._rvalFloat=yr(e)}t.prototype.evaluate=function(t){var e=t===this._rval;if(!e){var n=typeof t;n===this._rvalTypeof||"number"!==n&&"number"!==this._rvalTypeof||(e=yr(t)===this._rvalFloat)}return this._isEQ?e:!e}}();var kc=function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(t){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(t){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(t,e){},t.prototype.retrieveValueFromItem=function(t,e){},t.prototype.convertValue=function(t,e){return Oc(t,e)},t}();function zc(t){if(!Uc(t.sourceFormat)){0,Ec("")}return t.data}function Bc(t){var e=t.sourceFormat,n=t.data;if(!Uc(e)){0,Ec("")}if(e===$u){for(var i=[],r=0,o=n.length;r65535?Zc:Xc}function $c(t,e,n,i,r){var o=Kc[n||"float"];if(r){var a=t[e],s=a&&a.length;if(s!==i){for(var l=new o(i),u=0;ug[1]&&(g[1]=p)}return this._rawCount=this._count=s,{start:a,end:s}},t.prototype._initDataFromProvider=function(t,e,n){for(var i=this._provider,r=this._chunks,o=this._dimensions,a=o.length,s=this._rawExtent,l=(0,P.map)(o,(function(t){return t.property})),u=0;um[1]&&(m[1]=g)}}!i.persistent&&i.clean&&i.clean(),this._rawCount=this._count=e,this._extent=[]},t.prototype.count=function(){return this._count},t.prototype.get=function(t,e){if(!(e>=0&&e=0&&e=this._rawCount||t<0)return-1;if(!this._indices)return t;var e=this._indices,n=e[t];if(null!=n&&nt))return o;r=o-1}}return-1},t.prototype.indicesOfNearest=function(t,e,n){var i=this._chunks[t],r=[];if(!i)return r;null==n&&(n=1/0);for(var o=1/0,a=-1,s=0,l=0,u=this.count();l=0&&a<0)&&(o=c,a=h,s=0),h===a&&(r[s++]=l))}return r.length=s,r},t.prototype.getIndices=function(){var t,e=this._indices;if(e){var n=e.constructor,i=this._count;if(n===Array){t=new n(i);for(var r=0;r=u&&y<=h||isNaN(y))&&(a[s++]=f),f++}d=!0}else if(2===r){p=c[i[0]];var m=c[i[1]],v=t[i[1]][0],_=t[i[1]][1];for(g=0;g=u&&y<=h||isNaN(y))&&(x>=v&&x<=_||isNaN(x))&&(a[s++]=f),f++}d=!0}}if(!d)if(1===r)for(g=0;g=u&&y<=h||isNaN(y))&&(a[s++]=b)}else for(g=0;gt[T][1])&&(w=!1)}w&&(a[s++]=e.getRawIndex(g))}return sm[1]&&(m[1]=g)}}}},t.prototype.lttbDownSample=function(t,e){var n,i,r,o=this.clone([t],!0),a=o._chunks[t],s=this.count(),l=0,u=Math.floor(1/e),h=this.getRawIndex(0),c=new(Jc(this._rawCount))(Math.min(2*(Math.ceil(s/u)+2),s));c[l++]=h;for(var d=1;dn&&(n=i,r=M)}T>0&&Ta&&(p=a-u);for(var g=0;gf&&(f=m,d=u+g)}var v=this.getRawIndex(h),_=this.getRawIndex(d);hu-f&&(s=u-f,a.length=s);for(var p=0;ph[1]&&(h[1]=m),c[d++]=v}return r._count=d,r._indices=c,r._updateGetRawIdx(),r},t.prototype.each=function(t,e){if(this._count)for(var n=t.length,i=this._chunks,r=0,o=this.count();ra&&(a=l)}return i=[o,a],this._extent[t]=i,i},t.prototype.getRawDataItem=function(t){var e=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(e);for(var n=[],i=this._chunks,r=0;r=0?this._indices[t]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=function(){function t(t,e,n,i){return Oc(t[i],this._dimensions[i])}Wc={arrayRows:t,objectRows:function(t,e,n,i){return Oc(t[e],this._dimensions[i])},keyedColumns:t,original:function(t,e,n,i){var r=t&&(null==t.value?t:t.value);return Oc(r instanceof Array?r[i]:r,this._dimensions[i])},typedArray:function(t,e,n,i){return t[i]}}}(),t}();const td=Qc;var ed=function(){function t(t){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t}return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(t,e){this._sourceList=t,this._upstreamSignList=e,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var t,e,n=this._sourceHost,i=this._getUpstreamSourceManagers(),r=!!i.length;if(id(n)){var o=n,a=void 0,s=void 0,l=void 0;if(r){var u=i[0];u.prepareSource(),a=(l=u.getSource()).data,s=l.sourceFormat,e=[u._getVersionSign()]}else a=o.get("data",!0),s=(0,P.isTypedArray)(a)?eh:Ju,e=[];var h=this._getSourceMetaRawOption()||{},c=l&&l.metaRawOption||{},d=(0,P.retrieve2)(h.seriesLayoutBy,c.seriesLayoutBy)||null,f=(0,P.retrieve2)(h.sourceHeader,c.sourceHeader),p=(0,P.retrieve2)(h.dimensions,c.dimensions);t=d!==c.seriesLayoutBy||!!f!=!!c.sourceHeader||p?[sc(a,{seriesLayoutBy:d,sourceHeader:f,dimensions:p},s)]:[]}else{var g=n;if(r){var m=this._applyTransform(i);t=m.sourceList,e=m.upstreamSignList}else{t=[sc(g.get("source",!0),this._getSourceMetaRawOption(),null)],e=[]}}this._setLocalSource(t,e)},t.prototype._applyTransform=function(t){var e,n=this._sourceHost,i=n.get("transform",!0),r=n.get("fromTransformResult",!0);if(null!=r){1!==t.length&&rd("")}var o,a=[],s=[];return(0,P.each)(t,(function(t){t.prepareSource();var e=t.getSource(r||0);null==r||e||rd(""),a.push(e),s.push(t._getVersionSign())})),i?e=function(t,e){var n=Ar(t),i=n.length;i||Ec("");for(var r=0,o=i;r1||n>0&&!t.noHeader;return(0,P.each)(t.blocks,(function(t){var n=dd(t);n>=e&&(e=n+ +(i&&(!n||hd(t)&&!t.noHeader)))})),e}return 0}function fd(t,e,n,i){var r,o=e.noHeader,a=(r=dd(e),{html:sd[r],richText:ld[r]}),s=[],l=e.blocks||[];(0,P.assert)(!l||(0,P.isArray)(l)),l=l||[];var u=t.orderMode;if(e.sortBlocks&&u){l=l.slice();var h={valueAsc:"asc",valueDesc:"desc"};if((0,P.hasOwn)(h,u)){var c=new Rc(h[u],null);l.sort((function(t,e){return c.evaluate(t.sortParam,e.sortParam)}))}else"seriesDesc"===u&&l.reverse()}(0,P.each)(l,(function(n,r){var o=e.valueFormatter,l=cd(n)(o?(0,P.extend)((0,P.extend)({},t),{valueFormatter:o}):t,n,r>0?a.html:0,i);null!=l&&s.push(l)}));var d="richText"===t.renderMode?s.join(a.richText):md(i,s.join(""),o?n:a.html);if(o)return d;var f=Cu(e.header,"ordinal",t.useUTC),p=ad(i,t.renderMode).nameStyle,g=od(i);return"richText"===t.renderMode?vd(t,f,p)+a.richText+d:md(i,'
'+yt(f)+"
"+d,n)}function pd(t,e,n,i){var r=t.renderMode,o=e.noName,a=e.noValue,s=!e.markerType,l=e.name,u=t.useUTC,h=e.valueFormatter||t.valueFormatter||function(t){return t=(0,P.isArray)(t)?t:[t],(0,P.map)(t,(function(t,e){return Cu(t,(0,P.isArray)(f)?f[e]:f,u)}))};if(!o||!a){var c=s?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",r),d=o?"":Cu(l,"ordinal",u),f=e.valueType,p=a?[]:h(e.value,e.dataIndex),g=!s||!o,m=!s&&o,v=ad(i,r),_=v.nameStyle,y=v.valueStyle;return"richText"===r?(s?"":c)+(o?"":vd(t,d,_))+(a?"":function(t,e,n,i,r){var o=[r],a=i?10:20;return n&&o.push({padding:[0,0,0,a],align:"right"}),t.markupStyleCreator.wrapRichTextStyle((0,P.isArray)(e)?e.join(" "):e,o)}(t,p,g,m,y)):md(i,(s?"":c)+(o?"":function(t,e,n){return''+yt(t)+""}(d,!s,_))+(a?"":function(t,e,n,i){var r=n?"10px":"20px",o=e?"float:right;margin-left:"+r:"";return t=(0,P.isArray)(t)?t:[t],''+(0,P.map)(t,(function(t){return yt(t)})).join("  ")+""}(p,g,m,y)),n)}}function gd(t,e,n,i,r,o){if(t)return cd(t)({useUTC:r,renderMode:n,orderMode:i,markupStyleCreator:e,valueFormatter:t.valueFormatter},t,0,o)}function md(t,e,n){return'
'+e+'
'}function vd(t,e,n){return t.markupStyleCreator.wrapRichTextStyle(e,n)}function _d(t,e){var n=t.get("padding");return null!=n?n:"richText"===e?[8,10]:10}var yd=function(){function t(){this.richTextStyles={},this._nextStyleNameId=br()}return t.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},t.prototype.makeTooltipMarker=function(t,e,n){var i="richText"===n?this._generateStyleName():null,r=Iu({color:e,type:t,renderMode:n,markerId:i});return(0,P.isString)(r)?r:(this.richTextStyles[i]=r.style,r.content)},t.prototype.wrapRichTextStyle=function(t,e){var n={};(0,P.isArray)(e)?(0,P.each)(e,(function(t){return(0,P.extend)(n,t)})):(0,P.extend)(n,e);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+t+"}"},t}();function xd(t){var e,n,i,r,o=t.series,a=t.dataIndex,s=t.multipleSeries,l=o.getData(),u=l.mapDimensionsAll("defaultedTooltip"),h=u.length,c=o.getRawValue(a),d=(0,P.isArray)(c),f=function(t,e){return Ou(t.getData().getItemVisual(e,"style")[t.visualDrawType])}(o,a);if(h>1||d&&!h){var p=function(t,e,n,i,r){var o=e.getData(),a=(0,P.reduce)(t,(function(t,e,n){var i=o.getDimensionInfo(n);return t||i&&!1!==i.tooltip&&null!=i.displayName}),!1),s=[],l=[],u=[];function h(t,e){var n=o.getDimensionInfo(e);n&&!1!==n.otherDims.tooltip&&(a?u.push(ud("nameValue",{markerType:"subItem",markerColor:r,name:n.displayName,value:t,valueType:n.type})):(s.push(t),l.push(n.type)))}return i.length?(0,P.each)(i,(function(t){h(Tc(o,n,t),t)})):(0,P.each)(t,h),{inlineValues:s,inlineValueTypes:l,blocks:u}}(c,o,a,u,f);e=p.inlineValues,n=p.inlineValueTypes,i=p.blocks,r=p.inlineValues[0]}else if(h){var g=l.getDimensionInfo(u[0]);r=e=Tc(l,a,u[0]),n=g.type}else r=e=d?c[0]:c;var m=kr(o),v=m&&o.name||"",_=l.getName(a),y=s?v:_;return ud("section",{header:v,noHeader:s||!m,sortParam:r,blocks:[ud("nameValue",{markerType:"item",markerColor:f,name:y,noName:!(0,P.trim)(y),value:e,valueType:n,dataIndex:a})].concat(i||[])})}var bd=Fr();function wd(t,e){return t.getName(e)||t.getId(e)}var Sd=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectedDataIndicesMap={},e}return D(e,t),e.prototype.init=function(t,e,n){this.seriesIndex=this.componentIndex,this.dataTask=Lc({count:Md,reset:Cd}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n),(bd(this).sourceManager=new ed(this)).prepareSource();var i=this.getInitialData(t,n);Ld(i,this),this.dataTask.context.data=i,bd(this).dataBeforeProcessed=i,Td(this),this._initSelectedMapFromData(i)},e.prototype.mergeDefaultAndTheme=function(t,e){var n=Vu(this),i=n?Uu(t):{},r=this.subType;Zu.hasClass(r)&&(r+="Series"),P.merge(t,e.getTheme().get(this.subType)),P.merge(t,this.getDefaultOption()),Lr(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&Gu(t,i,n)},e.prototype.mergeOption=function(t,e){t=P.merge(this.option,t,!0),this.fillDataTextStyle(t.data);var n=Vu(this);n&&Gu(this.option,t,n);var i=bd(this).sourceManager;i.dirty(),i.prepareSource();var r=this.getInitialData(t,e);Ld(r,this),this.dataTask.dirty(),this.dataTask.context.data=r,bd(this).dataBeforeProcessed=r,Td(this),this._initSelectedMapFromData(r)},e.prototype.fillDataTextStyle=function(t){if(t&&!P.isTypedArray(t))for(var e=["show"],n=0;nthis.getShallow("animationThreshold")&&(e=!1),!!e},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(t,e,n){var i=this.ecModel,r=mh.prototype.getColorFromPalette.call(this,t,e,n);return r||(r=i.getColorFromPalette(t,e,n)),r},e.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(t,e){this._innerSelect(this.getData(e),t)},e.prototype.unselect=function(t,e){var n=this.option.selectedMap;if(n){var i=this.option.selectedMode,r=this.getData(e);if("series"===i||"all"===n)return this.option.selectedMap={},void(this._selectedDataIndicesMap={});for(var o=0;o=0&&n.push(r)}return n},e.prototype.isSelected=function(t,e){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(e);return("all"===n||n[wd(i,t)])&&!i.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var t=this.option.universalTransition;return!!t&&(!0===t||t&&t.enabled)},e.prototype._innerSelect=function(t,e){var n,i,r=this.option,o=r.selectedMode,a=e.length;if(o&&a)if("series"===o)r.selectedMap="all";else if("multiple"===o){P.isObject(r.selectedMap)||(r.selectedMap={});for(var s=r.selectedMap,l=0;l0&&this._innerSelect(t,e)}},e.registerClass=function(t){return Zu.registerClass(t)},e.protoInitialize=function(){var t=e.prototype;t.type="series.__base__",t.seriesIndex=0,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle",t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),e}(Zu);function Td(t){var e=t.name;kr(t)||(t.name=function(t){var e=t.getRawData(),n=e.mapDimensionsAll("seriesName"),i=[];return P.each(n,(function(t){var n=e.getDimensionInfo(t);n.displayName&&i.push(n.displayName)})),i.join(" ")}(t)||e)}function Md(t){return t.model.getRawData().count()}function Cd(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),Ad}function Ad(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function Ld(t,e){P.each(P.concatArray(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),(function(n){t.wrapMethod(n,P.curry(Dd,e))}))}function Dd(t,e){var n=Id(t);return n&&n.setOutputEnd((e||this).count()),e}function Id(t){var e=(t.ecModel||{}).scheduler,n=e&&e.getPipeline(t.uid);if(n){var i=n.currentTask;if(i){var r=i.agentStubMap;r&&(i=r.get(t.uid))}return i}}P.mixin(Sd,Cc),P.mixin(Sd,mh),Jr(Sd,Zu);const Pd=Sd;var Ed=function(){function t(){this.group=new Fi,this.uid=Fl("viewComponent")}return t.prototype.init=function(t,e){},t.prototype.render=function(t,e,n,i){},t.prototype.dispose=function(t,e){},t.prototype.updateView=function(t,e,n,i){},t.prototype.updateLayout=function(t,e,n,i){},t.prototype.updateVisual=function(t,e,n,i){},t.prototype.toggleBlurSeries=function(t,e,n){},t.prototype.eachRendered=function(t){var e=this.group;e&&e.traverse(t)},t}();Kr(Ed),eo(Ed);const Od=Ed;function Nd(){var t=Fr();return function(e){var n=t(e),i=e.pipelineContext,r=!!n.large,o=!!n.progressiveRender,a=n.large=!(!i||!i.large),s=n.progressiveRender=!(!i||!i.progressiveRender);return!(r===a&&o===s)&&"reset"}}var Rd=ca.CMD,kd=[[],[],[]],zd=Math.sqrt,Bd=Math.atan2;var Fd=Math.sqrt,Hd=Math.sin,Vd=Math.cos,Gd=Math.PI;function Ud(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Wd(t,e){return(t[0]*e[0]+t[1]*e[1])/(Ud(t)*Ud(e))}function jd(t,e){return(t[0]*e[1]1&&(a*=Fd(p),s*=Fd(p));var g=(r===o?-1:1)*Fd((a*a*(s*s)-a*a*(f*f)-s*s*(d*d))/(a*a*(f*f)+s*s*(d*d)))||0,m=g*a*f/s,v=g*-s*d/a,_=(t+n)/2+Vd(c)*m-Hd(c)*v,y=(e+i)/2+Hd(c)*m+Vd(c)*v,x=jd([1,0],[(d-m)/a,(f-v)/s]),b=[(d-m)/a,(f-v)/s],w=[(-1*d-m)/a,(-1*f-v)/s],S=jd(b,w);if(Wd(b,w)<=-1&&(S=Gd),Wd(b,w)>=1&&(S=0),S<0){var T=Math.round(S/Gd*1e6)/1e6;S=2*Gd+T%2*Gd}h.addData(u,_,y,a,s,x,S,c,o)}var Xd=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,qd=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;var Yd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return O(e,t),e.prototype.applyTransform=function(t){},e}(Ea);function Kd(t){return null!=t.setData}function Jd(t,e){var n=function(t){var e=new ca;if(!t)return e;var n,i=0,r=0,o=i,a=r,s=ca.CMD,l=t.match(Xd);if(!l)return e;for(var u=0;uI*I+P*P&&(T=C,M=A),{cx:T,cy:M,x0:-h,y0:-c,x1:T*(r/b-1),y1:M*(r/b-1)}}function vf(t,e){var n,i=ff(e.r,0),r=ff(e.r0||0,0),o=i>0;if(o||r>0){if(o||(i=r,r=0),r>i){var a=i;i=r,r=a}var s=e.startAngle,l=e.endAngle;if(!isNaN(s)&&!isNaN(l)){var u=e.cx,h=e.cy,c=!!e.clockwise,d=cf(l-s),f=d>af&&d%af;if(f>gf&&(d=f),i>gf)if(d>af-gf)t.moveTo(u+i*lf(s),h+i*sf(s)),t.arc(u,h,i,s,l,!c),r>gf&&(t.moveTo(u+r*lf(l),h+r*sf(l)),t.arc(u,h,r,l,s,c));else{var p=void 0,g=void 0,m=void 0,v=void 0,_=void 0,y=void 0,x=void 0,b=void 0,w=void 0,S=void 0,T=void 0,M=void 0,C=void 0,A=void 0,L=void 0,D=void 0,I=i*lf(s),E=i*sf(s),O=r*lf(l),N=r*sf(l),R=d>gf;if(R){var k=e.cornerRadius;k&&(n=function(t){var e;if((0,P.isArray)(t)){var n=t.length;if(!n)return t;e=1===n?[t[0],t[0],0,0]:2===n?[t[0],t[0],t[1],t[1]]:3===n?t.concat(t[2]):t}else e=[t,t,t,t];return e}(k),p=n[0],g=n[1],m=n[2],v=n[3]);var z=cf(i-r)/2;if(_=pf(z,m),y=pf(z,v),x=pf(z,p),b=pf(z,g),T=w=ff(_,y),M=S=ff(x,b),(w>gf||S>gf)&&(C=i*lf(l),A=i*sf(l),L=r*lf(s),D=r*sf(s),dgf){var j=pf(m,T),Z=pf(v,T),X=mf(L,D,I,E,i,j,c),q=mf(C,A,O,N,i,Z,c);t.moveTo(u+X.cx+X.x0,h+X.cy+X.y0),T0&&t.arc(u+X.cx,h+X.cy,j,hf(X.y0,X.x0),hf(X.y1,X.x1),!c),t.arc(u,h,i,hf(X.cy+X.y1,X.cx+X.x1),hf(q.cy+q.y1,q.cx+q.x1),!c),Z>0&&t.arc(u+q.cx,h+q.cy,Z,hf(q.y1,q.x1),hf(q.y0,q.x0),!c))}else t.moveTo(u+I,h+E),t.arc(u,h,i,s,l,!c);else t.moveTo(u+I,h+E);if(r>gf&&R)if(M>gf){j=pf(p,M),X=mf(O,N,C,A,r,-(Z=pf(g,M)),c),q=mf(I,E,L,D,r,-j,c);t.lineTo(u+X.cx+X.x0,h+X.cy+X.y0),M0&&t.arc(u+X.cx,h+X.cy,Z,hf(X.y0,X.x0),hf(X.y1,X.x1),!c),t.arc(u,h,r,hf(X.cy+X.y1,X.cx+X.x1),hf(q.cy+q.y1,q.cx+q.x1),c),j>0&&t.arc(u+q.cx,h+q.cy,j,hf(q.y1,q.x1),hf(q.y0,q.x0),!c))}else t.lineTo(u+O,h+N),t.arc(u,h,r,l,s,c);else t.lineTo(u+O,h+N)}else t.moveTo(u,h);t.closePath()}}}var _f=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0},yf=function(t){function e(e){return t.call(this,e)||this}return O(e,t),e.prototype.getDefaultShape=function(){return new _f},e.prototype.buildPath=function(t,e){vf(t,e)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(Ea);yf.prototype.type="sector";const xf=yf;var bf=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},wf=function(t){function e(e){return t.call(this,e)||this}return O(e,t),e.prototype.getDefaultShape=function(){return new bf},e.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=2*Math.PI;t.moveTo(n+e.r,i),t.arc(n,i,e.r,0,r,!1),t.moveTo(n+e.r0,i),t.arc(n,i,e.r0,0,r,!0)},e}(Ea);wf.prototype.type="ring";const Sf=wf;function Tf(t,e,n){var i=e.smooth,r=e.points;if(r&&r.length>=2){if(i){var o=function(t,e,n,i){var r,o,a,s,l=[],u=[],h=[],c=[];if(i){a=[1/0,1/0],s=[-1/0,-1/0];for(var d=0,f=t.length;d$f[1]){if(a=!1,r)return a;var u=Math.abs($f[0]-Jf[1]),h=Math.abs(Jf[0]-$f[1]);Math.min(u,h)>i.len()&&(uMath.abs(o[1])?o[0]>0?"right":"left":o[1]>0?"bottom":"top"}function Mp(t){return!t.isGroup}function Cp(t,e,n){if(t&&e){var i=function(t){var e={};return t.traverse((function(t){Mp(t)&&t.anid&&(e[t.anid]=t)})),e}(t);e.traverse((function(t){if(Mp(t)&&t.anid){var e=i[t.anid];if(e){var o=r(t);t.attr(r(e)),rl(t,o,n,hs(t).dataIndex)}}}))}function r(t){var e={x:t.x,y:t.y,rotation:t.rotation};return function(t){return null!=t.shape}(t)&&(e.shape=(0,P.extend)({},t.shape)),e}}function Ap(t,e){return(0,P.map)(t,(function(t){var n=t[0];n=ap(n,e.x),n=sp(n,e.x+e.width);var i=t[1];return i=ap(i,e.y),[n,i=sp(i,e.y+e.height)]}))}function Lp(t,e){var n=ap(t.x,e.x),i=sp(t.x+t.width,e.x+e.width),r=ap(t.y,e.y),o=sp(t.y+t.height,e.y+e.height);if(i>=n&&o>=r)return{x:n,y:r,width:i-n,height:o-r}}function Dp(t,e,n){var i=(0,P.extend)({rectHover:!0},e),r=i.style={strokeNoScale:!0};if(n=n||{x:-1,y:-1,width:2,height:2},t)return 0===t.indexOf("image://")?(r.image=t.slice(8),(0,P.defaults)(r,n),new Fa(i)):pp(t.replace("path://",""),i,n,"center")}function Ip(t,e,n,i,r){for(var o=0,a=r[r.length-1];o=-1e-6)return!1;var p=t-r,g=e-o,m=Ep(p,g,u,h)/f;if(m<0||m>1)return!1;var v=Ep(p,g,c,d)/f;return!(v<0||v>1)}function Ep(t,e,n,i){return t*i-n*e}function Op(t){var e=t.itemTooltipOption,n=t.componentModel,i=t.itemName,r=(0,P.isString)(e)?{formatter:e}:e,o=n.mainType,a=n.componentIndex,s={componentType:o,name:i,$vars:["name"]};s[o+"Index"]=a;var l=t.formatterParamsExtra;l&&(0,P.each)((0,P.keys)(l),(function(t){(0,P.hasOwn)(s,t)||(s[t]=l[t],s.$vars.push(t))}));var u=hs(t.el);u.componentMainType=o,u.componentIndex=a,u.tooltipConfig={name:i,option:(0,P.defaults)({content:i,encodeHTMLContent:!0,formatterParams:s},r)}}function Np(t,e){var n;t.isGroup&&(n=e(t)),n||t.traverse(e)}function Rp(t,e){if(t)if((0,P.isArray)(t))for(var n=0;n=0?c():h=setTimeout(c,-r),l=i};return d.clear=function(){h&&(clearTimeout(h),h=null)},d.debounceNextCall=function(t){s=t},d}function Yp(t,e,n,i){var r=t[e];if(r){var o=r[jp]||r,a=r[Xp];if(r[Zp]!==n||a!==i){if(null==n||!i)return t[e]=o;(r=t[e]=qp(o,n,"debounce"===i))[jp]=o,r[Xp]=i,r[Zp]=n}return r}}function Kp(t,e){var n=t[e];n&&n[jp]&&(n.clear&&n.clear(),t[e]=n[jp])}var Jp=Fr(),$p={itemStyle:no(Ol,!0),lineStyle:no(Il,!0)},Qp={lineStyle:"stroke",itemStyle:"fill"};function tg(t,e){var n=t.visualStyleMapper||$p[e];return n||(console.warn("Unknown style type '"+e+"'."),$p.itemStyle)}function eg(t,e){var n=t.visualDrawType||Qp[e];return n||(console.warn("Unknown style type '"+e+"'."),"fill")}var ng={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=t.getModel(i),o=tg(t,i)(r),a=r.getShallow("decal");a&&(n.setVisual("decal",a),a.dirty=!0);var s=eg(t,i),l=o[s],u=(0,P.isFunction)(l)?l:null,h="auto"===o.fill||"auto"===o.stroke;if(!o[s]||u||h){var c=t.getColorFromPalette(t.name,null,e.getSeriesCount());o[s]||(o[s]=c,n.setVisual("colorFromPalette",!0)),o.fill="auto"===o.fill||(0,P.isFunction)(o.fill)?c:o.fill,o.stroke="auto"===o.stroke||(0,P.isFunction)(o.stroke)?c:o.stroke}if(n.setVisual("style",o),n.setVisual("drawType",s),!e.isSeriesFiltered(t)&&u)return n.setVisual("colorFromPalette",!1),{dataEach:function(e,n){var i=t.getDataParams(n),r=(0,P.extend)({},o);r[s]=u(i),e.setItemVisual(n,"style",r)}}}},ig=new zl,rg={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!t.ignoreStyleOnData&&!e.isSeriesFiltered(t)){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=tg(t,i),o=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(t,e){var n=t.getRawDataItem(e);if(n&&n[i]){ig.option=n[i];var a=r(ig),s=t.ensureUniqueItemVisual(e,"style");(0,P.extend)(s,a),ig.option.decal&&(t.setItemVisual(e,"decal",ig.option.decal),ig.option.decal.dirty=!0),o in a&&t.setItemVisual(e,"colorFromPalette",!1)}}:null}}}},og={performRawSeries:!0,overallReset:function(t){var e=(0,P.createHashMap)();t.eachSeries((function(t){var n=t.getColorBy();if(!t.isColorBySeries()){var i=t.type+"-"+n,r=e.get(i);r||(r={},e.set(i,r)),Jp(t).scope=r}})),t.eachSeries((function(e){if(!e.isColorBySeries()&&!t.isSeriesFiltered(e)){var n=e.getRawData(),i={},r=e.getData(),o=Jp(e).scope,a=e.visualStyleAccessPath||"itemStyle",s=eg(e,a);r.each((function(t){var e=r.getRawIndex(t);i[e]=t})),n.each((function(t){var a=i[t];if(r.getItemVisual(a,"colorFromPalette")){var l=r.ensureUniqueItemVisual(a,"style"),u=n.getName(t)||t+"",h=n.count();l[s]=e.getColorFromPalette(u,o,h)}}))}}))}},ag=Math.PI;var sg=function(){function t(t,e,n,i){this._stageTaskMap=(0,P.createHashMap)(),this.ecInstance=t,this.api=e,n=this._dataProcessorHandlers=n.slice(),i=this._visualHandlers=i.slice(),this._allHandlers=n.concat(i)}return t.prototype.restoreData=function(t,e){t.restoreData(e),this._stageTaskMap.each((function(t){var e=t.overallTask;e&&e.dirty()}))},t.prototype.getPerformArgs=function(t,e){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),i=n.context,r=!e&&n.progressiveEnabled&&(!i||i.progressiveRender)&&t.__idxInPipeline>n.blockIndex?n.step:null,o=i&&i.modDataCount;return{step:r,modBy:null!=o?Math.ceil(o/r):null,modDataCount:o}}},t.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},t.prototype.updateStreamModes=function(t,e){var n=this._pipelineMap.get(t.uid),i=t.getData().count(),r=n.progressiveEnabled&&e.incrementalPrepareRender&&i>=n.threshold,o=t.get("large")&&i>=t.get("largeThreshold"),a="mod"===t.get("progressiveChunkMode")?i:null;t.pipelineContext=n.context={progressiveRender:r,modDataCount:a,large:o}},t.prototype.restorePipelines=function(t){var e=this,n=e._pipelineMap=(0,P.createHashMap)();t.eachSeries((function(t){var i=t.getProgressive(),r=t.uid;n.set(r,{id:r,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),e._pipe(t,t.dataTask)}))},t.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.api.getModel(),n=this.api;(0,P.each)(this._allHandlers,(function(i){var r=t.get(i.uid)||t.set(i.uid,{});(0,P.assert)(!(i.reset&&i.overallReset),""),i.reset&&this._createSeriesStageTask(i,r,e,n),i.overallReset&&this._createOverallStageTask(i,r,e,n)}),this)},t.prototype.prepareView=function(t,e,n,i){var r=t.renderTask,o=r.context;o.model=e,o.ecModel=n,o.api=i,r.__block=!t.incrementalPrepareRender,this._pipe(e,r)},t.prototype.performDataProcessorTasks=function(t,e){this._performStageTasks(this._dataProcessorHandlers,t,e,{block:!0})},t.prototype.performVisualTasks=function(t,e,n){this._performStageTasks(this._visualHandlers,t,e,n)},t.prototype._performStageTasks=function(t,e,n,i){i=i||{};var r=!1,o=this;function a(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}(0,P.each)(t,(function(t,s){if(!i.visualType||i.visualType===t.visualType){var l=o._stageTaskMap.get(t.uid),u=l.seriesTaskMap,h=l.overallTask;if(h){var c,d=h.agentStubMap;d.each((function(t){a(i,t)&&(t.dirty(),c=!0)})),c&&h.dirty(),o.updatePayload(h,n);var f=o.getPerformArgs(h,i.block);d.each((function(t){t.perform(f)})),h.perform(f)&&(r=!0)}else u&&u.each((function(s,l){a(i,s)&&s.dirty();var u=o.getPerformArgs(s,i.block);u.skip=!t.performRawSeries&&e.isSeriesFiltered(s.context.model),o.updatePayload(s,n),s.perform(u)&&(r=!0)}))}})),this.unfinished=r||this.unfinished},t.prototype.performSeriesTasks=function(t){var e;t.eachSeries((function(t){e=t.dataTask.perform()||e})),this.unfinished=e||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each((function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)}))},t.prototype.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},t.prototype._createSeriesStageTask=function(t,e,n,i){var r=this,o=e.seriesTaskMap,a=e.seriesTaskMap=(0,P.createHashMap)(),s=t.seriesType,l=t.getTargetSeries;function u(e){var s=e.uid,l=a.set(s,o&&o.get(s)||Lc({plan:dg,reset:fg,count:mg}));l.context={model:e,ecModel:n,api:i,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:r},r._pipe(e,l)}t.createOnAllSeries?n.eachRawSeries(u):s?n.eachRawSeriesByType(s,u):l&&l(n,i).each(u)},t.prototype._createOverallStageTask=function(t,e,n,i){var r=this,o=e.overallTask=e.overallTask||Lc({reset:lg});o.context={ecModel:n,api:i,overallReset:t.overallReset,scheduler:r};var a=o.agentStubMap,s=o.agentStubMap=(0,P.createHashMap)(),l=t.seriesType,u=t.getTargetSeries,h=!0,c=!1;function d(t){var e=t.uid,n=s.set(e,a&&a.get(e)||(c=!0,Lc({reset:ug,onDirty:cg})));n.context={model:t,overallProgress:h},n.agent=o,n.__block=h,r._pipe(t,n)}(0,P.assert)(!t.createOnAllSeries,""),l?n.eachRawSeriesByType(l,d):u?u(n,i).each(d):(h=!1,(0,P.each)(n.getSeries(),d)),c&&o.dirty()},t.prototype._pipe=function(t,e){var n=t.uid,i=this._pipelineMap.get(n);!i.head&&(i.head=e),i.tail&&i.tail.pipe(e),i.tail=e,e.__idxInPipeline=i.count++,e.__pipeline=i},t.wrapStageHandler=function(t,e){return(0,P.isFunction)(t)&&(t={overallReset:t,seriesType:vg(t)}),t.uid=Fl("stageHandler"),e&&(t.visualType=e),t},t}();function lg(t){t.overallReset(t.ecModel,t.api,t.payload)}function ug(t){return t.overallProgress&&hg}function hg(){this.agent.dirty(),this.getDownstream().dirty()}function cg(){this.agent&&this.agent.dirty()}function dg(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function fg(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=Ar(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?(0,P.map)(e,(function(t,e){return gg(e)})):pg}var pg=gg(0);function gg(t){return function(e,n){var i=n.data,r=n.resetDefines[t];if(r&&r.dataEach)for(var o=e.start;o0&&h===r.length-u.length){var c=r.slice(0,h);"data"!==c&&(e.mainType=c,e[u.toLowerCase()]=t,s=!0)}}a.hasOwnProperty(r)&&(n[r]=t,s=!0),s||(i[r]=t)}))}return{cptQuery:e,dataQuery:n,otherQuery:i}},t.prototype.filter=function(t,e){var n=this.eventInfo;if(!n)return!0;var i=n.targetEl,r=n.packedEvent,o=n.model,a=n.view;if(!o||!a)return!0;var s=e.cptQuery,l=e.dataQuery;return u(s,o,"mainType")&&u(s,o,"subType")&&u(s,o,"index","componentIndex")&&u(s,o,"name")&&u(s,o,"id")&&u(l,r,"name")&&u(l,r,"dataIndex")&&u(l,r,"dataType")&&(!a.filterForExposedEvent||a.filterForExposedEvent(t,e.otherQuery,i,r));function u(t,e,n,i){return null==t[n]||e[i||n]===t[n]}},t.prototype.afterTrigger=function(){this.eventInfo=null},t}(),Eg=["symbol","symbolSize","symbolRotate","symbolOffset"],Og=Eg.concat(["symbolKeepAspect"]),Ng={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData();if(t.legendIcon&&n.setVisual("legendIcon",t.legendIcon),t.hasSymbolVisual){for(var i={},r={},o=!1,a=0;a=0&&tm(l)?l:.5,t.createRadialGradient(a,s,0,a,s,l)}(t,e,n):function(t,e,n){var i=null==e.x?0:e.x,r=null==e.x2?1:e.x2,o=null==e.y?0:e.y,a=null==e.y2?0:e.y2;return e.global||(i=i*n.width+n.x,r=r*n.width+n.x,o=o*n.height+n.y,a=a*n.height+n.y),i=tm(i)?i:0,r=tm(r)?r:1,o=tm(o)?o:0,a=tm(a)?a:0,t.createLinearGradient(i,o,r,a)}(t,e,n),r=e.colorStops,o=0;o0&&(e=i.lineDash,n=i.lineWidth,e&&"solid"!==e&&n>0?"dashed"===e?[4*n,2*n]:"dotted"===e?[n]:(0,P.isNumber)(e)?[e]:(0,P.isArray)(e)?e:null:null),o=i.lineDashOffset;if(r){var a=i.strokeNoScale&&t.getLineScale?t.getLineScale():1;a&&1!==a&&(r=(0,P.map)(r,(function(t){return t/a})),o/=a)}return[r,o]}var om=new ca(!0);function am(t){var e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))}function sm(t){return"string"==typeof t&&"none"!==t}function lm(t){var e=t.fill;return null!=e&&"none"!==e}function um(t,e){if(null!=e.fillOpacity&&1!==e.fillOpacity){var n=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=n}else t.fill()}function hm(t,e){if(null!=e.strokeOpacity&&1!==e.strokeOpacity){var n=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=n}else t.stroke()}function cm(t,e,n){var i=so(e.image,e.__image,n);if(uo(i)){var r=t.createPattern(i,e.repeat||"repeat");if("function"==typeof DOMMatrix&&r&&r.setTransform){var o=new DOMMatrix;o.translateSelf(e.x||0,e.y||0),o.rotateSelf(0,0,(e.rotation||0)*P.RADIAN_TO_DEGREE),o.scaleSelf(e.scaleX||1,e.scaleY||1),r.setTransform(o)}return r}}var dm=["shadowBlur","shadowOffsetX","shadowOffsetY"],fm=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function pm(t,e,n,i,r){var o=!1;if(!i&&e===(n=n||{}))return!1;if(i||e.opacity!==n.opacity){bm(t,r),o=!0;var a=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(a)?Mo.opacity:a}(i||e.blend!==n.blend)&&(o||(bm(t,r),o=!0),t.globalCompositeOperation=e.blend||Mo.blend);for(var s=0;s0&&t.unfinished);t.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(t,e,n){if(!this[Um])if(this._disposed)xv(this.id);else{var i,r,o;if((0,P.isObject)(e)&&(n=e.lazyUpdate,i=e.silent,r=e.replaceMerge,o=e.transition,e=e.notMerge),this[Um]=!0,!this._model||e){var a=new Eh(this._api),s=this._theme,l=this._model=new Sh;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,a)}this._model.setOption(t,{replaceMerge:r},Tv);var u={seriesTransition:o,optionChanged:!0};if(n)this[Wm]={silent:i,updateParams:u},this[Um]=!1,this.getZr().wakeUp();else{try{Jm(this),tv.update.call(this,null,u)}catch(t){throw this[Wm]=null,this[Um]=!1,t}this._ssr||this._zr.flush(),this[Wm]=null,this[Um]=!1,rv.call(this,i),ov.call(this,i)}}},e.prototype.setTheme=function(){Pc()},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||I.default.hasGlobalWindow&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},e.prototype.renderToCanvas=function(t){return t=t||{},this._zr.painter.getRenderedCanvas({backgroundColor:t.backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(t){return t=t||{},this._zr.painter.renderToString({useViewBox:t.useViewBox})},e.prototype.getSvgDataURL=function(){if(I.default.svgSupported){var t=this._zr,e=t.storage.getDisplayList();return(0,P.each)(e,(function(t){t.stopAnimation(null,!0)})),t.painter.toDataURL()}},e.prototype.getDataURL=function(t){if(!this._disposed){var e=(t=t||{}).excludeComponents,n=this._model,i=[],r=this;(0,P.each)(e,(function(t){n.eachComponent({mainType:t},(function(t){var e=r._componentsMap[t.__viewId];e.group.ignore||(i.push(e),e.group.ignore=!0)}))}));var o="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return(0,P.each)(i,(function(t){t.group.ignore=!1})),o}xv(this.id)},e.prototype.getConnectedDataURL=function(t){if(!this._disposed){var e="svg"===t.type,n=this.group,i=Math.min,r=Math.max,o=1/0;if(Dv[n]){var a=o,s=o,l=-1/0,u=-1/0,h=[],c=t&&t.pixelRatio||this.getDevicePixelRatio();(0,P.each)(Lv,(function(o,c){if(o.group===n){var d=e?o.getZr().painter.getSvgDom().innerHTML:o.renderToCanvas((0,P.clone)(t)),f=o.getDom().getBoundingClientRect();a=i(f.left,a),s=i(f.top,s),l=r(f.right,l),u=r(f.bottom,u),h.push({dom:d,left:f.left,top:f.top})}}));var d=(l*=c)-(a*=c),f=(u*=c)-(s*=c),p=vi.yh.createCanvas(),g=Wi(p,{renderer:e?"svg":"canvas"});if(g.resize({width:d,height:f}),e){var m="";return(0,P.each)(h,(function(t){var e=t.left-a,n=t.top-s;m+=''+t.dom+""})),g.painter.getSvgRoot().innerHTML=m,t.connectedBackgroundColor&&g.painter.setBackgroundColor(t.connectedBackgroundColor),g.refreshImmediately(),g.painter.toDataURL()}return t.connectedBackgroundColor&&g.add(new Xa({shape:{x:0,y:0,width:d,height:f},style:{fill:t.connectedBackgroundColor}})),(0,P.each)(h,(function(t){var e=new Fa({style:{x:t.left*c-a,y:t.top*c-s,image:t.dom}});g.add(e)})),g.refreshImmediately(),p.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}xv(this.id)},e.prototype.convertToPixel=function(t,e){return ev(this,"convertToPixel",t,e)},e.prototype.convertFromPixel=function(t,e){return ev(this,"convertFromPixel",t,e)},e.prototype.containPixel=function(t,e){if(!this._disposed){var n,i=Vr(this._model,t);return(0,P.each)(i,(function(t,i){i.indexOf("Models")>=0&&(0,P.each)(t,(function(t){var r=t.coordinateSystem;if(r&&r.containPoint)n=n||!!r.containPoint(e);else if("seriesModels"===i){var o=this._chartsMap[t.__viewId];o&&o.containPoint&&(n=n||o.containPoint(e,t))}else 0}),this)}),this),!!n}xv(this.id)},e.prototype.getVisual=function(t,e){var n=Vr(this._model,t,{defaultMainType:"series"});var i=n.seriesModel.getData(),r=n.hasOwnProperty("dataIndexInside")?n.dataIndexInside:n.hasOwnProperty("dataIndex")?i.indexOfRawIndex(n.dataIndex):null;return null!=r?function(t,e,n){switch(n){case"color":return t.getItemVisual(e,"style")[t.getVisual("drawType")];case"opacity":return t.getItemVisual(e,"style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getItemVisual(e,n)}}(i,r,e):function(t,e){switch(e){case"color":return t.getVisual("style")[t.getVisual("drawType")];case"opacity":return t.getVisual("style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getVisual(e)}}(i,e)},e.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},e.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},e.prototype._initEvents=function(){var t,e,n,i=this;(0,P.each)(yv,(function(t){var e=function(e){var n,r=i.getModel(),o=e.target;if("globalout"===t?n={}:o&&zg(o,(function(t){var e=hs(t);if(e&&null!=e.dataIndex){var i=e.dataModel||r.getSeriesByIndex(e.seriesIndex);return n=i&&i.getDataParams(e.dataIndex,e.dataType,o)||{},!0}if(e.eventData)return n=(0,P.extend)({},e.eventData),!0}),!0),n){var a=n.componentType,s=n.componentIndex;"markLine"!==a&&"markPoint"!==a&&"markArea"!==a||(a="series",s=n.seriesIndex);var l=a&&null!=s&&r.getComponent(a,s),u=l&&i["series"===l.mainType?"_chartsMap":"_componentsMap"][l.__viewId];0,n.event=e,n.type=t,i._$eventProcessor.eventInfo={targetEl:o,packedEvent:n,model:l,view:u},i.trigger(t,n)}};e.zrEventfulCallAtLast=!0,i._zr.on(t,e,i)})),(0,P.each)(wv,(function(t,e){i._messageCenter.on(e,(function(t){this.trigger(e,t)}),i)})),(0,P.each)(["selectchanged"],(function(t){i._messageCenter.on(t,(function(e){this.trigger(t,e)}),i)})),t=this._messageCenter,e=this,n=this._api,t.on("selectchanged",(function(t){var i=n.getModel();t.isFromClick?(kg("map","selectchanged",e,i,t),kg("pie","selectchanged",e,i,t)):"select"===t.fromAction?(kg("map","selected",e,i,t),kg("pie","selected",e,i,t)):"unselect"===t.fromAction&&(kg("map","unselected",e,i,t),kg("pie","unselected",e,i,t))}))},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){this._disposed?xv(this.id):this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed)xv(this.id);else{this._disposed=!0,this.getDom()&&Zr(this.getDom(),Ev,"");var t=this,e=t._api,n=t._model;(0,P.each)(t._componentsViews,(function(t){t.dispose(n,e)})),(0,P.each)(t._chartsViews,(function(t){t.dispose(n,e)})),t._zr.dispose(),t._dom=t._model=t._chartsMap=t._componentsMap=t._chartsViews=t._componentsViews=t._scheduler=t._api=t._zr=t._throttledZrFlush=t._theme=t._coordSysMgr=t._messageCenter=null,delete Lv[t.id]}},e.prototype.resize=function(t){if(!this[Um])if(this._disposed)xv(this.id);else{this._zr.resize(t);var e=this._model;if(this._loadingFX&&this._loadingFX.resize(),e){var n=e.resetOption("media"),i=t&&t.silent;this[Wm]&&(null==i&&(i=this[Wm].silent),n=!0,this[Wm]=null),this[Um]=!0;try{n&&Jm(this),tv.update.call(this,{type:"resize",animation:(0,P.extend)({duration:0},t&&t.animation)})}catch(t){throw this[Um]=!1,t}this[Um]=!1,rv.call(this,i),ov.call(this,i)}}},e.prototype.showLoading=function(t,e){if(this._disposed)xv(this.id);else if((0,P.isObject)(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),Av[t]){var n=Av[t](this._api,e),i=this._zr;this._loadingFX=n,i.add(n)}},e.prototype.hideLoading=function(){this._disposed?xv(this.id):(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},e.prototype.makeActionFromEvent=function(t){var e=(0,P.extend)({},t);return e.type=wv[t.type],e},e.prototype.dispatchAction=function(t,e){if(this._disposed)xv(this.id);else if((0,P.isObject)(e)||(e={silent:!!e}),bv[t.type]&&this._model)if(this[Um])this._pendingActions.push(t);else{var n=e.silent;iv.call(this,t,n);var i=e.flush;i?this._zr.flush():!1!==i&&I.default.browser.weChat&&this._throttledZrFlush(),rv.call(this,n),ov.call(this,n)}},e.prototype.updateLabelLayout=function(){Em.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(t){if(this._disposed)xv(this.id);else{var e=t.seriesIndex;0,this.getModel().getSeriesByIndex(e).appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},e.internalField=function(){function t(t){t.clearColorPalette(),t.eachSeries((function(t){t.clearColorPalette()}))}function e(t){for(var e=[],n=t.currentStates,i=0;i0?{duration:o,delay:i.get("delay"),easing:i.get("easing")}:null;n.eachRendered((function(t){if(t.states&&t.states.emphasis){if(al(t))return;if(t instanceof Ea&&function(t){var e=fs(t);e.normalFill=t.style.fill,e.normalStroke=t.style.stroke;var n=t.states.select||{};e.selectFill=n.style&&n.style.fill||null,e.selectStroke=n.style&&n.style.stroke||null}(t),t.__dirty){var n=t.prevStates;n&&t.useStates(n)}if(r){t.stateTransition=a;var i=t.getTextContent(),o=t.getTextGuideLine();i&&(i.stateTransition=a),o&&(o.stateTransition=a)}t.__dirty&&e(t)}}))}Jm=function(t){var e=t._scheduler;e.restorePipelines(t._model),e.prepareStageTasks(),$m(t,!0),$m(t,!1),e.plan()},$m=function(t,e){for(var n=t._model,i=t._scheduler,r=e?t._componentsViews:t._chartsViews,o=e?t._componentsMap:t._chartsMap,a=t._zr,s=t._api,l=0;le.get("hoverLayerThreshold")&&!I.default.node&&!I.default.worker&&e.eachSeries((function(e){if(!e.preventUsingHoverLayer){var n=t._chartsMap[e.__viewId];n.__alive&&n.eachRendered((function(t){t.states.emphasis&&(t.states.emphasis.hoverLayer=!0)}))}}))}(t,e),Em.trigger("series:afterupdate",e,i,s)},fv=function(t){t[jm]=!0,t.getZr().wakeUp()},pv=function(t){t[jm]&&(t.getZr().storage.traverse((function(t){al(t)||e(t)})),t[jm]=!1)},cv=function(t){return new(function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return D(n,e),n.prototype.getCoordinateSystems=function(){return t._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(e){for(;e;){var n=e.__ecComponentInfo;if(null!=n)return t._model.getComponent(n.mainType,n.index);e=e.parent}},n.prototype.enterEmphasis=function(e,n){Bs(e,n),fv(t)},n.prototype.leaveEmphasis=function(e,n){Fs(e,n),fv(t)},n.prototype.enterBlur=function(e){!function(t){Os(t,Ls)}(e),fv(t)},n.prototype.leaveBlur=function(e){Hs(e),fv(t)},n.prototype.enterSelect=function(e){Vs(e),fv(t)},n.prototype.leaveSelect=function(e){Gs(e),fv(t)},n.prototype.getModel=function(){return t.getModel()},n.prototype.getViewOfComponentModel=function(e){return t.getViewOfComponentModel(e)},n.prototype.getViewOfSeriesModel=function(e){return t.getViewOfSeriesModel(e)},n}(Mh))(t)},dv=function(t){function e(t,e){for(var n=0;n=0)){Jv.push(n);var o=wg.wrapStageHandler(n,r);o.__prio=e,o.__raw=n,t.push(o)}}function Qv(t,e){Av[t]=e}function t_(t){(0,vi.Gs)({createCanvas:t})}function e_(t,e,n){var i=Nm("registerMap");i&&i(t,e,n)}function n_(t){var e=Nm("getMap");return e&&e(t)}var i_=function(t){var e=(t=(0,P.clone)(t)).type;e||Ec("");var n=e.split(":");2!==n.length&&Ec("");var i=!1;"echarts"===n[0]&&(e=n[1],i=!0),t.__isBuiltIn=i,Vc.set(e,t)};Kv(Fm,ng),Kv(Vm,rg),Kv(Vm,og),Kv(Fm,Ng),Kv(Vm,Rg),Kv(7e3,(function(t,e){t.eachRawSeries((function(n){if(!t.isSeriesFiltered(n)){var i=n.getData();i.hasItemVisual()&&i.each((function(t){var n=i.getItemVisual(t,"decal");n&&(i.ensureUniqueItemVisual(t,"style").decal=Lm(n,e))}));var r=i.getVisual("decal");if(r)i.getVisual("style").decal=Lm(r,e)}}))})),Vv($h),Gv(900,(function(t){var e=(0,P.createHashMap)();t.eachSeries((function(t){var n=t.get("stack");if(n){var i=e.get(n)||e.set(n,[]),r=t.getData(),o={stackResultDimension:r.getCalculationInfo("stackResultDimension"),stackedOverDimension:r.getCalculationInfo("stackedOverDimension"),stackedDimension:r.getCalculationInfo("stackedDimension"),stackedByDimension:r.getCalculationInfo("stackedByDimension"),isStackedByIndex:r.getCalculationInfo("isStackedByIndex"),data:r,seriesModel:t};if(!o.stackedDimension||!o.isStackedByIndex&&!o.stackedByDimension)return;i.length&&r.setCalculationInfo("stackedOnSeries",i[i.length-1].seriesModel),i.push(o)}})),e.each(Qh)})),Qv("default",(function(t,e){e=e||{},P.defaults(e,{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var n=new Fi,i=new Xa({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});n.add(i);var r,o=new us({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),a=new Xa({style:{fill:"none"},textContent:o,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});return n.add(a),e.showSpinner&&((r=new Gf({shape:{startAngle:-ag/2,endAngle:-ag/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001})).animateShape(!0).when(1e3,{endAngle:3*ag/2}).start("circularInOut"),r.animateShape(!0).when(1e3,{startAngle:3*ag/2}).delay(300).start("circularInOut"),n.add(r)),n.resize=function(){var n=o.getBoundingRect().width,s=e.showSpinner?e.spinnerRadius:0,l=(t.getWidth()-2*s-(e.showSpinner&&n?10:0)-n)/2-(e.showSpinner&&n?0:5+n/2)+(e.showSpinner?0:n/2)+(n?0:s),u=t.getHeight()/2;e.showSpinner&&r.setShape({cx:l,cy:u}),a.setShape({x:l-s,y:u-s,width:2*s,height:2*s}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},n.resize(),n})),Zv({type:ys,event:ys,update:ys},P.noop),Zv({type:xs,event:xs,update:xs},P.noop),Zv({type:bs,event:bs,update:bs},P.noop),Zv({type:ws,event:ws,update:ws},P.noop),Zv({type:Ss,event:Ss,update:Ss},P.noop),Hv("light",Tg),Hv("dark",Ig);var r_={};function o_(t){return null==t?0:t.length||1}function a_(t){return t}var s_=function(){function t(t,e,n,i,r,o){this._old=t,this._new=e,this._oldKeyGetter=n||a_,this._newKeyGetter=i||a_,this.context=r,this._diffModeMultiple="multiple"===o}return t.prototype.add=function(t){return this._add=t,this},t.prototype.update=function(t){return this._update=t,this},t.prototype.updateManyToOne=function(t){return this._updateManyToOne=t,this},t.prototype.updateOneToMany=function(t){return this._updateOneToMany=t,this},t.prototype.updateManyToMany=function(t){return this._updateManyToMany=t,this},t.prototype.remove=function(t){return this._remove=t,this},t.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},t.prototype._executeOneToOne=function(){var t=this._old,e=this._new,n={},i=new Array(t.length),r=new Array(e.length);this._initIndexMap(t,null,i,"_oldKeyGetter"),this._initIndexMap(e,n,r,"_newKeyGetter");for(var o=0;o1){var u=s.shift();1===s.length&&(n[a]=s[0]),this._update&&this._update(u,o)}else 1===l?(n[a]=null,this._update&&this._update(s,o)):this._remove&&this._remove(o)}this._performRestAdd(r,n)},t.prototype._executeMultiple=function(){var t=this._old,e=this._new,n={},i={},r=[],o=[];this._initIndexMap(t,n,r,"_oldKeyGetter"),this._initIndexMap(e,i,o,"_newKeyGetter");for(var a=0;a1&&1===c)this._updateManyToOne&&this._updateManyToOne(u,l),i[s]=null;else if(1===h&&c>1)this._updateOneToMany&&this._updateOneToMany(u,l),i[s]=null;else if(1===h&&1===c)this._update&&this._update(u,l),i[s]=null;else if(h>1&&c>1)this._updateManyToMany&&this._updateManyToMany(u,l),i[s]=null;else if(h>1)for(var d=0;d1)for(var a=0;a30}var y_,x_,b_,w_,S_,T_,M_,C_=P.isObject,A_=P.map,L_="undefined"==typeof Int32Array?Array:Int32Array,D_=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],I_=["_approximateExtent"],P_=function(){function t(t,e){var n;this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var i=!1;g_(t)?(n=t.dimensions,this._dimOmitted=t.isDimensionOmitted(),this._schema=t):(i=!0,n=t),n=n||["x","y"];for(var r={},o=[],a={},s=!1,l={},u=0;u=e)){var n=this._store.getProvider();this._updateOrdinalMeta();var i=this._nameList,r=this._idList;if(n.getSource().sourceFormat===Ju&&!n.pure)for(var o=[],a=t;a0},t.prototype.ensureUniqueItemVisual=function(t,e){var n=this._itemVisuals,i=n[t];i||(i=n[t]={});var r=i[e];return null==r&&(r=this.getVisual(e),P.isArray(r)?r=r.slice():C_(r)&&(r=P.extend({},r)),i[e]=r),r},t.prototype.setItemVisual=function(t,e,n){var i=this._itemVisuals[t]||{};this._itemVisuals[t]=i,C_(e)?P.extend(i,e):i[e]=n},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(t,e){C_(t)?P.extend(this._layout,t):this._layout[t]=e},t.prototype.getLayout=function(t){return this._layout[t]},t.prototype.getItemLayout=function(t){return this._itemLayouts[t]},t.prototype.setItemLayout=function(t,e,n){this._itemLayouts[t]=n?P.extend(this._itemLayouts[t]||{},e):e},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(t,e){!function(t,e,n,i){if(i){var r=hs(i);r.dataIndex=n,r.dataType=e,r.seriesIndex=t,r.ssrType="chart","group"===i.type&&i.traverse((function(i){var r=hs(i);r.seriesIndex=t,r.dataIndex=n,r.dataType=e,r.ssrType="chart"}))}}(this.hostModel&&this.hostModel.seriesIndex,this.dataType,t,e),this._graphicEls[t]=e},t.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},t.prototype.eachItemGraphicEl=function(t,e){P.each(this._graphicEls,(function(n,i){n&&t&&t.call(e,n,i)}))},t.prototype.cloneShallow=function(e){return e||(e=new t(this._schema?this._schema:A_(this.dimensions,this._getDimInfo,this),this.hostModel)),S_(e,this),e._store=this._store,e},t.prototype.wrapMethod=function(t,e){var n=this[t];P.isFunction(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=n.apply(this,arguments);return e.apply(this,[t].concat(P.slice(arguments)))})},t.internalField=(y_=function(t){var e=t._invertedIndicesMap;P.each(e,(function(n,i){var r=t._dimInfos[i],o=r.ordinalMeta,a=t._store;if(o){n=e[i]=new L_(o.categories.length);for(var s=0;s1&&(s+="__ec__"+u),i[e]=s}})),t}();const E_=P_;function O_(t,e){return N_(t,e).dimensions}function N_(t,e){ac(t)||(t=lc(t));var n=(e=e||{}).coordDimensions||[],i=e.dimensionsDefine||t.dimensionsDefine||[],r=(0,P.createHashMap)(),o=[],a=function(t,e,n,i){var r=Math.max(t.dimensionsDetectedCount||1,e.length,n.length,i||0);return(0,P.each)(e,(function(t){var e;(0,P.isObject)(t)&&(e=t.dimsDef)&&(r=Math.max(r,e.length))})),r}(t,n,i,e.dimensionsCount),s=e.canOmitUnusedDimensions&&__(a),l=i===t.dimensionsDefine,u=l?v_(t):m_(i),h=e.encodeDefine;!h&&e.encodeDefaulter&&(h=e.encodeDefaulter(t,a));for(var c=(0,P.createHashMap)(h),d=new qc(a),f=0;f0&&(i.name=r+(o-1)),o++,e.set(r,o)}}(o),new p_({source:t,dimensions:o,fullDimensionCount:a,dimensionOmitted:s})}function R_(t,e,n){if(n||e.hasKey(t)){for(var i=0;e.hasKey(t+i);)i++;t+=i}return e.set(t,!0),t}var k_=function(t){this.coordSysDims=[],this.axisMap=(0,P.createHashMap)(),this.categoryAxisMap=(0,P.createHashMap)(),this.coordSysName=t};var z_={cartesian2d:function(t,e,n,i){var r=t.getReferringComponents("xAxis",Ur).models[0],o=t.getReferringComponents("yAxis",Ur).models[0];e.coordSysDims=["x","y"],n.set("x",r),n.set("y",o),B_(r)&&(i.set("x",r),e.firstCategoryDimIndex=0),B_(o)&&(i.set("y",o),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,n,i){var r=t.getReferringComponents("singleAxis",Ur).models[0];e.coordSysDims=["single"],n.set("single",r),B_(r)&&(i.set("single",r),e.firstCategoryDimIndex=0)},polar:function(t,e,n,i){var r=t.getReferringComponents("polar",Ur).models[0],o=r.findAxisModel("radiusAxis"),a=r.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],n.set("radius",o),n.set("angle",a),B_(o)&&(i.set("radius",o),e.firstCategoryDimIndex=0),B_(a)&&(i.set("angle",a),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},geo:function(t,e,n,i){e.coordSysDims=["lng","lat"]},parallel:function(t,e,n,i){var r=t.ecModel,o=r.getComponent("parallel",t.get("parallelIndex")),a=e.coordSysDims=o.dimensions.slice();(0,P.each)(o.parallelAxisIndex,(function(t,o){var s=r.getComponent("parallelAxis",t),l=a[o];n.set(l,s),B_(s)&&(i.set(l,s),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=o))}))}};function B_(t){return"category"===t.get("type")}function F_(t,e,n){var i,r,o,a=(n=n||{}).byIndex,s=n.stackedCoordDimension;!function(t){return!g_(t.schema)}(e)?(r=e.schema,i=r.dimensions,o=e.store):i=e;var l,u,h,c,d=!(!t||!t.get("stack"));if((0,P.each)(i,(function(t,e){(0,P.isString)(t)&&(i[e]=t={name:t}),d&&!t.isExtraCoord&&(a||l||!t.ordinalMeta||(l=t),u||"ordinal"===t.type||"time"===t.type||s&&s!==t.coordDim||(u=t))})),!u||a||l||(a=!0),u){h="__\0ecstackresult_"+t.id,c="__\0ecstackedover_"+t.id,l&&(l.createInvertedIndices=!0);var f=u.coordDim,p=u.type,g=0;(0,P.each)(i,(function(t){t.coordDim===f&&g++}));var m={name:h,coordDim:f,coordDimIndex:g,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},v={name:c,coordDim:c,coordDimIndex:g+1,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};r?(o&&(m.storeDimIndex=o.ensureCalculationDimension(c,p),v.storeDimIndex=o.ensureCalculationDimension(h,p)),r.appendCalculationDimension(m),r.appendCalculationDimension(v)):(i.push(m),i.push(v))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:a,stackedOverDimension:c,stackResultDimension:h}}function H_(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function V_(t,e){return H_(t,e)?t.getCalculationInfo("stackResultDimension"):e}const G_=function(t,e,n){n=n||{};var i,r=e.getSourceManager(),o=!1;t?(o=!0,i=lc(t)):o=(i=r.getSource()).sourceFormat===Ju;var a=function(t){var e=t.get("coordinateSystem"),n=new k_(e),i=z_[e];if(i)return i(t,n,n.axisMap,n.categoryAxisMap),n}(e),s=function(t,e){var n,i=t.get("coordinateSystem"),r=Lh.get(i);return e&&e.coordSysDims&&(n=P.map(e.coordSysDims,(function(t){var n={name:t},i=e.axisMap.get(t);if(i){var r=i.get("type");n.type=function(t){return"category"===t?"ordinal":"time"===t?"time":"float"}(r)}return n}))),n||(n=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||["x","y"]),n}(e,a),l=n.useEncodeDefaulter,u=P.isFunction(l)?l:l?P.curry(sh,s,e):null,h=N_(i,{coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!o}),c=function(t,e,n){var i,r;return n&&P.each(t,(function(t,o){var a=t.coordDim,s=n.categoryAxisMap.get(a);s&&(null==i&&(i=o),t.ordinalMeta=s.getOrdinalMeta(),e&&(t.createInvertedIndices=!0)),null!=t.otherDims.itemName&&(r=!0)})),r||null==i||(t[i].otherDims.itemName=0),i}(h.dimensions,n.createInvertedIndices,a),d=o?null:r.getSharedDataStore(h),f=F_(e,{schema:h,store:d}),p=new E_(h,e);p.setCalculationInfo(f);var g=null!=c&&function(t){if(t.sourceFormat===Ju){var e=function(t){var e=0;for(;ee[1]&&(e[1]=t[1])},t.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=t),isNaN(e)||(n[1]=e)},t.prototype.isInExtentRange=function(t){return this._extent[0]<=t&&this._extent[1]>=t},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(t){this._isBlank=t},t}();eo(U_);const W_=U_;var j_=0,Z_=function(){function t(t){this.categories=t.categories||[],this._needCollect=t.needCollect,this._deduplication=t.deduplication,this.uid=++j_}return t.createByAxisModel=function(e){var n=e.option,i=n.data,r=i&&(0,P.map)(i,X_);return new t({categories:r,needCollect:!r,deduplication:!1!==n.dedplication})},t.prototype.getOrdinal=function(t){return this._getOrCreateMap().get(t)},t.prototype.parseAndCollect=function(t){var e,n=this._needCollect;if(!(0,P.isString)(t)&&!n)return t;if(n&&!this._deduplication)return e=this.categories.length,this.categories[e]=t,e;var i=this._getOrCreateMap();return null==(e=i.get(t))&&(n?(e=this.categories.length,this.categories[e]=t,i.set(t,e)):e=NaN),e},t.prototype._getOrCreateMap=function(){return this._map||(this._map=(0,P.createHashMap)(this.categories))},t}();function X_(t){return(0,P.isObject)(t)&&null!=t.value?t.value:t+""}const q_=Z_;function Y_(t){return"interval"===t.type||"log"===t.type}function K_(t,e,n,i){var r={},o=t[1]-t[0],a=r.interval=mr(o/e,!0);null!=n&&ai&&(a=r.interval=i);var s=r.intervalPrecision=$_(a);return function(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),Q_(t,0,e),Q_(t,1,e),t[0]>t[1]&&(t[0]=t[1])}(r.niceTickExtent=[nr(Math.ceil(t[0]/a)*a,s),nr(Math.floor(t[1]/a)*a,s)],t),r}function J_(t){var e=Math.pow(10,gr(t)),n=t/e;return n?2===n?n=3:3===n?n=5:n*=2:n=1,nr(n*e)}function $_(t){return rr(t)+2}function Q_(t,e,n){t[e]=Math.max(Math.min(t[e],n[1]),n[0])}function ty(t,e){return t>=e[0]&&t<=e[1]}function ey(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function ny(t,e){return t*(e[1]-e[0])+e[0]}var iy=function(t){function e(e){var n=t.call(this,e)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new q_({})),(0,P.isArray)(i)&&(i=new q_({categories:(0,P.map)(i,(function(t){return(0,P.isObject)(t)?t.value:t}))})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return D(e,t),e.prototype.parse=function(t){return null==t?NaN:(0,P.isString)(t)?this._ordinalMeta.getOrdinal(t):Math.round(t)},e.prototype.contain=function(t){return ty(t=this.parse(t),this._extent)&&null!=this._ordinalMeta.categories[t]},e.prototype.normalize=function(t){return ey(t=this._getTickNumber(this.parse(t)),this._extent)},e.prototype.scale=function(t){return t=Math.round(ny(t,this._extent)),this.getRawOrdinalNumber(t)},e.prototype.getTicks=function(){for(var t=[],e=this._extent,n=e[0];n<=e[1];)t.push({value:n}),n++;return t},e.prototype.getMinorTicks=function(t){},e.prototype.setSortInfo=function(t){if(null!=t){for(var e=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],r=0,o=this._ordinalMeta.categories.length,a=Math.min(o,e.length);r=0&&t=0&&t=t},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e}(W_);W_.registerClass(iy);const ry=iy;var oy=nr,ay=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="interval",e._interval=0,e._intervalPrecision=2,e}return D(e,t),e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return ty(t,this._extent)},e.prototype.normalize=function(t){return ey(t,this._extent)},e.prototype.scale=function(t){return ny(t,this._extent)},e.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(e)||(n[1]=parseFloat(e))},e.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),this.setExtent(e[0],e[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=$_(t)},e.prototype.getTicks=function(t){var e=this._interval,n=this._extent,i=this._niceExtent,r=this._intervalPrecision,o=[];if(!e)return o;n[0]1e4)return[];var s=o.length?o[o.length-1].value:i[1];return n[1]>s&&(t?o.push({value:oy(s+e,r)}):o.push({value:n[1]})),o},e.prototype.getMinorTicks=function(t){for(var e=this.getTicks(!0),n=[],i=this.getExtent(),r=1;ri[0]&&h0&&(o=null===o?s:Math.min(o,s))}n[i]=o}}return n}(t),n=[];return(0,P.each)(t,(function(t){var i,r=t.coordinateSystem.getBaseAxis(),o=r.getExtent();if("category"===r.type)i=r.getBandWidth();else if("value"===r.type||"time"===r.type){var a=r.dim+"_"+r.index,s=e[a],l=Math.abs(o[1]-o[0]),u=r.scale.getExtent(),h=Math.abs(u[1]-u[0]);i=s?l/h*s:l}else{var c=t.getData();i=Math.abs(o[1]-o[0])/c.count()}var d=er(t.get("barWidth"),i),f=er(t.get("barMaxWidth"),i),p=er(t.get("barMinWidth")||(gy(t)?.5:1),i),g=t.get("barGap"),m=t.get("barCategoryGap");n.push({bandWidth:i,barWidth:d,barMaxWidth:f,barMinWidth:p,barGap:g,barCategoryGap:m,axisKey:hy(r),stackId:uy(t)})})),fy(n)}function fy(t){var e={};(0,P.each)(t,(function(t,n){var i=t.axisKey,r=t.bandWidth,o=e[i]||{bandWidth:r,remainedWidth:r,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},a=o.stacks;e[i]=o;var s=t.stackId;a[s]||o.autoWidthCount++,a[s]=a[s]||{width:0,maxWidth:0};var l=t.barWidth;l&&!a[s].width&&(a[s].width=l,l=Math.min(o.remainedWidth,l),o.remainedWidth-=l);var u=t.barMaxWidth;u&&(a[s].maxWidth=u);var h=t.barMinWidth;h&&(a[s].minWidth=h);var c=t.barGap;null!=c&&(o.gap=c);var d=t.barCategoryGap;null!=d&&(o.categoryGap=d)}));var n={};return(0,P.each)(e,(function(t,e){n[e]={};var i=t.stacks,r=t.bandWidth,o=t.categoryGap;if(null==o){var a=(0,P.keys)(i).length;o=Math.max(35-4*a,15)+"%"}var s=er(o,r),l=er(t.gap,1),u=t.remainedWidth,h=t.autoWidthCount,c=(u-s)/(h+(h-1)*l);c=Math.max(c,0),(0,P.each)(i,(function(t){var e=t.maxWidth,n=t.minWidth;if(t.width){i=t.width;e&&(i=Math.min(i,e)),n&&(i=Math.max(i,n)),t.width=i,u-=i+l*i,h--}else{var i=c;e&&ei&&(i=n),i!==c&&(t.width=i,u-=i+l*i,h--)}})),c=(u-s)/(h+(h-1)*l),c=Math.max(c,0);var d,f=0;(0,P.each)(i,(function(t,e){t.width||(t.width=c),d=t,f+=t.width*(1+l)})),d&&(f-=d.width*l);var p=-f/2;(0,P.each)(i,(function(t,i){n[e][i]=n[e][i]||{bandWidth:r,offset:p,width:t.width},p+=t.width*(1+l)}))})),n}function py(t){return t.coordinateSystem&&"cartesian2d"===t.coordinateSystem.type}function gy(t){return t.pipelineContext&&t.pipelineContext.large}var my=function(t){function e(e){var n=t.call(this,e)||this;return n.type="time",n}return D(e,t),e.prototype.getLabel=function(t){var e=this.getSetting("useUTC");return au(t.value,tu[function(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}(ru(this._minLevelUnit))]||tu.second,e,this.getSetting("locale"))},e.prototype.getFormattedLabel=function(t,e,n){var i=this.getSetting("useUTC");return function(t,e,n,i,r){var o=null;if(P.isString(n))o=n;else if(P.isFunction(n))o=n(t.value,e,{level:t.level});else{var a=P.extend({},$l);if(t.level>0)for(var s=0;s=0;--s)if(l[u]){o=l[u];break}o=o||a.none}if(P.isArray(o)){var h=null==t.level?0:t.level>=0?t.level:o.length+t.level;o=o[h=Math.min(h,o.length-1)]}}return au(new Date(t.value),o,r,i)}(t,e,n,this.getSetting("locale"),i)},e.prototype.getTicks=function(){var t=this._interval,e=this._extent,n=[];if(!t)return n;n.push({value:e[0],level:0});var i=this.getSetting("useUTC"),r=function(t,e,n,i){var r=1e4,o=nu,a=0;function s(t,e,n,r,o,a,s){for(var l=new Date(e),u=e,h=l[r]();u1&&0===u&&o.unshift({value:o[0].value-d})}}for(u=0;u=i[0]&&v<=i[1]&&c++)}var _=(i[1]-i[0])/e;if(c>1.5*_&&d>_/1.5)break;if(u.push(g),c>_||t===o[f])break}h=[]}}0;var y=(0,P.filter)((0,P.map)(u,(function(t){return(0,P.filter)(t,(function(t){return t.value>=i[0]&&t.value<=i[1]&&!t.notAdd}))})),(function(t){return t.length>0})),x=[],b=y.length-1;for(f=0;fn&&(this._approxInterval=n);var o=vy.length,a=Math.min(function(t,e,n,i){for(;n>>1;t[r][1]16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function yy(t){return(t/=2592e6)>6?6:t>3?3:t>2?2:1}function xy(t){return(t/=Yl)>12?12:t>6?6:t>3.5?4:t>2?2:1}function by(t,e){return(t/=e?ql:Xl)>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function wy(t){return mr(t,!0)}function Sy(t,e,n){var i=new Date(t);switch(ru(e)){case"year":case"month":i[vu(n)](0);case"day":i[_u(n)](1);case"hour":i[yu(n)](0);case"minute":i[xu(n)](0);case"second":i[bu(n)](0),i[wu(n)](0)}return i.getTime()}W_.registerClass(my);const Ty=my;var My=W_.prototype,Cy=sy.prototype,Ay=nr,Ly=Math.floor,Dy=Math.ceil,Iy=Math.pow,Py=Math.log,Ey=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e.base=10,e._originalScale=new sy,e._interval=0,e}return D(e,t),e.prototype.getTicks=function(t){var e=this._originalScale,n=this._extent,i=e.getExtent(),r=Cy.getTicks.call(this,t);return P.map(r,(function(t){var e=t.value,r=nr(Iy(this.base,e));return r=e===n[0]&&this._fixMin?Ny(r,i[0]):r,{value:r=e===n[1]&&this._fixMax?Ny(r,i[1]):r}}),this)},e.prototype.setExtent=function(t,e){var n=Py(this.base);t=Py(Math.max(0,t))/n,e=Py(Math.max(0,e))/n,Cy.setExtent.call(this,t,e)},e.prototype.getExtent=function(){var t=this.base,e=My.getExtent.call(this);e[0]=Iy(t,e[0]),e[1]=Iy(t,e[1]);var n=this._originalScale.getExtent();return this._fixMin&&(e[0]=Ny(e[0],n[0])),this._fixMax&&(e[1]=Ny(e[1],n[1])),e},e.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=Py(t[0])/Py(e),t[1]=Py(t[1])/Py(e),My.unionExtent.call(this,t)},e.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},e.prototype.calcNiceTicks=function(t){t=t||10;var e=this._extent,n=e[1]-e[0];if(!(n===1/0||n<=0)){var i=pr(n);for(t/n*i<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var r=[nr(Dy(e[0]/i)*i),nr(Ly(e[1]/i)*i)];this._interval=i,this._niceExtent=r}},e.prototype.calcNiceExtent=function(t){Cy.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return ty(t=Py(t)/Py(this.base),this._extent)},e.prototype.normalize=function(t){return ey(t=Py(t)/Py(this.base),this._extent)},e.prototype.scale=function(t){return t=ny(t,this._extent),Iy(this.base,t)},e.type="log",e}(W_),Oy=Ey.prototype;function Ny(t,e){return Ay(t,rr(e))}Oy.getMinorTicks=Cy.getMinorTicks,Oy.getLabel=Cy.getLabel,W_.registerClass(Ey);const Ry=Ey;var ky=function(){function t(t,e,n){this._prepareParams(t,e,n)}return t.prototype._prepareParams=function(t,e,n){n[1]0&&s>0&&!l&&(a=0),a<0&&s<0&&!u&&(s=0));var c=this._determinedMin,d=this._determinedMax;return null!=c&&(a=c,l=!0),null!=d&&(s=d,u=!0),{min:a,max:s,minFixed:l,maxFixed:u,isBlank:h}},t.prototype.modifyDataMinMax=function(t,e){this[By[t]]=e},t.prototype.setDeterminedMinMax=function(t,e){this[zy[t]]=e},t.prototype.freeze=function(){this.frozen=!0},t}(),zy={min:"_determinedMin",max:"_determinedMax"},By={min:"_dataMin",max:"_dataMax"};function Fy(t,e,n){var i=t.rawExtentInfo;return i||(i=new ky(t,e,n),t.rawExtentInfo=i,i)}function Hy(t,e){return null==e?null:(0,P.eqNaN)(e)?NaN:t.parse(e)}function Vy(t,e){var n=t.type,i=Fy(t,e,t.getExtent()).calculate();t.setBlank(i.isBlank);var r=i.min,o=i.max,a=e.ecModel;if(a&&"time"===n){var s=cy("bar",a),l=!1;if(P.each(s,(function(t){l=l||t.getBaseAxis()===e.axis})),l){var u=dy(s),h=function(t,e,n,i){var r=n.axis.getExtent(),o=Math.abs(r[1]-r[0]),a=function(t,e,n){if(t&&e){var i=t[hy(e)];return null!=i&&null!=n?i[uy(n)]:i}}(i,n.axis);if(void 0===a)return{min:t,max:e};var s=1/0;P.each(a,(function(t){s=Math.min(t.offset,s)}));var l=-1/0;P.each(a,(function(t){l=Math.max(t.offset+t.width,l)})),s=Math.abs(s),l=Math.abs(l);var u=s+l,h=e-t,c=h/(1-(s+l)/o)-h;return e+=c*(l/u),t-=c*(s/u),{min:t,max:e}}(r,o,e,u);r=h.min,o=h.max}}return{extent:[r,o],fixMin:i.minFixed,fixMax:i.maxFixed}}function Gy(t,e){var n=e,i=Vy(t,n),r=i.extent,o=n.get("splitNumber");t instanceof Ry&&(t.base=n.get("logBase"));var a=t.type,s=n.get("interval"),l="interval"===a||"time"===a;t.setExtent(r[0],r[1]),t.calcNiceExtent({splitNumber:o,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?n.get("minInterval"):null,maxInterval:l?n.get("maxInterval"):null}),null!=s&&t.setInterval&&t.setInterval(s)}function Uy(t,e){if(e=e||t.get("type"))switch(e){case"category":return new ry({ordinalMeta:t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),extent:[1/0,-1/0]});case"time":return new Ty({locale:t.ecModel.getLocaleModel(),useUTC:t.ecModel.get("useUTC")});default:return new(W_.getClass(e)||sy)}}function Wy(t){var e,n,i=t.getLabelModel().get("formatter"),r="category"===t.type?t.scale.getExtent()[0]:null;return"time"===t.scale.type?(n=i,function(e,i){return t.scale.getFormattedLabel(e,i,n)}):P.isString(i)?function(e){return function(n){var i=t.scale.getLabel(n);return e.replace("{value}",null!=i?i:"")}}(i):P.isFunction(i)?(e=i,function(n,i){return null!=r&&(i=n.value-r),e(jy(t,n),i,null!=n.level?{level:n.level}:null)}):function(e){return t.scale.getLabel(e)}}function jy(t,e){return"category"===t.type?t.scale.getLabel(e):e.value}function Zy(t,e){var n=e*Math.PI/180,i=t.width,r=t.height,o=i*Math.abs(Math.cos(n))+Math.abs(r*Math.sin(n)),a=i*Math.abs(Math.sin(n))+Math.abs(r*Math.cos(n));return new Qt(t.x,t.y,o,a)}function Xy(t){var e=t.get("interval");return null==e?"auto":e}function qy(t){return"category"===t.type&&0===Xy(t.getLabelModel())}function Yy(t,e){var n={};return P.each(t.mapDimensionsAll(e),(function(e){n[V_(t,e)]=!0})),P.keys(n)}var Ky=function(){function t(){}return t.prototype.getNeedCrossZero=function(){return!this.option.scale},t.prototype.getCoordSysModel=function(){},t}();function Jy(t){return G_(null,t)}var $y={isDimensionStacked:H_,enableDataStack:F_,getStackedDimension:V_};function Qy(t,e){var n=e;e instanceof zl||(n=new zl(e));var i=Uy(n);return i.setExtent(t[0],t[1]),Gy(i,n),i}function tx(t){P.mixin(t,Ky)}function ex(t,e){return gl(t,null,null,"normal"!==(e=e||{}).state)}var nx=[],ix={registerPreprocessor:Vv,registerProcessor:Gv,registerPostInit:Uv,registerPostUpdate:Wv,registerUpdateLifecycle:jv,registerAction:Zv,registerCoordinateSystem:Xv,registerLayout:Yv,registerVisual:Kv,registerTransform:i_,registerLoading:Qv,registerMap:e_,registerImpl:function(t,e){Om[t]=e},PRIORITY:Gm,ComponentModel:Zu,ComponentView:Od,SeriesModel:Pd,ChartView:Wp,registerComponentModel:function(t){Zu.registerClass(t)},registerComponentView:function(t){Od.registerClass(t)},registerSeriesModel:function(t){Pd.registerClass(t)},registerChartView:function(t){Wp.registerClass(t)},registerSubTypeDefaulter:function(t,e){Zu.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){qi(t,e)}};function rx(t){(0,P.isArray)(t)?(0,P.each)(t,(function(t){rx(t)})):(0,P.indexOf)(nx,t)>=0||(nx.push(t),(0,P.isFunction)(t)&&(t={install:t}),t.install(ix))}function ox(t,e){return Math.abs(t-e)<1e-8}function ax(t,e,n){var i=0,r=t[0];if(!r)return!1;for(var o=1;on&&(t=r,n=a)}if(t)return function(t){for(var e=0,n=0,i=0,r=t.length,o=t[r-1][0],a=t[r-1][1],s=0;s>1^-(1&s),l=l>>1^-(1&l),r=s+=r,o=l+=o,i.push([s/n,l/n])}return i}function mx(t,e){return t=function(t){if(!t.UTF8Encoding)return t;var e=t,n=e.UTF8Scale;null==n&&(n=1024);var i=e.features;return P.each(i,(function(t){var e=t.geometry,i=e.encodeOffsets,r=e.coordinates;if(i)switch(e.type){case"LineString":e.coordinates=gx(r,i,n);break;case"Polygon":case"MultiLineString":px(r,i,n);break;case"MultiPolygon":P.each(r,(function(t,e){return px(t,i[e],n)}))}})),e.UTF8Encoding=!1,e}(t),P.map(P.filter(t.features,(function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0})),(function(t){var n=t.properties,i=t.geometry,r=[];switch(i.type){case"Polygon":var o=i.coordinates;r.push(new cx(o[0],o.slice(1)));break;case"MultiPolygon":P.each(i.coordinates,(function(t){t[0]&&r.push(new cx(t[0],t.slice(1)))}));break;case"LineString":r.push(new dx([i.coordinates]));break;case"MultiLineString":r.push(new dx(i.coordinates))}var a=new fx(n[e||"name"],r,n.cp);return a.properties=n,a}))}function vx(t,e,n,i,r,o,a,s){return new us({style:{text:t,font:e,align:n,verticalAlign:i,padding:r,rich:o,overflow:a?"truncate":null,lineHeight:s}}).getBoundingRect()}var _x=Fr();function yx(t,e){var n=P.map(e,(function(e){return t.scale.parse(e)}));return"time"===t.type&&n.length>0&&(n.sort(),n.unshift(n[0]),n.push(n[n.length-1])),n}function xx(t){var e=t.getLabelModel().get("customValues");if(e){var n=Wy(t),i=t.scale.getExtent(),r=yx(t,e),o=P.filter(r,(function(t){return t>=i[0]&&t<=i[1]}));return{labels:P.map(o,(function(e){var i={value:e};return{formattedLabel:n(i),rawLabel:t.scale.getLabel(i),tickValue:e}}))}}return"category"===t.type?function(t){var e=t.getLabelModel(),n=wx(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(t):function(t){var e=t.scale.getTicks(),n=Wy(t);return{labels:P.map(e,(function(e,i){return{level:e.level,formattedLabel:n(e,i),rawLabel:t.scale.getLabel(e),tickValue:e.value}}))}}(t)}function bx(t,e){var n=t.getTickModel().get("customValues");if(n){var i=t.scale.getExtent(),r=yx(t,n);return{ticks:P.filter(r,(function(t){return t>=i[0]&&t<=i[1]}))}}return"category"===t.type?function(t,e){var n,i,r=Sx(t,"ticks"),o=Xy(e),a=Tx(r,o);if(a)return a;e.get("show")&&!t.scale.isBlank()||(n=[]);if(P.isFunction(o))n=Ax(t,o,!0);else if("auto"===o){var s=wx(t,t.getLabelModel());i=s.labelCategoryInterval,n=P.map(s.labels,(function(t){return t.tickValue}))}else n=Cx(t,i=o,!0);return Mx(r,o,{ticks:n,tickCategoryInterval:i})}(t,e):{ticks:P.map(t.scale.getTicks(),(function(t){return t.value}))}}function wx(t,e){var n,i,r=Sx(t,"labels"),o=Xy(e),a=Tx(r,o);return a||(P.isFunction(o)?n=Ax(t,o):(i="auto"===o?function(t){var e=_x(t).autoInterval;return null!=e?e:_x(t).autoInterval=t.calculateCategoryInterval()}(t):o,n=Cx(t,i)),Mx(r,o,{labels:n,labelCategoryInterval:i}))}function Sx(t,e){return _x(t)[e]||(_x(t)[e]=[])}function Tx(t,e){for(var n=0;n1&&h/l>2&&(u=Math.round(Math.ceil(u/l)*l));var c=qy(t),d=a.get("showMinLabel")||c,f=a.get("showMaxLabel")||c;d&&u!==o[0]&&g(o[0]);for(var p=u;p<=o[1];p+=l)g(p);function g(t){var e={value:t};s.push(n?t:{formattedLabel:i(e),rawLabel:r.getLabel(e),tickValue:t})}return f&&p-l!==o[1]&&g(o[1]),s}function Ax(t,e,n){var i=t.scale,r=Wy(t),o=[];return P.each(i.getTicks(),(function(t){var a=i.getLabel(t),s=t.value;e(t.value,a)&&o.push(n?s:{formattedLabel:r(t),rawLabel:a,tickValue:s})})),o}var Lx=[0,1],Dx=function(){function t(t,e,n){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=e,this._extent=n||[0,0]}return t.prototype.contain=function(t){var e=this._extent,n=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]);return t>=n&&t<=i},t.prototype.containData=function(t){return this.scale.contain(t)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(t){return ar(t||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(t,e){var n=this._extent;n[0]=t,n[1]=e},t.prototype.dataToCoord=function(t,e){var n=this._extent,i=this.scale;return t=i.normalize(t),this.onBand&&"ordinal"===i.type&&Ix(n=n.slice(),i.count()),tr(t,Lx,n,e)},t.prototype.coordToData=function(t,e){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&Ix(n=n.slice(),i.count());var r=tr(t,n,Lx,e);return this.scale.scale(r)},t.prototype.pointToData=function(t,e){},t.prototype.getTicksCoords=function(t){var e=(t=t||{}).tickModel||this.getTickModel(),n=bx(this,e).ticks,i=(0,P.map)(n,(function(t){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(t):t),tickValue:t}}),this);return function(t,e,n,i){var r=e.length;if(!t.onBand||n||!r)return;var o,a,s=t.getExtent();if(1===r)e[0].coord=s[0],o=e[1]={coord:s[1],tickValue:e[0].tickValue};else{var l=e[r-1].tickValue-e[0].tickValue,u=(e[r-1].coord-e[0].coord)/l;(0,P.each)(e,(function(t){t.coord-=u/2}));var h=t.scale.getExtent();a=1+h[1]-e[r-1].tickValue,o={coord:e[r-1].coord+u*a,tickValue:h[1]+1},e.push(o)}var c=s[0]>s[1];d(e[0].coord,s[0])&&(i?e[0].coord=s[0]:e.shift());i&&d(s[0],e[0].coord)&&e.unshift({coord:s[0]});d(s[1],o.coord)&&(i?o.coord=s[1]:e.pop());i&&d(o.coord,s[1])&&e.push({coord:s[1]});function d(t,e){return t=nr(t),e=nr(e),c?t>e:t0&&t<100||(t=5);var e=this.scale.getMinorTicks(t);return(0,P.map)(e,(function(t){return(0,P.map)(t,(function(t){return{coord:this.dataToCoord(t),tickValue:t}}),this)}),this)},t.prototype.getViewLabels=function(){return xx(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var t=this._extent,e=this.scale.getExtent(),n=e[1]-e[0]+(this.onBand?1:0);0===n&&(n=1);var i=Math.abs(t[1]-t[0]);return Math.abs(i)/n},t.prototype.calculateCategoryInterval=function(){return function(t){var e=function(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}(t),n=Wy(t),i=(e.axisRotate-e.labelRotate)/180*Math.PI,r=t.scale,o=r.getExtent(),a=r.count();if(o[1]-o[0]<1)return 0;var s=1;a>40&&(s=Math.max(1,Math.floor(a/40)));for(var l=o[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),h=Math.abs(u*Math.cos(i)),c=Math.abs(u*Math.sin(i)),d=0,f=0;l<=o[1];l+=s){var p,g,m=bi(n({value:l}),e.font,"center","top");p=1.3*m.width,g=1.3*m.height,d=Math.max(d,p,7),f=Math.max(f,g,7)}var v=d/h,_=f/c;isNaN(v)&&(v=1/0),isNaN(_)&&(_=1/0);var y=Math.max(0,Math.floor(Math.min(v,_))),x=_x(t.model),b=t.getExtent(),w=x.lastAutoInterval,S=x.lastTickCount;return null!=w&&null!=S&&Math.abs(w-y)<=1&&Math.abs(S-a)<=1&&w>y&&x.axisExtent0===b[0]&&x.axisExtent1===b[1]?y=w:(x.lastTickCount=a,x.lastAutoInterval=y,x.axisExtent0=b[0],x.axisExtent1=b[1]),y}(this)},t}();function Ix(t,e){var n=(t[1]-t[0])/e/2;t[0]+=n,t[1]-=n}const Px=Dx;function Ex(t){var e=Zu.extend(t);return Zu.registerClass(e),e}function Ox(t){var e=Od.extend(t);return Od.registerClass(e),e}function Nx(t){var e=Pd.extend(t);return Pd.registerClass(e),e}function Rx(t){var e=Wp.extend(t);return Wp.registerClass(e),e}var kx=2*Math.PI,zx=ca.CMD,Bx=["top","right","bottom","left"];function Fx(t,e,n,i,r){var o=n.width,a=n.height;switch(t){case"top":i.set(n.x+o/2,n.y-e),r.set(0,-1);break;case"bottom":i.set(n.x+o/2,n.y+a+e),r.set(0,1);break;case"left":i.set(n.x-e,n.y+a/2),r.set(-1,0);break;case"right":i.set(n.x+o+e,n.y+a/2),r.set(1,0)}}function Hx(t,e,n,i,r,o,a,s,l){a-=t,s-=e;var u=Math.sqrt(a*a+s*s),h=(a/=u)*n+t,c=(s/=u)*n+e;if(Math.abs(i-r)%kx<1e-4)return l[0]=h,l[1]=c,u-n;if(o){var d=i;i=ma(r),r=ma(d)}else i=ma(i),r=ma(r);i>r&&(r+=kx);var f=Math.atan2(s,a);if(f<0&&(f+=kx),f>=i&&f<=r||f+kx>=i&&f+kx<=r)return l[0]=h,l[1]=c,u-n;var p=n*Math.cos(i)+t,g=n*Math.sin(i)+e,m=n*Math.cos(r)+t,v=n*Math.sin(r)+e,_=(p-a)*(p-a)+(g-s)*(g-s),y=(m-a)*(m-a)+(v-s)*(v-s);return _0))return;e=e/180*Math.PI,Zx.fromArray(t[0]),Xx.fromArray(t[1]),qx.fromArray(t[2]),Ut.sub(Yx,Zx,Xx),Ut.sub(Kx,qx,Xx);var n=Yx.len(),i=Kx.len();if(n<.001||i<.001)return;Yx.scale(1/n),Kx.scale(1/i);var r=Yx.dot(Kx);if(Math.cos(e)1&&Ut.copy(Qx,qx),Qx.toArray(t[1])}}(o,e.get("minTurnAngle")),n.setShape({points:o})}}}var $x=[],Qx=new Ut;function tb(t,e,n,i){var r="normal"===n,o=r?t:t.ensureState(n);o.ignore=e;var a=i.get("smooth");a&&!0===a&&(a=.3),o.shape=o.shape||{},a>0&&(o.shape.smooth=a);var s=i.getModel("lineStyle").getLineStyle();r?t.useStyle(s):o.style=s}function eb(t,e){var n=e.smooth,i=e.points;if(i)if(t.moveTo(i[0][0],i[0][1]),n>0&&i.length>=3){var r=J(i[0],i[1]),o=J(i[1],i[2]);if(!r||!o)return t.lineTo(i[1][0],i[1][1]),void t.lineTo(i[2][0],i[2][1]);var a=Math.min(r,o)*n,s=et([],i[1],i[0],a/r),l=et([],i[1],i[2],a/o),u=et([],s,l,.5);t.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),t.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var h=1;h0&&o&&w(-c/a,0,a);var m,v,_=t[0],y=t[a-1];return x(),m<0&&S(-m,.8),v<0&&S(v,.8),x(),b(m,v,1),b(v,m,-1),x(),m<0&&T(-m),v<0&&T(v),u}function x(){m=_.rect[e]-i,v=r-y.rect[e]-y.rect[n]}function b(t,e,n){if(t<0){var i=Math.min(e,-t);if(i>0){w(i*n,0,a);var r=i+t;r<0&&S(-r*n,1)}else S(-t*n,1)}}function w(n,i,r){0!==n&&(u=!0);for(var o=i;o0)for(l=0;l0;l--){w(-(o[l-1]*c),l,a)}}}function T(t){var e=t<0?-1:1;t=Math.abs(t);for(var n=Math.ceil(t/(a-1)),i=0;i0?w(n,0,i+1):w(-n,a-i-1,a),(t-=n)<=0)return}}function rb(t){var e=[];t.sort((function(t,e){return e.priority-t.priority}));var n=new Qt(0,0,0,0);function i(t){if(!t.ignore){var e=t.ensureState("emphasis");null==e.ignore&&(e.ignore=!1)}t.ignore=!0}for(var r=0;r=0&&n.attr(f.oldLayoutSelect),(0,P.indexOf)(u,"emphasis")>=0&&n.attr(f.oldLayoutEmphasis)),rl(n,s,e,a)}else if(n.attr(s),!wl(n).valueAnimation){var h=(0,P.retrieve2)(n.style.opacity,1);n.style.opacity=0,ol(n,{style:{opacity:h}},e,a)}if(f.oldLayout=s,n.states.select){var c=f.oldLayoutSelect={};cb(c,s,db),cb(c,n.states.select,db)}if(n.states.emphasis){var d=f.oldLayoutEmphasis={};cb(d,s,db),cb(d,n.states.emphasis,db)}Sl(n,a,l,e,e)}if(i&&!i.ignore&&!i.invisible){r=(f=hb(i)).oldLayout;var f,p={points:i.shape.points};r?(i.attr({shape:r}),rl(i,{shape:p},e)):(i.setShape(p),i.style.strokePercent=0,ol(i,{style:{strokePercent:1}},e)),f.oldLayout=p}},t}();var pb=Fr();function gb(t){t.registerUpdateLifecycle("series:beforeupdate",(function(t,e,n){var i=pb(e).labelManager;i||(i=pb(e).labelManager=new fb),i.clearLabels()})),t.registerUpdateLifecycle("series:layoutlabels",(function(t,e,n){var i=pb(e).labelManager;n.updatedSeries.forEach((function(t){i.addLabelsOfSeries(e.getViewOfSeriesModel(t))})),i.updateLayoutConfig(e),i.layout(e),i.processLabelsOverall()}))}function mb(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.eachSeriesByType("graph",(function(t){var n=t.getCategoriesData(),i=t.getGraph().data,r=n.mapArray(n.getName);i.filterSelf((function(t){var n=i.getItemModel(t).getShallow("category");if(null!=n){(0,P.isNumber)(n)&&(n=r[n]);for(var o=0;oi&&(i=e);var o=i%2?i+2:i+3;r=[];for(var a=0;a0?+d:1;C.scaleX=this._sizeX*A,C.scaleY=this._sizeY*A,this.setSymbolScale(1),Js(this,l,u,h)},e.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},e.prototype.fadeOut=function(t,e,n){var i=this.childAt(0),r=hs(this).dataIndex,o=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var a=i.getTextContent();a&&sl(a,{style:{opacity:0}},e,{dataIndex:r,removeOpt:o,cb:function(){i.removeTextContent()}})}else i.removeTextContent();sl(i,{style:{opacity:0},scaleX:0,scaleY:0},e,{dataIndex:r,cb:t,removeOpt:o})},e.getSymbolSize=function(t,e){return $g(t.getItemVisual(e,"symbolSize"))},e}(Fi);function Zb(t,e){this.parent.drift(t,e)}const Xb=jb;function qb(t,e,n,i){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(i.isIgnore&&i.isIgnore(n))&&!(i.clipShape&&!i.clipShape.contain(e[0],e[1]))&&"none"!==t.getItemVisual(n,"symbol")}function Yb(t){return null==t||(0,P.isObject)(t)||(t={isIgnore:t}),t||{}}function Kb(t){var e=t.hostModel,n=e.getModel("emphasis");return{emphasisItemStyle:n.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:n.get("focus"),blurScope:n.get("blurScope"),emphasisDisabled:n.get("disabled"),hoverScale:n.get("scale"),labelStatesModels:pl(e),cursorStyle:e.get("cursor")}}var Jb=function(){function t(t){this.group=new Fi,this._SymbolCtor=t||Xb}return t.prototype.updateData=function(t,e){this._progressiveEls=null,e=Yb(e);var n=this.group,i=t.hostModel,r=this._data,o=this._SymbolCtor,a=e.disableAnimation,s=Kb(t),l={disableAnimation:a},u=e.getSymbolPoint||function(e){return t.getItemLayout(e)};r||n.removeAll(),t.diff(r).add((function(i){var r=u(i);if(qb(t,r,i,e)){var a=new o(t,i,s,l);a.setPosition(r),t.setItemGraphicEl(i,a),n.add(a)}})).update((function(h,c){var d=r.getItemGraphicEl(c),f=u(h);if(qb(t,f,h,e)){var p=t.getItemVisual(h,"symbol")||"circle",g=d&&d.getSymbolType&&d.getSymbolType();if(!d||g&&g!==p)n.remove(d),(d=new o(t,h,s,l)).setPosition(f);else{d.updateData(t,h,s,l);var m={x:f[0],y:f[1]};a?d.attr(m):rl(d,m,i)}n.add(d),t.setItemGraphicEl(h,d)}else n.remove(d)})).remove((function(t){var e=r.getItemGraphicEl(t);e&&e.fadeOut((function(){n.remove(e)}),i)})).execute(),this._getSymbolPoint=u,this._data=t},t.prototype.updateLayout=function(){var t=this,e=this._data;e&&e.eachItemGraphicEl((function(e,n){var i=t._getSymbolPoint(n);e.setPosition(i),e.markRedraw()}))},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=Kb(t),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e,n){function i(t){t.isGroup||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[],n=Yb(n);for(var r=t.start;r0&&(_[0]=-_[0],_[1]=-_[1]);var x=v[0]<0?-1:1;if("start"!==i.__position&&"end"!==i.__position){var b=-Math.atan2(v[1],v[0]);u[0].8?"left":h[0]<-.8?"right":"center",d=h[1]>.8?"top":h[1]<-.8?"bottom":"middle";break;case"start":i.x=-h[0]*p+l[0],i.y=-h[1]*g+l[1],c=h[0]>.8?"right":h[0]<-.8?"left":"center",d=h[1]>.8?"bottom":h[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":i.x=p*x+l[0],i.y=l[1]+w,c=v[0]<0?"right":"left",i.originX=-p*x,i.originY=-w;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=y[0],i.y=y[1]+w,c="center",i.originY=-w;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-p*x+u[0],i.y=u[1]+w,c=v[0]>=0?"right":"left",i.originX=p*x,i.originY=-w}i.scaleX=i.scaleY=r,i.setStyle({verticalAlign:i.__verticalAlign||d,align:i.__align||c})}}}function S(t,e){var n=t.__specifiedRotation;if(null==n){var i=a.tangentAt(e);t.attr("rotation",(1===e?-1:1)*Math.PI/2-Math.atan2(i[1],i[0]))}else t.attr("rotation",n)}},e}(Fi);const hw=uw;function cw(t){var e=t.hostModel,n=e.getModel("emphasis");return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:n.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:n.get("disabled"),blurScope:n.get("blurScope"),focus:n.get("focus"),labelStatesModels:pl(e)}}function dw(t){return isNaN(t[0])||isNaN(t[1])}function fw(t){return t&&!dw(t[0])&&!dw(t[1])}const pw=function(){function t(t){this.group=new Fi,this._LineCtor=t||hw}return t.prototype.updateData=function(t){var e=this;this._progressiveEls=null;var n=this,i=n.group,r=n._lineData;n._lineData=t,r||i.removeAll();var o=cw(t);t.diff(r).add((function(n){e._doAdd(t,n,o)})).update((function(n,i){e._doUpdate(r,t,i,n,o)})).remove((function(t){i.remove(r.getItemGraphicEl(t))})).execute()},t.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl((function(e,n){e.updateLayout(t,n)}),this)},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=cw(t),this._lineData=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e){function n(t){t.isGroup||function(t){return t.animators&&t.animators.length>0}(t)||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[];for(var i=t.start;i3?1.4:r>1?1.2:1.1;yw(this,"zoom","zoomOnMouseWheel",t,{scale:i>0?s:1/s,originX:o,originY:a,isAvailableBehavior:null})}if(n){var l=Math.abs(i);yw(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:(i>0?1:-1)*(l>3?.4:l>1?.15:.05),originX:o,originY:a,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(t){mw(this._zr,"globalPan")||yw(this,"zoom",null,t,{scale:t.pinchScale>1?1.1:1/1.1,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})},e}(ut);function yw(t,e,n,i,r){t.pointerChecker&&t.pointerChecker(i,r.originX,r.originY)&&(Lt(i.event),xw(t,e,n,i,r))}function xw(t,e,n,i,r){r.isAvailableBehavior=(0,P.bind)(bw,null,n,i),t.trigger(e,r)}function bw(t,e,n){var i=n[t];return!t||i&&(!(0,P.isString)(i)||e.event[i+"Key"])}const ww=_w;var Sw={axisPointer:1,tooltip:1,brush:1};function Tw(t,e,n){var i=e.getComponentByElement(t.topTarget),r=i&&i.coordinateSystem;return i&&i!==n&&!Sw.hasOwnProperty(i.mainType)&&r&&r.model!==n}var Mw=[],Cw=[],Aw=[],Lw=je,Dw=Q,Iw=Math.abs;function Pw(t,e,n){for(var i,r=t[0],o=t[1],a=t[2],s=1/0,l=n*n,u=.1,h=.1;h<=.9;h+=.1){Mw[0]=Lw(r[0],o[0],a[0],h),Mw[1]=Lw(r[1],o[1],a[1],h),(f=Iw(Dw(Mw,e)-l))=0?i+=u:i-=u:p>=0?i-=u:i+=u}return i}function Ew(t,e){var n=[],i=qe,r=[[],[],[]],o=[[],[]],a=[];e/=2,t.eachEdge((function(t,s){var l=t.getLayout(),u=t.getVisual("fromSymbol"),h=t.getVisual("toSymbol");l.__original||(l.__original=[k(l[0]),k(l[1])],l[2]&&l.__original.push(k(l[2])));var c=l.__original;if(null!=l[2]){if(R(r[0],c[0]),R(r[1],c[2]),R(r[2],c[1]),u&&"none"!==u){var d=Pb(t.node1),f=Pw(r,c[0],d*e);i(r[0][0],r[1][0],r[2][0],f,n),r[0][0]=n[3],r[1][0]=n[4],i(r[0][1],r[1][1],r[2][1],f,n),r[0][1]=n[3],r[1][1]=n[4]}if(h&&"none"!==h){d=Pb(t.node2),f=Pw(r,c[1],d*e);i(r[0][0],r[1][0],r[2][0],f,n),r[1][0]=n[1],r[2][0]=n[2],i(r[0][1],r[1][1],r[2][1],f,n),r[1][1]=n[1],r[2][1]=n[2]}R(l[0],r[0]),R(l[1],r[2]),R(l[2],r[1])}else{if(R(o[0],c[0]),R(o[1],c[1]),H(a,o[1],o[0]),Y(a,a),u&&"none"!==u){d=Pb(t.node1);F(o[0],o[0],a,d*e)}if(h&&"none"!==h){d=Pb(t.node2);F(o[1],o[1],a,-d*e)}R(l[0],o[0]),R(l[1],o[1])}}))}function Ow(t){return"view"===t.type}var Nw=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return D(e,t),e.prototype.init=function(t,e){var n=new $b,i=new pw,r=this.group;this._controller=new ww(e.getZr()),this._controllerHost={target:r},r.add(n.group),r.add(i.group),this._symbolDraw=n,this._lineDraw=i,this._firstRender=!0},e.prototype.render=function(t,e,n){var i=this,r=t.coordinateSystem;this._model=t;var o=this._symbolDraw,a=this._lineDraw,s=this.group;if(Ow(r)){var l={x:r.x,y:r.y,scaleX:r.scaleX,scaleY:r.scaleY};this._firstRender?s.attr(l):rl(s,l,t)}Ew(t.getGraph(),Ib(t));var u=t.getData();o.updateData(u);var h=t.getEdgeData();a.updateData(h),this._updateNodeAndLinkScale(),this._updateController(t,e,n),clearTimeout(this._layoutTimeout);var c=t.forceLayout,d=t.get(["force","layoutAnimation"]);c&&this._startForceLayoutIteration(c,d);var f=t.get("layout");u.graph.eachNode((function(e){var n=e.dataIndex,r=e.getGraphicEl(),o=e.getModel();if(r){r.off("drag").off("dragend");var a=o.get("draggable");a&&r.on("drag",(function(o){switch(f){case"force":c.warmUp(),!i._layouting&&i._startForceLayoutIteration(c,d),c.setFixed(n),u.setItemLayout(n,[r.x,r.y]);break;case"circular":u.setItemLayout(n,[r.x,r.y]),e.setLayout({fixed:!0},!0),Nb(t,"symbolSize",e,[o.offsetX,o.offsetY]),i.updateLayout(t);break;default:u.setItemLayout(n,[r.x,r.y]),Lb(t.getGraph(),t),i.updateLayout(t)}})).on("dragend",(function(){c&&c.setUnfixed(n)})),r.setDraggable(a,!!o.get("cursor")),"adjacency"===o.get(["emphasis","focus"])&&(hs(r).focus=e.getAdjacentDataIndices())}})),u.graph.eachEdge((function(t){var e=t.getGraphicEl(),n=t.getModel().get(["emphasis","focus"]);e&&"adjacency"===n&&(hs(e).focus={edge:[t.dataIndex],node:[t.node1.dataIndex,t.node2.dataIndex]})}));var p="circular"===t.get("layout")&&t.get(["circular","rotateLabel"]),g=u.getLayout("cx"),m=u.getLayout("cy");u.graph.eachNode((function(t){kb(t,p,g,m)})),this._firstRender=!1},e.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},e.prototype._startForceLayoutIteration=function(t,e){var n=this;!function i(){t.step((function(t){n.updateLayout(n._model),(n._layouting=!t)&&(e?n._layoutTimeout=setTimeout(i,16):i())}))}()},e.prototype._updateController=function(t,e,n){var i=this,r=this._controller,o=this._controllerHost,a=this.group;r.setPointerChecker((function(e,i,r){var o=a.getBoundingRect();return o.applyTransform(a.transform),o.contain(i,r)&&!Tw(e,n,t)})),Ow(t.coordinateSystem)?(r.enable(t.get("roam")),o.zoomLimit=t.get("scaleLimit"),o.zoom=t.coordinateSystem.getZoom(),r.off("pan").off("zoom").on("pan",(function(e){!function(t,e,n){var i=t.target;i.x+=e,i.y+=n,i.dirty()}(o,e.dx,e.dy),n.dispatchAction({seriesId:t.id,type:"graphRoam",dx:e.dx,dy:e.dy})})).on("zoom",(function(e){!function(t,e,n,i){var r=t.target,o=t.zoomLimit,a=t.zoom=t.zoom||1;if(a*=e,o){var s=o.min||0,l=o.max||1/0;a=Math.max(Math.min(l,a),s)}var u=a/t.zoom;t.zoom=a,r.x-=(n-r.x)*(u-1),r.y-=(i-r.y)*(u-1),r.scaleX*=u,r.scaleY*=u,r.dirty()}(o,e.scale,e.originX,e.originY),n.dispatchAction({seriesId:t.id,type:"graphRoam",zoom:e.scale,originX:e.originX,originY:e.originY}),i._updateNodeAndLinkScale(),Ew(t.getGraph(),Ib(t)),i._lineDraw.updateLayout(),n.updateLabelLayout()}))):r.disable()},e.prototype._updateNodeAndLinkScale=function(){var t=this._model,e=t.getData(),n=Ib(t);e.eachItemGraphicEl((function(t,e){t&&t.setSymbolScale(n)}))},e.prototype.updateLayout=function(t){Ew(t.getGraph(),Ib(t)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},e.prototype.remove=function(){clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},e.type="graph",e}(Wp);const Rw=Nw;function kw(t){return"_EC_"+t}var zw=function(){function t(t){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=t||!1}return t.prototype.isDirected=function(){return this._directed},t.prototype.addNode=function(t,e){t=null==t?""+e:""+t;var n=this._nodesMap;if(!n[kw(t)]){var i=new Bw(t,e);return i.hostGraph=this,this.nodes.push(i),n[kw(t)]=i,i}},t.prototype.getNodeByIndex=function(t){var e=this.data.getRawIndex(t);return this.nodes[e]},t.prototype.getNodeById=function(t){return this._nodesMap[kw(t)]},t.prototype.addEdge=function(t,e,n){var i=this._nodesMap,r=this._edgesMap;if(P.isNumber(t)&&(t=this.nodes[t]),P.isNumber(e)&&(e=this.nodes[e]),t instanceof Bw||(t=i[kw(t)]),e instanceof Bw||(e=i[kw(e)]),t&&e){var o=t.id+"-"+e.id,a=new Fw(t,e,n);return a.hostGraph=this,this._directed&&(t.outEdges.push(a),e.inEdges.push(a)),t.edges.push(a),t!==e&&e.edges.push(a),this.edges.push(a),r[o]=a,a}},t.prototype.getEdgeByIndex=function(t){var e=this.edgeData.getRawIndex(t);return this.edges[e]},t.prototype.getEdge=function(t,e){t instanceof Bw&&(t=t.id),e instanceof Bw&&(e=e.id);var n=this._edgesMap;return this._directed?n[t+"-"+e]:n[t+"-"+e]||n[e+"-"+t]},t.prototype.eachNode=function(t,e){for(var n=this.nodes,i=n.length,r=0;r=0&&t.call(e,n[r],r)},t.prototype.eachEdge=function(t,e){for(var n=this.edges,i=n.length,r=0;r=0&&n[r].node1.dataIndex>=0&&n[r].node2.dataIndex>=0&&t.call(e,n[r],r)},t.prototype.breadthFirstTraverse=function(t,e,n,i){if(e instanceof Bw||(e=this._nodesMap[kw(e)]),e){for(var r="out"===n?"outEdges":"in"===n?"inEdges":"edges",o=0;o=0&&n.node2.dataIndex>=0}));for(r=0,o=i.length;r=0&&this[t][e].setItemVisual(this.dataIndex,n,i)},getVisual:function(n){return this[t][e].getItemVisual(this.dataIndex,n)},setLayout:function(n,i){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,n,i)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}}P.mixin(Bw,Hw("hostGraph","data")),P.mixin(Fw,Hw("hostGraph","edgeData"));const Vw=zw;var Gw=Fr();function Uw(t,e){if(Gw(i=this).mainData===i){var n=(0,P.extend)({},Gw(this).datas);n[this.dataType]=e,qw(e,n,t)}else Yw(e,this.dataType,Gw(this).mainData,t);var i;return e}function Ww(t,e){return t.struct&&t.struct.update(),e}function jw(t,e){return(0,P.each)(Gw(e).datas,(function(n,i){n!==e&&Yw(n.cloneShallow(),i,e,t)})),e}function Zw(t){var e=Gw(this).mainData;return null==t||null==e?e:Gw(e).datas[t]}function Xw(){var t=Gw(this).mainData;return null==t?[{data:t}]:(0,P.map)((0,P.keys)(Gw(t).datas),(function(e){return{type:e,data:Gw(t).datas[e]}}))}function qw(t,e,n){Gw(t).datas={},(0,P.each)(e,(function(e,i){Yw(e,i,t,n)}))}function Yw(t,e,n,i){Gw(n).datas[e]=t,Gw(t).mainData=n,t.dataType=e,i.struct&&(t[i.structAttr]=i.struct,i.struct[i.datasAttr[e]]=t),t.getLinkedData=Zw,t.getLinkedDataAll=Xw}const Kw=function(t){var e=t.mainData,n=t.datas;n||(n={main:e},t.datasAttr={main:"data"}),t.datas=t.mainData=null,qw(e,n,t),(0,P.each)(n,(function(n){(0,P.each)(e.TRANSFERABLE_METHODS,(function(e){n.wrapMethod(e,(0,P.curry)(Uw,t))}))})),e.wrapMethod("cloneShallow",(0,P.curry)(jw,t)),(0,P.each)(e.CHANGABLE_METHODS,(function(n){e.wrapMethod(n,(0,P.curry)(Ww,t))})),(0,P.assert)(n[e.dataType]===e)};var Jw=function(){function t(t,e){this._getDataWithEncodedVisual=t,this._getRawData=e}return t.prototype.getAllNames=function(){var t=this._getRawData();return t.mapArray(t.getName)},t.prototype.containName=function(t){return this._getRawData().indexOfName(t)>=0},t.prototype.indexOfName=function(t){return this._getDataWithEncodedVisual().indexOfName(t)},t.prototype.getItemVisual=function(t,e){return this._getDataWithEncodedVisual().getItemVisual(t,e)},t}();const $w=Jw;var Qw=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.hasSymbolVisual=!0,n}return D(e,t),e.prototype.init=function(e){t.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new $w(i,i),this.fillDataTextStyle(e.edges||e.links),this._updateCategoriesData()},e.prototype.mergeOption=function(e){t.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(e.edges||e.links),this._updateCategoriesData()},e.prototype.mergeDefaultAndTheme=function(e){t.prototype.mergeDefaultAndTheme.apply(this,arguments),Lr(e,"edgeLabel",["show"])},e.prototype.getInitialData=function(t,e){var n,i=t.edges||t.links||[],r=t.data||t.nodes||[],o=this;if(r&&i){bb(n=this)&&(n.__curvenessList=[],n.__edgeMap={},wb(n));var a=function(t,e,n,i,r){for(var o=new Vw(i),a=0;a "+d)),u++)}var f,p=n.get("coordinateSystem");if("cartesian2d"===p||"polar"===p)f=G_(t,n);else{var g=Lh.get(p),m=g&&g.dimensions||[];P.indexOf(m,"value")<0&&m.concat(["value"]);var v=N_(t,{coordDimensions:m,encodeDefine:n.getEncode()}).dimensions;(f=new E_(v,n)).initData(t)}var _=new E_(["value"],n);return _.initData(l,s),r&&r(f,_),Kw({mainData:f,struct:o,structAttr:"graph",datas:{node:f,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),o.update(),o}(r,i,this,!0,(function(t,e){t.wrapMethod("getItemModel",(function(t){var e=o._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t}));var n=zl.prototype.getModel;function i(t,e){var i=n.call(this,t,e);return i.resolveParentPath=r,i}function r(t){if(t&&("label"===t[0]||"label"===t[1])){var e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}e.wrapMethod("getItemModel",(function(t){return t.resolveParentPath=r,t.getModel=i,t}))}));return P.each(a.edges,(function(t){!function(t,e,n,i){if(bb(n)){var r=Sb(t,e,n),o=n.__edgeMap,a=o[Tb(r)];o[r]&&!a?o[r].isForward=!0:a&&o[r]&&(a.isForward=!0,o[r].isForward=!1),o[r]=o[r]||[],o[r].push(i)}}(t.node1,t.node2,this,t.dataIndex)}),this),a.data}},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.getCategoriesData=function(){return this._categoriesData},e.prototype.formatTooltip=function(t,e,n){if("edge"===n){var i=this.getData(),r=this.getDataParams(t,n),o=i.graph.getEdgeByIndex(t),a=i.getName(o.node1.dataIndex),s=i.getName(o.node2.dataIndex),l=[];return null!=a&&l.push(a),null!=s&&l.push(s),ud("nameValue",{name:l.join(" > "),value:r.value,noValue:null==r.value})}return xd({series:this,dataIndex:t,multipleSeries:e})},e.prototype._updateCategoriesData=function(){var t=P.map(this.option.categories||[],(function(t){return null!=t.value?t:P.extend({value:0},t)})),e=new E_(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray((function(t){return e.getItemModel(t)}))},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.isAnimationEnabled=function(){return t.prototype.isAnimationEnabled.call(this)&&!("force"===this.get("layout")&&this.get(["force","layoutAnimation"]))},e.type="series.graph",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(Pd);const tS=Qw;function eS(t,e){return t.pointToProjected?t.pointToProjected(e):t.pointToData(e)}var nS={type:"graphRoam",event:"graphRoam",update:"none"};function iS(t,e){var n=e.rippleEffectColor||e.color;t.eachChild((function(t){t.attr({z:e.z,zlevel:e.zlevel,style:{stroke:"stroke"===e.brushType?n:null,fill:"fill"===e.brushType?n:null}})}))}var rS=function(t){function e(e,n){var i=t.call(this)||this,r=new Xb(e,n),o=new Fi;return i.add(r),i.add(o),i.updateData(e,n),i}return D(e,t),e.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},e.prototype.startEffectAnimation=function(t){for(var e=t.symbolType,n=t.color,i=t.rippleNumber,r=this.childAt(1),o=0;o0&&(o=this._getLineLength(i)/l*1e3),o!==this._period||a!==this._loop||s!==this._roundTrip){i.stopAnimation();var h=void 0;h=P.isFunction(u)?u(n):u,i.__t>0&&(h=-o*i.__t),this._animateSymbol(i,o,h,a,s)}this._period=o,this._loop=a,this._roundTrip=s}},e.prototype._animateSymbol=function(t,e,n,i,r){if(e>0){t.__t=0;var o=this,a=t.animate("",i).when(r?2*e:e,{__t:r?2:1}).delay(n).during((function(){o._updateSymbolPosition(t)}));i||a.done((function(){o.remove(t)})),a.start()}},e.prototype._getLineLength=function(t){return J(t.__p1,t.__cp1)+J(t.__cp1,t.__p2)},e.prototype._updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},e.prototype.updateData=function(t,e,n){this.childAt(0).updateData(t,e,n),this._updateEffectSymbol(t,e)},e.prototype._updateSymbolPosition=function(t){var e=t.__p1,n=t.__p2,i=t.__cp1,r=t.__t<1?t.__t:2-t.__t,o=[t.x,t.y],a=o.slice(),s=je,l=Ze;o[0]=s(e[0],i[0],n[0],r),o[1]=s(e[1],i[1],n[1],r);var u=t.__t<1?l(e[0],i[0],n[0],r):l(n[0],i[0],e[0],1-r),h=t.__t<1?l(e[1],i[1],n[1],r):l(n[1],i[1],e[1],1-r);t.rotation=-Math.atan2(h,u)-Math.PI/2,"line"!==this._symbolType&&"rect"!==this._symbolType&&"roundRect"!==this._symbolType||(void 0!==t.__lastT&&t.__lastT=0&&!(i[o]<=e);o--);o=Math.min(o,r-2)}else{for(o=a;oe);o++);o=Math.min(o-1,r-2)}var s=(e-i[o])/(i[o+1]-i[o]),l=n[o],u=n[o+1];t.x=l[0]*(1-s)+s*u[0],t.y=l[1]*(1-s)+s*u[1];var h=t.__t<1?u[0]-l[0]:l[0]-u[0],c=t.__t<1?u[1]-l[1]:l[1]-u[1];t.rotation=-Math.atan2(c,h)-Math.PI/2,this._lastFrame=o,this._lastFramePercent=e,t.ignore=!1}},e}(dS);const mS=gS;var vS=function(){this.polyline=!1,this.curveness=0,this.segs=[]},_S=function(t){function e(e){var n=t.call(this,e)||this;return n._off=0,n.hoverDataIdx=-1,n}return D(e,t),e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new vS},e.prototype.buildPath=function(t,e){var n,i=e.segs,r=e.curveness;if(e.polyline)for(n=this._off;n0){t.moveTo(i[n++],i[n++]);for(var a=1;a0){var c=(s+u)/2-(l-h)*r,d=(l+h)/2-(u-s)*r;t.quadraticCurveTo(c,d,u,h)}else t.lineTo(u,h)}this.incremental&&(this._off=n,this.notClear=!0)},e.prototype.findDataIndex=function(t,e){var n=this.shape,i=n.segs,r=n.curveness,o=this.style.lineWidth;if(n.polyline)for(var a=0,s=0;s0)for(var u=i[s++],h=i[s++],c=1;c0){if(pa(u,h,(u+d)/2-(h-f)*r,(h+f)/2-(d-u)*r,d,f,o,t,e))return a}else if(da(u,h,d,f,o,t,e))return a;a++}return-1},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect();return t=n[0],e=n[1],i.contain(t,e)?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape.segs,n=1/0,i=1/0,r=-1/0,o=-1/0,a=0;a0&&(o.dataIndex=n+t.__startIndex)}))},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();var xS={seriesType:"lines",plan:Nd(),reset:function(t){var e=t.coordinateSystem;if(e){var n=t.get("polyline"),i=t.pipelineContext.large;return{progress:function(r,o){var a=[];if(i){var s=void 0,l=r.end-r.start;if(n){for(var u=0,h=r.start;h0&&(l||s.configLayer(o,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(a/10+.9,1),0)})),r.updateData(i);var u=t.get("clip",!0)&&wS(t.coordinateSystem,!1,t);u?this.group.setClipPath(u):this.group.removeClipPath(),this._lastZlevel=o,this._finished=!0},e.prototype.incrementalPrepareRender=function(t,e,n){var i=t.getData();this._updateLineDraw(i,t).incrementalPrepareUpdate(i),this._clearLayer(n),this._finished=!1},e.prototype.incrementalRender=function(t,e,n){this._lineDraw.incrementalUpdate(t,e.getData()),this._finished=t.end===e.getData().count()},e.prototype.eachRendered=function(t){this._lineDraw&&this._lineDraw.eachRendered(t)},e.prototype.updateTransform=function(t,e,n){var i=t.getData(),r=t.pipelineContext;if(!this._finished||r.large||r.progressiveRender)return{update:!0};var o=bS.reset(t,e,n);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._lineDraw.updateLayout(),this._clearLayer(n)},e.prototype._updateLineDraw=function(t,e){var n=this._lineDraw,i=this._showEffect(e),r=!!e.get("polyline"),o=e.pipelineContext.large;return n&&i===this._hasEffet&&r===this._isPolyline&&o===this._isLargeDraw||(n&&n.remove(),n=this._lineDraw=o?new yS:new pw(r?i?mS:pS:i?dS:hw),this._hasEffet=i,this._isPolyline=r,this._isLargeDraw=o),this.group.add(n.group),n},e.prototype._showEffect=function(t){return!!t.get(["effect","show"])},e.prototype._clearLayer=function(t){var e=t.getZr();"svg"===e.painter.getType()||null==this._lastZlevel||e.painter.getLayer(this._lastZlevel).clear(!0)},e.prototype.remove=function(t,e){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(e)},e.prototype.dispose=function(t,e){this.remove(t,e)},e.type="lines",e}(Wp);var TS="undefined"==typeof Uint32Array?Array:Uint32Array,MS="undefined"==typeof Float64Array?Array:Float64Array;function CS(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=(0,P.map)(e,(function(t){var e={coords:[t[0].coord,t[1].coord]};return t[0].name&&(e.fromName=t[0].name),t[1].name&&(e.toName=t[1].name),(0,P.mergeAll)([e,t[0],t[1]])})))}var AS=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.visualStyleAccessPath="lineStyle",n.visualDrawType="stroke",n}return D(e,t),e.prototype.init=function(e){e.data=e.data||[],CS(e);var n=this._processFlatCoordsArray(e.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(e.data=new Float32Array(n.count)),t.prototype.init.apply(this,arguments)},e.prototype.mergeOption=function(e){if(CS(e),e.data){var n=this._processFlatCoordsArray(e.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(e.data=new Float32Array(n.count))}t.prototype.mergeOption.apply(this,arguments)},e.prototype.appendData=function(t){var e=this._processFlatCoordsArray(t.data);e.flatCoords&&(this._flatCoords?(this._flatCoords=(0,P.concatArray)(this._flatCoords,e.flatCoords),this._flatCoordsOffset=(0,P.concatArray)(this._flatCoordsOffset,e.flatCoordsOffset)):(this._flatCoords=e.flatCoords,this._flatCoordsOffset=e.flatCoordsOffset),t.data=new Float32Array(e.count)),this.getRawData().appendData(t.data)},e.prototype._getCoordsFromItemModel=function(t){var e=this.getData().getItemModel(t);return e.option instanceof Array?e.option:e.getShallow("coords")},e.prototype.getLineCoordsCount=function(t){return this._flatCoordsOffset?this._flatCoordsOffset[2*t+1]:this._getCoordsFromItemModel(t).length},e.prototype.getLineCoords=function(t,e){if(this._flatCoordsOffset){for(var n=this._flatCoordsOffset[2*t],i=this._flatCoordsOffset[2*t+1],r=0;r ")})},e.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},e.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?1e4:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?2e4:this.get("progressiveThreshold"):t},e.prototype.getZLevelKey=function(){var t=this.getModel("effect"),e=t.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:t.get("show")&&e>0?e+"":""},e.type="series.lines",e.dependencies=["grid","polar","geo","calendar"],e.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},e}(Pd);const LS=AS;function DS(t){return t instanceof Array||(t=[t,t]),t}const IS={seriesType:"lines",reset:function(t){var e=DS(t.get("symbol")),n=DS(t.get("symbolSize")),i=t.getData();return i.setVisual("fromSymbol",e&&e[0]),i.setVisual("toSymbol",e&&e[1]),i.setVisual("fromSymbolSize",n&&n[0]),i.setVisual("toSymbolSize",n&&n[1]),{dataEach:i.hasItemOption?function(t,e){var n=t.getItemModel(e),i=DS(n.getShallow("symbol",!0)),r=DS(n.getShallow("symbolSize",!0));i[0]&&t.setItemVisual(e,"fromSymbol",i[0]),i[1]&&t.setItemVisual(e,"toSymbol",i[1]),r[0]&&t.setItemVisual(e,"fromSymbolSize",r[0]),r[1]&&t.setItemVisual(e,"toSymbolSize",r[1])}:null}}};const PS=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.hasSymbolVisual=!0,n}return D(e,t),e.prototype.getInitialData=function(t,e){return G_(null,this,{useEncodeDefaulter:!0})},e.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?5e3:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?1e4:this.get("progressiveThreshold"):t},e.prototype.brushSelector=function(t,e,n){return n.point(e.getItemLayout(t))},e.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},e.type="series.scatter",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}},e}(Pd);var ES=function(){},OS=function(t){function e(e){var n=t.call(this,e)||this;return n._off=0,n.hoverDataIdx=-1,n}return D(e,t),e.prototype.getDefaultShape=function(){return new ES},e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.buildPath=function(t,e){var n,i=e.points,r=e.size,o=this.symbolProxy,a=o.shape,s=t.getContext?t.getContext():t,l=s&&r[0]<4,u=this.softClipShape;if(l)this._ctx=s;else{for(this._ctx=null,n=this._off;n=0;s--){var l=2*s,u=i[l]-o/2,h=i[l+1]-a/2;if(t>=u&&e>=h&&t<=u+o&&e<=h+a)return s}return-1},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect();return t=n[0],e=n[1],i.contain(t,e)?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape,n=e.points,i=e.size,r=i[0],o=i[1],a=1/0,s=1/0,l=-1/0,u=-1/0,h=0;h=0&&(l.dataIndex=n+(t.startIndex||0))}))},t.prototype.remove=function(){this._clear()},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();const RS=NS;const kS=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return D(e,t),e.prototype.render=function(t,e,n){var i=t.getData();this._updateSymbolDraw(i,t).updateData(i,{clipShape:this._getClipShape(t)}),this._finished=!0},e.prototype.incrementalPrepareRender=function(t,e,n){var i=t.getData();this._updateSymbolDraw(i,t).incrementalPrepareUpdate(i),this._finished=!1},e.prototype.incrementalRender=function(t,e,n){this._symbolDraw.incrementalUpdate(t,e.getData(),{clipShape:this._getClipShape(e)}),this._finished=t.end===e.getData().count()},e.prototype.updateTransform=function(t,e,n){var i=t.getData();if(this.group.dirty(),!this._finished||i.count()>1e4)return{update:!0};var r=lS("").reset(t,e,n);r.progress&&r.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(i)},e.prototype.eachRendered=function(t){this._symbolDraw&&this._symbolDraw.eachRendered(t)},e.prototype._getClipShape=function(t){if(t.get("clip",!0)){var e=t.coordinateSystem;return e&&e.getArea&&e.getArea(.1)}},e.prototype._updateSymbolDraw=function(t,e){var n=this._symbolDraw,i=e.pipelineContext.large;return n&&i===this._isLargeDraw||(n&&n.remove(),n=this._symbolDraw=i?new RS:new $b,this._isLargeDraw=i,this.group.removeAll()),this.group.add(n.group),n},e.prototype.remove=function(t,e){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},e.prototype.dispose=function(){},e.type="scatter",e}(Wp);const zS=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return D(e,t),e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e}(Zu);var BS=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return D(e,t),e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Ur).models[0]},e.type="cartesian2dAxis",e}(Zu);P.mixin(BS,Ky);var FS={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},HS=P.merge({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},FS),VS=P.merge({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},FS);const GS={category:HS,value:VS,time:P.merge({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},VS),log:P.defaults({logBase:10},VS)};var US={value:1,category:1,time:1,log:1};function WS(t,e,n,i){(0,P.each)(US,(function(r,o){var a=(0,P.merge)((0,P.merge)({},GS[o],!0),i,!0),s=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e+"Axis."+o,n}return D(n,t),n.prototype.mergeDefaultAndTheme=function(t,e){var n=Vu(this),i=n?Uu(t):{},r=e.getTheme();(0,P.merge)(t,r.get(o+"Axis")),(0,P.merge)(t,this.getDefaultOption()),t.type=jS(t),n&&Gu(t,i,n)},n.prototype.optionUpdated=function(){"category"===this.option.type&&(this.__ordinalMeta=q_.createByAxisModel(this))},n.prototype.getCategories=function(t){var e=this.option;if("category"===e.type)return t?e.data:this.__ordinalMeta.categories},n.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},n.type=e+"Axis."+o,n.defaultOption=a,n}(n);t.registerComponentModel(s)})),t.registerSubTypeDefaulter(e+"Axis",jS)}function jS(t){return t.type||(t.data?"category":"value")}const ZS=function(){function t(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return t.prototype.getAxis=function(t){return this._axes[t]},t.prototype.getAxes=function(){return P.map(this._dimList,(function(t){return this._axes[t]}),this)},t.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),P.filter(this.getAxes(),(function(e){return e.scale.type===t}))},t.prototype.addAxis=function(t){var e=t.dim;this._axes[e]=t,this._dimList.push(e)},t}();var XS=["x","y"];function qS(t){return"interval"===t.type||"time"===t.type}var YS=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cartesian2d",e.dimensions=XS,e}return D(e,t),e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,e=this.getAxis("y").scale;if(qS(t)&&qS(e)){var n=t.getExtent(),i=e.getExtent(),r=this.dataToPoint([n[0],i[0]]),o=this.dataToPoint([n[1],i[1]]),a=n[1]-n[0],s=i[1]-i[0];if(a&&s){var l=(o[0]-r[0])/a,u=(o[1]-r[1])/s,h=r[0]-n[0]*l,c=r[1]-i[0]*u,d=this._transform=[l,0,0,u,h,c];this._invTransform=Ht([],d)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(t){var e=this.getAxis("x"),n=this.getAxis("y");return e.contain(e.toLocalCoord(t[0]))&&n.contain(n.toLocalCoord(t[1]))},e.prototype.containData=function(t){return this.getAxis("x").containData(t[0])&&this.getAxis("y").containData(t[1])},e.prototype.containZone=function(t,e){var n=this.dataToPoint(t),i=this.dataToPoint(e),r=this.getArea(),o=new Qt(n[0],n[1],i[0]-n[0],i[1]-n[1]);return r.intersect(o)},e.prototype.dataToPoint=function(t,e,n){n=n||[];var i=t[0],r=t[1];if(this._transform&&null!=i&&isFinite(i)&&null!=r&&isFinite(r))return nt(n,t,this._transform);var o=this.getAxis("x"),a=this.getAxis("y");return n[0]=o.toGlobalCoord(o.dataToCoord(i,e)),n[1]=a.toGlobalCoord(a.dataToCoord(r,e)),n},e.prototype.clampData=function(t,e){var n=this.getAxis("x").scale,i=this.getAxis("y").scale,r=n.getExtent(),o=i.getExtent(),a=n.parse(t[0]),s=i.parse(t[1]);return(e=e||[])[0]=Math.min(Math.max(Math.min(r[0],r[1]),a),Math.max(r[0],r[1])),e[1]=Math.min(Math.max(Math.min(o[0],o[1]),s),Math.max(o[0],o[1])),e},e.prototype.pointToData=function(t,e){var n=[];if(this._invTransform)return nt(n,t,this._invTransform);var i=this.getAxis("x"),r=this.getAxis("y");return n[0]=i.coordToData(i.toLocalCoord(t[0]),e),n[1]=r.coordToData(r.toLocalCoord(t[1]),e),n},e.prototype.getOtherAxis=function(t){return this.getAxis("x"===t.dim?"y":"x")},e.prototype.getArea=function(t){t=t||0;var e=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),i=Math.min(e[0],e[1])-t,r=Math.min(n[0],n[1])-t,o=Math.max(e[0],e[1])-i+t,a=Math.max(n[0],n[1])-r+t;return new Qt(i,r,o,a)},e}(ZS);const KS=YS;var JS=function(t){function e(e,n,i,r,o){var a=t.call(this,e,n,i)||this;return a.index=0,a.type=r||"value",a.position=o||"bottom",a}return D(e,t),e.prototype.isHorizontal=function(){var t=this.position;return"top"===t||"bottom"===t},e.prototype.getGlobalExtent=function(t){var e=this.getExtent();return e[0]=this.toGlobalCoord(e[0]),e[1]=this.toGlobalCoord(e[1]),t&&e[0]>e[1]&&e.reverse(),e},e.prototype.pointToData=function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},e.prototype.setCategorySortInfo=function(t){if("category"!==this.type)return!1;this.model.option.categorySortInfo=t,this.scale.setSortInfo(t)},e}(Px);const $S=JS;function QS(t,e,n){n=n||{};var i=t.coordinateSystem,r=e.axis,o={},a=r.getAxesOnZeroOf()[0],s=r.position,l=a?"onZero":s,u=r.dim,h=i.getRect(),c=[h.x,h.x+h.width,h.y,h.y+h.height],d={left:0,right:1,top:0,bottom:1,onZero:2},f=e.get("offset")||0,p="x"===u?[c[2]-f,c[3]+f]:[c[0]-f,c[1]+f];if(a){var g=a.toGlobalCoord(a.dataToCoord(0));p[d.onZero]=Math.max(Math.min(g,p[1]),p[0])}o.position=["y"===u?p[d[l]]:c[0],"x"===u?p[d[l]]:c[3]],o.rotation=Math.PI/2*("x"===u?0:1);o.labelDirection=o.tickDirection=o.nameDirection={top:-1,bottom:1,left:-1,right:1}[s],o.labelOffset=a?p[d[s]]-p[d.onZero]:0,e.get(["axisTick","inside"])&&(o.tickDirection=-o.tickDirection),P.retrieve(n.labelInside,e.get(["axisLabel","inside"]))&&(o.labelDirection=-o.labelDirection);var m=e.get(["axisLabel","rotate"]);return o.labelRotate="top"===l?-m:m,o.z2=1,o}function tT(t){return"cartesian2d"===t.get("coordinateSystem")}function eT(t){var e={xAxisModel:null,yAxisModel:null};return P.each(e,(function(n,i){var r=i.replace(/Model$/,""),o=t.getReferringComponents(r,Ur).models[0];e[i]=o})),e}var nT=Math.log;var iT=function(){function t(t,e,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=XS,this._initCartesian(t,e,n),this.model=t}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(t,e){var n=this._axesMap;function i(t){var e,n=(0,P.keys)(t),i=n.length;if(i){for(var r=[],o=i-1;o>=0;o--){var a=t[+n[o]],s=a.model,l=a.scale;Y_(l)&&s.get("alignTicks")&&null==s.get("interval")?r.push(a):(Gy(l,s),Y_(l)&&(e=a))}r.length&&(e||Gy((e=r.pop()).scale,e.model),(0,P.each)(r,(function(t){!function(t,e,n){var i=sy.prototype,r=i.getTicks.call(n),o=i.getTicks.call(n,!0),a=r.length-1,s=i.getInterval.call(n),l=Vy(t,e),u=l.extent,h=l.fixMin,c=l.fixMax;if("log"===t.type){var d=nT(t.base);u=[nT(u[0])/d,nT(u[1])/d]}t.setExtent(u[0],u[1]),t.calcNiceExtent({splitNumber:a,fixMin:h,fixMax:c});var f=i.getExtent.call(t);h&&(u[0]=f[0]),c&&(u[1]=f[1]);var p=i.getInterval.call(t),g=u[0],m=u[1];if(h&&c)p=(m-g)/a;else if(h)for(m=u[0]+p*a;mu[0]&&isFinite(g)&&isFinite(u[0]);)p=J_(p),g=u[1]-p*a;else{t.getTicks().length-1>a&&(p=J_(p));var v=p*a;(g=nr((m=Math.ceil(u[1]/p)*p)-v))<0&&u[0]>=0?(g=0,m=nr(v)):m>0&&u[1]<=0&&(m=0,g=-nr(v))}var _=(r[0].value-o[0].value)/s,y=(r[a].value-o[a].value)/s;i.setExtent.call(t,g+p*_,m+p*y),i.setInterval.call(t,p),(_||y)&&i.setNiceExtent.call(t,g+p,m-p)}(t.scale,t.model,e.scale)})))}}this._updateScale(t,this.model),i(n.x),i(n.y);var r={};(0,P.each)(n.x,(function(t){oT(n,"y",t,r)})),(0,P.each)(n.y,(function(t){oT(n,"x",t,r)})),this.resize(this.model,e)},t.prototype.resize=function(t,e,n){var i=t.getBoxLayoutParams(),r=!n&&t.get("containLabel"),o=Hu(i,{width:e.getWidth(),height:e.getHeight()});this._rect=o;var a=this._axesList;function s(){(0,P.each)(a,(function(t){var e=t.isHorizontal(),n=e?[0,o.width]:[0,o.height],i=t.inverse?1:0;t.setExtent(n[i],n[1-i]),function(t,e){var n=t.getExtent(),i=n[0]+n[1];t.toGlobalCoord="x"===t.dim?function(t){return t+e}:function(t){return i-t+e},t.toLocalCoord="x"===t.dim?function(t){return t-e}:function(t){return i-t+e}}(t,e?o.x:o.y)}))}s(),r&&((0,P.each)(a,(function(t){if(!t.model.get(["axisLabel","inside"])){var e=function(t){var e=t.model,n=t.scale;if(e.get(["axisLabel","show"])&&!n.isBlank()){var i,r,o=n.getExtent();r=n instanceof ry?n.count():(i=n.getTicks()).length;var a,s=t.getLabelModel(),l=Wy(t),u=1;r>40&&(u=Math.ceil(r/40));for(var h=0;h0&&i>0||n<0&&i<0)}(t)}const sT=iT;var lT=Math.PI,uT=function(){function t(t,e){this.group=new Fi,this.opt=e,this.axisModel=t,(0,P.defaults)(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new Fi({x:e.position[0],y:e.position[1],rotation:e.rotation});n.updateTransform(),this._transformGroup=n}return t.prototype.hasBuilder=function(t){return!!hT[t]},t.prototype.add=function(t){hT[t](this.opt,this.axisModel,this.group,this._transformGroup)},t.prototype.getGroup=function(){return this.group},t.innerTextLayout=function(t,e,n){var i,r,o=hr(e-t);return cr(o)?(r=n>0?"top":"bottom",i="center"):cr(o-lT)?(r=n>0?"bottom":"top",i="center"):(r="middle",i=o>0&&o0?"right":"left":n>0?"left":"right"),{rotation:o,textAlign:i,textVerticalAlign:r}},t.makeAxisEventDataBase=function(t){var e={componentType:t.mainType,componentIndex:t.componentIndex};return e[t.mainType+"Index"]=t.componentIndex,e},t.isLabelSilent=function(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)},t}(),hT={axisLine:function(t,e,n,i){var r=e.get(["axisLine","show"]);if("auto"===r&&t.handleAutoShown&&(r=t.handleAutoShown("axisLine")),r){var o=e.axis.getExtent(),a=i.transform,s=[o[0],0],l=[o[1],0],u=s[0]>l[0];a&&(nt(s,s,a),nt(l,l,a));var h=(0,P.extend)({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),c=new Nf({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:h,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});yp(c.shape,c.style.lineWidth),c.anid="line",n.add(c);var d=e.get(["axisLine","symbol"]);if(null!=d){var f=e.get(["axisLine","symbolSize"]);(0,P.isString)(d)&&(d=[d,d]),((0,P.isString)(f)||(0,P.isNumber)(f))&&(f=[f,f]);var p=Qg(e.get(["axisLine","symbolOffset"])||0,f),g=f[0],m=f[1];(0,P.each)([{rotate:t.rotation+Math.PI/2,offset:p[0],r:0},{rotate:t.rotation-Math.PI/2,offset:p[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],(function(e,i){if("none"!==d[i]&&null!=d[i]){var r=Jg(d[i],-g/2,-m/2,g,m,h.stroke,!0),o=e.r+e.offset,a=u?l:s;r.attr({rotation:e.rotate,x:a[0]+o*Math.cos(t.rotation),y:a[1]-o*Math.sin(t.rotation),silent:!0,z2:11}),n.add(r)}}))}}},axisTickLabel:function(t,e,n,i){var r=function(t,e,n,i){var r=n.axis,o=n.getModel("axisTick"),a=o.get("show");"auto"===a&&i.handleAutoShown&&(a=i.handleAutoShown("axisTick"));if(!a||r.scale.isBlank())return;for(var s=o.getModel("lineStyle"),l=i.tickDirection*o.get("length"),u=pT(r.getTicksCoords(),e.transform,l,(0,P.defaults)(s.getLineStyle(),{stroke:n.get(["axisLine","lineStyle","color"])}),"ticks"),h=0;hc[1]?-1:1,f=["start"===s?c[0]-d*h:"end"===s?c[1]+d*h:(c[0]+c[1])/2,fT(s)?t.labelOffset+l*h:0],p=e.get("nameRotate");null!=p&&(p=p*lT/180),fT(s)?o=uT.innerTextLayout(t.rotation,null!=p?p:t.rotation,l):(o=function(t,e,n,i){var r,o,a=hr(n-t),s=i[0]>i[1],l="start"===e&&!s||"start"!==e&&s;cr(a-lT/2)?(o=l?"bottom":"top",r="center"):cr(a-1.5*lT)?(o=l?"top":"bottom",r="center"):(o="middle",r=a<1.5*lT&&a>lT/2?l?"left":"right":l?"right":"left");return{rotation:a,textAlign:r,textVerticalAlign:o}}(t.rotation,s,p||0,c),null!=(a=t.axisNameAvailableWidth)&&(a=Math.abs(a/Math.sin(o.rotation)),!isFinite(a)&&(a=null)));var g=u.getFont(),m=e.get("nameTruncate",!0)||{},v=m.ellipsis,_=(0,P.retrieve)(t.nameTruncateMaxWidth,m.maxWidth,a),y=new us({x:f[0],y:f[1],rotation:o.rotation,silent:uT.isLabelSilent(e),style:gl(u,{text:r,font:g,overflow:"truncate",width:_,ellipsis:v,fill:u.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:u.get("align")||o.textAlign,verticalAlign:u.get("verticalAlign")||o.textVerticalAlign}),z2:1});if(Op({el:y,componentModel:e,itemName:r}),y.__fullText=r,y.anid="name",e.get("triggerEvent")){var x=uT.makeAxisEventDataBase(e);x.targetType="axisName",x.name=r,hs(y).eventData=x}i.add(y),y.updateTransform(),n.add(y),y.decomposeTransform()}}};function cT(t){t&&(t.ignore=!0)}function dT(t,e){var n=t&&t.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(n&&i){var r=Nt([]);return Bt(r,r,-t.rotation),n.applyTransform(kt([],r,t.getLocalTransform())),i.applyTransform(kt([],r,e.getLocalTransform())),n.intersect(i)}}function fT(t){return"middle"===t||"center"===t}function pT(t,e,n,i,r){for(var o=[],a=[],s=[],l=0;l=0||t===e}function _T(t){var e=(t.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return e&&e.axesInfo[xT(t)]}function yT(t){return!!t.get(["handle","show"])}function xT(t){return t.type+"||"+t.id}var bT={},wT=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return D(e,t),e.prototype.render=function(e,n,i,r){this.axisPointerClass&&function(t){var e=_T(t);if(e){var n=e.axisPointerModel,i=e.axis.scale,r=n.option,o=n.get("status"),a=n.get("value");null!=a&&(a=i.parse(a));var s=yT(n);null==o&&(r.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==a||a>l[1])&&(a=l[1]),aa)return!0;if(o){var s=_T(t).seriesDataCount,l=i.getExtent();return Math.abs(l[0]-l[1])/s>a}return!1}return!0===n},t.prototype.makeElOption=function(t,e,n,i,r){},t.prototype.createPointerEl=function(t,e,n,i){var o=e.pointer;if(o){var a=NT(t).pointerEl=new r[o.type](RT(e.pointer));t.add(a)}},t.prototype.createLabelEl=function(t,e,n,i){if(e.label){var r=NT(t).labelEl=new us(RT(e.label));t.add(r),HT(r,i)}},t.prototype.updatePointerEl=function(t,e,n){var i=NT(t).pointerEl;i&&e.pointer&&(i.setStyle(e.pointer.style),n(i,{shape:e.pointer.shape}))},t.prototype.updateLabelEl=function(t,e,n,i){var r=NT(t).labelEl;r&&(r.setStyle(e.label.style),n(r,{x:e.label.x,y:e.label.y}),HT(r,i))},t.prototype._renderHandle=function(t){if(!this._dragging&&this.updateHandleTransform){var e,n=this._axisPointerModel,i=this._api.getZr(),r=this._handle,o=n.getModel("handle"),a=n.get("status");if(!o.get("show")||!a||"hide"===a)return r&&i.remove(r),void(this._handle=null);this._handle||(e=!0,r=this._handle=Dp(o.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){Lt(t.event)},onmousedown:kT(this._onHandleDragMove,this,0,0),drift:kT(this._onHandleDragMove,this),ondragend:kT(this._onHandleDragEnd,this)}),i.add(r)),GT(r,n,!1),r.setStyle(o.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=o.get("size");P.isArray(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,Yp(this,"_doDispatchAxisPointer",o.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,e)}},t.prototype._moveHandleToValue=function(t,e){BT(this._axisPointerModel,!e&&this._moveAnimation,this._handle,VT(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(t,e){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(VT(n),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(VT(i)),NT(n).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){if(this._handle){var t=this._payloadInfo,e=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:e.axis.dim,axisIndex:e.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var t=this._axisPointerModel.get("value");this._moveHandleToValue(t),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),n=this._group,i=this._handle;e&&n&&(this._lastGraphicKey=null,n&&e.remove(n),i&&e.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),Kp(this,"_doDispatchAxisPointer")},t.prototype.doClear=function(){},t.prototype.buildLabel=function(t,e,n){return{x:t[n=n||0],y:t[1-n],width:e[n],height:e[1-n]}},t}();function BT(t,e,n,i){FT(NT(n).lastProp,i)||(NT(n).lastProp=i,e?rl(n,i,t):(n.stopAnimation(),n.attr(i)))}function FT(t,e){if(P.isObject(t)&&P.isObject(e)){var n=!0;return P.each(e,(function(e,i){n=n&&FT(t[i],e)})),!!n}return t===e}function HT(t,e){t[e.get(["label","show"])?"show":"hide"]()}function VT(t){return{x:t.x||0,y:t.y||0,rotation:t.rotation||0}}function GT(t,e,n){var i=e.get("z"),r=e.get("zlevel");t&&t.traverse((function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=r&&(t.zlevel=r),t.silent=n)}))}function UT(t,e,n,i,r){var o=WT(n.get("value"),e.axis,e.ecModel,n.get("seriesDataIndices"),{precision:n.get(["label","precision"]),formatter:n.get(["label","formatter"])}),a=n.getModel("label"),s=Mu(a.get("padding")||0),l=a.getFont(),u=bi(o,l),h=r.position,c=u.width+s[1]+s[3],d=u.height+s[0]+s[2],f=r.align;"right"===f&&(h[0]-=c),"center"===f&&(h[0]-=c/2);var p=r.verticalAlign;"bottom"===p&&(h[1]-=d),"middle"===p&&(h[1]-=d/2),function(t,e,n,i){var r=i.getWidth(),o=i.getHeight();t[0]=Math.min(t[0]+e,r)-e,t[1]=Math.min(t[1]+n,o)-n,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}(h,c,d,i);var g=a.get("backgroundColor");g&&"auto"!==g||(g=e.get(["axisLine","lineStyle","color"])),t.label={x:h[0],y:h[1],style:gl(a,{text:o,font:l,fill:a.getTextColor(),padding:s,backgroundColor:g}),z2:10}}function WT(t,e,n,i,r){t=e.scale.parse(t);var o=e.scale.getLabel({value:t},{precision:r.precision}),a=r.formatter;if(a){var s={value:jy(e,{value:t}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};P.each(i,(function(t){var e=n.getSeriesByIndex(t.seriesIndex),i=t.dataIndexInside,r=e&&e.getDataParams(i);r&&s.seriesData.push(r)})),P.isString(a)?o=a.replace("{value}",o):P.isFunction(a)&&(o=a(s))}return o}function jT(t,e,n){var i=[1,0,0,1,0,0];return Bt(i,i,n.rotation),zt(i,i,n.position),Sp([t.dataToCoord(e),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],i)}var ZT=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return D(e,t),e.prototype.makeElOption=function(t,e,n,i,r){var o=n.axis,a=o.grid,s=i.get("type"),l=XT(a,o).getOtherAxis(o).getGlobalExtent(),u=o.toGlobalCoord(o.dataToCoord(e,!0));if(s&&"none"!==s){var h=function(t){var e,n=t.get("type"),i=t.getModel(n+"Style");return"line"===n?(e=i.getLineStyle()).fill=null:"shadow"===n&&((e=i.getAreaStyle()).stroke=null),e}(i),c=qT[s](o,u,l);c.style=h,t.graphicKey=c.type,t.pointer=c}!function(t,e,n,i,r,o){var a=gT.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=r.get(["label","margin"]),UT(e,i,r,o,{position:jT(i.axis,t,n),align:a.textAlign,verticalAlign:a.textVerticalAlign})}(e,t,QS(a.model,n),n,i,r)},e.prototype.getHandleTransform=function(t,e,n){var i=QS(e.axis.grid.model,e,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var r=jT(e.axis,t,i);return{x:r[0],y:r[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,e,n,i){var r=n.axis,o=r.grid,a=r.getGlobalExtent(!0),s=XT(o,r).getOtherAxis(r).getGlobalExtent(),l="x"===r.dim?0:1,u=[t.x,t.y];u[l]+=e[l],u[l]=Math.min(a[1],u[l]),u[l]=Math.max(a[0],u[l]);var h=(s[1]+s[0])/2,c=[h,h];c[l]=u[l];return{x:u[0],y:u[1],rotation:t.rotation,cursorPoint:c,tooltipOption:[{verticalAlign:"middle"},{align:"center"}][l]}},e}(zT);function XT(t,e){var n={};return n[e.dim+"AxisIndex"]=e.index,t.getCartesian(n)}var qT={line:function(t,e,n){var i=function(t,e,n){return{x1:t[n=n||0],y1:t[1-n],x2:e[n],y2:e[1-n]}}([e,n[0]],[e,n[1]],YT(t));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(t,e,n){var i,r,o,a=Math.max(1,t.getBandWidth()),s=n[1]-n[0];return{type:"Rect",shape:(i=[e-a/2,n[0]],r=[a,s],o=YT(t),{x:i[o=o||0],y:i[1-o],width:r[o],height:r[1-o]})}}};function YT(t){return"x"===t.dim?0:1}const KT=ZT;const JT=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return D(e,t),e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e}(Zu);var $T=Fr(),QT=P.each;function tM(t,e,n){if(!I.default.node){var i=e.getZr();$T(i).records||($T(i).records={}),function(t,e){if($T(t).initialized)return;function n(n,i){t.on(n,(function(n){var r=function(t){var e={showTip:[],hideTip:[]},n=function(i){var r=e[i.type];r?r.push(i):(i.dispatchAction=n,t.dispatchAction(i))};return{dispatchAction:n,pendings:e}}(e);QT($T(t).records,(function(t){t&&i(t,n,r.dispatchAction)})),function(t,e){var n,i=t.showTip.length,r=t.hideTip.length;i?n=t.showTip[i-1]:r&&(n=t.hideTip[r-1]);n&&(n.dispatchAction=null,e.dispatchAction(n))}(r.pendings,e)}))}$T(t).initialized=!0,n("click",P.curry(nM,"click")),n("mousemove",P.curry(nM,"mousemove")),n("globalout",eM)}(i,e),($T(i).records[t]||($T(i).records[t]={})).handler=n}}function eM(t,e,n){t.handler("leave",null,n)}function nM(t,e,n,i){e.handler(t,n,i)}function iM(t,e){if(!I.default.node){var n=e.getZr();($T(n).records||{})[t]&&($T(n).records[t]=null)}}var rM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return D(e,t),e.prototype.render=function(t,e,n){var i=e.getComponent("tooltip"),r=t.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";tM("axisPointer",n,(function(t,e,n){"none"!==r&&("leave"===t||r.indexOf(t)>=0)&&n({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})}))},e.prototype.remove=function(t,e){iM("axisPointer",e)},e.prototype.dispose=function(t,e){iM("axisPointer",e)},e.type="axisPointer",e}(Od);const oM=rM;function aM(t,e){var n,i=[],r=t.seriesIndex;if(null==r||!(n=e.getSeriesByIndex(r)))return{point:[]};var o=n.getData(),a=Br(o,t);if(null==a||a<0||P.isArray(a))return{point:[]};var s=o.getItemGraphicEl(a),l=n.coordinateSystem;if(n.getTooltipPosition)i=n.getTooltipPosition(a)||[];else if(l&&l.dataToPoint)if(t.isStacked){var u=l.getBaseAxis(),h=l.getOtherAxis(u).dim,c=u.dim,d="x"===h||"radius"===h?1:0,f=o.mapDimension(c),p=[];p[d]=o.get(f,a),p[1-d]=o.get(o.getCalculationInfo("stackResultDimension"),a),i=l.dataToPoint(p)||[]}else i=l.dataToPoint(o.getValues(P.map(l.dimensions,(function(t){return o.mapDimension(t)})),a))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),i=[g.x+g.width/2,g.y+g.height/2]}return{point:i,el:s}}var sM=Fr();function lM(t,e,n){var i=t.currTrigger,r=[t.x,t.y],o=t,a=t.dispatchAction||(0,P.bind)(n.dispatchAction,n),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){fM(r)&&(r=aM({seriesIndex:o.seriesIndex,dataIndex:o.dataIndex},e).point);var l=fM(r),u=o.axesInfo,h=s.axesInfo,c="leave"===i||fM(r),d={},f={},p={list:[],map:{}},g={showPointer:(0,P.curry)(hM,f),showTooltip:(0,P.curry)(cM,p)};(0,P.each)(s.coordSysMap,(function(t,e){var n=l||t.containPoint(r);(0,P.each)(s.coordSysAxesInfo[e],(function(t,e){var i=t.axis,o=function(t,e){for(var n=0;n<(t||[]).length;n++){var i=t[n];if(e.axis.dim===i.axisDim&&e.axis.model.componentIndex===i.axisIndex)return i}}(u,t);if(!c&&n&&(!u||o)){var a=o&&o.value;null!=a||l||(a=i.pointToData(r)),null!=a&&uM(t,a,g,!1,d)}}))}));var m={};return(0,P.each)(h,(function(t,e){var n=t.linkGroup;n&&!f[e]&&(0,P.each)(n.axesInfo,(function(e,i){var r=f[i];if(e!==t&&r){var o=r.value;n.mapper&&(o=t.axis.scale.parse(n.mapper(o,dM(e),dM(t)))),m[t.key]=o}}))})),(0,P.each)(m,(function(t,e){uM(h[e],t,g,!0,d)})),function(t,e,n){var i=n.axesInfo=[];(0,P.each)(e,(function(e,n){var r=e.axisPointerModel.option,o=t[n];o?(!e.useHandle&&(r.status="show"),r.value=o.value,r.seriesDataIndices=(o.payloadBatch||[]).slice()):!e.useHandle&&(r.status="hide"),"show"===r.status&&i.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:r.value})}))}(f,h,d),function(t,e,n,i){if(fM(e)||!t.list.length)return void i({type:"hideTip"});var r=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:r.dataIndexInside,dataIndex:r.dataIndex,seriesIndex:r.seriesIndex,dataByCoordSys:t.list})}(p,r,t,a),function(t,e,n){var i=n.getZr(),r="axisPointerLastHighlights",o=sM(i)[r]||{},a=sM(i)[r]={};(0,P.each)(t,(function(t,e){var n=t.axisPointerModel.option;"show"===n.status&&t.triggerEmphasis&&(0,P.each)(n.seriesDataIndices,(function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t}))}));var s=[],l=[];(0,P.each)(o,(function(t,e){!a[e]&&l.push(t)})),(0,P.each)(a,(function(t,e){!o[e]&&s.push(t)})),l.length&&n.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&n.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}(h,0,n),d}}function uM(t,e,n,i,r){var o=t.axis;if(!o.scale.isBlank()&&o.containData(e))if(t.involveSeries){var a=function(t,e){var n=e.axis,i=n.dim,r=t,o=[],a=Number.MAX_VALUE,s=-1;return(0,P.each)(e.seriesModels,(function(e,l){var u,h,c=e.getData().mapDimensionsAll(i);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(c,t,n);h=d.dataIndices,u=d.nestestValue}else{if(!(h=e.getData().indicesOfNearest(c[0],t,"category"===n.type?.5:null)).length)return;u=e.getData().get(c[0],h[0])}if(null!=u&&isFinite(u)){var f=t-u,p=Math.abs(f);p<=a&&((p=0&&s<0)&&(a=p,s=f,r=u,o.length=0),(0,P.each)(h,(function(t){o.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})})))}})),{payloadBatch:o,snapToValue:r}}(e,t),s=a.payloadBatch,l=a.snapToValue;s[0]&&null==r.seriesIndex&&(0,P.extend)(r,s[0]),!i&&t.snap&&o.containData(l)&&null!=l&&(e=l),n.showPointer(t,e,s),n.showTooltip(t,a,l)}else n.showPointer(t,e)}function hM(t,e,n,i){t[e.key]={value:n,payloadBatch:i}}function cM(t,e,n,i){var r=n.payloadBatch,o=e.axis,a=o.model,s=e.axisPointerModel;if(e.triggerTooltip&&r.length){var l=e.coordSys.model,u=xT(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:o.dim,axisIndex:a.componentIndex,axisType:a.type,axisId:a.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:r.slice()})}}function dM(t){var e=t.axis.model,n={},i=n.axisDim=t.axis.dim;return n.axisIndex=n[i+"AxisIndex"]=e.componentIndex,n.axisName=n[i+"AxisName"]=e.name,n.axisId=n[i+"AxisId"]=e.id,n}function fM(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function pM(t){ST.registerAxisPointerClass("CartesianAxisPointer",KT),t.registerComponentModel(JT),t.registerComponentView(oM),t.registerPreprocessor((function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!(0,P.isArray)(e)&&(t.axisPointer.link=[e])}})),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,(function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=mT(t,e)})),t.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},lM)}const gM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return D(e,t),e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e}(Zu);function mM(t){var e=t.get("confine");return null!=e?!!e:"richText"===t.get("renderMode")}function vM(t){if(I.default.domSupported)for(var e=document.documentElement.style,n=0,i=t.length;n-1?(u+="top:50%",h+="translateY(-50%) rotate("+(a="left"===s?-225:-45)+"deg)"):(u+="left:50%",h+="translateX(-50%) rotate("+(a="top"===s?225:45)+"deg)");var c=a*Math.PI/180,d=l+r,f=d*Math.abs(Math.cos(c))+d*Math.abs(Math.sin(c)),p=e+" solid "+r+"px;";return'
'}(n,i,r)),(0,P.isString)(t))o.innerHTML=t+a;else if(t){o.innerHTML="",(0,P.isArray)(t)||(t=[t]);for(var s=0;s=0?this._tryShow(n,i):"leave"===e&&this._hide(i))}),this))},e.prototype._keepShow=function(){var t=this._tooltipModel,e=this._ecModel,n=this._api,i=t.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==i&&"click"!==i){var r=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout((function(){!n.isDisposed()&&r.manuallyShowTip(t,e,n,{x:r._lastX,y:r._lastY,dataByCoordSys:r._lastDataByCoordSys})}))}},e.prototype.manuallyShowTip=function(t,e,n,i){if(i.from!==this.uid&&!I.default.node&&n.getDom()){var r=kM(i,n);this._ticket="";var o=i.dataByCoordSys,a=function(t,e,n){var i=Gr(t).queryOptionMap,r=i.keys()[0];if(!r||"series"===r)return;var o=jr(e,r,i.get(r),{useDefault:!1,enableAll:!1,enableNone:!1}),a=o.models[0];if(!a)return;var s,l=n.getViewOfComponentModel(a);if(l.group.traverse((function(e){var n=hs(e).tooltipConfig;if(n&&n.name===t.name)return s=e,!0})),s)return{componentMainType:r,componentIndex:a.componentIndex,el:s}}(i,e,n);if(a){var s=a.el.getBoundingRect().clone();s.applyTransform(a.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:a.el,position:i.position,positionDefault:"bottom"},r)}else if(i.tooltip&&null!=i.x&&null!=i.y){var l=OM;l.x=i.x,l.y=i.y,l.update(),hs(l).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:l},r)}else if(o)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:o,tooltipOption:i.tooltipOption},r);else if(null!=i.seriesIndex){if(this._manuallyAxisShowTip(t,e,n,i))return;var u=aM(i,e),h=u.point[0],c=u.point[1];null!=h&&null!=c&&this._tryShow({offsetX:h,offsetY:c,target:u.el,position:i.position,positionDefault:"bottom"},r)}else null!=i.x&&null!=i.y&&(n.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:n.getZr().findHover(i.x,i.y).target},r))}},e.prototype.manuallyHideTip=function(t,e,n,i){var r=this._tooltipContent;this._tooltipModel&&r.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(kM(i,n))},e.prototype._manuallyAxisShowTip=function(t,e,n,i){var r=i.seriesIndex,o=i.dataIndex,a=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=r&&null!=o&&null!=a){var s=e.getSeriesByIndex(r);if(s)if("axis"===RM([s.getData().getItemModel(o),s,(s.coordinateSystem||{}).model],this._tooltipModel).get("trigger"))return n.dispatchAction({type:"updateAxisPointer",seriesIndex:r,dataIndex:o,position:i.position}),!0}},e.prototype._tryShow=function(t,e){var n=t.target;if(this._tooltipModel){this._lastX=t.offsetX,this._lastY=t.offsetY;var i=t.dataByCoordSys;if(i&&i.length)this._showAxisTooltip(i,t);else if(n){var r,o;if("legend"===hs(n).ssrType)return;this._lastDataByCoordSys=null,zg(n,(function(t){return null!=hs(t).dataIndex?(r=t,!0):null!=hs(t).tooltipConfig?(o=t,!0):void 0}),!0),r?this._showSeriesItemTooltip(t,r,e):o?this._showComponentItemTooltip(t,o,e):this._hide(e)}else this._lastDataByCoordSys=null,this._hide(e)}},e.prototype._showOrMove=function(t,e){var n=t.get("showDelay");e=(0,P.bind)(e,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(e,n):e()},e.prototype._showAxisTooltip=function(t,e){var n=this._ecModel,i=this._tooltipModel,r=[e.offsetX,e.offsetY],o=RM([e.tooltipOption],i),a=this._renderMode,s=[],l=ud("section",{blocks:[],noHeader:!0}),u=[],h=new yd;(0,P.each)(t,(function(t){(0,P.each)(t.dataByAxis,(function(t){var e=n.getComponent(t.axisDim+"Axis",t.axisIndex),r=t.value;if(e&&null!=r){var o=WT(r,e.axis,n,t.seriesDataIndices,t.valueLabelOpt),c=ud("section",{header:o,noHeader:!(0,P.trim)(o),sortBlocks:!0,blocks:[]});l.blocks.push(c),(0,P.each)(t.seriesDataIndices,(function(l){var d=n.getSeriesByIndex(l.seriesIndex),f=l.dataIndexInside,p=d.getDataParams(f);if(!(p.dataIndex<0)){p.axisDim=t.axisDim,p.axisIndex=t.axisIndex,p.axisType=t.axisType,p.axisId=t.axisId,p.axisValue=jy(e.axis,{value:r}),p.axisValueLabel=o,p.marker=h.makeTooltipMarker("item",Ou(p.color),a);var g=Ac(d.formatTooltip(f,!0,null)),m=g.frag;if(m){var v=RM([d],i).get("valueFormatter");c.blocks.push(v?(0,P.extend)({valueFormatter:v},m):m)}g.text&&u.push(g.text),s.push(p)}}))}}))})),l.blocks.reverse(),u.reverse();var c=e.position,d=o.get("order"),f=gd(l,h,a,d,n.get("useUTC"),o.get("textStyle"));f&&u.unshift(f);var p="richText"===a?"\n\n":"
",g=u.join(p);this._showOrMove(o,(function(){this._updateContentNotChangedOnAxis(t,s)?this._updatePosition(o,c,r[0],r[1],this._tooltipContent,s):this._showTooltipContent(o,g,s,Math.random()+"",r[0],r[1],c,null,h)}))},e.prototype._showSeriesItemTooltip=function(t,e,n){var i=this._ecModel,r=hs(e),o=r.seriesIndex,a=i.getSeriesByIndex(o),s=r.dataModel||a,l=r.dataIndex,u=r.dataType,h=s.getData(u),c=this._renderMode,d=t.positionDefault,f=RM([h.getItemModel(l),s,a&&(a.coordinateSystem||{}).model],this._tooltipModel,d?{position:d}:null),p=f.get("trigger");if(null==p||"item"===p){var g=s.getDataParams(l,u),m=new yd;g.marker=m.makeTooltipMarker("item",Ou(g.color),c);var v=Ac(s.formatTooltip(l,!1,u)),_=f.get("order"),y=f.get("valueFormatter"),x=v.frag,b=x?gd(y?(0,P.extend)({valueFormatter:y},x):x,m,c,_,i.get("useUTC"),f.get("textStyle")):v.text,w="item_"+s.name+"_"+l;this._showOrMove(f,(function(){this._showTooltipContent(f,b,g,w,t.offsetX,t.offsetY,t.position,t.target,m)})),n({type:"showTip",dataIndexInside:l,dataIndex:h.getRawIndex(l),seriesIndex:o,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,e,n){var i="html"===this._renderMode,r=hs(e),o=r.tooltipConfig.option||{},a=o.encodeHTMLContent;if((0,P.isString)(o)){o={content:o,formatter:o},a=!0}a&&i&&o.content&&((o=(0,P.clone)(o)).content=yt(o.content));var s=[o],l=this._ecModel.getComponent(r.componentMainType,r.componentIndex);l&&s.push(l),s.push({formatter:o.content});var u=t.positionDefault,h=RM(s,this._tooltipModel,u?{position:u}:null),c=h.get("content"),d=Math.random()+"",f=new yd;this._showOrMove(h,(function(){var n=(0,P.clone)(h.get("formatterParams")||{});this._showTooltipContent(h,c,n,d,t.offsetX,t.offsetY,t.position,e,f)})),n({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,e,n,i,r,o,a,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent;u.setEnterable(t.get("enterable"));var h=t.get("formatter");a=a||t.get("position");var c=e,d=this._getNearestPoint([r,o],n,t.get("trigger"),t.get("borderColor")).color;if(h)if((0,P.isString)(h)){var f=t.ecModel.get("useUTC"),p=(0,P.isArray)(n)?n[0]:n;c=h,p&&p.axisType&&p.axisType.indexOf("time")>=0&&(c=au(p.axisValue,c,f)),c=Du(c,n,!0)}else if((0,P.isFunction)(h)){var g=(0,P.bind)((function(e,i){e===this._ticket&&(u.setContent(i,l,t,d,a),this._updatePosition(t,a,r,o,u,n,s))}),this);this._ticket=i,c=h(n,i,g)}else c=h;u.setContent(c,l,t,d,a),u.show(t,d),this._updatePosition(t,a,r,o,u,n,s)}},e.prototype._getNearestPoint=function(t,e,n,i){return"axis"===n||(0,P.isArray)(e)?{color:i||("html"===this._renderMode?"#fff":"none")}:(0,P.isArray)(e)?void 0:{color:i||e.color||e.borderColor}},e.prototype._updatePosition=function(t,e,n,i,r,o,a){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var u=r.getSize(),h=t.get("align"),c=t.get("verticalAlign"),d=a&&a.getBoundingRect().clone();if(a&&d.applyTransform(a.transform),(0,P.isFunction)(e)&&(e=e([n,i],o,r.el,d,{viewSize:[s,l],contentSize:u.slice()})),(0,P.isArray)(e))n=er(e[0],s),i=er(e[1],l);else if((0,P.isObject)(e)){var f=e;f.width=u[0],f.height=u[1];var p=Hu(f,{width:s,height:l});n=p.x,i=p.y,h=null,c=null}else if((0,P.isString)(e)&&a){var g=function(t,e,n,i){var r=n[0],o=n[1],a=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=e.width,h=e.height;switch(t){case"inside":s=e.x+u/2-r/2,l=e.y+h/2-o/2;break;case"top":s=e.x+u/2-r/2,l=e.y-o-a;break;case"bottom":s=e.x+u/2-r/2,l=e.y+h+a;break;case"left":s=e.x-r-a,l=e.y+h/2-o/2;break;case"right":s=e.x+u+a,l=e.y+h/2-o/2}return[s,l]}(e,d,u,t.get("borderWidth"));n=g[0],i=g[1]}else{g=function(t,e,n,i,r,o,a){var s=n.getSize(),l=s[0],u=s[1];null!=o&&(t+l+o+2>i?t-=l+o:t+=o);null!=a&&(e+u+a>r?e-=u+a:e+=a);return[t,e]}(n,i,r,s,l,h?null:20,c?null:20);n=g[0],i=g[1]}if(h&&(n-=zM(h)?u[0]/2:"right"===h?u[0]:0),c&&(i-=zM(c)?u[1]/2:"bottom"===c?u[1]:0),mM(t)){g=function(t,e,n,i,r){var o=n.getSize(),a=o[0],s=o[1];return t=Math.min(t+a,i)-a,e=Math.min(e+s,r)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}(n,i,r,s,l);n=g[0],i=g[1]}r.moveTo(n,i)},e.prototype._updateContentNotChangedOnAxis=function(t,e){var n=this._lastDataByCoordSys,i=this._cbParamsList,r=!!n&&n.length===t.length;return r&&(0,P.each)(n,(function(n,o){var a=n.dataByAxis||[],s=(t[o]||{}).dataByAxis||[];(r=r&&a.length===s.length)&&(0,P.each)(a,(function(t,n){var o=s[n]||{},a=t.seriesDataIndices||[],l=o.seriesDataIndices||[];(r=r&&t.value===o.value&&t.axisType===o.axisType&&t.axisId===o.axisId&&a.length===l.length)&&(0,P.each)(a,(function(t,e){var n=l[e];r=r&&t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex})),i&&(0,P.each)(t.seriesDataIndices,(function(t){var n=t.seriesIndex,o=e[n],a=i[n];o&&a&&a.data!==o.data&&(r=!1)}))}))})),this._lastDataByCoordSys=t,this._cbParamsList=e,!!r},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,e){!I.default.node&&e.getDom()&&(Kp(this,"_updatePosition"),this._tooltipContent.dispose(),iM("itemTooltip",e))},e.type="tooltip",e}(Od);function RM(t,e,n){var i,r=e.ecModel;n?(i=new zl(n,r,r),i=new zl(e.option,i,r)):i=e;for(var o=t.length-1;o>=0;o--){var a=t[o];a&&(a instanceof zl&&(a=a.get("tooltip",!0)),(0,P.isString)(a)&&(a={formatter:a}),a&&(i=new zl(a,i,r)))}return i}function kM(t,e){return t.dispatchAction||(0,P.bind)(e.dispatchAction,e)}function zM(t){return"center"===t||"middle"===t}const BM=NM;var FM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.layoutMode={type:"box",ignoreSize:!0},n}return D(e,t),e.type="title",e.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},e}(Zu),HM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return D(e,t),e.prototype.render=function(t,e,n){if(this.group.removeAll(),t.get("show")){var i=this.group,r=t.getModel("textStyle"),o=t.getModel("subtextStyle"),a=t.get("textAlign"),s=P.retrieve2(t.get("textBaseline"),t.get("textVerticalAlign")),l=new us({style:gl(r,{text:t.get("text"),fill:r.getTextColor()},{disableBox:!0}),z2:10}),u=l.getBoundingRect(),h=t.get("subtext"),c=new us({style:gl(o,{text:h,fill:o.getTextColor(),y:u.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),d=t.get("link"),f=t.get("sublink"),p=t.get("triggerEvent",!0);l.silent=!d&&!p,c.silent=!f&&!p,d&&l.on("click",(function(){Nu(d,"_"+t.get("target"))})),f&&c.on("click",(function(){Nu(f,"_"+t.get("subtarget"))})),hs(l).eventData=hs(c).eventData=p?{componentType:"title",componentIndex:t.componentIndex}:null,i.add(l),h&&i.add(c);var g=i.getBoundingRect(),m=t.getBoxLayoutParams();m.width=g.width,m.height=g.height;var v=Hu(m,{width:n.getWidth(),height:n.getHeight()},t.get("padding"));a||("middle"===(a=t.get("left")||t.get("right"))&&(a="center"),"right"===a?v.x+=v.width:"center"===a&&(v.x+=v.width/2)),s||("center"===(s=t.get("top")||t.get("bottom"))&&(s="middle"),"bottom"===s?v.y+=v.height:"middle"===s&&(v.y+=v.height/2),s=s||"top"),i.x=v.x,i.y=v.y,i.markRedraw();var _={align:a,verticalAlign:s};l.setStyle(_),c.setStyle(_),g=i.getBoundingRect();var y=v.margin,x=t.getItemStyle(["color","opacity"]);x.fill=t.get("backgroundColor");var b=new Xa({shape:{x:g.x-y[3],y:g.y-y[0],width:g.width+y[1]+y[3],height:g.height+y[0]+y[2],r:t.get("borderRadius")},style:x,subPixelOptimize:!0,silent:!0});i.add(b)}},e.type="title",e}(Od);var VM=["x","y","radius","angle","single"],GM=["cartesian2d","polar","singleAxis"];function UM(t){return t+"Axis"}function WM(t,e){var n,i=(0,P.createHashMap)(),r=[],o=(0,P.createHashMap)();t.eachComponent({mainType:"dataZoom",query:e},(function(t){o.get(t.uid)||s(t)}));do{n=!1,t.eachComponent("dataZoom",a)}while(n);function a(t){!o.get(t.uid)&&function(t){var e=!1;return t.eachTargetAxis((function(t,n){var r=i.get(t);r&&r[n]&&(e=!0)})),e}(t)&&(s(t),n=!0)}function s(t){o.set(t.uid,!0),r.push(t),t.eachTargetAxis((function(t,e){(i.get(t)||i.set(t,[]))[e]=!0}))}return r}var jM=function(){function t(){this.indexList=[],this.indexMap=[]}return t.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},t}();function ZM(t){var e={};return(0,P.each)(["start","end","startValue","endValue","throttle"],(function(n){t.hasOwnProperty(n)&&(e[n]=t[n])})),e}const XM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return D(e,t),e.type="dataZoom.select",e}(function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=["percent","percent"],n}return D(e,t),e.prototype.init=function(t,e,n){var i=ZM(t);this.settledOption=i,this.mergeDefaultAndTheme(t,n),this._doInit(i)},e.prototype.mergeOption=function(t){var e=ZM(t);(0,P.merge)(this.option,t,!0),(0,P.merge)(this.settledOption,e,!0),this._doInit(e)},e.prototype._doInit=function(t){var e=this.option;this._setDefaultThrottle(t),this._updateRangeUse(t);var n=this.settledOption;(0,P.each)([["start","startValue"],["end","endValue"]],(function(t,i){"value"===this._rangePropMode[i]&&(e[t[0]]=n[t[0]]=null)}),this),this._resetTarget()},e.prototype._resetTarget=function(){var t=this.get("orient",!0),e=this._targetAxisInfoMap=(0,P.createHashMap)();this._fillSpecifiedTargetAxis(e)?this._orient=t||this._makeAutoOrientByTargetAxis():(this._orient=t||"horizontal",this._fillAutoTargetAxisByOrient(e,this._orient)),this._noTarget=!0,e.each((function(t){t.indexList.length&&(this._noTarget=!1)}),this)},e.prototype._fillSpecifiedTargetAxis=function(t){var e=!1;return(0,P.each)(VM,(function(n){var i=this.getReferringComponents(UM(n),Wr);if(i.specified){e=!0;var r=new jM;(0,P.each)(i.models,(function(t){r.add(t.componentIndex)})),t.set(n,r)}}),this),e},e.prototype._fillAutoTargetAxisByOrient=function(t,e){var n=this.ecModel,i=!0;if(i){var r="vertical"===e?"y":"x";o(n.findComponents({mainType:r+"Axis"}),r)}i&&o(n.findComponents({mainType:"singleAxis",filter:function(t){return t.get("orient",!0)===e}}),"single");function o(e,n){var r=e[0];if(r){var o=new jM;if(o.add(r.componentIndex),t.set(n,o),i=!1,"x"===n||"y"===n){var a=r.getReferringComponents("grid",Ur).models[0];a&&(0,P.each)(e,(function(t){r.componentIndex!==t.componentIndex&&a===t.getReferringComponents("grid",Ur).models[0]&&o.add(t.componentIndex)}))}}}i&&(0,P.each)(VM,(function(e){if(i){var r=n.findComponents({mainType:UM(e),filter:function(t){return"category"===t.get("type",!0)}});if(r[0]){var o=new jM;o.add(r[0].componentIndex),t.set(e,o),i=!1}}}),this)},e.prototype._makeAutoOrientByTargetAxis=function(){var t;return this.eachTargetAxis((function(e){!t&&(t=e)}),this),"y"===t?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(t){if(t.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var e=this.ecModel.option;this.option.throttle=e.animation&&e.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(t){var e=this._rangePropMode,n=this.get("rangeMode");(0,P.each)([["start","startValue"],["end","endValue"]],(function(i,r){var o=null!=t[i[0]],a=null!=t[i[1]];o&&!a?e[r]="percent":!o&&a?e[r]="value":n?e[r]=n[r]:o&&(e[r]="percent")}))},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var t;return this.eachTargetAxis((function(e,n){null==t&&(t=this.ecModel.getComponent(UM(e),n))}),this),t},e.prototype.eachTargetAxis=function(t,e){this._targetAxisInfoMap.each((function(n,i){(0,P.each)(n.indexList,(function(n){t.call(e,i,n)}))}))},e.prototype.getAxisProxy=function(t,e){var n=this.getAxisModel(t,e);if(n)return n.__dzAxisProxy},e.prototype.getAxisModel=function(t,e){var n=this._targetAxisInfoMap.get(t);if(n&&n.indexMap[e])return this.ecModel.getComponent(UM(t),e)},e.prototype.setRawRange=function(t){var e=this.option,n=this.settledOption;(0,P.each)([["start","startValue"],["end","endValue"]],(function(i){null==t[i[0]]&&null==t[i[1]]||(e[i[0]]=n[i[0]]=t[i[0]],e[i[1]]=n[i[1]]=t[i[1]])}),this),this._updateRangeUse(t)},e.prototype.setCalculatedRange=function(t){var e=this.option;(0,P.each)(["start","startValue","end","endValue"],(function(n){e[n]=t[n]}))},e.prototype.getPercentRange=function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},e.prototype.getValueRange=function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var n=this.findRepresentativeAxisProxy();return n?n.getDataValueWindow():void 0},e.prototype.findRepresentativeAxisProxy=function(t){if(t)return t.__dzAxisProxy;for(var e,n=this._targetAxisInfoMap.keys(),i=0;io&&(e[1-i]=e[i]+u.sign*o),e}function KM(t,e){var n=t[e]-t[1-e];return{span:Math.abs(n),sign:n>0?-1:n<0?1:e?-1:1}}function JM(t,e){return Math.min(null!=e[1]?e[1]:1/0,Math.max(null!=e[0]?e[0]:-1/0,t))}var $M=P.each,QM=ir,tC=function(){function t(t,e,n,i){this._dimName=t,this._axisIndex=e,this.ecModel=i,this._dataZoomModel=n}return t.prototype.hostedBy=function(t){return this._dataZoomModel===t},t.prototype.getDataValueWindow=function(){return this._valueWindow.slice()},t.prototype.getDataPercentWindow=function(){return this._percentWindow.slice()},t.prototype.getTargetSeriesModels=function(){var t=[];return this.ecModel.eachSeries((function(e){if(function(t){var e=t.get("coordinateSystem");return(0,P.indexOf)(GM,e)>=0}(e)){var n=UM(this._dimName),i=e.getReferringComponents(n,Ur).models[0];i&&this._axisIndex===i.componentIndex&&t.push(e)}}),this),t},t.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},t.prototype.getMinMaxSpan=function(){return P.clone(this._minMaxSpan)},t.prototype.calculateDataWindow=function(t){var e,n=this._dataExtent,i=this.getAxisModel().axis.scale,r=this._dataZoomModel.getRangePropMode(),o=[0,100],a=[],s=[];$M(["start","end"],(function(l,u){var h=t[l],c=t[l+"Value"];"percent"===r[u]?(null==h&&(h=o[u]),c=i.parse(tr(h,o,n))):(e=!0,h=tr(c=null==c?n[u]:i.parse(c),n,o)),s[u]=null==c||isNaN(c)?n[u]:c,a[u]=null==h||isNaN(h)?o[u]:h})),QM(s),QM(a);var l=this._minMaxSpan;function u(t,e,n,r,o){var a=o?"Span":"ValueSpan";YM(0,t,n,"all",l["min"+a],l["max"+a]);for(var s=0;s<2;s++)e[s]=tr(t[s],n,r,!0),o&&(e[s]=i.parse(e[s]))}return e?u(s,a,n,o,!1):u(a,s,o,n,!0),{valueWindow:s,percentWindow:a}},t.prototype.reset=function(t){if(t===this._dataZoomModel){var e=this.getTargetSeriesModels();this._dataExtent=function(t,e,n){var i=[1/0,-1/0];$M(n,(function(t){!function(t,e,n){e&&P.each(Yy(e,n),(function(n){var i=e.getApproximateExtent(n);i[0]t[1]&&(t[1]=i[1])}))}(i,t.getData(),e)}));var r=t.getAxisModel(),o=Fy(r.axis.scale,r,i).calculate();return[o.min,o.max]}(this,this._dimName,e),this._updateMinMaxSpan();var n=this.calculateDataWindow(t.settledOption);this._valueWindow=n.valueWindow,this._percentWindow=n.percentWindow,this._setAxisModel()}},t.prototype.filterData=function(t,e){if(t===this._dataZoomModel){var n=this._dimName,i=this.getTargetSeriesModels(),r=t.get("filterMode"),o=this._valueWindow;"none"!==r&&$M(i,(function(t){var e=t.getData(),i=e.mapDimensionsAll(n);if(i.length){if("weakFilter"===r){var a=e.getStore(),s=P.map(i,(function(t){return e.getDimensionIndex(t)}),e);e.filterSelf((function(t){for(var e,n,r,l=0;lo[1];if(h&&!c&&!d)return!0;h&&(r=!0),c&&(e=!0),d&&(n=!0)}return r&&e&&n}))}else $M(i,(function(n){if("empty"===r)t.setData(e=e.map(n,(function(t){return function(t){return t>=o[0]&&t<=o[1]}(t)?t:NaN})));else{var i={};i[n]=o,e.selectRange(i)}}));$M(i,(function(t){e.setApproximateExtent(o,t)}))}}))}},t.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},e=this._dataZoomModel,n=this._dataExtent;$M(["min","max"],(function(i){var r=e.get(i+"Span"),o=e.get(i+"ValueSpan");null!=o&&(o=this.getAxisModel().axis.scale.parse(o)),null!=o?r=tr(n[0]+o,n,[0,100],!0):null!=r&&(o=tr(r,[0,100],n,!0)-n[0]),t[i+"Span"]=r,t[i+"ValueSpan"]=o}),this)},t.prototype._setAxisModel=function(){var t=this.getAxisModel(),e=this._percentWindow,n=this._valueWindow;if(e){var i=ar(n,[0,500]);i=Math.min(i,20);var r=t.axis.scale.rawExtentInfo;0!==e[0]&&r.setDeterminedMinMax("min",+n[0].toFixed(i)),100!==e[1]&&r.setDeterminedMinMax("max",+n[1].toFixed(i)),r.freeze()}},t}();const eC=tC;const nC={getTargetSeries:function(t){function e(e){t.eachComponent("dataZoom",(function(n){n.eachTargetAxis((function(i,r){var o=t.getComponent(UM(i),r);e(i,r,o,n)}))}))}e((function(t,e,n,i){n.__dzAxisProxy=null}));var n=[];e((function(e,i,r,o){r.__dzAxisProxy||(r.__dzAxisProxy=new eC(e,i,o,t),n.push(r.__dzAxisProxy))}));var i=(0,P.createHashMap)();return(0,P.each)(n,(function(t){(0,P.each)(t.getTargetSeriesModels(),(function(t){i.set(t.uid,t)}))})),i},overallReset:function(t,e){t.eachComponent("dataZoom",(function(t){t.eachTargetAxis((function(e,n){t.getAxisProxy(e,n).reset(t)})),t.eachTargetAxis((function(n,i){t.getAxisProxy(n,i).filterData(t,e)}))})),t.eachComponent("dataZoom",(function(t){var e=t.findRepresentativeAxisProxy();if(e){var n=e.getDataPercentWindow(),i=e.getDataValueWindow();t.setCalculatedRange({start:n[0],end:n[1],startValue:i[0],endValue:i[1]})}}))}};var iC=!1;function rC(t){iC||(iC=!0,t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,nC),function(t){t.registerAction("dataZoom",(function(t,e){var n=WM(e,t);(0,P.each)(n,(function(e){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})}))}))}(t),t.registerSubTypeDefaulter("dataZoom",(function(){return"slider"})))}function oC(t){t.registerComponentModel(XM),t.registerComponentView(qM),rC(t)}var aC=function(){},sC={};function lC(t,e){sC[t]=e}function uC(t){return sC[t]}const hC=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return D(e,t),e.prototype.optionUpdated=function(){t.prototype.optionUpdated.apply(this,arguments);var e=this.ecModel;P.each(this.option.feature,(function(t,n){var i=uC(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(e)),P.merge(t,i.defaultOption))}))},e.type="toolbox",e.layoutMode={type:"box",ignoreSize:!0},e.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}},e}(Zu);function cC(t,e,n){var i=e.getBoxLayoutParams(),r=e.get("padding"),o={width:n.getWidth(),height:n.getHeight()},a=Hu(i,o,r);Fu(e.get("orient"),t,e.get("itemGap"),a.width,a.height),function(t,e,n,i,r,o){var a,s=!r||!r.hv||r.hv[0],l=!r||!r.hv||r.hv[1],u=r&&r.boundingMode||"all";if((o=o||t).x=t.x,o.y=t.y,!s&&!l)return!1;if("raw"===u)a="group"===t.type?new Qt(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(a=t.getBoundingRect(),t.needLocalTransform()){var h=t.getLocalTransform();(a=a.clone()).applyTransform(h)}var c=Hu(P.defaults({width:a.width,height:a.height},e),n,i),d=s?c.x-a.x:0,f=l?c.y-a.y:0;"raw"===u?(o.x=d,o.y=f):(o.x+=d,o.y+=f),o===t&&t.markRedraw()}(t,i,o,r)}function dC(t,e){var n=Mu(e.get("padding")),i=e.getItemStyle(["color","opacity"]);return i.fill=e.get("backgroundColor"),t=new Xa({shape:{x:t.x-n[3],y:t.y-n[0],width:t.width+n[1]+n[3],height:t.height+n[0]+n[2],r:e.get("borderRadius")},style:i,silent:!0,z2:-1})}var fC=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return D(e,t),e.prototype.render=function(t,e,n,i){var r=this.group;if(r.removeAll(),t.get("show")){var o=+t.get("itemSize"),a="vertical"===t.get("orient"),s=t.get("feature")||{},l=this._features||(this._features={}),u=[];P.each(s,(function(t,e){u.push(e)})),new l_(this._featureNames||[],u).add(h).update(h).remove(P.curry(h,null)).execute(),this._featureNames=u,cC(r,t,n),r.add(dC(r.getBoundingRect(),t)),a||r.eachChild((function(t){var e=t.__title,i=t.ensureState("emphasis"),a=i.textConfig||(i.textConfig={}),s=t.getTextContent(),l=s&&s.ensureState("emphasis");if(l&&!P.isFunction(l)&&e){var u=l.style||(l.style={}),h=bi(e,us.makeFont(u)),c=t.x+r.x,d=!1;t.y+r.y+o+h.height>n.getHeight()&&(a.position="top",d=!0);var f=d?-5-h.height:o+10;c+h.width/2>n.getWidth()?(a.position=["100%",f],u.align="right"):c-h.width/2<0&&(a.position=[0,f],u.align="left")}}))}function h(h,c){var d,f=u[h],p=u[c],g=s[f],m=new zl(g,t,t.ecModel);if(i&&null!=i.newTitle&&i.featureName===f&&(g.title=i.newTitle),f&&!p){if(function(t){return 0===t.indexOf("my")}(f))d={onclick:m.option.onclick,featureName:f};else{var v=uC(f);if(!v)return;d=new v}l[f]=d}else if(!(d=l[p]))return;d.uid=Fl("toolbox-feature"),d.model=m,d.ecModel=e,d.api=n;var _=d instanceof aC;f||!p?!m.get("show")||_&&d.unusable?_&&d.remove&&d.remove(e,n):(!function(i,s,l){var u,h,c=i.getModel("iconStyle"),d=i.getModel(["emphasis","iconStyle"]),f=s instanceof aC&&s.getIcons?s.getIcons():i.get("icon"),p=i.get("title")||{};P.isString(f)?(u={})[l]=f:u=f;P.isString(p)?(h={})[l]=p:h=p;var g=i.iconPaths={};P.each(u,(function(l,u){var f=Dp(l,{},{x:-o/2,y:-o/2,width:o,height:o});f.setStyle(c.getItemStyle()),f.ensureState("emphasis").style=d.getItemStyle();var p=new us({style:{text:h[u],align:d.get("textAlign"),borderRadius:d.get("textBorderRadius"),padding:d.get("textPadding"),fill:null,font:bl({fontStyle:d.get("textFontStyle"),fontFamily:d.get("textFontFamily"),fontSize:d.get("textFontSize"),fontWeight:d.get("textFontWeight")},e)},ignore:!0});f.setTextContent(p),Op({el:f,componentModel:t,itemName:u,formatterParamsExtra:{title:h[u]}}),f.__title=h[u],f.on("mouseover",(function(){var e=d.getItemStyle(),i=a?null==t.get("right")&&"right"!==t.get("left")?"right":"left":null==t.get("bottom")&&"bottom"!==t.get("top")?"bottom":"top";p.setStyle({fill:d.get("textFill")||e.fill||e.stroke||"#000",backgroundColor:d.get("textBackgroundColor")}),f.setTextConfig({position:d.get("textPosition")||i}),p.ignore=!t.get("showTitle"),n.enterEmphasis(this)})).on("mouseout",(function(){"emphasis"!==i.get(["iconStatus",u])&&n.leaveEmphasis(this),p.hide()})),("emphasis"===i.get(["iconStatus",u])?Bs:Fs)(f),r.add(f),f.on("click",P.bind(s.onclick,s,e,n,u)),g[u]=f}))}(m,d,f),m.setIconStatus=function(t,e){var n=this.option,i=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[t]=e,i[t]&&("emphasis"===e?Bs:Fs)(i[t])},d instanceof aC&&d.render&&d.render(m,e,n,i)):_&&d.dispose&&d.dispose(e,n)}},e.prototype.updateView=function(t,e,n,i){P.each(this._features,(function(t){t instanceof aC&&t.updateView&&t.updateView(t.model,e,n,i)}))},e.prototype.remove=function(t,e){P.each(this._features,(function(n){n instanceof aC&&n.remove&&n.remove(t,e)})),this.group.removeAll()},e.prototype.dispose=function(t,e){P.each(this._features,(function(n){n instanceof aC&&n.dispose&&n.dispose(t,e)}))},e.type="toolbox",e}(Od);const pC=fC;const gC=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return D(e,t),e.prototype.onclick=function(t,e){var n=this.model,i=n.get("name")||t.get("title.0.text")||"echarts",r="svg"===e.getZr().painter.getType(),o=r?"svg":n.get("type",!0)||"png",a=e.getConnectedDataURL({type:o,backgroundColor:n.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",connectedBackgroundColor:n.get("connectedBackgroundColor"),excludeComponents:n.get("excludeComponents"),pixelRatio:n.get("pixelRatio")}),s=I.default.browser;if("function"!=typeof MouseEvent||!s.newEdge&&(s.ie||s.edge))if(window.navigator.msSaveOrOpenBlob||r){var l=a.split(","),u=l[0].indexOf("base64")>-1,h=r?decodeURIComponent(l[1]):l[1];u&&(h=window.atob(h));var c=i+"."+o;if(window.navigator.msSaveOrOpenBlob){for(var d=h.length,f=new Uint8Array(d);d--;)f[d]=h.charCodeAt(d);var p=new Blob([f]);window.navigator.msSaveOrOpenBlob(p,c)}else{var g=document.createElement("iframe");document.body.appendChild(g);var m=g.contentWindow,v=m.document;v.open("image/svg+xml","replace"),v.write(h),v.close(),m.focus(),v.execCommand("SaveAs",!0,c),document.body.removeChild(g)}}else{var _=n.get("lang"),y='',x=window.open();x.document.write(y),x.document.title=i}else{var b=document.createElement("a");b.download=i+"."+o,b.target="_blank",b.href=a;var w=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});b.dispatchEvent(w)}},e.getDefaultOption=function(t){return{show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:t.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:t.getLocaleModel().get(["toolbox","saveAsImage","lang"])}},e}(aC);var mC="__ec_magicType_stack__",vC=[["line","bar"],["stack"]],_C=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return D(e,t),e.prototype.getIcons=function(){var t=this.model,e=t.get("icon"),n={};return P.each(t.get("type"),(function(t){e[t]&&(n[t]=e[t])})),n},e.getDefaultOption=function(t){return{show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:t.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}}},e.prototype.onclick=function(t,e,n){var i=this.model,r=i.get(["seriesIndex",n]);if(yC[n]){var o,a={series:[]};P.each(vC,(function(t){P.indexOf(t,n)>=0&&P.each(t,(function(t){i.setIconStatus(t,"normal")}))})),i.setIconStatus(n,"emphasis"),t.eachComponent({mainType:"series",query:null==r?null:{seriesIndex:r}},(function(t){var e=t.subType,r=t.id,o=yC[n](e,r,t,i);o&&(P.defaults(o,t.option),a.series.push(o));var s=t.coordinateSystem;if(s&&"cartesian2d"===s.type&&("line"===n||"bar"===n)){var l=s.getAxesByScale("ordinal")[0];if(l){var u=l.dim+"Axis",h=t.getReferringComponents(u,Ur).models[0].componentIndex;a[u]=a[u]||[];for(var c=0;c<=h;c++)a[u][h]=a[u][h]||{};a[u][h].boundaryGap="bar"===n}}}));var s=n;"stack"===n&&(o=P.merge({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),"emphasis"!==i.get(["iconStatus",n])&&(s="tiled")),e.dispatchAction({type:"changeMagicType",currentType:s,newOption:a,newTitle:o,featureName:"magicType"})}},e}(aC),yC={line:function(t,e,n,i){if("bar"===t)return P.merge({id:e,type:"line",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","line"])||{},!0)},bar:function(t,e,n,i){if("line"===t)return P.merge({id:e,type:"bar",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","bar"])||{},!0)},stack:function(t,e,n,i){var r=n.get("stack")===mC;if("line"===t||"bar"===t)return i.setIconStatus("stack",r?"normal":"emphasis"),P.merge({id:e,stack:r?"":mC},i.get(["option","stack"])||{},!0)}};Zv({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},(function(t,e){e.mergeOption(t.newOption)}));const xC=_C;var bC=new Array(60).join("-"),wC="\t";function SC(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var TC=new RegExp("[\t]+","g");function MC(t,e){var n=t.split(new RegExp("\n*"+bC+"\n*","g")),i={series:[]};return P.each(n,(function(t,n){if(function(t){if(t.slice(0,t.indexOf("\n")).indexOf(wC)>=0)return!0}(t)){var r=function(t){for(var e=t.split(/\n+/g),n=SC(e.shift()).split(TC),i=[],r=P.map(n,(function(t){return{name:t,data:[]}})),o=0;o6}(t)||o){if(a&&!o){"single"===s.brushMode&&$C(t);var l=(0,P.clone)(s);l.brushType=gA(l.brushType,a),l.panelId=a===NC?null:a.panelId,o=t._creatingCover=WC(t,l),t._covers.push(o)}if(o){var u=_A[gA(t._brushType,a)];o.__brushOption.range=u.getCreatingRange(cA(t,o,t._track)),i&&(jC(t,o),u.updateCommon(t,o)),ZC(t,o),r={isEnd:i}}}else i&&"single"===s.brushMode&&s.removeOnClick&&KC(t,e,n)&&$C(t)&&(r={isEnd:i,removeOnClick:!0});return r}function gA(t,e){return"auto"===t?e.defaultBrushType:t}var mA={mousedown:function(t){if(this._dragging)vA(this,t);else if(!t.target||!t.target.draggable){dA(t);var e=this.group.transformCoordToLocal(t.offsetX,t.offsetY);this._creatingCover=null,(this._creatingPanel=KC(this,t,e))&&(this._dragging=!0,this._track=[e.slice()])}},mousemove:function(t){var e=t.offsetX,n=t.offsetY,i=this.group.transformCoordToLocal(e,n);if(function(t,e,n){if(t._brushType&&!function(t,e,n){var i=t._zr;return e<0||e>i.getWidth()||n<0||n>i.getHeight()}(t,e.offsetX,e.offsetY)){var i=t._zr,r=t._covers,o=KC(t,e,n);if(!t._dragging)for(var a=0;a=0)&&t(r,i._targetInfoList)}))}return t.prototype.setOutputRanges=function(t,e){return this.matchOutputRanges(t,e,(function(t,e,n){if((t.coordRanges||(t.coordRanges=[])).push(e),!t.coordRange){t.coordRange=e;var i=EA[t.brushType](0,n,e);t.__rangeOffset={offset:NA[t.brushType](i.values,t.range,[1,1]),xyMinMax:i.xyMinMax}}})),t},t.prototype.matchOutputRanges=function(t,e,n){(0,P.each)(t,(function(t){var i=this.findTargetInfo(t,e);i&&!0!==i&&(0,P.each)(i.coordSyses,(function(i){var r=EA[t.brushType](1,i,t.range,!0);n(t,r.values,i,e)}))}),this)},t.prototype.setInputRanges=function(t,e){(0,P.each)(t,(function(t){var n,i,r,o,a,s=this.findTargetInfo(t,e);if(t.range=t.range||[],s&&!0!==s){t.panelId=s.panelId;var l=EA[t.brushType](0,s.coordSys,t.coordRange),u=t.__rangeOffset;t.range=u?NA[t.brushType](l.values,u.offset,(n=l.xyMinMax,i=u.xyMinMax,r=kA(n),o=kA(i),a=[r[0]/o[0],r[1]/o[1]],isNaN(a[0])&&(a[0]=1),isNaN(a[1])&&(a[1]=1),a)):l.values}}),this)},t.prototype.makePanelOpts=function(t,e){return(0,P.map)(this._targetInfoList,(function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:e?e(n):null,clipPath:bA(i),isTargetByCursor:SA(i,t,n.coordSysModel),getLinearBrushOtherExtent:wA(i)}}))},t.prototype.controlSeries=function(t,e,n){var i=this.findTargetInfo(t,n);return!0===i||i&&(0,P.indexOf)(i.coordSyses,e.coordinateSystem)>=0},t.prototype.findTargetInfo=function(t,e){for(var n=this._targetInfoList,i=LA(e,t),r=0;rt[1]&&t.reverse(),t}function LA(t,e){return Vr(t,e,{includeMainTypes:MA})}var DA={grid:function(t,e){var n=t.xAxisModels,i=t.yAxisModels,r=t.gridModels,o=(0,P.createHashMap)(),a={},s={};(n||i||r)&&((0,P.each)(n,(function(t){var e=t.axis.grid.model;o.set(e.id,e),a[e.id]=!0})),(0,P.each)(i,(function(t){var e=t.axis.grid.model;o.set(e.id,e),s[e.id]=!0})),(0,P.each)(r,(function(t){o.set(t.id,t),a[t.id]=!0,s[t.id]=!0})),o.each((function(t){var r=t.coordinateSystem,o=[];(0,P.each)(r.getCartesians(),(function(t,e){((0,P.indexOf)(n,t.getAxis("x").model)>=0||(0,P.indexOf)(i,t.getAxis("y").model)>=0)&&o.push(t)})),e.push({panelId:"grid--"+t.id,gridModel:t,coordSysModel:t,coordSys:o[0],coordSyses:o,getPanelRect:PA.grid,xAxisDeclared:a[t.id],yAxisDeclared:s[t.id]})})))},geo:function(t,e){(0,P.each)(t.geoModels,(function(t){var n=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:n,coordSyses:[n],getPanelRect:PA.geo})}))}},IA=[function(t,e){var n=t.xAxisModel,i=t.yAxisModel,r=t.gridModel;return!r&&n&&(r=n.axis.grid.model),!r&&i&&(r=i.axis.grid.model),r&&r===e.gridModel},function(t,e){var n=t.geoModel;return n&&n===e.geoModel}],PA={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(wp(t)),e}},EA={lineX:(0,P.curry)(OA,0),lineY:(0,P.curry)(OA,1),rect:function(t,e,n,i){var r=t?e.pointToData([n[0][0],n[1][0]],i):e.dataToPoint([n[0][0],n[1][0]],i),o=t?e.pointToData([n[0][1],n[1][1]],i):e.dataToPoint([n[0][1],n[1][1]],i),a=[AA([r[0],o[0]]),AA([r[1],o[1]])];return{values:a,xyMinMax:a}},polygon:function(t,e,n,i){var r=[[1/0,-1/0],[1/0,-1/0]];return{values:(0,P.map)(n,(function(n){var o=t?e.pointToData(n,i):e.dataToPoint(n,i);return r[0][0]=Math.min(r[0][0],o[0]),r[1][0]=Math.min(r[1][0],o[1]),r[0][1]=Math.max(r[0][1],o[0]),r[1][1]=Math.max(r[1][1],o[1]),o})),xyMinMax:r}}};function OA(t,e,n,i){var r=n.getAxis(["x","y"][t]),o=AA((0,P.map)([0,1],(function(t){return e?r.coordToData(r.toLocalCoord(i[t]),!0):r.toGlobalCoord(r.dataToCoord(i[t]))}))),a=[];return a[t]=o,a[1-t]=[NaN,NaN],{values:o,xyMinMax:a}}var NA={lineX:(0,P.curry)(RA,0),lineY:(0,P.curry)(RA,1),rect:function(t,e,n){return[[t[0][0]-n[0]*e[0][0],t[0][1]-n[0]*e[0][1]],[t[1][0]-n[1]*e[1][0],t[1][1]-n[1]*e[1][1]]]},polygon:function(t,e,n){return(0,P.map)(t,(function(t,i){return[t[0]-n[0]*e[i][0],t[1]-n[1]*e[i][1]]}))}};function RA(t,e,n,i){return[e[0]-i[t]*n[0],e[1]-i[t]*n[1]]}function kA(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}const zA=CA;var BA,FA,HA=P.each,VA=Cr+"toolbox-dataZoom_",GA=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return D(e,t),e.prototype.render=function(t,e,n,i){this._brushController||(this._brushController=new xA(n.getZr()),this._brushController.on("brush",P.bind(this._onBrush,this)).mount()),function(t,e,n,i,r){var o=n._isZoomActive;i&&"takeGlobalCursor"===i.type&&(o="dataZoomSelect"===i.key&&i.dataZoomSelectActive);n._isZoomActive=o,t.setIconStatus("zoom",o?"emphasis":"normal");var a=new zA(WA(t),e,{include:["grid"]}),s=a.makePanelOpts(r,(function(t){return t.xAxisDeclared&&!t.yAxisDeclared?"lineX":!t.xAxisDeclared&&t.yAxisDeclared?"lineY":"rect"}));n._brushController.setPanels(s).enableBrush(!(!o||!s.length)&&{brushType:"auto",brushStyle:t.getModel("brushStyle").getItemStyle()})}(t,e,this,i,n),function(t,e){t.setIconStatus("back",function(t){return PC(t).length}(e)>1?"emphasis":"normal")}(t,e)},e.prototype.onclick=function(t,e,n){UA[n].call(this)},e.prototype.remove=function(t,e){this._brushController&&this._brushController.unmount()},e.prototype.dispose=function(t,e){this._brushController&&this._brushController.dispose()},e.prototype._onBrush=function(t){var e=t.areas;if(t.isEnd&&e.length){var n={},i=this.ecModel;this._brushController.updateCovers([]),new zA(WA(this.model),i,{include:["grid"]}).matchOutputRanges(e,i,(function(t,e,n){if("cartesian2d"===n.type){var i=t.brushType;"rect"===i?(r("x",n,e[0]),r("y",n,e[1])):r({lineX:"x",lineY:"y"}[i],n,e)}})),function(t,e){var n=PC(t);DC(e,(function(e,i){for(var r=n.length-1;r>=0&&!n[r][i];r--);if(r<0){var o=t.queryComponents({mainType:"dataZoom",subType:"select",id:i})[0];if(o){var a=o.getPercentRange();n[0][i]={dataZoomId:i,start:a[0],end:a[1]}}}})),n.push(e)}(i,n),this._dispatchZoomAction(n)}function r(t,e,r){var o=e.getAxis(t),a=o.model,s=function(t,e,n){var i;return n.eachComponent({mainType:"dataZoom",subType:"select"},(function(n){n.getAxisModel(t,e.componentIndex)&&(i=n)})),i}(t,a,i),l=s.findRepresentativeAxisProxy(a).getMinMaxSpan();null==l.minValueSpan&&null==l.maxValueSpan||(r=YM(0,r.slice(),o.scale.getExtent(),0,l.minValueSpan,l.maxValueSpan)),s&&(n[s.id]={dataZoomId:s.id,startValue:r[0],endValue:r[1]})}},e.prototype._dispatchZoomAction=function(t){var e=[];HA(t,(function(t,n){e.push(P.clone(t))})),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},e.getDefaultOption=function(t){return{show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:t.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}}},e}(aC),UA={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(function(t){var e=PC(t),n=e[e.length-1];e.length>1&&e.pop();var i={};return DC(n,(function(t,n){for(var r=e.length-1;r>=0;r--)if(t=e[r][n]){i[n]=t;break}})),i}(this.ecModel))}};function WA(t){var e={xAxisIndex:t.get("xAxisIndex",!0),yAxisIndex:t.get("yAxisIndex",!0),xAxisId:t.get("xAxisId",!0),yAxisId:t.get("yAxisId",!0)};return null==e.xAxisIndex&&null==e.xAxisId&&(e.xAxisIndex="all"),null==e.yAxisIndex&&null==e.yAxisId&&(e.yAxisIndex="all"),e}BA="dataZoom",FA=function(t){var e=t.getComponent("toolbox",0),n=["feature","dataZoom"];if(e&&null!=e.get(n)){var i=e.getModel(n),r=[],o=Vr(t,WA(i));return HA(o.xAxisModels,(function(t){return a(t,"xAxis","xAxisIndex")})),HA(o.yAxisModels,(function(t){return a(t,"yAxis","yAxisIndex")})),r}function a(t,e,n){var o=t.componentIndex,a={type:"select",$fromToolbox:!0,filterMode:i.get("filterMode",!0)||"filter",id:VA+e+o};a[n]=o,r.push(a)}},(0,P.assert)(null==ch.get(BA)&&FA),ch.set(BA,FA);const jA=GA;const ZA=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.layoutMode={type:"box",ignoreSize:!0},n}return D(e,t),e.prototype.init=function(t,e,n){this.mergeDefaultAndTheme(t,n),t.selected=t.selected||{},this._updateSelector(t)},e.prototype.mergeOption=function(e,n){t.prototype.mergeOption.call(this,e,n),this._updateSelector(e)},e.prototype._updateSelector=function(t){var e=t.selector,n=this.ecModel;!0===e&&(e=t.selector=["all","inverse"]),P.isArray(e)&&P.each(e,(function(t,i){P.isString(t)&&(t={type:t}),e[i]=P.merge(t,function(t,e){return"all"===e?{type:"all",title:t.getLocaleModel().get(["legend","selector","all"])}:"inverse"===e?{type:"inverse",title:t.getLocaleModel().get(["legend","selector","inverse"])}:void 0}(n,t.type))}))},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,n=0;n=0},e.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(Zu);var XA=P.curry,qA=P.each,YA=Fi,KA=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.newlineDisabled=!1,n}return D(e,t),e.prototype.init=function(){this.group.add(this._contentGroup=new YA),this.group.add(this._selectorGroup=new YA),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(t,e,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),t.get("show",!0)){var r=t.get("align"),o=t.get("orient");r&&"auto"!==r||(r="right"===t.get("left")&&"vertical"===o?"right":"left");var a=t.get("selector",!0),s=t.get("selectorPosition",!0);!a||s&&"auto"!==s||(s="horizontal"===o?"end":"start"),this.renderInner(r,t,e,n,a,o,s);var l=t.getBoxLayoutParams(),u={width:n.getWidth(),height:n.getHeight()},h=t.get("padding"),c=Hu(l,u,h),d=this.layoutInner(t,r,c,i,a,s),f=Hu(P.defaults({width:d.width,height:d.height},l),u,h);this.group.x=f.x-d.x,this.group.y=f.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=dC(d,t))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(t,e,n,i,r,o,a){var s=this.getContentGroup(),l=P.createHashMap(),u=e.get("selectedMode"),h=[];n.eachRawSeries((function(t){!t.get("legendHoverLink")&&h.push(t.id)})),qA(e.getData(),(function(r,o){var a=r.get("name");if(!this.newlineDisabled&&(""===a||"\n"===a)){var c=new YA;return c.newline=!0,void s.add(c)}var d=n.getSeriesByName(a)[0];if(!l.get(a)){if(d){var f=d.getData(),p=f.getVisual("legendLineStyle")||{},g=f.getVisual("legendIcon"),m=f.getVisual("style"),v=this._createItem(d,a,o,r,e,t,p,m,g,u,i);v.on("click",XA(JA,a,null,i,h)).on("mouseover",XA(QA,d.name,null,i,h)).on("mouseout",XA(tL,d.name,null,i,h)),n.ssr&&v.eachChild((function(t){var e=hs(t);e.seriesIndex=d.seriesIndex,e.dataIndex=o,e.ssrType="legend"})),l.set(a,!0)}else n.eachRawSeries((function(s){if(!l.get(a)&&s.legendVisualProvider){var c=s.legendVisualProvider;if(!c.containName(a))return;var d=c.indexOfName(a),f=c.getItemVisual(d,"style"),p=c.getItemVisual(d,"legendIcon"),g=(0,tn.parse)(f.fill);g&&0===g[3]&&(g[3]=.2,f=P.extend(P.extend({},f),{fill:(0,tn.stringify)(g,"rgba")}));var m=this._createItem(s,a,o,r,e,t,{},f,p,u,i);m.on("click",XA(JA,null,a,i,h)).on("mouseover",XA(QA,null,a,i,h)).on("mouseout",XA(tL,null,a,i,h)),n.ssr&&m.eachChild((function(t){var e=hs(t);e.seriesIndex=s.seriesIndex,e.dataIndex=o,e.ssrType="legend"})),l.set(a,!0)}}),this);0}}),this),r&&this._createSelector(r,e,i,o,a)},e.prototype._createSelector=function(t,e,n,i,r){var o=this.getSelectorGroup();qA(t,(function(t){var i=t.type,r=new us({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect",legendId:e.id})}});o.add(r),fl(r,{normal:e.getModel("selectorLabel"),emphasis:e.getModel(["emphasis","selectorLabel"])},{defaultText:t.title}),Ks(r)}))},e.prototype._createItem=function(t,e,n,i,r,o,a,s,l,u,h){var c=t.visualDrawType,d=r.get("itemWidth"),f=r.get("itemHeight"),p=r.isSelected(e),g=i.get("symbolRotate"),m=i.get("symbolKeepAspect"),v=i.get("icon"),_=function(t,e,n,i,r,o,a){function s(t,e){"auto"===t.lineWidth&&(t.lineWidth=e.lineWidth>0?2:0),qA(t,(function(n,i){"inherit"===t[i]&&(t[i]=e[i])}))}var l=e.getModel("itemStyle"),u=l.getItemStyle(),h=0===t.lastIndexOf("empty",0)?"fill":"stroke",c=l.getShallow("decal");u.decal=c&&"inherit"!==c?Lm(c,a):i.decal,"inherit"===u.fill&&(u.fill=i[r]);"inherit"===u.stroke&&(u.stroke=i[h]);"inherit"===u.opacity&&(u.opacity=("fill"===r?i:n).opacity);s(u,i);var d=e.getModel("lineStyle"),f=d.getLineStyle();if(s(f,n),"auto"===u.fill&&(u.fill=i.fill),"auto"===u.stroke&&(u.stroke=i.fill),"auto"===f.stroke&&(f.stroke=i.fill),!o){var p=e.get("inactiveBorderWidth"),g=u[h];u.lineWidth="auto"===p?i.lineWidth>0&&g?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),f.stroke=d.get("inactiveColor"),f.lineWidth=d.get("inactiveWidth")}return{itemStyle:u,lineStyle:f}}(l=v||l||"roundRect",i,a,s,c,p,h),y=new YA,x=i.getModel("textStyle");if(!P.isFunction(t.getLegendIcon)||v&&"inherit"!==v){var b="inherit"===v&&t.getData().getVisual("symbol")?"inherit"===g?t.getData().getVisual("symbolRotate"):g:0;y.add(function(t){var e=t.icon||"roundRect",n=Jg(e,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill,t.symbolKeepAspect);n.setStyle(t.itemStyle),n.rotation=(t.iconRotate||0)*Math.PI/180,n.setOrigin([t.itemWidth/2,t.itemHeight/2]),e.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2);return n}({itemWidth:d,itemHeight:f,icon:l,iconRotate:b,itemStyle:_.itemStyle,lineStyle:_.lineStyle,symbolKeepAspect:m}))}else y.add(t.getLegendIcon({itemWidth:d,itemHeight:f,icon:l,iconRotate:g,itemStyle:_.itemStyle,lineStyle:_.lineStyle,symbolKeepAspect:m}));var w="left"===o?d+5:-5,S=o,T=r.get("formatter"),M=e;P.isString(T)&&T?M=T.replace("{name}",null!=e?e:""):P.isFunction(T)&&(M=T(e));var C=p?x.getTextColor():i.get("inactiveColor");y.add(new us({style:gl(x,{text:M,x:w,y:f/2,fill:C,align:S,verticalAlign:"middle"},{inheritColor:C})}));var A=new Xa({shape:y.getBoundingRect(),style:{fill:"transparent"}}),L=i.getModel("tooltip");return L.get("show")&&Op({el:A,componentModel:r,itemName:e,itemTooltipOption:L.option}),y.add(A),y.eachChild((function(t){t.silent=!0})),A.silent=!u,this.getContentGroup().add(y),Ks(y),y.__legendDataIndex=n,y},e.prototype.layoutInner=function(t,e,n,i,r,o){var a=this.getContentGroup(),s=this.getSelectorGroup();Fu(t.get("orient"),a,t.get("itemGap"),n.width,n.height);var l=a.getBoundingRect(),u=[-l.x,-l.y];if(s.markRedraw(),a.markRedraw(),r){Fu("horizontal",s,t.get("selectorItemGap",!0));var h=s.getBoundingRect(),c=[-h.x,-h.y],d=t.get("selectorButtonGap",!0),f=t.getOrient().index,p=0===f?"width":"height",g=0===f?"height":"width",m=0===f?"y":"x";"end"===o?c[f]+=l[p]+d:u[f]+=h[p]+d,c[1-f]+=l[g]/2-h[g]/2,s.x=c[0],s.y=c[1],a.x=u[0],a.y=u[1];var v={x:0,y:0};return v[p]=l[p]+d+h[p],v[g]=Math.max(l[g],h[g]),v[m]=Math.min(0,h[m]+c[1-f]),v}return a.x=u[0],a.y=u[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(Od);function JA(t,e,n,i){tL(t,e,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=t?t:e}),QA(t,e,n,i)}function $A(t){for(var e,n=t.getZr().storage.getDisplayList(),i=0,r=n.length;in[r],p=[-c.x,-c.y];e||(p[i]=l[s]);var g=[0,0],m=[-d.x,-d.y],v=P.retrieve2(t.get("pageButtonGap",!0),t.get("itemGap",!0));f&&("end"===t.get("pageButtonPosition",!0)?m[i]+=n[r]-d[r]:g[i]+=d[r]+v);m[1-i]+=c[o]/2-d[o]/2,l.setPosition(p),u.setPosition(g),h.setPosition(m);var _={x:0,y:0};if(_[r]=f?n[r]:c[r],_[o]=Math.max(c[o],d[o]),_[a]=Math.min(0,d[a]+m[1-i]),u.__rectSize=n[r],f){var y={x:0,y:0};y[r]=Math.max(n[r]-d[r]-v,0),y[o]=_[o],u.setClipPath(new Xa({shape:y})),u.__rectSize=y[r]}else h.eachChild((function(t){t.attr({invisible:!0,silent:!0})}));var x=this._getPageInfo(t);return null!=x.pageIndex&&rl(l,{x:x.contentPosition[0],y:x.contentPosition[1]},f?t:null),this._updatePageInfoView(t,x),_},e.prototype._pageGo=function(t,e,n){var i=this._getPageInfo(e)[t];null!=i&&n.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:e.id})},e.prototype._updatePageInfoView=function(t,e){var n=this._controllerGroup;P.each(["pagePrev","pageNext"],(function(i){var r=null!=e[i+"DataIndex"],o=n.childOfName(i);o&&(o.setStyle("fill",r?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),o.cursor=r?"pointer":"default")}));var i=n.childOfName("pageText"),r=t.get("pageFormatter"),o=e.pageIndex,a=null!=o?o+1:0,s=e.pageCount;i&&r&&i.setStyle("text",P.isString(r)?r.replace("{current}",null==a?"":a+"").replace("{total}",null==s?"":s+""):r({current:a,total:s}))},e.prototype._getPageInfo=function(t){var e=t.get("scrollDataIndex",!0),n=this.getContentGroup(),i=this._containerGroup.__rectSize,r=t.getOrient().index,o=uL[r],a=hL[r],s=this._findTargetItemIndex(e),l=n.children(),u=l[s],h=l.length,c=h?1:0,d={contentPosition:[n.x,n.y],pageCount:c,pageIndex:c-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!u)return d;var f=_(u);d.contentPosition[r]=-f.s;for(var p=s+1,g=f,m=f,v=null;p<=h;++p)(!(v=_(l[p]))&&m.e>g.s+i||v&&!y(v,g.s))&&(g=m.i>g.i?m:v)&&(null==d.pageNextDataIndex&&(d.pageNextDataIndex=g.i),++d.pageCount),m=v;for(p=s-1,g=f,m=f,v=null;p>=-1;--p)(v=_(l[p]))&&y(m,v.s)||!(g.i=e&&t.s<=e+i}},e.prototype._findTargetItemIndex=function(t){return this._showController?(this.getContentGroup().eachChild((function(i,r){var o=i.__legendDataIndex;null==n&&null!=o&&(n=r),o===t&&(e=r)})),null!=e?e:n):0;var e,n},e.type="legend.scroll",e}(eL);const dL=cL;function fL(t){rx(oL),t.registerComponentModel(sL),t.registerComponentView(dL),function(t){t.registerAction("legendScroll","legendscroll",(function(t,e){var n=t.scrollDataIndex;null!=n&&e.eachComponent({mainType:"legend",subType:"scroll",query:t},(function(t){t.setScrollDataIndex(n)}))}))}(t)}var pL=Math.sin,gL=Math.cos,mL=Math.PI,vL=2*Math.PI,_L=180/mL,yL=function(){function t(){}return t.prototype.reset=function(t){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,t||4)},t.prototype.moveTo=function(t,e){this._add("M",t,e)},t.prototype.lineTo=function(t,e){this._add("L",t,e)},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){this._add("C",t,e,n,i,r,o)},t.prototype.quadraticCurveTo=function(t,e,n,i){this._add("Q",t,e,n,i)},t.prototype.arc=function(t,e,n,i,r,o){this.ellipse(t,e,n,n,0,i,r,o)},t.prototype.ellipse=function(t,e,n,i,r,o,a,s){var l=a-o,u=!s,h=Math.abs(l),c=on(h-vL)||(u?l>=vL:-l>=vL),d=l>0?l%vL:l%vL+vL,f=!1;f=!!c||!on(h)&&d>=mL==!!u;var p=t+n*gL(o),g=e+i*pL(o);this._start&&this._add("M",p,g);var m=Math.round(r*_L);if(c){var v=1/this._p,_=(u?1:-1)*(vL-v);this._add("A",n,i,m,1,+u,t+n*gL(o+_),e+i*pL(o+_)),v>.01&&this._add("A",n,i,m,0,+u,p,g)}else{var y=t+n*gL(a),x=e+i*pL(a);this._add("A",n,i,m,+f,+u,y,x)}},t.prototype.rect=function(t,e,n,i){this._add("M",t,e),this._add("l",n,0),this._add("l",0,i),this._add("l",-n,0),this._add("Z")},t.prototype.closePath=function(){this._d.length>0&&this._add("Z")},t.prototype._add=function(t,e,n,i,r,o,a,s,l){for(var u=[],h=this._p,c=1;c"}(r,o)+("style"!==r?yt(a):a||"")+(i?""+n+(0,P.map)(i,(function(e){return t(e)})).join(n)+n:"")+("")}(t)}function EL(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function OL(t,e,n,i){return IL("svg","root",{width:t,height:e,xmlns:CL,"xmlns:xlink":AL,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+t+" "+e},n)}var NL=0;function RL(){return NL++}var kL={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},zL="transform-origin";function BL(t,e,n){var i=(0,P.extend)({},t.shape);(0,P.extend)(i,e),t.buildPath(n,i);var r=new xL;return r.reset(gn(t)),n.rebuildPath(r,1),r.generateStr(),r.getStr()}function FL(t,e){var n=e.originX,i=e.originY;(n||i)&&(t[zL]=n+"px "+i+"px")}var HL={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function VL(t,e){var n=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[n]=t,n}function GL(t){return(0,P.isString)(t)?kL[t]?"cubic-bezier("+kL[t]+")":$e(t)?t:"":""}function UL(t,e,n,i){var r=t.animators,o=r.length,a=[];if(t instanceof Wf){var s=function(t,e,n){var i,r,o=t.shape.paths,a={};if((0,P.each)(o,(function(t){var e=EL(n.zrId);e.animation=!0,UL(t,{},e,!0);var o=e.cssAnims,s=e.cssNodes,l=(0,P.keys)(o),u=l.length;if(u){var h=o[r=l[u-1]];for(var c in h){var d=h[c];a[c]=a[c]||{d:""},a[c].d+=d.d||""}for(var f in s){var p=s[f].animation;p.indexOf(r)>=0&&(i=p)}}})),i){e.d=!1;var s=VL(a,n);return i.replace(r,s)}}(t,e,n);if(s)a.push(s);else if(!o)return}else if(!o)return;for(var l={},u=0;u0})).length)return VL(h,n)+" "+r[0]+" both"}for(var m in l){(s=g(l[m]))&&a.push(s)}if(a.length){var v=n.zrId+"-cls-"+RL();n.cssNodes["."+v]={animation:a.join(",")},e.class=v}}function WL(t,e,n,i){var r=JSON.stringify(t),o=n.cssStyleCache[r];o||(o=n.zrId+"-cls-"+RL(),n.cssStyleCache[r]=o,n.cssNodes["."+o+(i?":hover":"")]=t),e.class=e.class?e.class+" "+o:o}var jL=Math.round;function ZL(t){return t&&(0,P.isString)(t.src)}function XL(t){return t&&(0,P.isFunction)(t.toDataURL)}function qL(t,e,n,i){ML((function(r,o){var a="fill"===r||"stroke"===r;a&&fn(o)?oD(e,t,r,i):a&&hn(o)?aD(n,t,r,i):t[r]=o,a&&i.ssr&&"none"===o&&(t["pointer-events"]="visible")}),e,n,!1),function(t,e,n){var i=t.style;if(function(t){return t&&(t.shadowBlur||t.shadowOffsetX||t.shadowOffsetY)}(i)){var r=function(t){var e=t.style,n=t.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(",")}(t),o=n.shadowCache,a=o[r];if(!a){var s=t.getGlobalScale(),l=s[0],u=s[1];if(!l||!u)return;var h=i.shadowOffsetX||0,c=i.shadowOffsetY||0,d=i.shadowBlur,f=nn(i.shadowColor),p=f.opacity,g=f.color,m=d/2/l+" "+d/2/u;a=n.zrId+"-s"+n.shadowIdx++,n.defs[a]=IL("filter",a,{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},[IL("feDropShadow","",{dx:h/l,dy:c/u,stdDeviation:m,"flood-color":g,"flood-opacity":p})]),o[r]=a}e.filter=pn(a)}}(n,t,i)}function YL(t,e){var n=Yi(e);n&&(n.each((function(e,n){null!=e&&(t[(LL+n).toLowerCase()]=e+"")})),e.isSilent()&&(t[LL+"silent"]="true"))}function KL(t){return on(t[0]-1)&&on(t[1])&&on(t[2])&&on(t[3]-1)}function JL(t,e,n){if(e&&(!function(t){return on(t[4])&&on(t[5])}(e)||!KL(e))){var i=n?10:1e4;t.transform=KL(e)?"translate("+jL(e[4]*i)/i+" "+jL(e[5]*i)/i+")":function(t){return"matrix("+an(t[0])+","+an(t[1])+","+an(t[2])+","+an(t[3])+","+sn(t[4])+","+sn(t[5])+")"}(e)}}function $L(t,e,n){for(var i=t.points,r=[],o=0;o=0&&a||o;s&&(r=(0,tn.liftColor)(s))}var l=i.lineWidth;l&&(l/=!i.strokeNoScale&&t.transform?t.transform[0]:1);var u={cursor:"pointer"};r&&(u.fill=r),i.stroke&&(u.stroke=i.stroke),l&&(u["stroke-width"]=l),WL(u,e,n,!0)}}(t,o,e),IL(s,t.id+"",o)}function rD(t,e){return t instanceof Ea?iD(t,e):t instanceof Fa?function(t,e){var n=t.style,i=n.image;if(i&&!(0,P.isString)(i)&&(ZL(i)?i=i.src:XL(i)&&(i=i.toDataURL())),i){var r=n.x||0,o=n.y||0,a={href:i,width:n.width,height:n.height};return r&&(a.x=r),o&&(a.y=o),JL(a,t.transform),qL(a,n,t,e),YL(a,t),e.animation&&UL(t,a,e),IL("image",t.id+"",a)}}(t,e):t instanceof Ra?function(t,e){var n=t.style,i=n.text;if(null!=i&&(i+=""),i&&!isNaN(n.x)&&!isNaN(n.y)){var r=n.font||vi.OH,o=n.x||0,a=function(t,e,n){return"top"===n?t+=e/2:"bottom"===n&&(t-=e/2),t}(n.y||0,Ti(r),n.textBaseline),s={"dominant-baseline":"central","text-anchor":ln[n.textAlign]||n.textAlign};if(ns(n)){var l="",u=n.fontStyle,h=ts(n.fontSize);if(!parseFloat(h))return;var c=n.fontFamily||vi.zs,d=n.fontWeight;l+="font-size:"+h+";font-family:"+c+";",u&&"normal"!==u&&(l+="font-style:"+u+";"),d&&"normal"!==d&&(l+="font-weight:"+d+";"),s.style=l}else s.style="font: "+r;return i.match(/\s/)&&(s["xml:space"]="preserve"),o&&(s.x=o),a&&(s.y=a),JL(s,t.transform),qL(s,n,t,e),YL(s,t),e.animation&&UL(t,s,e),IL("text",t.id+"",s,void 0,i)}}(t,e):void 0}function oD(t,e,n,i){var r,o=t[n],a={gradientUnits:o.global?"userSpaceOnUse":"objectBoundingBox"};if(cn(o))r="linearGradient",a.x1=o.x,a.y1=o.y,a.x2=o.x2,a.y2=o.y2;else{if(!dn(o))return void 0;r="radialGradient",a.cx=(0,P.retrieve2)(o.x,.5),a.cy=(0,P.retrieve2)(o.y,.5),a.r=(0,P.retrieve2)(o.r,.5)}for(var s=o.colorStops,l=[],u=0,h=s.length;ul?bD(t,null==n[c+1]?null:n[c+1].elm,n,s,c):wD(t,e,a,l))}(n,i,r):vD(r)?(vD(t.text)&&pD(n,""),bD(n,null,r,0,r.length-1)):vD(i)?wD(n,i,0,i.length-1):vD(t.text)&&pD(n,""):t.text!==e.text&&(vD(i)&&wD(n,i,0,i.length-1),pD(n,e.text)))}var MD=0,CD=function(){function t(t,e,n){if(this.type="svg",this.refreshHover=function(){0},this.configLayer=function(){0},this.storage=e,this._opts=n=(0,P.extend)({},n),this.root=t,this._id="zr"+MD++,this._oldVNode=OL(n.width,n.height),t&&!n.ssr){var i=this._viewport=document.createElement("div");i.style.cssText="position:relative;overflow:hidden";var r=this._svgDom=this._oldVNode.elm=DL("svg");SD(null,this._oldVNode),i.appendChild(r),t.appendChild(i)}this.resize(n.width,n.height)}return t.prototype.getType=function(){return this.type},t.prototype.getViewportRoot=function(){return this._viewport},t.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},t.prototype.getSvgDom=function(){return this._svgDom},t.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",function(t,e){if(yD(t,e))TD(t,e);else{var n=t.elm,i=dD(n);xD(e),null!==i&&(uD(i,e.elm,fD(n)),wD(i,[t],0,0))}}(this._oldVNode,t),this._oldVNode=t}},t.prototype.renderOneToVNode=function(t){return rD(t,EL(this._id))},t.prototype.renderToVNode=function(t){t=t||{};var e=this.storage.getDisplayList(!0),n=this._width,i=this._height,r=EL(this._id);r.animation=t.animation,r.willUpdate=t.willUpdate,r.compress=t.compress,r.emphasis=t.emphasis,r.ssr=this._opts.ssr;var o=[],a=this._bgVNode=function(t,e,n,i){var r;if(n&&"none"!==n)if(r=IL("rect","bg",{width:t,height:e,x:"0",y:"0"}),fn(n))oD({fill:n},r.attrs,"fill",i);else if(hn(n))aD({style:{fill:n},dirty:P.noop,getBoundingRect:function(){return{width:t,height:e}}},r.attrs,"fill",i);else{var o=nn(n),a=o.color,s=o.opacity;r.attrs.fill=a,s<1&&(r.attrs["fill-opacity"]=s)}return r}(n,i,this._backgroundColor,r);a&&o.push(a);var s=t.compress?null:this._mainVNode=IL("g","main",{},[]);this._paintList(e,r,s?s.children:o),s&&o.push(s);var l=(0,P.map)((0,P.keys)(r.defs),(function(t){return r.defs[t]}));if(l.length&&o.push(IL("defs","defs",{},l)),t.animation){var u=function(t,e,n){var i=(n=n||{}).newline?"\n":"",r=" {"+i,o=i+"}",a=(0,P.map)((0,P.keys)(t),(function(e){return e+r+(0,P.map)((0,P.keys)(t[e]),(function(n){return n+":"+t[e][n]+";"})).join(i)+o})).join(i),s=(0,P.map)((0,P.keys)(e),(function(t){return"@keyframes "+t+r+(0,P.map)((0,P.keys)(e[t]),(function(n){return n+r+(0,P.map)((0,P.keys)(e[t][n]),(function(i){var r=e[t][n][i];return"d"===i&&(r='path("'+r+'")'),i+":"+r+";"})).join(i)+o})).join(i)+o})).join(i);return a||s?[""].join(i):""}(r.cssNodes,r.cssAnims,{newline:!0});if(u){var h=IL("style","stl",{},[],u);o.push(h)}}return OL(n,i,o,t.useViewBox)},t.prototype.renderToString=function(t){return t=t||{},PL(this.renderToVNode({animation:(0,P.retrieve2)(t.cssAnimation,!0),emphasis:(0,P.retrieve2)(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:(0,P.retrieve2)(t.useViewBox,!0)}),{newline:!0})},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t},t.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},t.prototype._paintList=function(t,e,n){for(var i,r,o=t.length,a=[],s=0,l=0,u=0;u=0&&(!c||!r||c[p]!==r[p]);p--);for(var g=f-1;g>p;g--)i=a[--s-1];for(var m=p+1;m=a)}}for(var h=this.__startIndex;h15)break}n.prevElClipPaths&&c.restore()};if(f)if(0===f.length)s=l.__endIndex;else for(var x=d.dpr,b=0;b0&&t>i[0]){for(s=0;st);s++);a=n[i[s]]}if(i.splice(s+1,0,t),n[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?o.insertBefore(e.dom,l.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.painter||(e.painter=this)}},t.prototype.eachLayer=function(t,e){for(var n=this._zlevelList,i=0;i0?OD:0),this._needsManuallyCompositing),u.__builtin__||P.logError("ZLevel "+l+" has been used by unkown layer "+u.id),u!==o&&(u.__used=!0,u.__startIndex!==r&&(u.__dirty=!0),u.__startIndex=r,u.incremental?u.__drawIndex=-1:u.__drawIndex=r,e(r),o=u),s.__dirty&ve&&!s.__inHover&&(u.__dirty=!0,u.incremental&&u.__drawIndex<0&&(u.__drawIndex=r))}e(r),this.eachBuiltinLayer((function(t,e){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)}))},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(t){t.clear()},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t,P.each(this._layers,(function(t){t.setUnpainted()}))},t.prototype.configLayer=function(t,e){if(e){var n=this._layerConfig;n[t]?P.merge(n[t],e,!0):n[t]=e;for(var i=0;i=400?t.onerror&&t.onerror():t.onload&&t.onload(e.response)},t.onerror&&(e.onerror=t.onerror),e.send(null)}};var YI,KI={supportWebGL:function(){if(null==YI)try{var t=document.createElement("canvas");if(!(t.getContext("webgl")||t.getContext("experimental-webgl")))throw new Error}catch(t){YI=!1}return YI}};KI.Int8Array="undefined"==typeof Int8Array?Array:Int8Array,KI.Uint8Array="undefined"==typeof Uint8Array?Array:Uint8Array,KI.Uint16Array="undefined"==typeof Uint16Array?Array:Uint16Array,KI.Uint32Array="undefined"==typeof Uint32Array?Array:Uint32Array,KI.Int16Array="undefined"==typeof Int16Array?Array:Int16Array,KI.Float32Array="undefined"==typeof Float32Array?Array:Float32Array,KI.Float64Array="undefined"==typeof Float64Array?Array:Float64Array;var JI={};"undefined"!=typeof window?JI=window:void 0!==n.g&&(JI=n.g),KI.requestAnimationFrame=JI.requestAnimationFrame||JI.msRequestAnimationFrame||JI.mozRequestAnimationFrame||JI.webkitRequestAnimationFrame||function(t){setTimeout(t,16)},KI.createCanvas=function(){return document.createElement("canvas")},KI.createImage=function(){return new JI.Image},KI.request={get:qI.get},KI.addEventListener=function(t,e,n,i){t.addEventListener(e,n,i)},KI.removeEventListener=function(t,e,n){t.removeEventListener(e,n)};const $I=KI;var QI=function(){this.head=null,this.tail=null,this._length=0};QI.prototype.insert=function(t){var e=new QI.Entry(t);return this.insertEntry(e),e},QI.prototype.insertAt=function(t,e){if(!(t<0)){for(var n=this.head,i=0;n&&i!=t;)n=n.next,i++;if(n){var r=new QI.Entry(e),o=n.prev;o?(o.next=r,r.prev=o):this.head=r,r.next=n,n.prev=r}else this.insert(e)}},QI.prototype.insertBeforeEntry=function(t,e){var n=new QI.Entry(t),i=e.prev;i?(i.next=n,n.prev=i):this.head=n,n.next=e,e.prev=n,this._length++},QI.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,this.tail=t):this.head=this.tail=t,this._length++},QI.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._length--},QI.prototype.removeAt=function(t){if(!(t<0)){for(var e=this.head,n=0;e&&n!=t;)e=e.next,n++;return e?(this.remove(e),e.value):void 0}},QI.prototype.getHead=function(){if(this.head)return this.head.value},QI.prototype.getTail=function(){if(this.tail)return this.tail.value},QI.prototype.getAt=function(t){if(!(t<0)){for(var e=this.head,n=0;e&&n!=t;)e=e.next,n++;return e.value}},QI.prototype.indexOf=function(t){for(var e=this.head,n=0;e;){if(e.value===t)return n;e=e.next,n++}},QI.prototype.length=function(){return this._length},QI.prototype.isEmpty=function(){return 0===this._length},QI.prototype.forEach=function(t,e){for(var n=this.head,i=0,r=void 0!==e;n;)r?t.call(e,n.value,i):t(n.value,i),n=n.next,i++},QI.prototype.clear=function(){this.tail=this.head=null,this._length=0},QI.Entry=function(t){this.value=t,this.next=null,this.prev=null};const tP=QI;var eP=function(t){this._list=new tP,this._map={},this._maxSize=t||10};eP.prototype.setMaxSize=function(t){this._maxSize=t},eP.prototype.put=function(t,e){if(!this._map.hasOwnProperty(t)){var n=this._list.length();if(n>=this._maxSize&&n>0){var i=this._list.head;this._list.remove(i),delete this._map[i.key]}var r=this._list.insert(e);r.key=t,this._map[t]=r}},eP.prototype.get=function(t){var e=this._map[t];if(this._map.hasOwnProperty(t))return e!==this._list.tail&&(this._list.remove(e),this._list.insertEntry(e)),e.value},eP.prototype.remove=function(t){var e=this._map[t];void 0!==e&&(delete this._map[t],this._list.remove(e))},eP.prototype.clear=function(){this._list.clear(),this._map={}};const nP=eP;var iP={},rP={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function oP(t){return(t=Math.round(t))<0?0:t>255?255:t}function aP(t){return t<0?0:t>1?1:t}function sP(t){return t.length&&"%"===t.charAt(t.length-1)?oP(parseFloat(t)/100*255):oP(parseInt(t,10))}function lP(t){return t.length&&"%"===t.charAt(t.length-1)?aP(parseFloat(t)/100):aP(parseFloat(t))}function uP(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function hP(t,e,n){return t+(e-t)*n}function cP(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function dP(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var fP=new nP(20),pP=null;function gP(t,e){pP&&dP(pP,e),pP=fP.put(t,pP||e.slice())}function mP(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=lP(t[1]),r=lP(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return cP(e=e||[],oP(255*uP(a,o,n+1/3)),oP(255*uP(a,o,n)),oP(255*uP(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}iP.parse=function(t,e){if(t){e=e||[];var n=fP.get(t);if(n)return dP(e,n);var i,r=(t+="").replace(/ /g,"").toLowerCase();if(r in rP)return dP(e,rP[r]),gP(t,e),e;if("#"===r.charAt(0))return 4===r.length?(i=parseInt(r.substr(1),16))>=0&&i<=4095?(cP(e,(3840&i)>>4|(3840&i)>>8,240&i|(240&i)>>4,15&i|(15&i)<<4,1),gP(t,e),e):void cP(e,0,0,0,1):7===r.length?(i=parseInt(r.substr(1),16))>=0&&i<=16777215?(cP(e,(16711680&i)>>16,(65280&i)>>8,255&i,1),gP(t,e),e):void cP(e,0,0,0,1):void 0;var o=r.indexOf("("),a=r.indexOf(")");if(-1!==o&&a+1===r.length){var s=r.substr(0,o),l=r.substr(o+1,a-(o+1)).split(","),u=1;switch(s){case"rgba":if(4!==l.length)return void cP(e,0,0,0,1);u=lP(l.pop());case"rgb":return 3!==l.length?void cP(e,0,0,0,1):(cP(e,sP(l[0]),sP(l[1]),sP(l[2]),u),gP(t,e),e);case"hsla":return 4!==l.length?void cP(e,0,0,0,1):(l[3]=lP(l[3]),mP(l,e),gP(t,e),e);case"hsl":return 3!==l.length?void cP(e,0,0,0,1):(mP(l,e),gP(t,e),e);default:return}}cP(e,0,0,0,1)}},iP.parseToFloat=function(t,e){if(e=iP.parse(t,e))return e[0]/=255,e[1]/=255,e[2]/=255,e},iP.lift=function(t,e){var n=iP.parse(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0;return iP.stringify(n,4===n.length?"rgba":"rgb")}},iP.toHex=function(t){var e=iP.parse(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)},iP.fastLerp=function(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],l=i-r;return n[0]=oP(hP(a[0],s[0],l)),n[1]=oP(hP(a[1],s[1],l)),n[2]=oP(hP(a[2],s[2],l)),n[3]=aP(hP(a[3],s[3],l)),n}},iP.fastMapToColor=iP.fastLerp,iP.lerp=function(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=iP.parse(e[r]),s=iP.parse(e[o]),l=i-r,u=iP.stringify([oP(hP(a[0],s[0],l)),oP(hP(a[1],s[1],l)),oP(hP(a[2],s[2],l)),aP(hP(a[3],s[3],l))],"rgba");return n?{color:u,leftIndex:r,rightIndex:o,value:i}:u}},iP.mapToColor=iP.lerp,iP.modifyHSL=function(t,e,n,i){if(t=iP.parse(t))return t=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(t),null!=e&&(t[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(t[1]=lP(n)),null!=i&&(t[2]=lP(i)),iP.stringify(mP(t),"rgba");var r},iP.modifyAlpha=function(t,e){if((t=iP.parse(t))&&null!=e)return t[3]=aP(e),iP.stringify(t,"rgba")},iP.stringify=function(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}};var vP=iP.parseToFloat,_P={};function yP(t){var e=Object.keys(t);e.sort();for(var n=[],i=0;i=0},getEnabledUniforms:function(){return this._enabledUniforms},getTextureUniforms:function(){return this._textureUniforms},set:function(t,e){if("object"==typeof t)for(var n in t){var i=t[n];this.setUniform(n,i)}else this.setUniform(t,e)},get:function(t){var e=this.uniforms[t];if(e)return e.value},attachShader:function(t,e){var n=this.uniforms;this.uniforms=t.createUniforms(),this.shader=t;var i=this.uniforms;this._enabledUniforms=Object.keys(i),this._enabledUniforms.sort(),this._textureUniforms=this._enabledUniforms.filter((function(t){var e=this.uniforms[t].type;return"t"===e||"tv"===e}),this);var r=this.vertexDefines,o=this.fragmentDefines;if(this.vertexDefines=XD.clone(t.vertexDefines),this.fragmentDefines=XD.clone(t.fragmentDefines),e){for(var a in n)i[a]&&(i[a].value=n[a].value);XD.defaults(this.vertexDefines,r),XD.defaults(this.fragmentDefines,o)}var s={};for(var l in t.textures)s[l]={shaderType:t.textures[l].shaderType,type:t.textures[l].type,enabled:!(!e||!this._textureStatus[l])&&this._textureStatus[l].enabled};this._textureStatus=s,this._programKey=""},clone:function(){var t=new this.constructor({name:this.name,shader:this.shader});for(var e in this.uniforms)t.uniforms[e].value=this.uniforms[e].value;return t.depthTest=this.depthTest,t.depthMask=this.depthMask,t.transparent=this.transparent,t.blend=this.blend,t.vertexDefines=XD.clone(this.vertexDefines),t.fragmentDefines=XD.clone(this.fragmentDefines),t.enableTexture(this.getEnabledTextures()),t.precision=this.precision,t},define:function(t,e,n){var i=this.vertexDefines,r=this.fragmentDefines;"vertex"!==t&&"fragment"!==t&&"both"!==t&&arguments.length<3&&(n=e,e=t,t="both"),n=null!=n?n:null,"vertex"!==t&&"both"!==t||i[e]!==n&&(i[e]=n,this._programKey=""),"fragment"!==t&&"both"!==t||r[e]!==n&&(r[e]=n,"both"!==t&&(this._programKey=""))},undefine:function(t,e){"vertex"!==t&&"fragment"!==t&&"both"!==t&&arguments.length<2&&(e=t,t="both"),"vertex"!==t&&"both"!==t||this.isDefined("vertex",e)&&(delete this.vertexDefines[e],this._programKey=""),"fragment"!==t&&"both"!==t||this.isDefined("fragment",e)&&(delete this.fragmentDefines[e],"both"!==t&&(this._programKey=""))},isDefined:function(t,e){switch(t){case"vertex":return void 0!==this.vertexDefines[e];case"fragment":return void 0!==this.fragmentDefines[e]}},getDefine:function(t,e){switch(t){case"vertex":return this.vertexDefines[e];case"fragment":return this.fragmentDefines[e]}},enableTexture:function(t){if(Array.isArray(t))for(var e=0;e0&&(r=1/Math.sqrt(r),t[0]=e[0]*r,t[1]=e[1]*r),t},MP.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},MP.cross=function(t,e,n){var i=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=i,t},MP.lerp=function(t,e,n,i){var r=e[0],o=e[1];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t},MP.random=function(t,e){e=e||1;var n=2*GLMAT_RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},MP.transformMat2=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r,t[1]=n[1]*i+n[3]*r,t},MP.transformMat2d=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r+n[4],t[1]=n[1]*i+n[3]*r+n[5],t},MP.transformMat3=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[3]*r+n[6],t[1]=n[1]*i+n[4]*r+n[7],t},MP.transformMat4=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[4]*r+n[12],t[1]=n[1]*i+n[5]*r+n[13],t},MP.forEach=(bP=MP.create(),function(t,e,n,i,r,o){var a,s;for(e||(e=2),n||(n=0),s=i?Math.min(i*e+n,t.length):t.length,a=n;a0&&i.push("#define "+r.toUpperCase()+"_COUNT "+o)}if(n)for(var a=0;al.getMaxJointNumber()&&(d.USE_SKIN_MATRICES_TEXTURE=null),c+="\n"+zP(d)+"\n"}o&&(c+="\n#define INSTANCING\n");var f=c+zP(e.vertexDefines,s,h),p=c+zP(e.fragmentDefines,s,h),g=f+"\n"+e.shader.vertex,m=["OES_standard_derivatives","EXT_shader_texture_lod"].filter((function(t){return null!=l.getGLExtension(t)}));m.indexOf("EXT_shader_texture_lod")>=0&&(p+="\n#define SUPPORT_TEXTURE_LOD"),m.indexOf("OES_standard_derivatives")>=0&&(p+="\n#define SUPPORT_STANDARD_DERIVATIVES");var v,_,y=function(t){for(var e=[],n=0;n=0){if(1!==s&&4!==s){QP();break}s=2,u=[]}else if(1!==s)if(4!==s)h(c),s=0;else{var d=c;ZP.indexOf(d)>=0||XP.indexOf(d)>=0||qP.indexOf(d)>=0?l[a].semantic=d:"ignore"===d||"unconfigurable"===d?l[a].ignore=!0:l[a].value="bool"===t?"true"===d:parseFloat(d)}else l[a].value="bool"===t?"true"===c:parseFloat(c),u=null;else{if(2!==s){QP();break}if(!(u instanceof Array)){QP();break}u.push(+i[++o])}else l[a].value=new $I.Float32Array(u),u=null,s=5;else if(2===s){if(!(u instanceof Array)){QP();break}u.push(+i[++o])}else s=5;else s=4;else{if(0!==s&&3!==s){QP();break}s=1}}return l}function eE(t,e){"object"==typeof t&&(e=t.fragment,t=t.vertex),t=$P(t),e=$P(e),this._shaderID=function(t,e){var n="vertex:"+t+"fragment:"+e;if(KP[n])return KP[n];var i=XD.genGUID();return KP[n]=i,JP[i]={vertex:t,fragment:e},i}(t,e),this._vertexCode=eE.parseImport(t),this._fragmentCode=eE.parseImport(e),this.attributeSemantics={},this.matrixSemantics={},this.uniformSemantics={},this.matrixSemanticKeys=[],this.uniformTemplates={},this.attributes={},this.textures={},this.vertexDefines={},this.fragmentDefines={},this._parseAttributes(),this._parseUniforms(),this._parseDefines()}eE.prototype={constructor:eE,createUniforms:function(){var t={};for(var e in this.uniformTemplates){var n=this.uniformTemplates[e];t[e]={type:n.type,value:n.value()}}return t},_parseImport:function(){this._vertexCode=eE.parseImport(this.vertex),this._fragmentCode=eE.parseImport(this.fragment)},_addSemanticUniform:function(t,e,n){if(ZP.indexOf(n)>=0)this.attributeSemantics[n]={symbol:t,type:e};else if(qP.indexOf(n)>=0){var i=!1,r=n;n.match(/TRANSPOSE$/)&&(i=!0,r=n.slice(0,-9)),this.matrixSemantics[n]={symbol:t,type:e,isTranspose:i,semanticNoTranspose:r}}else XP.indexOf(n)>=0&&(this.uniformSemantics[n]={symbol:t,type:e})},_addMaterialUniform:function(t,e,n,i,r,o){o[t]={type:n,value:r?jP.array:i||jP[e],semantic:null}},_parseUniforms:function(){var t={},e=this,n="vertex";function i(t){return null!=t?function(){return t}:null}function r(r,o,a){var s=tE(o,a),l=[];for(var u in s){var h=s[u],c=h.semantic,d=u,f=UP[o],p=i(s[u].value);s[u].isArray&&(d+="["+s[u].arraySize+"]",f+="v"),l.push(d),e._uniformList.push(u),h.ignore||("sampler2D"!==o&&"samplerCube"!==o||(e.textures[u]={shaderType:n,type:o}),c?e._addSemanticUniform(u,f,c):e._addMaterialUniform(u,o,f,p,s[u].isArray,t))}return l.length>0?"uniform "+o+" "+l.join(",")+";\n":""}this._uniformList=[],this._vertexCode=this._vertexCode.replace(HP,r),n="fragment",this._fragmentCode=this._fragmentCode.replace(HP,r),e.matrixSemanticKeys=Object.keys(this.matrixSemantics),this.uniformTemplates=t},_parseAttributes:function(){var t={},e=this;this._vertexCode=this._vertexCode.replace(VP,(function(n,i,r){var o=tE(i,r),a=YP[i]||1,s=[];for(var l in o){var u=o[l].semantic;if(t[l]={type:"float",size:a,semantic:u||null},u){if(ZP.indexOf(u)<0)throw new Error('Unkown semantic "'+u+'"');e.attributeSemantics[u]={symbol:l,type:i}}s.push(l)}return"attribute "+i+" "+s.join(",")+";\n"})),this.attributes=t},_parseDefines:function(){var t=this,e="vertex";function n(n,i,r){var o="vertex"===e?t.vertexDefines:t.fragmentDefines;return o[i]||(o[i]="false"!==r&&("true"===r||(r?isNaN(parseFloat(r))?r.trim():parseFloat(r):null))),""}this._vertexCode=this._vertexCode.replace(GP,n),e="fragment",this._fragmentCode=this._fragmentCode.replace(GP,n)},clone:function(){var t=JP[this._shaderID];return new eE(t.vertex,t.fragment)}},Object.defineProperty&&(Object.defineProperty(eE.prototype,"shaderID",{get:function(){return this._shaderID}}),Object.defineProperty(eE.prototype,"vertex",{get:function(){return this._vertexCode}}),Object.defineProperty(eE.prototype,"fragment",{get:function(){return this._fragmentCode}}),Object.defineProperty(eE.prototype,"uniforms",{get:function(){return this._uniformList}}));var nE=/(@import)\s*([0-9a-zA-Z_\-\.]*)/g;eE.parseImport=function(t){return t=t.replace(nE,(function(t,e,n){return(t=eE.source(n))?eE.parseImport(t):(console.error('Shader chunk "'+n+'" not existed in library'),"")}))};var iE=/(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g;eE.import=function(t){t.replace(iE,(function(t,e,n,i){if(i=i.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g,"")){for(var r,o=n.split("."),a=eE.codes,s=0;s 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n}\n@end";var aE={create:function(){var t=new SP(16);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},clone:function(t){var e=new SP(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},copy:function(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},identity:function(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},transpose:function(t,e){if(t===e){var n=e[1],i=e[2],r=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=o,t[11]=e[14],t[12]=r,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},invert:function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15],_=n*s-i*a,y=n*l-r*a,x=n*u-o*a,b=i*l-r*s,w=i*u-o*s,S=r*u-o*l,T=h*g-c*p,M=h*m-d*p,C=h*v-f*p,A=c*m-d*g,L=c*v-f*g,D=d*v-f*m,I=_*D-y*L+x*A+b*C-w*M+S*T;return I?(I=1/I,t[0]=(s*D-l*L+u*A)*I,t[1]=(r*L-i*D-o*A)*I,t[2]=(g*S-m*w+v*b)*I,t[3]=(d*w-c*S-f*b)*I,t[4]=(l*C-a*D-u*M)*I,t[5]=(n*D-r*C+o*M)*I,t[6]=(m*x-p*S-v*y)*I,t[7]=(h*S-d*x+f*y)*I,t[8]=(a*L-s*C+u*T)*I,t[9]=(i*C-n*L-o*T)*I,t[10]=(p*w-g*x+v*_)*I,t[11]=(c*x-h*w-f*_)*I,t[12]=(s*M-a*A-l*T)*I,t[13]=(n*A-i*M+r*T)*I,t[14]=(g*y-p*b-m*_)*I,t[15]=(h*b-c*y+d*_)*I,t):null},adjoint:function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15];return t[0]=s*(d*v-f*m)-c*(l*v-u*m)+g*(l*f-u*d),t[1]=-(i*(d*v-f*m)-c*(r*v-o*m)+g*(r*f-o*d)),t[2]=i*(l*v-u*m)-s*(r*v-o*m)+g*(r*u-o*l),t[3]=-(i*(l*f-u*d)-s*(r*f-o*d)+c*(r*u-o*l)),t[4]=-(a*(d*v-f*m)-h*(l*v-u*m)+p*(l*f-u*d)),t[5]=n*(d*v-f*m)-h*(r*v-o*m)+p*(r*f-o*d),t[6]=-(n*(l*v-u*m)-a*(r*v-o*m)+p*(r*u-o*l)),t[7]=n*(l*f-u*d)-a*(r*f-o*d)+h*(r*u-o*l),t[8]=a*(c*v-f*g)-h*(s*v-u*g)+p*(s*f-u*c),t[9]=-(n*(c*v-f*g)-h*(i*v-o*g)+p*(i*f-o*c)),t[10]=n*(s*v-u*g)-a*(i*v-o*g)+p*(i*u-o*s),t[11]=-(n*(s*f-u*c)-a*(i*f-o*c)+h*(i*u-o*s)),t[12]=-(a*(c*m-d*g)-h*(s*m-l*g)+p*(s*d-l*c)),t[13]=n*(c*m-d*g)-h*(i*m-r*g)+p*(i*d-r*c),t[14]=-(n*(s*m-l*g)-a*(i*m-r*g)+p*(i*l-r*s)),t[15]=n*(s*d-l*c)-a*(i*d-r*c)+h*(i*l-r*s),t},determinant:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],h=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],m=t[15];return(e*a-n*o)*(c*m-d*g)-(e*s-i*o)*(h*m-d*p)+(e*l-r*o)*(h*g-c*p)+(n*s-i*a)*(u*m-d*f)-(n*l-r*a)*(u*g-c*f)+(i*l-r*s)*(u*p-h*f)},multiply:function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],c=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],v=e[14],_=e[15],y=n[0],x=n[1],b=n[2],w=n[3];return t[0]=y*i+x*s+b*c+w*g,t[1]=y*r+x*l+b*d+w*m,t[2]=y*o+x*u+b*f+w*v,t[3]=y*a+x*h+b*p+w*_,y=n[4],x=n[5],b=n[6],w=n[7],t[4]=y*i+x*s+b*c+w*g,t[5]=y*r+x*l+b*d+w*m,t[6]=y*o+x*u+b*f+w*v,t[7]=y*a+x*h+b*p+w*_,y=n[8],x=n[9],b=n[10],w=n[11],t[8]=y*i+x*s+b*c+w*g,t[9]=y*r+x*l+b*d+w*m,t[10]=y*o+x*u+b*f+w*v,t[11]=y*a+x*h+b*p+w*_,y=n[12],x=n[13],b=n[14],w=n[15],t[12]=y*i+x*s+b*c+w*g,t[13]=y*r+x*l+b*d+w*m,t[14]=y*o+x*u+b*f+w*v,t[15]=y*a+x*h+b*p+w*_,t},multiplyAffine:function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[4],s=e[5],l=e[6],u=e[8],h=e[9],c=e[10],d=e[12],f=e[13],p=e[14],g=n[0],m=n[1],v=n[2];return t[0]=g*i+m*a+v*u,t[1]=g*r+m*s+v*h,t[2]=g*o+m*l+v*c,g=n[4],m=n[5],v=n[6],t[4]=g*i+m*a+v*u,t[5]=g*r+m*s+v*h,t[6]=g*o+m*l+v*c,g=n[8],m=n[9],v=n[10],t[8]=g*i+m*a+v*u,t[9]=g*r+m*s+v*h,t[10]=g*o+m*l+v*c,g=n[12],m=n[13],v=n[14],t[12]=g*i+m*a+v*u+d,t[13]=g*r+m*s+v*h+f,t[14]=g*o+m*l+v*c+p,t}};aE.mul=aE.multiply,aE.mulAffine=aE.multiplyAffine,aE.translate=function(t,e,n){var i,r,o,a,s,l,u,h,c,d,f,p,g=n[0],m=n[1],v=n[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*v+e[12],t[13]=e[1]*g+e[5]*m+e[9]*v+e[13],t[14]=e[2]*g+e[6]*m+e[10]*v+e[14],t[15]=e[3]*g+e[7]*m+e[11]*v+e[15]):(i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],c=e[8],d=e[9],f=e[10],p=e[11],t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=h,t[8]=c,t[9]=d,t[10]=f,t[11]=p,t[12]=i*g+s*m+c*v+e[12],t[13]=r*g+l*m+d*v+e[13],t[14]=o*g+u*m+f*v+e[14],t[15]=a*g+h*m+p*v+e[15]),t},aE.scale=function(t,e,n){var i=n[0],r=n[1],o=n[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},aE.rotate=function(t,e,n,i){var r,o,a,s,l,u,h,c,d,f,p,g,m,v,_,y,x,b,w,S,T,M,C,A,L=i[0],D=i[1],I=i[2],P=Math.sqrt(L*L+D*D+I*I);return Math.abs(P)0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},lE.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},lE.cross=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2];return t[0]=r*l-o*s,t[1]=o*a-i*l,t[2]=i*s-r*a,t},lE.lerp=function(t,e,n,i){var r=e[0],o=e[1],a=e[2];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t[2]=a+i*(n[2]-a),t},lE.random=function(t,e){e=e||1;var n=2*TP()*Math.PI,i=2*TP()-1,r=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*r,t[1]=Math.sin(n)*r,t[2]=i*e,t},lE.transformMat4=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[3]*i+n[7]*r+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*i+n[4]*r+n[8]*o+n[12])/a,t[1]=(n[1]*i+n[5]*r+n[9]*o+n[13])/a,t[2]=(n[2]*i+n[6]*r+n[10]*o+n[14])/a,t},lE.transformMat3=function(t,e,n){var i=e[0],r=e[1],o=e[2];return t[0]=i*n[0]+r*n[3]+o*n[6],t[1]=i*n[1]+r*n[4]+o*n[7],t[2]=i*n[2]+r*n[5]+o*n[8],t},lE.transformQuat=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2],u=n[3],h=u*i+s*o-l*r,c=u*r+l*i-a*o,d=u*o+a*r-s*i,f=-a*i-s*r-l*o;return t[0]=h*u+f*-a+c*-l-d*-s,t[1]=c*u+f*-s+d*-a-h*-l,t[2]=d*u+f*-l+h*-s-c*-a,t},lE.rotateX=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[0],o[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),o[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},lE.rotateY=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),o[1]=r[1],o[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},lE.rotateZ=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),o[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),o[2]=r[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},lE.forEach=function(){var t=lE.create();return function(e,n,i,r,o,a){var s,l;for(n||(n=3),i||(i=0),l=r?Math.min(r*n+i,e.length):e.length,s=i;s1?0:Math.acos(r)};const uE=lE;rE.import(oE);var hE=sE.create,cE={};function dE(t){return t.material}function fE(t,e,n){return e.uniforms[n].value}function pE(t,e,n,i){return n!==i}function gE(t){return!0}function mE(){}var vE={float:SI,byte:vI,ubyte:_I,short:yI,ushort:xI};function _E(t,e,n){this.availableAttributes=t,this.availableAttributeSymbols=e,this.indicesBuffer=n,this.vao=null}function yE(t){var e,n;this.bind=function(t){e||((e=$I.createCanvas()).width=e.height=1,e.getContext("2d"));var i=t.gl,r=!n;r&&(n=i.createTexture()),i.bindTexture(i.TEXTURE_2D,n),r&&i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e)},this.unbind=function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},this.isRenderable=function(){return!0}}var xE=YD.extend((function(){return{canvas:null,_width:100,_height:100,devicePixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,clearColor:[0,0,0,0],clearBit:17664,alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,throwError:!0,gl:null,viewport:{},maxJointNumber:20,__currentFrameBuffer:null,_viewportStack:[],_clearStack:[],_sceneRendering:null}}),(function(){this.canvas||(this.canvas=$I.createCanvas());var t=this.canvas;try{var e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,preserveDrawingBuffer:this.preserveDrawingBuffer};if(this.gl=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!this.gl)throw new Error;this._glinfo=new $D(this.gl),this.gl.targetRenderer&&console.error("Already created a renderer"),this.gl.targetRenderer=this,this.resize()}catch(t){throw"Error creating WebGL Context "+t}this._programMgr=new FP(this),this._placeholderTexture=new yE(this)}),{resize:function(t,e){var n=this.canvas,i=this.devicePixelRatio;null!=t?(n.style&&(n.style.width=t+"px",n.style.height=e+"px"),n.width=t*i,n.height=e*i,this._width=t,this._height=e):(this._width=n.width/i,this._height=n.height/i),this.setViewport(0,0,this._width,this._height)},getWidth:function(){return this._width},getHeight:function(){return this._height},getViewportAspect:function(){var t=this.viewport;return t.width/t.height},setDevicePixelRatio:function(t){this.devicePixelRatio=t,this.resize(this._width,this._height)},getDevicePixelRatio:function(){return this.devicePixelRatio},getGLExtension:function(t){return this._glinfo.getExtension(t)},getGLParameter:function(t){return this._glinfo.getParameter(t)},setViewport:function(t,e,n,i,r){if("object"==typeof t){var o=t;t=o.x,e=o.y,n=o.width,i=o.height,r=o.devicePixelRatio}r=r||this.devicePixelRatio,this.gl.viewport(t*r,e*r,n*r,i*r),this.viewport={x:t,y:e,width:n,height:i,devicePixelRatio:r}},saveViewport:function(){this._viewportStack.push(this.viewport)},restoreViewport:function(){this._viewportStack.length>0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var t=this._clearStack.pop();this.clearColor=t.clearColor,this.clearBit=t.clearBit}},bindSceneRendering:function(t){this._sceneRendering=t},render:function(t,e,n,i){var r=this.gl,o=this.clearColor;if(this.clearBit){r.colorMask(!0,!0,!0,!0),r.depthMask(!0);var a=this.viewport,s=!1,l=a.devicePixelRatio;(a.width!==this._width||a.height!==this._height||l&&l!==this.devicePixelRatio||a.x||a.y)&&(s=!0,r.enable(r.SCISSOR_TEST),r.scissor(a.x*l,a.y*l,a.width*l,a.height*l)),r.clearColor(o[0],o[1],o[2],o[3]),r.clear(this.clearBit),s&&r.disable(r.SCISSOR_TEST)}if(n||t.update(!1),t.updateLights(),e=e||t.getMainCamera()){e.update();var u=t.updateRenderList(e,!0);this._sceneRendering=t;var h=u.opaque,c=u.transparent,d=t.material;t.trigger("beforerender",this,t,e,u),i?(this.renderPreZ(h,t,e),r.depthFunc(r.LEQUAL)):r.depthFunc(r.LESS);for(var f=hE(),p=uE.create(),g=0;g0){var s=t[r-1],l=s.joints?s.joints.length:0;if((o.joints?o.joints.length:0)===l&&o.material===s.material&&o.lightGroup===s.lightGroup){o.__program=s.__program;continue}}var u=this._programMgr.getProgram(o,a,e);this.validateProgram(u),o.__program=u}},renderPass:function(t,e,n){this.trigger("beforerenderpass",this,t,e,n),(n=n||{}).getMaterial=n.getMaterial||dE,n.getUniform=n.getUniform||fE,n.isMaterialChanged=n.isMaterialChanged||pE,n.beforeRender=n.beforeRender||mE,n.afterRender=n.afterRender||mE;var i=n.ifRender||gE;this.updatePrograms(t,this._sceneRendering,n),n.sortCompare&&t.sort(n.sortCompare);var r=this.viewport,o=r.devicePixelRatio,a=[r.x*o,r.y*o,r.width*o,r.height*o],s=this.devicePixelRatio,l=this.__currentFrameBuffer?[this.__currentFrameBuffer.getTextureWidth(),this.__currentFrameBuffer.getTextureHeight()]:[this._width*s,this._height*s],u=[a[2],a[3]],h=Date.now();e?(sE.copy(bE.VIEW,e.viewMatrix.array),sE.copy(bE.PROJECTION,e.projectionMatrix.array),sE.copy(bE.VIEWINVERSE,e.worldTransform.array)):(sE.identity(bE.VIEW),sE.identity(bE.PROJECTION),sE.identity(bE.VIEWINVERSE)),sE.multiply(bE.VIEWPROJECTION,bE.PROJECTION,bE.VIEW),sE.invert(bE.PROJECTIONINVERSE,bE.PROJECTION),sE.invert(bE.VIEWPROJECTIONINVERSE,bE.VIEWPROJECTION);for(var c,d,f,p,g,m,v,_,y,x,b,w,S=this.gl,T=this._sceneRendering,M=null,C=0;Cthis.getMaxJointNumber()){var o=r.getSubSkinMatricesTexture(t.__uid__,t.joints);e.useTextureSlot(this,o,n),e.setUniform(i,"1i","skinMatricesTexture",n),e.setUniform(i,"1f","skinMatricesTextureSize",o.width)}else{var a=r.getSubSkinMatrices(t.__uid__,t.joints);e.setUniformOfSemantic(i,"SKIN_MATRIX",a)}},_renderObject:function(t,e,n){var i=this.gl,r=t.geometry,o=t.mode;null==o&&(o=4);var a=null,s=t.isInstancedMesh&&t.isInstancedMesh();if(!s||(a=this.getGLExtension("ANGLE_instanced_arrays"))){var l;if(s&&(l=this._bindInstancedAttributes(t,n,a)),e.indicesBuffer){var u=this.getGLExtension("OES_element_index_uint")&&r.indices instanceof Uint32Array?i.UNSIGNED_INT:i.UNSIGNED_SHORT;s?a.drawElementsInstancedANGLE(o,e.indicesBuffer.count,u,0,t.getInstanceCount()):i.drawElements(o,e.indicesBuffer.count,u,0)}else s?a.drawArraysInstancedANGLE(o,0,r.vertexCount,t.getInstanceCount()):i.drawArrays(o,0,r.vertexCount);if(s)for(var h=0;hn?n:t}SE.add=function(t,e,n){return uE.add(t.array,e.array,n.array),t._dirty=!0,t},SE.set=function(t,e,n,i){uE.set(t.array,e,n,i),t._dirty=!0},SE.copy=function(t,e){return uE.copy(t.array,e.array),t._dirty=!0,t},SE.cross=function(t,e,n){return uE.cross(t.array,e.array,n.array),t._dirty=!0,t},SE.distance=SE.dist=function(t,e){return uE.distance(t.array,e.array)},SE.div=function(t,e,n){return uE.divide(t.array,e.array,n.array),t._dirty=!0,t},SE.divide=SE.div,SE.dot=function(t,e){return uE.dot(t.array,e.array)},SE.len=function(t){return uE.length(t.array)},SE.lerp=function(t,e,n,i){return uE.lerp(t.array,e.array,n.array,i),t._dirty=!0,t},SE.min=function(t,e,n){return uE.min(t.array,e.array,n.array),t._dirty=!0,t},SE.max=function(t,e,n){return uE.max(t.array,e.array,n.array),t._dirty=!0,t},SE.mul=function(t,e,n){return uE.multiply(t.array,e.array,n.array),t._dirty=!0,t},SE.multiply=SE.mul,SE.negate=function(t,e){return uE.negate(t.array,e.array),t._dirty=!0,t},SE.normalize=function(t,e){return uE.normalize(t.array,e.array),t._dirty=!0,t},SE.random=function(t,e){return uE.random(t.array,e),t._dirty=!0,t},SE.scale=function(t,e,n){return uE.scale(t.array,e.array,n),t._dirty=!0,t},SE.scaleAndAdd=function(t,e,n,i){return uE.scaleAndAdd(t.array,e.array,n.array,i),t._dirty=!0,t},SE.squaredDistance=SE.sqrDist=function(t,e){return uE.sqrDist(t.array,e.array)},SE.squaredLength=SE.sqrLen=function(t){return uE.sqrLen(t.array)},SE.sub=function(t,e,n){return uE.subtract(t.array,e.array,n.array),t._dirty=!0,t},SE.subtract=SE.sub,SE.transformMat3=function(t,e,n){return uE.transformMat3(t.array,e.array,n.array),t._dirty=!0,t},SE.transformMat4=function(t,e,n){return uE.transformMat4(t.array,e.array,n.array),t._dirty=!0,t},SE.transformQuat=function(t,e,n){return uE.transformQuat(t.array,e.array,n.array),t._dirty=!0,t};var AE=Math.atan2,LE=Math.asin,DE=Math.abs;SE.eulerFromQuat=function(t,e,n){t._dirty=!0,e=e.array;var i=t.array,r=e[0],o=e[1],a=e[2],s=e[3],l=r*r,u=o*o,h=a*a,c=s*s;switch(n=(n||"XYZ").toUpperCase()){case"XYZ":i[0]=AE(2*(r*s-o*a),c-l-u+h),i[1]=LE(CE(2*(r*a+o*s),-1,1)),i[2]=AE(2*(a*s-r*o),c+l-u-h);break;case"YXZ":i[0]=LE(CE(2*(r*s-o*a),-1,1)),i[1]=AE(2*(r*a+o*s),c-l-u+h),i[2]=AE(2*(r*o+a*s),c-l+u-h);break;case"ZXY":i[0]=LE(CE(2*(r*s+o*a),-1,1)),i[1]=AE(2*(o*s-a*r),c-l-u+h),i[2]=AE(2*(a*s-r*o),c-l+u-h);break;case"ZYX":i[0]=AE(2*(r*s+a*o),c-l-u+h),i[1]=LE(CE(2*(o*s-r*a),-1,1)),i[2]=AE(2*(r*o+a*s),c+l-u-h);break;case"YZX":i[0]=AE(2*(r*s-a*o),c-l+u-h),i[1]=AE(2*(o*s-r*a),c+l-u-h),i[2]=LE(CE(2*(r*o+a*s),-1,1));break;case"XZY":i[0]=AE(2*(r*s+o*a),c-l+u-h),i[1]=AE(2*(r*a+o*s),c+l-u-h),i[2]=LE(CE(2*(a*s-r*o),-1,1));break;default:console.warn("Unkown order: "+n)}return t},SE.eulerFromMat3=function(t,e,n){var i=e.array,r=i[0],o=i[3],a=i[6],s=i[1],l=i[4],u=i[7],h=i[2],c=i[5],d=i[8],f=t.array;switch(n=(n||"XYZ").toUpperCase()){case"XYZ":f[1]=LE(CE(a,-1,1)),DE(a)<.99999?(f[0]=AE(-u,d),f[2]=AE(-o,r)):(f[0]=AE(c,l),f[2]=0);break;case"YXZ":f[0]=LE(-CE(u,-1,1)),DE(u)<.99999?(f[1]=AE(a,d),f[2]=AE(s,l)):(f[1]=AE(-h,r),f[2]=0);break;case"ZXY":f[0]=LE(CE(c,-1,1)),DE(c)<.99999?(f[1]=AE(-h,d),f[2]=AE(-o,l)):(f[1]=0,f[2]=AE(s,r));break;case"ZYX":f[1]=LE(-CE(h,-1,1)),DE(h)<.99999?(f[0]=AE(c,d),f[2]=AE(s,r)):(f[0]=0,f[2]=AE(-o,l));break;case"YZX":f[2]=LE(CE(s,-1,1)),DE(s)<.99999?(f[0]=AE(-u,l),f[1]=AE(-h,r)):(f[0]=0,f[1]=AE(a,d));break;case"XZY":f[2]=LE(-CE(o,-1,1)),DE(o)<.99999?(f[0]=AE(c,l),f[1]=AE(a,r)):(f[0]=AE(-u,d),f[1]=0);break;default:console.warn("Unkown order: "+n)}return t._dirty=!0,t},Object.defineProperties(SE,{POSITIVE_X:{get:function(){return new SE(1,0,0)}},NEGATIVE_X:{get:function(){return new SE(-1,0,0)}},POSITIVE_Y:{get:function(){return new SE(0,1,0)}},NEGATIVE_Y:{get:function(){return new SE(0,-1,0)}},POSITIVE_Z:{get:function(){return new SE(0,0,1)}},NEGATIVE_Z:{get:function(){return new SE(0,0,-1)}},UP:{get:function(){return new SE(0,1,0)}},ZERO:{get:function(){return new SE}}});const IE=SE;var PE,EE,OE,NE,RE,kE=1e-5,zE=function(t,e){this.origin=t||new IE,this.direction=e||new IE};zE.prototype={constructor:zE,intersectPlane:function(t,e){var n=t.normal.array,i=t.distance,r=this.origin.array,o=this.direction.array,a=uE.dot(n,o);if(0===a)return null;e||(e=new IE);var s=(uE.dot(n,r)-i)/a;return uE.scaleAndAdd(e.array,r,o,-s),e._dirty=!0,e},mirrorAgainstPlane:function(t){var e=uE.dot(t.normal.array,this.direction.array);uE.scaleAndAdd(this.direction.array,this.direction.array,t.normal.array,2*-e),this.direction._dirty=!0},distanceToPoint:(RE=uE.create(),function(t){uE.sub(RE,t,this.origin.array);var e=uE.dot(RE,this.direction.array);if(e<0)return uE.distance(this.origin.array,t);var n=uE.lenSquared(RE);return Math.sqrt(n-e*e)}),intersectSphere:function(){var t=uE.create();return function(e,n,i){var r=this.origin.array,o=this.direction.array;e=e.array,uE.sub(t,e,r);var a=uE.dot(t,o),s=uE.squaredLength(t)-a*a,l=n*n;if(!(s>l)){var u=Math.sqrt(l-s),h=a-u,c=a+u;return i||(i=new IE),h<0?c<0?null:(uE.scaleAndAdd(i.array,r,o,c),i):(uE.scaleAndAdd(i.array,r,o,h),i)}}}(),intersectBoundingBox:function(t,e){var n,i,r,o,a,s,l=this.direction.array,u=this.origin.array,h=t.min.array,c=t.max.array,d=1/l[0],f=1/l[1],p=1/l[2];if(d>=0?(n=(h[0]-u[0])*d,i=(c[0]-u[0])*d):(i=(h[0]-u[0])*d,n=(c[0]-u[0])*d),f>=0?(r=(h[1]-u[1])*f,o=(c[1]-u[1])*f):(o=(h[1]-u[1])*f,r=(c[1]-u[1])*f),n>o||r>i)return null;if((r>n||n!=n)&&(n=r),(o=0?(a=(h[2]-u[2])*p,s=(c[2]-u[2])*p):(s=(h[2]-u[2])*p,a=(c[2]-u[2])*p),n>s||a>i)return null;if((a>n||n!=n)&&(n=a),(s=0?n:i;return e||(e=new IE),uE.scaleAndAdd(e.array,u,l,g),e},intersectTriangle:(PE=uE.create(),EE=uE.create(),OE=uE.create(),NE=uE.create(),function(t,e,n,i,r,o){var a=this.direction.array,s=this.origin.array;t=t.array,e=e.array,n=n.array,uE.sub(PE,e,t),uE.sub(EE,n,t),uE.cross(NE,EE,a);var l=uE.dot(PE,NE);if(i){if(l>-1e-5)return null}else if(l>-1e-5&&l1)return null;uE.cross(NE,PE,OE);var h=uE.dot(a,NE)/l;if(h<0||h>1||u+h>1)return null;uE.cross(NE,PE,EE);var c=-uE.dot(OE,NE)/l;return c<0?null:(r||(r=new IE),o&&IE.set(o,1-u-h,u,h),uE.scaleAndAdd(r.array,s,a,c),r)}),applyTransform:function(t){IE.add(this.direction,this.direction,this.origin),IE.transformMat4(this.origin,this.origin,t),IE.transformMat4(this.direction,this.direction,t),IE.sub(this.direction,this.direction,this.origin),IE.normalize(this.direction,this.direction)},copy:function(t){IE.copy(this.origin,t.origin),IE.copy(this.direction,t.direction)},clone:function(){var t=new zE;return t.copy(this),t}};const BE=zE;var FE={create:function(){var t=new SP(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},clone:function(t){var e=new SP(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},fromValues:function(t,e,n,i){var r=new SP(4);return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},set:function(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t},add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},subtract:function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}};FE.sub=FE.subtract,FE.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},FE.mul=FE.multiply,FE.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t},FE.div=FE.divide,FE.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},FE.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},FE.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},FE.scaleAndAdd=function(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t},FE.distance=function(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(n*n+i*i+r*r+o*o)},FE.dist=FE.distance,FE.squaredDistance=function(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],o=e[3]-t[3];return n*n+i*i+r*r+o*o},FE.sqrDist=FE.squaredDistance,FE.length=function(t){var e=t[0],n=t[1],i=t[2],r=t[3];return Math.sqrt(e*e+n*n+i*i+r*r)},FE.len=FE.length,FE.squaredLength=function(t){var e=t[0],n=t[1],i=t[2],r=t[3];return e*e+n*n+i*i+r*r},FE.sqrLen=FE.squaredLength,FE.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},FE.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},FE.normalize=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=n*n+i*i+r*r+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t[3]=e[3]*a),t},FE.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},FE.lerp=function(t,e,n,i){var r=e[0],o=e[1],a=e[2],s=e[3];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t[2]=a+i*(n[2]-a),t[3]=s+i*(n[3]-s),t},FE.random=function(t,e){return e=e||1,t[0]=TP(),t[1]=TP(),t[2]=TP(),t[3]=TP(),FE.normalize(t,t),FE.scale(t,t,e),t},FE.transformMat4=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3];return t[0]=n[0]*i+n[4]*r+n[8]*o+n[12]*a,t[1]=n[1]*i+n[5]*r+n[9]*o+n[13]*a,t[2]=n[2]*i+n[6]*r+n[10]*o+n[14]*a,t[3]=n[3]*i+n[7]*r+n[11]*o+n[15]*a,t},FE.transformQuat=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2],u=n[3],h=u*i+s*o-l*r,c=u*r+l*i-a*o,d=u*o+a*r-s*i,f=-a*i-s*r-l*o;return t[0]=h*u+f*-a+c*-l-d*-s,t[1]=c*u+f*-s+d*-a-h*-l,t[2]=d*u+f*-l+h*-s-c*-a,t},FE.forEach=function(){var t=FE.create();return function(e,n,i,r,o,a){var s,l;for(n||(n=4),i||(i=0),l=r?Math.min(r*n+i,e.length):e.length,s=i;s.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(uE.cross(UE,e,n),t[0]=UE[0],t[1]=UE[1],t[2]=UE[2],t[3]=1+i,XE.normalize(t,t))}),XE.setAxes=(ZE=GE.create(),function(t,e,n,i){return ZE[0]=n[0],ZE[3]=n[1],ZE[6]=n[2],ZE[1]=i[0],ZE[4]=i[1],ZE[7]=i[2],ZE[2]=-e[0],ZE[5]=-e[1],ZE[8]=-e[2],XE.normalize(t,XE.fromMat3(t,ZE))}),XE.clone=HE.clone,XE.fromValues=HE.fromValues,XE.copy=HE.copy,XE.set=HE.set,XE.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},XE.setAxisAngle=function(t,e,n){n*=.5;var i=Math.sin(n);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(n),t},XE.add=HE.add,XE.multiply=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=n[0],l=n[1],u=n[2],h=n[3];return t[0]=i*h+a*s+r*u-o*l,t[1]=r*h+a*l+o*s-i*u,t[2]=o*h+a*u+i*l-r*s,t[3]=a*h-i*s-r*l-o*u,t},XE.mul=XE.multiply,XE.scale=HE.scale,XE.rotateX=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+a*s,t[1]=r*l+o*s,t[2]=o*l-r*s,t[3]=a*l-i*s,t},XE.rotateY=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l-o*s,t[1]=r*l+a*s,t[2]=o*l+i*s,t[3]=a*l-r*s,t},XE.rotateZ=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+r*s,t[1]=r*l-i*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t},XE.calculateW=function(t,e){var n=e[0],i=e[1],r=e[2];return t[0]=n,t[1]=i,t[2]=r,t[3]=Math.sqrt(Math.abs(1-n*n-i*i-r*r)),t},XE.dot=HE.dot,XE.lerp=HE.lerp,XE.slerp=function(t,e,n,i){var r,o,a,s,l,u=e[0],h=e[1],c=e[2],d=e[3],f=n[0],p=n[1],g=n[2],m=n[3];return(o=u*f+h*p+c*g+d*m)<0&&(o=-o,f=-f,p=-p,g=-g,m=-m),1-o>1e-6?(r=Math.acos(o),a=Math.sin(r),s=Math.sin((1-i)*r)/a,l=Math.sin(i*r)/a):(s=1-i,l=i),t[0]=s*u+l*f,t[1]=s*h+l*p,t[2]=s*c+l*g,t[3]=s*d+l*m,t},XE.invert=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=n*n+i*i+r*r+o*o,s=a?1/a:0;return t[0]=-n*s,t[1]=-i*s,t[2]=-r*s,t[3]=o*s,t},XE.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},XE.length=HE.length,XE.len=XE.length,XE.squaredLength=HE.squaredLength,XE.sqrLen=XE.squaredLength,XE.normalize=HE.normalize,XE.fromMat3=function(t,e){var n,i=e[0]+e[4]+e[8];if(i>0)n=Math.sqrt(i+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var r=0;e[4]>e[0]&&(r=1),e[8]>e[3*r+r]&&(r=2);var o=(r+1)%3,a=(r+2)%3;n=Math.sqrt(e[3*r+r]-e[3*o+o]-e[3*a+a]+1),t[r]=.5*n,n=.5/n,t[3]=(e[3*o+a]-e[3*a+o])*n,t[o]=(e[3*o+r]+e[3*r+o])*n,t[a]=(e[3*a+r]+e[3*r+a])*n}return t};const qE=XE;var YE,KE,JE,$E,QE=function(){this._axisX=new IE,this._axisY=new IE,this._axisZ=new IE,this.array=sE.create(),this._dirty=!0};QE.prototype={constructor:QE,setArray:function(t){for(var e=0;e0){var e=this.min,n=this.max,i=e.array,r=n.array;pO(i,t[0]),pO(r,t[0]);for(var o=1;or[0]&&(r[0]=a[0]),a[1]>r[1]&&(r[1]=a[1]),a[2]>r[2]&&(r[2]=a[2])}e._dirty=!0,n._dirty=!0}},union:function(t){var e=this.min,n=this.max;return uE.min(e.array,e.array,t.min.array),uE.max(n.array,n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},intersection:function(t){var e=this.min,n=this.max;return uE.max(e.array,e.array,t.min.array),uE.min(n.array,n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},intersectBoundingBox:function(t){var e=this.min.array,n=this.max.array,i=t.min.array,r=t.max.array;return!(e[0]>r[0]||e[1]>r[1]||e[2]>r[2]||n[0]=r[0]&&n[1]>=r[1]&&n[2]>=r[2]},containPoint:function(t){var e=this.min.array,n=this.max.array,i=t.array;return e[0]<=i[0]&&e[1]<=i[1]&&e[2]<=i[2]&&n[0]>=i[0]&&n[1]>=i[1]&&n[2]>=i[2]},isFinite:function(){var t=this.min.array,e=this.max.array;return isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])&&isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])},applyTransform:function(t){this.transformFrom(this,t)},transformFrom:(sO=uE.create(),lO=uE.create(),uO=uE.create(),hO=uE.create(),cO=uE.create(),dO=uE.create(),function(t,e){var n=t.min.array,i=t.max.array,r=e.array;return sO[0]=r[0]*n[0],sO[1]=r[1]*n[0],sO[2]=r[2]*n[0],lO[0]=r[0]*i[0],lO[1]=r[1]*i[0],lO[2]=r[2]*i[0],uO[0]=r[4]*n[1],uO[1]=r[5]*n[1],uO[2]=r[6]*n[1],hO[0]=r[4]*i[1],hO[1]=r[5]*i[1],hO[2]=r[6]*i[1],cO[0]=r[8]*n[2],cO[1]=r[9]*n[2],cO[2]=r[10]*n[2],dO[0]=r[8]*i[2],dO[1]=r[9]*i[2],dO[2]=r[10]*i[2],n=this.min.array,i=this.max.array,n[0]=Math.min(sO[0],lO[0])+Math.min(uO[0],hO[0])+Math.min(cO[0],dO[0])+r[12],n[1]=Math.min(sO[1],lO[1])+Math.min(uO[1],hO[1])+Math.min(cO[1],dO[1])+r[13],n[2]=Math.min(sO[2],lO[2])+Math.min(uO[2],hO[2])+Math.min(cO[2],dO[2])+r[14],i[0]=Math.max(sO[0],lO[0])+Math.max(uO[0],hO[0])+Math.max(cO[0],dO[0])+r[12],i[1]=Math.max(sO[1],lO[1])+Math.max(uO[1],hO[1])+Math.max(cO[1],dO[1])+r[13],i[2]=Math.max(sO[2],lO[2])+Math.max(uO[2],hO[2])+Math.max(cO[2],dO[2])+r[14],this.min._dirty=!0,this.max._dirty=!0,this}),applyProjection:function(t){var e=this.min.array,n=this.max.array,i=t.array,r=e[0],o=e[1],a=e[2],s=n[0],l=n[1],u=e[2],h=n[0],c=n[1],d=n[2];if(1===i[15])e[0]=i[0]*r+i[12],e[1]=i[5]*o+i[13],n[2]=i[10]*a+i[14],n[0]=i[0]*h+i[12],n[1]=i[5]*c+i[13],e[2]=i[10]*d+i[14];else{var f=-1/a;e[0]=i[0]*r*f,e[1]=i[5]*o*f,n[2]=(i[10]*a+i[14])*f,f=-1/u,n[0]=i[0]*s*f,n[1]=i[5]*l*f,f=-1/d,e[2]=(i[10]*d+i[14])*f}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var t=this.vertices;if(!t){t=[];for(var e=0;e<8;e++)t[e]=uE.fromValues(0,0,0);this.vertices=t}var n=this.min.array,i=this.max.array;return fO(t[0],n[0],n[1],n[2]),fO(t[1],n[0],i[1],n[2]),fO(t[2],i[0],n[1],n[2]),fO(t[3],i[0],i[1],n[2]),fO(t[4],n[0],n[1],i[2]),fO(t[5],n[0],i[1],i[2]),fO(t[6],i[0],n[1],i[2]),fO(t[7],i[0],i[1],i[2]),this},copy:function(t){var e=this.min,n=this.max;return pO(e.array,t.min.array),pO(n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},clone:function(){var t=new gO;return t.copy(this),t}};const mO=gO;var vO,_O=0,yO=YD.extend({name:"",position:null,rotation:null,scale:null,worldTransform:null,localTransform:null,autoUpdateLocalTransform:!0,_parent:null,_scene:null,_needsUpdateWorldTransform:!0,_inIterating:!1,__depth:0},(function(){this.name||(this.name=(this.type||"NODE")+"_"+_O++),this.position||(this.position=new IE),this.rotation||(this.rotation=new aO),this.scale||(this.scale=new IE(1,1,1)),this.worldTransform=new nO,this.localTransform=new nO,this._children=[]}),{target:null,invisible:!1,isSkinnedMesh:function(){return!1},isRenderable:function(){return!1},setName:function(t){var e=this._scene;if(e){var n=e._nodeRepository;delete n[this.name],n[t]=this}this.name=t},add:function(t){var e=t._parent;if(e!==this){e&&e.remove(t),t._parent=this,this._children.push(t);var n=this._scene;n&&n!==t.scene&&t.traverse(this._addSelfToScene,this),t._needsUpdateWorldTransform=!0}},remove:function(t){var e=this._children,n=e.indexOf(t);n<0||(e.splice(n,1),t._parent=null,this._scene&&t.traverse(this._removeSelfFromScene,this))},removeAll:function(){for(var t=this._children,e=0;e0},beforeRender:function(t){},afterRender:function(t,e){},getBoundingBox:function(t,e){return e=xO.prototype.getBoundingBox.call(this,t,e),this.geometry&&this.geometry.boundingBox&&e.union(this.geometry.boundingBox),e},clone:(bO=["castShadow","receiveShadow","mode","culling","cullFace","frontFace","frustumCulling","renderOrder","lineWidth","ignorePicking","ignorePreZ","ignoreGBuffer"],function(){var t=xO.prototype.clone.call(this);t.geometry=this.geometry,t.material=this.material;for(var e=0;e=0&&b[y]>1e-4&&(uE.transformMat4(T,x,v[w[y]]),uE.scaleAndAdd(S,S,T,b[y]));M.set(_,S)}}for(_=0;_>e;return t+1},dispose:function(t){var e=this._cache;e.use(t.__uid__);var n=e.get("webgl_texture");n&&t.gl.deleteTexture(n),e.deleteContext(t.__uid__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty(DO.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty(DO.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}),DO.BYTE=vI,DO.UNSIGNED_BYTE=_I,DO.SHORT=yI,DO.UNSIGNED_SHORT=xI,DO.INT=bI,DO.UNSIGNED_INT=wI,DO.FLOAT=SI,DO.HALF_FLOAT=36193,DO.UNSIGNED_INT_24_8_WEBGL=34042,DO.DEPTH_COMPONENT=TI,DO.DEPTH_STENCIL=UI,DO.ALPHA=MI,DO.RGB=CI,DO.RGBA=AI,DO.LUMINANCE=LI,DO.LUMINANCE_ALPHA=DI,DO.SRGB=35904,DO.SRGB_ALPHA=35906,DO.COMPRESSED_RGB_S3TC_DXT1_EXT=33776,DO.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777,DO.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778,DO.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779,DO.NEAREST=II,DO.LINEAR=PI,DO.NEAREST_MIPMAP_NEAREST=EI,DO.LINEAR_MIPMAP_NEAREST=OI,DO.NEAREST_MIPMAP_LINEAR=NI,DO.LINEAR_MIPMAP_LINEAR=RI,DO.REPEAT=BI,DO.CLAMP_TO_EDGE=FI,DO.MIRRORED_REPEAT=HI;const IO=DO;var PO=SO.extend({skeleton:null,joints:null},(function(){this.joints||(this.joints=[])}),{offsetMatrix:null,isInstancedMesh:function(){return!1},isSkinnedMesh:function(){return!!(this.skeleton&&this.joints&&this.joints.length>0)},clone:function(){var t=SO.prototype.clone.call(this);return t.skeleton=this.skeleton,this.joints&&(t.joints=this.joints.slice()),t}});PO.POINTS=nI,PO.LINES=iI,PO.LINE_LOOP=rI,PO.LINE_STRIP=oI,PO.TRIANGLES=aI,PO.TRIANGLE_STRIP=sI,PO.TRIANGLE_FAN=lI,PO.BACK=fI,PO.FRONT=dI,PO.FRONT_AND_BACK=pI,PO.CW=gI,PO.CCW=mI;const EO=PO;var OO={isPowerOfTwo:function(t){return!(t&t-1)},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}};const NO=OO;var RO=NO.isPowerOfTwo;function kO(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}var zO=IO.extend((function(){return{image:null,pixels:null,mipmaps:[],convertToPOT:!1}}),{textureType:"texture2D",update:function(t){var e=t.gl;e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),this.updateCommon(t);var n=this.format,i=this.type,r=!(!this.convertToPOT||this.mipmaps.length||!this.image||this.wrapS!==IO.REPEAT&&this.wrapT!==IO.REPEAT||!this.NPOT);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,r?this.wrapS:this.getAvailableWrapS()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,r?this.wrapT:this.getAvailableWrapT()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r?this.magFilter:this.getAvailableMagFilter()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,r?this.minFilter:this.getAvailableMinFilter());var o=t.getGLExtension("EXT_texture_filter_anisotropic");(o&&this.anisotropic>1&&e.texParameterf(e.TEXTURE_2D,o.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i)&&(t.getGLExtension("OES_texture_half_float")||(i=SI));if(this.mipmaps.length)for(var a=this.width,s=this.height,l=0;l=IO.COMPRESSED_RGB_S3TC_DXT1_EXT?t.compressedTexImage2D(t.TEXTURE_2D,n,o,i,r,0,e.pixels):t.texImage2D(t.TEXTURE_2D,n,o,i,r,0,o,a,e.pixels)},generateMipmap:function(t){var e=t.gl;this.useMipmap&&!this.NPOT&&(e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),e.generateMipmap(e.TEXTURE_2D))},isPowerOfTwo:function(){return RO(this.width)&&RO(this.height)},isRenderable:function(){return this.image?this.image.width>0&&this.image.height>0:!(!this.width||!this.height)},bind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,this.getWebGLTexture(t))},unbind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},load:function(t,e){var n=$I.createImage();e&&(n.crossOrigin=e);var i=this;return n.onload=function(){i.dirty(),i.trigger("success",i)},n.onerror=function(){i.trigger("error",i)},n.src=t,this.image=n,this}});Object.defineProperty(zO.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(t){this.image?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}}),Object.defineProperty(zO.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(t){this.image?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});const BO=zO;function FO(t){return{byte:$I.Int8Array,ubyte:$I.Uint8Array,short:$I.Int16Array,ushort:$I.Uint16Array}[t]||$I.Float32Array}function HO(t){return"attr_"+t}function VO(t,e,n,i){switch(this.name=t,this.type=e,this.size=n,this.semantic=i||"",this.value=null,n){case 1:this.get=function(t){return this.value[t]},this.set=function(t,e){this.value[t]=e},this.copy=function(t,e){this.value[t]=this.value[t]};break;case 2:this.get=function(t,e){var n=this.value;return e[0]=n[2*t],e[1]=n[2*t+1],e},this.set=function(t,e){var n=this.value;n[2*t]=e[0],n[2*t+1]=e[1]},this.copy=function(t,e){var n=this.value;e*=2,n[t*=2]=n[e],n[t+1]=n[e+1]};break;case 3:this.get=function(t,e){var n=3*t,i=this.value;return e[0]=i[n],e[1]=i[n+1],e[2]=i[n+2],e},this.set=function(t,e){var n=3*t,i=this.value;i[n]=e[0],i[n+1]=e[1],i[n+2]=e[2]},this.copy=function(t,e){var n=this.value;e*=3,n[t*=3]=n[e],n[t+1]=n[e+1],n[t+2]=n[e+2]};break;case 4:this.get=function(t,e){var n=this.value,i=4*t;return e[0]=n[i],e[1]=n[i+1],e[2]=n[i+2],e[3]=n[i+3],e},this.set=function(t,e){var n=this.value,i=4*t;n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2],n[i+3]=e[3]},this.copy=function(t,e){var n=this.value;e*=4,n[t*=4]=n[e],n[t+1]=n[e+1],n[t+2]=n[e+2],n[t+3]=n[e+3]}}}function GO(t,e,n,i,r){this.name=t,this.type=e,this.buffer=n,this.size=i,this.semantic=r,this.symbol="",this.needsRemove=!1}function UO(t){this.buffer=t,this.count=0}VO.prototype.init=function(t){if(!this.value||this.value.length!==t*this.size){var e=FO(this.type);this.value=new e(t*this.size)}},VO.prototype.fromArray=function(t){var e,n=FO(this.type);if(t[0]&&t[0].length){var i=0,r=this.size;e=new n(t.length*r);for(var o=0;o=0){e||(e=[]);var n=this.indices;return e[0]=n[3*t],e[1]=n[3*t+1],e[2]=n[3*t+2],e}},setTriangleIndices:function(t,e){var n=this.indices;n[3*t]=e[0],n[3*t+1]=e[1],n[3*t+2]=e[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(t){var e,n=this.vertexCount>65535?$I.Uint32Array:$I.Uint16Array;if(t[0]&&t[0].length){var i=0;e=new n(3*t.length);for(var r=0;r=0&&(e.splice(n,1),delete this.attributes[t],!0)},getAttribute:function(t){return this.attributes[t]},getEnabledAttributes:function(){var t=this._enabledAttributes,e=this._attributeList;if(t)return t;for(var n=[],i=this.vertexCount,r=0;ro[0]&&(o[0]=s),l>o[1]&&(o[1]=l),u>o[2]&&(o[2]=u)}n._dirty=!0,i._dirty=!0}},generateVertexNormals:function(){if(this.vertexCount){var t=this.indices,e=this.attributes,n=e.position.value,i=e.normal.value;if(i&&i.length===n.length)for(var r=0;r65535&&(this.indices=new $I.Uint32Array(this.indices));for(var t=this.attributes,e=this.indices,n=this.getEnabledAttributes(),i={},r=0;rthis.distance,r=1;r<8;r++)if(uE.dot(e[r].array,n)>this.distance!=i)return!0},intersectLine:(uN=uE.create(),function(t,e,n){var i=this.distanceToPoint(t),r=this.distanceToPoint(e);if(i>0&&r>0||i<0&&r<0)return null;var o=this.normal.array,a=this.distance,s=t.array;uE.sub(uN,e.array,t.array),uE.normalize(uN,uN);var l=uE.dot(o,uN);if(0===l)return null;n||(n=new IE);var u=(uE.dot(o,s)-a)/l;return uE.scaleAndAdd(n.array,s,uN,-u),n._dirty=!0,n}),applyTransform:(aN=sE.create(),sN=HE.create(),lN=HE.create(),lN[3]=1,function(t){t=t.array,uE.scale(lN,this.normal.array,this.distance),HE.transformMat4(lN,lN,t),this.distance=uE.dot(lN,this.normal.array),sE.invert(aN,t),sE.transpose(aN,aN),sN[3]=0,uE.copy(sN,this.normal.array),HE.transformMat4(sN,sN,aN),uE.copy(this.normal.array,sN)}),copy:function(t){uE.copy(this.normal.array,t.normal.array),this.normal._dirty=!0,this.distance=t.distance},clone:function(){var t=new hN;return t.copy(this),t}};const cN=hN;var dN,fN=uE.set,pN=uE.copy,gN=uE.transformMat4,mN=Math.min,vN=Math.max,_N=function(){this.planes=[];for(var t=0;t<6;t++)this.planes.push(new cN);this.boundingBox=new mO,this.vertices=[];for(t=0;t<8;t++)this.vertices[t]=uE.fromValues(0,0,0)};_N.prototype={setFromProjection:function(t){var e=this.planes,n=t.array,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],l=n[5],u=n[6],h=n[7],c=n[8],d=n[9],f=n[10],p=n[11],g=n[12],m=n[13],v=n[14],_=n[15];fN(e[0].normal.array,a-i,h-s,p-c),e[0].distance=-(_-g),e[0].normalize(),fN(e[1].normal.array,a+i,h+s,p+c),e[1].distance=-(_+g),e[1].normalize(),fN(e[2].normal.array,a+r,h+l,p+d),e[2].distance=-(_+m),e[2].normalize(),fN(e[3].normal.array,a-r,h-l,p-d),e[3].distance=-(_-m),e[3].normalize(),fN(e[4].normal.array,a-o,h-u,p-f),e[4].distance=-(_-v),e[4].normalize(),fN(e[5].normal.array,a+o,h+u,p+f),e[5].distance=-(_+v),e[5].normalize();var y=this.boundingBox,x=this.vertices;if(0===_){var b=l/i,w=-v/(f-1),S=-v/(f+1),T=-S/l,M=-w/l;y.min.set(-T*b,-T,S),y.max.set(T*b,T,w),fN(x[0],-T*b,-T,S),fN(x[1],-T*b,T,S),fN(x[2],T*b,-T,S),fN(x[3],T*b,T,S),fN(x[4],-M*b,-M,w),fN(x[5],-M*b,M,w),fN(x[6],M*b,-M,w),fN(x[7],M*b,M,w)}else{var C=(-1-g)/i,A=(1-g)/i,L=(1-m)/l,D=(-1-m)/l,I=(-1-v)/f,P=(1-v)/f;y.min.set(Math.min(C,A),Math.min(D,L),Math.min(P,I)),y.max.set(Math.max(A,C),Math.max(L,D),Math.max(I,P));var E=y.min.array,O=y.max.array;fN(x[0],E[0],E[1],E[2]),fN(x[1],E[0],O[1],E[2]),fN(x[2],O[0],E[1],E[2]),fN(x[3],O[0],O[1],E[2]),fN(x[4],E[0],E[1],O[2]),fN(x[5],E[0],O[1],O[2]),fN(x[6],O[0],E[1],O[2]),fN(x[7],O[0],O[1],O[2])}},getTransformedBoundingBox:(dN=uE.create(),function(t,e){var n=this.vertices,i=e.array,r=t.min,o=t.max,a=r.array,s=o.array,l=n[0];gN(dN,l,i),pN(a,dN),pN(s,dN);for(var u=1;u<8;u++)l=n[u],gN(dN,l,i),a[0]=mN(dN[0],a[0]),a[1]=mN(dN[1],a[1]),a[2]=mN(dN[2],a[2]),s[0]=vN(dN[0],s[0]),s[1]=vN(dN[1],s[1]),s[2]=vN(dN[2],s[2]);return r._dirty=!0,o._dirty=!0,t})};const yN=_N;var xN,bN=xO.extend((function(){return{projectionMatrix:new nO,invProjectionMatrix:new nO,viewMatrix:new nO,frustum:new yN}}),(function(){this.update(!0)}),{update:function(t){xO.prototype.update.call(this,t),nO.invert(this.viewMatrix,this.worldTransform),this.updateProjectionMatrix(),nO.invert(this.invProjectionMatrix,this.projectionMatrix),this.frustum.setFromProjection(this.projectionMatrix)},setViewMatrix:function(t){nO.copy(this.viewMatrix,t),nO.invert(this.worldTransform,t),this.decomposeWorldTransform()},decomposeProjectionMatrix:function(){},setProjectionMatrix:function(t){nO.copy(this.projectionMatrix,t),nO.invert(this.invProjectionMatrix,t),this.decomposeProjectionMatrix()},updateProjectionMatrix:function(){},castRay:(xN=HE.create(),function(t,e){var n=void 0!==e?e:new BE,i=t.array[0],r=t.array[1];return HE.set(xN,i,r,-1,1),HE.transformMat4(xN,xN,this.invProjectionMatrix.array),HE.transformMat4(xN,xN,this.worldTransform.array),uE.scale(n.origin.array,xN,1/xN[3]),HE.set(xN,i,r,1,1),HE.transformMat4(xN,xN,this.invProjectionMatrix.array),HE.transformMat4(xN,xN,this.worldTransform.array),uE.scale(xN,xN,1/xN[3]),uE.sub(n.direction.array,xN,n.origin.array),uE.normalize(n.direction.array,n.direction.array),n.direction._dirty=!0,n.origin._dirty=!0,n})});const wN=bN;var SN=sE.create(),TN=sE.create(),MN={};function CN(t){var e=[],n=Object.keys(t);n.sort();for(var i=0;i0&&console.warn("Found multiple camera in one scene. Use the fist one."),this._cameraList.push(t)):t instanceof oN&&this.lights.push(t),t.name&&(this._nodeRepository[t.name]=t)},removeFromScene:function(t){var e;t instanceof wN?(e=this._cameraList.indexOf(t))>=0&&this._cameraList.splice(e,1):t instanceof oN&&(e=this.lights.indexOf(t))>=0&&this.lights.splice(e,1),t.name&&delete this._nodeRepository[t.name]},getNode:function(t){return this._nodeRepository[t]},setMainCamera:function(t){var e=this._cameraList.indexOf(t);e>=0&&this._cameraList.splice(e,1),this._cameraList.unshift(t)},getMainCamera:function(){return this._cameraList[0]},getLights:function(){return this.lights},updateLights:function(){var t=this.lights;this._previousLightNumber=this._lightNumber;for(var e={},n=0;n0&&this._doUpdateRenderList(a,e,n,i,r)}},isFrustumCulled:(LN=new mO,DN=new nO,function(t,e,n){var i=t.boundingBox;if(i||(i=t.skeleton&&t.skeleton.boundingBox?t.skeleton.boundingBox:t.geometry.boundingBox),!i)return!1;if(DN.array=n,LN.transformFrom(i,DN),t.castShadow&&this.viewBoundingBoxLastFrame.union(LN),t.frustumCulling){if(!LN.intersectBoundingBox(e.frustum.boundingBox))return!0;DN.array=e.projectionMatrix.array,LN.max.array[2]>0&&LN.min.array[2]<0&&(LN.max.array[2]=-1e-20),LN.applyProjection(DN);var r=LN.min.array,o=LN.max.array;if(o[0]<-1||r[0]>1||o[1]<-1||r[1]>1||o[2]<-1||r[2]>1)return!0}return!1}),_updateLightUniforms:function(){var t=this.lights;t.sort(PN);var e=this._lightUniforms;for(var n in e)for(var i in e[n])e[n][i].value.length=0;for(var r=0;r1&&e.texParameterf(e.TEXTURE_CUBE_MAP,r.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i)&&(t.getGLExtension("OES_texture_half_float")||(i=SI));if(this.mipmaps.length)for(var o=this.width,a=this.height,s=0;s0&&t.height>0}Object.defineProperty(RN.prototype,"width",{get:function(){return this.image&&this.image.px?this.image.px.width:this._width},set:function(t){this.image&&this.image.px?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}}),Object.defineProperty(RN.prototype,"height",{get:function(){return this.image&&this.image.px?this.image.px.height:this._height},set:function(t){this.image&&this.image.px?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});const zN=RN;var BN=wN.extend({fov:50,aspect:1,near:.1,far:2e3},{updateProjectionMatrix:function(){var t=this.fov/180*Math.PI;this.projectionMatrix.perspective(t,this.aspect,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array,e=2*Math.atan(1/t[5]);this.fov=e/Math.PI*180,this.aspect=t[5]/t[0],this.near=t[14]/(t[10]-1),this.far=t[14]/(t[10]+1)},clone:function(){var t=wN.prototype.clone.call(this);return t.fov=this.fov,t.aspect=this.aspect,t.near=this.near,t.far=this.far,t}});const FN=BN;var HN="framebuffer",VN="renderbuffer",GN=VN+"_width",UN=VN+"_height",WN=VN+"_attached",jN="depthtexture_attached",ZN=VI,XN=GI,qN=jI,YN=WI,KN=YD.extend({depthBuffer:!0,viewport:null,_width:0,_height:0,_textures:null,_boundRenderer:null},(function(){this._cache=new LO,this._textures={}}),{getTextureWidth:function(){return this._width},getTextureHeight:function(){return this._height},bind:function(t){if(t.__currentFrameBuffer){if(t.__currentFrameBuffer===this)return;console.warn("Renderer already bound with another framebuffer. Unbind it first")}t.__currentFrameBuffer=this;var e=t.gl;e.bindFramebuffer(ZN,this._getFrameBufferGL(t)),this._boundRenderer=t;var n=this._cache;n.put("viewport",t.viewport);var i,r,o=!1;for(var a in this._textures){o=!0;var s=this._textures[a];s&&(i=s.texture.width,r=s.texture.height,this._doAttach(t,s.texture,a,s.target))}this._width=i,this._height=r,!o&&this.depthBuffer&&console.error("Must attach texture before bind, or renderbuffer may have incorrect width and height."),this.viewport?t.setViewport(this.viewport):t.setViewport(0,0,i,r,1);var l=n.get("attached_textures");if(l)for(var a in l)if(!this._textures[a]){var u=l[a];this._doDetach(e,a,u)}if(!n.get(jN)&&this.depthBuffer){n.miss(VN)&&n.put(VN,e.createRenderbuffer());var h=n.get(VN);i===n.get(GN)&&r===n.get(UN)||(e.bindRenderbuffer(XN,h),e.renderbufferStorage(XN,e.DEPTH_COMPONENT16,i,r),n.put(GN,i),n.put(UN,r),e.bindRenderbuffer(XN,null)),n.get(WN)||(e.framebufferRenderbuffer(ZN,qN,XN,h),n.put(WN,!0))}},unbind:function(t){t.__currentFrameBuffer=null,t.gl.bindFramebuffer(ZN,null),this._boundRenderer=null,this._cache.use(t.__uid__);var e=this._cache.get("viewport");e&&t.setViewport(e),this.updateMipmap(t)},updateMipmap:function(t){var e=t.gl;for(var n in this._textures){var i=this._textures[n];if(i){var r=i.texture;if(!r.NPOT&&r.useMipmap&&r.minFilter===IO.LINEAR_MIPMAP_LINEAR){var o="textureCube"===r.textureType?zI:kI;e.bindTexture(o,r.getWebGLTexture(t)),e.generateMipmap(o),e.bindTexture(o,null)}}}},checkStatus:function(t){return t.checkFramebufferStatus(ZN)},_getFrameBufferGL:function(t){var e=this._cache;return e.use(t.__uid__),e.miss(HN)&&e.put(HN,t.gl.createFramebuffer()),e.get(HN)},attach:function(t,e,n){if(!t.width)throw new Error("The texture attached to color buffer is not a valid.");e=e||YN,n=n||kI;var i,r=this._boundRenderer;if(r&&r.gl){var o=this._cache;o.use(r.__uid__),i=o.get("attached_textures")}var a=this._textures[e];if(!a||a.target!==n||a.texture!==t||!i||null==i[e]){var s=!0;r&&(s=this._doAttach(r,t,e,n),this.viewport||r.setViewport(0,0,t.width,t.height,1)),s&&(this._textures[e]=this._textures[e]||{},this._textures[e].texture=t,this._textures[e].target=n)}},_doAttach:function(t,e,n,i){var r=t.gl,o=e.getWebGLTexture(t),a=this._cache.get("attached_textures");if(a&&a[n]){var s=a[n];if(s.texture===e&&s.target===i)return}var l=!0;if(((n=+n)===qN||n===XI)&&(t.getGLExtension("WEBGL_depth_texture")||(console.error("Depth texture is not supported by the browser"),l=!1),e.format!==TI&&e.format!==UI&&(console.error("The texture attached to depth buffer is not a valid."),l=!1),l)){var u=this._cache.get(VN);u&&(r.framebufferRenderbuffer(ZN,qN,XN,null),r.deleteRenderbuffer(u),this._cache.put(VN,!1)),this._cache.put(WN,!1),this._cache.put(jN,!0)}return r.framebufferTexture2D(ZN,n,i,o,0),a||(a={},this._cache.put("attached_textures",a)),a[n]=a[n]||{},a[n].texture=e,a[n].target=i,l},_doDetach:function(t,e,n){t.framebufferTexture2D(ZN,e,n,null,0);var i=this._cache.get("attached_textures");i&&i[e]&&(i[e]=null),e!==qN&&e!==XI||this._cache.put(jN,!1)},detach:function(t,e){(this._textures[t]=null,this._boundRenderer)&&(this._cache.use(this._boundRenderer.__uid__),this._doDetach(this._boundRenderer.gl,t,e))},dispose:function(t){var e=t.gl,n=this._cache;n.use(t.__uid__);var i=n.get(VN);i&&e.deleteRenderbuffer(i);var r=n.get(HN);r&&e.deleteFramebuffer(r),n.deleteContext(t.__uid__),this._textures={}}});KN.DEPTH_ATTACHMENT=qN,KN.COLOR_ATTACHMENT0=YN,KN.STENCIL_ATTACHMENT=ZI,KN.DEPTH_STENCIL_ATTACHMENT=XI;const JN=KN;var $N=["px","nx","py","ny","pz","nz"],QN=YD.extend((function(){var t={position:new IE,far:1e3,near:.1,texture:null,shadowMapPass:null},e=t._cameras={px:new FN({fov:90}),nx:new FN({fov:90}),py:new FN({fov:90}),ny:new FN({fov:90}),pz:new FN({fov:90}),nz:new FN({fov:90})};return e.px.lookAt(IE.POSITIVE_X,IE.NEGATIVE_Y),e.nx.lookAt(IE.NEGATIVE_X,IE.NEGATIVE_Y),e.py.lookAt(IE.POSITIVE_Y,IE.POSITIVE_Z),e.ny.lookAt(IE.NEGATIVE_Y,IE.NEGATIVE_Z),e.pz.lookAt(IE.POSITIVE_Z,IE.NEGATIVE_Y),e.nz.lookAt(IE.NEGATIVE_Z,IE.NEGATIVE_Y),t._frameBuffer=new JN,t}),{getCamera:function(t){return this._cameras[t]},render:function(t,e,n){var i=t.gl;n||e.update();for(var r=this.texture.width,o=2*Math.atan(r/(r-.5))/Math.PI*180,a=0;a<6;a++){var s=$N[a],l=this._cameras[s];if(IE.copy(l.position,this.position),l.far=this.far,l.near=this.near,l.fov=o,this.shadowMapPass){l.update();var u=e.getBoundingBox();u.applyTransform(l.viewMatrix),e.viewBoundingBoxLastFrame.copy(u),this.shadowMapPass.render(t,e,l,!0)}this._frameBuffer.attach(this.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+a),this._frameBuffer.bind(t),t.render(e,l,!0),this._frameBuffer.unbind(t)}},dispose:function(t){this._frameBuffer.dispose(t)}});const tR=QN;var eR=JO.extend({dynamic:!1,widthSegments:1,heightSegments:1},(function(){this.build()}),{build:function(){for(var t=this.heightSegments,e=this.widthSegments,n=this.attributes,i=[],r=[],o=[],a=[],s=0;s<=t;s++)for(var l=s/t,u=0;u<=e;u++){var h=u/e;if(i.push([2*h-1,2*l-1,0]),r&&r.push([h,l]),o&&o.push([0,0,1]),u0?this.material.define("fragment","LOD"):this.material.undefine("fragment","LOD"),t.renderPass([this],n)}});const lR=sR,uR=lR;function hR(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}var cR=hR("DXT1"),dR=hR("DXT3"),fR=hR("DXT5"),pR={parse:function(t,e){var n=new Int32Array(t,0,31);if(542327876!==n[0])return null;if(4&!n(20))return null;var i,r,o=n(21),a=n[4],s=n[3],l=512&n[28],u=131072&n[2];switch(o){case cR:i=8,r=IO.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case dR:i=16,r=IO.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case fR:i=16,r=IO.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}var h=n[1]+4,c=l?6:1,d=1;u&&(d=Math.max(1,n[7]));for(var f=[],p=0;p0){var r=Math.pow(2,t[3]-128-8+i);e[n+0]=t[0]*r,e[n+1]=t[1]*r,e[n+2]=t[2]*r}else e[n+0]=0,e[n+1]=0,e[n+2]=0;return e[n+3]=1,e}function _R(t,e,n,i){for(var r,o,a=0,s=0,l=i;l>0;)if(t[s][0]=e[n++],t[s][1]=e[n++],t[s][2]=e[n++],t[s][3]=e[n++],1===t[s][0]&&1===t[s][1]&&1===t[s][2]){for(var u=t[s][3]<>>0;u>0;u--)r=t[s-1],(o=t[s])[0]=r[0],o[1]=r[1],o[2]=r[2],o[3]=r[3],s++,l--;a+=8}else s++,l--,a=0;return n}function yR(t,e,n,i){if(i<8|i>32767)return _R(t,e,n,i);if(2!=(r=e[n++]))return _R(t,e,n-1,i);if(t[0][1]=e[n++],t[0][2]=e[n++],r=e[n++],(t[0][2]<<8>>>0|r)>>>0!==i)return null;for(var r=0;r<4;r++)for(var o=0;o128){a=(127&a)>>>0;for(var s=e[n++];a--;)t[o++][r]=s}else for(;a--;)t[o++][r]=e[n++]}return n}var xR={parseRGBE:function(t,e,n){null==n&&(n=0);var i=new Uint8Array(t),r=i.length;if("#?"===function(t,e,n){for(var i="",r=e;r=r)){o+=2;for(var a="";o20)return console.warn("Given image is not a height map"),t}var d,f,p,g;l%(4*i)==0?(d=a.data[l],p=a.data[l+4]):l%(4*i)==4*(i-1)?(d=a.data[l-4],p=a.data[l]):(d=a.data[l-4],p=a.data[l+4]),l<4*i?(f=a.data[l],g=a.data[l+4*i]):l>i*(r-1)*4?(f=a.data[l-4*i],g=a.data[l]):(f=a.data[l-4*i],g=a.data[l+4*i]),s.data[l]=d-p+127,s.data[l+1]=f-g+127,s.data[l+2]=255,s.data[l+3]=255}return o.putImageData(s,0,0),n},isHeightImage:function(t,e,n){if(!t||!t.width||!t.height)return!1;var i=document.createElement("canvas"),r=i.getContext("2d"),o=e||32;n=n||20,i.width=i.height=o,r.drawImage(t,0,0,o,o);for(var a=r.getImageData(0,0,o,o),s=0;sn)return!1}return!0},_fetchTexture:function(t,e,n){$I.request.get({url:t,responseType:"arraybuffer",onload:e,onerror:n})},createChessboard:function(t,e,n,i){t=t||512,e=e||64,n=n||"black",i=i||"white";var r=Math.ceil(t/e),o=document.createElement("canvas");o.width=t,o.height=t;var a=o.getContext("2d");a.fillStyle=i,a.fillRect(0,0,t,t),a.fillStyle=n;for(var s=0;s=0||(TR.forEach((function(e){t.on(e,this[MR(e)],this)}),this),this._meshes.push(t))},detachFromMesh:function(t){var e=this._meshes.indexOf(t);e>=0&&this._meshes.splice(e,1),TR.forEach((function(e){t.off(e,this[MR(e)])}),this)},dispose:function(){this._meshes.forEach((function(t){this.detachFromMesh(t)}),this)}};const AR=CR;var LR=wN.extend({left:-1,right:1,near:-1,far:1,top:1,bottom:-1},{updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array;this.left=(-1-t[12])/t[0],this.right=(1-t[12])/t[0],this.top=(1-t[13])/t[5],this.bottom=(-1-t[13])/t[5],this.near=-(-1-t[14])/t[10],this.far=-(1-t[14])/t[10]},clone:function(){var t=wN.prototype.clone.call(this);return t.left=this.left,t.right=this.right,t.near=this.near,t.far=this.far,t.top=this.top,t.bottom=this.bottom,t}});const DR=LR;rE.import("\n@export clay.compositor.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end");var IR=new nR,PR=new EO({geometry:IR,frustumCulling:!1}),ER=new DR;const OR=YD.extend((function(){return{fragment:"",outputs:null,material:null,blendWithPrevious:!1,clearColor:!1,clearDepth:!0}}),(function(){var t=new rE(rE.source("clay.compositor.vertex"),this.fragment),e=new xP({shader:t});e.enableTexturesAll(),this.material=e}),{setUniform:function(t,e){this.material.setUniform(t,e)},getUniform:function(t){var e=this.material.uniforms[t];if(e)return e.value},attachOutput:function(t,e){this.outputs||(this.outputs={}),e=e||WI,this.outputs[e]=t},detachOutput:function(t){for(var e in this.outputs)this.outputs[e]===t&&(this.outputs[e]=null)},bind:function(t,e){if(this.outputs)for(var n in this.outputs){var i=this.outputs[n];i&&e.attach(i,n)}e&&e.bind(t)},unbind:function(t,e){e.unbind(t)},render:function(t,e){var n=t.gl;if(e){this.bind(t,e);var i=t.getGLExtension("EXT_draw_buffers");if(i&&this.outputs){var r=[];for(var o in this.outputs)(o=+o)>=n.COLOR_ATTACHMENT0&&o<=n.COLOR_ATTACHMENT0+8&&r.push(o);i.drawBuffersEXT(r)}}this.trigger("beforerender",this,t);var a=this.clearDepth?n.DEPTH_BUFFER_BIT:0;if(n.depthMask(!0),this.clearColor){a|=n.COLOR_BUFFER_BIT,n.colorMask(!0,!0,!0,!0);var s=this.clearColor;Array.isArray(s)&&n.clearColor(s[0],s[1],s[2],s[3])}n.clear(a),this.blendWithPrevious?(n.enable(n.BLEND),this.material.transparent=!0):(n.disable(n.BLEND),this.material.transparent=!1),this.renderQuad(t),this.trigger("afterrender",this,t),e&&this.unbind(t,e)},renderQuad:function(t){PR.material=this.material,t.renderPass([PR],ER)},dispose:function(t){}});var NR={},RR=["px","nx","py","ny","pz","nz"];NR.prefilterEnvironmentMap=function(t,e,n,i,r){r&&i||(i=NR.generateNormalDistribution(),r=NR.integrateBRDF(t,i));var o=(n=n||{}).width||64,a=n.height||64,s=n.type||e.type,l=new zN({width:o,height:a,type:s,flipY:!1,mipmaps:[]});l.isPowerOfTwo()||console.warn("Width and height must be power of two to enable mipmap.");var u=Math.min(o,a),h=Math.log(u)/Math.log(2)+1,c=new xP({shader:new rE({vertex:rE.source("clay.skybox.vertex"),fragment:"#define SHADER_NAME prefilter\n#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\nuniform float roughness : 0.5;\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvoid main() {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n vec3 N = V;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n"})});c.set("normalDistribution",i),n.encodeRGBM&&c.define("fragment","RGBM_ENCODE"),n.decodeRGBM&&c.define("fragment","RGBM_DECODE");var d,f=new EN;if("texture2D"===e.textureType){var p=new zN({width:o,height:a,type:s===IO.FLOAT?IO.HALF_FLOAT:s});SR.panoramaToCubeMap(t,e,p,{encodeRGBM:n.decodeRGBM}),e=p}(d=new lR({scene:f,material:c})).material.set("environmentMap",e);var g=new tR({texture:l});n.encodeRGBM&&(s=l.type=IO.UNSIGNED_BYTE);for(var m=new BO({width:o,height:a,type:s}),v=new JN({depthBuffer:!1}),_=$I[s===IO.UNSIGNED_BYTE?"Uint8Array":"Float32Array"],y=0;y 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nfloat G_Smith(float roughness, float NoV, float NoL) {\n float k = roughness * roughness / 2.0;\n float G1V = NoV / (NoV * (1.0 - k) + k);\n float G1L = NoL / (NoL * (1.0 - k) + k);\n return G1L * G1V;\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / viewportSize;\n float NoV = uv.x;\n float roughness = uv.y;\n vec3 V;\n V.x = sqrt(1.0 - NoV * NoV);\n V.y = 0.0;\n V.z = NoV;\n float A = 0.0;\n float B = 0.0;\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(L.z, 0.0, 1.0);\n float NoH = clamp(H.z, 0.0, 1.0);\n float VoH = clamp(dot(V, H), 0.0, 1.0);\n if (NoL > 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n"}),r=new BO({width:512,height:256,type:IO.HALF_FLOAT,wrapS:IO.CLAMP_TO_EDGE,wrapT:IO.CLAMP_TO_EDGE,minFilter:IO.NEAREST,magFilter:IO.NEAREST,useMipmap:!1});return i.setUniform("normalDistribution",e),i.setUniform("viewportSize",[512,256]),i.attachOutput(r),i.render(t,n),n.dispose(t),r},NR.generateNormalDistribution=function(t,e){for(var n=new BO({width:t=t||256,height:e=e||1024,type:IO.FLOAT,minFilter:IO.NEAREST,magFilter:IO.NEAREST,wrapS:IO.CLAMP_TO_EDGE,wrapT:IO.CLAMP_TO_EDGE,useMipmap:!1}),i=new Float32Array(e*t*4),r=[],o=0;o>>16)>>>0;u=(((16711935&(u=((252645135&(u=((858993459&(u=((1431655765&u)<<1|(2863311530&u)>>>1)>>>0))<<2|(3435973836&u)>>>2)>>>0))<<4|(4042322160&u)>>>4)>>>0))<<8|(4278255360&u)>>>8)>>>0)/4294967296;var h=Math.sqrt((1-u)/(1+(s*s-1)*u));r[l]=h}for(l=0;l65535?Uint32Array:Uint16Array,_=this.indices=new v(e*t*6),y=this.radius,x=this.phiStart,b=this.phiLength,w=this.thetaStart,S=this.thetaLength,T=[],M=[],C=0,A=1/(y=this.radius);for(d=0;d<=t;d++)for(c=0;c<=e;c++)u=c/e,h=d/t,a=-y*Math.cos(x+u*b)*Math.sin(w+h*S),s=y*Math.cos(w+h*S),l=y*Math.sin(x+u*b)*Math.sin(w+h*S),T[0]=a,T[1]=s,T[2]=l,M[0]=u,M[1]=h,n.set(C,T),i.set(C,M),T[0]*=A,T[1]*=A,T[2]*=A,r.set(C,T),C++;var L=e+1,D=0;for(d=0;d=0&&s.splice(t,1)})),s.push(l),this.__zr&&this.__zr.animation.addAnimator(l),l},stopAnimation:function(t){this._animators=this._animators||[];for(var e=this._animators,n=e.length,i=0;i 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n@export clay.chunk.instancing_header\n#ifdef INSTANCING\nattribute vec4 instanceMat1;\nattribute vec4 instanceMat2;\nattribute vec4 instanceMat3;\n#endif\n@end\n@export clay.chunk.instancing_matrix\nmat4 instanceMat = mat4(\n vec4(instanceMat1.xyz, 0.0),\n vec4(instanceMat2.xyz, 0.0),\n vec4(instanceMat3.xyz, 0.0),\n vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0)\n);\n@end\n@export clay.util.parallax_correct\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n return normalize(fixedPos - boxCenter);\n}\n@end\n@export clay.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end\n@export clay.util.ACES\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n@end";function bk(t){return t instanceof HTMLCanvasElement||t instanceof HTMLImageElement||t instanceof Image}Object.assign(xO.prototype,yk),rE.import(xk),rE.import(oE),rE.import("\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n"),rE.import("@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\nattribute vec3 normal: NORMAL;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nvarying vec3 v_Normal;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\nvarying vec3 v_Normal;\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end"),rE.import("/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),rE.import("@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import clay.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import clay.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),rE.import("@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n"),rE.import("@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n v_Texcoord = texcoord;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import clay.sm.depth.fragment\n\n@end");var wk=EN.prototype.addToScene,Sk=EN.prototype.removeFromScene;EN.prototype.addToScene=function(t){if(wk.call(this,t),this.__zr){var e=this.__zr;t.traverse((function(t){t.__zr=e,t.addAnimatorsToZr&&t.addAnimatorsToZr(e)}))}},EN.prototype.removeFromScene=function(t){Sk.call(this,t),t.traverse((function(t){var e=t.__zr;t.__zr=null,e&&t.removeAnimatorsFromZr&&t.removeAnimatorsFromZr(e)}))},xP.prototype.setTextureImage=function(t,e,n,i){if(this.shader){var r,o,a=n.getZr(),s=this;return s.autoUpdateTextureStatus=!1,s.disableTexture(t),(o=e)&&"none"!==o&&(r=Tk.loadTexture(e,n,i,(function(e){s.enableTexture(t),a&&a.refresh()})),s.set(t,r)),r}};var Tk={};Tk.Renderer=wE,Tk.Node=xO,Tk.Mesh=EO,Tk.Shader=rE,Tk.Material=xP,Tk.Texture=IO,Tk.Texture2D=BO,Tk.Geometry=JO,Tk.SphereGeometry=YR,Tk.PlaneGeometry=nR,Tk.CubeGeometry=aR,Tk.AmbientLight=JR,Tk.DirectionalLight=QR,Tk.PointLight=ek,Tk.SpotLight=ik,Tk.PerspectiveCamera=FN,Tk.OrthographicCamera=DR,Tk.Vector2=DP,Tk.Vector3=IE,Tk.Vector4=sk,Tk.Quaternion=aO,Tk.Matrix2=ck,Tk.Matrix2d=gk,Tk.Matrix3=vk,Tk.Matrix4=nO,Tk.Plane=cN,Tk.Ray=BE,Tk.BoundingBox=mO,Tk.Frustum=yN;var Mk=null;function Ck(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function Ak(t){if((t.wrapS===IO.REPEAT||t.wrapT===IO.REPEAT)&&t.image){var e=Ck(t.width),n=Ck(t.height);if(e!==t.width||n!==t.height){var i=document.createElement("canvas");i.width=e,i.height=n,i.getContext("2d").drawImage(t.image,0,0,e,n),t.image=i}}}Tk.loadTexture=function(t,e,n,i){"function"==typeof n&&(i=n,n={}),n=n||{};for(var r=Object.keys(n).sort(),o="",a=0;a3?e[3]=t[3]:e[3]=1,e):((e=tn.parse(t||"#000",e)||[0,0,0,0])[0]/=255,e[1]/=255,e[2]/=255,e)},Tk.directionFromAlphaBeta=function(t,e){var n=t/180*Math.PI+Math.PI/2,i=-e/180*Math.PI+Math.PI/2,r=[],o=Math.sin(n);return r[0]=o*Math.cos(i),r[1]=-Math.cos(n),r[2]=o*Math.sin(i),r},Tk.getShadowResolution=function(t){var e=1024;switch(t){case"low":e=512;break;case"medium":break;case"high":e=2048;break;case"ultra":e=4096}return e},Tk.COMMON_SHADERS=["lambert","color","realistic","hatching","shadow"],Tk.createShader=function(t){"ecgl.shadow"===t&&(t="ecgl.displayShadow");var e=rE.source(t+".vertex"),n=rE.source(t+".fragment");e||console.error("Vertex shader of '%s' not exits",t),n||console.error("Fragment shader of '%s' not exits",t);var i=new rE(e,n);return i.name=t,i},Tk.createMaterial=function(t,e){e instanceof Array||(e=[e]);var n=Tk.createShader(t),i=new xP({shader:n});return e.forEach((function(t){"string"==typeof t&&i.define(t)})),i},Tk.setMaterialFromModel=function(t,e,n,i){e.autoUpdateTextureStatus=!1;var r=n.getModel(t+"Material"),o=r.get("detailTexture"),a=XR.firstNotNull(r.get("textureTiling"),1),s=XR.firstNotNull(r.get("textureOffset"),0);"number"==typeof a&&(a=[a,a]),"number"==typeof s&&(s=[s,s]);var l=a[0]>1||a[1]>1?Tk.Texture.REPEAT:Tk.Texture.CLAMP_TO_EDGE,u={anisotropic:8,wrapS:l,wrapT:l};if("realistic"===t){var h=r.get("roughness"),c=r.get("metalness");null!=c?isNaN(c)&&(e.setTextureImage("metalnessMap",c,i,u),c=XR.firstNotNull(r.get("metalnessAdjust"),.5)):c=0,null!=h?isNaN(h)&&(e.setTextureImage("roughnessMap",h,i,u),h=XR.firstNotNull(r.get("roughnessAdjust"),.5)):h=.5;var d=r.get("normalTexture");e.setTextureImage("detailMap",o,i,u),e.setTextureImage("normalMap",d,i,u),e.set({roughness:h,metalness:c,detailUvRepeat:a,detailUvOffset:s})}else if("lambert"===t)e.setTextureImage("detailMap",o,i,u),e.set({detailUvRepeat:a,detailUvOffset:s});else if("color"===t)e.setTextureImage("detailMap",o,i,u),e.set({detailUvRepeat:a,detailUvOffset:s});else if("hatching"===t){var f=r.get("hatchingTextures")||[];f.length;for(var p=0;p<6;p++)e.setTextureImage("hatch"+(p+1),f[p],i,{anisotropic:8,wrapS:Tk.Texture.REPEAT,wrapT:Tk.Texture.REPEAT});e.set({detailUvRepeat:a,detailUvOffset:s})}},Tk.updateVertexAnimation=function(t,e,n,i){var r=i.get("animation"),o=i.get("animationDurationUpdate"),a=i.get("animationEasingUpdate"),s=n.shadowDepthMaterial;if(r&&e&&o>0&&e.geometry.vertexCount===n.geometry.vertexCount){n.material.define("vertex","VERTEX_ANIMATION"),n.ignorePreZ=!0,s&&s.define("vertex","VERTEX_ANIMATION");for(var l=0;l=0&&this._viewsToDispose.splice(e,1),this.views.push(t),t.layer=this;var n=this.zr;t.scene.traverse((function(t){t.__zr=n,t.addAnimatorsToZr&&t.addAnimatorsToZr(n)}))}},Dk.prototype.removeView=function(t){if(t.layer===this){var e=this.views.indexOf(t);e>=0&&(this.views.splice(e,1),t.scene.traverse(Ik,this),t.layer=null,this._viewsToDispose.push(t))}},Dk.prototype.removeViewsAll=function(){this.views.forEach((function(t){t.scene.traverse(Ik,this),t.layer=null,this._viewsToDispose.push(t)}),this),this.views.length=0},Dk.prototype.resize=function(t,e){this.renderer.resize(t,e)},Dk.prototype.clear=function(){var t=this.renderer.gl,e=this._backgroundColor||[0,0,0,0];t.clearColor(e[0],e[1],e[2],e[3]),t.depthMask(!0),t.colorMask(!0,!0,!0,!0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT)},Dk.prototype.clearDepth=function(){var t=this.renderer.gl;t.clear(t.DEPTH_BUFFER_BIT)},Dk.prototype.clearColor=function(){var t=this.renderer.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},Dk.prototype.needsRefresh=function(){this.zr.refresh()},Dk.prototype.refresh=function(t){this._backgroundColor=t?Lk.parseColor(t):[0,0,0,0],this.renderer.clearColor=this._backgroundColor;for(var e=0;e20)){t=t.event;var i=this.pickObject(t.offsetX,t.offsetY);i&&(this._dispatchEvent(t.type,t,i),this._dispatchDataEvent(t.type,t,i));var r=this._clickToSetFocusPoint(t);if(r)r.view.setDOFFocusOnPoint(r.distance)&&this.zr.refresh()}}},Dk.prototype._clickToSetFocusPoint=function(t){for(var e=this.renderer,n=e.viewport,i=this.views.length-1;i>=0;i--){var r=this.views[i];if(r.hasDOF()&&r.containPoint(t.offsetX,t.offsetY)){this._picking.scene=r.scene,this._picking.camera=r.camera,e.viewport=r.viewport;var o=this._picking.pick(t.offsetX,t.offsetY,!0);if(o)return o.view=r,o}}e.viewport=n},Dk.prototype.onglobalout=function(t){var e=this._hovered;e&&this._dispatchEvent("mouseout",t,{target:e.target})},Dk.prototype.pickObject=function(t,e){for(var n=[],i=this.renderer,r=i.viewport,o=0;o=0&&(h.dataIndex=this._lastDataIndex,h.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(u,"mouseout",e)),s=!0):null!=a&&a!==this._lastEventData&&(null!=this._lastEventData&&(h.eventData=this._lastEventData,this.zr.handler.dispatchToElement(u,"mouseout",e)),s=!0),this._lastEventData=a,this._lastDataIndex=r,this._lastSeriesIndex=o),h.eventData=a,h.dataIndex=r,h.seriesIndex=o,(null!=a||parseInt(r,10)>=0&&parseInt(o,10)>=0)&&(this.zr.handler.dispatchToElement(u,t,e),s&&this.zr.handler.dispatchToElement(u,"mouseover",e))},Dk.prototype._dispatchToView=function(t,e){for(var n=0;nt&&a=0&&(!function(t){Bk(t,"itemStyle"),Bk(t,"lineStyle"),Bk(t,"areaStyle"),Bk(t,"label")}(e),"mapbox"===e.coordinateSystem&&(e.coordinateSystem="mapbox3D",t.mapbox3D=t.mapbox))})),Fk(t.xAxis3D),Fk(t.yAxis3D),Fk(t.zAxis3D),Fk(t.grid3D),Bk(t.geo3D)}));const Vk={defaultOption:{viewControl:{projection:"perspective",autoRotate:!1,autoRotateDirection:"cw",autoRotateSpeed:10,autoRotateAfterStill:3,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",distance:150,minDistance:40,maxDistance:400,orthographicSize:150,maxOrthographicSize:400,minOrthographicSize:20,center:[0,0,0],alpha:0,beta:0,minAlpha:-90,maxAlpha:90}},setView:function(t){t=t||{},this.option.viewControl=this.option.viewControl||{},null!=t.alpha&&(this.option.viewControl.alpha=t.alpha),null!=t.beta&&(this.option.viewControl.beta=t.beta),null!=t.distance&&(this.option.viewControl.distance=t.distance),null!=t.center&&(this.option.viewControl.center=t.center)}},Gk={defaultOption:{postEffect:{enable:!1,bloom:{enable:!0,intensity:.1},depthOfField:{enable:!1,focalRange:20,focalDistance:50,blurRadius:10,fstop:2.8,quality:"medium"},screenSpaceAmbientOcclusion:{enable:!1,radius:2,quality:"medium",intensity:1},screenSpaceReflection:{enable:!1,quality:"medium",maxRoughness:.8},colorCorrection:{enable:!0,exposure:0,brightness:0,contrast:1,saturation:1,lookupTexture:""},edge:{enable:!1},FXAA:{enable:!1}},temporalSuperSampling:{enable:"auto"}}},Uk={defaultOption:{light:{main:{shadow:!1,shadowQuality:"high",color:"#fff",intensity:1,alpha:0,beta:0},ambient:{color:"#fff",intensity:.2},ambientCubemap:{texture:null,exposure:1,diffuseIntensity:.5,specularIntensity:.5}}}};var Wk=Zu.extend({type:"grid3D",dependencies:["xAxis3D","yAxis3D","zAxis3D"],defaultOption:{show:!0,zlevel:-10,left:0,top:0,width:"100%",height:"100%",environment:"auto",boxWidth:100,boxHeight:100,boxDepth:100,axisPointer:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.8)",width:1},label:{show:!0,formatter:null,margin:8,textStyle:{fontSize:14,color:"#fff",backgroundColor:"rgba(0,0,0,0.5)",padding:3,borderRadius:3}}},axisLine:{show:!0,lineStyle:{color:"#333",width:2,type:"solid"}},axisTick:{show:!0,inside:!1,length:3,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}},light:{main:{alpha:30,beta:40},ambient:{intensity:.4}},viewControl:{alpha:20,beta:40,autoRotate:!1,distance:200,minDistance:40,maxDistance:400}}});P.merge(Wk.prototype,Vk),P.merge(Wk.prototype,Gk),P.merge(Wk.prototype,Uk);const jk=Wk;var Zk=XR.firstNotNull,Xk={left:0,middle:1,right:2};function qk(t){return t instanceof Array||(t=[t,t]),t}var Yk=YD.extend((function(){return{zr:null,viewGL:null,_center:new IE,minDistance:.5,maxDistance:1.5,maxOrthographicSize:300,minOrthographicSize:30,minAlpha:-90,maxAlpha:90,minBeta:-1/0,maxBeta:1/0,autoRotateAfterStill:0,autoRotateDirection:"cw",autoRotateSpeed:60,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",_mode:"rotate",_camera:null,_needsUpdate:!1,_rotating:!1,_phi:0,_theta:0,_mouseX:0,_mouseY:0,_rotateVelocity:new DP,_panVelocity:new DP,_distance:500,_zoomSpeed:0,_stillTimeout:0,_animators:[]}}),(function(){["_mouseDownHandler","_mouseWheelHandler","_mouseMoveHandler","_mouseUpHandler","_pinchHandler","_contextMenuHandler","_update"].forEach((function(t){this[t]=this[t].bind(this)}),this)}),{init:function(){var t=this.zr;t&&(t.on("mousedown",this._mouseDownHandler),t.on("globalout",this._mouseUpHandler),t.on("mousewheel",this._mouseWheelHandler),t.on("pinch",this._pinchHandler),t.animation.on("frame",this._update),t.dom.addEventListener("contextmenu",this._contextMenuHandler))},dispose:function(){var t=this.zr;t&&(t.off("mousedown",this._mouseDownHandler),t.off("mousemove",this._mouseMoveHandler),t.off("mouseup",this._mouseUpHandler),t.off("mousewheel",this._mouseWheelHandler),t.off("pinch",this._pinchHandler),t.off("globalout",this._mouseUpHandler),t.dom.removeEventListener("contextmenu",this._contextMenuHandler),t.animation.off("frame",this._update)),this.stopAllAnimation()},getDistance:function(){return this._distance},setDistance:function(t){this._distance=t,this._needsUpdate=!0},getOrthographicSize:function(){return this._orthoSize},setOrthographicSize:function(t){this._orthoSize=t,this._needsUpdate=!0},getAlpha:function(){return this._theta/Math.PI*180},getBeta:function(){return-this._phi/Math.PI*180},getCenter:function(){return this._center.toArray()},setAlpha:function(t){t=Math.max(Math.min(this.maxAlpha,t),this.minAlpha),this._theta=t/180*Math.PI,this._needsUpdate=!0},setBeta:function(t){t=Math.max(Math.min(this.maxBeta,t),this.minBeta),this._phi=-t/180*Math.PI,this._needsUpdate=!0},setCenter:function(t){this._center.setArray(t)},setViewGL:function(t){this.viewGL=t},getCamera:function(){return this.viewGL.camera},setFromViewControlModel:function(t,e){var n=(e=e||{}).baseDistance||0,i=e.baseOrthoSize||1,r=t.get("projection");"perspective"!==r&&"orthographic"!==r&&"isometric"!==r&&(r="perspective"),this._projection=r,this.viewGL.setProjection(r);var o=t.get("distance")+n,a=t.get("orthographicSize")+i;[["damping",.8],["autoRotate",!1],["autoRotateAfterStill",3],["autoRotateDirection","cw"],["autoRotateSpeed",10],["minDistance",30],["maxDistance",400],["minOrthographicSize",30],["maxOrthographicSize",300],["minAlpha",-90],["maxAlpha",90],["minBeta",-1/0],["maxBeta",1/0],["rotateSensitivity",1],["zoomSensitivity",1],["panSensitivity",1],["panMouseButton","left"],["rotateMouseButton","middle"]].forEach((function(e){this[e[0]]=Zk(t.get(e[0]),e[1])}),this),this.minDistance+=n,this.maxDistance+=n,this.minOrthographicSize+=i,this.maxOrthographicSize+=i;var s=t.ecModel,l={};["animation","animationDurationUpdate","animationEasingUpdate"].forEach((function(e){l[e]=Zk(t.get(e),s&&s.get(e))}));var u=Zk(e.alpha,t.get("alpha"))||0,h=Zk(e.beta,t.get("beta"))||0,c=Zk(e.center,t.get("center"))||[0,0,0];l.animation&&l.animationDurationUpdate>0&&this._notFirst?this.animateTo({alpha:u,beta:h,center:c,distance:o,orthographicSize:a,easing:l.animationEasingUpdate,duration:l.animationDurationUpdate}):(this.setDistance(o),this.setAlpha(u),this.setBeta(h),this.setCenter(c),this.setOrthographicSize(a)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){0},animateTo:function(t){var e=this.zr,n=this,i={},r={};return null!=t.distance&&(i.distance=this.getDistance(),r.distance=t.distance),null!=t.orthographicSize&&(i.orthographicSize=this.getOrthographicSize(),r.orthographicSize=t.orthographicSize),null!=t.alpha&&(i.alpha=this.getAlpha(),r.alpha=t.alpha),null!=t.beta&&(i.beta=this.getBeta(),r.beta=t.beta),null!=t.center&&(i.center=this.getCenter(),r.center=t.center),this._addAnimator(e.animation.animate(i).when(t.duration||1e3,r).during((function(){null!=i.alpha&&n.setAlpha(i.alpha),null!=i.beta&&n.setBeta(i.beta),null!=i.distance&&n.setDistance(i.distance),null!=i.center&&n.setCenter(i.center),null!=i.orthographicSize&&n.setOrthographicSize(i.orthographicSize),n._needsUpdate=!0}))).start(t.easing||"linear")},stopAllAnimation:function(){for(var t=0;t0},_update:function(t){if(this._rotating){var e=("cw"===this.autoRotateDirection?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=e*t/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(t=Math.min(t,50),this._updateDistanceOrSize(t),this._updatePan(t),this._updateRotate(t),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(t){var e=this._rotateVelocity;this._phi=e.y*t/20+this._phi,this._theta=e.x*t/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(e,Math.pow(this.damping,t/16))},_updateDistanceOrSize:function(t){"perspective"===this._projection?this._setDistance(this._distance+this._zoomSpeed*t/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*t/20),this._zoomSpeed*=Math.pow(this.damping,t/16)},_setDistance:function(t){this._distance=Math.max(Math.min(t,this.maxDistance),this.minDistance)},_setOrthoSize:function(t){this._orthoSize=Math.max(Math.min(t,this.maxOrthographicSize),this.minOrthographicSize);var e=this.getCamera(),n=this._orthoSize,i=n/this.viewGL.viewport.height*this.viewGL.viewport.width;e.left=-i/2,e.right=i/2,e.top=n/2,e.bottom=-n/2},_updatePan:function(t){var e=this._panVelocity,n=this._distance,i=this.getCamera(),r=i.worldTransform.y,o=i.worldTransform.x;this._center.scaleAndAdd(o,-e.x*n/200).scaleAndAdd(r,-e.y*n/200),this._vectorDamping(e,0)},_updateTransform:function(){var t=this.getCamera(),e=new IE,n=this._theta+Math.PI/2,i=this._phi+Math.PI/2,r=Math.sin(n);e.x=r*Math.cos(i),e.y=-Math.cos(n),e.z=r*Math.sin(i),t.position.copy(this._center).scaleAndAdd(e,this._distance),t.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var t=this.autoRotateAfterStill,e=this;!isNaN(t)&&t>0&&(this._stillTimeout=setTimeout((function(){e._rotating=!0}),1e3*t))},_vectorDamping:function(t,e){var n=t.len();(n*=e)<1e-4&&(n=0),t.normalize().scale(n)},_decomposeTransform:function(){if(this.getCamera()){this.getCamera().updateWorldTransform();var t=this.getCamera().worldTransform.z,e=Math.asin(t.y),n=Math.atan2(t.x,t.z);this._theta=e,this._phi=-n,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(t){if(!t.target&&!this._isAnimating()){var e=t.offsetX,n=t.offsetY;this.viewGL&&!this.viewGL.containPoint(e,n)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),t.event.targetTouches?1===t.event.targetTouches.length&&(this._mode="rotate"):t.event.button===Xk[this.rotateMouseButton]?this._mode="rotate":t.event.button===Xk[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=t.offsetX,this._mouseY=t.offsetY)}},_mouseMoveHandler:function(t){if(!(t.target&&t.target.__isGLToZRProxy||this._isAnimating())){var e=qk(this.panSensitivity),n=qk(this.rotateSensitivity);"rotate"===this._mode?(this._rotateVelocity.y=(t.offsetX-this._mouseX)/this.zr.getHeight()*2*n[0],this._rotateVelocity.x=(t.offsetY-this._mouseY)/this.zr.getWidth()*2*n[1]):"pan"===this._mode&&(this._panVelocity.x=(t.offsetX-this._mouseX)/this.zr.getWidth()*e[0]*400,this._panVelocity.y=(-t.offsetY+this._mouseY)/this.zr.getHeight()*e[1]*400),this._mouseX=t.offsetX,this._mouseY=t.offsetY,t.event.preventDefault()}},_mouseWheelHandler:function(t){if(!this._isAnimating()){var e=t.event.wheelDelta||-t.event.detail;this._zoomHandler(t,e)}},_pinchHandler:function(t){this._isAnimating()||(this._zoomHandler(t,t.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(t,e){if(0!==e){var n,i=t.offsetX,r=t.offsetY;if(!this.viewGL||this.viewGL.containPoint(i,r))n="perspective"===this._projection?Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(e>0?-1:1)*n*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&"rotate"===this._mode&&this._startCountingStill(),t.event.preventDefault()}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return"right"===this.rotateMouseButton||"right"===this.panMouseButton},_contextMenuHandler:function(t){this._isRightMouseButtonUsed()&&t.preventDefault()},_addAnimator:function(t){var e=this._animators;return e.push(t),t.done((function(){var n=e.indexOf(t);n>=0&&e.splice(n,1)})),t}});Object.defineProperty(Yk.prototype,"autoRotate",{get:function(t){return this._autoRotate},set:function(t){this._autoRotate=t,this._rotating=t}});const Kk=Yk,Jk={convertToDynamicArray:function(t){t&&this.resetOffset();var e=this.attributes;for(var n in e)t||!e[n].value?e[n].value=[]:e[n].value=Array.prototype.slice.call(e[n].value);t||!this.indices?this.indices=[]:this.indices=Array.prototype.slice.call(this.indices)},convertToTypedArray:function(){var t=this.attributes;for(var e in t)t[e].value&&t[e].value.length>0?t[e].value=new Float32Array(t[e].value):t[e].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}},$k={vec2:CP,vec3:uE,vec4:HE,mat2:uk,mat2d:fk,mat3:GE,mat4:sE,quat:qE};var Qk=$k.vec3,tz=[[0,0],[1,1]],ez=JO.extend((function(){return{segmentScale:1,dynamic:!0,useNativeLine:!0,attributes:{position:new JO.Attribute("position","float",3,"POSITION"),positionPrev:new JO.Attribute("positionPrev","float",3),positionNext:new JO.Attribute("positionNext","float",3),prevPositionPrev:new JO.Attribute("prevPositionPrev","float",3),prevPosition:new JO.Attribute("prevPosition","float",3),prevPositionNext:new JO.Attribute("prevPositionNext","float",3),offset:new JO.Attribute("offset","float",1),color:new JO.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(t){var e=this.attributes;this.vertexCount!==t&&(e.position.init(t),e.color.init(t),this.useNativeLine||(e.positionPrev.init(t),e.positionNext.init(t),e.offset.init(t)),t>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(this.indices=0===t?null:this.vertexCount>65535?new Uint32Array(3*t):new Uint16Array(3*t))},_getCubicCurveApproxStep:function(t,e,n,i){return 1/(Qk.dist(t,e)+Qk.dist(n,e)+Qk.dist(i,n)+1)*this.segmentScale},getCubicCurveVertexCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?2*o:2*o+2},getCubicCurveTriangleCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?0:2*o},getLineVertexCount:function(){return this.getPolylineVertexCount(tz)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(tz)},getPolylineVertexCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/3;return this.useNativeLine?2*(e-1):2*(e-1)+2},getPolylineTriangleCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/3;return this.useNativeLine?0:2*Math.max(e-1,0)},addCubicCurve:function(t,e,n,i,r,o){null==o&&(o=1);var a=t[0],s=t[1],l=t[2],u=e[0],h=e[1],c=e[2],d=n[0],f=n[1],p=n[2],g=i[0],m=i[1],v=i[2],_=this._getCubicCurveApproxStep(t,e,n,i),y=_*_,x=y*_,b=3*_,w=3*y,S=6*y,T=6*x,M=a-2*u+d,C=s-2*h+f,A=l-2*c+p,L=3*(u-d)-a+g,D=3*(h-f)-s+m,I=3*(c-p)-l+v,P=a,E=s,O=l,N=(u-a)*b+M*w+L*x,R=(h-s)*b+C*w+D*x,k=(c-l)*b+A*w+I*x,z=M*S+L*T,B=C*S+D*T,F=A*S+I*T,H=L*T,V=D*T,G=I*T,U=0,W=0,j=Math.ceil(1/_),Z=new Float32Array(3*(j+1)),X=(Z=[],0);for(W=0;W1&&(P=N>0?Math.min(P,g):Math.max(P,g),E=R>0?Math.min(E,m):Math.max(E,m),O=k>0?Math.min(O,v):Math.max(O,v));return this.addPolyline(Z,r,o)},addLine:function(t,e,n,i){return this.addPolyline([t,e],n,i)},addPolyline:function(t,e,n,i,r){if(t.length){var o="number"!=typeof t[0];if(null==r&&(r=o?t.length:t.length/3),!(r<2)){null==i&&(i=0),null==n&&(n=1),this._itemVertexOffsets.push(this._vertexOffset);var a,s,l=(o="number"!=typeof t[0])?"number"!=typeof e[0]:e.length/4===r,u=this.attributes.position,h=this.attributes.positionPrev,c=this.attributes.positionNext,d=this.attributes.color,f=this.attributes.offset,p=this.indices,g=this._vertexOffset;n=Math.max(n,.01);for(var m=i;m1&&(u.copy(g,g-1),d.copy(g,g-1),g++):(m0&&(c.set(g-2,a),c.set(g-1,a)),u.set(g,a),u.set(g+1,a),d.set(g,s),d.set(g+1,s),f.set(g,n/2),f.set(g+1,-n/2),g+=2),this.useNativeLine)d.set(g,s),u.set(g,a),g++;else if(m>0){var y=3*this._triangleOffset;(p=this.indices)[y]=g-4,p[y+1]=g-3,p[y+2]=g-2,p[y+3]=g-3,p[y+4]=g-1,p[y+5]=g-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,b=this._vertexOffset+2*r;h.copy(x,x+2),h.copy(x+1,x+3),c.copy(b-1,b-3),c.copy(b-2,b-4)}return this._vertexOffset=g,this._vertexOffset}}},setItemColor:function(t,e){for(var n=this._itemVertexOffsets[t],i=ta&&(r=this._x=0,o+=this._rowHeight+l,this._y=o,this._rowHeight=0),this._x+=e+l,this._rowHeight=Math.max(this._rowHeight,n),o+n+l>s)return null;t.x+=this.offsetX*this.dpr+r,t.y+=this.offsetY*this.dpr+o,this._zr.add(t);var u=[this.offsetX/this.width,this.offsetY/this.height];return[[r/a+u[0],o/s+u[1]],[(r+e)/a+u[0],(o+n)/s+u[1]]]},_fitElement:function(t,e,n){var i=t.getBoundingRect(),r=e/i.width,o=n/i.height;t.x=-i.x*r,t.y=-i.y*o,t.scaleX=r,t.scaleY=o,t.update()}},rz.prototype={clear:function(){for(var t=0;t=t)){var r=(n+this._nodeWidth)*this._dpr,o=(i+this._nodeHeight)*this._dpr;try{this._zr.resize({width:r,height:o})}catch(t){this._canvas.width=r,this._canvas.height=o}var a=new iz(this._zr,n,i,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(a),a}},add:function(t,e,n){if(this._coords[t.id])return this._coords[t.id];var i=this._getCurrentNode().add(t,e,n);if(!i){var r=this._expand();if(!r)return;i=r.add(t,e,n)}return this._coords[t.id]=i,i},getCoordsScale:function(){var t=this._dpr;return[this._nodeWidth/this._canvas.width*t,this._nodeHeight/this._canvas.height*t]},getCoords:function(t){return this._coords[t]},dispose:function(){this._zr.dispose()}};const oz=rz;function az(){}az.prototype={constructor:az,setScene:function(t){this._scene=t,this._skybox&&this._skybox.attachScene(this._scene)},initLight:function(t){this._lightRoot=t,this.mainLight=new Lk.DirectionalLight({shadowBias:.005}),this.ambientLight=new Lk.AmbientLight,t.add(this.mainLight),t.add(this.ambientLight)},dispose:function(){this._lightRoot&&(this._lightRoot.remove(this.mainLight),this._lightRoot.remove(this.ambientLight))},updateLight:function(t){var e=this.mainLight,n=this.ambientLight,i=t.getModel("light"),r=i.getModel("main"),o=i.getModel("ambient");e.intensity=r.get("intensity"),n.intensity=o.get("intensity"),e.color=Lk.parseColor(r.get("color")).slice(0,3),n.color=Lk.parseColor(o.get("color")).slice(0,3);var a=r.get("alpha")||0,s=r.get("beta")||0;e.position.setArray(Lk.directionFromAlphaBeta(a,s)),e.lookAt(Lk.Vector3.ZERO),e.castShadow=r.get("shadow"),e.shadowResolution=Lk.getShadowResolution(r.get("shadowQuality"))},updateAmbientCubemap:function(t,e,n){var i=e.getModel("light.ambientCubemap"),r=i.get("texture");if(r){this._cubemapLightsCache=this._cubemapLightsCache||{};var o=this._cubemapLightsCache[r];if(!o){var a=this;o=this._cubemapLightsCache[r]=Lk.createAmbientCubemap(i.option,t,n,(function(){a._isSkyboxFromAmbientCubemap&&a._skybox.setEnvironmentMap(o.specular.cubemap),n.getZr().refresh()}))}this._lightRoot.add(o.diffuse),this._lightRoot.add(o.specular),this._currentCubemapLights=o}else this._currentCubemapLights&&(this._lightRoot.remove(this._currentCubemapLights.diffuse),this._lightRoot.remove(this._currentCubemapLights.specular),this._currentCubemapLights=null)},updateSkybox:function(t,e,n){var i=e.get("environment"),r=this;var o=(r._skybox=r._skybox||new lR,r._skybox);if(i&&"none"!==i)if("auto"===i)if(this._isSkyboxFromAmbientCubemap=!0,this._currentCubemapLights){var a=this._currentCubemapLights.specular.cubemap;o.setEnvironmentMap(a),this._scene&&o.attachScene(this._scene),o.material.set("lod",3)}else this._skybox&&this._skybox.detachScene();else if("object"==typeof i&&i.colorStops||"string"==typeof i&&tn.parse(i)){this._isSkyboxFromAmbientCubemap=!1;var s=new Lk.Texture2D({anisotropic:8,flipY:!1});o.setEnvironmentMap(s);var l=s.image=document.createElement("canvas");l.width=l.height=16,Sm(l.getContext("2d"),new Xa({shape:{x:0,y:0,width:16,height:16},style:{fill:i}})),o.attachScene(this._scene)}else{this._isSkyboxFromAmbientCubemap=!1;s=Lk.loadTexture(i,n,{anisotropic:8,flipY:!1});o.setEnvironmentMap(s),o.attachScene(this._scene)}else this._skybox&&this._skybox.detachScene(this._scene),this._skybox=null;var u=e.coordinateSystem;if(this._skybox)if(!u||!u.viewGL||"auto"===i||i.match&&i.match(/.hdr$/))this._skybox.material.undefine("fragment","SRGB_DECODE");else{var h=u.viewGL.isLinearSpace()?"define":"undefine";this._skybox.material[h]("fragment","SRGB_DECODE")}}};const sz=az;var lz=$k.vec3,uz=JO.extend((function(){return{segmentScale:1,useNativeLine:!0,attributes:{position:new JO.Attribute("position","float",3,"POSITION"),normal:new JO.Attribute("normal","float",3,"NORMAL"),color:new JO.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setQuadCount:function(t){var e=this.attributes,n=this.getQuadVertexCount()*t,i=this.getQuadTriangleCount()*t;this.vertexCount!==n&&(e.position.init(n),e.normal.init(n),e.color.init(n)),this.triangleCount!==i&&(this.indices=n>65535?new Uint32Array(3*i):new Uint16Array(3*i))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var t=lz.create(),e=lz.create(),n=lz.create(),i=[0,3,1,3,2,1];return function(r,o){var a=this.attributes.position,s=this.attributes.normal,l=this.attributes.color;lz.sub(t,r[1],r[0]),lz.sub(e,r[2],r[1]),lz.cross(n,t,e),lz.normalize(n,n);for(var u=0;u<4;u++)a.set(this._vertexOffset+u,r[u]),l.set(this._vertexOffset+u,o),s.set(this._vertexOffset+u,n);var h=3*this._faceOffset;for(u=0;u<6;u++)this.indices[h+u]=i[u]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});P.defaults(uz.prototype,Jk);const hz=uz;var cz=XR.firstNotNull,dz={x:0,y:2,z:1};function fz(t,e,n){this.rootNode=new Lk.Node;var i=new Lk.Mesh({geometry:new nz({useNativeLine:!1}),material:e,castShadow:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:1}),r=new Lk.Mesh({geometry:new hz,material:n,castShadow:!1,culling:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:0});this.rootNode.add(r),this.rootNode.add(i),this.faceInfo=t,this.plane=new Lk.Plane,this.linesMesh=i,this.quadsMesh=r}fz.prototype.update=function(t,e,n){var i=t.coordinateSystem,r=[i.getAxis(this.faceInfo[0]),i.getAxis(this.faceInfo[1])],o=this.linesMesh.geometry,a=this.quadsMesh.geometry;o.convertToDynamicArray(!0),a.convertToDynamicArray(!0),this._updateSplitLines(o,r,t,n),this._udpateSplitAreas(a,r,t,n),o.convertToTypedArray(),a.convertToTypedArray();var s=i.getAxis(this.faceInfo[2]);!function(t,e,n,i){var r=[0,0,0],o=i<0?n.getExtentMin():n.getExtentMax();r[dz[n.dim]]=o,t.position.setArray(r),t.rotation.identity(),e.distance=-Math.abs(o),e.normal.set(0,0,0),"x"===n.dim?(t.rotation.rotateY(i*Math.PI/2),e.normal.x=-i):"z"===n.dim?(t.rotation.rotateX(-i*Math.PI/2),e.normal.y=-i):(i>0&&t.rotation.rotateY(Math.PI),e.normal.z=-i)}(this.rootNode,this.plane,s,this.faceInfo[3])},fz.prototype._updateSplitLines=function(t,e,n,i){var r=i.getDevicePixelRatio();e.forEach((function(i,o){var a=i.model,s=e[1-o].getExtent();if(!i.scale.isBlank()){var l=a.getModel("splitLine",n.getModel("splitLine"));if(l.get("show")){var u=l.getModel("lineStyle"),h=u.get("color"),c=cz(u.get("opacity"),1),d=cz(u.get("width"),1);h=P.isArray(h)?h:[h];for(var f=i.getTicksCoords({tickModel:l}),p=0,g=0;g65535?new Uint32Array(3*n):new Uint16Array(3*n))},setSpriteAlign:function(t,e,n,i,r){var o,a,s,l;switch(null==n&&(n="left"),null==i&&(i="top"),r=r||0,n){case"left":o=r,s=e[0]+r;break;case"center":case"middle":o=-e[0]/2,s=e[0]/2;break;case"right":o=-e[0]-r,s=-r}switch(i){case"bottom":a=r,l=e[1]+r;break;case"middle":a=-e[1]/2,l=e[1]/2;break;case"top":a=-e[1]-r,l=-r}var u=4*t,h=this.attributes.offset;h.set(u,[o,l]),h.set(u+1,[s,l]),h.set(u+2,[s,a]),h.set(u+3,[o,a])},addSprite:function(t,e,n,i,r,o){var a=this._vertexOffset;this.setSprite(this._vertexOffset/4,t,e,n,i,r,o);for(var s=0;s 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end";var Mz=XR.firstNotNull;Lk.Shader.import(Tz);var Cz={x:0,y:2,z:1};const Az=Od.extend({type:"grid3D",__ecgl__:!0,init:function(t,e){var n=new Lk.Material({shader:Lk.createShader("ecgl.color"),depthMask:!1,transparent:!0}),i=new Lk.Material({shader:Lk.createShader("ecgl.meshLines3D"),depthMask:!1,transparent:!0});n.define("fragment","DOUBLE_SIDED"),n.define("both","VERTEX_COLOR"),this.groupGL=new Lk.Node,this._control=new Kk({zr:e.getZr()}),this._control.init(),this._faces=[["y","z","x",-1,"left"],["y","z","x",1,"right"],["x","y","z",-1,"bottom"],["x","y","z",1,"top"],["x","z","y",-1,"far"],["x","z","y",1,"near"]].map((function(t){var e=new pz(t,i,n);return this.groupGL.add(e.rootNode),e}),this),this._axes=["x","y","z"].map((function(t){var e=new Sz(t,i);return this.groupGL.add(e.rootNode),e}),this);var r=e.getDevicePixelRatio();this._axisLabelSurface=new oz({width:256,height:256,devicePixelRatio:r}),this._axisLabelSurface.onupdate=function(){e.getZr().refresh()},this._axisPointerLineMesh=new Lk.Mesh({geometry:new nz({useNativeLine:!1}),material:i,castShadow:!1,ignorePicking:!0,renderOrder:3}),this.groupGL.add(this._axisPointerLineMesh),this._axisPointerLabelsSurface=new oz({width:128,height:128,devicePixelRatio:r}),this._axisPointerLabelsMesh=new _z({ignorePicking:!0,renderOrder:4,castShadow:!1}),this._axisPointerLabelsMesh.material.set("textureAtlas",this._axisPointerLabelsSurface.getTexture()),this.groupGL.add(this._axisPointerLabelsMesh),this._lightRoot=new Lk.Node,this._sceneHelper=new sz,this._sceneHelper.initLight(this._lightRoot)},render:function(t,e,n){this._model=t,this._api=n;var i=t.coordinateSystem;i.viewGL.add(this._lightRoot),t.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL);var r=this._control;r.setViewGL(i.viewGL);var o=t.getModel("viewControl");r.setFromViewControlModel(o,0),this._axisLabelSurface.clear(),r.off("update"),t.get("show")&&(this._faces.forEach((function(i){i.update(t,e,n)}),this),this._axes.forEach((function(e){e.update(t,this._axisLabelSurface,n)}),this)),r.on("update",this._onCameraChange.bind(this,t,n),this),this._sceneHelper.setScene(i.viewGL.scene),this._sceneHelper.updateLight(t),i.viewGL.setPostEffect(t.getModel("postEffect"),n),i.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._initMouseHandler(t)},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n)},showAxisPointer:function(t,e,n,i){this._doShowAxisPointer(),this._updateAxisPointer(i.value)},hideAxisPointer:function(t,e,n,i){this._doHideAxisPointer()},_initMouseHandler:function(t){var e=t.coordinateSystem.viewGL;t.get("show")&&t.get("axisPointer.show")?e.on("mousemove",this._updateAxisPointerOnMousePosition,this):e.off("mousemove",this._updateAxisPointerOnMousePosition)},_updateAxisPointerOnMousePosition:function(t){if(!t.target){for(var e,n=this._model.coordinateSystem,i=n.viewGL,r=i.castRay(t.offsetX,t.offsetY,new Lk.Ray),o=0;oi[1]?0:1,a=this._faces[2*n+o],s=this._faces[2*n+1-o];a.rootNode.invisible=!0,s.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var t=this._model.coordinateSystem,e=t.getAxis("x"),n=t.getAxis("y"),i=t.getAxis("z"),r=i.getExtentMax(),o=i.getExtentMin(),a=e.getExtentMin(),s=e.getExtentMax(),l=n.getExtentMax(),u=n.getExtentMin(),h=this._axes[0].rootNode,c=this._axes[1].rootNode,d=this._axes[2].rootNode,f=this._faces,p=f[4].rootNode.invisible?u:l,g=f[2].rootNode.invisible?r:o,m=f[0].rootNode.invisible?a:s,v=f[2].rootNode.invisible?r:o,_=f[0].rootNode.invisible?s:a,y=f[4].rootNode.invisible?u:l;h.rotation.identity(),c.rotation.identity(),d.rotation.identity(),f[4].rootNode.invisible&&(this._axes[0].flipped=!0,h.rotation.rotateX(Math.PI)),f[0].rootNode.invisible&&(this._axes[1].flipped=!0,c.rotation.rotateZ(Math.PI)),f[4].rootNode.invisible&&(this._axes[2].flipped=!0,d.rotation.rotateY(Math.PI)),h.position.set(0,g,p),c.position.set(m,v,0),d.position.set(_,0,y),h.update(),c.update(),d.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var t=this._control.getCamera(),e=[new Lk.Vector4,new Lk.Vector4],n=new Lk.Vector4;this.groupGL.getWorldPosition(n),n.w=1,n.transformMat4(t.viewMatrix).transformMat4(t.projectionMatrix),n.x/=n.w,n.y/=n.w,this._axes.forEach((function(i){for(var r=i.axisLineCoords,o=(i.labelsMesh.geometry,0);on.y?"bottom":"top"):(s="middle",a=h>n.x?"left":"right"),i.setSpriteAlign(a,s,this._api)}),this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(t){var e=this._model.coordinateSystem,n=e.dataToPoint(t),i=this._axisPointerLineMesh.geometry,r=this._model.getModel("axisPointer"),o=this._api.getDevicePixelRatio();function a(t){return XR.firstNotNull(t.model.get("axisPointer.show"),r.get("show"))}function s(t){var e=t.model.getModel("axisPointer",r).getModel("lineStyle"),n=Lk.parseColor(e.get("color")),i=Mz(e.get("width"),1),o=Mz(e.get("opacity"),1);return n[3]*=o,{color:n,lineWidth:i}}i.convertToDynamicArray(!0);for(var l=0;l 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n#ifdef USE_VSM\n depth = depth * 0.5 + 0.5;\n float moment1 = depth;\n float moment2 = depth * depth;\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n moment2 += 0.25*(dx*dx+dy*dy);\n #endif\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\n#else\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\n #else\n depth += bias;\n #endif\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\n#endif\n}\n@end\n@export clay.sm.debug_depth\nuniform sampler2D depthMap;\nvarying vec2 v_Texcoord;\n@import clay.util.decode_float\nvoid main() {\n vec4 tex = texture2D(depthMap, v_Texcoord);\n#ifdef USE_VSM\n gl_FragColor = vec4(tex.rgb, 1.0);\n#else\n float depth = decodeFloat(tex);\n gl_FragColor = vec4(depth, depth, depth, 1.0);\n#endif\n}\n@end\n@export clay.sm.distance.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 world : WORLD;\nattribute vec3 position : POSITION;\n@import clay.chunk.skinning_header\nvarying vec3 v_WorldPosition;\nvoid main (){\n vec4 P = vec4(position, 1.0);\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = skinMatrixWS * P;\n#endif\n#ifdef INSTANCING\n @import clay.chunk.instancing_matrix\n P = instanceMat * P;\n#endif\n gl_Position = worldViewProjection * P;\n v_WorldPosition = (world * P).xyz;\n}\n@end\n@export clay.sm.distance.fragment\nuniform vec3 lightPosition;\nuniform float range : 100;\nvarying vec3 v_WorldPosition;\n@import clay.util.encode_float\nvoid main(){\n float dist = distance(lightPosition, v_WorldPosition);\n#ifdef USE_VSM\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\n#else\n dist = dist / range;\n gl_FragColor = encodeFloat(dist);\n#endif\n}\n@end\n@export clay.plugin.shadow_map_common\n@import clay.util.decode_float\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\n vec4 tex = texture2D(map, uv);\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\n float shadowContrib = tapShadowMap(map, uv, z);\n vec2 offset = vec2(1.0 / textureSize) * scale;\n#ifdef PCF_KERNEL_SIZE\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\n }}\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\n#else\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\n return shadowContrib / 9.0;\n#endif\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\n return pcf(map, uv, z, textureSize, vec2(1.0));\n}\nfloat chebyshevUpperBound(vec2 moments, float z){\n float p = 0.0;\n z = z * 0.5 + 0.5;\n if (z <= moments.x) {\n p = 1.0;\n }\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.0000001);\n float mD = moments.x - z;\n float pMax = variance / (variance + mD * mD);\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\n return max(p, pMax);\n}\nfloat computeShadowContrib(\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\n) {\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\n posInLightSpace.xyz /= posInLightSpace.w;\n float z = posInLightSpace.z;\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\n #ifdef USE_VSM\n vec2 moments = texture2D(map, uv * scale + offset).xy;\n return chebyshevUpperBound(moments, z);\n #else\n return pcf(map, uv * scale + offset, z, textureSize, scale);\n #endif\n }\n return 1.0;\n}\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\n}\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\n{\n float dist = length(direction);\n vec4 shadowTex = textureCube(map, direction);\n#ifdef USE_VSM\n vec2 moments = shadowTex.xy;\n float variance = moments.y - moments.x * moments.x;\n float mD = moments.x - dist;\n float p = variance / (variance + mD * mD);\n if(moments.x + 0.001 < dist){\n return clamp(p, 0.0, 1.0);\n }else{\n return 1.0;\n }\n#else\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\n#endif\n}\n@end\n@export clay.plugin.compute_shadow_map\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\n#if defined(SHADOW_CASCADE)\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\n#else\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#endif\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\nuniform bool shadowEnabled : true;\n#ifdef PCF_KERNEL_SIZE\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\n#endif\n@import clay.plugin.shadow_map_common\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\n spotLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n#ifdef SHADOW_CASCADE\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\n / (gl_DepthRange.far - gl_DepthRange.near);\n float shadowContrib;\n shadowContribs[0] = 1.0;\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\n if (\n depth >= shadowCascadeClipsNear[_idx_] &&\n depth <= shadowCascadeClipsFar[_idx_]\n ) {\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[0],\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\n );\n shadowContribs[0] = shadowContrib;\n }\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#else\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\n vec3 lightPosition;\n vec3 direction;\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n lightPosition = pointLightPosition[_idx_];\n direction = position - lightPosition;\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\n }}\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n@end");var Hz,Vz,Gz,Uz,Wz,jz,Zz,Xz=YD.extend((function(){return{softShadow:Xz.PCF,shadowBlur:1,lightFrustumBias:"auto",kernelPCF:new Float32Array([1,0,1,1,-1,1,0,1,-1,0,-1,-1,1,-1,0,-1]),precision:"highp",_lastRenderNotCastShadow:!1,_frameBuffer:new JN,_textures:{},_shadowMapNumber:{POINT_LIGHT:0,DIRECTIONAL_LIGHT:0,SPOT_LIGHT:0},_depthMaterials:{},_distanceMaterials:{},_receivers:[],_lightsCastShadow:[],_lightCameras:{},_lightMaterials:{},_texturePool:new kz}}),(function(){this._gaussianPassH=new OR({fragment:rE.source("clay.compositor.gaussian_blur")}),this._gaussianPassV=new OR({fragment:rE.source("clay.compositor.gaussian_blur")}),this._gaussianPassH.setUniform("blurSize",this.shadowBlur),this._gaussianPassH.setUniform("blurDir",0),this._gaussianPassV.setUniform("blurSize",this.shadowBlur),this._gaussianPassV.setUniform("blurDir",1),this._outputDepthPass=new OR({fragment:rE.source("clay.sm.debug_depth")})}),{render:function(t,e,n,i){n||(n=e.getMainCamera()),this.trigger("beforerender",this,t,e,n),this._renderShadowPass(t,e,n,i),this.trigger("afterrender",this,t,e,n)},renderDebug:function(t,e){t.saveClear();var n=t.viewport,i=0,r=e||n.width/4,o=r;for(var a in this.softShadow===Xz.VSM?this._outputDepthPass.material.define("fragment","USE_VSM"):this._outputDepthPass.material.undefine("fragment","USE_VSM"),this._textures){var s=this._textures[a];t.setViewport(i,0,r*s.width/s.height,o),this._outputDepthPass.setUniform("depthMap",s),this._outputDepthPass.render(t),i+=r*s.width/s.height}t.setViewport(n),t.restoreClear()},_updateReceivers:function(t,e){if(e.receiveShadow?(this._receivers.push(e),e.material.set("shadowEnabled",1),e.material.set("pcfKernel",this.kernelPCF)):e.material.set("shadowEnabled",0),this.softShadow===Xz.VSM)e.material.define("fragment","USE_VSM"),e.material.undefine("fragment","PCF_KERNEL_SIZE");else{e.material.undefine("fragment","USE_VSM");var n=this.kernelPCF;n&&n.length?e.material.define("fragment","PCF_KERNEL_SIZE",n.length/2):e.material.undefine("fragment","PCF_KERNEL_SIZE")}},_update:function(t,e){var n=this;e.traverse((function(e){e.isRenderable()&&n._updateReceivers(t,e)}));for(var i=0;i4){console.warn("Support at most 4 cascade");continue}p.shadowCascade>1&&(a=p),this.renderDirectionalLightShadow(t,e,n,p,c,h,u)}else"SPOT_LIGHT"===p.type?this.renderSpotLightShadow(t,e,p,l,s):"POINT_LIGHT"===p.type&&this.renderPointLightShadow(t,e,p,d);this._shadowMapNumber[p.type]++}for(var g in this._shadowMapNumber){var m=this._shadowMapNumber[g],v=g+"_SHADOWMAP_COUNT";for(f=0;f0?_.define("fragment",v,m):_.isDefined("fragment",v)&&_.undefine("fragment",v))}}for(f=0;f0){var x=u.map(T);if(y.directionalLightShadowMaps={value:u,type:"tv"},y.directionalLightMatrices={value:h,type:"m4v"},y.directionalLightShadowMapSizes={value:x,type:"1fv"},a){var b=c.slice(),w=c.slice();b.pop(),w.shift(),b.reverse(),w.reverse(),h.reverse(),y.shadowCascadeClipsNear={value:b,type:"1fv"},y.shadowCascadeClipsFar={value:w,type:"1fv"}}}if(s.length>0){var S=s.map(T);(y=e.shadowUniforms).spotLightShadowMaps={value:s,type:"tv"},y.spotLightMatrices={value:l,type:"m4v"},y.spotLightShadowMapSizes={value:S,type:"1fv"}}d.length>0&&(y.pointLightShadowMaps={value:d,type:"tv"})}function T(t){return t.height}},renderDirectionalLightShadow:(Hz=new yN,Vz=new nO,Gz=new mO,Uz=new nO,Wz=new nO,jz=new nO,Zz=new nO,function(t,e,n,i,r,o,a){var s=this._getDepthMaterial(i),l={getMaterial:function(t){return t.shadowDepthMaterial||s},isMaterialChanged:Fz,getUniform:Bz,ifRender:function(t){return t.castShadow},sortCompare:wE.opaqueSortCompare};if(!e.viewBoundingBoxLastFrame.isFinite()){var u=e.getBoundingBox();e.viewBoundingBoxLastFrame.copy(u).applyTransform(n.viewMatrix)}var h=Math.min(-e.viewBoundingBoxLastFrame.min.z,n.far),c=Math.max(-e.viewBoundingBoxLastFrame.max.z,n.near),d=this._getDirectionalLightCamera(i,e,n),f=jz.array;Zz.copy(d.projectionMatrix),sE.invert(Wz.array,d.worldTransform.array),sE.multiply(Wz.array,Wz.array,n.worldTransform.array),sE.multiply(f,Zz.array,Wz.array);for(var p=[],g=n instanceof FN,m=(n.near+n.far)/(n.near-n.far),v=2*n.near*n.far/(n.near-n.far),_=0;_<=i.shadowCascade;_++){var y=c*Math.pow(h/c,_/i.shadowCascade),x=c+(h-c)*_/i.shadowCascade,b=y*i.cascadeSplitLogFactor+x*(1-i.cascadeSplitLogFactor);p.push(b),r.push(-(-b*m+v)/-b)}var w=this._getTexture(i,i.shadowCascade);a.push(w);var S=t.viewport,T=t.gl;for(this._frameBuffer.attach(w),this._frameBuffer.bind(t),T.clear(T.COLOR_BUFFER_BIT|T.DEPTH_BUFFER_BIT),_=0;_d?s>f?p[r>0?"px":"nx"]=!0:p[a>0?"pz":"nz"]=!0:d>f?p[o>0?"py":"ny"]=!0:p[a>0?"pz":"nz"]=!0}for(n=0;n0)this.outputs[t].keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t])}}});var Kz=YD.extend((function(){return{nodes:[]}}),{dirty:function(){this._dirty=!0},addNode:function(t){this.nodes.indexOf(t)>=0||(this.nodes.push(t),this._dirty=!0)},removeNode:function(t){"string"==typeof t&&(t=this.getNodeByName(t));var e=this.nodes.indexOf(t);e>=0&&(this.nodes.splice(e,1),this._dirty=!0)},getNodeByName:function(t){for(var e=0;e=n.COLOR_ATTACHMENT0&&h<=n.COLOR_ATTACHMENT0+8&&u.push(h);l.drawBuffersEXT(u)}t.saveClear(),t.clearBit=QD|eI,e=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),t.restoreClear(),i.unbind(t)}else e=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ);this.trigger("afterrender",e),this._rendering=!1,this._rendered=!0}});const tB=Yz.extend((function(){return{texture:null,outputs:{color:{}}}}),(function(){}),{getOutput:function(t,e){return this.texture},beforeFrame:function(){},afterFrame:function(){}});const eB=Yz.extend((function(){return{name:"",inputs:{},outputs:null,shader:"",inputLinks:{},outputLinks:{},pass:null,_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}}),(function(){var t=new OR({fragment:this.shader});this.pass=t}),{render:function(t,e){this.trigger("beforerender",t),this._rendering=!0;var n=t.gl;for(var i in this.inputLinks){var r=(c=this.inputLinks[i]).node.getOutput(t,c.pin);this.pass.setUniform(i,r)}if(this.outputs){this.pass.outputs={};var o={};for(var a in this.outputs){var s=this.updateParameter(a,t);isNaN(s.width)&&this.updateParameter(a,t);var l=this.outputs[a],u=this._compositor.allocateTexture(s);this._outputTextures[a]=u,"string"==typeof(h=l.attachment||n.COLOR_ATTACHMENT0)&&(h=n[h]),o[h]=u}for(var h in this._compositor.getFrameBuffer().bind(t),o)this._compositor.getFrameBuffer().attach(o[h],h);this.pass.render(t),this._compositor.getFrameBuffer().updateMipmap(t)}else this.pass.outputs=null,this._compositor.getFrameBuffer().unbind(t),this.pass.render(t,e);for(var i in this.inputLinks){var c;(c=this.inputLinks[i]).node.removeReference(c.pin)}this._rendering=!1,this._rendered=!0,this.trigger("afterrender",t)},updateParameter:function(t,e){var n,i,r=this.outputs[t],o=r.parameters,a=r._parametersCopy;if(a||(a=r._parametersCopy={}),o)for(var s in o)"width"!==s&&"height"!==s&&(a[s]=o[s]);return n="function"==typeof o.width?o.width.call(this,e):o.width,i="function"==typeof o.height?o.height.call(this,e):o.height,n=Math.ceil(n),i=Math.ceil(i),a.width===n&&a.height===i||this._outputTextures[t]&&this._outputTextures[t].dispose(e),a.width=n,a.height=i,a},setParameter:function(t,e){this.pass.setUniform(t,e)},getParameter:function(t){return this.pass.getUniform(t)},setParameters:function(t){for(var e in t)this.setParameter(e,t[e])},define:function(t,e){this.pass.material.define("fragment",t,e)},undefine:function(t){this.pass.material.undefine("fragment",t)},removeReference:function(t){(this._outputReferences[t]--,0===this._outputReferences[t])&&(this.outputs[t].keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t]))},clear:function(){Yz.prototype.clear.call(this),this.pass.material.disableTexturesAll()}}),nB="@export clay.compositor.kernel.gaussian_9\nfloat gaussianKernel[9];\ngaussianKernel[0] = 0.07;\ngaussianKernel[1] = 0.09;\ngaussianKernel[2] = 0.12;\ngaussianKernel[3] = 0.14;\ngaussianKernel[4] = 0.16;\ngaussianKernel[5] = 0.14;\ngaussianKernel[6] = 0.12;\ngaussianKernel[7] = 0.09;\ngaussianKernel[8] = 0.07;\n@end\n@export clay.compositor.kernel.gaussian_13\nfloat gaussianKernel[13];\ngaussianKernel[0] = 0.02;\ngaussianKernel[1] = 0.03;\ngaussianKernel[2] = 0.06;\ngaussianKernel[3] = 0.08;\ngaussianKernel[4] = 0.11;\ngaussianKernel[5] = 0.13;\ngaussianKernel[6] = 0.14;\ngaussianKernel[7] = 0.13;\ngaussianKernel[8] = 0.11;\ngaussianKernel[9] = 0.08;\ngaussianKernel[10] = 0.06;\ngaussianKernel[11] = 0.03;\ngaussianKernel[12] = 0.02;\n@end\n@export clay.compositor.gaussian_blur\n#define SHADER_NAME gaussian_blur\nuniform sampler2D texture;varying vec2 v_Texcoord;\nuniform float blurSize : 2.0;\nuniform vec2 textureSize : [512.0, 512.0];\nuniform float blurDir : 0.0;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main (void)\n{\n @import clay.compositor.kernel.gaussian_9\n vec2 off = blurSize / textureSize;\n off *= vec2(1.0 - blurDir, blurDir);\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n for (int i = 0; i < 9; i++) {\n float w = gaussianKernel[i];\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\n sum += texel * w;\n weightAll += w;\n }\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\n}\n@end\n",iB="\n@export clay.compositor.lut\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform sampler2D lookup;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n float blueColor = tex.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec4 newColor1 = texture2D(lookup, texPos1);\n vec4 newColor2 = texture2D(lookup, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n gl_FragColor = vec4(newColor.rgb, tex.w);\n}\n@end",rB="@export clay.compositor.output\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = tex.rgb;\n#ifdef OUTPUT_ALPHA\n gl_FragColor.a = tex.a;\n#else\n gl_FragColor.a = 1.0;\n#endif\n gl_FragColor = encodeHDR(gl_FragColor);\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",oB="@export clay.compositor.bright\nuniform sampler2D texture;\nuniform float threshold : 1;\nuniform float scale : 1.0;\nuniform vec2 textureSize: [512, 512];\nvarying vec2 v_Texcoord;\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvec4 median(vec4 a, vec4 b, vec4 c)\n{\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\n}\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n#ifdef ANTI_FLICKER\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\n texel = median(median(texel, s1, s2), s3, s4);\n#endif\n float lum = dot(texel.rgb , lumWeight);\n vec4 color;\n if (lum > threshold && texel.a > 0.0)\n {\n color = vec4(texel.rgb * scale, texel.a * scale);\n }\n else\n {\n color = vec4(0.0);\n }\n gl_FragColor = encodeHDR(color);\n}\n@end\n",aB="@export clay.compositor.downsample\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nfloat brightness(vec3 c)\n{\n return max(max(c.r, c.g), c.b);\n}\n@import clay.util.clamp_sample\nvoid main()\n{\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\n#ifdef ANTI_FLICKER\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\n float s1w = 1.0 / (brightness(s1) + 1.0);\n float s2w = 1.0 / (brightness(s2) + 1.0);\n float s3w = 1.0 / (brightness(s3) + 1.0);\n float s4w = 1.0 / (brightness(s4) + 1.0);\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\n vec4 color = vec4(\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\n 1.0\n );\n#else\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n color *= 0.25;\n#endif\n gl_FragColor = encodeHDR(color);\n}\n@end",sB="\n@export clay.compositor.upsample\n#define HIGH_QUALITY\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nuniform float sampleScale: 0.5;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main()\n{\n#ifdef HIGH_QUALITY\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n gl_FragColor = encodeHDR(s / 16.0);\n#else\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n gl_FragColor = encodeHDR(s / 4.0);\n#endif\n}\n@end",lB="@export clay.compositor.hdr.composite\n#define TONEMAPPING\nuniform sampler2D texture;\n#ifdef BLOOM_ENABLED\nuniform sampler2D bloom;\n#endif\n#ifdef LENSFLARE_ENABLED\nuniform sampler2D lensflare;\nuniform sampler2D lensdirt;\n#endif\n#ifdef LUM_ENABLED\nuniform sampler2D lum;\n#endif\n#ifdef LUT_ENABLED\nuniform sampler2D lut;\n#endif\n#ifdef COLOR_CORRECTION\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float saturation : 1.0;\n#endif\n#ifdef VIGNETTE\nuniform float vignetteDarkness: 1.0;\nuniform float vignetteOffset: 1.0;\n#endif\nuniform float exposure : 1.0;\nuniform float bloomIntensity : 0.25;\nuniform float lensflareIntensity : 1;\nvarying vec2 v_Texcoord;\n@import clay.util.srgb\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nfloat eyeAdaption(float fLum)\n{\n return mix(0.2, fLum, 0.5);\n}\n#ifdef LUT_ENABLED\nvec3 lutTransform(vec3 color) {\n float blueColor = color.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return newColor.rgb;\n}\n#endif\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = vec4(0.0);\n vec4 originalTexel = vec4(0.0);\n#ifdef TEXTURE_ENABLED\n texel = decodeHDR(texture2D(texture, v_Texcoord));\n originalTexel = texel;\n#endif\n#ifdef BLOOM_ENABLED\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\n texel.rgb += bloomTexel.rgb * bloomIntensity;\n texel.a += bloomTexel.a * bloomIntensity;\n#endif\n#ifdef LENSFLARE_ENABLED\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\n#endif\n texel.a = min(texel.a, 1.0);\n#ifdef LUM_ENABLED\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\n float exposureBias = adaptedLumDest * exposure;\n#else\n float exposureBias = exposure;\n#endif\n#ifdef TONEMAPPING\n texel.rgb *= exposureBias;\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n texel = linearTosRGB(texel);\n#ifdef LUT_ENABLED\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\n#endif\n#ifdef COLOR_CORRECTION\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\n#endif\n#ifdef VIGNETTE\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\n#endif\n gl_FragColor = encodeHDR(texel);\n#ifdef DEBUG\n #if DEBUG == 1\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\n #elif DEBUG == 2\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\n #elif DEBUG == 3\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\n #endif\n#endif\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\n }\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",uB="@export clay.compositor.blend\n#define SHADER_NAME blend\n#ifdef TEXTURE1_ENABLED\nuniform sampler2D texture1;\nuniform float weight1 : 1.0;\n#endif\n#ifdef TEXTURE2_ENABLED\nuniform sampler2D texture2;\nuniform float weight2 : 1.0;\n#endif\n#ifdef TEXTURE3_ENABLED\nuniform sampler2D texture3;\nuniform float weight3 : 1.0;\n#endif\n#ifdef TEXTURE4_ENABLED\nuniform sampler2D texture4;\nuniform float weight4 : 1.0;\n#endif\n#ifdef TEXTURE5_ENABLED\nuniform sampler2D texture5;\nuniform float weight5 : 1.0;\n#endif\n#ifdef TEXTURE6_ENABLED\nuniform sampler2D texture6;\nuniform float weight6 : 1.0;\n#endif\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = vec4(0.0);\n#ifdef TEXTURE1_ENABLED\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\n#endif\n#ifdef TEXTURE2_ENABLED\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\n#endif\n#ifdef TEXTURE3_ENABLED\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\n#endif\n#ifdef TEXTURE4_ENABLED\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\n#endif\n#ifdef TEXTURE5_ENABLED\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\n#endif\n#ifdef TEXTURE6_ENABLED\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\n#endif\n gl_FragColor = encodeHDR(tex);\n}\n@end",hB="@export clay.compositor.fxaa\nuniform sampler2D texture;\nuniform vec4 viewport : VIEWPORT;\nvarying vec2 v_Texcoord;\n#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\n@import clay.util.rgbm\nvoid main()\n{\n vec2 resolution = 1.0 / viewport.zw;\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\n vec3 rgbM = rgbaM.xyz;\n float opacity = rgbaM.w;\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float lumaNW = dot( rgbNW, luma );\n float lumaNE = dot( rgbNE, luma );\n float lumaSW = dot( rgbSW, luma );\n float lumaSE = dot( rgbSE, luma );\n float lumaM = dot( rgbM, luma );\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * resolution;\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA *= 0.5;\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\n rgbB *= 0.25;\n rgbB += rgbA * 0.5;\n float lumaB = dot( rgbB, luma );\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\n {\n gl_FragColor = vec4( rgbA, opacity );\n }\n else {\n gl_FragColor = vec4( rgbB, opacity );\n }\n}\n@end";!function(t){t.import("@export clay.compositor.coloradjust\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float exposure : 0.0;\nuniform float gamma : 1.0;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\n float luminance = dot( color, w );\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.brightness\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = tex.rgb + vec3(brightness);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.contrast\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float contrast : 1.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.exposure\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float exposure : 0.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb * pow(2.0, exposure);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.gamma\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float gamma : 1.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = pow(tex.rgb, vec3(gamma));\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.saturation\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb;\n float luminance = dot(color, w);\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end"),t.import(nB),t.import("@export clay.compositor.hdr.log_lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n float luminance = dot(tex.rgb, w);\n luminance = log(luminance + 0.001);\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\n}\n@end\n@export clay.compositor.hdr.lum_adaption\nvarying vec2 v_Texcoord;\nuniform sampler2D adaptedLum;\nuniform sampler2D currentLum;\nuniform float frameTime : 0.02;\n@import clay.util.rgbm\nvoid main()\n{\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\n}\n@end\n@export clay.compositor.lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord );\n float luminance = dot(tex.rgb, w);\n gl_FragColor = vec4(vec3(luminance), 1.0);\n}\n@end"),t.import(iB),t.import("@export clay.compositor.vignette\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float darkness: 1;\nuniform float offset: 1;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = texel.rgb;\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\n}\n@end"),t.import(rB),t.import(oB),t.import(aB),t.import(sB),t.import(lB),t.import("@export clay.compositor.lensflare\n#define SAMPLE_NUMBER 8\nuniform sampler2D texture;\nuniform sampler2D lenscolor;\nuniform vec2 textureSize : [512, 512];\nuniform float dispersal : 0.3;\nuniform float haloWidth : 0.4;\nuniform float distortion : 1.0;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvec4 textureDistorted(\n in vec2 texcoord,\n in vec2 direction,\n in vec3 distortion\n) {\n return vec4(\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\n 1.0\n );\n}\nvoid main()\n{\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\n vec4 result = vec4(0.0);\n for (int i = 0; i < SAMPLE_NUMBER; i++)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n }\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n vec2 offset = fract(texcoord + haloVec);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n gl_FragColor = result;\n}\n@end"),t.import(uB),t.import(hB)}(rE);var cB=/^#source\((.*?)\)/;function dB(t,e,n){var i,r,o,a,s=t.type||"filter";if("filter"===s){var l=t.shader.trim(),u=cB.exec(l);if(u?i=rE.source(u[1].trim()):"#"===l.charAt(0)&&(i=e.shaders[l.substr(1)]),i||(i=l),!i)return}if(t.inputs)for(var h in r={},t.inputs)"string"==typeof t.inputs[h]?r[h]=t.inputs[h]:r[h]={node:t.inputs[h].node,pin:t.inputs[h].pin};if(t.outputs)for(var h in o={},t.outputs){var c=t.outputs[h];o[h]={},null!=c.attachment&&(o[h].attachment=c.attachment),null!=c.keepLastFrame&&(o[h].keepLastFrame=c.keepLastFrame),null!=c.outputLastFrame&&(o[h].outputLastFrame=c.outputLastFrame),c.parameters&&(o[h].parameters=gB(c.parameters))}if(a="scene"===s?new Qz({name:t.name,scene:n.scene,camera:n.camera,outputs:o}):"texture"===s?new tB({name:t.name,outputs:o}):new eB({name:t.name,shader:i,inputs:r,outputs:o})){if(t.parameters)for(var h in t.parameters){"string"==typeof(d=t.parameters[h])?"#"===(d=d.trim()).charAt(0)?d=e.textures[d.substr(1)]:a.on("beforerender",mB(h,vB(d))):"function"==typeof d&&a.on("beforerender",d),a.setParameter(h,d)}if(t.defines&&a.pass)for(var h in t.defines){var d=t.defines[h];a.pass.material.define("fragment",h,d)}}return a}function fB(t,e){return t}function pB(t,e){return e}function gB(t){var e={};if(!t)return e;["type","minFilter","magFilter","wrapS","wrapT","flipY","useMipmap"].forEach((function(n){var i=t[n];null!=i&&("string"==typeof i&&(i=IO[i]),e[n]=i)}));var n=t.scale||1;return["width","height"].forEach((function(i){if(null!=t[i]){var r=t[i];"string"==typeof r?(r=r.trim(),e[i]=function(t,e,n){return n=n||1,function(t){var i=t.getDevicePixelRatio(),r=t.getWidth()*n,o=t.getHeight()*n;return e(r,o,i)}}(0,vB(r),n)):e[i]=r}})),e.width||(e.width=fB),e.height||(e.height=pB),null!=t.useMipmap&&(e.useMipmap=t.useMipmap),e}function mB(t,e){return function(n){var i=n.getDevicePixelRatio(),r=n.getWidth(),o=n.getHeight(),a=e(r,o,i);this.setParameter(t,a)}}function vB(t){var e=/^expr\((.*)\)$/.exec(t);if(e)try{var n=new Function("width","height","dpr","return "+e[1]);return n(1,1),n}catch(t){throw new Error("Invalid expression.")}}const _B=function(t,e){var n=new $z;e=e||{};var i={textures:{},parameters:{}};for(var r in t.parameters){var o=t.parameters[r];i.parameters[r]=gB(o)}return function(t,e,n,i){if(!t.textures)return void i({});var r={},o=0,a=!1,s=n.textureRootPath;XD.each(t.textures,(function(t,e){var n,l=t.path,u=gB(t.parameters);if(Array.isArray(l)&&6===l.length)s&&(l=l.map((function(t){return XD.relative2absolute(t,s)}))),n=new zN(u);else{if("string"!=typeof l)return;s&&(l=XD.relative2absolute(l,s)),n=new BO(u)}n.load(l),o++,n.once("success",(function(){r[e]=n,0===--o&&(i(r),a=!0)}))})),0!==o||a||i(r)}(t,0,e,(function(r){i.textures=r,function(){for(var r=0;r0;)n+=i*(r%e),r=Math.floor(r/e),i/=e;return n};function xB(t){for(var e=new Uint8Array(t*t*4),n=0,i=new IE,r=0;r 0.99999) {\n gl_FragColor = vec4(1.0);\n return;\n }\n mat3 kernelBasis;\n#endif\n\n float z = depthTexel.r * 2.0 - 1.0;\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * projectedPos;\n\n vec3 position = p4.xyz / p4.w;\n\n float ao = ssaoEstimator(position, kernelBasis);\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n\n@end\n\n\n@export ecgl.ssao.blur\n#define SHADER_NAME SSAO_BLUR\n\nuniform sampler2D ssaoTexture;\n\n#ifdef NORMALTEX_ENABLED\nuniform sampler2D normalTex;\n#endif\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\nuniform int direction: 0.0;\n\n#ifdef DEPTHTEX_ENABLED\nuniform sampler2D depthTex;\nuniform mat4 projection;\nuniform float depthRange : 0.5;\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n#endif\n\nvoid main()\n{\n float kernel[5];\n kernel[0] = 0.122581;\n kernel[1] = 0.233062;\n kernel[2] = 0.288713;\n kernel[3] = 0.233062;\n kernel[4] = 0.122581;\n\n vec2 off = vec2(0.0);\n if (direction == 0) {\n off[0] = blurSize / textureSize.x;\n }\n else {\n off[1] = blurSize / textureSize.y;\n }\n\n vec2 coord = v_Texcoord;\n\n float sum = 0.0;\n float weightAll = 0.0;\n\n#ifdef NORMALTEX_ENABLED\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\n#endif\n#if defined(DEPTHTEX_ENABLED)\n float centerDepth = getLinearDepth(v_Texcoord);\n#endif\n\n for (int i = 0; i < 5; i++) {\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\n\n float w = kernel[i];\n#ifdef NORMALTEX_ENABLED\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\n#endif\n#ifdef DEPTHTEX_ENABLED\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\n#endif\n\n weightAll += w;\n sum += texture2D(ssaoTexture, coord).r * w;\n }\n\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\n}\n\n@end\n"),SB.prototype.setDepthTexture=function(t){this._depthTex=t},SB.prototype.setNormalTexture=function(t){this._normalTex=t,this._ssaoPass.material[t?"enableTexture":"disableTexture"]("normalTex"),this.setKernelSize(this._kernelSize)},SB.prototype.update=function(t,e,n){var i=t.getWidth(),r=t.getHeight(),o=this._ssaoPass,a=this._blurPass;o.setUniform("kernel",this._kernels[n%this._kernels.length]),o.setUniform("depthTex",this._depthTex),null!=this._normalTex&&o.setUniform("normalTex",this._normalTex),o.setUniform("depthTexSize",[this._depthTex.width,this._depthTex.height]);var s=new nO;nO.transpose(s,e.worldTransform),o.setUniform("projection",e.projectionMatrix.array),o.setUniform("projectionInv",e.invProjectionMatrix.array),o.setUniform("viewInverseTranspose",s.array);var l=this._ssaoTexture,u=this._blurTexture,h=this._blurTexture2;l.width=i/2,l.height=r/2,u.width=i,u.height=r,h.width=i,h.height=r,this._framebuffer.attach(l),this._framebuffer.bind(t),t.gl.clearColor(1,1,1,1),t.gl.clear(t.gl.COLOR_BUFFER_BIT),o.render(t),a.setUniform("textureSize",[i/2,r/2]),a.setUniform("projection",e.projectionMatrix.array),this._framebuffer.attach(u),a.setUniform("direction",0),a.setUniform("ssaoTexture",l),a.render(t),this._framebuffer.attach(h),a.setUniform("textureSize",[i,r]),a.setUniform("direction",1),a.setUniform("ssaoTexture",u),a.render(t),this._framebuffer.unbind(t);var c=t.clearColor;t.gl.clearColor(c[0],c[1],c[2],c[3])},SB.prototype.getTargetTexture=function(){return this._blurTexture2},SB.prototype.setParameter=function(t,e){"noiseTexSize"===t?this.setNoiseSize(e):"kernelSize"===t?this.setKernelSize(e):"intensity"===t?this._ssaoPass.material.set("intensity",e):this._ssaoPass.setUniform(t,e)},SB.prototype.setKernelSize=function(t){this._kernelSize=t,this._ssaoPass.material.define("fragment","KERNEL_SIZE",t),this._kernels=this._kernels||[];for(var e=0;e<30;e++)this._kernels[e]=wB(t,e*t,!!this._normalTex)},SB.prototype.setNoiseSize=function(t){var e=this._ssaoPass.getUniform("noiseTex");e?(e.data=xB(t),e.width=e.height=t,e.dirty()):(e=bB(t),this._ssaoPass.setUniform("noiseTex",bB(t))),this._ssaoPass.setUniform("noiseTexSize",[t,t])},SB.prototype.dispose=function(t){this._blurTexture.dispose(t),this._ssaoTexture.dispose(t),this._blurTexture2.dispose(t)};const TB=SB;function MB(t){t=t||{},this._ssrPass=new OR({fragment:rE.source("ecgl.ssr.main"),clearColor:[0,0,0,0]}),this._blurPass1=new OR({fragment:rE.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blurPass2=new OR({fragment:rE.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blendPass=new OR({fragment:rE.source("clay.compositor.blend")}),this._blendPass.material.disableTexturesAll(),this._blendPass.material.enableTexture(["texture1","texture2"]),this._ssrPass.setUniform("gBufferTexture1",t.normalTexture),this._ssrPass.setUniform("gBufferTexture2",t.depthTexture),this._blurPass1.setUniform("gBufferTexture1",t.normalTexture),this._blurPass1.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.setUniform("gBufferTexture1",t.normalTexture),this._blurPass2.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.material.define("fragment","VERTICAL"),this._blurPass2.material.define("fragment","BLEND"),this._ssrTexture=new BO({type:IO.HALF_FLOAT}),this._texture2=new BO({type:IO.HALF_FLOAT}),this._texture3=new BO({type:IO.HALF_FLOAT}),this._prevTexture=new BO({type:IO.HALF_FLOAT}),this._currentTexture=new BO({type:IO.HALF_FLOAT}),this._frameBuffer=new JN({depthBuffer:!1}),this._normalDistribution=null,this._totalSamples=256,this._samplePerFrame=4,this._ssrPass.material.define("fragment","SAMPLE_PER_FRAME",this._samplePerFrame),this._ssrPass.material.define("fragment","TOTAL_SAMPLES",this._totalSamples),this._downScale=1}rE.import("@export ecgl.ssr.main\n\n#define SHADER_NAME SSR\n#define MAX_ITERATION 20;\n#define SAMPLE_PER_FRAME 5;\n#define TOTAL_SAMPLES 128;\n\nuniform sampler2D sourceTexture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform sampler2D gBufferTexture3;\nuniform samplerCube specularCubemap;\nuniform float specularIntensity: 1;\n\nuniform mat4 projection;\nuniform mat4 projectionInv;\nuniform mat4 toViewSpace;\nuniform mat4 toWorldSpace;\n\nuniform float maxRayDistance: 200;\n\nuniform float pixelStride: 16;\nuniform float pixelStrideZCutoff: 50; \nuniform float screenEdgeFadeStart: 0.9; \nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\n\nuniform float nearZ;\nuniform vec2 viewportSize : VIEWPORT_SIZE;\n\nuniform float jitterOffset: 0;\n\nvarying vec2 v_Texcoord;\n\n#ifdef DEPTH_DECODE\n@import clay.util.decode_float\n#endif\n\n#ifdef PHYSICALLY_CORRECT\nuniform sampler2D normalDistribution;\nuniform float sampleOffset: 0;\nuniform vec2 normalDistributionSize;\n\nvec3 transformNormal(vec3 H, vec3 N) {\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\n return transformNormal(H, N);\n}\nfloat G_Smith(float g, float ndv, float ndl) {\n float roughness = 1.0 - g;\n float k = roughness * roughness / 2.0;\n float G1V = ndv / (ndv * (1.0 - k) + k);\n float G1L = ndl / (ndl * (1.0 - k) + k);\n return G1L * G1V;\n}\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n#endif\n\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\n{\n vec4 depthTexel = texture2D(depthTexture, uv);\n return depthTexel.r * 2.0 - 1.0;\n}\n\nfloat linearDepth(float depth)\n{\n if (projection[3][3] == 0.0) {\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n }\n else {\n return (depth - projection[3][2]) / projection[2][2];\n }\n}\n\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\n{\n if (rayZFar > rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n dPQK *= 1.2;\n\n if (intersect) {\n break;\n }\n }\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import clay.util.rand\n\n@import clay.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n#if !defined(PHYSICALLY_CORRECT)\n if (g <= minGlossiness) {\n discard;\n }\n#endif\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n vec3 V = -normalize(rayOrigin);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n float iterationCount;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n#ifdef PHYSICALLY_CORRECT\n vec4 color = vec4(vec3(0.0), 1.0);\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\n vec3 albedo = albedoMetalness.rgb;\n float m = albedoMetalness.a;\n vec3 diffuseColor = albedo * (1.0 - m);\n vec3 spec = mix(vec3(0.04), albedo, m);\n\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\n\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\n vec3 rayDir = normalize(reflect(-V, H));\n#else\n vec3 rayDir = normalize(reflect(-V, N));\n#endif\n vec2 hitPixel;\n vec3 hitPoint;\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\n#ifdef PHYSICALLY_CORRECT\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\n float vdh = clamp(dot(V, H), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n vec3 litTexel = vec3(0.0);\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\n\n }\n else {\n #ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\n#endif\n }\n color.rgb += ndl * litTexel * (\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\n );\n }\n color.rgb /= float(SAMPLE_PER_FRAME);\n#else\n #if !defined(SPECULARCUBEMAP_ENABLED)\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n if (!intersect) {\n discard;\n }\n#endif\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\n vec4 color = texture2D(sourceTexture, hitPixel);\n color.rgb *= alpha;\n\n#ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n alpha = alpha * (intersect ? 1.0 : 0.0);\n float bias = (1.0 -g) * 5.0;\n color.rgb += (1.0 - alpha)\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\n * specularIntensity;\n#endif\n\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform mat4 projection;\nuniform float depthRange : 0.05;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\n#ifdef BLEND\n #ifdef SSAOTEX_ENABLED\nuniform sampler2D ssaoTex;\n #endif\nuniform sampler2D sourceTexture;\n#endif\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n\n@import clay.util.rgbm\n\n\nvoid main()\n{\n @import clay.compositor.kernel.gaussian_9\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n float cD = getLinearDepth(v_Texcoord);\n for (int i = 0; i < 9; i++) {\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i]\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\n\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n float aoFactor = 1.0;\n #ifdef SSAOTEX_ENABLED\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\n #endif\n gl_FragColor = encodeHDR(\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end"),MB.prototype.setAmbientCubemap=function(t,e){this._ssrPass.material.set("specularCubemap",t),this._ssrPass.material.set("specularIntensity",e);var n=t&&e;this._ssrPass.material[n?"enableTexture":"disableTexture"]("specularCubemap")},MB.prototype.update=function(t,e,n,i){var r=t.getWidth(),o=t.getHeight(),a=this._ssrTexture,s=this._texture2,l=this._texture3;a.width=this._prevTexture.width=this._currentTexture.width=r/this._downScale,a.height=this._prevTexture.height=this._currentTexture.height=o/this._downScale,s.width=l.width=r,s.height=l.height=o;var u=this._frameBuffer,h=this._ssrPass,c=this._blurPass1,d=this._blurPass2,f=this._blendPass,p=new nO,g=new nO;nO.transpose(p,e.worldTransform),nO.transpose(g,e.viewMatrix),h.setUniform("sourceTexture",n),h.setUniform("projection",e.projectionMatrix.array),h.setUniform("projectionInv",e.invProjectionMatrix.array),h.setUniform("toViewSpace",p.array),h.setUniform("toWorldSpace",g.array),h.setUniform("nearZ",e.near);var m=i/this._totalSamples*this._samplePerFrame;if(h.setUniform("jitterOffset",m),h.setUniform("sampleOffset",i*this._samplePerFrame),c.setUniform("textureSize",[a.width,a.height]),d.setUniform("textureSize",[r,o]),d.setUniform("sourceTexture",n),c.setUniform("projection",e.projectionMatrix.array),d.setUniform("projection",e.projectionMatrix.array),u.attach(a),u.bind(t),h.render(t),this._physicallyCorrect&&(u.attach(this._currentTexture),f.setUniform("texture1",this._prevTexture),f.setUniform("texture2",a),f.material.set({weight1:i>=1?.95:0,weight2:i>=1?.05:1}),f.render(t)),u.attach(s),c.setUniform("texture",this._physicallyCorrect?this._currentTexture:a),c.render(t),u.attach(l),d.setUniform("texture",s),d.render(t),u.unbind(t),this._physicallyCorrect){var v=this._prevTexture;this._prevTexture=this._currentTexture,this._currentTexture=v}},MB.prototype.getTargetTexture=function(){return this._texture3},MB.prototype.setParameter=function(t,e){"maxIteration"===t?this._ssrPass.material.define("fragment","MAX_ITERATION",e):this._ssrPass.setUniform(t,e)},MB.prototype.setPhysicallyCorrect=function(t){t?(this._normalDistribution||(this._normalDistribution=kR.generateNormalDistribution(64,this._totalSamples)),this._ssrPass.material.define("fragment","PHYSICALLY_CORRECT"),this._ssrPass.material.set("normalDistribution",this._normalDistribution),this._ssrPass.material.set("normalDistributionSize",[64,this._totalSamples])):this._ssrPass.material.undefine("fragment","PHYSICALLY_CORRECT"),this._physicallyCorrect=t},MB.prototype.setSSAOTexture=function(t){var e=this._blurPass2;t?(e.material.enableTexture("ssaoTex"),e.material.set("ssaoTex",t)):e.material.disableTexture("ssaoTex")},MB.prototype.isFinished=function(t){return!this._physicallyCorrect||t>this._totalSamples/this._samplePerFrame},MB.prototype.dispose=function(t){this._ssrTexture.dispose(t),this._texture2.dispose(t),this._texture3.dispose(t),this._prevTexture.dispose(t),this._currentTexture.dispose(t),this._frameBuffer.dispose(t)};const CB=MB,AB=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925];function LB(t,e,n,i,r){var o=t.gl;e.setUniform(o,"1i",n,r),o.activeTexture(o.TEXTURE0+r),i.isRenderable()?i.bind(t):i.unbind(t)}function DB(t,e,n,i,r){var o,a,s,l,u=t.gl;return function(r,h,c){if(!l||l.material!==r.material){var d=r.material,f=r.__program,p=d.get("roughness");null==p&&(p=1);var g=d.get("normalMap")||e,m=d.get("roughnessMap"),v=d.get("bumpMap"),_=d.get("uvRepeat"),y=d.get("uvOffset"),x=d.get("detailUvRepeat"),b=d.get("detailUvOffset"),w=!!v&&d.isTextureEnabled("bumpMap"),S=!!m&&d.isTextureEnabled("roughnessMap"),T=d.isDefined("fragment","DOUBLE_SIDED");v=v||n,m=m||i,c!==h?(h.set("normalMap",g),h.set("bumpMap",v),h.set("roughnessMap",m),h.set("useBumpMap",w),h.set("useRoughnessMap",S),h.set("doubleSide",T),null!=_&&h.set("uvRepeat",_),null!=y&&h.set("uvOffset",y),null!=x&&h.set("detailUvRepeat",x),null!=b&&h.set("detailUvOffset",b),h.set("roughness",p)):(f.setUniform(u,"1f","roughness",p),o!==g&&LB(t,f,"normalMap",g,0),a!==v&&v&&LB(t,f,"bumpMap",v,1),s!==m&&m&&LB(t,f,"roughnessMap",m,2),null!=_&&f.setUniform(u,"2f","uvRepeat",_),null!=y&&f.setUniform(u,"2f","uvOffset",y),null!=x&&f.setUniform(u,"2f","detailUvRepeat",x),null!=b&&f.setUniform(u,"2f","detailUvOffset",b),f.setUniform(u,"1i","useBumpMap",+w),f.setUniform(u,"1i","useRoughnessMap",+S),f.setUniform(u,"1i","doubleSide",+T)),o=g,a=v,s=m,l=r}}}function IB(t){t=t||{},this._depthTex=new BO({format:IO.DEPTH_COMPONENT,type:IO.UNSIGNED_INT}),this._normalTex=new BO({type:IO.HALF_FLOAT}),this._framebuffer=new JN,this._framebuffer.attach(this._normalTex),this._framebuffer.attach(this._depthTex,JN.DEPTH_ATTACHMENT),this._normalMaterial=new xP({shader:new rE(rE.source("ecgl.normal.vertex"),rE.source("ecgl.normal.fragment"))}),this._normalMaterial.enableTexture(["normalMap","bumpMap","roughnessMap"]),this._defaultNormalMap=SR.createBlank("#000"),this._defaultBumpMap=SR.createBlank("#000"),this._defaultRoughessMap=SR.createBlank("#000"),this._debugPass=new OR({fragment:rE.source("clay.compositor.output")}),this._debugPass.setUniform("texture",this._normalTex),this._debugPass.material.undefine("fragment","OUTPUT_ALPHA")}rE.import("@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end"),IB.prototype.getDepthTexture=function(){return this._depthTex},IB.prototype.getNormalTexture=function(){return this._normalTex},IB.prototype.update=function(t,e,n){var i=t.getWidth(),r=t.getHeight(),o=this._depthTex,a=this._normalTex,s=this._normalMaterial;o.width=i,o.height=r,a.width=i,a.height=r;var l=e.getRenderList(n).opaque;this._framebuffer.bind(t),t.gl.clearColor(0,0,0,0),t.gl.clear(t.gl.COLOR_BUFFER_BIT|t.gl.DEPTH_BUFFER_BIT),t.gl.disable(t.gl.BLEND),t.renderPass(l,n,{getMaterial:function(){return s},ifRender:function(t){return t.renderNormal},beforeRender:DB(t,this._defaultNormalMap,this._defaultBumpMap,this._defaultRoughessMap,this._normalMaterial),sort:t.opaqueSortCompare}),this._framebuffer.unbind(t)},IB.prototype.renderDebug=function(t){this._debugPass.render(t)},IB.prototype.dispose=function(t){this._depthTex.dispose(t),this._normalTex.dispose(t)};const PB=IB;function EB(t){t=t||{},this._edgePass=new OR({fragment:rE.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",t.normalTexture),this._edgePass.setUniform("depthTexture",t.depthTexture),this._targetTexture=new BO({type:IO.HALF_FLOAT}),this._frameBuffer=new JN,this._frameBuffer.attach(this._targetTexture)}EB.prototype.update=function(t,e,n,i){var r=t.getWidth(),o=t.getHeight(),a=this._targetTexture;a.width=r,a.height=o;var s=this._frameBuffer;s.bind(t),this._edgePass.setUniform("projectionInv",e.invProjectionMatrix.array),this._edgePass.setUniform("textureSize",[r,o]),this._edgePass.setUniform("texture",n),this._edgePass.render(t),s.unbind(t)},EB.prototype.getTargetTexture=function(){return this._targetTexture},EB.prototype.setParameter=function(t,e){this._edgePass.setUniform(t,e)},EB.prototype.dispose=function(t){this._targetTexture.dispose(t),this._frameBuffer.dispose(t)};const OB=EB,NB={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(clay.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(clay.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_8_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_4_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_2_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bloom_composite",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(clay.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},defines:{}},{name:"FXAA",shader:"#source(clay.compositor.fxaa)",inputs:{texture:"composite"}}]};function RB(t,e){return{color:{parameters:{width:t,height:e}}}}rE.import(nB),rE.import(iB),rE.import(rB),rE.import(oB),rE.import(aB),rE.import(sB),rE.import(lB),rE.import(uB),rE.import(hB),rE.import("@export ecgl.dof.coc\n\nuniform sampler2D depth;\n\nuniform float zNear: 0.1;\nuniform float zFar: 2000;\n\nuniform float focalDistance: 3;\nuniform float focalRange: 1;\nuniform float focalLength: 30;\nuniform float fstop: 2.8;\n\nvarying vec2 v_Texcoord;\n\n@import clay.util.encode_float\n\nvoid main()\n{\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\n\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\n\n float aperture = focalLength / fstop;\n\n float coc;\n\n float uppper = focalDistance + focalRange;\n float lower = focalDistance - focalRange;\n if (dist <= uppper && dist >= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import clay.util.rgbm\n@import clay.util.float\n\nvoid main()\n{\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\n vec4 originalColor = texture2D(original, v_Texcoord);\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import clay.util.rgbm\n@import clay.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = texel;\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n texel.rgb *= texel.a;\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n color.rgb /= (color.a + 0.0001);\n gl_FragColor = color;\n#endif\n}\n\n@end"),rE.import("@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end");var kB=["composite","FXAA"];function zB(){this._width,this._height,this._dpr,this._sourceTexture=new BO({type:IO.HALF_FLOAT}),this._depthTexture=new BO({format:IO.DEPTH_COMPONENT,type:IO.UNSIGNED_INT}),this._framebuffer=new JN,this._framebuffer.attach(this._sourceTexture),this._framebuffer.attach(this._depthTexture,JN.DEPTH_ATTACHMENT),this._normalPass=new PB,this._compositor=_B(NB);var t=this._compositor.getNodeByName("source");t.texture=this._sourceTexture;var e=this._compositor.getNodeByName("coc");this._sourceNode=t,this._cocNode=e,this._compositeNode=this._compositor.getNodeByName("composite"),this._fxaaNode=this._compositor.getNodeByName("FXAA"),this._dofBlurNodes=["dof_far_blur","dof_near_blur","dof_coc_blur"].map((function(t){return this._compositor.getNodeByName(t)}),this),this._dofBlurKernel=0,this._dofBlurKernelSize=new Float32Array(0),this._finalNodesChain=kB.map((function(t){return this._compositor.getNodeByName(t)}),this);var n={normalTexture:this._normalPass.getNormalTexture(),depthTexture:this._normalPass.getDepthTexture()};this._ssaoPass=new TB(n),this._ssrPass=new CB(n),this._edgePass=new OB(n)}zB.prototype.resize=function(t,e,n){t*=n=n||1,e*=n;var i=this._sourceTexture,r=this._depthTexture;i.width=t,i.height=e,r.width=t,r.height=e;var o={getWidth:function(){return t},getHeight:function(){return e},getDevicePixelRatio:function(){return n}};function a(t,e){if("function"==typeof t[e]){var n=t[e].__original||t[e];t[e]=function(t){return n.call(this,o)},t[e].__original=n}}this._compositor.nodes.forEach((function(t){for(var e in t.outputs){var n=t.outputs[e].parameters;n&&(a(n,"width"),a(n,"height"))}for(var i in t.parameters)a(t.parameters,i)})),this._width=t,this._height=e,this._dpr=n},zB.prototype.getWidth=function(){return this._width},zB.prototype.getHeight=function(){return this._height},zB.prototype._ifRenderNormalPass=function(){return this._enableSSAO||this._enableEdge||this._enableSSR},zB.prototype._getPrevNode=function(t){for(var e=kB.indexOf(t.name)-1,n=this._finalNodesChain[e];n&&!this._compositor.getNodeByName(n.name);)e-=1,n=this._finalNodesChain[e];return n},zB.prototype._getNextNode=function(t){for(var e=kB.indexOf(t.name)+1,n=this._finalNodesChain[e];n&&!this._compositor.getNodeByName(n.name);)e+=1,n=this._finalNodesChain[e];return n},zB.prototype._addChainNode=function(t){var e=this._getPrevNode(t),n=this._getNextNode(t);e&&(t.inputs.texture=e.name,n?(t.outputs=RB(this.getWidth.bind(this),this.getHeight.bind(this)),n.inputs.texture=t.name):t.outputs=null,this._compositor.addNode(t))},zB.prototype._removeChainNode=function(t){var e=this._getPrevNode(t),n=this._getNextNode(t);e&&(n?(e.outputs=RB(this.getWidth.bind(this),this.getHeight.bind(this)),n.inputs.texture=e.name):e.outputs=null,this._compositor.removeNode(t))},zB.prototype.updateNormal=function(t,e,n,i){this._ifRenderNormalPass()&&this._normalPass.update(t,e,n)},zB.prototype.updateSSAO=function(t,e,n,i){this._ssaoPass.update(t,n,i)},zB.prototype.enableSSAO=function(){this._enableSSAO=!0},zB.prototype.disableSSAO=function(){this._enableSSAO=!1},zB.prototype.enableSSR=function(){this._enableSSR=!0},zB.prototype.disableSSR=function(){this._enableSSR=!1},zB.prototype.getSSAOTexture=function(){return this._ssaoPass.getTargetTexture()},zB.prototype.getSourceFrameBuffer=function(){return this._framebuffer},zB.prototype.getSourceTexture=function(){return this._sourceTexture},zB.prototype.disableFXAA=function(){this._removeChainNode(this._fxaaNode)},zB.prototype.enableFXAA=function(){this._addChainNode(this._fxaaNode)},zB.prototype.enableBloom=function(){this._compositeNode.inputs.bloom="bloom_composite",this._compositor.dirty()},zB.prototype.disableBloom=function(){this._compositeNode.inputs.bloom=null,this._compositor.dirty()},zB.prototype.enableDOF=function(){this._compositeNode.inputs.texture="dof_composite",this._compositor.dirty()},zB.prototype.disableDOF=function(){this._compositeNode.inputs.texture="source",this._compositor.dirty()},zB.prototype.enableColorCorrection=function(){this._compositeNode.define("COLOR_CORRECTION"),this._enableColorCorrection=!0},zB.prototype.disableColorCorrection=function(){this._compositeNode.undefine("COLOR_CORRECTION"),this._enableColorCorrection=!1},zB.prototype.enableEdge=function(){this._enableEdge=!0},zB.prototype.disableEdge=function(){this._enableEdge=!1},zB.prototype.setBloomIntensity=function(t){this._compositeNode.setParameter("bloomIntensity",t)},zB.prototype.setSSAOParameter=function(t,e){switch(t){case"quality":var n={low:6,medium:12,high:32,ultra:62}[e]||12;this._ssaoPass.setParameter("kernelSize",n);break;case"radius":this._ssaoPass.setParameter(t,e),this._ssaoPass.setParameter("bias",e/200);break;case"intensity":this._ssaoPass.setParameter(t,e)}},zB.prototype.setDOFParameter=function(t,e){switch(t){case"focalDistance":case"focalRange":case"fstop":this._cocNode.setParameter(t,e);break;case"blurRadius":for(var n=0;n=this._haltonSequence.length},render:function(t,e,n){var i=this._blendPass;0===this._frame?(i.setUniform("weight1",0),i.setUniform("weight2",1)):(i.setUniform("weight1",.9),i.setUniform("weight2",.1)),i.setUniform("texture1",this._prevFrameTex),i.setUniform("texture2",e||this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(t),i.render(t),this._blendFb.unbind(t),n||(this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(t));var r=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=r,this._frame++},dispose:function(t){this._sourceFb.dispose(t),this._blendFb.dispose(t),this._prevFrameTex.dispose(t),this._outputTex.dispose(t),this._sourceTex.dispose(t),this._outputPass.dispose(t),this._blendPass.dispose(t)}};const HB=FB;function VB(t){t=t||"perspective",this.layer=null,this.scene=new EN,this.rootNode=this.scene,this.viewport={x:0,y:0,width:0,height:0},this.setProjection(t),this._compositor=new BB,this._temporalSS=new HB,this._shadowMapPass=new qz;for(var e=[],n=0,i=0;i<30;i++){for(var r=[],o=0;o<6;o++)r.push(4*yB(n,2)-2),r.push(4*yB(n,3)-2),n++;e.push(r)}this._pcfKernels=e,this.scene.on("beforerender",(function(t,e,n){this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,n)}),this)}VB.prototype.setProjection=function(t){var e=this.camera;e&&e.update(),"perspective"===t?this.camera instanceof FN||(this.camera=new FN,e&&this.camera.setLocalTransform(e.localTransform)):this.camera instanceof DR||(this.camera=new DR,e&&this.camera.setLocalTransform(e.localTransform)),this.camera.near=.1,this.camera.far=2e3},VB.prototype.setViewport=function(t,e,n,i,r){this.camera instanceof FN&&(this.camera.aspect=n/i),r=r||1,this.viewport.x=t,this.viewport.y=e,this.viewport.width=n,this.viewport.height=i,this.viewport.devicePixelRatio=r,this._compositor.resize(n*r,i*r),this._temporalSS.resize(n*r,i*r)},VB.prototype.containPoint=function(t,e){var n=this.viewport;return e=this.layer.renderer.getHeight()-e,t>=n.x&&e>=n.y&&t<=n.x+n.width&&e<=n.y+n.height};var GB=new DP;VB.prototype.castRay=function(t,e,n){var i=this.layer.renderer,r=i.viewport;return i.viewport=this.viewport,i.screenToNDC(t,e,GB),this.camera.castRay(GB,n),i.viewport=r,n},VB.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this.scene.updateLights();var t=this.scene.updateRenderList(this.camera);this._needsSortProgressively=!1;for(var e=0;e30},VB.prototype._doRender=function(t,e,n){var i=this.scene,r=this.camera;n=n||0,this._updateTransparent(t,i,r,n),e||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(t,i,r,!0)),this._updateShadowPCFKernel(n);var o,a=t.clearColor;(t.gl.clearColor(a[0],a[1],a[2],a[3]),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,r),this._compositor.updateNormal(t,i,r,this._temporalSS.getFrame())),this._updateSSAO(t,i,r,this._temporalSS.getFrame()),this._enablePostEffect)?((o=this._compositor.getSourceFrameBuffer()).bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),t.render(i,r,!0,!0),o.unbind(t),this.needsTemporalSS()&&e?(this._compositor.composite(t,i,r,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),this._compositor.composite(t,i,r,null,0))):this.needsTemporalSS()&&e?((o=this._temporalSS.getSourceFrameBuffer()).bind(t),t.saveClear(),t.clearBit=t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT,t.render(i,r,!0,!0),t.restoreClear(),o.unbind(t),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),t.render(i,r,!0,!0))},VB.prototype._updateTransparent=function(t,e,n,i){for(var r=new IE,o=new nO,a=n.getWorldPosition(),s=e.getRenderList(n).transparent,l=0;lthis.camera.far||t80*n){i=o=t[0],r=a=t[1];for(var p=n;po&&(o=s),l>a&&(a=l);u=Math.max(o-i,a-r)}return cF(d,f,n,i,r,u),f}function uF(t,e,n,i,r){var o,a;if(r===IF(t,e,n,i)>0)for(o=e;o=e;o-=i)a=AF(o,t[o],t[o+1],a);return a&&SF(a,a.next)&&(LF(a),a=a.next),a}function hF(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=!1,i.steiner||!SF(i,i.next)&&0!==wF(i.prev,i,i.next))i=i.next;else{if(LF(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function cF(t,e,n,i,r,o,a){if(t){!a&&o&&function(t,e,n,i){var r=t;do{null===r.z&&(r.z=_F(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,a,s,l,u=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,u*=2}while(a>1)}(r)}(t,i,r,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?fF(t,i,r,o):dF(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),LF(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?cF(t=pF(t,e,n),e,n,i,r,o,2):2===a&&gF(t,e,n,i,r,o):cF(hF(t),e,n,i,r,o,1);break}}}function dF(t){var e=t.prev,n=t,i=t.next;if(wF(e,n,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(xF(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&wF(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function fF(t,e,n,i){var r=t.prev,o=t,a=t.next;if(wF(r,o,a)>=0)return!1;for(var s=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,h=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,c=_F(s,l,e,n,i),d=_F(u,h,e,n,i),f=t.nextZ;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&xF(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&wF(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&xF(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&wF(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function pF(t,e,n){var i=t;do{var r=i.prev,o=i.next.next;!SF(r,o)&&TF(r,i,i.next,o)&&MF(r,o)&&MF(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),LF(i),LF(i.next),i=t=o),i=i.next}while(i!==t);return i}function gF(t,e,n,i,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&bF(a,s)){var l=CF(a,s);return a=hF(a,a.next),l=hF(l,l.next),cF(a,e,n,i,r,o),void cF(l,e,n,i,r,o)}s=s.next}a=a.next}while(a!==t)}function mF(t,e){return t.x-e.x}function vF(t,e){if(e=function(t,e){var n,i=e,r=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x=i.x&&i.x>=h&&r!==i.x&&xF(on.x)&&MF(i,t)&&(n=i,d=l),i=i.next;return n}(t,e),e){var n=CF(e,t);hF(n,n.next)}}function _F(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function yF(t){var e=t,n=t;do{e.x=0&&(t-a)*(i-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function bF(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&TF(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&MF(t,e)&&MF(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)}function wF(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function SF(t,e){return t.x===e.x&&t.y===e.y}function TF(t,e,n,i){return!!(SF(t,e)&&SF(n,i)||SF(t,i)&&SF(n,e))||wF(t,e,n)>0!=wF(t,e,i)>0&&wF(n,i,t)>0!=wF(n,i,e)>0}function MF(t,e){return wF(t.prev,t,t.next)<0?wF(t,e,t.next)>=0&&wF(t,t.prev,e)>=0:wF(t,e,t.prev)<0||wF(t,t.next,e)<0}function CF(t,e){var n=new DF(t.i,t.x,t.y),i=new DF(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function AF(t,e,n,i){var r=new DF(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function LF(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function DF(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function IF(t,e,n,i){for(var r=0,o=e,a=n-i;ol&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u});var u;l=o[a].pivot+1;(u=o[a].right)>l&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u})}o=this._parts=s}else for(a=0;a=2e4},doSortTriangles:function(t,e){var n=this.indices;if(0===e){var i=this.attributes.position;t=t.array;this._triangleZList&&this._triangleZList.length===this.triangleCount||(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new n.constructor(n.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var r,o=0,a=0;a0,n={},i=0;i65535?new Uint32Array(3*a):new Uint16Array(3*a),d.material.shader!==e&&d.material.attachShader(e,!0),Lk.setMaterialFromModel(e.__shading,d.material,t,n),s>0&&(this._linesMesh.geometry.resetOffset(),this._linesMesh.geometry.setVertexCount(s),this._linesMesh.geometry.setTriangleCount(l)),this._dataIndexOfVertex=new Uint32Array(o),this._vertexRangeOfDataIndex=new Uint32Array(2*(r-i))},_updateRegionMesh:function(t,e,n,i){for(var r=t.getData(),o=0,a=0,s=!1,l=this._polygonMesh,u=this._linesMesh,h=n;h0;w&&(b*=e.getDevicePixelRatio(),this._updateLinesGeometry(u.geometry,t,h,_,b,t.coordinateSystem.transform)),u.invisible=!w,u.material.set({color:m})}(l=this._polygonMesh).material.transparent=s,l.material.depthMask=!s,l.geometry.updateBoundingBox(),l.frontFace=this.extrudeY?Lk.Mesh.CCW:Lk.Mesh.CW,l.material.get("normalMap")&&l.geometry.generateTangents(),l.seriesIndex=t.seriesIndex,l.on("mousemove",this._onmousemove,this),l.on("mouseout",this._onmouseout,this)},_updateDebugWireframe:function(t){var e=t.getModel("debug.wireframe");if(e.get("show")){var n=Lk.parseColor(e.get("lineStyle.color")||"rgba(0,0,0,0.5)"),i=XR.firstNotNull(e.get("lineStyle.width"),1),r=this._polygonMesh;r.geometry.generateBarycentric(),r.material.define("both","WIREFRAME_TRIANGLE"),r.material.set("wireframeLineColor",n),r.material.set("wireframeLineWidth",i)}},_onmousemove:function(t){var e=this._dataIndexOfVertex[t.triangle[0]];null==e&&(e=-1),e!==this._lastHoverDataIndex&&(this.downplay(this._lastHoverDataIndex),this.highlight(e),this._labelsBuilder.updateLabels([e])),this._lastHoverDataIndex=e,this._polygonMesh.dataIndex=e},_onmouseout:function(t){t.target&&(this.downplay(this._lastHoverDataIndex),this._lastHoverDataIndex=-1,this._polygonMesh.dataIndex=-1),this._labelsBuilder.updateLabels([])},_updateGroundPlane:function(t,e,n){var i=t.getModel("groundPlane",t);if(this._groundMesh.invisible=!i.get("show",!0),!this._groundMesh.invisible){var r=t.get("shading"),o=this._groundMaterials[r];o||(o=this._groundMaterials.lambert),Lk.setMaterialFromModel(r,o,i,n),o.get("normalMap")&&this._groundMesh.geometry.generateTangents(),this._groundMesh.material=o,this._groundMesh.material.set("color",Lk.parseColor(i.get("color"))),this._groundMesh.scale.set(e.size[0],e.size[2],1)}},_triangulation:function(t,e,n){this._triangulationResults=[];for(var i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0],o=t.coordinateSystem,a=e;a1?i:0,I[H][m]=C.points[G+2],l.set(r+H,I[H]),s?(N[0]=(C.points[G]*v[0]-_[0])/x,N[1]=(C.points[G+2]*v[m]-_[m])/x):(N[0]=(V?R:R+F)/x,N[1]=(I[H][g]*v[g]-_[g])/x),h.set(r+H,N)}jF.sub(P,I[1],I[0]),jF.sub(E,I[3],I[0]),jF.cross(O,P,E),jF.normalize(O,O);for(H=0;H<4;H++)u.set(r+H,O),f&&c.set(r+H,a);for(H=0;H<6;H++)p[3*o+H]=D[H]+r;r+=4,o+=2,R+=F}}return e.dirty(),{vertexOffset:r,triangleOffset:o}},_getRegionLinesInfo:function(t,e,n){var i=0,r=0;e.getRegionModel(t).getModel("itemStyle").get("borderWidth")>0&&e.getRegionPolygonCoords(t).forEach((function(t){var e=t.exterior,o=t.interiors;i+=n.getPolylineVertexCount(e),r+=n.getPolylineTriangleCount(e);for(var a=0;athis._endIndex)){e-=this._startIndex;for(var i=this._vertexRangeOfDataIndex[2*e];i0},_displacementChanged:!0,_displacementScale:0,updateDisplacementHash:function(){var t=this.getDisplacementTexture(),e=this.getDisplacemenScale();this._displacementChanged=this._displacementTexture!==t||this._displacementScale!==e,this._displacementTexture=t,this._displacementScale=e},isDisplacementChanged:function(){return this._displacementChanged}});P.merge(uH.prototype,Vk),P.merge(uH.prototype,Gk),P.merge(uH.prototype,Uk),P.merge(uH.prototype,iF);const hH=uH;var cH=Math.PI,dH=Math.sin,fH=Math.cos,pH=Math.tan,gH=Math.asin,mH=Math.atan2,vH=cH/180;var _H=23.4397*vH;function yH(t,e){return mH(dH(t)*fH(_H)-pH(e)*dH(_H),fH(t))}function xH(t,e,n){return mH(dH(t),fH(t)*dH(e)-pH(n)*fH(e))}function bH(t,e,n){return gH(dH(e)*dH(n)+fH(e)*fH(n)*fH(t))}function wH(t){var e,n,i=function(t){return vH*(357.5291+.98560028*t)}(t),r=function(t){return t+vH*(1.9148*dH(t)+.02*dH(2*t)+3e-4*dH(3*t))+102.9372*vH+cH}(i);return{dec:(e=r,n=0,gH(dH(n)*fH(_H)+fH(n)*dH(_H)*dH(e))),ra:yH(r,0)}}var SH={};SH.getPosition=function(t,e,n){var i=vH*-n,r=vH*e,o=function(t){return function(t){return t.valueOf()/864e5-.5+2440588}(t)-2451545}(t),a=wH(o),s=function(t,e){return vH*(280.16+360.9856235*t)-e}(o,i)-a.ra;return{azimuth:xH(s,r,a.dec),altitude:bH(s,r,a.dec)}};const TH=SH;Lk.Shader.import(xk),Lk.Shader.import("@export ecgl.atmosphere.vertex\nattribute vec3 position: POSITION;\nattribute vec3 normal : NORMAL;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 normalMatrix : WORLDINVERSETRANSPOSE;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n v_Normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end\n\n\n@export ecgl.atmosphere.fragment\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform float glowPower;\nuniform vec3 glowColor;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n float intensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor = vec4(glowColor, intensity * intensity);\n}\n@end");const MH=Od.extend({type:"globe",__ecgl__:!0,_displacementScale:0,init:function(t,e){this.groupGL=new Lk.Node,this._sphereGeometry=new Lk.SphereGeometry({widthSegments:200,heightSegments:100,dynamic:!0}),this._overlayGeometry=new Lk.SphereGeometry({widthSegments:80,heightSegments:40}),this._planeGeometry=new Lk.PlaneGeometry,this._earthMesh=new Lk.Mesh({renderNormal:!0}),this._atmosphereMesh=new Lk.Mesh,this._atmosphereGeometry=new Lk.SphereGeometry({widthSegments:80,heightSegments:40}),this._atmosphereMaterial=new Lk.Material({shader:new Lk.Shader(Lk.Shader.source("ecgl.atmosphere.vertex"),Lk.Shader.source("ecgl.atmosphere.fragment")),transparent:!0}),this._atmosphereMesh.geometry=this._atmosphereGeometry,this._atmosphereMesh.material=this._atmosphereMaterial,this._atmosphereMesh.frontFace=Lk.Mesh.CW,this._lightRoot=new Lk.Node,this._sceneHelper=new sz,this._sceneHelper.initLight(this._lightRoot),this.groupGL.add(this._atmosphereMesh),this.groupGL.add(this._earthMesh),this._control=new Kk({zr:e.getZr()}),this._control.init(),this._layerMeshes={}},render:function(t,e,n){var i=t.coordinateSystem,r=t.get("shading");i.viewGL.add(this._lightRoot),t.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL),this._sceneHelper.setScene(i.viewGL.scene),i.viewGL.setPostEffect(t.getModel("postEffect"),n),i.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling"));var o=this._earthMesh;o.geometry=this._sphereGeometry;var a="ecgl."+r;o.material&&o.material.shader.name===a||(o.material=Lk.createMaterial(a)),Lk.setMaterialFromModel(r,o.material,t,n),["roughnessMap","metalnessMap","detailMap","normalMap"].forEach((function(t){var e=o.material.get(t);e&&(e.flipY=!1)})),o.material.set("color",Lk.parseColor(t.get("baseColor")));var s=.99*i.radius;if(o.scale.set(s,s,s),t.get("atmosphere.show")){o.material.define("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!1,this._atmosphereMaterial.setUniforms({glowPower:t.get("atmosphere.glowPower")||6,glowColor:t.get("atmosphere.color")||"#ffffff"}),o.material.setUniforms({glowPower:t.get("atmosphere.innerGlowPower")||2,glowColor:t.get("atmosphere.color")||"#ffffff"});var l=t.get("atmosphere.offset")||5;this._atmosphereMesh.scale.set(s+l,s+l,s+l)}else o.material.undefine("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!0;var u=o.material.setTextureImage("diffuseMap",t.get("baseTexture"),n,{flipY:!1,anisotropic:8});u&&u.surface&&u.surface.attachToMesh(o);var h=o.material.setTextureImage("bumpMap",t.get("heightTexture"),n,{flipY:!1,anisotropic:8});h&&h.surface&&h.surface.attachToMesh(o),o.material[t.get("postEffect.enable")?"define":"undefine"]("fragment","SRGB_DECODE"),this._updateLight(t,n),this._displaceVertices(t,n),this._updateViewControl(t,n),this._updateLayers(t,n)},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n)},_updateLayers:function(t,e){var n=t.coordinateSystem,i=t.get("layers"),r=n.radius,o=[],a=[],s=[],l=[];P.each(i,(function(t){var i=new zl(t),u=i.get("type"),h=Lk.loadTexture(i.get("texture"),e,{flipY:!1,anisotropic:8});if(h.surface&&h.surface.attachToMesh(this._earthMesh),"blend"===u){var c=i.get("blendTo"),d=XR.firstNotNull(i.get("intensity"),1);"emission"===c?(s.push(h),l.push(d)):(o.push(h),a.push(d))}else{var f=i.get("id"),p=this._layerMeshes[f];p||(p=this._layerMeshes[f]=new Lk.Mesh({geometry:this._overlayGeometry,castShadow:!1,ignorePicking:!0})),"lambert"===i.get("shading")?(p.material=p.__lambertMaterial||new Lk.Material({autoUpdateTextureStatus:!1,shader:Lk.createShader("ecgl.lambert"),transparent:!0,depthMask:!1}),p.__lambertMaterial=p.material):(p.material=p.__colorMaterial||new Lk.Material({autoUpdateTextureStatus:!1,shader:Lk.createShader("ecgl.color"),transparent:!0,depthMask:!1}),p.__colorMaterial=p.material),p.material.enableTexture("diffuseMap");var g=i.get("distance"),m=r+(null==g?n.radius/100:g);p.scale.set(m,m,m),r=m;var v=this._blankTexture||(this._blankTexture=Lk.createBlankTexture("rgba(255, 255, 255, 0)"));p.material.set("diffuseMap",v),Lk.loadTexture(i.get("texture"),e,{flipY:!1,anisotropic:8},(function(t){t.surface&&t.surface.attachToMesh(p),p.material.set("diffuseMap",t),e.getZr().refresh()})),i.get("show")?this.groupGL.add(p):this.groupGL.remove(p)}}),this);var u=this._earthMesh.material;u.define("fragment","LAYER_DIFFUSEMAP_COUNT",o.length),u.define("fragment","LAYER_EMISSIVEMAP_COUNT",s.length),u.set("layerDiffuseMap",o),u.set("layerDiffuseIntensity",a),u.set("layerEmissiveMap",s),u.set("layerEmissionIntensity",l);var h=t.getModel("debug.wireframe");if(h.get("show")){u.define("both","WIREFRAME_TRIANGLE");var c=Lk.parseColor(h.get("lineStyle.color")||"rgba(0,0,0,0.5)"),d=XR.firstNotNull(h.get("lineStyle.width"),1);u.set("wireframeLineWidth",d),u.set("wireframeLineColor",c)}else u.undefine("both","WIREFRAME_TRIANGLE")},_updateViewControl:function(t,e){var n=t.coordinateSystem,i=t.getModel("viewControl"),r=(n.viewGL.camera,this);var o=this._control;o.setViewGL(n.viewGL);var a,s,l=i.get("targetCoord");null!=l&&(s=l[0]+90,a=l[1]),o.setFromViewControlModel(i,{baseDistance:n.radius,alpha:a,beta:s}),o.off("update"),o.on("update",(function(){e.dispatchAction({type:"globeChangeCamera",alpha:o.getAlpha(),beta:o.getBeta(),distance:o.getDistance()-n.radius,center:o.getCenter(),from:r.uid,globeId:t.id})}))},_displaceVertices:function(t,e){var n=t.get("displacementQuality"),i=t.get("debug.wireframe.show"),r=t.coordinateSystem;if(t.isDisplacementChanged()||n!==this._displacementQuality||i!==this._showDebugWireframe){this._displacementQuality=n,this._showDebugWireframe=i;var o=this._sphereGeometry,a={low:100,medium:200,high:400,ultra:800}[n]||200,s=a/2;(o.widthSegments!==a||i)&&(o.widthSegments=a,o.heightSegments=s,o.build()),this._doDisplaceVertices(o,r),i&&o.generateBarycentric()}},_doDisplaceVertices:function(t,e){var n=t.attributes.position.value,i=t.attributes.texcoord0.value,r=t.__originalPosition;r&&r.length===n.length||((r=new Float32Array(n.length)).set(n),t.__originalPosition=r);for(var o=e.displacementWidth,a=e.displacementHeight,s=e.displacementData,l=0;l50&&(o=1e3);var a=[];VH.perspective(a,UH,this.width/this.height,1,o),this.viewGL.camera.projectionMatrix.setArray(a),this.viewGL.camera.decomposeProjectionMatrix();a=VH.identity([]);var s=this.dataToPoint(this.center);VH.scale(a,a,[1,-1,1]),VH.translate(a,a,[0,0,-t]),VH.rotateX(a,a,e),VH.rotateZ(a,a,-this.bearing/180*Math.PI),VH.translate(a,a,[-s[0]*this.getScale()*jH,-s[1]*this.getScale()*jH,0]),this.viewGL.camera.viewMatrix.array=a;var l=[];VH.invert(l,a),this.viewGL.camera.worldTransform.array=l,this.viewGL.camera.decomposeWorldTransform();var u,h=GH*this.getScale();if(this.altitudeExtent&&!isNaN(this.boxHeight)){var c=this.altitudeExtent[1]-this.altitudeExtent[0];u=this.boxHeight/c*this.getScale()/Math.pow(2,this._initialZoom-this.zoomOffset)}else u=h/(2*Math.PI*6378e3*Math.abs(Math.cos(this.center[1]*(Math.PI/180))))*this.altitudeScale*jH;this.viewGL.rootNode.scale.set(this.getScale()*jH,this.getScale()*jH,u)}},getScale:function(){return Math.pow(2,this.zoom-this.zoomOffset)},projectOnTile:function(t,e){return this.projectOnTileWithScale(t,this.getScale()*GH,e)},projectOnTileWithScale:function(t,e,n){var i=t[0],r=t[1]*WH/180,o=e*(i*WH/180+WH)/(2*WH),a=e*(WH-Math.log(Math.tan(WH/4+.5*r)))/(2*WH);return(n=n||[])[0]=o,n[1]=a,n},unprojectFromTile:function(t,e){return this.unprojectOnTileWithScale(t,this.getScale()*GH,e)},unprojectOnTileWithScale:function(t,e,n){var i=t[0],r=t[1],o=i/e*(2*WH)-WH,a=2*(Math.atan(Math.exp(WH-r/e*(2*WH)))-WH/4);return(n=n||[])[0]=180*o/WH,n[1]=180*a/WH,n},dataToPoint:function(t,e){return(e=this.projectOnTileWithScale(t,GH,e))[0]-=this._origin[0],e[1]-=this._origin[1],e[2]=isNaN(t[2])?0:t[2],isNaN(t[2])||(e[2]=t[2],this.altitudeExtent&&(e[2]-=this.altitudeExtent[0])),e}};const XH=ZH;function qH(){XH.apply(this,arguments)}qH.prototype=new XH,qH.prototype.constructor=qH,qH.prototype.type="mapbox3D";function YH(t,e,n){function i(t,e){var n=e.getWidth(),i=e.getHeight(),r=e.getDevicePixelRatio();this.viewGL.setViewport(0,0,n,i,r),this.width=n,this.height=i,this.altitudeScale=t.get("altitudeScale"),this.boxHeight=t.get("boxHeight")}function r(t,e){if("auto"!==this.model.get("boxHeight")){var n=[1/0,-1/0];t.eachSeries((function(t){if(t.coordinateSystem===this){var e=t.getData(),i=t.coordDimToDataDim("alt")[0];if(i){var r=e.getDataExtent(i,!0);n[0]=Math.min(n[0],r[0]),n[1]=Math.max(n[1],r[1])}}}),this),n&&isFinite(n[1]-n[0])&&(this.altitudeExtent=n)}}return{dimensions:e.prototype.dimensions,create:function(o,a){var s=[];return o.eachComponent(t,(function(t){var n=t.__viewGL;n||(n=t.__viewGL=new UB).setRootNode(new Lk.Node);var o=new e;o.viewGL=t.__viewGL,o.resize=i,o.resize(t,a),s.push(o),t.coordinateSystem=o,o.model=t,o.update=r})),o.eachSeries((function(e){if(e.get("coordinateSystem")===t){var n=e.getReferringComponents(t).models[0];if(n||(n=o.getComponent(t)),!n)throw new Error(t+' "'+XR.firstNotNull(e.get(t+"Index"),e.get(t+"Id"),0)+'" not found');e.coordinateSystem=n.coordinateSystem}})),n&&n(s,o,a),s}}}const KH=YH("mapbox3D",qH,(function(t){t.forEach((function(t){t.setCameraOption(t.model.getMapboxCameraOption())}))}));rx((function(t){t.registerComponentModel(RH),t.registerComponentView(HH),t.registerCoordinateSystem("mapbox3D",KH),t.registerAction({type:"mapbox3DChangeCamera",event:"mapbox3dcamerachanged",update:"mapbox3D:updateCamera"},(function(t,e){e.eachComponent({mainType:"mapbox3D",query:t},(function(e){e.setMapboxCameraOption(t)}))}))}));var JH=["zoom","center","pitch","bearing"],$H=Zu.extend({type:"maptalks3D",layoutMode:"box",coordinateSystem:null,defaultOption:{zlevel:-10,urlTemplate:"http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",attribution:'© OpenStreetMap contributors, © CARTO',center:[0,0],zoom:0,pitch:0,bearing:0,light:{main:{alpha:20,beta:30}},altitudeScale:1,boxHeight:"auto"},getMaptalksCameraOption:function(){var t=this;return JH.reduce((function(e,n){return e[n]=t.get(n),e}),{})},setMaptalksCameraOption:function(t){null!=t&&JH.forEach((function(e){null!=t[e]&&(this.option[e]=t[e])}),this)},getMaptalks:function(){return this._maptalks},setMaptalks:function(t){this._maptalks=t}});P.merge($H.prototype,Gk),P.merge($H.prototype,Uk);const QH=$H;function tV(t,e,n,i){if(this.id=t,this.zr=e,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute;left:0;right:0;top:0;bottom:0;",!maptalks)throw new Error("Maptalks library must be included. See https://maptalks.org");this._maptalks=new maptalks.Map(this.dom,{center:n,zoom:i,doubleClickZoom:!1,fog:!1}),this._initEvents()}tV.prototype.setUnpainted=function(){},tV.prototype.resize=function(){this._maptalks.checkSize()},tV.prototype.getMaptalks=function(){return this._maptalks},tV.prototype.clear=function(){},tV.prototype.refresh=function(){this._maptalks.checkSize()};var eV=["mousedown","mouseup","click","dblclick","mousemove","mousewheel","DOMMouseScroll","touchstart","touchend","touchmove","touchcancel"];tV.prototype._initEvents=function(){var t=this.dom;this._handlers=this._handlers||{contextmenu:function(t){return t.preventDefault(),!1}},eV.forEach((function(e){this._handlers[e]=function(n){var i={};for(var r in n)i[r]=n[r];i.bubbles=!1;var o=new n.constructor(n.type,i);"mousewheel"===e||"DOMMouseScroll"===e?t.dispatchEvent(o):t.firstElementChild.dispatchEvent(o)},this.zr.dom.addEventListener(e,this._handlers[e])}),this),this.zr.dom.addEventListener("contextmenu",this._handlers.contextmenu)},tV.prototype.dispose=function(){eV.forEach((function(t){this.zr.dom.removeEventListener(t,this._handlers[t])}),this),this._maptalks.remove()};const nV=tV;Lk.Shader.import(FH);const iV=Od.extend({type:"maptalks3D",__ecgl__:!0,init:function(t,e){this._groundMesh=new Lk.Mesh({geometry:new Lk.PlaneGeometry,material:new Lk.Material({shader:new Lk.Shader({vertex:Lk.Shader.source("ecgl.displayShadow.vertex"),fragment:Lk.Shader.source("ecgl.displayShadow.fragment")}),depthMask:!1}),renderOrder:-100,culling:!1,castShadow:!1,$ignorePicking:!0,renderNormal:!0})},_initMaptalksLayer:function(t,e){var n=e.getZr();this._zrLayer=new nV("maptalks3D",n,t.get("center"),t.get("zoom")),n.painter.insertLayer(-1e3,this._zrLayer),this._lightRoot=new Lk.Node,this._sceneHelper=new sz(this._lightRoot),this._sceneHelper.initLight(this._lightRoot);var i=this._zrLayer.getMaptalks(),r=this._dispatchInteractAction.bind(this,e,i);["zoomend","zooming","zoomstart","dragrotating","pitch","pitchend","movestart","moving","moveend","resize","touchstart","touchmove","touchend","animating"].forEach((function(t){i.on(t,r)}))},render:function(t,e,n){this._zrLayer||this._initMaptalksLayer(t,n);var i=this._zrLayer.getMaptalks(),r=t.get("urlTemplate"),o=i.getBaseLayer();r!==this._oldUrlTemplate&&(o?o.setOptions({urlTemplate:r,attribution:t.get("attribution")}):(o=new maptalks.TileLayer("maptalks-echarts-gl-baselayer",{urlTemplate:r,subdomains:["a","b","c"],attribution:t.get("attribution")}),i.setBaseLayer(o))),this._oldUrlTemplate=r,i.setCenter(t.get("center")),i.setZoom(t.get("zoom"),{animation:!1}),i.setPitch(t.get("pitch")),i.setBearing(t.get("bearing")),t.setMaptalks(i);var a=t.coordinateSystem;a.viewGL.scene.add(this._lightRoot),a.viewGL.add(this._groundMesh),this._updateGroundMesh(),this._sceneHelper.setScene(a.viewGL.scene),this._sceneHelper.updateLight(t),a.viewGL.setPostEffect(t.getModel("postEffect"),n),a.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._maptalks3DModel=t},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n),t.coordinateSystem.viewGL.scene.traverse((function(t){t.material&&(t.material.define("fragment","NORMAL_UP_AXIS",2),t.material.define("fragment","NORMAL_FRONT_AXIS",1))}))},updateCamera:function(t,e,n,i){t.coordinateSystem.setCameraOption(i),this._updateGroundMesh(),n.getZr().refresh()},_dispatchInteractAction:function(t,e,n){var i;t.dispatchAction({type:"maptalks3DChangeCamera",pitch:e.getPitch(),zoom:(i=e.getResolution(),19-Math.log(i/rV)/Math.LN2+1),center:e.getCenter().toArray(),bearing:e.getBearing(),maptalks3DId:this._maptalks3DModel&&this._maptalks3DModel.id})},_updateGroundMesh:function(){if(this._maptalks3DModel){var t=this._maptalks3DModel.coordinateSystem,e=t.dataToPoint(t.center);this._groundMesh.position.set(e[0],e[1],-.001);var n=new Lk.Plane(new Lk.Vector3(0,0,1),0),i=t.viewGL.camera.castRay(new Lk.Vector2(-1,-1)),r=t.viewGL.camera.castRay(new Lk.Vector2(1,1)),o=i.intersectPlane(n),a=r.intersectPlane(n),s=o.dist(a)/t.viewGL.rootNode.scale.x;this._groundMesh.scale.set(s,s,1)}},dispose:function(t,e){this._zrLayer&&this._zrLayer.dispose(),e.getZr().painter.delLayer(-1e3)}}),rV=12756274*Math.PI/(256*Math.pow(2,20));function oV(){XH.apply(this,arguments),this.maxPitch=85,this.zoomOffset=1}oV.prototype=new XH,oV.prototype.constructor=oV,oV.prototype.type="maptalks3D";const aV=YH("maptalks3D",oV,(function(t){t.forEach((function(t){t.setCameraOption(t.model.getMaptalksCameraOption())}))}));rx((function(t){t.registerComponentModel(QH),t.registerComponentView(iV),t.registerCoordinateSystem("maptalks3D",aV),t.registerAction({type:"maptalks3DChangeCamera",event:"maptalks3dcamerachanged",update:"maptalks3D:updateCamera"},(function(t,e){e.eachComponent({mainType:"maptalks3D",query:t},(function(e){e.setMaptalksCameraOption(t)}))}))}));var sV=$k.vec3,lV=$y.isDimensionStacked;const uV=function(t,e){var n=t.getData(),i=t.get("barSize");if(null==i){var r,o,a=e.size,s=e.getAxis("x"),l=e.getAxis("y");r="category"===s.type?.7*s.getBandWidth():.6*Math.round(a[0]/Math.sqrt(n.count())),o="category"===l.type?.7*l.getBandWidth():.6*Math.round(a[1]/Math.sqrt(n.count())),i=[r,o]}else P.isArray(i)||(i=[i,i]);var u=e.getAxis("z").scale.getExtent(),h=function(t){var e=t[0],n=t[1];return!(e>0&&n>0||e<0&&n<0)}(u),c=["x","y","z"].map((function(e){return t.coordDimToDataDim(e)[0]})),d=lV(n,c[2]),f=d?n.getCalculationInfo("stackResultDimension"):c[2];n.each(c,(function(t,r,o,a){var s=n.get(f,a),l=d?s-o:h?0:u[0],c=e.dataToPoint([t,r,l]),p=e.dataToPoint([t,r,s]),g=sV.dist(c,p),m=[0,p[1]"+r.join("
")}(r):yt(Su(r)),a=i.getName(e),s=VF(i,e);P.isObject(s)&&s.colorStops&&(s=(s.colorStops[0]||{}).color);var l=Iu(s=s||"transparent"),u=t.name;return"\0-"===u&&(u=""),u=u?yt(u)+(n?": ":"
"):"",n?l+u+o:u+l+(a?yt(a)+": "+o:o)}function _V(t,e,n){n=n||t.getSource();var i=e||qv(t.get("coordinateSystem"))||["x","y","z"],r=O_(n,{dimensionsDefine:n.dimensionsDefine||t.get("dimensions"),encodeDefine:n.encodeDefine||t.get("encode"),coordDimensions:i.map((function(e){var n=t.getReferringComponents(e+"Axis3D").models[0];return{type:n&&"category"===n.get("type")?"ordinal":"float",name:e}}))});"cartesian3D"===t.get("coordinateSystem")&&r.forEach((function(e){if(i.indexOf(e.coordDim)>=0){var n=t.getReferringComponents(e.coordDim+"Axis3D").models[0];n&&"category"===n.get("type")&&(e.ordinalMeta=n.getOrdinalMeta())}}));var o=$y.enableDataStack(t,r,{byIndex:!0,stackedCoordDimension:"z"}),a=new E_(r,t);return a.setCalculationInfo(o),a.initData(n),a}var yV=Pd.extend({type:"series.bar3D",dependencies:["globe"],visualStyleAccessPathvisu:"itemStyle",getInitialData:function(t,e){return _V(this)},getFormattedLabel:function(t,e,n,i){var r=mV.getFormattedLabel(this,t,e,n,i);return null==r&&(r=this.getData().get("z",t)),r},formatTooltip:function(t){return vV(this,t)},defaultOption:{coordinateSystem:"cartesian3D",globeIndex:0,grid3DIndex:0,zlevel:-10,bevelSize:0,bevelSmoothness:2,onGridPlane:"xy",shading:"color",minHeight:0,itemStyle:{opacity:1},label:{show:!1,distance:2,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},emphasis:{label:{show:!0}},animationDurationUpdate:500}});P.merge(yV.prototype,iF);const xV=yV;var bV,wV,SV,TV,MV,CV,AV,LV,DV=$k.vec3,IV=$k.mat3,PV=JO.extend((function(){return{attributes:{position:new JO.Attribute("position","float",3,"POSITION"),normal:new JO.Attribute("normal","float",3,"NORMAL"),color:new JO.Attribute("color","float",4,"COLOR"),prevPosition:new JO.Attribute("prevPosition","float",3),prevNormal:new JO.Attribute("prevNormal","float",3)},dynamic:!0,enableNormal:!1,bevelSize:1,bevelSegments:0,_dataIndices:null,_vertexOffset:0,_triangleOffset:0}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0},setBarCount:function(t){var e=this.enableNormal,n=this.getBarVertexCount()*t,i=this.getBarTriangleCount()*t;this.vertexCount!==n&&(this.attributes.position.init(n),e?this.attributes.normal.init(n):this.attributes.normal.value=null,this.attributes.color.init(n)),this.triangleCount!==i&&(this.indices=n>65535?new Uint32Array(3*i):new Uint16Array(3*i),this._dataIndices=new Uint32Array(n))},getBarVertexCount:function(){var t=this.bevelSize>0?this.bevelSegments:0;return t>0?this._getBevelBarVertexCount(t):this.enableNormal?24:8},getBarTriangleCount:function(){var t=this.bevelSize>0?this.bevelSegments:0;return t>0?this._getBevelBarTriangleCount(t):12},_getBevelBarVertexCount:function(t){return 4*(t+1)*(t+1)*2},_getBevelBarTriangleCount:function(t){return(4*t+3+1)*(2*t+1)*2+4},setColor:function(t,e){for(var n=this.getBarVertexCount(),i=n*(t+1),r=n*t;r0&&this.bevelSegments>0)this._addBevelBar(t,c,g,m,this.bevelSize,this.bevelSegments,v);else{DV.copy(r,c),DV.normalize(r,r),DV.cross(o,g,r),DV.normalize(o,o),DV.cross(i,r,o),DV.normalize(o,o),DV.negate(a,i),DV.negate(s,r),DV.negate(l,o),e(u[0],t,i,m[0]/2),e(u[0],u[0],o,m[2]/2),e(u[1],t,i,m[0]/2),e(u[1],u[1],l,m[2]/2),e(u[2],t,a,m[0]/2),e(u[2],u[2],l,m[2]/2),e(u[3],t,a,m[0]/2),e(u[3],u[3],o,m[2]/2),e(n,t,r,m[1]),e(u[4],n,i,m[0]/2),e(u[4],u[4],o,m[2]/2),e(u[5],n,i,m[0]/2),e(u[5],u[5],l,m[2]/2),e(u[6],n,a,m[0]/2),e(u[6],u[6],l,m[2]/2),e(u[7],n,a,m[0]/2),e(u[7],u[7],o,m[2]/2);var x=this.attributes;if(this.enableNormal){h[0]=i,h[1]=a,h[2]=r,h[3]=s,h[4]=o,h[5]=l;for(var b=this._vertexOffset,w=0;w0&&(f++,h[3]<.99&&(p=!0))}})),a.geometry.setBarCount(f);var g=n.getLayout("orient"),m=this._barIndexOfData=new Int32Array(n.count());f=0;n.each((function(t){if(n.hasValue(t)){var e=n.getItemLayout(t),i=e[0],r=e[1],a=e[2],s=4*t;h[0]=c[s++],h[1]=c[s++],h[2]=c[s++],h[3]=c[s++],h[3]>0&&(o._barMesh.geometry.addBar(i,r,g,a,h,t),m[t]=f++)}else m[t]=-1})),a.geometry.dirty(),a.geometry.updateBoundingBox();var v=a.material;v.transparent=p,v.depthMask=!p,a.geometry.sortTriangles=p,this._initHandler(t,e)},_initHandler:function(t,e){var n=t.getData(),i=this._barMesh,r="cartesian3D"===t.coordinateSystem.type;i.seriesIndex=t.seriesIndex;var o=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(t){var a=i.geometry.getDataIndexOfVertex(t.triangle[0]);a!==o&&(this._downplay(o),this._highlight(a),this._labelsBuilder.updateLabels([a]),r&&e.dispatchAction({type:"grid3DShowAxisPointer",value:[n.get("x",a),n.get("y",a),n.get("z",a,!0)]})),o=a,i.dataIndex=a}),this),i.on("mouseout",(function(t){this._downplay(o),this._labelsBuilder.updateLabels(),o=-1,i.dataIndex=-1,r&&e.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_highlight:function(t){var e=this._data;if(e){var n=this._barIndexOfData[t];if(!(n<0)){var i=e.getItemModel(t).getModel("emphasis.itemStyle"),r=i.get("color"),o=i.get("opacity");if(null==r){var a=VF(e,t);r=tn.lift(a,-.4)}null==o&&(o=GF(e,t));var s=Lk.parseColor(r);s[3]*=o,this._barMesh.geometry.setColor(n,s),this._api.getZr().refresh()}}},_downplay:function(t){var e=this._data;if(e){var n=this._barIndexOfData[t];if(!(n<0)){var i=VF(e,t),r=GF(e,t),o=Lk.parseColor(i);o[3]*=r,this._barMesh.geometry.setColor(n,o),this._api.getZr().refresh()}}},highlight:function(t,e,n,i){this._toggleStatus("highlight",t,e,n,i)},downplay:function(t,e,n,i){this._toggleStatus("downplay",t,e,n,i)},_toggleStatus:function(t,e,n,i,r){var o=e.getData(),a=XR.queryDataIndex(o,r),s=this;null!=a?P.each(mV.normalizeToArray(a),(function(e){"highlight"===t?this._highlight(e):this._downplay(e)}),this):o.each((function(e){"highlight"===t?s._highlight(e):s._downplay(e)}))},remove:function(){this.groupGL.removeAll()},dispose:function(){this._labelsBuilder.dispose(),this.groupGL.removeAll()}});rx((function(t){t.registerChartView(NV),t.registerSeriesModel(xV),pV(t),t.registerProcessor((function(t,e){t.eachSeriesByType("bar3d",(function(t){var e=t.getData();e.filterSelf((function(t){return e.hasValue(t)}))}))}))}));const RV=Pd.extend({type:"series.line3D",dependencies:["grid3D"],visualStyleAccessPath:"lineStyle",visualDrawType:"stroke",getInitialData:function(t,e){return _V(this)},formatTooltip:function(t){return vV(this,t)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,grid3DIndex:0,lineStyle:{width:2},animationDurationUpdate:500}});var kV=$k.vec3;Lk.Shader.import(Tz);const zV=Wp.extend({type:"line3D",__ecgl__:!0,init:function(t,e){this.groupGL=new Lk.Node,this._api=e},render:function(t,e,n){var i=this._prevLine3DMesh;this._prevLine3DMesh=this._line3DMesh,this._line3DMesh=i,this._line3DMesh||(this._line3DMesh=new Lk.Mesh({geometry:new nz({useNativeLine:!1,sortTriangles:!0}),material:new Lk.Material({shader:Lk.createShader("ecgl.meshLines3D")}),renderOrder:10}),this._line3DMesh.geometry.pick=this._pick.bind(this)),this.groupGL.remove(this._prevLine3DMesh),this.groupGL.add(this._line3DMesh);var r=t.coordinateSystem;if(r&&r.viewGL){r.viewGL.add(this.groupGL);var o=r.viewGL.isLinearSpace()?"define":"undefine";this._line3DMesh.material[o]("fragment","SRGB_DECODE")}this._doRender(t,n),this._data=t.getData(),this._camera=r.viewGL.camera,this.updateCamera(),this._updateAnimation(t)},updateCamera:function(){this._updateNDCPosition()},_doRender:function(t,e){var n=t.getData(),i=this._line3DMesh;i.geometry.resetOffset();var r=n.getLayout("points"),o=[],a=new Float32Array(r.length/3*4),s=0,l=!1;n.each((function(t){var e=VF(n,t),i=GF(n,t);null==i&&(i=1),Lk.parseColor(e,o),o[3]*=i,a[s++]=o[0],a[s++]=o[1],a[s++]=o[2],a[s++]=o[3],o[3]<.99&&(l=!0)})),i.geometry.setVertexCount(i.geometry.getPolylineVertexCount(r)),i.geometry.setTriangleCount(i.geometry.getPolylineTriangleCount(r)),i.geometry.addPolyline(r,a,XR.firstNotNull(t.get("lineStyle.width"),1)),i.geometry.dirty(),i.geometry.updateBoundingBox();var u=i.material;u.transparent=l,u.depthMask=!l;var h=t.getModel("debug.wireframe");h.get("show")?(i.geometry.createAttribute("barycentric","float",3),i.geometry.generateBarycentric(),i.material.set("both","WIREFRAME_TRIANGLE"),i.material.set("wireframeLineColor",Lk.parseColor(h.get("lineStyle.color")||"rgba(0,0,0,0.5)")),i.material.set("wireframeLineWidth",XR.firstNotNull(h.get("lineStyle.width"),1))):i.material.set("both","WIREFRAME_TRIANGLE"),this._points=r,this._initHandler(t,e)},_updateAnimation:function(t){Lk.updateVertexAnimation([["prevPosition","position"],["prevPositionPrev","positionPrev"],["prevPositionNext","positionNext"]],this._prevLine3DMesh,this._line3DMesh,t)},_initHandler:function(t,e){var n=t.getData(),i=t.coordinateSystem,r=this._line3DMesh,o=-1;r.seriesIndex=t.seriesIndex,r.off("mousemove"),r.off("mouseout"),r.on("mousemove",(function(t){var a=i.pointToData(t.point.array),s=n.indicesOfNearest("x",a[0])[0];s!==o&&(e.dispatchAction({type:"grid3DShowAxisPointer",value:[n.get("x",s),n.get("y",s),n.get("z",s)]}),r.dataIndex=s),o=s}),this),r.on("mouseout",(function(t){o=-1,r.dataIndex=-1,e.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_updateNDCPosition:function(){var t=new nO,e=this._camera;nO.multiply(t,e.projectionMatrix,e.viewMatrix);var n=this._positionNDC,i=this._points,r=i.length/3;n&&n.length/2===r||(n=this._positionNDC=new Float32Array(2*r));for(var o=[],a=0;a=0){var m=3*l,v=new IE(this._points[m],this._points[m+1],this._points[m+2]);o.push({dataIndex:l,point:v,pointWorld:v.clone(),target:this._line3DMesh,distance:this._camera.getWorldPosition().dist(v)})}},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});rx((function(t){t.registerChartView(zV),t.registerSeriesModel(RV),t.registerLayout((function(t,e){t.eachSeriesByType("line3D",(function(t){var e=t.getData(),n=t.coordinateSystem;if(n){if("cartesian3D"!==n.type)return void 0;var i=new Float32Array(3*e.count()),r=[],o=[],a=n.dimensions.map((function(e){return t.coordDimToDataDim(e)[0]}));n&&e.each(a,(function(t,e,a,s){r[0]=t,r[1]=e,r[2]=a,n.dataToPoint(r,o),i[3*s]=o[0],i[3*s+1]=o[1],i[3*s+2]=o[2]})),e.setLayout("points",i)}}))}))}));const BV=Pd.extend({type:"series.scatter3D",dependencies:["globe","grid3D","geo3D"],visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,getInitialData:function(t,e){return _V(this)},getFormattedLabel:function(t,e,n,i){var r=mV.getFormattedLabel(this,t,e,n,i);if(null==r){var o=this.getData(),a=o.dimensions[o.dimensions.length-1];r=o.get(a,t)}return r},formatTooltip:function(t){return vV(this,t)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,progressive:1e5,progressiveThreshold:1e5,grid3DIndex:0,globeIndex:0,symbol:"circle",symbolSize:10,blendMode:"source-over",label:{show:!1,position:"right",distance:5,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},itemStyle:{opacity:.8},emphasis:{label:{show:!0}},animationDurationUpdate:500}});function FV(t,e,n){(e=e||document.createElement("canvas")).width=t,e.height=t;var i=e.getContext("2d");return n&&n(i),e}var HV={getMarginByStyle:function(t){var e=t.minMargin||0,n=0;t.stroke&&"none"!==t.stroke&&(n=null==t.lineWidth?1:t.lineWidth);var i=t.shadowBlur||0,r=t.shadowOffsetX||0,o=t.shadowOffsetY||0,a={};return a.left=Math.max(n/2,-r+i,e),a.right=Math.max(n/2,r+i,e),a.top=Math.max(n/2,-o+i,e),a.bottom=Math.max(n/2,o+i,e),a},createSymbolSprite:function(t,e,n,i){var r=function(t,e,n,i){P.isArray(e)||(e=[e,e]);var r=HV.getMarginByStyle(n,i),o=e[0]+r.left+r.right,a=e[1]+r.top+r.bottom,s=Jg(t,0,0,e[0],e[1]),l=Math.max(o,a);s.x=r.left,s.y=r.top,o>a?s.y+=(l-a)/2:s.x+=(l-o)/2;var u=s.getBoundingRect();return s.x-=u.x,s.y-=u.y,s.setStyle(n),s.update(),s.__size=l,s}(t,e,n),o=HV.getMarginByStyle(n);return{image:FV(r.__size,i,(function(t){Sm(t,r)})),margin:o}},createSDFFromCanvas:function(t,e,n,i){return FV(e,i,(function(e){var i=t.getContext("2d").getImageData(0,0,t.width,t.height);e.putImageData(function(t,e,n){var i=e.width,r=e.height,o=t.canvas.width,a=t.canvas.height,s=i/o,l=r/a;function u(t){return t<128?1:-1}function h(t,o){var a=1/0;t=Math.floor(t*s);for(var h=(o=Math.floor(o*l))*i+t,c=u(e.data[4*h]),d=Math.max(o-n,0);d=2e4},doSortVertices:function(t,e){var n=this.indices,i=GV.create();if(!n){n=this.indices=this.vertexCount>65535?new Uint32Array(this.vertexCount):new Uint16Array(this.vertexCount);for(var r=0;r.05);else for(r=0;r<3;r++)this._progressiveQuickSort(3*e+r);this.dirtyIndices()},_simpleSort:function(t){var e=this._zList,n=this.indices;function i(t,n){return e[n]-e[t]}t?Array.prototype.sort.call(n,i):RF.sort(n,i,0,n.length-1)},_progressiveQuickSort:function(t){var e=this._zList,n=this.indices;this._quickSort=this._quickSort||new RF,this._quickSort.step(n,(function(t,n){return e[n]-e[t]}),t)}};var WV=$k.vec4;Lk.Shader.import("@export ecgl.sdfSprite.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform float elapsedTime : 0;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_SIZE\nattribute float size;\n#else\nuniform float u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_FillColor: COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute float prevSize;\nuniform float percent : 1.0;\n#endif\n\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvarying float v_Size;\n\nvoid main()\n{\n\n#ifdef POSITIONTEXTURE_ENABLED\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\n#else\n\n #ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n #else\n vec3 pos = position;\n #endif\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n#endif\n\n#ifdef VERTEX_SIZE\n#ifdef VERTEX_ANIMATION\n v_Size = mix(prevSize, size, percent);\n#else\n v_Size = size;\n#endif\n#else\n v_Size = u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\n v_Color = a_FillColor;\n #endif\n\n gl_PointSize = v_Size;\n}\n\n@end\n\n@export ecgl.sdfSprite.fragment\n\nuniform vec4 color: [1, 1, 1, 1];\nuniform vec4 strokeColor: [1, 1, 1, 1];\nuniform float smoothing: 0.07;\n\nuniform float lineWidth: 0.0;\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\nvarying float v_Size;\n\nuniform sampler2D sprite;\n\n@import clay.util.srgb\n\nvoid main()\n{\n gl_FragColor = color;\n\n vec4 _strokeColor = strokeColor;\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n #endif\n\n#ifdef SPRITE_ENABLED\n float d = texture2D(sprite, gl_PointCoord).r;\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\n\n if (lineWidth > 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end");var jV=Lk.Mesh.extend((function(){var t=new Lk.Geometry({dynamic:!0,attributes:{color:new Lk.Geometry.Attribute("color","float",4,"COLOR"),position:new Lk.Geometry.Attribute("position","float",3,"POSITION"),size:new Lk.Geometry.Attribute("size","float",1),prevPosition:new Lk.Geometry.Attribute("prevPosition","float",3),prevSize:new Lk.Geometry.Attribute("prevSize","float",1)}});Object.assign(t,UV);var e=new Lk.Material({shader:Lk.createShader("ecgl.sdfSprite"),transparent:!0,depthMask:!1});e.enableTexture("sprite"),e.define("both","VERTEX_COLOR"),e.define("both","VERTEX_SIZE");var n=new Lk.Texture2D({image:document.createElement("canvas"),flipY:!1});return e.set("sprite",n),t.pick=this._pick.bind(this),{geometry:t,material:e,mode:Lk.Mesh.POINTS,sizeScale:1}}),{_pick:function(t,e,n,i,r,o){var a=this._positionNDC;if(a)for(var s=n.viewport,l=2/s.width,u=2/s.height,h=this.geometry.vertexCount-1;h>=0;h--){var c,d=a[2*(c=this.geometry.indices?this.geometry.indices[h]:h)],f=a[2*c+1],p=this.geometry.attributes.size.get(c)/this.sizeScale/2;if(t>d-p*l&&tf-p*u&&e2?(p=this._updateSymbolSprite(t,d,h,c),s.enableTexture("sprite")):s.disableTexture("sprite"),u.position.init(r-i);var g=[];if(f){s.undefine("VERTEX_SIZE"),s.undefine("VERTEX_COLOR");var m=function(t){const e=t.getVisual("style");if(e)return e[t.getVisual("drawType")]}(a),v=function(t){return t.getVisual("style").opacity}(a);Lk.parseColor(m,g),g[3]*=v,s.set({color:g,u_Size:h.maxSize*this._sizeScale})}else s.set({color:[1,1,1,1]}),s.define("VERTEX_SIZE"),s.define("VERTEX_COLOR"),u.size.init(r-i),u.color.init(r-i),this._originalOpacity=new Float32Array(r-i);for(var _=a.getLayout("points"),y=u.position.value,x=0;x1?(a[0]=n.maxSize,a[1]=n.maxSize/n.aspect):(a[1]=n.maxSize,a[0]=n.maxSize*n.aspect),a[0]=a[0]||1,a[1]=a[1]||1,this._symbolType===n.type&&(r=this._symbolSize,o=a,r&&o&&r[0]===o[0]&&r[1]===o[1])&&this._lineWidth===e.lineWidth||(VV.createSymbolSprite(n.type,a,{fill:"#fff",lineWidth:e.lineWidth,stroke:"transparent",shadowColor:"transparent",minMargin:Math.min(a[0]/2,10)},this._spriteImageCanvas),VV.createSDFFromCanvas(this._spriteImageCanvas,Math.min(this._spriteImageCanvas.width,32),20,this._mesh.material.get("sprite").image),this._symbolType=n.type,this._symbolSize=a,this._lineWidth=e.lineWidth),this._spriteImageCanvas.width/n.maxSize*i},_updateMaterial:function(t,e){var n="lighter"===t.get("blendMode")?Lk.additiveBlend:null,i=this._mesh.material;i.blend=n,i.set("lineWidth",e.lineWidth/20);var r=Lk.parseColor(e.stroke);i.set("strokeColor",r),i.transparent=!0,i.depthMask=!1,i.depthTest=!this.is2D,i.sortVertices=!this.is2D},_updateLabelBuilder:function(t,e,n){var i=t.getData(),r=this._mesh.geometry,o=r.attributes.position.value,a=(e=this._startDataIndex,this._mesh.sizeScale);this._labelsBuilder.updateData(i,e,n),this._labelsBuilder.getLabelPosition=function(t,n,i){var r=3*(t-e);return[o[r],o[r+1],o[r+2]]},this._labelsBuilder.getLabelDistance=function(t,n,i){return r.attributes.size.get(t-e)/a/2+i},this._labelsBuilder.updateLabels()},_updateAnimation:function(t){Lk.updateVertexAnimation([["prevPosition","position"],["prevSize","size"]],this._prevMesh,this._mesh,t)},_updateHandler:function(t,e,n){var i,r=t.getData(),o=this._mesh,a=this,s=-1,l=t.coordinateSystem&&"cartesian3D"===t.coordinateSystem.type;l&&(i=t.coordinateSystem.model),o.seriesIndex=t.seriesIndex,o.off("mousemove"),o.off("mouseout"),o.on("mousemove",(function(e){var u=e.vertexIndex+a._startDataIndex;u!==s&&(this.highlightOnMouseover&&(this.downplay(r,s),this.highlight(r,u),this._labelsBuilder.updateLabels([u])),l&&n.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get(t.coordDimToDataDim("x")[0],u),r.get(t.coordDimToDataDim("y")[0],u),r.get(t.coordDimToDataDim("z")[0],u)],grid3DIndex:i.componentIndex})),o.dataIndex=u,s=u}),this),o.on("mouseout",(function(t){var e=t.vertexIndex+a._startDataIndex;this.highlightOnMouseover&&(this.downplay(r,e),this._labelsBuilder.updateLabels()),s=-1,o.dataIndex=-1,l&&n.dispatchAction({type:"grid3DHideAxisPointer",grid3DIndex:i.componentIndex})}),this)},updateLayout:function(t,e,n){var i=t.getData();if(this._mesh){var r=this._mesh.geometry.attributes.position.value,o=i.getLayout("points");if(this.is2D)for(var a=0;athis._endDataIndex||ethis._endDataIndex||e 1.0 || v_Percent < 0.0) {\n discard;\n }\n\n float fade = v_Percent;\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n\n if (v_Percent > (1.0 - v_SpotPercent)) {\n gl_FragColor.rgb *= spotIntensity;\n }\n\n gl_FragColor.a *= fade;\n}\n\n@end");const mG=Lk.Mesh.extend((function(){var t=new Lk.Material({shader:new Lk.Shader(Lk.Shader.source("ecgl.trail2.vertex"),Lk.Shader.source("ecgl.trail2.fragment")),transparent:!0,depthMask:!1}),e=new nz({dynamic:!0});return e.createAttribute("dist","float",1),e.createAttribute("distAll","float",1),e.createAttribute("start","float",1),{geometry:e,material:t,culling:!1,$ignorePicking:!0}}),{updateData:function(t,e,n){var i=t.hostModel,r=this.geometry,o=i.getModel("effect"),a=o.get("trailWidth")*e.getDevicePixelRatio(),s=o.get("trailLength"),l=i.get("effect.constantSpeed"),u=1e3*i.get("effect.period"),h=null!=l;h?this.material.set("speed",l/1e3):this.material.set("period",u),this.material[h?"define":"undefine"]("vertex","CONSTANT_SPEED");var c=i.get("polyline");r.trailLength=s,this.material.set("trailLength",s),r.resetOffset(),["position","positionPrev","positionNext"].forEach((function(t){r.attributes[t].value=n.attributes[t].value}));["dist","distAll","start","offset","color"].forEach((function(t){r.attributes[t].init(r.vertexCount)})),r.indices=n.indices;var d=[],f=o.get("trailColor"),p=o.get("trailOpacity"),g=null!=f,m=null!=p;this.updateWorldTransform();var v=this.worldTransform.x.len(),_=this.worldTransform.y.len(),y=this.worldTransform.z.len(),x=0,b=0;t.each((function(e){var i=t.getItemLayout(e),o=m?p:GF(t,e),s=VF(t,e);null==o&&(o=1),(d=Lk.parseColor(g?f:s,d))[3]*=o;for(var l=c?n.getPolylineVertexCount(i):n.getCubicCurveVertexCount(i[0],i[1],i[2],i[3]),w=0,S=[],T=[],M=x;Mx&&(w+=gG.dist(S,T)),r.attributes.dist.set(M,w),gG.copy(T,S);b=Math.max(b,w);var C=Math.random()*(h?w:u);for(M=x;M0?1:-1)*a/2),r.attributes.color.set(M,d);x+=l})),this.material.set("spotSize",.1*b*s),this.material.set("spotIntensity",o.get("spotIntensity")),r.dirty()},setAnimationTime:function(t){this.material.set("time",t)}});Lk.Shader.import(Tz);const vG=Wp.extend({type:"lines3D",__ecgl__:!0,init:function(t,e){this.groupGL=new Lk.Node,this._meshLinesMaterial=new Lk.Material({shader:Lk.createShader("ecgl.meshLines3D"),transparent:!0,depthMask:!1}),this._linesMesh=new Lk.Mesh({geometry:new nz,material:this._meshLinesMaterial,$ignorePicking:!0}),this._trailMesh=new mG},render:function(t,e,n){this.groupGL.add(this._linesMesh);var i=t.coordinateSystem,r=t.getData();if(i&&i.viewGL){i.viewGL.add(this.groupGL),this._updateLines(t,e,n);var o=i.viewGL.isLinearSpace()?"define":"undefine";this._linesMesh.material[o]("fragment","SRGB_DECODE"),this._trailMesh.material[o]("fragment","SRGB_DECODE")}var a=this._trailMesh;if(a.stopAnimation(),t.get("effect.show")){this.groupGL.add(a),a.updateData(r,n,this._linesMesh.geometry),a.__time=a.__time||0;var s=36e5;this._curveEffectsAnimator=a.animate("",{loop:!0}).when(s,{__time:s}).during((function(){a.setAnimationTime(a.__time)})).start()}else this.groupGL.remove(a),this._curveEffectsAnimator=null;this._linesMesh.material.blend=this._trailMesh.material.blend="lighter"===t.get("blendMode")?Lk.additiveBlend:null},pauseEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.pause()},resumeEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.resume()},toggleEffect:function(){var t=this._curveEffectsAnimator;t&&(t.isPaused()?t.resume():t.pause())},_updateLines:function(t,e,n){var i=t.getData(),r=t.coordinateSystem,o=this._linesMesh.geometry,a=t.get("polyline");o.expandLine=!0;var s=function(t){return null!=t.radius?t.radius:null!=t.size?Math.max(t.size[0],t.size[1],t.size[2]):100}(r);o.segmentScale=s/20;var l="lineStyle.width".split("."),u=n.getDevicePixelRatio(),h=0;i.each((function(t){var e=i.getItemModel(t).get(l);null==e&&(e=1),i.setItemVisual(t,"lineWidth",e),h=Math.max(e,h)})),o.useNativeLine=!1;var c=0,d=0;i.each((function(t){var e=i.getItemLayout(t);a?(c+=o.getPolylineVertexCount(e),d+=o.getPolylineTriangleCount(e)):(c+=o.getCubicCurveVertexCount(e[0],e[1],e[2],e[3]),d+=o.getCubicCurveTriangleCount(e[0],e[1],e[2],e[3]))})),o.setVertexCount(c),o.setTriangleCount(d),o.resetOffset();var f=[];i.each((function(t){var e=i.getItemLayout(t),n=VF(i,t),r=GF(i,t),s=i.getItemVisual(t,"lineWidth")*u;null==r&&(r=1),(f=Lk.parseColor(n,f))[3]*=r,a?o.addPolyline(e,f,s):o.addCubicCurve(e[0],e[1],e[2],e[3],f,s)})),o.dirty()},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});function _G(t,e){for(var n=[],i=0;i0;this._updateSurfaceMesh(this._surfaceMesh,t,h,f);var p=this._surfaceMesh.material;f?(p.define("WIREFRAME_QUAD"),p.set("wireframeLineWidth",d),p.set("wireframeLineColor",Lk.parseColor(c.get("lineStyle.color")))):p.undefine("WIREFRAME_QUAD"),this._initHandler(t,n),this._updateAnimation(t)},_updateAnimation:function(t){Lk.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,t)},_createSurfaceMesh:function(){var t=new Lk.Mesh({geometry:new Lk.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new Lk.Material({shader:new Lk.Shader(Lk.Shader.source("ecgl.sm.depth.vertex"),Lk.Shader.source("ecgl.sm.depth.fragment"))}),culling:!1,renderOrder:10,renderNormal:!0});return t.geometry.createAttribute("barycentric","float",4),t.geometry.createAttribute("prevPosition","float",3),t.geometry.createAttribute("prevNormal","float",3),Object.assign(t.geometry,HF),t},_initHandler:function(t,e){var n=t.getData(),i=this._surfaceMesh,r=t.coordinateSystem;i.seriesIndex=t.seriesIndex;var o=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(t){var a=function(t,e){for(var n=1/0,r=-1,o=[],a=0;a=0){var s=[];i.geometry.attributes.position.get(a,s);for(var l=r.pointToData(s),u=1/0,h=-1,c=[],d=0;d65535?Uint32Array:Uint16Array)((p-1)*(g-1)*6),w=function(t,e,n){n[1]=t*g+e,n[0]=t*g+e+1,n[3]=(t+1)*g+e+1,n[2]=(t+1)*g+e},S=!1;if(l){var T=[],M=[],C=0;m?h.init(r.vertexCount):h.value=null;for(var A=[[],[],[]],L=[],D=[],I=TG.create(),P=function(t,e,n){var i=3*e;return n[0]=t[i],n[1]=t[i+1],n[2]=t[i+2],n},E=new Float32Array(a.length),O=new Float32Array(a.length/3*4),N=0;N0;){if(Math.floor(s/h)===s/h)return[h,s/h];h--}return[h=Math.floor(Math.sqrt(s)),h]},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function CG(t,e){for(var n=[],i=0;i "+f)),h++)}var p=O_(t,{coordDimensions:["value"]});(s=new E_(p,n)).initData(t);var g=new E_(["value"],n);return g.initData(u,l),r&&r(s,g),NG({mainData:s,struct:o,structAttr:"graph",datas:{node:s,edge:g},datasAttr:{node:"data",edge:"edgeData"}}),o.update(),o}(i,n,this,!0,(function(t,n){t.wrapMethod("getItemModel",(function(t){const e=r._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t}));const i=e.getModel([]).getModel;function o(t,e){const n=i.call(this,t,e);return n.resolveParentPath=a,n}function a(t){if(t&&("label"===t[0]||"label"===t[1])){const e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}n.wrapMethod("getItemModel",(function(t){return t.resolveParentPath=a,t.getModel=o,t}))})).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(t,e,n){if("edge"===n){var i=this.getData(),r=this.getDataParams(t,n),o=i.graph.getEdgeByIndex(t),a=i.getName(o.node1.dataIndex),s=i.getName(o.node2.dataIndex),l=[];return null!=a&&l.push(a),null!=s&&l.push(s),l=yt(l.join(" > ")),r.value&&(l+=" : "+yt(r.value)),l}return RG.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var t=(this.option.categories||[]).map((function(t){return null!=t.value?t:Object.assign({value:0},t)})),e=new E_(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray((function(t){return e.getItemModel(t,!0)}))},setView:function(t){null!=t.zoom&&(this.option.zoom=t.zoom),null!=t.offset&&(this.option.offset=t.offset)},setNodePosition:function(t){for(var e=0;e65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(this.indices=0===t?null:this.vertexCount>65535?new Uint32Array(3*t):new Uint16Array(3*t))},_getCubicCurveApproxStep:function(t,e,n,i){return 1/(zG.dist(t,e)+zG.dist(n,e)+zG.dist(i,n)+1)*this.segmentScale},getCubicCurveVertexCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?2*o:2*o+2},getCubicCurveTriangleCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?0:2*o},getLineVertexCount:function(){return this.getPolylineVertexCount(BG)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(BG)},getPolylineVertexCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/2;return this.useNativeLine?2*(e-1):2*(e-1)+2},getPolylineTriangleCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/2;return this.useNativeLine?0:2*(e-1)},addCubicCurve:function(t,e,n,i,r,o){null==o&&(o=1);var a=t[0],s=t[1],l=e[0],u=e[1],h=n[0],c=n[1],d=i[0],f=i[1],p=this._getCubicCurveApproxStep(t,e,n,i),g=p*p,m=g*p,v=3*p,_=3*g,y=6*g,x=6*m,b=a-2*l+h,w=s-2*u+c,S=3*(l-h)-a+d,T=3*(u-c)-s+f,M=a,C=s,A=(l-a)*v+b*_+S*m,L=(u-s)*v+w*_+T*m,D=b*y+S*x,I=w*y+T*x,P=S*x,E=T*x,O=0,N=0,R=Math.ceil(1/p),k=new Float32Array(3*(R+1)),z=(k=[],0);for(N=0;N1&&(M=A>0?Math.min(M,d):Math.max(M,d),C=L>0?Math.min(C,f):Math.max(C,f));this.addPolyline(k,r,o)},addLine:function(t,e,n,i){this.addPolyline([t,e],n,i)},addPolyline:function(){var t=zG.create(),e=zG.create(),n=zG.create(),i=zG.create(),r=[],o=[],a=[];return function(s,l,u,h,c){if(s.length){var d="number"!=typeof s[0];if(null==c&&(c=d?s.length:s.length/2),!(c<2)){null==h&&(h=0),null==u&&(u=1),this._itemVertexOffsets.push(this._vertexOffset);for(var f,p=d?"number"!=typeof l[0]:l.length/4===c,g=this.attributes.position,m=this.attributes.color,v=this.attributes.offset,_=this.attributes.normal,y=this.indices,x=this._vertexOffset,b=0;b1&&(g.copy(x,x-1),m.copy(x,x-1),x++);else{var T;if(b0){zG.sub(t,r,a),zG.sub(e,o,r),zG.normalize(t,t),zG.normalize(e,e),zG.add(i,t,e),zG.normalize(i,i);var M=u/2*Math.min(1/zG.dot(t,i),2);n[0]=-i[1],n[1]=i[0],T=M}else zG.sub(t,o,r),zG.normalize(t,t),n[0]=-t[1],n[1]=t[0],T=u/2}else zG.sub(t,r,a),zG.normalize(t,t),n[0]=-t[1],n[1]=t[0],T=u/2;_.set(x,n),_.set(x+1,n),v.set(x,T),v.set(x+1,-T),zG.copy(a,r),g.set(x,r),g.set(x+1,r),m.set(x,f),m.set(x+1,f),x+=2}if(this.useNativeLine)m.set(x,f),g.set(x,r),x++;else if(b>0){var C=3*this._faceOffset;(y=this.indices)[C]=x-4,y[C+1]=x-3,y[C+2]=x-2,y[C+3]=x-3,y[C+4]=x-1,y[C+5]=x-2,this._faceOffset+=2}}this._vertexOffset=x}}}}(),setItemColor:function(t,e){for(var n=this._itemVertexOffsets[t],i=t 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end");var VG={repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null};function GG(t){var e={type:Lk.Texture.FLOAT,minFilter:Lk.Texture.NEAREST,magFilter:Lk.Texture.NEAREST};this._positionSourceTex=new Lk.Texture2D(e),this._positionSourceTex.flipY=!1,this._positionTex=new Lk.Texture2D(e),this._positionPrevTex=new Lk.Texture2D(e),this._forceTex=new Lk.Texture2D(e),this._forcePrevTex=new Lk.Texture2D(e),this._weightedSumTex=new Lk.Texture2D(e),this._weightedSumTex.width=this._weightedSumTex.height=1,this._globalSpeedTex=new Lk.Texture2D(e),this._globalSpeedPrevTex=new Lk.Texture2D(e),this._globalSpeedTex.width=this._globalSpeedTex.height=1,this._globalSpeedPrevTex.width=this._globalSpeedPrevTex.height=1,this._nodeRepulsionPass=new OR({fragment:Lk.Shader.source("ecgl.forceAtlas2.updateNodeRepulsion")}),this._positionPass=new OR({fragment:Lk.Shader.source("ecgl.forceAtlas2.updatePosition")}),this._globalSpeedPass=new OR({fragment:Lk.Shader.source("ecgl.forceAtlas2.calcGlobalSpeed")}),this._copyPass=new OR({fragment:Lk.Shader.source("clay.compositor.output")});var n=function(t){t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE)};this._edgeForceMesh=new Lk.Mesh({geometry:new Lk.Geometry({attributes:{node1:new Lk.Geometry.Attribute("node1","float",2),node2:new Lk.Geometry.Attribute("node2","float",2),weight:new Lk.Geometry.Attribute("weight","float",1)},dynamic:!0,mainAttribute:"node1"}),material:new Lk.Material({transparent:!0,shader:Lk.createShader("ecgl.forceAtlas2.updateEdgeAttraction"),blend:n,depthMask:!1,depthText:!1}),mode:Lk.Mesh.POINTS}),this._weightedSumMesh=new Lk.Mesh({geometry:new Lk.Geometry({attributes:{node:new Lk.Geometry.Attribute("node","float",2)},dynamic:!0,mainAttribute:"node"}),material:new Lk.Material({transparent:!0,shader:Lk.createShader("ecgl.forceAtlas2.calcWeightedSum"),blend:n,depthMask:!1,depthText:!1}),mode:Lk.Mesh.POINTS}),this._framebuffer=new JN({depthBuffer:!1}),this._dummyCamera=new Lk.OrthographicCamera({left:-1,right:1,top:1,bottom:-1,near:0,far:100}),this._globalSpeed=0}GG.prototype.updateOption=function(t){for(var e in VG)this[e]=VG[e];var n=this._nodes.length;if(this.jitterTolerence=n>5e4?10:n>5e3?1:.1,this.scaling=n>100?2:10,t)for(var e in VG)null!=t[e]&&(this[e]=t[e]);if(this.repulsionByDegree)for(var i=this._positionSourceTex.pixels,r=0;rt},GG.prototype._swapTexture=function(){var t=this._positionPrevTex;this._positionPrevTex=this._positionTex,this._positionTex=t;t=this._forcePrevTex;this._forcePrevTex=this._forceTex,this._forceTex=t;t=this._globalSpeedPrevTex;this._globalSpeedPrevTex=this._globalSpeedTex,this._globalSpeedTex=t},GG.prototype._initFromSource=function(t){this._framebuffer.attach(this._positionPrevTex),this._framebuffer.bind(t),this._copyPass.setUniform("texture",this._positionSourceTex),this._copyPass.render(t),t.gl.clearColor(0,0,0,0),this._framebuffer.attach(this._forcePrevTex),t.gl.clear(t.gl.COLOR_BUFFER_BIT),this._framebuffer.attach(this._globalSpeedPrevTex),t.gl.clear(t.gl.COLOR_BUFFER_BIT),this._framebuffer.unbind(t)},GG.prototype._resize=function(t,e){["_positionSourceTex","_positionTex","_positionPrevTex","_forceTex","_forcePrevTex"].forEach((function(n){this[n].width=t,this[n].height=e,this[n].dirty()}),this)},GG.prototype.dispose=function(t){this._framebuffer.dispose(t),this._copyPass.dispose(t),this._nodeRepulsionPass.dispose(t),this._positionPass.dispose(t),this._globalSpeedPass.dispose(t),this._edgeForceMesh.geometry.dispose(t),this._weightedSumMesh.geometry.dispose(t),this._positionSourceTex.dispose(t),this._positionTex.dispose(t),this._positionPrevTex.dispose(t),this._forceTex.dispose(t),this._forcePrevTex.dispose(t),this._weightedSumTex.dispose(t),this._globalSpeedTex.dispose(t),this._globalSpeedPrevTex.dispose(t)};const UG=GG;const WG=function(){var t=function(){return new Float32Array(2)},e=function(t,e){var n=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(n*n+i*i)},n=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},i=function(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t},r=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},o=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},a=function(t,e){return t[0]=e[0],t[1]=e[1],t},s=function(t,e,n){return t[0]=e,t[1]=n,t};function l(){this.subRegions=[],this.nSubRegions=0,this.node=null,this.mass=0,this.centerOfMass=null,this.bbox=new Float32Array(4),this.size=0}var u=l.prototype;function h(){this.position=new Float32Array(2),this.force=t(),this.forcePrev=t(),this.mass=1,this.inDegree=0,this.outDegree=0}function c(t,e){this.source=t,this.target=e,this.weight=1}function d(){this.autoSettings=!0,this.barnesHutOptimize=!0,this.barnesHutTheta=1.5,this.repulsionByDegree=!0,this.linLogMode=!1,this.strongGravityMode=!1,this.gravity=1,this.scaling=1,this.edgeWeightInfluence=1,this.jitterTolerence=.1,this.preventOverlap=!1,this.dissuadeHubs=!1,this.rootRegion=new l,this.rootRegion.centerOfMass=t(),this.nodes=[],this.edges=[],this.bbox=new Float32Array(4),this.gravityCenter=null,this._massArr=null,this._swingingArr=null,this._sizeArr=null,this._globalSpeed=0}u.beforeUpdate=function(){for(var t=0;t=t&&this.bbox[1]<=e&&this.bbox[3]>=e},u.setBBox=function(t,e,n,i){this.bbox[0]=t,this.bbox[1]=e,this.bbox[2]=n,this.bbox[3]=i,this.size=(n-t+i-e)/2},u._newSubRegion=function(){var t=this.subRegions[this.nSubRegions];return t||(t=new l,this.subRegions[this.nSubRegions]=t),this.nSubRegions++,t},u._addNodeToSubRegion=function(t){var e=this.findSubRegion(t.position[0],t.position[1]),n=this.bbox;if(!e){var i=(n[0]+n[2])/2,r=(n[1]+n[3])/2,o=(n[2]-n[0])/2,a=(n[3]-n[1])/2,s=t.position[0]>=i?1:0,l=t.position[1]>=r?1:0;(e=this._newSubRegion()).setBBox(s*o+n[0],l*a+n[1],(s+1)*o+n[0],(l+1)*a+n[1])}e.addNode(t)},u._updateCenterOfMass=function(t){null==this.centerOfMass&&(this.centerOfMass=new Float32Array(2));var e=this.centerOfMass[0]*this.mass,n=this.centerOfMass[1]*this.mass;e+=t.position[0]*t.mass,n+=t.position[1]*t.mass,this.mass+=t.mass,this.centerOfMass[0]=e/this.mass,this.centerOfMass[1]=n/this.mass};var f=d.prototype;f.initNodes=function(t,e,n){var i=e.length;this.nodes.length=0;for(var r=void 0!==n,o=0;o0&&(this.strongGravityMode?this.applyNodeStrongGravity(h):this.applyNodeGravity(h))}for(l=0;l0&&(m=Math.min(m/this._globalSpeed,1.5)*this._globalSpeed),this._globalSpeed=m;for(l=0;l0&&(_=Math.min(y*_,10)/y,i(u.position,u.position,u.force,_))}},f.applyRegionToNodeRepulsion=function(){var e=t();return function(t,n){if(t.node)this.applyNodeToNodeRepulsion(t.node,n,!0);else{o(e,n.position,t.centerOfMass);var r=e[0]*e[0]+e[1]*e[1];if(r>this.barnesHutTheta*t.size*t.size){var a=this.scaling*n.mass*t.mass/r;i(n.force,n.force,e,a)}else for(var s=0;s0)s=this.scaling*t.mass*n.mass/(l*l);else{if(!(l<0))return;s=100*this.scaling*t.mass*n.mass}}else s=this.scaling*t.mass*n.mass/a;i(t.force,t.force,e,s),i(n.force,n.force,e,-s)}}}}(),f.applyEdgeAttraction=function(){var e=t();return function(t){var r=t.source,a=t.target;o(e,r.position,a.position);var s,l,u=n(e);s=0===this.edgeWeightInfluence?1:1===this.edgeWeightInfluence?t.weight:Math.pow(t.weight,this.edgeWeightInfluence),this.preventOverlap&&(u=u-r.size-a.size)<=0||(l=this.linLogMode?-s*Math.log(u+1)/(u+1):-s,i(r.force,r.force,e,l),i(a.force,a.force,e,-l))}}(),f.applyNodeGravity=function(){var e=t();return function(t){o(e,this.gravityCenter,t.position);var r=n(e);i(t.force,t.force,e,this.gravity*t.mass/(r+1))}}(),f.applyNodeStrongGravity=function(){var e=t();return function(t){o(e,this.gravityCenter,t.position),i(t.force,t.force,e,this.gravity*t.mass)}}(),f.updateBBox=function(){for(var t=1/0,e=1/0,n=-1/0,i=-1/0,r=0;r5e4?10:o>5e3?1:.1,e.scaling=o>100?2:10,e.barnesHutOptimize=o>1e3,t)for(var n in ZG)null!=t[n]&&(e[n]=t[n]);if(!e.gravityCenter){for(var a=[1/0,1/0],s=[-1/0,-1/0],l=0;lt},XG.prototype.getNodePosition=function(t,e){if(e||(e=new Float32Array(2*this._nodes.length)),this._positionArr)for(var n=0;n0?1.1:.9,o=Math.max(Math.min(this._zoom*r,this.maxZoom),this.minZoom);r=o/this._zoom;var a=this._convertPos(n,i),s=(a.x-this._dx)*(r-1),l=(a.y-this._dy)*(r-1);this._dx-=s,this._dy-=l,this._zoom=o,this._needsUpdate=!0}}},dispose:function(){var t=this.zr;t.off("mousedown",this._mouseDownHandler),t.off("mousemove",this._mouseMoveHandler),t.off("mouseup",this._mouseUpHandler),t.off("mousewheel",this._mouseWheelHandler),t.off("globalout",this._mouseUpHandler),t.animation.off("frame",this._update)}});const KG=YG;var JG=$k.vec2;Lk.Shader.import("@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end");var $G=1;const QG=Wp.extend({type:"graphGL",__ecgl__:!0,init:function(t,e){this.groupGL=new Lk.Node,this.viewGL=new UB("orthographic"),this.viewGL.camera.left=this.viewGL.camera.right=0,this.viewGL.add(this.groupGL),this._pointsBuilder=new qV(!0,e),this._forceEdgesMesh=new Lk.Mesh({material:new Lk.Material({shader:Lk.createShader("ecgl.forceAtlas2.edges"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new Lk.Geometry({attributes:{node:new Lk.Geometry.Attribute("node","float",2),color:new Lk.Geometry.Attribute("color","float",4,"COLOR")},dynamic:!0,mainAttribute:"node"}),renderOrder:-1,mode:Lk.Mesh.LINES}),this._edgesMesh=new Lk.Mesh({material:new Lk.Material({shader:Lk.createShader("ecgl.meshLines2D"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new HG({useNativeLine:!1,dynamic:!0}),renderOrder:-1,culling:!1}),this._layoutId=0,this._control=new KG({zr:e.getZr(),viewGL:this.viewGL}),this._control.setTarget(this.groupGL),this._control.init(),this._clickHandler=this._clickHandler.bind(this)},render:function(t,e,n){this.groupGL.add(this._pointsBuilder.rootNode),this._model=t,this._api=n,this._initLayout(t,e,n),this._pointsBuilder.update(t,e,n),this._forceLayoutInstance instanceof UG||this.groupGL.remove(this._forceEdgesMesh),this._updateCamera(t,n),this._control.off("update"),this._control.on("update",(function(){n.dispatchAction({type:"graphGLRoam",seriesId:t.id,zoom:this._control.getZoom(),offset:this._control.getOffset()}),this._pointsBuilder.updateView(this.viewGL.camera)}),this),this._control.setZoom(XR.firstNotNull(t.get("zoom"),1)),this._control.setOffset(t.get("offset")||[0,0]);var i=this._pointsBuilder.getPointsMesh();if(i.off("mousemove",this._mousemoveHandler),i.off("mouseout",this._mouseOutHandler,this),n.getZr().off("click",this._clickHandler),this._pointsBuilder.highlightOnMouseover=!0,t.get("focusNodeAdjacency")){var r=t.get("focusNodeAdjacencyOn");"click"===r?n.getZr().on("click",this._clickHandler):"mouseover"===r&&(i.on("mousemove",this._mousemoveHandler,this),i.on("mouseout",this._mouseOutHandler,this),this._pointsBuilder.highlightOnMouseover=!1)}this._lastMouseOverDataIndex=-1},_clickHandler:function(t){if(!this._layouting){var e=this._pointsBuilder.getPointsMesh().dataIndex;e>=0?this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:e}):this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id})}},_mousemoveHandler:function(t){if(!this._layouting){var e=this._pointsBuilder.getPointsMesh().dataIndex;e>=0?e!==this._lastMouseOverDataIndex&&this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:e}):this._mouseOutHandler(t),this._lastMouseOverDataIndex=e}},_mouseOutHandler:function(t){this._layouting||(this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id}),this._lastMouseOverDataIndex=-1)},_updateForceEdgesGeometry:function(t,e){var n=this._forceEdgesMesh.geometry,i=e.getEdgeData(),r=0,o=this._forceLayoutInstance,a=2*i.count();n.attributes.node.init(a),n.attributes.color.init(a),i.each((function(e){var a=t[e];n.attributes.node.set(r,o.getNodeUV(a.node1)),n.attributes.node.set(r+1,o.getNodeUV(a.node2));var s=VF(i,a.dataIndex),l=Lk.parseColor(s);l[3]*=XR.firstNotNull(GF(i,a.dataIndex),1),n.attributes.color.set(r,l),n.attributes.color.set(r+1,l),r+=2})),n.dirty()},_updateMeshLinesGeometry:function(){var t=this._model.getEdgeData(),e=this._edgesMesh.geometry,n=(t=this._model.getEdgeData(),this._model.getData().getLayout("points"));e.resetOffset(),e.setVertexCount(t.count()*e.getLineVertexCount()),e.setTriangleCount(t.count()*e.getLineTriangleCount());var i=[],r=[],o=["lineStyle","width"];this._originalEdgeColors=new Float32Array(4*t.count()),this._edgeIndicesMap=new Float32Array(t.count()),t.each((function(a){var s=t.graph.getEdgeByIndex(a),l=2*s.node1.dataIndex,u=2*s.node2.dataIndex;i[0]=n[l],i[1]=n[l+1],r[0]=n[u],r[1]=n[u+1];var h=VF(t,s.dataIndex),c=Lk.parseColor(h);c[3]*=XR.firstNotNull(GF(t,s.dataIndex),1);var d=t.getItemModel(s.dataIndex),f=XR.firstNotNull(d.get(o),1)*this._api.getDevicePixelRatio();e.addLine(i,r,c,f);for(var p=0;p<4;p++)this._originalEdgeColors[4*s.dataIndex+p]=c[p];this._edgeIndicesMap[s.dataIndex]=a}),this),e.dirty()},_updateForceNodesGeometry:function(t){for(var e=this._pointsBuilder.getPointsMesh(),n=[],i=0;i=f&&(l._syncNodePosition(t),d=0),n.getZr().refresh(),Te((function(){p(e)}))}))};Te((function(){l._forceLayoutInstanceToDispose&&(l._forceLayoutInstanceToDispose.dispose(r.layer.renderer),l._forceLayoutInstanceToDispose=null),p(u)})),this._layouting=!0}}},stopLayout:function(t,e,n,i){i&&null!=i.from&&i.from!==this.uid||(this._layoutId=0,this.groupGL.remove(this._forceEdgesMesh),this.groupGL.add(this._edgesMesh),this._forceLayoutInstance&&this.viewGL.layer&&(i&&i.beforeLayout||(this._syncNodePosition(t),this._updateAfterLayout(t,e,n)),this._api.getZr().refresh(),this._layouting=!1))},_syncNodePosition:function(t){var e=this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);t.getData().setLayout("points",e),t.setNodePosition(e)},_updateAfterLayout:function(t,e,n){this._updateMeshLinesGeometry(),this._pointsBuilder.removePositionTexture(),this._pointsBuilder.updateLayout(t,e,n),this._pointsBuilder.updateView(this.viewGL.camera),this._pointsBuilder.updateLabels(),this._pointsBuilder.showLabels()},focusNodeAdjacency:function(t,e,n,i){var r=this._model.getData();this._downplayAll();var o=i.dataIndex,a=r.graph,s=[],l=a.getNodeByIndex(o);s.push(l),l.edges.forEach((function(t){t.dataIndex<0||(t.node1!==l&&s.push(t.node1),t.node2!==l&&s.push(t.node2))}),this),this._pointsBuilder.fadeOutAll(.05),this._fadeOutEdgesAll(.05),s.forEach((function(t){this._pointsBuilder.highlight(r,t.dataIndex)}),this),this._pointsBuilder.updateLabels(s.map((function(t){return t.dataIndex})));var u=[];l.edges.forEach((function(t){t.dataIndex>=0&&(this._highlightEdge(t.dataIndex),u.push(t))}),this),this._focusNodes=s,this._focusEdges=u},unfocusNodeAdjacency:function(t,e,n,i){this._downplayAll(),this._pointsBuilder.fadeInAll(),this._fadeInEdgesAll(),this._pointsBuilder.updateLabels()},_highlightEdge:function(t){var e=this._model.getEdgeData().getItemModel(t),n=Lk.parseColor(e.get("emphasis.lineStyle.color")||e.get("lineStyle.color")),i=XR.firstNotNull(e.get("emphasis.lineStyle.opacity"),e.get("lineStyle.opacity"),1);n[3]*=i,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],n)},_downplayAll:function(){this._focusNodes&&this._focusNodes.forEach((function(t){this._pointsBuilder.downplay(this._model.getData(),t.dataIndex)}),this),this._focusEdges&&this._focusEdges.forEach((function(t){this._downplayEdge(t.dataIndex)}),this)},_downplayEdge:function(t){var e=this._getColor(t,[]);this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],e)},_setEdgeFade:function(){var t=[];return function(e,n){this._getColor(e,t),t[3]*=n,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],t)}}(),_getColor:function(t,e){for(var n=0;n<4;n++)e[n]=this._originalEdgeColors[4*t+n];return e},_fadeOutEdgesAll:function(t){this._model.getData().graph.eachEdge((function(e){this._setEdgeFade(e.dataIndex,t)}),this)},_fadeInEdgesAll:function(){this._fadeOutEdgesAll(1)},_updateCamera:function(t,e){this.viewGL.setViewport(0,0,e.getWidth(),e.getHeight(),e.getDevicePixelRatio());for(var n=this.viewGL.camera,i=t.getData().getLayout("points"),r=JG.create(1/0,1/0),o=JG.create(-1/0,-1/0),a=[],s=0;sn.left&&un.top)){var h=Math.max(o[0]-r[0],10),c=h/e.getWidth()*e.getHeight();h*=1.4,c*=1.4,r[0]-=.2*h,n.left=r[0],n.top=l-c/2,n.bottom=l+c/2,n.right=h+r[0],n.near=0,n.far=100}},dispose:function(){var t=this.viewGL.layer.renderer;this._forceLayoutInstance&&this._forceLayoutInstance.dispose(t),this.groupGL.removeAll(),this._layoutId=-1,this._pointsBuilder.dispose()},remove:function(){this.groupGL.removeAll(),this._control.dispose()}});function tU(t){return t instanceof Array||(t=[t,t]),t}rx((function(t){function e(){}t.registerChartView(QG),t.registerSeriesModel(kG),t.registerVisual((function(t){const e={};t.eachSeriesByType("graphGL",(function(t){var n=t.getCategoriesData(),i=t.getData(),r={};n.each((function(i){var o=n.getName(i);r["ec-"+o]=i;var a=n.getItemModel(i),s=a.getModel("itemStyle").getItemStyle();s.fill||(s.fill=t.getColorFromPalette(o,e)),n.setItemVisual(i,"style",s);var l=["symbol","symbolSize","symbolKeepAspect"];for(let t=0;t65535?new Uint32Array(3*i):new Uint16Array(3*i))},addLine:function(t){var e=this._vertexOffset;this.attributes.position.set(e,[t[0],t[1],1]),this.attributes.position.set(e+1,[t[0],t[1],-1]),this.attributes.position.set(e+2,[t[0],t[1],2]),this.attributes.position.set(e+3,[t[0],t[1],-2]),this.setTriangleIndices(this._faceOffset++,[e,e+1,e+2]),this.setTriangleIndices(this._faceOffset++,[e+1,e+2,e+3]),this._vertexOffset+=4}});rE.import("@export ecgl.vfParticle.particle.fragment\n\nuniform sampler2D particleTexture;\nuniform sampler2D spawnTexture;\nuniform sampler2D velocityTexture;\n\nuniform float deltaTime;\nuniform float elapsedTime;\n\nuniform float speedScaling : 1.0;\n\nuniform vec2 textureSize;\nuniform vec4 region : [0, 0, 1, 1];\nuniform float firstFrameTime;\n\nvarying vec2 v_Texcoord;\n\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, v_Texcoord);\n bool spawn = false;\n if (p.w <= 0.0) {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.w -= firstFrameTime;\n spawn = true;\n }\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.w -= deltaTime;\n\n if (spawn || p.xy != fract(p.xy)) {\n p.z = 0.0;\n }\n p.xy = fract(p.xy);\n\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\nuniform sampler2D spriteTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef SPRITETEXTURE_ENABLED\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\n if (color.a == 0.0) {\n discard;\n }\n#endif\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.vertex\n\n#define PI 3.1415926\n\nattribute vec3 position : POSITION;\n\nuniform sampler2D particleTexture;\nuniform sampler2D prevParticleTexture;\n\nuniform float size : 1.0;\nuniform vec4 vp: VIEWPORT;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\n@import clay.util.rand\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, position.xy);\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\n\n p.xy = p.xy * 2.0 - 1.0;\n p2.xy = p2.xy * 2.0 - 1.0;\n\n if (p.w > 0.0 && p.z > 1e-5) {\n vec2 dir = normalize(p.xy - p2.xy);\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\n if (abs(position.z) == 2.0) {\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\n v_Uv = p.xy;\n v_Mag = p.z;\n }\n else {\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\n v_Mag = p2.z;\n v_Uv = p2.xy;\n }\n gl_Position = worldViewProjection * gl_Position;\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n #ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n");var iU=function(){this.motionBlurFactor=.99,this.vectorFieldTexture=new BO({type:IO.FLOAT,flipY:!1}),this.particleLife=[5,20],this._particleType="point",this._particleSize=1,this.particleColor=[1,1,1,1],this.particleSpeedScaling=1,this._thisFrameTexture=null,this._particlePass=null,this._spawnTexture=null,this._particleTexture0=null,this._particleTexture1=null,this._particlePointsMesh=null,this._surfaceFrameBuffer=null,this._elapsedTime=0,this._scene=null,this._camera=null,this._lastFrameTexture=null,this._supersampling=1,this._downsampleTextures=[],this._width=512,this._height=512,this.init()};iU.prototype={constructor:iU,init:function(){var t={type:IO.FLOAT,minFilter:IO.NEAREST,magFilter:IO.NEAREST,useMipmap:!1};this._spawnTexture=new BO(t),this._particleTexture0=new BO(t),this._particleTexture1=new BO(t),this._frameBuffer=new JN({depthBuffer:!1}),this._particlePass=new OR({fragment:rE.source("ecgl.vfParticle.particle.fragment")}),this._particlePass.setUniform("velocityTexture",this.vectorFieldTexture),this._particlePass.setUniform("spawnTexture",this._spawnTexture),this._downsamplePass=new OR({fragment:rE.source("clay.compositor.downsample")});var e=new EO({renderOrder:10,material:new xP({shader:new rE(rE.source("ecgl.vfParticle.renderPoints.vertex"),rE.source("ecgl.vfParticle.renderPoints.fragment"))}),mode:EO.POINTS,geometry:new JO({dynamic:!0,mainAttribute:"texcoord0"})}),n=new EO({renderOrder:10,material:new xP({shader:new rE(rE.source("ecgl.vfParticle.renderLines.vertex"),rE.source("ecgl.vfParticle.renderLines.fragment"))}),geometry:new nU,culling:!1}),i=new EO({material:new xP({shader:new rE(rE.source("ecgl.color.vertex"),rE.source("ecgl.color.fragment"))}),geometry:new nR});i.material.enableTexture("diffuseMap"),this._particlePointsMesh=e,this._particleLinesMesh=n,this._lastFrameFullQuadMesh=i,this._camera=new DR,this._thisFrameTexture=new BO,this._lastFrameTexture=new BO},setParticleDensity:function(t,e){for(var n=new Float32Array(4*(t*e)),i=0,r=this.particleLife,o=0;o0?t[t.length-1]:this._lastFrameTexture},setRegion:function(t){this._particlePass.setUniform("region",t)},resize:function(t,e){this._lastFrameTexture.width=t*this._supersampling,this._lastFrameTexture.height=e*this._supersampling,this._thisFrameTexture.width=t*this._supersampling,this._thisFrameTexture.height=e*this._supersampling,this._width=t,this._height=e},setParticleSize:function(t){var e=this._getParticleMesh();if(t<=2)return e.material.disableTexture("spriteTexture"),void(e.material.transparent=!1);this._spriteTexture||(this._spriteTexture=new BO),this._spriteTexture.image&&this._spriteTexture.image.width===t||(this._spriteTexture.image=function(t){var e=document.createElement("canvas");e.width=e.height=t;var n=e.getContext("2d");return n.fillStyle="#fff",n.arc(t/2,t/2,t/2,0,2*Math.PI),n.fill(),e}(t),this._spriteTexture.dirty()),e.material.transparent=!0,e.material.enableTexture("spriteTexture"),e.material.set("spriteTexture",this._spriteTexture),this._particleSize=t},setGradientTexture:function(t){var e=this._getParticleMesh().material;e[t?"enableTexture":"disableTexture"]("gradientTexture"),e.setUniform("gradientTexture",t)},setColorTextureImage:function(t,e){this._getParticleMesh().material.setTextureImage("colorTexture",t,e,{flipY:!0})},setParticleType:function(t){this._particleType=t},clearFrame:function(t){var e=this._frameBuffer;e.attach(this._lastFrameTexture),e.bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),e.unbind(t)},setSupersampling:function(t){this._supersampling=t,this.resize(this._width,this._height)},_updateDownsampleTextures:function(t,e){for(var n=this._downsampleTextures,i=Math.max(Math.floor(Math.log(this._supersampling/e.getDevicePixelRatio())/Math.log(2)),0),r=2,o=this._width*this._supersampling,a=this._height*this._supersampling,s=0;s=359&&(r[0]>0&&(r[0]=0),o[0]1?(e.material.shader!==this._meshLinesShader&&e.material.attachShader(this._meshLinesShader),e.mode=Lk.Mesh.TRIANGLES):(e.material.shader!==this._nativeLinesShader&&e.material.attachShader(this._nativeLinesShader),e.mode=Lk.Mesh.LINES),n=n||0,i=i||r.count(),s.resetOffset();var h=0,c=0,d=[],f=[],p=[],g=[],m=[],v=.3,_=.7;function y(){f[0]=d[0]*_+g[0]*v-(d[1]-g[1])*o,f[1]=d[1]*_+g[1]*v-(g[0]-d[0])*o,p[0]=d[0]*v+g[0]*_-(d[1]-g[1])*o,p[1]=d[1]*v+g[1]*_-(g[0]-d[0])*o}if(a||0!==o)for(var x=n;x{let o="right";return r.viewSize[0]-t[0]"graph"===t.componentSubType?"edge"===t.dataType?e.utils.getLinkTooltipInfo(t.data):e.utils.getNodeTooltipInfo(t.data):"graphGL"===t.componentSubType?e.utils.getNodeTooltipInfo(t.data):"lines"===t.componentSubType?e.utils.getLinkTooltipInfo(t.data.link):e.utils.getNodeTooltipInfo(t.data.node)}},n.echartsOption);return i.setOption(e.utils.deepMergeObj(r,t)),i.on("click",(t=>{const i=n.onClickElement.bind(e);return"graph"===t.componentSubType?i("edge"===t.dataType?"link":"node",t.data):"graphGL"===t.componentSubType?i("node",t.data):"lines"===t.componentSubType?i("link",t.data.link):!t.data.cluster&&i("node",t.data.node)}),{passive:!0}),i}generateGraphOption(t,e){const n=[],i=e.config,r=t.nodes.map((t=>{const n=JSON.parse(JSON.stringify(t)),{nodeStyleConfig:r,nodeSizeConfig:o,nodeEmphasisConfig:a}=e.utils.getNodeStyle(t,i,"graph");return n.itemStyle=r,n.symbolSize=o,n.emphasis={itemStyle:a.nodeStyle,symbolSize:a.nodeSize},n.name="string"==typeof t.label?t.label:"",n})),o=t.links.map((t=>{const n=JSON.parse(JSON.stringify(t)),{linkStyleConfig:r,linkEmphasisConfig:o}=e.utils.getLinkStyle(t,i,"graph");return n.lineStyle=r,n.emphasis={lineStyle:o.linkStyle},n})),a=[Object.assign(i.graphConfig.series,{type:"graphGL"===i.graphConfig.series.type?"graphGL":"graph",layout:"graphGL"===i.graphConfig.series.type?"forceAtlas2":i.graphConfig.series.layout,nodes:r,links:o})];return{legend:n.length?{data:n}:void 0,series:a,...i.graphConfig.baseOptions}}generateMapOption(t,e,n=[]){const i=e.config,{nodes:r,links:o}=t,a=t.flatNodes||{},s=[];let l=[];r.forEach((n=>{if(n.properties&&(t.flatNodes||(a[n.id]=JSON.parse(JSON.stringify(n)))),!n.properties||!n.properties._featureType||"Point"===n.properties._featureType)if(n.properties){const{location:t}=n.properties;if(t&&t.lng&&t.lat){const{nodeEmphasisConfig:r}=e.utils.getNodeStyle(n,i,"map");l.push({name:"string"==typeof n.label?n.label:"",value:[t.lng,t.lat],emphasis:{itemStyle:r.nodeStyle,symbolSize:r.nodeSize},node:n})}else console.error(`Node ${n.id} position is undefined!`)}else console.error(`Node ${n.id} position is undefined!`)})),o.forEach((t=>{if(a[t.source])if(a[t.target]){const{linkStyleConfig:n,linkEmphasisConfig:r}=e.utils.getLinkStyle(t,i,"map");s.push({coords:[[a[t.source].properties.location.lng,a[t.source].properties.location.lat],[a[t.target].properties.location.lng,a[t.target].properties.location.lat]],lineStyle:n,emphasis:{lineStyle:r.linkStyle},link:t})}else console.warn(`Node ${t.target} does not exist!`);else console.warn(`Node ${t.source} does not exist!`)})),l=l.concat(n);const u=[{type:"effectScatter"===i.mapOptions.nodeConfig.type?"effectScatter":"scatter",name:"nodes",coordinateSystem:"leaflet",data:l,animationDuration:1e3,label:i.mapOptions.nodeConfig.label,itemStyle:{color:t=>{if(t.data&&t.data.cluster&&t.data.itemStyle&&t.data.itemStyle.color)return t.data.itemStyle.color;if(t.data&&t.data.node&&t.data.node.category){const e=i.nodeCategories.find((e=>e.name===t.data.node.category));return e&&e.nodeStyle&&e.nodeStyle.color||i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeStyle&&i.mapOptions.nodeConfig.nodeStyle.color||"#6c757d"}return i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeStyle&&i.mapOptions.nodeConfig.nodeStyle.color||"#6c757d"}},symbolSize:(t,n)=>{if(n.data&&n.data.cluster)return i.mapOptions.clusterConfig&&i.mapOptions.clusterConfig.symbolSize||30;if(n.data&&n.data.node){const{nodeSizeConfig:t}=e.utils.getNodeStyle(n.data.node,i,"map");return"object"==typeof t?i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeSize||17:t}return i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeSize||17},emphasis:i.mapOptions.nodeConfig.emphasis},Object.assign(i.mapOptions.linkConfig,{type:"lines",coordinateSystem:"leaflet",data:s})];return{leaflet:{tiles:i.mapTileConfig,mapOptions:i.mapOptions},series:u,...i.mapOptions.baseOptions}}graphRender(t,e){e.utils.echartsSetOption(e.utils.generateGraphOption(t,e),e),window.onresize=()=>{e.echarts.resize()},e.event.emit("onLoad"),e.event.emit("onReady"),e.event.emit("renderArray")}mapRender(t,e){if(!e.config.mapTileConfig[0])throw new Error('You must add the tiles via the "mapTileConfig" param!');e.utils.isGeoJSON(t)&&(e.originalGeoJSON=JSON.parse(JSON.stringify(t)),t=e.utils.geojsonToNetjson(t));const n=e.utils.generateMapOption(t,e);if(e.utils.echartsSetOption(n,e),e.bboxData={nodes:[],links:[]},e.leaflet=e.echarts._api.getCoordinateSystems()[0].getLeaflet(),e.leaflet._zoomAnimated=!1,e.config.geoOptions=e.utils.deepMergeObj({pointToLayer:(t,n)=>p().circleMarker(n,e.config.geoOptions.style),onEachFeature:(t,n)=>{n.on("click",(()=>{const n={...t.properties};e.config.onClickElement.call(e,"Feature",n)}))}},e.config.geoOptions),e.originalGeoJSON){!function(t){if(!t.originalGeoJSON||!Array.isArray(t.originalGeoJSON.features))return;const e=t.leaflet,n=t.originalGeoJSON.features.filter((t=>t&&t.geometry&&("Polygon"===t.geometry.type||"MultiPolygon"===t.geometry.type)));if(!n.length)return;let i=e.getPane("njg-polygons");i||(i=e.createPane("njg-polygons"),i.style.zIndex=410);const r={fillColor:"#1566a9",color:"#1566a9",weight:0,fillOpacity:.6},o=p().geoJSON({type:"FeatureCollection",features:n},{pane:"njg-polygons",style:e=>{const n=e.properties&&e.properties.echartsStyle||{},i={...r,...t.config.geoOptions&&t.config.geoOptions.style};return n.areaColor&&(i.fillColor=n.areaColor),n.color&&(i.color=n.color),void 0!==n.opacity&&(i.fillOpacity=n.opacity),void 0!==n.borderWidth&&(i.weight=n.borderWidth),i},onEachFeature:(e,n)=>{n.on("click",(()=>{const n=e.properties||{};t.config.onClickElement.call(t,"Feature",n)}))},...t.config.geoOptions}).addTo(e);t.leaflet.polygonGeoJSON=o}(e);let n=null;if(e.leaflet.polygonGeoJSON&&"function"==typeof e.leaflet.polygonGeoJSON.getBounds&&(n=e.leaflet.polygonGeoJSON.getBounds()),t.nodes&&t.nodes.length){const e=t.nodes.map((t=>t.properties.location)).map((t=>[t.lat,t.lng]));n?e.forEach((t=>n.extend(t))):n=p().latLngBounds(e)}n&&n.isValid()&&e.leaflet.fitBounds(n,{padding:[20,20]})}if(e.leaflet.getZoom(){const t=e.leaflet.getZoom(),n=t>=e.config.showLabelsAtZoomLevel;e.echarts.setOption({series:[{label:{show:n},emphasis:{label:{show:n}}}]});const i=e.leaflet.getMinZoom(),r=e.leaflet.getMaxZoom(),o=document.querySelector(".leaflet-control-zoom-in"),a=document.querySelector(".leaflet-control-zoom-out");o&&a&&(Math.round(t)>=r?o.classList.add("leaflet-disabled"):o.classList.remove("leaflet-disabled"),Math.round(t)<=i?a.classList.add("leaflet-disabled"):a.classList.remove("leaflet-disabled"))})),e.leaflet.on("moveend",(async()=>{const n=e.leaflet.getBounds();if(e.leaflet.getZoom()>=e.config.loadMoreAtZoomLevel&&e.hasMoreData){const i=await e.utils.getBBoxData.call(e,e.JSONParam,n);e.config.prepareData.call(e,i);const r=new Set(e.data.nodes.map((t=>t.id))),o=new Set(e.data.links.map((t=>t.source))),a=new Set(e.data.links.map((t=>t.target))),s=i.nodes.filter((t=>!r.has(t.id))),l=i.links.filter((t=>!o.has(t.source)&&!a.has(t.target))),u=new Set(i.nodes.map((t=>t.id))),h=e.bboxData.nodes.filter((t=>!u.has(t.id))),c=new Set(h.map((t=>t.id)));t.nodes=t.nodes.filter((t=>!c.has(t.id))),e.bboxData.nodes=e.bboxData.nodes.concat(s),e.bboxData.links=e.bboxData.links.concat(l),t={...t,nodes:t.nodes.concat(s),links:t.links.concat(l)},e.echarts.setOption(e.utils.generateMapOption(t,e)),e.data=t}else e.hasMoreData&&e.bboxData.nodes.length>0&&(()=>{const n=new Set(e.bboxData.nodes),i=new Set(e.bboxData.links);t={...t,nodes:t.nodes.filter((t=>!n.has(t))),links:t.links.filter((t=>!i.has(t)))},e.data=t,e.echarts.setOption(e.utils.generateMapOption(t,e)),e.bboxData.nodes=[],e.bboxData.links=[]})()})),e.config.clustering&&e.config.clusteringThresholde.config.disableClusteringAtLevel&&(n=[],i=t.nodes,r=t.links),e.echarts.setOption(e.utils.generateMapOption({...t,nodes:i,links:r},e,n)),e.echarts.on("click",(t=>{if(("scatter"===t.componentSubType||"effectScatter"===t.componentSubType)&&t.data.cluster){const n=e.leaflet.getZoom(),i=Math.min(n+2,e.leaflet.getMaxZoom());e.leaflet.setView([t.data.value[1],t.data.value[0]],i)}})),e.leaflet.on("zoomend",(()=>{if(e.leaflet.getZoom(){e.echarts.appendData({seriesIndex:n,data:t.data})})),e.utils.mergeData(t,e)}e.config.afterUpdate.call(e)}addData(t,e){e.utils.mergeData(t,e),e.data.nodes&&e.data.nodes.length>0&&(e.data.nodes=e.utils.deduplicateNodesById(e.data.nodes)),e.utils.render(),e.config.afterUpdate.call(e)}mergeData(t,e){t.nodes||(t.nodes=[]);const n=new Set;e.data.nodes.forEach((t=>{t.id&&n.add(t.id)}));const i=t.nodes.filter((t=>!t.id||(!n.has(t.id)||(console.warn(`Duplicate node ID ${t.id} detected during merge and skipped.`),!1)))),r=e.data.nodes.concat(i),o=t.links||[],a=e.data.links.concat(o);Object.assign(e.data,t,{nodes:r,links:a})}}const hU=function(t,e){const{util:n,graphic:i,matrix:r}=t,o=e.Layer.extend({initialize(t){this._container=t},onAdd(t){t.getPane(this.options.pane).appendChild(this._container),t.zoomControl.setPosition("topright")},onRemove(){e.DomUtil.remove(this._container)},_update(){}});function a(t,n){this._map=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=n,this._projection=e.Projection.Mercator}function s(t,e,n,i){const{leafletModel:r,seriesModel:o}=n,a=r?r.coordinateSystem:o?o.coordinateSystem||(o.getReferringComponents("leaflet")[0]||{}).coordinateSystem:null;return a===this?a[t](i):null}return a.dimensions=["lng","lat"],a.prototype.dimensions=["lng","lat"],a.prototype.setZoom=function(t){this._zoom=t},a.prototype.setCenter=function(t){this._center=this._projection.project(new e.LatLng(t[1],t[0]))},a.prototype.setMapOffset=function(t){this._mapOffset=t},a.prototype.getLeaflet=function(){return this._map},a.prototype.getViewRect=function(){const t=this._api;return new i.BoundingRect(0,0,t.getWidth(),t.getHeight())},a.prototype.getRoamTransform=function(){return r.create()},a.prototype.dataToPoint=function(t){const n=new e.LatLng(t[1],t[0]),i=this._map.latLngToLayerPoint(n),r=this._mapOffset;return[i.x-r[0],i.y-r[1]]},a.prototype.pointToData=function(t){const e=this._mapOffset,n=this._map.layerPointToLatLng({x:t[0]+e[0],y:t[1]+e[1]});return[n.lng,n.lat]},a.prototype.convertToPixel=n.curry(s,"dataToPoint"),a.prototype.convertFromPixel=n.curry(s,"pointToData"),a.create=function(t,n){let i;const r=[],s=n.getDom();return t.eachComponent("leaflet",(t=>{const l=n.getZr().painter.getViewportRoot();if(void 0===e)throw new Error("Leaflet api is not loaded");if(i)throw new Error("Only one leaflet component can exist");if(!t.__map){let n=s.querySelector(".ec-extension-leaflet");n&&(l.style.left="0px",l.style.top="0px",s.removeChild(n)),n=document.createElement("div"),n.style.cssText="width:100%;height:100%",n.classList.add("ec-extension-leaflet"),s.appendChild(n),t.__map=e.map(n,t.get("mapOptions"));const i=t.__map,r=t.get("tiles"),a={};let u=!1;if(r.forEach((t=>{const n=e.tileLayer(t.urlTemplate,t.options);t.label?(u||(n.addTo(i),u=!0),a[t.label]=n):n.addTo(i)})),r.length>1){const n=t.get("layerControl");e.control.layers(a,{},n).addTo(i)}const h=document.createElement("div");h.style="position: absolute;left: 0;top: 0;z-index: 100",h.appendChild(l),new o(h).addTo(i)}const u=t.__map;i=new a(u,n),r.push(i),i.setMapOffset(t.__mapOffset||[0,0]);const{center:h,zoom:c}=t.get("mapOptions");h&&c&&(i.setZoom(c),i.setCenter(h)),t.coordinateSystem=i})),t.eachSeries((t=>{"leaflet"===t.get("coordinateSystem")&&(t.coordinateSystem=i)})),r},a};function cU(t,e,n){!function(t){t.extendComponentModel({type:"leaflet",getLeaflet(){return this.__map},setCenterAndZoom(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged(t,e){const{option:n}=this;return i=t,r=n.center,!(i&&r&&i[0]===r[0]&&i[1]===r[1]&&e===n.zoom);var i,r},defaultOption:{mapOptions:{},tiles:[{urlTemplate:"http://{s}.tile.osm.org/{z}/{x}/{y}.png",options:{attribution:'© OpenStreetMap contributors'}}],layerControl:{}}})}(t),function(t){t.extendComponentView({type:"leaflet",render(e,n,i){let r=!0;const o=e.getLeaflet(),a=i.getZr().painter.getViewportRoot().parentNode,s=e.coordinateSystem,{roam:l}=e.get("mapOptions");function u(t){if(r)return;const n=o._mapPane;let l=n.style.transform,u=0,h=0;if(l){l=l.replace("translate3d(","");let t=l.split(",");u=-parseInt(t[0],10),h=-parseInt(t[1],10)}else u=-parseInt(n.style.left,10),h=-parseInt(n.style.top,10);let c=[u,h];a.style.left=`${c[0]}px`,a.style.top=`${c[1]}px`,s.setMapOffset(c),e.__mapOffset=c,i.dispatchAction({type:"leafletRoam",animation:{duration:0}})}function h(){r||i.dispatchAction({type:"leafletRoam"})}function c(){u()}function d(){t.getInstanceByDom(i.getDom()).resize()}l&&"scale"!==l?o.dragging.enable():o.dragging.disable(),l&&"move"!==l?(o.scrollWheelZoom.enable(),o.doubleClickZoom.enable(),o.touchZoom.enable()):(o.scrollWheelZoom.disable(),o.doubleClickZoom.disable(),o.touchZoom.disable()),this._oldMoveHandler&&o.off("move",this._oldMoveHandler),this._oldZoomHandler&&o.off("zoom",this._oldZoomHandler),this._oldZoomEndHandler&&o.off("zoomend",this._oldZoomEndHandler),this._oldResizeHandler&&o.off("resize",this._oldResizeHandler),o.on("move",u),o.on("zoom",c),o.on("zoomend",h),o.on("resize",d),this._oldMoveHandler=u,this._oldZoomHandler=c,this._oldZoomEndHandler=h,this._oldResizeHandler=d,r=!1}})}(t),t.registerCoordinateSystem("leaflet",hU(t,e)),t.registerAction({type:"leafletRoam",event:"leafletRoam",update:"updateLayout"},((t,e)=>{e.eachComponent("leaflet",(t=>{const e=t.getLeaflet(),n=e.getCenter();t.setCenterAndZoom([n.lng,n.lat],e.getZoom())}))}))}cU.version="1.0.0";const dU=cU;const fU=class{constructor(t){this.self=t,this.renderModeSelector=null,this.controls=null,this.sideBar=null,this.metaInfoContainer=null,this.nodeLinkInfoContainer=null}createControls(){const t=document.createElement("div");return t.setAttribute("class","njg-controls"),this.self.el.appendChild(t),t}createRenderModeSelector(){const t=document.createElement("div"),e=document.createElement("span");return e.setAttribute("class","iconfont icon-eye"),t.setAttribute("class","njg-selectIcon"),t.appendChild(e),this.controls.appendChild(t),t}createSideBar(){const t=document.createElement("div");t.setAttribute("class","njg-sideBar"),t.classList.add("hidden");const e=document.createElement("button");return t.appendChild(e),e.classList.add("sideBarHandle"),e.onclick=()=>{t.classList.toggle("hidden");const e=document.querySelector(".njg-metaInfoContainer");(this.self.config.showMetaOnNarrowScreens||this.self.el.clientWidth>850)&&e&&(e.style.display="flex")},this.self.el.appendChild(t),t}hideInfoOnNarrowScreen(){!this.self.config.showMetaOnNarrowScreens&&this.self.el.clientWidth<850&&(this.metaInfoContainer.style.display="none"),"none"===this.metaInfoContainer.style.display&&"none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")}createMetaInfoContainer(){const t=document.createElement("div"),e=document.createElement("h2"),n=document.createElement("div");n.classList.add("njg-metaData"),t.classList.add("njg-metaInfoContainer");const i=document.createElement("span");return i.classList.add("njg-closeButton"),e.innerHTML="Info",i.innerHTML=" ✕",e.appendChild(i),t.appendChild(e),t.appendChild(n),this.metaInfoContainer=t,this.sideBar.appendChild(t),this.nodeLinkInfoContainer=this.createNodeLinkInfoContainer(),this.hideInfoOnNarrowScreen(),window.addEventListener("resize",this.hideInfoOnNarrowScreen.bind(this)),i.onclick=()=>{this.metaInfoContainer.style.display="none","none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")},t}createNodeLinkInfoContainer(){const t=document.createElement("div");return t.classList.add("njg-nodeLinkInfoContainer"),t.style.display="none",this.sideBar.appendChild(t),t}getNodeLinkInfo(t,e){const n=document.querySelectorAll(".njg-infoContainer"),i=document.querySelectorAll(".njg-headerContainer");for(let t=0;t{const n=e[t];if(null==n||"string"==typeof n&&(""===n.trim()||/^(undefined|null)$/i.test(n.trim()))&&"0"!==n)return;const i=document.createElement("div");i.classList.add("njg-infoItems");const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const a=document.createElement("span");if(a.setAttribute("class","njg-valueLabel"),"location"===t)r.innerHTML="Location",a.innerHTML=`${Math.round(1e3*e[t].lat)/1e3}, ${Math.round(1e3*e[t].lng)/1e3}`;else if("localAddresses"===t)r.innerHTML="Local Addresses",a.innerHTML=e[t].join("
");else{r.innerHTML=t;const e="string"==typeof n?n.replace(/\n/g,"
"):n;a.innerHTML=e}i.appendChild(r),i.appendChild(a),o.appendChild(i)})),r.appendChild(a),r.appendChild(s),this.nodeLinkInfoContainer.appendChild(r),this.nodeLinkInfoContainer.appendChild(o),s.onclick=()=>{this.nodeLinkInfoContainer.style.display="none",null!==this.metaInfoContainer&&"none"!==this.metaInfoContainer.style.display||this.sideBar.classList.add("hidden")}}init(){this.sideBar=this.createSideBar(),this.self.config.switchMode&&(this.controls=this.createControls(),this.renderModeSelector=this.createRenderModeSelector())}},pU=n(698),{each:gU}=n(26),mU=n(123);dU(c,p(),{colorTool:pU,each:gU,env:mU}),window.NetJSONGraph=class{constructor(t,e={}){return this.graph=new A(t),this.config=this.initializeConfig(e),this.graph.setConfig(this.config),this.setupGraph(),this.config.onInit.call(this.graph),this.initializeECharts(),this.graph}initializeConfig(t={}){return{...t,render:"map"===t.render?uU.prototype.mapRender:uU.prototype.graphRender,onInit:this.onInit,onRender:this.onRender,onUpdate:this.onUpdate,afterUpdate:this.afterUpdate,onLoad:this.onLoad}}setupGraph(){Object.setPrototypeOf(uU.prototype,this.graph.utils),this.graph.gui=new fU(this.graph),this.graph.utils=new uU,this.graph.setUtils(),this.graph.event=this.graph.utils.createEvent()}initializeECharts(){this.graph.echarts=Ov(this.graph.el,null,{renderer:this.graph.config.svgRender?"svg":"canvas"})}onInit(){return this.config}onRender(){return this.utils.showLoading.call(this),this.gui.init(),this.config}onUpdate(){return this.config}afterUpdate(){return this.config}onLoad(){return this.config.metadata&&this.utils.isNetJSON(this.data)?(this.gui.createMetaInfoContainer(this.graph),this.utils.updateMetadata.call(this)):this.gui.nodeLinkInfoContainer=this.gui.createNodeLinkInfoContainer(),this.config.switchMode&&this.utils.isNetJSON(this.data)&&(this.gui.renderModeSelector.onclick=()=>{if(this.config.render===this.utils.mapRender){this.config.render=this.utils.graphRender;const t=this.echarts.getZr().painter.getViewportRoot().parentNode;this.echarts.clear(),this.utils.graphRender(this.data,this),t.style.background=this.echarts.getZr()._backgroundColor,document.querySelector(".leaflet-control-attribution").style.display="none",document.querySelector(".leaflet-control-zoom").style.display="none"}else this.echarts.clear(),this.config.render=this.utils.mapRender,this.utils.mapRender(this.data,this),document.querySelector(".leaflet-control-attribution").style.display="block",document.querySelector(".leaflet-control-zoom").style.display="block"}),this.utils.hideLoading.call(this),this.config}},window.echarts=c,window.L=p()})()})(); +var Oo={},No={};var Ro,ko=function(){function t(t,e,n){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=e,this.id=t;var r=new Hn,o=n.renderer||"canvas";Oo[o]||(o=mt(Oo)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var a=new Oo[o](e,r,n,t),s=n.ssr||a.ssrOnly;this.storage=r,this.painter=a;var l,u=O.node||O.worker||s?null:new qr(a.getViewportRoot(),a.root),h=n.useCoarsePointer;(null==h||"auto"===h?O.touchEventsSupported:!!h)&&(l=Ot(n.pointerSize,44)),this.handler=new Dn(r,a,u,a.root,l),this.animation=new Dr({stage:{update:s?null:function(){return i._flush(!0)}}}),s||this.animation.start()}return t.prototype.add=function(t){!this._disposed&&t&&(this.storage.addRoot(t),t.addSelfToZr(this),this.refresh())},t.prototype.remove=function(t){!this._disposed&&t&&(this.storage.delRoot(t),t.removeSelfFromZr(this),this.refresh())},t.prototype.configLayer=function(t,e){this._disposed||(this.painter.configLayer&&this.painter.configLayer(t,e),this.refresh())},t.prototype.setBackgroundColor=function(t){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(t),this.refresh(),this._backgroundColor=t,this._darkMode=function(t){if(!t)return!1;if("string"==typeof t)return Zi(t,1)<.4;if(t.colorStops){for(var e=t.colorStops,n=0,i=e.length,r=0;r0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},t.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover())},t.prototype.resize=function(t){this._disposed||(t=t||{},this.painter.resize(t.width,t.height),this.handler.resize())},t.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},t.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},t.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},t.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},t.prototype.findHover=function(t,e){if(!this._disposed)return this.handler.findHover(t,e)},t.prototype.on=function(t,e,n){return this._disposed||this.handler.on(t,e,n),this},t.prototype.off=function(t,e){this._disposed||this.handler.off(t,e)},t.prototype.trigger=function(t,e){this._disposed||this.handler.trigger(t,e)},t.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),e=0;e0){if(t<=r)return a;if(t>=o)return s}else{if(t>=r)return a;if(t<=o)return s}else{if(t===r)return a;if(t===o)return s}return(t-r)/l*u+a}function qo(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return wt(t)?(n=t,n.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t;var n}function Yo(t,e,n){return null==e&&(e=10),e=Math.min(Math.max(0,e),Zo),t=(+t).toFixed(e),n?t:+t}function Ko(t){return t.sort((function(t,e){return t-e})),t}function Jo(t){if(t=+t,isNaN(t))return 0;if(t>1e-14)for(var e=1,n=0;n<15;n++,e*=10)if(Math.round(t*e)/e===t)return n;return Qo(t)}function Qo(t){var e=t.toString().toLowerCase(),n=e.indexOf("e"),i=n>0?+e.slice(n+1):0,r=n>0?n:e.length,o=e.indexOf("."),a=o<0?0:r-1-o;return Math.max(0,a-i)}function $o(t,e){var n=Math.log,i=Math.LN10,r=Math.floor(n(t[1]-t[0])/i),o=Math.round(n(Math.abs(e[1]-e[0]))/i),a=Math.min(Math.max(-r+o,0),20);return isFinite(a)?a:20}function ta(t,e,n){if(!t[e])return 0;var i=function(t,e){var n=ft(t,(function(t,e){return t+(isNaN(e)?0:e)}),0);if(0===n)return[];var i=Math.pow(10,e),r=dt(t,(function(t){return(isNaN(t)?0:t)/n*i*100})),o=100*i,a=dt(r,(function(t){return Math.floor(t)})),s=ft(a,(function(t,e){return t+e}),0),l=dt(r,(function(t,e){return t-a[e]}));for(;su&&(u=l[c],h=c);++a[h],l[h]=0,++s}return dt(a,(function(t){return t/i}))}(t,n);return i[e]||0}function ea(t,e){var n=Math.max(Jo(t),Jo(e)),i=t+e;return n>Zo?i:Yo(i,n)}var na=9007199254740991;function ia(t){var e=2*Math.PI;return(t%e+e)%e}function ra(t){return t>-jo&&t=10&&e++,e}function ua(t,e){var n=la(t),i=Math.pow(10,n),r=t/i;return t=(e?r<1.5?1:r<2.5?2:r<4?3:r<7?5:10:r<1?1:r<2?2:r<3?3:r<5?5:10)*i,n>=-20?+t.toFixed(n<0?-n:0):t}function ha(t,e){var n=(t.length-1)*e+1,i=Math.floor(n),r=+t[i-1],o=n-i;return o?r+o*(t[i]-r):r}function ca(t){t.sort((function(t,e){return s(t,e,0)?-1:1}));for(var e=-1/0,n=1,i=0;i=0||r&&st(r,s)<0)){var l=n.getShallow(s,e);null!=l&&(o[t[a][0]]=l)}}return o}}var Ka=Ya([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),Ja=function(){function t(){}return t.prototype.getAreaStyle=function(t,e){return Ka(this,t,e)},t}(),Qa=new bi(50);function $a(t){if("string"==typeof t){var e=Qa.get(t);return e&&e.image}return t}function ts(t,e,n,i,r){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!n)return e;var o=Qa.get(t),a={hostEl:n,cb:i,cbPayload:r};return o?!ns(e=o.image)&&o.pending.push(a):((e=F.loadImage(t,es,es)).__zrImageSrc=t,Qa.put(t,e.__cachedImgObj={image:e,pending:[a]})),e}return t}return e}function es(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e=a;l++)s-=a;var u=co(n,e);return u>s&&(n="",u=0),s=t-u,r.ellipsis=n,r.ellipsisWidth=u,r.contentWidth=s,r.containerWidth=t,r}function ss(t,e,n){var i=n.containerWidth,r=n.font,o=n.contentWidth;if(!i)return t.textLine="",void(t.isTruncated=!1);var a=co(e,r);if(a<=i)return t.textLine=e,void(t.isTruncated=!1);for(var s=0;;s++){if(a<=o||s>=n.maxIterations){e+=n.ellipsis;break}var l=0===s?ls(e,o,n.ascCharWidth,n.cnCharWidth):a>0?Math.floor(e.length*o/a):0;a=co(e=e.substr(0,l),r)}""===e&&(e=n.placeholder),t.textLine=e,t.isTruncated=!0}function ls(t,e,n,i){for(var r=0,o=0,a=t.length;o0&&p+i.accumWidth>i.width&&(o=e.split("\n"),c=!0),i.accumWidth=p}else{var g=gs(e,h,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+f,a=g.linesWidths,o=g.lines}}else o=e.split("\n");for(var m=0;m=32&&e<=591||e>=880&&e<=4351||e>=4608&&e<=5119||e>=7680&&e<=8303}(t)||!!fs[t]}function gs(t,e,n,i,r){for(var o=[],a=[],s="",l="",u=0,h=0,c=0;cn:r+h+f>n)?h?(s||l)&&(p?(s||(s=l,l="",h=u=0),o.push(s),a.push(h-u),l+=d,s="",h=u+=f):(l&&(s+=l,l="",u=0),o.push(s),a.push(h),s=d,h=f)):p?(o.push(l),a.push(u),l=d,u=f):(o.push(d),a.push(f)):(h+=f,p?(l+=d,u+=f):(l&&(s+=l,l="",u=0),s+=d))}else l&&(s+=l,h+=u),o.push(s),a.push(h),s="",l="",u=0,h=0}return o.length||s||(s=t,l="",u=0),l&&(s+=l),s&&(o.push(s),a.push(h)),1===o.length&&(h+=r),{accumWidth:h,lines:o,linesWidths:a}}var ms="__zr_style_"+Math.round(10*Math.random()),vs={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},_s={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};vs[ms]=!0;var ys=["z","z2","invisible"],xs=["invisible"],ws=function(t){function e(e){return t.call(this,e)||this}var n;return I(e,t),e.prototype._init=function(e){for(var n=mt(e),i=0;i1e-4)return s[0]=t-n,s[1]=e-i,l[0]=t+n,void(l[1]=e+i);if(Is[0]=As(r)*n+t,Is[1]=Ls(r)*i+e,Ps[0]=As(o)*n+t,Ps[1]=Ls(o)*i+e,u(s,Is,Ps),h(l,Is,Ps),(r%=Ds)<0&&(r+=Ds),(o%=Ds)<0&&(o+=Ds),r>o&&!a?o+=Ds:rr&&(Es[0]=As(f)*n+t,Es[1]=Ls(f)*i+e,u(s,Es,s),h(l,Es,l))}var Fs={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Vs=[],Gs=[],Hs=[],Us=[],Ws=[],js=[],Zs=Math.min,Xs=Math.max,qs=Math.cos,Ys=Math.sin,Ks=Math.abs,Js=Math.PI,Qs=2*Js,$s="undefined"!=typeof Float32Array,tl=[];function el(t){return Math.round(t/Js*1e8)/1e8%2*Js}var nl=function(){function t(t){this.dpr=1,this._xi=0,this._yi=0,this._x0=0,this._y0=0,this._len=0,t&&(this._saveData=!1),this._saveData&&(this.data=[])}return t.prototype.increaseVersion=function(){this._version++},t.prototype.getVersion=function(){return this._version},t.prototype.setScale=function(t,e,n){(n=n||0)>0&&(this._ux=Ks(n/Kr/t)||0,this._uy=Ks(n/Kr/e)||0)},t.prototype.setDPR=function(t){this.dpr=t},t.prototype.setContext=function(t){this._ctx=t},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(t,e){return this._drawPendingPt(),this.addData(Fs.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},t.prototype.lineTo=function(t,e){var n=Ks(t-this._xi),i=Ks(e-this._yi),r=n>this._ux||i>this._uy;if(this.addData(Fs.L,t,e),this._ctx&&r&&this._ctx.lineTo(t,e),r)this._xi=t,this._yi=e,this._pendingPtDist=0;else{var o=n*n+i*i;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){return this._drawPendingPt(),this.addData(Fs.C,t,e,n,i,r,o),this._ctx&&this._ctx.bezierCurveTo(t,e,n,i,r,o),this._xi=r,this._yi=o,this},t.prototype.quadraticCurveTo=function(t,e,n,i){return this._drawPendingPt(),this.addData(Fs.Q,t,e,n,i),this._ctx&&this._ctx.quadraticCurveTo(t,e,n,i),this._xi=n,this._yi=i,this},t.prototype.arc=function(t,e,n,i,r,o){this._drawPendingPt(),tl[0]=i,tl[1]=r,function(t,e){var n=el(t[0]);n<0&&(n+=Qs);var i=n-t[0],r=t[1];r+=i,!e&&r-n>=Qs?r=n+Qs:e&&n-r>=Qs?r=n-Qs:!e&&n>r?r=n+(Qs-el(n-r)):e&&nu.length&&(this._expandData(),u=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],e=0;e11&&(this.data=new Float32Array(t)))}},t.prototype.getBoundingRect=function(){Hs[0]=Hs[1]=Ws[0]=Ws[1]=Number.MAX_VALUE,Us[0]=Us[1]=js[0]=js[1]=-Number.MAX_VALUE;var t,e=this.data,n=0,i=0,r=0,o=0;for(t=0;tn||Ks(m)>i||c===e-1)&&(p=Math.sqrt(D*D+m*m),r=g,o=y);break;case Fs.C:var v=t[c++],_=t[c++],y=(g=t[c++],t[c++]),x=t[c++],w=t[c++];p=ui(r,o,v,_,g,y,x,w,10),r=x,o=w;break;case Fs.Q:p=gi(r,o,v=t[c++],_=t[c++],g=t[c++],y=t[c++],10),r=g,o=y;break;case Fs.A:var b=t[c++],S=t[c++],T=t[c++],M=t[c++],C=t[c++],L=t[c++],A=L+C;c+=1,f&&(a=qs(C)*T+b,s=Ys(C)*M+S),p=Xs(T,M)*Zs(Qs,Math.abs(L)),r=qs(A)*T+b,o=Ys(A)*M+S;break;case Fs.R:a=r=t[c++],s=o=t[c++],p=2*t[c++]+2*t[c++];break;case Fs.Z:var D=a-r;m=s-o;p=Math.sqrt(D*D+m*m),r=a,o=s}p>=0&&(l[h++]=p,u+=p)}return this._pathLen=u,u},t.prototype.rebuildPath=function(t,e){var n,i,r,o,a,s,l,u,h,c,d=this.data,f=this._ux,p=this._uy,g=this._len,m=e<1,v=0,_=0,y=0;if(!m||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,u=e*this._pathLen))t:for(var x=0;x0&&(t.lineTo(h,c),y=0),w){case Fs.M:n=r=d[x++],i=o=d[x++],t.moveTo(r,o);break;case Fs.L:a=d[x++],s=d[x++];var S=Ks(a-r),T=Ks(s-o);if(S>f||T>p){if(m){if(v+(q=l[_++])>u){var M=(u-v)/q;t.lineTo(r*(1-M)+a*M,o*(1-M)+s*M);break t}v+=q}t.lineTo(a,s),r=a,o=s,y=0}else{var C=S*S+T*T;C>y&&(h=a,c=s,y=C)}break;case Fs.C:var L=d[x++],A=d[x++],D=d[x++],I=d[x++],P=d[x++],E=d[x++];if(m){if(v+(q=l[_++])>u){si(r,L,D,P,M=(u-v)/q,Vs),si(o,A,I,E,M,Gs),t.bezierCurveTo(Vs[1],Gs[1],Vs[2],Gs[2],Vs[3],Gs[3]);break t}v+=q}t.bezierCurveTo(L,A,D,I,P,E),r=P,o=E;break;case Fs.Q:L=d[x++],A=d[x++],D=d[x++],I=d[x++];if(m){if(v+(q=l[_++])>u){fi(r,L,D,M=(u-v)/q,Vs),fi(o,A,I,M,Gs),t.quadraticCurveTo(Vs[1],Gs[1],Vs[2],Gs[2]);break t}v+=q}t.quadraticCurveTo(L,A,D,I),r=D,o=I;break;case Fs.A:var O=d[x++],N=d[x++],R=d[x++],k=d[x++],z=d[x++],B=d[x++],F=d[x++],V=!d[x++],G=R>k?R:k,H=Ks(R-k)>.001,U=z+B,W=!1;if(m)v+(q=l[_++])>u&&(U=z+B*(u-v)/q,W=!0),v+=q;if(H&&t.ellipse?t.ellipse(O,N,R,k,F,z,U,V):t.arc(O,N,G,z,U,V),W)break t;b&&(n=qs(z)*R+O,i=Ys(z)*k+N),r=qs(U)*R+O,o=Ys(U)*k+N;break;case Fs.R:n=r=d[x],i=o=d[x+1],a=d[x++],s=d[x++];var j=d[x++],Z=d[x++];if(m){if(v+(q=l[_++])>u){var X=u-v;t.moveTo(a,s),t.lineTo(a+Zs(X,j),s),(X-=j)>0&&t.lineTo(a+j,s+Zs(X,Z)),(X-=Z)>0&&t.lineTo(a+Xs(j-X,0),s+Z),(X-=j)>0&&t.lineTo(a,s+Xs(Z-X,0));break t}v+=q}t.rect(a,s,j,Z);break;case Fs.Z:if(m){var q;if(v+(q=l[_++])>u){M=(u-v)/q;t.lineTo(r*(1-M)+n*M,o*(1-M)+i*M);break t}v+=q}t.closePath(),r=n,o=i}}},t.prototype.clone=function(){var e=new t,n=this.data;return e.data=n.slice?n.slice():Array.prototype.slice.call(n),e._len=this._len,e},t.CMD=Fs,t.initDefaultProps=function(){var e=t.prototype;e._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,e._version=0}(),t}();const il=nl;function rl(t,e,n,i,r,o,a){if(0===r)return!1;var s=r,l=0;if(a>e+s&&a>i+s||at+s&&o>n+s||oe+c&&h>i+c&&h>o+c&&h>s+c||ht+c&&u>n+c&&u>r+c&&u>a+c||ue+u&&l>i+u&&l>o+u||lt+u&&s>n+u&&s>r+u||sn||h+ur&&(r+=ul);var d=Math.atan2(l,s);return d<0&&(d+=ul),d>=i&&d<=r||d+ul>=i&&d+ul<=r}function cl(t,e,n,i,r,o){if(o>e&&o>i||or?s:0}var dl=il.CMD,fl=2*Math.PI;var pl=[-1,-1,-1],gl=[-1,-1];function ml(t,e,n,i,r,o,a,s,l,u){if(u>e&&u>i&&u>o&&u>s||u1&&(h=void 0,h=gl[0],gl[0]=gl[1],gl[1]=h),p=ii(e,i,o,s,gl[0]),f>1&&(g=ii(e,i,o,s,gl[1]))),2===f?ve&&s>i&&s>o||s=0&&h<=1&&(r[l++]=h);else{var u=a*a-4*o*s;if(ei(u))(h=-a/(2*o))>=0&&h<=1&&(r[l++]=h);else if(u>0){var h,c=Xn(u),d=(-a-c)/(2*o);(h=(-a+c)/(2*o))>=0&&h<=1&&(r[l++]=h),d>=0&&d<=1&&(r[l++]=d)}}return l}(e,i,o,s,pl);if(0===l)return 0;var u=di(e,i,o);if(u>=0&&u<=1){for(var h=0,c=hi(e,i,o,u),d=0;dn||s<-n)return 0;var l=Math.sqrt(n*n-s*s);pl[0]=-l,pl[1]=l;var u=Math.abs(i-r);if(u<1e-4)return 0;if(u>=fl-1e-4){i=0,r=fl;var h=o?1:-1;return a>=pl[0]+t&&a<=pl[1]+t?h:0}if(i>r){var c=i;i=r,r=c}i<0&&(i+=fl,r+=fl);for(var d=0,f=0;f<2;f++){var p=pl[f];if(p+t>a){var g=Math.atan2(s,p);h=o?1:-1;g<0&&(g=fl+g),(g>=i&&g<=r||g+fl>=i&&g+fl<=r)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),d+=h)}}return d}function yl(t,e,n,i,r){for(var o,a,s,l,u=t.data,h=t.len(),c=0,d=0,f=0,p=0,g=0,m=0;m1&&(n||(c+=cl(d,f,p,g,i,r))),_&&(p=d=u[m],g=f=u[m+1]),v){case dl.M:d=p=u[m++],f=g=u[m++];break;case dl.L:if(n){if(rl(d,f,u[m],u[m+1],e,i,r))return!0}else c+=cl(d,f,u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case dl.C:if(n){if(ol(d,f,u[m++],u[m++],u[m++],u[m++],u[m],u[m+1],e,i,r))return!0}else c+=ml(d,f,u[m++],u[m++],u[m++],u[m++],u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case dl.Q:if(n){if(al(d,f,u[m++],u[m++],u[m],u[m+1],e,i,r))return!0}else c+=vl(d,f,u[m++],u[m++],u[m],u[m+1],i,r)||0;d=u[m++],f=u[m++];break;case dl.A:var y=u[m++],x=u[m++],w=u[m++],b=u[m++],S=u[m++],T=u[m++];m+=1;var M=!!(1-u[m++]);o=Math.cos(S)*w+y,a=Math.sin(S)*b+x,_?(p=o,g=a):c+=cl(d,f,o,a,i,r);var C=(i-y)*b/w+y;if(n){if(hl(y,x,b,S,S+T,M,e,C,r))return!0}else c+=_l(y,x,b,S,S+T,M,C,r);d=Math.cos(S+T)*w+y,f=Math.sin(S+T)*b+x;break;case dl.R:if(p=d=u[m++],g=f=u[m++],o=p+u[m++],a=g+u[m++],n){if(rl(p,g,o,g,e,i,r)||rl(o,g,o,a,e,i,r)||rl(o,a,p,a,e,i,r)||rl(p,a,p,g,e,i,r))return!0}else c+=cl(o,g,o,a,i,r),c+=cl(p,a,p,g,i,r);break;case dl.Z:if(n){if(rl(d,f,p,g,e,i,r))return!0}else c+=cl(d,f,p,g,i,r);d=p,f=g}}return n||(s=f,l=g,Math.abs(s-l)<1e-4)||(c+=cl(d,f,p,g,i,r)||0),0!==c}var xl=ot({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},vs),wl={style:ot({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},_s.style)},bl=so.concat(["invisible","culling","z","z2","zlevel","parent"]),Sl=function(t){function e(e){return t.call(this,e)||this}var n;return I(e,t),e.prototype.update=function(){var n=this;t.prototype.update.call(this);var i=this.style;if(i.decal){var r=this._decalEl=this._decalEl||new e;r.buildPath===e.prototype.buildPath&&(r.buildPath=function(t){n.buildPath(t,n.shape)}),r.silent=!0;var o=r.style;for(var a in i)o[a]!==i[a]&&(o[a]=i[a]);o.fill=i.fill?i.decal:null,o.decal=null,o.shadowColor=null,i.strokeFirst&&(o.stroke=null);for(var s=0;s.5?Jr:e>.2?"#eee":Qr}if(t)return Qr}return Jr},e.prototype.getInsideTextStroke=function(t){var e=this.style.fill;if(wt(e)){var n=this.__zr;if(!(!n||!n.isDarkMode())===Zi(t,0)<.4)return e}},e.prototype.buildPath=function(t,e,n){},e.prototype.pathUpdated=function(){this.__dirty&=~zn},e.prototype.getUpdatedPathProxy=function(t){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,t),this.path},e.prototype.createPathProxy=function(){this.path=new il(!1)},e.prototype.hasStroke=function(){var t=this.style,e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.getBoundingRect=function(){var t=this._rect,e=this.style,n=!t;if(n){var i=!1;this.path||(i=!0,this.createPathProxy());var r=this.path;(i||this.__dirty&zn)&&(r.beginPath(),this.buildPath(r,this.shape,!1),this.pathUpdated()),t=r.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var o=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||n){o.copy(t);var a=e.strokeNoScale?this.getLineScale():1,s=e.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}a>1e-10&&(o.width+=s/a,o.height+=s/a,o.x-=s/a/2,o.y-=s/a/2)}return o}return t},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect(),r=this.style;if(t=n[0],e=n[1],i.contain(t,e)){var o=this.path;if(this.hasStroke()){var a=r.lineWidth,s=r.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),function(t,e,n,i){return yl(t,e,!0,n,i)}(o,a/s,t,e)))return!0}if(this.hasFill())return function(t,e,n){return yl(t,0,!1,e,n)}(o,t,e)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=zn,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():"shape"===t?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(e,n){"shape"===e?this.setShape(n):t.prototype.attrKV.call(this,e,n)},e.prototype.setShape=function(t,e){var n=this.shape;return n||(n=this.shape={}),"string"==typeof t?n[t]=e:rt(n,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&zn)},e.prototype.createStyle=function(t){return Xt(xl,t)},e.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var n=this._normalState;e.shape&&!n.shape&&(n.shape=rt({},this.shape))},e.prototype._applyStateObj=function(e,n,i,r,o,a){t.prototype._applyStateObj.call(this,e,n,i,r,o,a);var s,l=!(n&&r);if(n&&n.shape?o?r?s=n.shape:(s=rt({},i.shape),rt(s,n.shape)):(s=rt({},r?this.shape:i.shape),rt(s,n.shape)):l&&(s=i.shape),s)if(o){this.shape=rt({},this.shape);for(var u={},h=mt(s),c=0;c0},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.createStyle=function(t){return Xt(Ml,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var e=t.text;null!=e?e+="":e="";var n=po(e,t.font,t.textAlign,t.textBaseline);if(n.x+=t.x||0,n.y+=t.y||0,this.hasStroke()){var i=t.lineWidth;n.x-=i/2,n.y-=i/2,n.width+=i,n.height+=i}this._rect=n}return this._rect},e.initDefaultProps=void(e.prototype.dirtyRectTolerance=10),e}(Ts);Cl.prototype.type="tspan";const Ll=Cl;var Al=ot({x:0,y:0},vs),Dl={style:ot({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},_s.style)};var Il=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.createStyle=function(t){return Xt(Al,t)},e.prototype._getSize=function(t){var e=this.style,n=e[t];if(null!=n)return n;var i,r=(i=e.image)&&"string"!=typeof i&&i.width&&i.height?e.image:this.__image;if(!r)return 0;var o="width"===t?"height":"width",a=e[o];return null==a?r[t]:r[t]/r[o]*a},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return Dl},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new _n(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(Ts);Il.prototype.type="image";const Pl=Il;var El=Math.round;function Ol(t,e,n){if(e){var i=e.x1,r=e.x2,o=e.y1,a=e.y2;t.x1=i,t.x2=r,t.y1=o,t.y2=a;var s=n&&n.lineWidth;return s?(El(2*i)===El(2*r)&&(t.x1=t.x2=Rl(i,s,!0)),El(2*o)===El(2*a)&&(t.y1=t.y2=Rl(o,s,!0)),t):t}}function Nl(t,e,n){if(e){var i=e.x,r=e.y,o=e.width,a=e.height;t.x=i,t.y=r,t.width=o,t.height=a;var s=n&&n.lineWidth;return s?(t.x=Rl(i,s,!0),t.y=Rl(r,s,!0),t.width=Math.max(Rl(i+o,s,!1)-t.x,0===o?0:1),t.height=Math.max(Rl(r+a,s,!1)-t.y,0===a?0:1),t):t}}function Rl(t,e,n){if(!e)return t;var i=El(2*t);return(i+El(e))%2==0?i/2:(i+(n?1:-1))/2}var kl=function(){this.x=0,this.y=0,this.width=0,this.height=0},zl={},Bl=function(t){function e(e){return t.call(this,e)||this}return I(e,t),e.prototype.getDefaultShape=function(){return new kl},e.prototype.buildPath=function(t,e){var n,i,r,o;if(this.subPixelOptimize){var a=Nl(zl,e,this.style);n=a.x,i=a.y,r=a.width,o=a.height,a.r=e.r,e=a}else n=e.x,i=e.y,r=e.width,o=e.height;e.r?function(t,e){var n,i,r,o,a,s=e.x,l=e.y,u=e.width,h=e.height,c=e.r;u<0&&(s+=u,u=-u),h<0&&(l+=h,h=-h),"number"==typeof c?n=i=r=o=c:c instanceof Array?1===c.length?n=i=r=o=c[0]:2===c.length?(n=r=c[0],i=o=c[1]):3===c.length?(n=c[0],i=o=c[1],r=c[2]):(n=c[0],i=c[1],r=c[2],o=c[3]):n=i=r=o=0,n+i>u&&(n*=u/(a=n+i),i*=u/a),r+o>u&&(r*=u/(a=r+o),o*=u/a),i+r>h&&(i*=h/(a=i+r),r*=h/a),n+o>h&&(n*=h/(a=n+o),o*=h/a),t.moveTo(s+n,l),t.lineTo(s+u-i,l),0!==i&&t.arc(s+u-i,l+i,i,-Math.PI/2,0),t.lineTo(s+u,l+h-r),0!==r&&t.arc(s+u-r,l+h-r,r,0,Math.PI/2),t.lineTo(s+o,l+h),0!==o&&t.arc(s+o,l+h-o,o,Math.PI/2,Math.PI),t.lineTo(s,l+n),0!==n&&t.arc(s+n,l+n,n,Math.PI,1.5*Math.PI)}(t,e):t.rect(n,i,r,o)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(Tl);Bl.prototype.type="rect";const Fl=Bl;var Vl={fill:"#000"},Gl={style:ot({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},_s.style)},Hl=function(t){function e(e){var n=t.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=Vl,n.attr(e),n}return I(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var e=0;ep&&h){var g=Math.floor(p/l);c=c||n.length>g,n=n.slice(0,g)}if(t&&a&&null!=d)for(var m=as(d,o,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),v={},_=0;_0,M=null!=t.width&&("truncate"===t.overflow||"break"===t.overflow||"breakAll"===t.overflow),C=i.calculatedLineHeight,L=0;Ll&&ds(n,t.substring(l,u),e,s),ds(n,i[2],e,s,i[1]),l=is.lastIndex}lo){var A=n.lines.length;b>0?(y.tokens=y.tokens.slice(0,b),v(y,w,x),n.lines=n.lines.slice(0,_+1)):n.lines=n.lines.slice(0,_),n.isTruncated=n.isTruncated||n.lines.length=0&&"right"===(L=y[C]).align;)this._placeToken(L,t,w,p,M,"right",m),b-=L.width,M-=L.width,C--;for(T+=(n-(T-f)-(g-M)-b)/2;S<=C;)L=y[S],this._placeToken(L,t,w,p,T+L.width/2,"center",m),T+=L.width,S++;p+=w}},e.prototype._placeToken=function(t,e,n,i,r,o,a){var s=e.rich[t.styleName]||{};s.text=t.text;var l=t.verticalAlign,u=i+n/2;"top"===l?u=i+t.height/2:"bottom"===l&&(u=i+n-t.height/2),!t.isLineHolder&&tu(s)&&this._renderBackground(s,e,"right"===o?r-t.width:"center"===o?r-t.width/2:r,u-t.height/2,t.width,t.height);var h=!!s.backgroundColor,c=t.textPadding;c&&(r=Ql(r,o,c),u-=t.height/2-c[0]-t.innerHeight/2);var d=this._getOrCreateChild(Ll),f=d.createStyle();d.useStyle(f);var p=this._defaultStyle,g=!1,m=0,v=Jl("fill"in s?s.fill:"fill"in e?e.fill:(g=!0,p.fill)),_=Kl("stroke"in s?s.stroke:"stroke"in e?e.stroke:h||a||p.autoStroke&&!g?null:(m=2,p.stroke)),y=s.textShadowBlur>0||e.textShadowBlur>0;f.text=t.text,f.x=r,f.y=u,y&&(f.shadowBlur=s.textShadowBlur||e.textShadowBlur||0,f.shadowColor=s.textShadowColor||e.textShadowColor||"transparent",f.shadowOffsetX=s.textShadowOffsetX||e.textShadowOffsetX||0,f.shadowOffsetY=s.textShadowOffsetY||e.textShadowOffsetY||0),f.textAlign=o,f.textBaseline="middle",f.font=t.font||R,f.opacity=Nt(s.opacity,e.opacity,1),Xl(f,s),_&&(f.lineWidth=Nt(s.lineWidth,e.lineWidth,m),f.lineDash=Ot(s.lineDash,e.lineDash),f.lineDashOffset=e.lineDashOffset||0,f.stroke=_),v&&(f.fill=v);var x=t.contentWidth,w=t.contentHeight;d.setBoundingRect(new _n(go(f.x,x,f.textAlign),mo(f.y,w,f.textBaseline),x,w))},e.prototype._renderBackground=function(t,e,n,i,r,o){var a,s,l,u=t.backgroundColor,h=t.borderWidth,c=t.borderColor,d=u&&u.image,f=u&&!d,p=t.borderRadius,g=this;if(f||t.lineHeight||h&&c){(a=this._getOrCreateChild(Fl)).useStyle(a.createStyle()),a.style.fill=null;var m=a.shape;m.x=n,m.y=i,m.width=r,m.height=o,m.r=p,a.dirtyShape()}if(f)(l=a.style).fill=u||null,l.fillOpacity=Ot(t.fillOpacity,1);else if(d){(s=this._getOrCreateChild(Pl)).onload=function(){g.dirtyStyle()};var v=s.style;v.image=u.image,v.x=n,v.y=i,v.width=r,v.height=o}h&&c&&((l=a.style).lineWidth=h,l.stroke=c,l.strokeOpacity=Ot(t.strokeOpacity,1),l.lineDash=t.borderDash,l.lineDashOffset=t.borderDashOffset||0,a.strokeContainThreshold=0,a.hasFill()&&a.hasStroke()&&(l.strokeFirst=!0,l.lineWidth*=2));var _=(a||s).style;_.shadowBlur=t.shadowBlur||0,_.shadowColor=t.shadowColor||"transparent",_.shadowOffsetX=t.shadowOffsetX||0,_.shadowOffsetY=t.shadowOffsetY||0,_.opacity=Nt(t.opacity,e.opacity,1)},e.makeFont=function(t){var e="";return ql(t)&&(e=[t.fontStyle,t.fontWeight,Zl(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),e&&Bt(e)||t.textFont||t.font},e}(Ts),Ul={left:!0,right:1,center:1},Wl={top:1,bottom:1,middle:1},jl=["fontStyle","fontWeight","fontSize","fontFamily"];function Zl(t){return"string"!=typeof t||-1===t.indexOf("px")&&-1===t.indexOf("rem")&&-1===t.indexOf("em")?isNaN(+t)?"12px":t+"px":t}function Xl(t,e){for(var n=0;n=0,o=!1;if(t instanceof Tl){var a=ou(t),s=r&&a.selectFill||a.normalFill,l=r&&a.selectStroke||a.normalStroke;if(mu(s)||mu(l)){var u=(i=i||{}).style||{};"inherit"===u.fill?(o=!0,i=rt({},i),(u=rt({},u)).fill=s):!mu(u.fill)&&mu(s)?(o=!0,i=rt({},i),(u=rt({},u)).fill=Yi(s)):!mu(u.stroke)&&mu(l)&&(o||(i=rt({},i),u=rt({},u)),u.stroke=Yi(l)),i.style=u}}if(i&&null==i.z2){o||(i=rt({},i));var h=t.z2EmphasisLift;i.z2=t.z2+(null!=h?h:uu)}return i}(this,0,e,n);if("blur"===t)return function(t,e,n){var i=st(t.currentStates,e)>=0,r=t.style.opacity,o=i?null:function(t,e,n,i){for(var r=t.style,o={},a=0;a0){var o={dataIndex:r,seriesIndex:t.seriesIndex};null!=i&&(o.dataType=i),e.push(o)}}))})),e}function Hu(t,e,n){Wu(t,!0),Mu(t,Lu),function(t,e,n){var i=nu(t);null!=e?(i.focus=e,i.blurScope=n):i.focus&&(i.focus=null)}(t,e,n)}function Uu(t,e,n,i){i?function(t){Wu(t,!1)}(t):Hu(t,e,n)}function Wu(t,e){var n=!1===e,i=t;t.highDownSilentOnTouch&&(i.__highDownSilentOnTouch=t.highDownSilentOnTouch),n&&!i.__highDownDispatcher||(i.__highByOuter=i.__highByOuter||0,i.__highDownDispatcher=!n)}function ju(t){return!(!t||!t.__highDownDispatcher)}function Zu(t){var e=t.type;return e===fu||e===pu||e===gu}function Xu(t){var e=t.type;return e===cu||e===du}var qu=Ea();function Yu(t,e,n,i,r){var o;if(e&&e.ecModel){var a=e.ecModel.getUpdatePayload();o=a&&a.animation}var s="update"===t;if(e&&e.isAnimationEnabled()){var l=void 0,u=void 0,h=void 0;return i?(l=Ot(i.duration,200),u=Ot(i.easing,"cubicOut"),h=0):(l=e.getShallow(s?"animationDurationUpdate":"animationDuration"),u=e.getShallow(s?"animationEasingUpdate":"animationEasing"),h=e.getShallow(s?"animationDelayUpdate":"animationDelay")),o&&(null!=o.duration&&(l=o.duration),null!=o.easing&&(u=o.easing),null!=o.delay&&(h=o.delay)),xt(h)&&(h=h(n,r)),xt(l)&&(l=l(n)),{duration:l||0,delay:h,easing:u}}return null}function Ku(t,e,n,i,r,o,a){var s,l=!1;xt(r)?(a=o,o=r,r=null):Tt(r)&&(o=r.cb,a=r.during,l=r.isFrom,s=r.removeOpt,r=r.dataIndex);var u="leave"===t;u||e.stopAnimation("leave");var h=Yu(t,i,r,u?s||{}:null,i&&i.getAnimationDelayParams?i.getAnimationDelayParams(e,r):null);if(h&&h.duration>0){var c={duration:h.duration,delay:h.delay||0,easing:h.easing,done:o,force:!!o||!!a,setToFinal:!u,scope:t,during:a};l?e.animateFrom(n,c):e.animateTo(n,c)}else e.stopAnimation(),!l&&e.attr(n),a&&a(1),o&&o()}function Ju(t,e,n,i,r,o){Ku("update",t,e,n,i,r,o)}function Qu(t,e,n,i,r,o){Ku("enter",t,e,n,i,r,o)}function $u(t){if(!t.__zr)return!0;for(var e=0;e-1?Oh:Rh;function Fh(t,e){t=t.toUpperCase(),zh[t]=new Ih(e),kh[t]=e}Fh(Nh,{time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}}),Fh(Oh,{time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}});var Vh=1e3,Gh=6e4,Hh=36e5,Uh=864e5,Wh=31536e6,jh={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},Zh="{yyyy}-{MM}-{dd}",Xh={year:"{yyyy}",month:"{yyyy}-{MM}",day:Zh,hour:Zh+" "+jh.hour,minute:Zh+" "+jh.minute,second:Zh+" "+jh.second,millisecond:jh.none},qh=["year","month","day","hour","minute","second","millisecond"],Yh=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Kh(t,e){return"0000".substr(0,e-(t+="").length)+t}function Jh(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return t}}function Qh(t){return t===Jh(t)}function $h(t,e,n,i){var r=aa(t),o=r[nc(n)](),a=r[ic(n)]()+1,s=Math.floor((a-1)/3)+1,l=r[rc(n)](),u=r["get"+(n?"UTC":"")+"Day"](),h=r[oc(n)](),c=(h-1)%12+1,d=r[ac(n)](),f=r[sc(n)](),p=r[lc(n)](),g=h>=12?"pm":"am",m=g.toUpperCase(),v=i instanceof Ih?i:function(t){return zh[t]}(i||Bh)||zh[Rh],_=v.getModel("time"),y=_.get("month"),x=_.get("monthAbbr"),w=_.get("dayOfWeek"),b=_.get("dayOfWeekAbbr");return(e||"").replace(/{a}/g,g+"").replace(/{A}/g,m+"").replace(/{yyyy}/g,o+"").replace(/{yy}/g,Kh(o%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,y[a-1]).replace(/{MMM}/g,x[a-1]).replace(/{MM}/g,Kh(a,2)).replace(/{M}/g,a+"").replace(/{dd}/g,Kh(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,w[u]).replace(/{ee}/g,b[u]).replace(/{e}/g,u+"").replace(/{HH}/g,Kh(h,2)).replace(/{H}/g,h+"").replace(/{hh}/g,Kh(c+"",2)).replace(/{h}/g,c+"").replace(/{mm}/g,Kh(d,2)).replace(/{m}/g,d+"").replace(/{ss}/g,Kh(f,2)).replace(/{s}/g,f+"").replace(/{SSS}/g,Kh(p,3)).replace(/{S}/g,p+"")}function tc(t,e){var n=aa(t),i=n[ic(e)]()+1,r=n[rc(e)](),o=n[oc(e)](),a=n[ac(e)](),s=n[sc(e)](),l=0===n[lc(e)](),u=l&&0===s,h=u&&0===a,c=h&&0===o,d=c&&1===r;return d&&1===i?"year":d?"month":c?"day":h?"hour":u?"minute":l?"second":"millisecond"}function ec(t,e,n){var i=St(t)?aa(t):t;switch(e=e||tc(t,n)){case"year":return i[nc(n)]();case"half-year":return i[ic(n)]()>=6?1:0;case"quarter":return Math.floor((i[ic(n)]()+1)/4);case"month":return i[ic(n)]();case"day":return i[rc(n)]();case"half-day":return i[oc(n)]()/24;case"hour":return i[oc(n)]();case"minute":return i[ac(n)]();case"second":return i[sc(n)]();case"millisecond":return i[lc(n)]()}}function nc(t){return t?"getUTCFullYear":"getFullYear"}function ic(t){return t?"getUTCMonth":"getMonth"}function rc(t){return t?"getUTCDate":"getDate"}function oc(t){return t?"getUTCHours":"getHours"}function ac(t){return t?"getUTCMinutes":"getMinutes"}function sc(t){return t?"getUTCSeconds":"getSeconds"}function lc(t){return t?"getUTCMilliseconds":"getMilliseconds"}function uc(t){return t?"setUTCFullYear":"setFullYear"}function hc(t){return t?"setUTCMonth":"setMonth"}function cc(t){return t?"setUTCDate":"setDate"}function dc(t){return t?"setUTCHours":"setHours"}function fc(t){return t?"setUTCMinutes":"setMinutes"}function pc(t){return t?"setUTCSeconds":"setSeconds"}function gc(t){return t?"setUTCMilliseconds":"setMilliseconds"}function mc(t){if(!fa(t))return wt(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function vc(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()})),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}var _c=kt;function yc(t,e,n){function i(t){return t&&Bt(t)?t:"-"}function r(t){return!(null==t||isNaN(t)||!isFinite(t))}var o="time"===e,a=t instanceof Date;if(o||a){var s=o?aa(t):t;if(!isNaN(+s))return $h(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n);if(a)return"-"}if("ordinal"===e)return bt(t)?i(t):St(t)&&r(t)?t+"":"-";var l=da(t);return r(l)?mc(l):bt(t)?i(t):"boolean"==typeof t?t+"":"-"}var xc=["a","b","c","d","e","f","g"],wc=function(t,e){return"{"+t+(null==e?"":e)+"}"};function bc(t,e,n){yt(e)||(e=[e]);var i=e.length;if(!i)return"";for(var r=e[0].$vars||[],o=0;o':'':{renderMode:o,content:"{"+(n.markerId||"markerX")+"|} ",style:"subItem"===r?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}:""}function Tc(t,e,n){"week"!==t&&"month"!==t&&"quarter"!==t&&"half-year"!==t&&"year"!==t||(t="MM-dd\nyyyy");var i=aa(e),r=n?"getUTC":"get",o=i[r+"FullYear"](),a=i[r+"Month"]()+1,s=i[r+"Date"](),l=i[r+"Hours"](),u=i[r+"Minutes"](),h=i[r+"Seconds"](),c=i[r+"Milliseconds"]();return t=t.replace("MM",Kh(a,2)).replace("M",a).replace("yyyy",o).replace("yy",Kh(o%100+"",2)).replace("dd",Kh(s,2)).replace("d",s).replace("hh",Kh(l,2)).replace("h",l).replace("mm",Kh(u,2)).replace("m",u).replace("ss",Kh(h,2)).replace("s",h).replace("SSS",Kh(c,3))}function Mc(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t}function Cc(t,e){return e=e||"transparent",wt(t)?t:Tt(t)&&t.colorStops&&(t.colorStops[0]||{}).color||e}function Lc(t,e){if("_blank"===e||"blank"===e){var n=window.open();n.opener=null,n.location.href=t}else window.open(t,e)}var Ac=ct,Dc=["left","right","top","bottom","width","height"],Ic=[["width","left","right"],["height","top","bottom"]];function Pc(t,e,n,i,r){var o=0,a=0;null==i&&(i=1/0),null==r&&(r=1/0);var s=0;e.eachChild((function(l,u){var h,c,d=l.getBoundingRect(),f=e.childAt(u+1),p=f&&f.getBoundingRect();if("horizontal"===t){var g=d.width+(p?-p.x+d.x:0);(h=o+g)>i||l.newline?(o=0,h=g,a+=s+n,s=d.height):s=Math.max(s,d.height)}else{var m=d.height+(p?-p.y+d.y:0);(c=a+m)>r||l.newline?(o+=s+n,a=0,c=m,s=d.width):s=Math.max(s,d.width)}l.newline||(l.x=o,l.y=a,l.markRedraw(),"horizontal"===t?o=h+n:a=c+n)}))}var Ec=Pc;_t(Pc,"vertical"),_t(Pc,"horizontal");function Oc(t,e,n){n=_c(n||0);var i=e.width,r=e.height,o=qo(t.left,i),a=qo(t.top,r),s=qo(t.right,i),l=qo(t.bottom,r),u=qo(t.width,i),h=qo(t.height,r),c=n[2]+n[0],d=n[1]+n[3],f=t.aspect;switch(isNaN(u)&&(u=i-s-d-o),isNaN(h)&&(h=r-l-c-a),null!=f&&(isNaN(u)&&isNaN(h)&&(f>i/r?u=.8*i:h=.8*r),isNaN(u)&&(u=f*h),isNaN(h)&&(h=u/f)),isNaN(o)&&(o=i-s-u-d),isNaN(a)&&(a=r-l-h-c),t.left||t.right){case"center":o=i/2-u/2-n[3];break;case"right":o=i-u-d}switch(t.top||t.bottom){case"middle":case"center":a=r/2-h/2-n[0];break;case"bottom":a=r-h-c}o=o||0,a=a||0,isNaN(u)&&(u=i-d-o-(s||0)),isNaN(h)&&(h=r-c-a-(l||0));var p=new _n(o+n[3],a+n[0],u,h);return p.margin=n,p}function Nc(t,e,n,i,r,o){var a,s=!r||!r.hv||r.hv[0],l=!r||!r.hv||r.hv[1],u=r&&r.boundingMode||"all";if((o=o||t).x=t.x,o.y=t.y,!s&&!l)return!1;if("raw"===u)a="group"===t.type?new _n(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(a=t.getBoundingRect(),t.needLocalTransform()){var h=t.getLocalTransform();(a=a.clone()).applyTransform(h)}var c=Oc(ot({width:a.width,height:a.height},e),n,i),d=s?c.x-a.x:0,f=l?c.y-a.y:0;return"raw"===u?(o.x=d,o.y=f):(o.x+=d,o.y+=f),o===t&&t.markRedraw(),!0}function Rc(t){var e=t.layoutMode||t.constructor.layoutMode;return Tt(e)?e:e?{type:e}:null}function kc(t,e,n){var i=n&&n.ignoreSize;!yt(i)&&(i=[i,i]);var r=a(Ic[0],0),o=a(Ic[1],1);function a(n,r){var o={},a=0,u={},h=0;if(Ac(n,(function(e){u[e]=t[e]})),Ac(n,(function(t){s(e,t)&&(o[t]=u[t]=e[t]),l(o,t)&&a++,l(u,t)&&h++})),i[r])return l(e,n[1])?u[n[2]]=null:l(e,n[2])&&(u[n[1]]=null),u;if(2!==h&&a){if(a>=2)return o;for(var c=0;c=0;a--)o=nt(o,n[a],!0);e.defaultOption=o}return e.defaultOption},e.prototype.getReferringComponents=function(t,e){var n=t+"Index",i=t+"Id";return Ba(this.ecModel,t,{index:this.get(n,!0),id:this.get(i,!0)},e)},e.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(t){this.option.zlevel=t},e.protoInitialize=function(){var t=e.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),e}(Ih);Wa(Vc,Ih),qa(Vc),function(t){var e={};t.registerSubTypeDefaulter=function(t,n){var i=Ha(t);e[i.main]=n},t.determineSubType=function(n,i){var r=i.type;if(!r){var o=Ha(n).main;t.hasSubTypes(n)&&e[o]&&(r=e[o](i))}return r}}(Vc),function(t,e){function n(t,e){return t[e]||(t[e]={predecessor:[],successor:[]}),t[e]}t.topologicalTravel=function(t,i,r,o){if(t.length){var a=function(t){var i={},r=[];return ct(t,(function(o){var a=n(i,o),s=function(t,e){var n=[];return ct(t,(function(t){st(e,t)>=0&&n.push(t)})),n}(a.originalDeps=e(o),t);a.entryCount=s.length,0===a.entryCount&&r.push(o),ct(s,(function(t){st(a.predecessor,t)<0&&a.predecessor.push(t);var e=n(i,t);st(e.successor,t)<0&&e.successor.push(o)}))})),{graph:i,noEntryList:r}}(i),s=a.graph,l=a.noEntryList,u={};for(ct(t,(function(t){u[t]=!0}));l.length;){var h=l.pop(),c=s[h],d=!!u[h];d&&(r.call(o,h,c.originalDeps.slice()),delete u[h]),ct(c.successor,d?p:f)}ct(u,(function(){throw new Error("")}))}function f(t){s[t].entryCount--,0===s[t].entryCount&&l.push(t)}function p(t){u[t]=!0,f(t)}}}(Vc,(function(t){var e=[];ct(Vc.getClassesByMainType(t),(function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])})),e=dt(e,(function(t){return Ha(t).main})),"dataset"!==t&&st(e,"dataset")<=0&&e.unshift("dataset");return e}));const Gc=Vc;var Hc="";"undefined"!=typeof navigator&&(Hc=navigator.platform||"");var Uc="rgba(0, 0, 0, 0.2)";const Wc={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:Uc,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:Uc,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:Uc,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:Uc,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:Uc,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:Uc,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:Hc.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var jc=jt(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),Zc="original",Xc="arrayRows",qc="objectRows",Yc="keyedColumns",Kc="typedArray",Jc="unknown",Qc="column",$c="row",td={Must:1,Might:2,Not:3},ed=Ea();function nd(t,e,n){var i={},r=id(e);if(!r||!t)return i;var o,a,s=[],l=[],u=e.ecModel,h=ed(u).datasetMap,c=r.uid+"_"+n.seriesLayoutBy;ct(t=t.slice(),(function(e,n){var r=Tt(e)?e:t[n]={name:e};"ordinal"===r.type&&null==o&&(o=n,a=p(r)),i[r.name]=[]}));var d=h.get(c)||h.set(c,{categoryWayDim:a,valueWayDim:0});function f(t,e,n){for(var i=0;ie)return t[i];return t[n-1]}(i,a):n;if((h=h||n)&&h.length){var c=h[l];return r&&(u[r]=c),s.paletteIdx=(l+1)%h.length,c}}var fd="\0_ec_inner";var pd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.init=function(t,e,n,i,r,o){i=i||{},this.option=null,this._theme=new Ih(i),this._locale=new Ih(r),this._optionManager=o},e.prototype.setOption=function(t,e,n){var i=vd(e);this._optionManager.setOption(t,n,i),this._resetOption(null,i)},e.prototype.resetOption=function(t,e){return this._resetOption(t,vd(e))},e.prototype._resetOption=function(t,e){var n=!1,i=this._optionManager;if(!t||"recreate"===t){var r=i.mountOption("recreate"===t);0,this.option&&"recreate"!==t?(this.restoreData(),this._mergeOption(r,e)):ud(this,r),n=!0}if("timeline"!==t&&"media"!==t||this.restoreData(),!t||"recreate"===t||"timeline"===t){var o=i.getTimelineOption(this);o&&(n=!0,this._mergeOption(o,e))}if(!t||"recreate"===t||"media"===t){var a=i.getMediaOption(this);a.length&&ct(a,(function(t){n=!0,this._mergeOption(t,e)}),this)}return n},e.prototype.mergeOption=function(t){this._mergeOption(t,null)},e.prototype._mergeOption=function(t,e){var n=this.option,i=this._componentsMap,r=this._componentsCount,o=[],a=jt(),s=e&&e.replaceMergeMainTypeMap;ed(this).datasetMap=jt(),ct(t,(function(t,e){null!=t&&(Gc.hasClass(e)?e&&(o.push(e),a.set(e,!0)):n[e]=null==n[e]?et(t):nt(n[e],t,!0))})),s&&s.each((function(t,e){Gc.hasClass(e)&&!a.get(e)&&(o.push(e),a.set(e,!0))})),Gc.topologicalTravel(o,Gc.getAllClassMainTypes(),(function(e){var o=function(t,e,n){var i=ad.get(e);if(!i)return n;var r=i(t);return r?n.concat(r):n}(this,e,xa(t[e])),a=i.get(e),l=a?s&&s.get(e)?"replaceMerge":"normalMerge":"replaceAll",u=Ma(a,o,l);(function(t,e,n){ct(t,(function(t){var i=t.newOption;Tt(i)&&(t.keyInfo.mainType=e,t.keyInfo.subType=function(t,e,n,i){return e.type?e.type:n?n.subType:i.determineSubType(t,e)}(e,i,t.existing,n))}))})(u,e,Gc),n[e]=null,i.set(e,null),r.set(e,0);var h,c=[],d=[],f=0;ct(u,(function(t,n){var i=t.existing,r=t.newOption;if(r){var o="series"===e,a=Gc.getClass(e,t.keyInfo.subType,!o);if(!a)return;if("tooltip"===e){if(h)return void 0;h=!0}if(i&&i.constructor===a)i.name=t.keyInfo.name,i.mergeOption(r,this),i.optionUpdated(r,!1);else{var s=rt({componentIndex:n},t.keyInfo);rt(i=new a(r,this,this,s),s),t.brandNew&&(i.__requireNewView=!0),i.init(r,this,this),i.optionUpdated(null,!0)}}else i&&(i.mergeOption({},this),i.optionUpdated({},!1));i?(c.push(i.option),d.push(i),f++):(c.push(void 0),d.push(void 0))}),this),n[e]=c,i.set(e,d),r.set(e,f),"series"===e&&sd(this)}),this),this._seriesIndices||sd(this)},e.prototype.getOption=function(){var t=et(this.option);return ct(t,(function(e,n){if(Gc.hasClass(n)){for(var i=xa(e),r=i.length,o=!1,a=r-1;a>=0;a--)i[a]&&!Ia(i[a])?o=!0:(i[a]=null,!o&&r--);i.length=r,t[n]=i}})),delete t[fd],t},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(t){this._payload=t},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(t,e){var n=this._componentsMap.get(t);if(n){var i=n[e||0];if(i)return i;if(null==e)for(var r=0;r=e:"max"===n?t<=e:t===e})(i[a],t,o)||(r=!1)}})),r}const Ld=Md;var Ad=ct,Dd=Tt,Id=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function Pd(t){var e=t&&t.itemStyle;if(e)for(var n=0,i=Id.length;n=0;g--){var m=t[g];if(s||(d=m.data.rawIndexOf(m.stackedByDimension,c)),d>=0){var v=m.data.getByRawIndex(m.stackResultDimension,d);if("all"===l||"positive"===l&&v>0||"negative"===l&&v<0||"samesign"===l&&f>=0&&v>0||"samesign"===l&&f<=0&&v<0){f=ea(f,v),p=v;break}}}return i[0]=f,i[1]=p,i}))}))}var Yd,Kd,Jd,Qd,$d,tf=function(t){this.data=t.data||(t.sourceFormat===Yc?{}:[]),this.sourceFormat=t.sourceFormat||Jc,this.seriesLayoutBy=t.seriesLayoutBy||Qc,this.startIndex=t.startIndex||0,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.metaRawOption=t.metaRawOption;var e=this.dimensionsDefine=t.dimensionsDefine;if(e)for(var n=0;nu&&(u=f)}s[0]=l,s[1]=u}},i=function(){return this._data?this._data.length/this._dimSize:0};function r(t){for(var e=0;e=0&&(s=o.interpolatedValue[l])}return null!=s?s+"":""})):void 0},t.prototype.getRawValue=function(t,e){return xf(this.getData(e),t)},t.prototype.formatTooltip=function(t,e,n){},t}();function Sf(t){var e,n;return Tt(t)?t.type&&(n=t):e=t,{text:e,frag:n}}function Tf(t){return new Mf(t)}var Mf=function(){function t(t){t=t||{},this._reset=t.reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0}return t.prototype.perform=function(t){var e,n=this._upstream,i=t&&t.skip;if(this._dirty&&n){var r=this.context;r.data=r.outputData=n.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this),this._plan&&!i&&(e=this._plan(this.context));var o,a=h(this._modBy),s=this._modDataCount||0,l=h(t&&t.modBy),u=t&&t.modDataCount||0;function h(t){return!(t>=1)&&(t=1),t}a===l&&s===u||(e="reset"),(this._dirty||"reset"===e)&&(this._dirty=!1,o=this._doReset(i)),this._modBy=l,this._modDataCount=u;var c=t&&t.step;if(this._dueEnd=n?n._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var d=this._dueIndex,f=Math.min(null!=c?this._dueIndex+c:1/0,this._dueEnd);if(!i&&(o||d1&&i>0?s:a}};return o;function a(){return e=t?null:oe},gte:function(t,e){return t>=e}},Pf=(function(){function t(t,e){if(!St(e)){0,Af("")}this._opFn=If[t],this._rvalFloat=da(e)}t.prototype.evaluate=function(t){return St(t)?this._opFn(t,this._rvalFloat):this._opFn(da(t),this._rvalFloat)}}(),function(){function t(t,e){var n="desc"===t;this._resultLT=n?1:-1,null==e&&(e=n?"min":"max"),this._incomparable="min"===e?-1/0:1/0}return t.prototype.evaluate=function(t,e){var n=St(t)?t:da(t),i=St(e)?e:da(e),r=isNaN(n),o=isNaN(i);if(r&&(n=this._incomparable),o&&(i=this._incomparable),r&&o){var a=wt(t),s=wt(e);a&&(n=s?t:0),s&&(i=a?e:0)}return ni?-this._resultLT:0},t}());!function(){function t(t,e){this._rval=e,this._isEQ=t,this._rvalTypeof=typeof e,this._rvalFloat=da(e)}t.prototype.evaluate=function(t){var e=t===this._rval;if(!e){var n=typeof t;n===this._rvalTypeof||"number"!==n&&"number"!==this._rvalTypeof||(e=da(t)===this._rvalFloat)}return this._isEQ?e:!e}}();var Ef=function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(t){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(t){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(t,e){},t.prototype.retrieveValueFromItem=function(t,e){},t.prototype.convertValue=function(t,e){return Df(t,e)},t}();function Of(t){if(!Ff(t.sourceFormat)){0,Af("")}return t.data}function Nf(t){var e=t.sourceFormat,n=t.data;if(!Ff(e)){0,Af("")}if(e===Xc){for(var i=[],r=0,o=n.length;r65535?Hf:Uf}function qf(t,e,n,i,r){var o=Zf[n||"float"];if(r){var a=t[e],s=a&&a.length;if(s!==i){for(var l=new o(i),u=0;ug[1]&&(g[1]=p)}return this._rawCount=this._count=s,{start:a,end:s}},t.prototype._initDataFromProvider=function(t,e,n){for(var i=this._provider,r=this._chunks,o=this._dimensions,a=o.length,s=this._rawExtent,l=dt(o,(function(t){return t.property})),u=0;um[1]&&(m[1]=g)}}!i.persistent&&i.clean&&i.clean(),this._rawCount=this._count=e,this._extent=[]},t.prototype.count=function(){return this._count},t.prototype.get=function(t,e){if(!(e>=0&&e=0&&e=this._rawCount||t<0)return-1;if(!this._indices)return t;var e=this._indices,n=e[t];if(null!=n&&nt))return o;r=o-1}}return-1},t.prototype.indicesOfNearest=function(t,e,n){var i=this._chunks[t],r=[];if(!i)return r;null==n&&(n=1/0);for(var o=1/0,a=-1,s=0,l=0,u=this.count();l=0&&a<0)&&(o=c,a=h,s=0),h===a&&(r[s++]=l))}return r.length=s,r},t.prototype.getIndices=function(){var t,e=this._indices;if(e){var n=e.constructor,i=this._count;if(n===Array){t=new n(i);for(var r=0;r=u&&y<=h||isNaN(y))&&(a[s++]=f),f++}d=!0}else if(2===r){p=c[i[0]];var m=c[i[1]],v=t[i[1]][0],_=t[i[1]][1];for(g=0;g=u&&y<=h||isNaN(y))&&(x>=v&&x<=_||isNaN(x))&&(a[s++]=f),f++}d=!0}}if(!d)if(1===r)for(g=0;g=u&&y<=h||isNaN(y))&&(a[s++]=w)}else for(g=0;gt[T][1])&&(b=!1)}b&&(a[s++]=e.getRawIndex(g))}return sm[1]&&(m[1]=g)}}}},t.prototype.lttbDownSample=function(t,e){var n,i,r,o=this.clone([t],!0),a=o._chunks[t],s=this.count(),l=0,u=Math.floor(1/e),h=this.getRawIndex(0),c=new(Xf(this._rawCount))(Math.min(2*(Math.ceil(s/u)+2),s));c[l++]=h;for(var d=1;dn&&(n=i,r=M)}T>0&&Ta&&(p=a-u);for(var g=0;gf&&(f=m,d=u+g)}var v=this.getRawIndex(h),_=this.getRawIndex(d);hu-f&&(s=u-f,a.length=s);for(var p=0;ph[1]&&(h[1]=m),c[d++]=v}return r._count=d,r._indices=c,r._updateGetRawIdx(),r},t.prototype.each=function(t,e){if(this._count)for(var n=t.length,i=this._chunks,r=0,o=this.count();ra&&(a=l)}return i=[o,a],this._extent[t]=i,i},t.prototype.getRawDataItem=function(t){var e=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(e);for(var n=[],i=this._chunks,r=0;r=0?this._indices[t]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=function(){function t(t,e,n,i){return Df(t[i],this._dimensions[i])}Vf={arrayRows:t,objectRows:function(t,e,n,i){return Df(t[e],this._dimensions[i])},keyedColumns:t,original:function(t,e,n,i){var r=t&&(null==t.value?t:t.value);return Df(r instanceof Array?r[i]:r,this._dimensions[i])},typedArray:function(t,e,n,i){return t[i]}}}(),t}();const Kf=Yf;var Jf=function(){function t(t){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t}return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(t,e){this._sourceList=t,this._upstreamSignList=e,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var t,e,n=this._sourceHost,i=this._getUpstreamSourceManagers(),r=!!i.length;if($f(n)){var o=n,a=void 0,s=void 0,l=void 0;if(r){var u=i[0];u.prepareSource(),a=(l=u.getSource()).data,s=l.sourceFormat,e=[u._getVersionSign()]}else s=Ct(a=o.get("data",!0))?Kc:Zc,e=[];var h=this._getSourceMetaRawOption()||{},c=l&&l.metaRawOption||{},d=Ot(h.seriesLayoutBy,c.seriesLayoutBy)||null,f=Ot(h.sourceHeader,c.sourceHeader),p=Ot(h.dimensions,c.dimensions);t=d!==c.seriesLayoutBy||!!f!=!!c.sourceHeader||p?[nf(a,{seriesLayoutBy:d,sourceHeader:f,dimensions:p},s)]:[]}else{var g=n;if(r){var m=this._applyTransform(i);t=m.sourceList,e=m.upstreamSignList}else{t=[nf(g.get("source",!0),this._getSourceMetaRawOption(),null)],e=[]}}this._setLocalSource(t,e)},t.prototype._applyTransform=function(t){var e,n=this._sourceHost,i=n.get("transform",!0),r=n.get("fromTransformResult",!0);if(null!=r){1!==t.length&&tp("")}var o,a=[],s=[];return ct(t,(function(t){t.prepareSource();var e=t.getSource(r||0);null==r||e||tp(""),a.push(e),s.push(t._getVersionSign())})),i?e=function(t,e){var n=xa(t),i=n.length;i||Af("");for(var r=0,o=i;r1||n>0&&!t.noHeader;return ct(t.blocks,(function(t){var n=lp(t);n>=e&&(e=n+ +(i&&(!n||ap(t)&&!t.noHeader)))})),e}return 0}function up(t,e,n,i){var r,o=e.noHeader,a=(r=lp(e),{html:ip[r],richText:rp[r]}),s=[],l=e.blocks||[];zt(!l||yt(l)),l=l||[];var u=t.orderMode;if(e.sortBlocks&&u){l=l.slice();var h={valueAsc:"asc",valueDesc:"desc"};if(Yt(h,u)){var c=new Pf(h[u],null);l.sort((function(t,e){return c.evaluate(t.sortParam,e.sortParam)}))}else"seriesDesc"===u&&l.reverse()}ct(l,(function(n,r){var o=e.valueFormatter,l=sp(n)(o?rt(rt({},t),{valueFormatter:o}):t,n,r>0?a.html:0,i);null!=l&&s.push(l)}));var d="richText"===t.renderMode?s.join(a.richText):dp(i,s.join(""),o?n:a.html);if(o)return d;var f=yc(e.header,"ordinal",t.useUTC),p=np(i,t.renderMode).nameStyle,g=ep(i);return"richText"===t.renderMode?fp(t,f,p)+a.richText+d:dp(i,'
'+ze(f)+"
"+d,n)}function hp(t,e,n,i){var r=t.renderMode,o=e.noName,a=e.noValue,s=!e.markerType,l=e.name,u=t.useUTC,h=e.valueFormatter||t.valueFormatter||function(t){return dt(t=yt(t)?t:[t],(function(t,e){return yc(t,yt(f)?f[e]:f,u)}))};if(!o||!a){var c=s?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",r),d=o?"":yc(l,"ordinal",u),f=e.valueType,p=a?[]:h(e.value,e.dataIndex),g=!s||!o,m=!s&&o,v=np(i,r),_=v.nameStyle,y=v.valueStyle;return"richText"===r?(s?"":c)+(o?"":fp(t,d,_))+(a?"":function(t,e,n,i,r){var o=[r],a=i?10:20;return n&&o.push({padding:[0,0,0,a],align:"right"}),t.markupStyleCreator.wrapRichTextStyle(yt(e)?e.join(" "):e,o)}(t,p,g,m,y)):dp(i,(s?"":c)+(o?"":function(t,e,n){return''+ze(t)+""}(d,!s,_))+(a?"":function(t,e,n,i){var r=n?"10px":"20px",o=e?"float:right;margin-left:"+r:"";return t=yt(t)?t:[t],''+dt(t,(function(t){return ze(t)})).join("  ")+""}(p,g,m,y)),n)}}function cp(t,e,n,i,r,o){if(t)return sp(t)({useUTC:r,renderMode:n,orderMode:i,markupStyleCreator:e,valueFormatter:t.valueFormatter},t,0,o)}function dp(t,e,n){return'
'+e+'
'}function fp(t,e,n){return t.markupStyleCreator.wrapRichTextStyle(e,n)}function pp(t,e){var n=t.get("padding");return null!=n?n:"richText"===e?[8,10]:10}var gp=function(){function t(){this.richTextStyles={},this._nextStyleNameId=pa()}return t.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},t.prototype.makeTooltipMarker=function(t,e,n){var i="richText"===n?this._generateStyleName():null,r=Sc({color:e,type:t,renderMode:n,markerId:i});return wt(r)?r:(this.richTextStyles[i]=r.style,r.content)},t.prototype.wrapRichTextStyle=function(t,e){var n={};yt(e)?ct(e,(function(t){return rt(n,t)})):rt(n,e);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+t+"}"},t}();function mp(t){var e,n,i,r,o=t.series,a=t.dataIndex,s=t.multipleSeries,l=o.getData(),u=l.mapDimensionsAll("defaultedTooltip"),h=u.length,c=o.getRawValue(a),d=yt(c),f=function(t,e){return Cc(t.getData().getItemVisual(e,"style")[t.visualDrawType])}(o,a);if(h>1||d&&!h){var p=function(t,e,n,i,r){var o=e.getData(),a=ft(t,(function(t,e,n){var i=o.getDimensionInfo(n);return t||i&&!1!==i.tooltip&&null!=i.displayName}),!1),s=[],l=[],u=[];function h(t,e){var n=o.getDimensionInfo(e);n&&!1!==n.otherDims.tooltip&&(a?u.push(op("nameValue",{markerType:"subItem",markerColor:r,name:n.displayName,value:t,valueType:n.type})):(s.push(t),l.push(n.type)))}return i.length?ct(i,(function(t){h(xf(o,n,t),t)})):ct(t,h),{inlineValues:s,inlineValueTypes:l,blocks:u}}(c,o,a,u,f);e=p.inlineValues,n=p.inlineValueTypes,i=p.blocks,r=p.inlineValues[0]}else if(h){var g=l.getDimensionInfo(u[0]);r=e=xf(l,a,u[0]),n=g.type}else r=e=d?c[0]:c;var m=Da(o),v=m&&o.name||"",_=l.getName(a),y=s?v:_;return op("section",{header:v,noHeader:s||!m,sortParam:r,blocks:[op("nameValue",{markerType:"item",markerColor:f,name:y,noName:!Bt(y),value:e,valueType:n,dataIndex:a})].concat(i||[])})}var vp=Ea();function _p(t,e){return t.getName(e)||t.getId(e)}var yp=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectedDataIndicesMap={},e}return I(e,t),e.prototype.init=function(t,e,n){this.seriesIndex=this.componentIndex,this.dataTask=Tf({count:wp,reset:bp}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n),(vp(this).sourceManager=new Jf(this)).prepareSource();var i=this.getInitialData(t,n);Tp(i,this),this.dataTask.context.data=i,vp(this).dataBeforeProcessed=i,xp(this),this._initSelectedMapFromData(i)},e.prototype.mergeDefaultAndTheme=function(t,e){var n=Rc(this),i=n?zc(t):{},r=this.subType;Gc.hasClass(r)&&(r+="Series"),nt(t,e.getTheme().get(this.subType)),nt(t,this.getDefaultOption()),wa(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&kc(t,i,n)},e.prototype.mergeOption=function(t,e){t=nt(this.option,t,!0),this.fillDataTextStyle(t.data);var n=Rc(this);n&&kc(this.option,t,n);var i=vp(this).sourceManager;i.dirty(),i.prepareSource();var r=this.getInitialData(t,e);Tp(r,this),this.dataTask.dirty(),this.dataTask.context.data=r,vp(this).dataBeforeProcessed=r,xp(this),this._initSelectedMapFromData(r)},e.prototype.fillDataTextStyle=function(t){if(t&&!Ct(t))for(var e=["show"],n=0;nthis.getShallow("animationThreshold")&&(e=!1),!!e},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(t,e,n){var i=this.ecModel,r=cd.prototype.getColorFromPalette.call(this,t,e,n);return r||(r=i.getColorFromPalette(t,e,n)),r},e.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(t,e){this._innerSelect(this.getData(e),t)},e.prototype.unselect=function(t,e){var n=this.option.selectedMap;if(n){var i=this.option.selectedMode,r=this.getData(e);if("series"===i||"all"===n)return this.option.selectedMap={},void(this._selectedDataIndicesMap={});for(var o=0;o=0&&n.push(r)}return n},e.prototype.isSelected=function(t,e){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(e);return("all"===n||n[_p(i,t)])&&!i.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this.__universalTransitionEnabled)return!0;var t=this.option.universalTransition;return!!t&&(!0===t||t&&t.enabled)},e.prototype._innerSelect=function(t,e){var n,i,r=this.option,o=r.selectedMode,a=e.length;if(o&&a)if("series"===o)r.selectedMap="all";else if("multiple"===o){Tt(r.selectedMap)||(r.selectedMap={});for(var s=r.selectedMap,l=0;l0&&this._innerSelect(t,e)}},e.registerClass=function(t){return Gc.registerClass(t)},e.protoInitialize=function(){var t=e.prototype;t.type="series.__base__",t.seriesIndex=0,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle",t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),e}(Gc);function xp(t){var e=t.name;Da(t)||(t.name=function(t){var e=t.getRawData(),n=e.mapDimensionsAll("seriesName"),i=[];return ct(n,(function(t){var n=e.getDimensionInfo(t);n.displayName&&i.push(n.displayName)})),i.join(" ")}(t)||e)}function wp(t){return t.model.getRawData().count()}function bp(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),Sp}function Sp(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function Tp(t,e){ct(Zt(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),(function(n){t.wrapMethod(n,_t(Mp,e))}))}function Mp(t,e){var n=Cp(t);return n&&n.setOutputEnd((e||this).count()),e}function Cp(t){var e=(t.ecModel||{}).scheduler,n=e&&e.getPipeline(t.uid);if(n){var i=n.currentTask;if(i){var r=i.agentStubMap;r&&(i=r.get(t.uid))}return i}}ut(yp,bf),ut(yp,cd),Wa(yp,Gc);const Lp=yp;var Ap=function(){function t(){this.group=new Eo,this.uid=Eh("viewComponent")}return t.prototype.init=function(t,e){},t.prototype.render=function(t,e,n,i){},t.prototype.dispose=function(t,e){},t.prototype.updateView=function(t,e,n,i){},t.prototype.updateLayout=function(t,e,n,i){},t.prototype.updateVisual=function(t,e,n,i){},t.prototype.toggleBlurSeries=function(t,e,n){},t.prototype.eachRendered=function(t){var e=this.group;e&&e.traverse(t)},t}();Ua(Ap),qa(Ap);const Dp=Ap;function Ip(){var t=Ea();return function(e){var n=t(e),i=e.pipelineContext,r=!!n.large,o=!!n.progressiveRender,a=n.large=!(!i||!i.large),s=n.progressiveRender=!(!i||!i.progressiveRender);return!(r===a&&o===s)&&"reset"}}var Pp=il.CMD,Ep=[[],[],[]],Op=Math.sqrt,Np=Math.atan2;var Rp=Math.sqrt,kp=Math.sin,zp=Math.cos,Bp=Math.PI;function Fp(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Vp(t,e){return(t[0]*e[0]+t[1]*e[1])/(Fp(t)*Fp(e))}function Gp(t,e){return(t[0]*e[1]1&&(a*=Rp(p),s*=Rp(p));var g=(r===o?-1:1)*Rp((a*a*(s*s)-a*a*(f*f)-s*s*(d*d))/(a*a*(f*f)+s*s*(d*d)))||0,m=g*a*f/s,v=g*-s*d/a,_=(t+n)/2+zp(c)*m-kp(c)*v,y=(e+i)/2+kp(c)*m+zp(c)*v,x=Gp([1,0],[(d-m)/a,(f-v)/s]),w=[(d-m)/a,(f-v)/s],b=[(-1*d-m)/a,(-1*f-v)/s],S=Gp(w,b);if(Vp(w,b)<=-1&&(S=Bp),Vp(w,b)>=1&&(S=0),S<0){var T=Math.round(S/Bp*1e6)/1e6;S=2*Bp+T%2*Bp}h.addData(u,_,y,a,s,x,S,c,o)}var Up=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,Wp=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;var jp=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.applyTransform=function(t){},e}(Tl);function Zp(t){return null!=t.setData}function Xp(t,e){var n=function(t){var e=new il;if(!t)return e;var n,i=0,r=0,o=i,a=r,s=il.CMD,l=t.match(Up);if(!l)return e;for(var u=0;uI*I+P*P&&(T=C,M=L),{cx:T,cy:M,x0:-h,y0:-c,x1:T*(r/w-1),y1:M*(r/w-1)}}function dg(t,e){var n,i=lg(e.r,0),r=lg(e.r0||0,0),o=i>0;if(o||r>0){if(o||(i=r,r=0),r>i){var a=i;i=r,r=a}var s=e.startAngle,l=e.endAngle;if(!isNaN(s)&&!isNaN(l)){var u=e.cx,h=e.cy,c=!!e.clockwise,d=ag(l-s),f=d>eg&&d%eg;if(f>hg&&(d=f),i>hg)if(d>eg-hg)t.moveTo(u+i*ig(s),h+i*ng(s)),t.arc(u,h,i,s,l,!c),r>hg&&(t.moveTo(u+r*ig(l),h+r*ng(l)),t.arc(u,h,r,l,s,c));else{var p=void 0,g=void 0,m=void 0,v=void 0,_=void 0,y=void 0,x=void 0,w=void 0,b=void 0,S=void 0,T=void 0,M=void 0,C=void 0,L=void 0,A=void 0,D=void 0,I=i*ig(s),P=i*ng(s),E=r*ig(l),O=r*ng(l),N=d>hg;if(N){var R=e.cornerRadius;R&&(n=function(t){var e;if(yt(t)){var n=t.length;if(!n)return t;e=1===n?[t[0],t[0],0,0]:2===n?[t[0],t[0],t[1],t[1]]:3===n?t.concat(t[2]):t}else e=[t,t,t,t];return e}(R),p=n[0],g=n[1],m=n[2],v=n[3]);var k=ag(i-r)/2;if(_=ug(k,m),y=ug(k,v),x=ug(k,p),w=ug(k,g),T=b=lg(_,y),M=S=lg(x,w),(b>hg||S>hg)&&(C=i*ig(l),L=i*ng(l),A=r*ig(s),D=r*ng(s),dhg){var W=ug(m,T),j=ug(v,T),Z=cg(A,D,I,P,i,W,c),X=cg(C,L,E,O,i,j,c);t.moveTo(u+Z.cx+Z.x0,h+Z.cy+Z.y0),T0&&t.arc(u+Z.cx,h+Z.cy,W,og(Z.y0,Z.x0),og(Z.y1,Z.x1),!c),t.arc(u,h,i,og(Z.cy+Z.y1,Z.cx+Z.x1),og(X.cy+X.y1,X.cx+X.x1),!c),j>0&&t.arc(u+X.cx,h+X.cy,j,og(X.y1,X.x1),og(X.y0,X.x0),!c))}else t.moveTo(u+I,h+P),t.arc(u,h,i,s,l,!c);else t.moveTo(u+I,h+P);if(r>hg&&N)if(M>hg){W=ug(p,M),Z=cg(E,O,C,L,r,-(j=ug(g,M)),c),X=cg(I,P,A,D,r,-W,c);t.lineTo(u+Z.cx+Z.x0,h+Z.cy+Z.y0),M0&&t.arc(u+Z.cx,h+Z.cy,j,og(Z.y0,Z.x0),og(Z.y1,Z.x1),!c),t.arc(u,h,r,og(Z.cy+Z.y1,Z.cx+Z.x1),og(X.cy+X.y1,X.cx+X.x1),c),W>0&&t.arc(u+X.cx,h+X.cy,W,og(X.y1,X.x1),og(X.y0,X.x0),!c))}else t.lineTo(u+E,h+O),t.arc(u,h,r,l,s,c);else t.lineTo(u+E,h+O)}else t.moveTo(u,h);t.closePath()}}}var fg=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0},pg=function(t){function e(e){return t.call(this,e)||this}return I(e,t),e.prototype.getDefaultShape=function(){return new fg},e.prototype.buildPath=function(t,e){dg(t,e)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(Tl);pg.prototype.type="sector";const gg=pg;var mg=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},vg=function(t){function e(e){return t.call(this,e)||this}return I(e,t),e.prototype.getDefaultShape=function(){return new mg},e.prototype.buildPath=function(t,e){var n=e.cx,i=e.cy,r=2*Math.PI;t.moveTo(n+e.r,i),t.arc(n,i,e.r,0,r,!1),t.moveTo(n+e.r0,i),t.arc(n,i,e.r0,0,r,!0)},e}(Tl);vg.prototype.type="ring";const _g=vg;function yg(t,e,n){var i=e.smooth,r=e.points;if(r&&r.length>=2){if(i){var o=function(t,e,n,i){var r,o,a,s,l=[],u=[],h=[],c=[];if(i){a=[1/0,1/0],s=[-1/0,-1/0];for(var d=0,f=t.length;dXg[1]){if(a=!1,r)return a;var u=Math.abs(Xg[0]-Zg[1]),h=Math.abs(Zg[0]-Xg[1]);Math.min(u,h)>i.len()&&(uMath.abs(o[1])?o[0]>0?"right":"left":o[1]>0?"bottom":"top"}function xm(t){return!t.isGroup}function wm(t,e,n){if(t&&e){var i=function(t){var e={};return t.traverse((function(t){xm(t)&&t.anid&&(e[t.anid]=t)})),e}(t);e.traverse((function(t){if(xm(t)&&t.anid){var e=i[t.anid];if(e){var o=r(t);t.attr(r(e)),Ju(t,o,n,nu(t).dataIndex)}}}))}function r(t){var e={x:t.x,y:t.y,rotation:t.rotation};return function(t){return null!=t.shape}(t)&&(e.shape=rt({},t.shape)),e}}function bm(t,e){return dt(t,(function(t){var n=t[0];n=em(n,e.x),n=nm(n,e.x+e.width);var i=t[1];return i=em(i,e.y),[n,i=nm(i,e.y+e.height)]}))}function Sm(t,e){var n=em(t.x,e.x),i=nm(t.x+t.width,e.x+e.width),r=em(t.y,e.y),o=nm(t.y+t.height,e.y+e.height);if(i>=n&&o>=r)return{x:n,y:r,width:i-n,height:o-r}}function Tm(t,e,n){var i=rt({rectHover:!0},e),r=i.style={strokeNoScale:!0};if(n=n||{x:-1,y:-1,width:2,height:2},t)return 0===t.indexOf("image://")?(r.image=t.slice(8),ot(r,n),new Pl(i)):um(t.replace("path://",""),i,n,"center")}function Mm(t,e,n,i,r){for(var o=0,a=r[r.length-1];o=-1e-6)return!1;var p=t-r,g=e-o,m=Lm(p,g,u,h)/f;if(m<0||m>1)return!1;var v=Lm(p,g,c,d)/f;return!(v<0||v>1)}function Lm(t,e,n,i){return t*i-n*e}function Am(t){var e=t.itemTooltipOption,n=t.componentModel,i=t.itemName,r=wt(e)?{formatter:e}:e,o=n.mainType,a=n.componentIndex,s={componentType:o,name:i,$vars:["name"]};s[o+"Index"]=a;var l=t.formatterParamsExtra;l&&ct(mt(l),(function(t){Yt(s,t)||(s[t]=l[t],s.$vars.push(t))}));var u=nu(t.el);u.componentMainType=o,u.componentIndex=a,u.tooltipConfig={name:i,option:ot({content:i,encodeHTMLContent:!0,formatterParams:s},r)}}function Dm(t,e){var n;t.isGroup&&(n=e(t)),n||t.traverse(e)}function Im(t,e){if(t)if(yt(t))for(var n=0;n=0?c():h=setTimeout(c,-r),l=i};return d.clear=function(){h&&(clearTimeout(h),h=null)},d.debounceNextCall=function(t){s=t},d}function Wm(t,e,n,i){var r=t[e];if(r){var o=r[Vm]||r,a=r[Hm];if(r[Gm]!==n||a!==i){if(null==n||!i)return t[e]=o;(r=t[e]=Um(o,n,"debounce"===i))[Vm]=o,r[Hm]=i,r[Gm]=n}return r}}function jm(t,e){var n=t[e];n&&n[Vm]&&(n.clear&&n.clear(),t[e]=n[Vm])}var Zm=Ea(),Xm={itemStyle:Ya(Ch,!0),lineStyle:Ya(Sh,!0)},qm={lineStyle:"stroke",itemStyle:"fill"};function Ym(t,e){var n=t.visualStyleMapper||Xm[e];return n||(console.warn("Unknown style type '"+e+"'."),Xm.itemStyle)}function Km(t,e){var n=t.visualDrawType||qm[e];return n||(console.warn("Unknown style type '"+e+"'."),"fill")}var Jm={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=t.getModel(i),o=Ym(t,i)(r),a=r.getShallow("decal");a&&(n.setVisual("decal",a),a.dirty=!0);var s=Km(t,i),l=o[s],u=xt(l)?l:null,h="auto"===o.fill||"auto"===o.stroke;if(!o[s]||u||h){var c=t.getColorFromPalette(t.name,null,e.getSeriesCount());o[s]||(o[s]=c,n.setVisual("colorFromPalette",!0)),o.fill="auto"===o.fill||xt(o.fill)?c:o.fill,o.stroke="auto"===o.stroke||xt(o.stroke)?c:o.stroke}if(n.setVisual("style",o),n.setVisual("drawType",s),!e.isSeriesFiltered(t)&&u)return n.setVisual("colorFromPalette",!1),{dataEach:function(e,n){var i=t.getDataParams(n),r=rt({},o);r[s]=u(i),e.setItemVisual(n,"style",r)}}}},Qm=new Ih,$m={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!t.ignoreStyleOnData&&!e.isSeriesFiltered(t)){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",r=Ym(t,i),o=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(t,e){var n=t.getRawDataItem(e);if(n&&n[i]){Qm.option=n[i];var a=r(Qm);rt(t.ensureUniqueItemVisual(e,"style"),a),Qm.option.decal&&(t.setItemVisual(e,"decal",Qm.option.decal),Qm.option.decal.dirty=!0),o in a&&t.setItemVisual(e,"colorFromPalette",!1)}}:null}}}},tv={performRawSeries:!0,overallReset:function(t){var e=jt();t.eachSeries((function(t){var n=t.getColorBy();if(!t.isColorBySeries()){var i=t.type+"-"+n,r=e.get(i);r||(r={},e.set(i,r)),Zm(t).scope=r}})),t.eachSeries((function(e){if(!e.isColorBySeries()&&!t.isSeriesFiltered(e)){var n=e.getRawData(),i={},r=e.getData(),o=Zm(e).scope,a=e.visualStyleAccessPath||"itemStyle",s=Km(e,a);r.each((function(t){var e=r.getRawIndex(t);i[e]=t})),n.each((function(t){var a=i[t];if(r.getItemVisual(a,"colorFromPalette")){var l=r.ensureUniqueItemVisual(a,"style"),u=n.getName(t)||t+"",h=n.count();l[s]=e.getColorFromPalette(u,o,h)}}))}}))}},ev=Math.PI;var nv=function(){function t(t,e,n,i){this._stageTaskMap=jt(),this.ecInstance=t,this.api=e,n=this._dataProcessorHandlers=n.slice(),i=this._visualHandlers=i.slice(),this._allHandlers=n.concat(i)}return t.prototype.restoreData=function(t,e){t.restoreData(e),this._stageTaskMap.each((function(t){var e=t.overallTask;e&&e.dirty()}))},t.prototype.getPerformArgs=function(t,e){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),i=n.context,r=!e&&n.progressiveEnabled&&(!i||i.progressiveRender)&&t.__idxInPipeline>n.blockIndex?n.step:null,o=i&&i.modDataCount;return{step:r,modBy:null!=o?Math.ceil(o/r):null,modDataCount:o}}},t.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},t.prototype.updateStreamModes=function(t,e){var n=this._pipelineMap.get(t.uid),i=t.getData().count(),r=n.progressiveEnabled&&e.incrementalPrepareRender&&i>=n.threshold,o=t.get("large")&&i>=t.get("largeThreshold"),a="mod"===t.get("progressiveChunkMode")?i:null;t.pipelineContext=n.context={progressiveRender:r,modDataCount:a,large:o}},t.prototype.restorePipelines=function(t){var e=this,n=e._pipelineMap=jt();t.eachSeries((function(t){var i=t.getProgressive(),r=t.uid;n.set(r,{id:r,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),e._pipe(t,t.dataTask)}))},t.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.api.getModel(),n=this.api;ct(this._allHandlers,(function(i){var r=t.get(i.uid)||t.set(i.uid,{});zt(!(i.reset&&i.overallReset),""),i.reset&&this._createSeriesStageTask(i,r,e,n),i.overallReset&&this._createOverallStageTask(i,r,e,n)}),this)},t.prototype.prepareView=function(t,e,n,i){var r=t.renderTask,o=r.context;o.model=e,o.ecModel=n,o.api=i,r.__block=!t.incrementalPrepareRender,this._pipe(e,r)},t.prototype.performDataProcessorTasks=function(t,e){this._performStageTasks(this._dataProcessorHandlers,t,e,{block:!0})},t.prototype.performVisualTasks=function(t,e,n){this._performStageTasks(this._visualHandlers,t,e,n)},t.prototype._performStageTasks=function(t,e,n,i){i=i||{};var r=!1,o=this;function a(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}ct(t,(function(t,s){if(!i.visualType||i.visualType===t.visualType){var l=o._stageTaskMap.get(t.uid),u=l.seriesTaskMap,h=l.overallTask;if(h){var c,d=h.agentStubMap;d.each((function(t){a(i,t)&&(t.dirty(),c=!0)})),c&&h.dirty(),o.updatePayload(h,n);var f=o.getPerformArgs(h,i.block);d.each((function(t){t.perform(f)})),h.perform(f)&&(r=!0)}else u&&u.each((function(s,l){a(i,s)&&s.dirty();var u=o.getPerformArgs(s,i.block);u.skip=!t.performRawSeries&&e.isSeriesFiltered(s.context.model),o.updatePayload(s,n),s.perform(u)&&(r=!0)}))}})),this.unfinished=r||this.unfinished},t.prototype.performSeriesTasks=function(t){var e;t.eachSeries((function(t){e=t.dataTask.perform()||e})),this.unfinished=e||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each((function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)}))},t.prototype.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},t.prototype._createSeriesStageTask=function(t,e,n,i){var r=this,o=e.seriesTaskMap,a=e.seriesTaskMap=jt(),s=t.seriesType,l=t.getTargetSeries;function u(e){var s=e.uid,l=a.set(s,o&&o.get(s)||Tf({plan:sv,reset:lv,count:cv}));l.context={model:e,ecModel:n,api:i,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:r},r._pipe(e,l)}t.createOnAllSeries?n.eachRawSeries(u):s?n.eachRawSeriesByType(s,u):l&&l(n,i).each(u)},t.prototype._createOverallStageTask=function(t,e,n,i){var r=this,o=e.overallTask=e.overallTask||Tf({reset:iv});o.context={ecModel:n,api:i,overallReset:t.overallReset,scheduler:r};var a=o.agentStubMap,s=o.agentStubMap=jt(),l=t.seriesType,u=t.getTargetSeries,h=!0,c=!1;function d(t){var e=t.uid,n=s.set(e,a&&a.get(e)||(c=!0,Tf({reset:rv,onDirty:av})));n.context={model:t,overallProgress:h},n.agent=o,n.__block=h,r._pipe(t,n)}zt(!t.createOnAllSeries,""),l?n.eachRawSeriesByType(l,d):u?u(n,i).each(d):(h=!1,ct(n.getSeries(),d)),c&&o.dirty()},t.prototype._pipe=function(t,e){var n=t.uid,i=this._pipelineMap.get(n);!i.head&&(i.head=e),i.tail&&i.tail.pipe(e),i.tail=e,e.__idxInPipeline=i.count++,e.__pipeline=i},t.wrapStageHandler=function(t,e){return xt(t)&&(t={overallReset:t,seriesType:dv(t)}),t.uid=Eh("stageHandler"),e&&(t.visualType=e),t},t}();function iv(t){t.overallReset(t.ecModel,t.api,t.payload)}function rv(t){return t.overallProgress&&ov}function ov(){this.agent.dirty(),this.getDownstream().dirty()}function av(){this.agent&&this.agent.dirty()}function sv(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function lv(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=xa(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?dt(e,(function(t,e){return hv(e)})):uv}var uv=hv(0);function hv(t){return function(e,n){var i=n.data,r=n.resetDefines[t];if(r&&r.dataEach)for(var o=e.start;o0&&h===r.length-u.length){var c=r.slice(0,h);"data"!==c&&(e.mainType=c,e[u.toLowerCase()]=t,s=!0)}}a.hasOwnProperty(r)&&(n[r]=t,s=!0),s||(i[r]=t)}))}return{cptQuery:e,dataQuery:n,otherQuery:i}},t.prototype.filter=function(t,e){var n=this.eventInfo;if(!n)return!0;var i=n.targetEl,r=n.packedEvent,o=n.model,a=n.view;if(!o||!a)return!0;var s=e.cptQuery,l=e.dataQuery;return u(s,o,"mainType")&&u(s,o,"subType")&&u(s,o,"index","componentIndex")&&u(s,o,"name")&&u(s,o,"id")&&u(l,r,"name")&&u(l,r,"dataIndex")&&u(l,r,"dataType")&&(!a.filterForExposedEvent||a.filterForExposedEvent(t,e.otherQuery,i,r));function u(t,e,n,i){return null==t[n]||e[i||n]===t[n]}},t.prototype.afterTrigger=function(){this.eventInfo=null},t}(),Lv=["symbol","symbolSize","symbolRotate","symbolOffset"],Av=Lv.concat(["symbolKeepAspect"]),Dv={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData();if(t.legendIcon&&n.setVisual("legendIcon",t.legendIcon),t.hasSymbolVisual){for(var i={},r={},o=!1,a=0;a=0&&qv(l)?l:.5,t.createRadialGradient(a,s,0,a,s,l)}(t,e,n):function(t,e,n){var i=null==e.x?0:e.x,r=null==e.x2?1:e.x2,o=null==e.y?0:e.y,a=null==e.y2?0:e.y2;return e.global||(i=i*n.width+n.x,r=r*n.width+n.x,o=o*n.height+n.y,a=a*n.height+n.y),i=qv(i)?i:0,r=qv(r)?r:1,o=qv(o)?o:0,a=qv(a)?a:0,t.createLinearGradient(i,o,r,a)}(t,e,n),r=e.colorStops,o=0;o0&&(e=i.lineDash,n=i.lineWidth,e&&"solid"!==e&&n>0?"dashed"===e?[4*n,2*n]:"dotted"===e?[n]:St(e)?[e]:yt(e)?e:null:null),o=i.lineDashOffset;if(r){var a=i.strokeNoScale&&t.getLineScale?t.getLineScale():1;a&&1!==a&&(r=dt(r,(function(t){return t/a})),o/=a)}return[r,o]}var $v=new il(!0);function t_(t){var e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))}function e_(t){return"string"==typeof t&&"none"!==t}function n_(t){var e=t.fill;return null!=e&&"none"!==e}function i_(t,e){if(null!=e.fillOpacity&&1!==e.fillOpacity){var n=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=n}else t.fill()}function r_(t,e){if(null!=e.strokeOpacity&&1!==e.strokeOpacity){var n=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=n}else t.stroke()}function o_(t,e,n){var i=ts(e.image,e.__image,n);if(ns(i)){var r=t.createPattern(i,e.repeat||"repeat");if("function"==typeof DOMMatrix&&r&&r.setTransform){var o=new DOMMatrix;o.translateSelf(e.x||0,e.y||0),o.rotateSelf(0,0,(e.rotation||0)*Jt),o.scaleSelf(e.scaleX||1,e.scaleY||1),r.setTransform(o)}return r}}var a_=["shadowBlur","shadowOffsetX","shadowOffsetY"],s_=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function l_(t,e,n,i,r){var o=!1;if(!i&&e===(n=n||{}))return!1;if(i||e.opacity!==n.opacity){g_(t,r),o=!0;var a=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(a)?vs.opacity:a}(i||e.blend!==n.blend)&&(o||(g_(t,r),o=!0),t.globalCompositeOperation=e.blend||vs.blend);for(var s=0;s0&&t.unfinished);t.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(t,e,n){if(!this[z_])if(this._disposed)py(this.id);else{var i,r,o;if(Tt(e)&&(n=e.lazyUpdate,i=e.silent,r=e.replaceMerge,o=e.transition,e=e.notMerge),this[z_]=!0,!this._model||e){var a=new Ld(this._api),s=this._theme,l=this._model=new _d;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,a)}this._model.setOption(t,{replaceMerge:r},_y);var u={seriesTransition:o,optionChanged:!0};if(n)this[B_]={silent:i,updateParams:u},this[z_]=!1,this.getZr().wakeUp();else{try{j_(this),q_.update.call(this,null,u)}catch(t){throw this[B_]=null,this[z_]=!1,t}this._ssr||this._zr.flush(),this[B_]=null,this[z_]=!1,Q_.call(this,i),$_.call(this,i)}}},e.prototype.setTheme=function(){Lf()},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||O.hasGlobalWindow&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},e.prototype.renderToCanvas=function(t){return t=t||{},this._zr.painter.getRenderedCanvas({backgroundColor:t.backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(t){return t=t||{},this._zr.painter.renderToString({useViewBox:t.useViewBox})},e.prototype.getSvgDataURL=function(){if(O.svgSupported){var t=this._zr;return ct(t.storage.getDisplayList(),(function(t){t.stopAnimation(null,!0)})),t.painter.toDataURL()}},e.prototype.getDataURL=function(t){if(!this._disposed){var e=(t=t||{}).excludeComponents,n=this._model,i=[],r=this;ct(e,(function(t){n.eachComponent({mainType:t},(function(t){var e=r._componentsMap[t.__viewId];e.group.ignore||(i.push(e),e.group.ignore=!0)}))}));var o="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return ct(i,(function(t){t.group.ignore=!1})),o}py(this.id)},e.prototype.getConnectedDataURL=function(t){if(!this._disposed){var e="svg"===t.type,n=this.group,i=Math.min,r=Math.max,o=1/0;if(Sy[n]){var a=o,s=o,l=-1/0,u=-1/0,h=[],c=t&&t.pixelRatio||this.getDevicePixelRatio();ct(by,(function(o,c){if(o.group===n){var d=e?o.getZr().painter.getSvgDom().innerHTML:o.renderToCanvas(et(t)),f=o.getDom().getBoundingClientRect();a=i(f.left,a),s=i(f.top,s),l=r(f.right,l),u=r(f.bottom,u),h.push({dom:d,left:f.left,top:f.top})}}));var d=(l*=c)-(a*=c),f=(u*=c)-(s*=c),p=F.createCanvas(),g=zo(p,{renderer:e?"svg":"canvas"});if(g.resize({width:d,height:f}),e){var m="";return ct(h,(function(t){var e=t.left-a,n=t.top-s;m+=''+t.dom+""})),g.painter.getSvgRoot().innerHTML=m,t.connectedBackgroundColor&&g.painter.setBackgroundColor(t.connectedBackgroundColor),g.refreshImmediately(),g.painter.toDataURL()}return t.connectedBackgroundColor&&g.add(new Fl({shape:{x:0,y:0,width:d,height:f},style:{fill:t.connectedBackgroundColor}})),ct(h,(function(t){var e=new Pl({style:{x:t.left*c-a,y:t.top*c-s,image:t.dom}});g.add(e)})),g.refreshImmediately(),p.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}py(this.id)},e.prototype.convertToPixel=function(t,e){return Y_(this,"convertToPixel",t,e)},e.prototype.convertFromPixel=function(t,e){return Y_(this,"convertFromPixel",t,e)},e.prototype.containPixel=function(t,e){var n;if(!this._disposed)return ct(Na(this._model,t),(function(t,i){i.indexOf("Models")>=0&&ct(t,(function(t){var r=t.coordinateSystem;if(r&&r.containPoint)n=n||!!r.containPoint(e);else if("seriesModels"===i){var o=this._chartsMap[t.__viewId];o&&o.containPoint&&(n=n||o.containPoint(e,t))}else 0}),this)}),this),!!n;py(this.id)},e.prototype.getVisual=function(t,e){var n=Na(this._model,t,{defaultMainType:"series"});var i=n.seriesModel.getData(),r=n.hasOwnProperty("dataIndexInside")?n.dataIndexInside:n.hasOwnProperty("dataIndex")?i.indexOfRawIndex(n.dataIndex):null;return null!=r?function(t,e,n){switch(n){case"color":return t.getItemVisual(e,"style")[t.getVisual("drawType")];case"opacity":return t.getItemVisual(e,"style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getItemVisual(e,n)}}(i,r,e):function(t,e){switch(e){case"color":return t.getVisual("style")[t.getVisual("drawType")];case"opacity":return t.getVisual("style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getVisual(e)}}(i,e)},e.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},e.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},e.prototype._initEvents=function(){var t,e,n,i=this;ct(fy,(function(t){var e=function(e){var n,r=i.getModel(),o=e.target;if("globalout"===t?n={}:o&&Ev(o,(function(t){var e=nu(t);if(e&&null!=e.dataIndex){var i=e.dataModel||r.getSeriesByIndex(e.seriesIndex);return n=i&&i.getDataParams(e.dataIndex,e.dataType,o)||{},!0}if(e.eventData)return n=rt({},e.eventData),!0}),!0),n){var a=n.componentType,s=n.componentIndex;"markLine"!==a&&"markPoint"!==a&&"markArea"!==a||(a="series",s=n.seriesIndex);var l=a&&null!=s&&r.getComponent(a,s),u=l&&i["series"===l.mainType?"_chartsMap":"_componentsMap"][l.__viewId];0,n.event=e,n.type=t,i._$eventProcessor.eventInfo={targetEl:o,packedEvent:n,model:l,view:u},i.trigger(t,n)}};e.zrEventfulCallAtLast=!0,i._zr.on(t,e,i)})),ct(my,(function(t,e){i._messageCenter.on(e,(function(t){this.trigger(e,t)}),i)})),ct(["selectchanged"],(function(t){i._messageCenter.on(t,(function(e){this.trigger(t,e)}),i)})),t=this._messageCenter,e=this,n=this._api,t.on("selectchanged",(function(t){var i=n.getModel();t.isFromClick?(Pv("map","selectchanged",e,i,t),Pv("pie","selectchanged",e,i,t)):"select"===t.fromAction?(Pv("map","selected",e,i,t),Pv("pie","selected",e,i,t)):"unselect"===t.fromAction&&(Pv("map","unselected",e,i,t),Pv("pie","unselected",e,i,t))}))},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){this._disposed?py(this.id):this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed)py(this.id);else{this._disposed=!0,this.getDom()&&Fa(this.getDom(),Cy,"");var t=this,e=t._api,n=t._model;ct(t._componentsViews,(function(t){t.dispose(n,e)})),ct(t._chartsViews,(function(t){t.dispose(n,e)})),t._zr.dispose(),t._dom=t._model=t._chartsMap=t._componentsMap=t._chartsViews=t._componentsViews=t._scheduler=t._api=t._zr=t._throttledZrFlush=t._theme=t._coordSysMgr=t._messageCenter=null,delete by[t.id]}},e.prototype.resize=function(t){if(!this[z_])if(this._disposed)py(this.id);else{this._zr.resize(t);var e=this._model;if(this._loadingFX&&this._loadingFX.resize(),e){var n=e.resetOption("media"),i=t&&t.silent;this[B_]&&(null==i&&(i=this[B_].silent),n=!0,this[B_]=null),this[z_]=!0;try{n&&j_(this),q_.update.call(this,{type:"resize",animation:rt({duration:0},t&&t.animation)})}catch(t){throw this[z_]=!1,t}this[z_]=!1,Q_.call(this,i),$_.call(this,i)}}},e.prototype.showLoading=function(t,e){if(this._disposed)py(this.id);else if(Tt(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),wy[t]){var n=wy[t](this._api,e),i=this._zr;this._loadingFX=n,i.add(n)}},e.prototype.hideLoading=function(){this._disposed?py(this.id):(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},e.prototype.makeActionFromEvent=function(t){var e=rt({},t);return e.type=my[t.type],e},e.prototype.dispatchAction=function(t,e){if(this._disposed)py(this.id);else if(Tt(e)||(e={silent:!!e}),gy[t.type]&&this._model)if(this[z_])this._pendingActions.push(t);else{var n=e.silent;J_.call(this,t,n);var i=e.flush;i?this._zr.flush():!1!==i&&O.browser.weChat&&this._throttledZrFlush(),Q_.call(this,n),$_.call(this,n)}},e.prototype.updateLabelLayout=function(){C_.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(t){if(this._disposed)py(this.id);else{var e=t.seriesIndex;0,this.getModel().getSeriesByIndex(e).appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},e.internalField=function(){function t(t){t.clearColorPalette(),t.eachSeries((function(t){t.clearColorPalette()}))}function e(t){for(var e=[],n=t.currentStates,i=0;i0?{duration:o,delay:i.get("delay"),easing:i.get("easing")}:null;n.eachRendered((function(t){if(t.states&&t.states.emphasis){if($u(t))return;if(t instanceof Tl&&function(t){var e=ou(t);e.normalFill=t.style.fill,e.normalStroke=t.style.stroke;var n=t.states.select||{};e.selectFill=n.style&&n.style.fill||null,e.selectStroke=n.style&&n.style.stroke||null}(t),t.__dirty){var n=t.prevStates;n&&t.useStates(n)}if(r){t.stateTransition=a;var i=t.getTextContent(),o=t.getTextGuideLine();i&&(i.stateTransition=a),o&&(o.stateTransition=a)}t.__dirty&&e(t)}}))}j_=function(t){var e=t._scheduler;e.restorePipelines(t._model),e.prepareStageTasks(),Z_(t,!0),Z_(t,!1),e.plan()},Z_=function(t,e){for(var n=t._model,i=t._scheduler,r=e?t._componentsViews:t._chartsViews,o=e?t._componentsMap:t._chartsMap,a=t._zr,s=t._api,l=0;le.get("hoverLayerThreshold")&&!O.node&&!O.worker&&e.eachSeries((function(e){if(!e.preventUsingHoverLayer){var n=t._chartsMap[e.__viewId];n.__alive&&n.eachRendered((function(t){t.states.emphasis&&(t.states.emphasis.hoverLayer=!0)}))}}))}(t,e),C_.trigger("series:afterupdate",e,i,s)},sy=function(t){t[F_]=!0,t.getZr().wakeUp()},ly=function(t){t[F_]&&(t.getZr().storage.traverse((function(t){$u(t)||e(t)})),t[F_]=!1)},oy=function(t){return new(function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return I(n,e),n.prototype.getCoordinateSystems=function(){return t._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(e){for(;e;){var n=e.__ecComponentInfo;if(null!=n)return t._model.getComponent(n.mainType,n.index);e=e.parent}},n.prototype.enterEmphasis=function(e,n){Iu(e,n),sy(t)},n.prototype.leaveEmphasis=function(e,n){Pu(e,n),sy(t)},n.prototype.enterBlur=function(e){!function(t){Mu(t,xu)}(e),sy(t)},n.prototype.leaveBlur=function(e){Eu(e),sy(t)},n.prototype.enterSelect=function(e){Ou(e),sy(t)},n.prototype.leaveSelect=function(e){Nu(e),sy(t)},n.prototype.getModel=function(){return t.getModel()},n.prototype.getViewOfComponentModel=function(e){return t.getViewOfComponentModel(e)},n.prototype.getViewOfSeriesModel=function(e){return t.getViewOfSeriesModel(e)},n}(xd))(t)},ay=function(t){function e(t,e){for(var n=0;n=0)){jy.push(n);var o=vv.wrapStageHandler(n,r);o.__prio=e,o.__raw=n,t.push(o)}}function Xy(t,e){wy[t]=e}function qy(t){V({createCanvas:t})}function Yy(t,e,n){var i=A_("registerMap");i&&i(t,e,n)}function Ky(t){var e=A_("getMap");return e&&e(t)}var Jy=function(t){var e=(t=et(t)).type;e||Af("");var n=e.split(":");2!==n.length&&Af("");var i=!1;"echarts"===n[0]&&(e=n[1],i=!0),t.__isBuiltIn=i,zf.set(e,t)};Wy(O_,Jm),Wy(R_,$m),Wy(R_,tv),Wy(O_,Dv),Wy(R_,Iv),Wy(7e3,(function(t,e){t.eachRawSeries((function(n){if(!t.isSeriesFiltered(n)){var i=n.getData();i.hasItemVisual()&&i.each((function(t){var n=i.getItemVisual(t,"decal");n&&(i.ensureUniqueItemVisual(t,"style").decal=b_(n,e))}));var r=i.getVisual("decal");if(r)i.getVisual("style").decal=b_(r,e)}}))})),Ry(Xd),ky(900,(function(t){var e=jt();t.eachSeries((function(t){var n=t.get("stack");if(n){var i=e.get(n)||e.set(n,[]),r=t.getData(),o={stackResultDimension:r.getCalculationInfo("stackResultDimension"),stackedOverDimension:r.getCalculationInfo("stackedOverDimension"),stackedDimension:r.getCalculationInfo("stackedDimension"),stackedByDimension:r.getCalculationInfo("stackedByDimension"),isStackedByIndex:r.getCalculationInfo("isStackedByIndex"),data:r,seriesModel:t};if(!o.stackedDimension||!o.isStackedByIndex&&!o.stackedByDimension)return;i.length&&r.setCalculationInfo("stackedOnSeries",i[i.length-1].seriesModel),i.push(o)}})),e.each(qd)})),Xy("default",(function(t,e){ot(e=e||{},{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var n=new Eo,i=new Fl({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});n.add(i);var r,o=new eu({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),a=new Fl({style:{fill:"none"},textContent:o,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});return n.add(a),e.showSpinner&&((r=new zg({shape:{startAngle:-ev/2,endAngle:-ev/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001})).animateShape(!0).when(1e3,{endAngle:3*ev/2}).start("circularInOut"),r.animateShape(!0).when(1e3,{startAngle:3*ev/2}).delay(300).start("circularInOut"),n.add(r)),n.resize=function(){var n=o.getBoundingRect().width,s=e.showSpinner?e.spinnerRadius:0,l=(t.getWidth()-2*s-(e.showSpinner&&n?10:0)-n)/2-(e.showSpinner&&n?0:5+n/2)+(e.showSpinner?0:n/2)+(n?0:s),u=t.getHeight()/2;e.showSpinner&&r.setShape({cx:l,cy:u}),a.setShape({x:l-s,y:u-s,width:2*s,height:2*s}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},n.resize(),n})),Vy({type:cu,event:cu,update:cu},Kt),Vy({type:du,event:du,update:du},Kt),Vy({type:fu,event:fu,update:fu},Kt),Vy({type:pu,event:pu,update:pu},Kt),Vy({type:gu,event:gu,update:gu},Kt),Ny("light",yv),Ny("dark",Mv);var Qy={};function $y(t){return null==t?0:t.length||1}function tx(t){return t}const ex=function(){function t(t,e,n,i,r,o){this._old=t,this._new=e,this._oldKeyGetter=n||tx,this._newKeyGetter=i||tx,this.context=r,this._diffModeMultiple="multiple"===o}return t.prototype.add=function(t){return this._add=t,this},t.prototype.update=function(t){return this._update=t,this},t.prototype.updateManyToOne=function(t){return this._updateManyToOne=t,this},t.prototype.updateOneToMany=function(t){return this._updateOneToMany=t,this},t.prototype.updateManyToMany=function(t){return this._updateManyToMany=t,this},t.prototype.remove=function(t){return this._remove=t,this},t.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},t.prototype._executeOneToOne=function(){var t=this._old,e=this._new,n={},i=new Array(t.length),r=new Array(e.length);this._initIndexMap(t,null,i,"_oldKeyGetter"),this._initIndexMap(e,n,r,"_newKeyGetter");for(var o=0;o1){var u=s.shift();1===s.length&&(n[a]=s[0]),this._update&&this._update(u,o)}else 1===l?(n[a]=null,this._update&&this._update(s,o)):this._remove&&this._remove(o)}this._performRestAdd(r,n)},t.prototype._executeMultiple=function(){var t=this._old,e=this._new,n={},i={},r=[],o=[];this._initIndexMap(t,n,r,"_oldKeyGetter"),this._initIndexMap(e,i,o,"_newKeyGetter");for(var a=0;a1&&1===c)this._updateManyToOne&&this._updateManyToOne(u,l),i[s]=null;else if(1===h&&c>1)this._updateOneToMany&&this._updateOneToMany(u,l),i[s]=null;else if(1===h&&1===c)this._update&&this._update(u,l),i[s]=null;else if(h>1&&c>1)this._updateManyToMany&&this._updateManyToMany(u,l),i[s]=null;else if(h>1)for(var d=0;d1)for(var a=0;a30}var dx,fx,px,gx,mx,vx,_x,yx=Tt,xx=dt,bx="undefined"==typeof Int32Array?Array:Int32Array,Sx=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],Tx=["_approximateExtent"],Mx=function(){function t(t,e){var n;this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var i=!1;lx(t)?(n=t.dimensions,this._dimOmitted=t.isDimensionOmitted(),this._schema=t):(i=!0,n=t),n=n||["x","y"];for(var r={},o=[],a={},s=!1,l={},u=0;u=e)){var n=this._store.getProvider();this._updateOrdinalMeta();var i=this._nameList,r=this._idList;if(n.getSource().sourceFormat===Zc&&!n.pure)for(var o=[],a=t;a0},t.prototype.ensureUniqueItemVisual=function(t,e){var n=this._itemVisuals,i=n[t];i||(i=n[t]={});var r=i[e];return null==r&&(yt(r=this.getVisual(e))?r=r.slice():yx(r)&&(r=rt({},r)),i[e]=r),r},t.prototype.setItemVisual=function(t,e,n){var i=this._itemVisuals[t]||{};this._itemVisuals[t]=i,yx(e)?rt(i,e):i[e]=n},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(t,e){yx(t)?rt(this._layout,t):this._layout[t]=e},t.prototype.getLayout=function(t){return this._layout[t]},t.prototype.getItemLayout=function(t){return this._itemLayouts[t]},t.prototype.setItemLayout=function(t,e,n){this._itemLayouts[t]=n?rt(this._itemLayouts[t]||{},e):e},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(t,e){!function(t,e,n,i){if(i){var r=nu(i);r.dataIndex=n,r.dataType=e,r.seriesIndex=t,r.ssrType="chart","group"===i.type&&i.traverse((function(i){var r=nu(i);r.seriesIndex=t,r.dataIndex=n,r.dataType=e,r.ssrType="chart"}))}}(this.hostModel&&this.hostModel.seriesIndex,this.dataType,t,e),this._graphicEls[t]=e},t.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},t.prototype.eachItemGraphicEl=function(t,e){ct(this._graphicEls,(function(n,i){n&&t&&t.call(e,n,i)}))},t.prototype.cloneShallow=function(e){return e||(e=new t(this._schema?this._schema:xx(this.dimensions,this._getDimInfo,this),this.hostModel)),mx(e,this),e._store=this._store,e},t.prototype.wrapMethod=function(t,e){var n=this[t];xt(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=n.apply(this,arguments);return e.apply(this,[t].concat(Rt(arguments)))})},t.internalField=(dx=function(t){var e=t._invertedIndicesMap;ct(e,(function(n,i){var r=t._dimInfos[i],o=r.ordinalMeta,a=t._store;if(o){n=e[i]=new bx(o.categories.length);for(var s=0;s1&&(s+="__ec__"+u),i[e]=s}})),t}();const Cx=Mx;function Lx(t,e){return Ax(t,e).dimensions}function Ax(t,e){ef(t)||(t=rf(t));var n=(e=e||{}).coordDimensions||[],i=e.dimensionsDefine||t.dimensionsDefine||[],r=jt(),o=[],a=function(t,e,n,i){var r=Math.max(t.dimensionsDetectedCount||1,e.length,n.length,i||0);return ct(e,(function(t){var e;Tt(t)&&(e=t.dimsDef)&&(r=Math.max(r,e.length))})),r}(t,n,i,e.dimensionsCount),s=e.canOmitUnusedDimensions&&cx(a),l=i===t.dimensionsDefine,u=l?hx(t):ux(i),h=e.encodeDefine;!h&&e.encodeDefaulter&&(h=e.encodeDefaulter(t,a));for(var c=jt(h),d=new Wf(a),f=0;f0&&(i.name=r+(o-1)),o++,e.set(r,o)}}(o),new sx({source:t,dimensions:o,fullDimensionCount:a,dimensionOmitted:s})}function Dx(t,e,n){if(n||e.hasKey(t)){for(var i=0;e.hasKey(t+i);)i++;t+=i}return e.set(t,!0),t}var Ix=function(t){this.coordSysDims=[],this.axisMap=jt(),this.categoryAxisMap=jt(),this.coordSysName=t};var Px={cartesian2d:function(t,e,n,i){var r=t.getReferringComponents("xAxis",ka).models[0],o=t.getReferringComponents("yAxis",ka).models[0];e.coordSysDims=["x","y"],n.set("x",r),n.set("y",o),Ex(r)&&(i.set("x",r),e.firstCategoryDimIndex=0),Ex(o)&&(i.set("y",o),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,n,i){var r=t.getReferringComponents("singleAxis",ka).models[0];e.coordSysDims=["single"],n.set("single",r),Ex(r)&&(i.set("single",r),e.firstCategoryDimIndex=0)},polar:function(t,e,n,i){var r=t.getReferringComponents("polar",ka).models[0],o=r.findAxisModel("radiusAxis"),a=r.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],n.set("radius",o),n.set("angle",a),Ex(o)&&(i.set("radius",o),e.firstCategoryDimIndex=0),Ex(a)&&(i.set("angle",a),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},geo:function(t,e,n,i){e.coordSysDims=["lng","lat"]},parallel:function(t,e,n,i){var r=t.ecModel,o=r.getComponent("parallel",t.get("parallelIndex")),a=e.coordSysDims=o.dimensions.slice();ct(o.parallelAxisIndex,(function(t,o){var s=r.getComponent("parallelAxis",t),l=a[o];n.set(l,s),Ex(s)&&(i.set(l,s),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=o))}))}};function Ex(t){return"category"===t.get("type")}function Ox(t,e,n){var i,r,o,a=(n=n||{}).byIndex,s=n.stackedCoordDimension;!function(t){return!lx(t.schema)}(e)?(r=e.schema,i=r.dimensions,o=e.store):i=e;var l,u,h,c,d=!(!t||!t.get("stack"));if(ct(i,(function(t,e){wt(t)&&(i[e]=t={name:t}),d&&!t.isExtraCoord&&(a||l||!t.ordinalMeta||(l=t),u||"ordinal"===t.type||"time"===t.type||s&&s!==t.coordDim||(u=t))})),!u||a||l||(a=!0),u){h="__\0ecstackresult_"+t.id,c="__\0ecstackedover_"+t.id,l&&(l.createInvertedIndices=!0);var f=u.coordDim,p=u.type,g=0;ct(i,(function(t){t.coordDim===f&&g++}));var m={name:h,coordDim:f,coordDimIndex:g,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},v={name:c,coordDim:c,coordDimIndex:g+1,type:p,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};r?(o&&(m.storeDimIndex=o.ensureCalculationDimension(c,p),v.storeDimIndex=o.ensureCalculationDimension(h,p)),r.appendCalculationDimension(m),r.appendCalculationDimension(v)):(i.push(m),i.push(v))}return{stackedDimension:u&&u.name,stackedByDimension:l&&l.name,isStackedByIndex:a,stackedOverDimension:c,stackResultDimension:h}}function Nx(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function Rx(t,e){return Nx(t,e)?t.getCalculationInfo("stackResultDimension"):e}const kx=function(t,e,n){n=n||{};var i,r=e.getSourceManager(),o=!1;t?(o=!0,i=rf(t)):o=(i=r.getSource()).sourceFormat===Zc;var a=function(t){var e=t.get("coordinateSystem"),n=new Ix(e),i=Px[e];if(i)return i(t,n,n.axisMap,n.categoryAxisMap),n}(e),s=function(t,e){var n,i=t.get("coordinateSystem"),r=Sd.get(i);return e&&e.coordSysDims&&(n=dt(e.coordSysDims,(function(t){var n={name:t},i=e.axisMap.get(t);if(i){var r=i.get("type");n.type=function(t){return"category"===t?"ordinal":"time"===t?"time":"float"}(r)}return n}))),n||(n=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||["x","y"]),n}(e,a),l=n.useEncodeDefaulter,u=xt(l)?l:l?_t(nd,s,e):null,h=Ax(i,{coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!o}),c=function(t,e,n){var i,r;return n&&ct(t,(function(t,o){var a=t.coordDim,s=n.categoryAxisMap.get(a);s&&(null==i&&(i=o),t.ordinalMeta=s.getOrdinalMeta(),e&&(t.createInvertedIndices=!0)),null!=t.otherDims.itemName&&(r=!0)})),r||null==i||(t[i].otherDims.itemName=0),i}(h.dimensions,n.createInvertedIndices,a),d=o?null:r.getSharedDataStore(h),f=Ox(e,{schema:h,store:d}),p=new Cx(h,e);p.setCalculationInfo(f);var g=null!=c&&function(t){if(t.sourceFormat===Zc){return!yt(Sa(function(t){var e=0;for(;ee[1]&&(e[1]=t[1])},t.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=t),isNaN(e)||(n[1]=e)},t.prototype.isInExtentRange=function(t){return this._extent[0]<=t&&this._extent[1]>=t},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(t){this._isBlank=t},t}();qa(zx);const Bx=zx;var Fx=0;function Vx(t){return Tt(t)&&null!=t.value?t.value:t+""}const Gx=function(){function t(t){this.categories=t.categories||[],this._needCollect=t.needCollect,this._deduplication=t.deduplication,this.uid=++Fx}return t.createByAxisModel=function(e){var n=e.option,i=n.data,r=i&&dt(i,Vx);return new t({categories:r,needCollect:!r,deduplication:!1!==n.dedplication})},t.prototype.getOrdinal=function(t){return this._getOrCreateMap().get(t)},t.prototype.parseAndCollect=function(t){var e,n=this._needCollect;if(!wt(t)&&!n)return t;if(n&&!this._deduplication)return e=this.categories.length,this.categories[e]=t,e;var i=this._getOrCreateMap();return null==(e=i.get(t))&&(n?(e=this.categories.length,this.categories[e]=t,i.set(t,e)):e=NaN),e},t.prototype._getOrCreateMap=function(){return this._map||(this._map=jt(this.categories))},t}();function Hx(t){return"interval"===t.type||"log"===t.type}function Ux(t,e,n,i){var r={},o=t[1]-t[0],a=r.interval=ua(o/e,!0);null!=n&&ai&&(a=r.interval=i);var s=r.intervalPrecision=jx(a);return function(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),Zx(t,0,e),Zx(t,1,e),t[0]>t[1]&&(t[0]=t[1])}(r.niceTickExtent=[Yo(Math.ceil(t[0]/a)*a,s),Yo(Math.floor(t[1]/a)*a,s)],t),r}function Wx(t){var e=Math.pow(10,la(t)),n=t/e;return n?2===n?n=3:3===n?n=5:n*=2:n=1,Yo(n*e)}function jx(t){return Jo(t)+2}function Zx(t,e,n){t[e]=Math.max(Math.min(t[e],n[1]),n[0])}function Xx(t,e){return t>=e[0]&&t<=e[1]}function qx(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function Yx(t,e){return t*(e[1]-e[0])+e[0]}var Kx=function(t){function e(e){var n=t.call(this,e)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new Gx({})),yt(i)&&(i=new Gx({categories:dt(i,(function(t){return Tt(t)?t.value:t}))})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return I(e,t),e.prototype.parse=function(t){return null==t?NaN:wt(t)?this._ordinalMeta.getOrdinal(t):Math.round(t)},e.prototype.contain=function(t){return Xx(t=this.parse(t),this._extent)&&null!=this._ordinalMeta.categories[t]},e.prototype.normalize=function(t){return qx(t=this._getTickNumber(this.parse(t)),this._extent)},e.prototype.scale=function(t){return t=Math.round(Yx(t,this._extent)),this.getRawOrdinalNumber(t)},e.prototype.getTicks=function(){for(var t=[],e=this._extent,n=e[0];n<=e[1];)t.push({value:n}),n++;return t},e.prototype.getMinorTicks=function(t){},e.prototype.setSortInfo=function(t){if(null!=t){for(var e=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],r=0,o=this._ordinalMeta.categories.length,a=Math.min(o,e.length);r=0&&t=0&&t=t},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e}(Bx);Bx.registerClass(Kx);const Jx=Kx;var Qx=Yo,$x=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="interval",e._interval=0,e._intervalPrecision=2,e}return I(e,t),e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return Xx(t,this._extent)},e.prototype.normalize=function(t){return qx(t,this._extent)},e.prototype.scale=function(t){return Yx(t,this._extent)},e.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=parseFloat(t)),isNaN(e)||(n[1]=parseFloat(e))},e.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),this.setExtent(e[0],e[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=jx(t)},e.prototype.getTicks=function(t){var e=this._interval,n=this._extent,i=this._niceExtent,r=this._intervalPrecision,o=[];if(!e)return o;n[0]1e4)return[];var s=o.length?o[o.length-1].value:i[1];return n[1]>s&&(t?o.push({value:Qx(s+e,r)}):o.push({value:n[1]})),o},e.prototype.getMinorTicks=function(t){for(var e=this.getTicks(!0),n=[],i=this.getExtent(),r=1;ri[0]&&h0&&(o=null===o?s:Math.min(o,s))}n[i]=o}}return n}(t),n=[];return ct(t,(function(t){var i,r=t.coordinateSystem.getBaseAxis(),o=r.getExtent();if("category"===r.type)i=r.getBandWidth();else if("value"===r.type||"time"===r.type){var a=r.dim+"_"+r.index,s=e[a],l=Math.abs(o[1]-o[0]),u=r.scale.getExtent(),h=Math.abs(u[1]-u[0]);i=s?l/h*s:l}else{var c=t.getData();i=Math.abs(o[1]-o[0])/c.count()}var d=qo(t.get("barWidth"),i),f=qo(t.get("barMaxWidth"),i),p=qo(t.get("barMinWidth")||(lw(t)?.5:1),i),g=t.get("barGap"),m=t.get("barCategoryGap");n.push({bandWidth:i,barWidth:d,barMaxWidth:f,barMinWidth:p,barGap:g,barCategoryGap:m,axisKey:iw(r),stackId:nw(t)})})),aw(n)}function aw(t){var e={};ct(t,(function(t,n){var i=t.axisKey,r=t.bandWidth,o=e[i]||{bandWidth:r,remainedWidth:r,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},a=o.stacks;e[i]=o;var s=t.stackId;a[s]||o.autoWidthCount++,a[s]=a[s]||{width:0,maxWidth:0};var l=t.barWidth;l&&!a[s].width&&(a[s].width=l,l=Math.min(o.remainedWidth,l),o.remainedWidth-=l);var u=t.barMaxWidth;u&&(a[s].maxWidth=u);var h=t.barMinWidth;h&&(a[s].minWidth=h);var c=t.barGap;null!=c&&(o.gap=c);var d=t.barCategoryGap;null!=d&&(o.categoryGap=d)}));var n={};return ct(e,(function(t,e){n[e]={};var i=t.stacks,r=t.bandWidth,o=t.categoryGap;if(null==o){var a=mt(i).length;o=Math.max(35-4*a,15)+"%"}var s=qo(o,r),l=qo(t.gap,1),u=t.remainedWidth,h=t.autoWidthCount,c=(u-s)/(h+(h-1)*l);c=Math.max(c,0),ct(i,(function(t){var e=t.maxWidth,n=t.minWidth;if(t.width){i=t.width;e&&(i=Math.min(i,e)),n&&(i=Math.max(i,n)),t.width=i,u-=i+l*i,h--}else{var i=c;e&&ei&&(i=n),i!==c&&(t.width=i,u-=i+l*i,h--)}})),c=(u-s)/(h+(h-1)*l),c=Math.max(c,0);var d,f=0;ct(i,(function(t,e){t.width||(t.width=c),d=t,f+=t.width*(1+l)})),d&&(f-=d.width*l);var p=-f/2;ct(i,(function(t,i){n[e][i]=n[e][i]||{bandWidth:r,offset:p,width:t.width},p+=t.width*(1+l)}))})),n}function sw(t){return t.coordinateSystem&&"cartesian2d"===t.coordinateSystem.type}function lw(t){return t.pipelineContext&&t.pipelineContext.large}var uw=function(t){function e(e){var n=t.call(this,e)||this;return n.type="time",n}return I(e,t),e.prototype.getLabel=function(t){var e=this.getSetting("useUTC");return $h(t.value,Xh[function(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}(Jh(this._minLevelUnit))]||Xh.second,e,this.getSetting("locale"))},e.prototype.getFormattedLabel=function(t,e,n){var i=this.getSetting("useUTC");return function(t,e,n,i,r){var o=null;if(wt(n))o=n;else if(xt(n))o=n(t.value,e,{level:t.level});else{var a=rt({},jh);if(t.level>0)for(var s=0;s=0;--s)if(l[u]){o=l[u];break}o=o||a.none}if(yt(o)){var h=null==t.level?0:t.level>=0?t.level:o.length+t.level;o=o[h=Math.min(h,o.length-1)]}}return $h(new Date(t.value),o,r,i)}(t,e,n,this.getSetting("locale"),i)},e.prototype.getTicks=function(){var t=this._interval,e=this._extent,n=[];if(!t)return n;n.push({value:e[0],level:0});var i=this.getSetting("useUTC"),r=function(t,e,n,i){var r=1e4,o=Yh,a=0;function s(t,e,n,r,o,a,s){for(var l=new Date(e),u=e,h=l[r]();u1&&0===u&&o.unshift({value:o[0].value-d})}}for(u=0;u=i[0]&&v<=i[1]&&c++)}var _=(i[1]-i[0])/e;if(c>1.5*_&&d>_/1.5)break;if(u.push(g),c>_||t===o[f])break}h=[]}}0;var y=pt(dt(u,(function(t){return pt(t,(function(t){return t.value>=i[0]&&t.value<=i[1]&&!t.notAdd}))})),(function(t){return t.length>0})),x=[],w=y.length-1;for(f=0;fn&&(this._approxInterval=n);var o=hw.length,a=Math.min(function(t,e,n,i){for(;n>>1;t[r][1]16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function dw(t){return(t/=2592e6)>6?6:t>3?3:t>2?2:1}function fw(t){return(t/=Hh)>12?12:t>6?6:t>3.5?4:t>2?2:1}function pw(t,e){return(t/=e?Gh:Vh)>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function gw(t){return ua(t,!0)}function mw(t,e,n){var i=new Date(t);switch(Jh(e)){case"year":case"month":i[hc(n)](0);case"day":i[cc(n)](1);case"hour":i[dc(n)](0);case"minute":i[fc(n)](0);case"second":i[pc(n)](0),i[gc(n)](0)}return i.getTime()}Bx.registerClass(uw);const vw=uw;var _w=Bx.prototype,yw=tw.prototype,xw=Yo,ww=Math.floor,bw=Math.ceil,Sw=Math.pow,Tw=Math.log,Mw=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e.base=10,e._originalScale=new tw,e._interval=0,e}return I(e,t),e.prototype.getTicks=function(t){var e=this._originalScale,n=this._extent,i=e.getExtent();return dt(yw.getTicks.call(this,t),(function(t){var e=t.value,r=Yo(Sw(this.base,e));return r=e===n[0]&&this._fixMin?Lw(r,i[0]):r,{value:r=e===n[1]&&this._fixMax?Lw(r,i[1]):r}}),this)},e.prototype.setExtent=function(t,e){var n=Tw(this.base);t=Tw(Math.max(0,t))/n,e=Tw(Math.max(0,e))/n,yw.setExtent.call(this,t,e)},e.prototype.getExtent=function(){var t=this.base,e=_w.getExtent.call(this);e[0]=Sw(t,e[0]),e[1]=Sw(t,e[1]);var n=this._originalScale.getExtent();return this._fixMin&&(e[0]=Lw(e[0],n[0])),this._fixMax&&(e[1]=Lw(e[1],n[1])),e},e.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=Tw(t[0])/Tw(e),t[1]=Tw(t[1])/Tw(e),_w.unionExtent.call(this,t)},e.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},e.prototype.calcNiceTicks=function(t){t=t||10;var e=this._extent,n=e[1]-e[0];if(!(n===1/0||n<=0)){var i=sa(n);for(t/n*i<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var r=[Yo(bw(e[0]/i)*i),Yo(ww(e[1]/i)*i)];this._interval=i,this._niceExtent=r}},e.prototype.calcNiceExtent=function(t){yw.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return Xx(t=Tw(t)/Tw(this.base),this._extent)},e.prototype.normalize=function(t){return qx(t=Tw(t)/Tw(this.base),this._extent)},e.prototype.scale=function(t){return t=Yx(t,this._extent),Sw(this.base,t)},e.type="log",e}(Bx),Cw=Mw.prototype;function Lw(t,e){return xw(t,Jo(e))}Cw.getMinorTicks=yw.getMinorTicks,Cw.getLabel=yw.getLabel,Bx.registerClass(Mw);const Aw=Mw;var Dw=function(){function t(t,e,n){this._prepareParams(t,e,n)}return t.prototype._prepareParams=function(t,e,n){n[1]0&&s>0&&!l&&(a=0),a<0&&s<0&&!u&&(s=0));var c=this._determinedMin,d=this._determinedMax;return null!=c&&(a=c,l=!0),null!=d&&(s=d,u=!0),{min:a,max:s,minFixed:l,maxFixed:u,isBlank:h}},t.prototype.modifyDataMinMax=function(t,e){this[Pw[t]]=e},t.prototype.setDeterminedMinMax=function(t,e){this[Iw[t]]=e},t.prototype.freeze=function(){this.frozen=!0},t}(),Iw={min:"_determinedMin",max:"_determinedMax"},Pw={min:"_dataMin",max:"_dataMax"};function Ew(t,e,n){var i=t.rawExtentInfo;return i||(i=new Dw(t,e,n),t.rawExtentInfo=i,i)}function Ow(t,e){return null==e?null:Pt(e)?NaN:t.parse(e)}function Nw(t,e){var n=t.type,i=Ew(t,e,t.getExtent()).calculate();t.setBlank(i.isBlank);var r=i.min,o=i.max,a=e.ecModel;if(a&&"time"===n){var s=rw("bar",a),l=!1;if(ct(s,(function(t){l=l||t.getBaseAxis()===e.axis})),l){var u=ow(s),h=function(t,e,n,i){var r=n.axis.getExtent(),o=Math.abs(r[1]-r[0]),a=function(t,e,n){if(t&&e){var i=t[iw(e)];return null!=i&&null!=n?i[nw(n)]:i}}(i,n.axis);if(void 0===a)return{min:t,max:e};var s=1/0;ct(a,(function(t){s=Math.min(t.offset,s)}));var l=-1/0;ct(a,(function(t){l=Math.max(t.offset+t.width,l)})),s=Math.abs(s),l=Math.abs(l);var u=s+l,h=e-t,c=h/(1-(s+l)/o)-h;return e+=c*(l/u),t-=c*(s/u),{min:t,max:e}}(r,o,e,u);r=h.min,o=h.max}}return{extent:[r,o],fixMin:i.minFixed,fixMax:i.maxFixed}}function Rw(t,e){var n=e,i=Nw(t,n),r=i.extent,o=n.get("splitNumber");t instanceof Aw&&(t.base=n.get("logBase"));var a=t.type,s=n.get("interval"),l="interval"===a||"time"===a;t.setExtent(r[0],r[1]),t.calcNiceExtent({splitNumber:o,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?n.get("minInterval"):null,maxInterval:l?n.get("maxInterval"):null}),null!=s&&t.setInterval&&t.setInterval(s)}function kw(t,e){if(e=e||t.get("type"))switch(e){case"category":return new Jx({ordinalMeta:t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),extent:[1/0,-1/0]});case"time":return new vw({locale:t.ecModel.getLocaleModel(),useUTC:t.ecModel.get("useUTC")});default:return new(Bx.getClass(e)||tw)}}function zw(t){var e,n,i=t.getLabelModel().get("formatter"),r="category"===t.type?t.scale.getExtent()[0]:null;return"time"===t.scale.type?(n=i,function(e,i){return t.scale.getFormattedLabel(e,i,n)}):wt(i)?function(e){return function(n){var i=t.scale.getLabel(n);return e.replace("{value}",null!=i?i:"")}}(i):xt(i)?(e=i,function(n,i){return null!=r&&(i=n.value-r),e(Bw(t,n),i,null!=n.level?{level:n.level}:null)}):function(e){return t.scale.getLabel(e)}}function Bw(t,e){return"category"===t.type?t.scale.getLabel(e):e.value}function Fw(t,e){var n=e*Math.PI/180,i=t.width,r=t.height,o=i*Math.abs(Math.cos(n))+Math.abs(r*Math.sin(n)),a=i*Math.abs(Math.sin(n))+Math.abs(r*Math.cos(n));return new _n(t.x,t.y,o,a)}function Vw(t){var e=t.get("interval");return null==e?"auto":e}function Gw(t){return"category"===t.type&&0===Vw(t.getLabelModel())}function Hw(t,e){var n={};return ct(t.mapDimensionsAll(e),(function(e){n[Rx(t,e)]=!0})),mt(n)}var Uw=function(){function t(){}return t.prototype.getNeedCrossZero=function(){return!this.option.scale},t.prototype.getCoordSysModel=function(){},t}();function Ww(t){return kx(null,t)}var jw={isDimensionStacked:Nx,enableDataStack:Ox,getStackedDimension:Rx};function Zw(t,e){var n=e;e instanceof Ih||(n=new Ih(e));var i=kw(n);return i.setExtent(t[0],t[1]),Rw(i,n),i}function Xw(t){ut(t,Uw)}function qw(t,e){return lh(t,null,null,"normal"!==(e=e||{}).state)}var Yw=[],Kw={registerPreprocessor:Ry,registerProcessor:ky,registerPostInit:zy,registerPostUpdate:By,registerUpdateLifecycle:Fy,registerAction:Vy,registerCoordinateSystem:Gy,registerLayout:Uy,registerVisual:Wy,registerTransform:Jy,registerLoading:Xy,registerMap:Yy,registerImpl:function(t,e){L_[t]=e},PRIORITY:k_,ComponentModel:Gc,ComponentView:Dp,SeriesModel:Lp,ChartView:Fm,registerComponentModel:function(t){Gc.registerClass(t)},registerComponentView:function(t){Dp.registerClass(t)},registerSeriesModel:function(t){Lp.registerClass(t)},registerChartView:function(t){Fm.registerClass(t)},registerSubTypeDefaulter:function(t,e){Gc.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){Go(t,e)}};function Jw(t){yt(t)?ct(t,(function(t){Jw(t)})):st(Yw,t)>=0||(Yw.push(t),xt(t)&&(t={install:t}),t.install(Kw))}function Qw(t,e){return Math.abs(t-e)<1e-8}function $w(t,e,n){var i=0,r=t[0];if(!r)return!1;for(var o=1;on&&(t=r,n=a)}if(t)return function(t){for(var e=0,n=0,i=0,r=t.length,o=t[r-1][0],a=t[r-1][1],s=0;s>1^-(1&s),l=l>>1^-(1&l),r=s+=r,o=l+=o,i.push([s/n,l/n])}return i}function ub(t,e){return dt(pt((t=function(t){if(!t.UTF8Encoding)return t;var e=t,n=e.UTF8Scale;return null==n&&(n=1024),ct(e.features,(function(t){var e=t.geometry,i=e.encodeOffsets,r=e.coordinates;if(i)switch(e.type){case"LineString":e.coordinates=lb(r,i,n);break;case"Polygon":case"MultiLineString":sb(r,i,n);break;case"MultiPolygon":ct(r,(function(t,e){return sb(t,i[e],n)}))}})),e.UTF8Encoding=!1,e}(t)).features,(function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0})),(function(t){var n=t.properties,i=t.geometry,r=[];switch(i.type){case"Polygon":var o=i.coordinates;r.push(new rb(o[0],o.slice(1)));break;case"MultiPolygon":ct(i.coordinates,(function(t){t[0]&&r.push(new rb(t[0],t.slice(1)))}));break;case"LineString":r.push(new ob([i.coordinates]));break;case"MultiLineString":r.push(new ob(i.coordinates))}var a=new ab(n[e||"name"],r,n.cp);return a.properties=n,a}))}function hb(t,e,n,i,r,o,a,s){return new eu({style:{text:t,font:e,align:n,verticalAlign:i,padding:r,rich:o,overflow:a?"truncate":null,lineHeight:s}}).getBoundingRect()}var cb=Ea();function db(t,e){var n=dt(e,(function(e){return t.scale.parse(e)}));return"time"===t.type&&n.length>0&&(n.sort(),n.unshift(n[0]),n.push(n[n.length-1])),n}function fb(t){var e=t.getLabelModel().get("customValues");if(e){var n=zw(t),i=t.scale.getExtent();return{labels:dt(pt(db(t,e),(function(t){return t>=i[0]&&t<=i[1]})),(function(e){var i={value:e};return{formattedLabel:n(i),rawLabel:t.scale.getLabel(i),tickValue:e}}))}}return"category"===t.type?function(t){var e=t.getLabelModel(),n=gb(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(t):function(t){var e=t.scale.getTicks(),n=zw(t);return{labels:dt(e,(function(e,i){return{level:e.level,formattedLabel:n(e,i),rawLabel:t.scale.getLabel(e),tickValue:e.value}}))}}(t)}function pb(t,e){var n=t.getTickModel().get("customValues");if(n){var i=t.scale.getExtent();return{ticks:pt(db(t,n),(function(t){return t>=i[0]&&t<=i[1]}))}}return"category"===t.type?function(t,e){var n,i,r=mb(t,"ticks"),o=Vw(e),a=vb(r,o);if(a)return a;e.get("show")&&!t.scale.isBlank()||(n=[]);if(xt(o))n=xb(t,o,!0);else if("auto"===o){var s=gb(t,t.getLabelModel());i=s.labelCategoryInterval,n=dt(s.labels,(function(t){return t.tickValue}))}else n=yb(t,i=o,!0);return _b(r,o,{ticks:n,tickCategoryInterval:i})}(t,e):{ticks:dt(t.scale.getTicks(),(function(t){return t.value}))}}function gb(t,e){var n,i,r=mb(t,"labels"),o=Vw(e),a=vb(r,o);return a||(xt(o)?n=xb(t,o):(i="auto"===o?function(t){var e=cb(t).autoInterval;return null!=e?e:cb(t).autoInterval=t.calculateCategoryInterval()}(t):o,n=yb(t,i)),_b(r,o,{labels:n,labelCategoryInterval:i}))}function mb(t,e){return cb(t)[e]||(cb(t)[e]=[])}function vb(t,e){for(var n=0;n1&&h/l>2&&(u=Math.round(Math.ceil(u/l)*l));var c=Gw(t),d=a.get("showMinLabel")||c,f=a.get("showMaxLabel")||c;d&&u!==o[0]&&g(o[0]);for(var p=u;p<=o[1];p+=l)g(p);function g(t){var e={value:t};s.push(n?t:{formattedLabel:i(e),rawLabel:r.getLabel(e),tickValue:t})}return f&&p-l!==o[1]&&g(o[1]),s}function xb(t,e,n){var i=t.scale,r=zw(t),o=[];return ct(i.getTicks(),(function(t){var a=i.getLabel(t),s=t.value;e(t.value,a)&&o.push(n?s:{formattedLabel:r(t),rawLabel:a,tickValue:s})})),o}var wb=[0,1],bb=function(){function t(t,e,n){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=e,this._extent=n||[0,0]}return t.prototype.contain=function(t){var e=this._extent,n=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]);return t>=n&&t<=i},t.prototype.containData=function(t){return this.scale.contain(t)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(t){return $o(t||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(t,e){var n=this._extent;n[0]=t,n[1]=e},t.prototype.dataToCoord=function(t,e){var n=this._extent,i=this.scale;return t=i.normalize(t),this.onBand&&"ordinal"===i.type&&Sb(n=n.slice(),i.count()),Xo(t,wb,n,e)},t.prototype.coordToData=function(t,e){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&Sb(n=n.slice(),i.count());var r=Xo(t,n,wb,e);return this.scale.scale(r)},t.prototype.pointToData=function(t,e){},t.prototype.getTicksCoords=function(t){var e=(t=t||{}).tickModel||this.getTickModel(),n=dt(pb(this,e).ticks,(function(t){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(t):t),tickValue:t}}),this);return function(t,e,n,i){var r=e.length;if(!t.onBand||n||!r)return;var o,a,s=t.getExtent();if(1===r)e[0].coord=s[0],o=e[1]={coord:s[1],tickValue:e[0].tickValue};else{var l=e[r-1].tickValue-e[0].tickValue,u=(e[r-1].coord-e[0].coord)/l;ct(e,(function(t){t.coord-=u/2}));var h=t.scale.getExtent();a=1+h[1]-e[r-1].tickValue,o={coord:e[r-1].coord+u*a,tickValue:h[1]+1},e.push(o)}var c=s[0]>s[1];d(e[0].coord,s[0])&&(i?e[0].coord=s[0]:e.shift());i&&d(s[0],e[0].coord)&&e.unshift({coord:s[0]});d(s[1],o.coord)&&(i?o.coord=s[1]:e.pop());i&&d(o.coord,s[1])&&e.push({coord:s[1]});function d(t,e){return t=Yo(t),e=Yo(e),c?t>e:t0&&t<100||(t=5),dt(this.scale.getMinorTicks(t),(function(t){return dt(t,(function(t){return{coord:this.dataToCoord(t),tickValue:t}}),this)}),this)},t.prototype.getViewLabels=function(){return fb(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var t=this._extent,e=this.scale.getExtent(),n=e[1]-e[0]+(this.onBand?1:0);0===n&&(n=1);var i=Math.abs(t[1]-t[0]);return Math.abs(i)/n},t.prototype.calculateCategoryInterval=function(){return function(t){var e=function(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}(t),n=zw(t),i=(e.axisRotate-e.labelRotate)/180*Math.PI,r=t.scale,o=r.getExtent(),a=r.count();if(o[1]-o[0]<1)return 0;var s=1;a>40&&(s=Math.max(1,Math.floor(a/40)));for(var l=o[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),h=Math.abs(u*Math.cos(i)),c=Math.abs(u*Math.sin(i)),d=0,f=0;l<=o[1];l+=s){var p,g,m=po(n({value:l}),e.font,"center","top");p=1.3*m.width,g=1.3*m.height,d=Math.max(d,p,7),f=Math.max(f,g,7)}var v=d/h,_=f/c;isNaN(v)&&(v=1/0),isNaN(_)&&(_=1/0);var y=Math.max(0,Math.floor(Math.min(v,_))),x=cb(t.model),w=t.getExtent(),b=x.lastAutoInterval,S=x.lastTickCount;return null!=b&&null!=S&&Math.abs(b-y)<=1&&Math.abs(S-a)<=1&&b>y&&x.axisExtent0===w[0]&&x.axisExtent1===w[1]?y=b:(x.lastTickCount=a,x.lastAutoInterval=y,x.axisExtent0=w[0],x.axisExtent1=w[1]),y}(this)},t}();function Sb(t,e){var n=(t[1]-t[0])/e/2;t[0]+=n,t[1]-=n}const Tb=bb;function Mb(t){var e=Gc.extend(t);return Gc.registerClass(e),e}function Cb(t){var e=Dp.extend(t);return Dp.registerClass(e),e}function Lb(t){var e=Lp.extend(t);return Lp.registerClass(e),e}function Ab(t){var e=Fm.extend(t);return Fm.registerClass(e),e}var Db=2*Math.PI,Ib=il.CMD,Pb=["top","right","bottom","left"];function Eb(t,e,n,i,r){var o=n.width,a=n.height;switch(t){case"top":i.set(n.x+o/2,n.y-e),r.set(0,-1);break;case"bottom":i.set(n.x+o/2,n.y+a+e),r.set(0,1);break;case"left":i.set(n.x-e,n.y+a/2),r.set(-1,0);break;case"right":i.set(n.x+o+e,n.y+a/2),r.set(1,0)}}function Ob(t,e,n,i,r,o,a,s,l){a-=t,s-=e;var u=Math.sqrt(a*a+s*s),h=(a/=u)*n+t,c=(s/=u)*n+e;if(Math.abs(i-r)%Db<1e-4)return l[0]=h,l[1]=c,u-n;if(o){var d=i;i=ll(r),r=ll(d)}else i=ll(i),r=ll(r);i>r&&(r+=Db);var f=Math.atan2(s,a);if(f<0&&(f+=Db),f>=i&&f<=r||f+Db>=i&&f+Db<=r)return l[0]=h,l[1]=c,u-n;var p=n*Math.cos(i)+t,g=n*Math.sin(i)+e,m=n*Math.cos(r)+t,v=n*Math.sin(r)+e,_=(p-a)*(p-a)+(g-s)*(g-s),y=(m-a)*(m-a)+(v-s)*(v-s);return _0))return;e=e/180*Math.PI,Fb.fromArray(t[0]),Vb.fromArray(t[1]),Gb.fromArray(t[2]),ln.sub(Hb,Fb,Vb),ln.sub(Ub,Gb,Vb);var n=Hb.len(),i=Ub.len();if(n<.001||i<.001)return;Hb.scale(1/n),Ub.scale(1/i);var r=Hb.dot(Ub);if(Math.cos(e)1&&ln.copy(Zb,Gb),Zb.toArray(t[1])}}(o,e.get("minTurnAngle")),n.setShape({points:o})}}}var jb=[],Zb=new ln;function Xb(t,e,n,i){var r="normal"===n,o=r?t:t.ensureState(n);o.ignore=e;var a=i.get("smooth");a&&!0===a&&(a=.3),o.shape=o.shape||{},a>0&&(o.shape.smooth=a);var s=i.getModel("lineStyle").getLineStyle();r?t.useStyle(s):o.style=s}function qb(t,e){var n=e.smooth,i=e.points;if(i)if(t.moveTo(i[0][0],i[0][1]),n>0&&i.length>=3){var r=ge(i[0],i[1]),o=ge(i[1],i[2]);if(!r||!o)return t.lineTo(i[1][0],i[1][1]),void t.lineTo(i[2][0],i[2][1]);var a=Math.min(r,o)*n,s=ye([],i[1],i[0],a/r),l=ye([],i[1],i[2],a/o),u=ye([],s,l,.5);t.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),t.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var h=1;h0&&o&&b(-c/a,0,a);var m,v,_=t[0],y=t[a-1];return x(),m<0&&S(-m,.8),v<0&&S(v,.8),x(),w(m,v,1),w(v,m,-1),x(),m<0&&T(-m),v<0&&T(v),u}function x(){m=_.rect[e]-i,v=r-y.rect[e]-y.rect[n]}function w(t,e,n){if(t<0){var i=Math.min(e,-t);if(i>0){b(i*n,0,a);var r=i+t;r<0&&S(-r*n,1)}else S(-t*n,1)}}function b(n,i,r){0!==n&&(u=!0);for(var o=i;o0)for(l=0;l0;l--){b(-(o[l-1]*c),l,a)}}}function T(t){var e=t<0?-1:1;t=Math.abs(t);for(var n=Math.ceil(t/(a-1)),i=0;i0?b(n,0,i+1):b(-n,a-i-1,a),(t-=n)<=0)return}}function Jb(t){var e=[];t.sort((function(t,e){return e.priority-t.priority}));var n=new _n(0,0,0,0);function i(t){if(!t.ignore){var e=t.ensureState("emphasis");null==e.ignore&&(e.ignore=!1)}t.ignore=!0}for(var r=0;r=0&&n.attr(f.oldLayoutSelect),st(u,"emphasis")>=0&&n.attr(f.oldLayoutEmphasis)),Ju(n,s,e,a)}else if(n.attr(s),!gh(n).valueAnimation){var h=Ot(n.style.opacity,1);n.style.opacity=0,Qu(n,{style:{opacity:h}},e,a)}if(f.oldLayout=s,n.states.select){var c=f.oldLayoutSelect={};rS(c,s,oS),rS(c,n.states.select,oS)}if(n.states.emphasis){var d=f.oldLayoutEmphasis={};rS(d,s,oS),rS(d,n.states.emphasis,oS)}mh(n,a,l,e,e)}if(i&&!i.ignore&&!i.invisible){r=(f=iS(i)).oldLayout;var f,p={points:i.shape.points};r?(i.attr({shape:r}),Ju(i,{shape:p},e)):(i.setShape(p),i.style.strokePercent=0,Qu(i,{style:{strokePercent:1}},e)),f.oldLayout=p}},t}();var sS=Ea();function lS(t){t.registerUpdateLifecycle("series:beforeupdate",(function(t,e,n){var i=sS(e).labelManager;i||(i=sS(e).labelManager=new aS),i.clearLabels()})),t.registerUpdateLifecycle("series:layoutlabels",(function(t,e,n){var i=sS(e).labelManager;n.updatedSeries.forEach((function(t){i.addLabelsOfSeries(e.getViewOfSeriesModel(t))})),i.updateLayoutConfig(e),i.layout(e),i.processLabelsOverall()}))}function uS(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.eachSeriesByType("graph",(function(t){var n=t.getCategoriesData(),i=t.getGraph().data,r=n.mapArray(n.getName);i.filterSelf((function(t){var n=i.getItemModel(t).getShallow("category");if(null!=n){St(n)&&(n=r[n]);for(var o=0;oi&&(i=e);var o=i%2?i+2:i+3;r=[];for(var a=0;a0?+d:1;C.scaleX=this._sizeX*L,C.scaleY=this._sizeY*L,this.setSymbolScale(1),Uu(this,l,u,h)},e.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},e.prototype.fadeOut=function(t,e,n){var i=this.childAt(0),r=nu(this).dataIndex,o=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var a=i.getTextContent();a&&th(a,{style:{opacity:0}},e,{dataIndex:r,removeOpt:o,cb:function(){i.removeTextContent()}})}else i.removeTextContent();th(i,{style:{opacity:0},scaleX:0,scaleY:0},e,{dataIndex:r,cb:t,removeOpt:o})},e.getSymbolSize=function(t,e){return Zv(t.getItemVisual(e,"symbolSize"))},e}(Eo);function FS(t,e){this.parent.drift(t,e)}const VS=BS;function GS(t,e,n,i){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(i.isIgnore&&i.isIgnore(n))&&!(i.clipShape&&!i.clipShape.contain(e[0],e[1]))&&"none"!==t.getItemVisual(n,"symbol")}function HS(t){return null==t||Tt(t)||(t={isIgnore:t}),t||{}}function US(t){var e=t.hostModel,n=e.getModel("emphasis");return{emphasisItemStyle:n.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:n.get("focus"),blurScope:n.get("blurScope"),emphasisDisabled:n.get("disabled"),hoverScale:n.get("scale"),labelStatesModels:sh(e),cursorStyle:e.get("cursor")}}var WS=function(){function t(t){this.group=new Eo,this._SymbolCtor=t||VS}return t.prototype.updateData=function(t,e){this._progressiveEls=null,e=HS(e);var n=this.group,i=t.hostModel,r=this._data,o=this._SymbolCtor,a=e.disableAnimation,s=US(t),l={disableAnimation:a},u=e.getSymbolPoint||function(e){return t.getItemLayout(e)};r||n.removeAll(),t.diff(r).add((function(i){var r=u(i);if(GS(t,r,i,e)){var a=new o(t,i,s,l);a.setPosition(r),t.setItemGraphicEl(i,a),n.add(a)}})).update((function(h,c){var d=r.getItemGraphicEl(c),f=u(h);if(GS(t,f,h,e)){var p=t.getItemVisual(h,"symbol")||"circle",g=d&&d.getSymbolType&&d.getSymbolType();if(!d||g&&g!==p)n.remove(d),(d=new o(t,h,s,l)).setPosition(f);else{d.updateData(t,h,s,l);var m={x:f[0],y:f[1]};a?d.attr(m):Ju(d,m,i)}n.add(d),t.setItemGraphicEl(h,d)}else n.remove(d)})).remove((function(t){var e=r.getItemGraphicEl(t);e&&e.fadeOut((function(){n.remove(e)}),i)})).execute(),this._getSymbolPoint=u,this._data=t},t.prototype.updateLayout=function(){var t=this,e=this._data;e&&e.eachItemGraphicEl((function(e,n){var i=t._getSymbolPoint(n);e.setPosition(i),e.markRedraw()}))},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=US(t),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e,n){function i(t){t.isGroup||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[],n=HS(n);for(var r=t.start;r0&&(_[0]=-_[0],_[1]=-_[1]);var x=v[0]<0?-1:1;if("start"!==i.__position&&"end"!==i.__position){var w=-Math.atan2(v[1],v[0]);u[0].8?"left":h[0]<-.8?"right":"center",d=h[1]>.8?"top":h[1]<-.8?"bottom":"middle";break;case"start":i.x=-h[0]*p+l[0],i.y=-h[1]*g+l[1],c=h[0]>.8?"right":h[0]<-.8?"left":"center",d=h[1]>.8?"bottom":h[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":i.x=p*x+l[0],i.y=l[1]+b,c=v[0]<0?"right":"left",i.originX=-p*x,i.originY=-b;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=y[0],i.y=y[1]+b,c="center",i.originY=-b;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-p*x+u[0],i.y=u[1]+b,c=v[0]>=0?"right":"left",i.originX=p*x,i.originY=-b}i.scaleX=i.scaleY=r,i.setStyle({verticalAlign:i.__verticalAlign||d,align:i.__align||c})}}}function S(t,e){var n=t.__specifiedRotation;if(null==n){var i=a.tangentAt(e);t.attr("rotation",(1===e?-1:1)*Math.PI/2-Math.atan2(i[1],i[0]))}else t.attr("rotation",n)}},e}(Eo);const iT=nT;function rT(t){var e=t.hostModel,n=e.getModel("emphasis");return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:n.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:n.get("disabled"),blurScope:n.get("blurScope"),focus:n.get("focus"),labelStatesModels:sh(e)}}function oT(t){return isNaN(t[0])||isNaN(t[1])}function aT(t){return t&&!oT(t[0])&&!oT(t[1])}const sT=function(){function t(t){this.group=new Eo,this._LineCtor=t||iT}return t.prototype.updateData=function(t){var e=this;this._progressiveEls=null;var n=this,i=n.group,r=n._lineData;n._lineData=t,r||i.removeAll();var o=rT(t);t.diff(r).add((function(n){e._doAdd(t,n,o)})).update((function(n,i){e._doUpdate(r,t,i,n,o)})).remove((function(t){i.remove(r.getItemGraphicEl(t))})).execute()},t.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl((function(e,n){e.updateLayout(t,n)}),this)},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=rT(t),this._lineData=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e){function n(t){t.isGroup||function(t){return t.animators&&t.animators.length>0}(t)||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[];for(var i=t.start;i3?1.4:r>1?1.2:1.1;dT(this,"zoom","zoomOnMouseWheel",t,{scale:i>0?s:1/s,originX:o,originY:a,isAvailableBehavior:null})}if(n){var l=Math.abs(i);dT(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:(i>0?1:-1)*(l>3?.4:l>1?.15:.05),originX:o,originY:a,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(t){uT(this._zr,"globalPan")||dT(this,"zoom",null,t,{scale:t.pinchScale>1?1.1:1/1.1,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})},e}(Le);function dT(t,e,n,i,r){t.pointerChecker&&t.pointerChecker(i,r.originX,r.originY)&&(Ze(i.event),fT(t,e,n,i,r))}function fT(t,e,n,i,r){r.isAvailableBehavior=vt(pT,null,n,i),t.trigger(e,r)}function pT(t,e,n){var i=n[t];return!t||i&&(!wt(i)||e.event[i+"Key"])}const gT=cT;var mT={axisPointer:1,tooltip:1,brush:1};function vT(t,e,n){var i=e.getComponentByElement(t.topTarget),r=i&&i.coordinateSystem;return i&&i!==n&&!mT.hasOwnProperty(i.mainType)&&r&&r.model!==n}var _T=[],yT=[],xT=[],wT=hi,bT=ve,ST=Math.abs;function TT(t,e,n){for(var i,r=t[0],o=t[1],a=t[2],s=1/0,l=n*n,u=.1,h=.1;h<=.9;h+=.1){_T[0]=wT(r[0],o[0],a[0],h),_T[1]=wT(r[1],o[1],a[1],h),(f=ST(bT(_T,e)-l))=0?i+=u:i-=u:p>=0?i-=u:i+=u}return i}function MT(t,e){var n=[],i=fi,r=[[],[],[]],o=[[],[]],a=[];e/=2,t.eachEdge((function(t,s){var l=t.getLayout(),u=t.getVisual("fromSymbol"),h=t.getVisual("toSymbol");l.__original||(l.__original=[te(l[0]),te(l[1])],l[2]&&l.__original.push(te(l[2])));var c=l.__original;if(null!=l[2]){if($t(r[0],c[0]),$t(r[1],c[2]),$t(r[2],c[1]),u&&"none"!==u){var d=TS(t.node1),f=TT(r,c[0],d*e);i(r[0][0],r[1][0],r[2][0],f,n),r[0][0]=n[3],r[1][0]=n[4],i(r[0][1],r[1][1],r[2][1],f,n),r[0][1]=n[3],r[1][1]=n[4]}if(h&&"none"!==h){d=TS(t.node2),f=TT(r,c[1],d*e);i(r[0][0],r[1][0],r[2][0],f,n),r[1][0]=n[1],r[2][0]=n[2],i(r[0][1],r[1][1],r[2][1],f,n),r[1][1]=n[1],r[2][1]=n[2]}$t(l[0],r[0]),$t(l[1],r[2]),$t(l[2],r[1])}else{if($t(o[0],c[0]),$t(o[1],c[1]),re(a,o[1],o[0]),fe(a,a),u&&"none"!==u){d=TS(t.node1);ie(o[0],o[0],a,d*e)}if(h&&"none"!==h){d=TS(t.node2);ie(o[1],o[1],a,-d*e)}$t(l[0],o[0]),$t(l[1],o[1])}}))}function CT(t){return"view"===t.type}var LT=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.init=function(t,e){var n=new jS,i=new sT,r=this.group;this._controller=new gT(e.getZr()),this._controllerHost={target:r},r.add(n.group),r.add(i.group),this._symbolDraw=n,this._lineDraw=i,this._firstRender=!0},e.prototype.render=function(t,e,n){var i=this,r=t.coordinateSystem;this._model=t;var o=this._symbolDraw,a=this._lineDraw,s=this.group;if(CT(r)){var l={x:r.x,y:r.y,scaleX:r.scaleX,scaleY:r.scaleY};this._firstRender?s.attr(l):Ju(s,l,t)}MT(t.getGraph(),SS(t));var u=t.getData();o.updateData(u);var h=t.getEdgeData();a.updateData(h),this._updateNodeAndLinkScale(),this._updateController(t,e,n),clearTimeout(this._layoutTimeout);var c=t.forceLayout,d=t.get(["force","layoutAnimation"]);c&&this._startForceLayoutIteration(c,d);var f=t.get("layout");u.graph.eachNode((function(e){var n=e.dataIndex,r=e.getGraphicEl(),o=e.getModel();if(r){r.off("drag").off("dragend");var a=o.get("draggable");a&&r.on("drag",(function(o){switch(f){case"force":c.warmUp(),!i._layouting&&i._startForceLayoutIteration(c,d),c.setFixed(n),u.setItemLayout(n,[r.x,r.y]);break;case"circular":u.setItemLayout(n,[r.x,r.y]),e.setLayout({fixed:!0},!0),LS(t,"symbolSize",e,[o.offsetX,o.offsetY]),i.updateLayout(t);break;default:u.setItemLayout(n,[r.x,r.y]),wS(t.getGraph(),t),i.updateLayout(t)}})).on("dragend",(function(){c&&c.setUnfixed(n)})),r.setDraggable(a,!!o.get("cursor")),"adjacency"===o.get(["emphasis","focus"])&&(nu(r).focus=e.getAdjacentDataIndices())}})),u.graph.eachEdge((function(t){var e=t.getGraphicEl(),n=t.getModel().get(["emphasis","focus"]);e&&"adjacency"===n&&(nu(e).focus={edge:[t.dataIndex],node:[t.node1.dataIndex,t.node2.dataIndex]})}));var p="circular"===t.get("layout")&&t.get(["circular","rotateLabel"]),g=u.getLayout("cx"),m=u.getLayout("cy");u.graph.eachNode((function(t){DS(t,p,g,m)})),this._firstRender=!1},e.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},e.prototype._startForceLayoutIteration=function(t,e){var n=this;!function i(){t.step((function(t){n.updateLayout(n._model),(n._layouting=!t)&&(e?n._layoutTimeout=setTimeout(i,16):i())}))}()},e.prototype._updateController=function(t,e,n){var i=this,r=this._controller,o=this._controllerHost,a=this.group;r.setPointerChecker((function(e,i,r){var o=a.getBoundingRect();return o.applyTransform(a.transform),o.contain(i,r)&&!vT(e,n,t)})),CT(t.coordinateSystem)?(r.enable(t.get("roam")),o.zoomLimit=t.get("scaleLimit"),o.zoom=t.coordinateSystem.getZoom(),r.off("pan").off("zoom").on("pan",(function(e){!function(t,e,n){var i=t.target;i.x+=e,i.y+=n,i.dirty()}(o,e.dx,e.dy),n.dispatchAction({seriesId:t.id,type:"graphRoam",dx:e.dx,dy:e.dy})})).on("zoom",(function(e){!function(t,e,n,i){var r=t.target,o=t.zoomLimit,a=t.zoom=t.zoom||1;if(a*=e,o){var s=o.min||0,l=o.max||1/0;a=Math.max(Math.min(l,a),s)}var u=a/t.zoom;t.zoom=a,r.x-=(n-r.x)*(u-1),r.y-=(i-r.y)*(u-1),r.scaleX*=u,r.scaleY*=u,r.dirty()}(o,e.scale,e.originX,e.originY),n.dispatchAction({seriesId:t.id,type:"graphRoam",zoom:e.scale,originX:e.originX,originY:e.originY}),i._updateNodeAndLinkScale(),MT(t.getGraph(),SS(t)),i._lineDraw.updateLayout(),n.updateLabelLayout()}))):r.disable()},e.prototype._updateNodeAndLinkScale=function(){var t=this._model,e=t.getData(),n=SS(t);e.eachItemGraphicEl((function(t,e){t&&t.setSymbolScale(n)}))},e.prototype.updateLayout=function(t){MT(t.getGraph(),SS(t)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},e.prototype.remove=function(){clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},e.type="graph",e}(Fm);const AT=LT;function DT(t){return"_EC_"+t}var IT=function(){function t(t){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=t||!1}return t.prototype.isDirected=function(){return this._directed},t.prototype.addNode=function(t,e){t=null==t?""+e:""+t;var n=this._nodesMap;if(!n[DT(t)]){var i=new PT(t,e);return i.hostGraph=this,this.nodes.push(i),n[DT(t)]=i,i}},t.prototype.getNodeByIndex=function(t){var e=this.data.getRawIndex(t);return this.nodes[e]},t.prototype.getNodeById=function(t){return this._nodesMap[DT(t)]},t.prototype.addEdge=function(t,e,n){var i=this._nodesMap,r=this._edgesMap;if(St(t)&&(t=this.nodes[t]),St(e)&&(e=this.nodes[e]),t instanceof PT||(t=i[DT(t)]),e instanceof PT||(e=i[DT(e)]),t&&e){var o=t.id+"-"+e.id,a=new ET(t,e,n);return a.hostGraph=this,this._directed&&(t.outEdges.push(a),e.inEdges.push(a)),t.edges.push(a),t!==e&&e.edges.push(a),this.edges.push(a),r[o]=a,a}},t.prototype.getEdgeByIndex=function(t){var e=this.edgeData.getRawIndex(t);return this.edges[e]},t.prototype.getEdge=function(t,e){t instanceof PT&&(t=t.id),e instanceof PT&&(e=e.id);var n=this._edgesMap;return this._directed?n[t+"-"+e]:n[t+"-"+e]||n[e+"-"+t]},t.prototype.eachNode=function(t,e){for(var n=this.nodes,i=n.length,r=0;r=0&&t.call(e,n[r],r)},t.prototype.eachEdge=function(t,e){for(var n=this.edges,i=n.length,r=0;r=0&&n[r].node1.dataIndex>=0&&n[r].node2.dataIndex>=0&&t.call(e,n[r],r)},t.prototype.breadthFirstTraverse=function(t,e,n,i){if(e instanceof PT||(e=this._nodesMap[DT(e)]),e){for(var r="out"===n?"outEdges":"in"===n?"inEdges":"edges",o=0;o=0&&n.node2.dataIndex>=0}));for(r=0,o=i.length;r=0&&this[t][e].setItemVisual(this.dataIndex,n,i)},getVisual:function(n){return this[t][e].getItemVisual(this.dataIndex,n)},setLayout:function(n,i){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,n,i)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}}ut(PT,OT("hostGraph","data")),ut(ET,OT("hostGraph","edgeData"));const NT=IT;var RT=Ea();function kT(t,e){if(RT(i=this).mainData===i){var n=rt({},RT(this).datas);n[this.dataType]=e,GT(e,n,t)}else HT(e,this.dataType,RT(this).mainData,t);var i;return e}function zT(t,e){return t.struct&&t.struct.update(),e}function BT(t,e){return ct(RT(e).datas,(function(n,i){n!==e&&HT(n.cloneShallow(),i,e,t)})),e}function FT(t){var e=RT(this).mainData;return null==t||null==e?e:RT(e).datas[t]}function VT(){var t=RT(this).mainData;return null==t?[{data:t}]:dt(mt(RT(t).datas),(function(e){return{type:e,data:RT(t).datas[e]}}))}function GT(t,e,n){RT(t).datas={},ct(e,(function(e,i){HT(e,i,t,n)}))}function HT(t,e,n,i){RT(n).datas[e]=t,RT(t).mainData=n,t.dataType=e,i.struct&&(t[i.structAttr]=i.struct,i.struct[i.datasAttr[e]]=t),t.getLinkedData=FT,t.getLinkedDataAll=VT}const UT=function(t){var e=t.mainData,n=t.datas;n||(n={main:e},t.datasAttr={main:"data"}),t.datas=t.mainData=null,GT(e,n,t),ct(n,(function(n){ct(e.TRANSFERABLE_METHODS,(function(e){n.wrapMethod(e,_t(kT,t))}))})),e.wrapMethod("cloneShallow",_t(BT,t)),ct(e.CHANGABLE_METHODS,(function(n){e.wrapMethod(n,_t(zT,t))})),zt(n[e.dataType]===e)};var WT=function(){function t(t,e){this._getDataWithEncodedVisual=t,this._getRawData=e}return t.prototype.getAllNames=function(){var t=this._getRawData();return t.mapArray(t.getName)},t.prototype.containName=function(t){return this._getRawData().indexOfName(t)>=0},t.prototype.indexOfName=function(t){return this._getDataWithEncodedVisual().indexOfName(t)},t.prototype.getItemVisual=function(t,e){return this._getDataWithEncodedVisual().getItemVisual(t,e)},t}();const jT=WT;var ZT=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.hasSymbolVisual=!0,n}return I(e,t),e.prototype.init=function(e){t.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new jT(i,i),this.fillDataTextStyle(e.edges||e.links),this._updateCategoriesData()},e.prototype.mergeOption=function(e){t.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(e.edges||e.links),this._updateCategoriesData()},e.prototype.mergeDefaultAndTheme=function(e){t.prototype.mergeDefaultAndTheme.apply(this,arguments),wa(e,"edgeLabel",["show"])},e.prototype.getInitialData=function(t,e){var n,i=t.edges||t.links||[],r=t.data||t.nodes||[],o=this;if(r&&i){pS(n=this)&&(n.__curvenessList=[],n.__edgeMap={},gS(n));var a=function(t,e,n,i,r){for(var o=new NT(i),a=0;a "+d)),u++)}var f,p=n.get("coordinateSystem");if("cartesian2d"===p||"polar"===p)f=kx(t,n);else{var g=Sd.get(p),m=g&&g.dimensions||[];st(m,"value")<0&&m.concat(["value"]);var v=Ax(t,{coordDimensions:m,encodeDefine:n.getEncode()}).dimensions;(f=new Cx(v,n)).initData(t)}var _=new Cx(["value"],n);return _.initData(l,s),r&&r(f,_),UT({mainData:f,struct:o,structAttr:"graph",datas:{node:f,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),o.update(),o}(r,i,this,!0,(function(t,e){t.wrapMethod("getItemModel",(function(t){var e=o._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t}));var n=Ih.prototype.getModel;function i(t,e){var i=n.call(this,t,e);return i.resolveParentPath=r,i}function r(t){if(t&&("label"===t[0]||"label"===t[1])){var e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}e.wrapMethod("getItemModel",(function(t){return t.resolveParentPath=r,t.getModel=i,t}))}));return ct(a.edges,(function(t){!function(t,e,n,i){if(pS(n)){var r=mS(t,e,n),o=n.__edgeMap,a=o[vS(r)];o[r]&&!a?o[r].isForward=!0:a&&o[r]&&(a.isForward=!0,o[r].isForward=!1),o[r]=o[r]||[],o[r].push(i)}}(t.node1,t.node2,this,t.dataIndex)}),this),a.data}},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.getCategoriesData=function(){return this._categoriesData},e.prototype.formatTooltip=function(t,e,n){if("edge"===n){var i=this.getData(),r=this.getDataParams(t,n),o=i.graph.getEdgeByIndex(t),a=i.getName(o.node1.dataIndex),s=i.getName(o.node2.dataIndex),l=[];return null!=a&&l.push(a),null!=s&&l.push(s),op("nameValue",{name:l.join(" > "),value:r.value,noValue:null==r.value})}return mp({series:this,dataIndex:t,multipleSeries:e})},e.prototype._updateCategoriesData=function(){var t=dt(this.option.categories||[],(function(t){return null!=t.value?t:rt({value:0},t)})),e=new Cx(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray((function(t){return e.getItemModel(t)}))},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.isAnimationEnabled=function(){return t.prototype.isAnimationEnabled.call(this)&&!("force"===this.get("layout")&&this.get(["force","layoutAnimation"]))},e.type="series.graph",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(Lp);const XT=ZT;function qT(t,e){return t.pointToProjected?t.pointToProjected(e):t.pointToData(e)}var YT={type:"graphRoam",event:"graphRoam",update:"none"};function KT(t,e){var n=e.rippleEffectColor||e.color;t.eachChild((function(t){t.attr({z:e.z,zlevel:e.zlevel,style:{stroke:"stroke"===e.brushType?n:null,fill:"fill"===e.brushType?n:null}})}))}var JT=function(t){function e(e,n){var i=t.call(this)||this,r=new VS(e,n),o=new Eo;return i.add(r),i.add(o),i.updateData(e,n),i}return I(e,t),e.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},e.prototype.startEffectAnimation=function(t){for(var e=t.symbolType,n=t.color,i=t.rippleNumber,r=this.childAt(1),o=0;o0&&(o=this._getLineLength(i)/l*1e3),o!==this._period||a!==this._loop||s!==this._roundTrip){i.stopAnimation();var h=void 0;h=xt(u)?u(n):u,i.__t>0&&(h=-o*i.__t),this._animateSymbol(i,o,h,a,s)}this._period=o,this._loop=a,this._roundTrip=s}},e.prototype._animateSymbol=function(t,e,n,i,r){if(e>0){t.__t=0;var o=this,a=t.animate("",i).when(r?2*e:e,{__t:r?2:1}).delay(n).during((function(){o._updateSymbolPosition(t)}));i||a.done((function(){o.remove(t)})),a.start()}},e.prototype._getLineLength=function(t){return ge(t.__p1,t.__cp1)+ge(t.__cp1,t.__p2)},e.prototype._updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},e.prototype.updateData=function(t,e,n){this.childAt(0).updateData(t,e,n),this._updateEffectSymbol(t,e)},e.prototype._updateSymbolPosition=function(t){var e=t.__p1,n=t.__p2,i=t.__cp1,r=t.__t<1?t.__t:2-t.__t,o=[t.x,t.y],a=o.slice(),s=hi,l=ci;o[0]=s(e[0],i[0],n[0],r),o[1]=s(e[1],i[1],n[1],r);var u=t.__t<1?l(e[0],i[0],n[0],r):l(n[0],i[0],e[0],1-r),h=t.__t<1?l(e[1],i[1],n[1],r):l(n[1],i[1],e[1],1-r);t.rotation=-Math.atan2(h,u)-Math.PI/2,"line"!==this._symbolType&&"rect"!==this._symbolType&&"roundRect"!==this._symbolType||(void 0!==t.__lastT&&t.__lastT=0&&!(i[o]<=e);o--);o=Math.min(o,r-2)}else{for(o=a;oe);o++);o=Math.min(o-1,r-2)}var s=(e-i[o])/(i[o+1]-i[o]),l=n[o],u=n[o+1];t.x=l[0]*(1-s)+s*u[0],t.y=l[1]*(1-s)+s*u[1];var h=t.__t<1?u[0]-l[0]:l[0]-u[0],c=t.__t<1?u[1]-l[1]:l[1]-u[1];t.rotation=-Math.atan2(c,h)-Math.PI/2,this._lastFrame=o,this._lastFramePercent=e,t.ignore=!1}},e}(oM);const uM=lM;var hM=function(){this.polyline=!1,this.curveness=0,this.segs=[]},cM=function(t){function e(e){var n=t.call(this,e)||this;return n._off=0,n.hoverDataIdx=-1,n}return I(e,t),e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new hM},e.prototype.buildPath=function(t,e){var n,i=e.segs,r=e.curveness;if(e.polyline)for(n=this._off;n0){t.moveTo(i[n++],i[n++]);for(var a=1;a0){var c=(s+u)/2-(l-h)*r,d=(l+h)/2-(u-s)*r;t.quadraticCurveTo(c,d,u,h)}else t.lineTo(u,h)}this.incremental&&(this._off=n,this.notClear=!0)},e.prototype.findDataIndex=function(t,e){var n=this.shape,i=n.segs,r=n.curveness,o=this.style.lineWidth;if(n.polyline)for(var a=0,s=0;s0)for(var u=i[s++],h=i[s++],c=1;c0){if(al(u,h,(u+d)/2-(h-f)*r,(h+f)/2-(d-u)*r,d,f,o,t,e))return a}else if(rl(u,h,d,f,o,t,e))return a;a++}return-1},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect();return t=n[0],e=n[1],i.contain(t,e)?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape.segs,n=1/0,i=1/0,r=-1/0,o=-1/0,a=0;a0&&(o.dataIndex=n+t.__startIndex)}))},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();var fM={seriesType:"lines",plan:Ip(),reset:function(t){var e=t.coordinateSystem;if(e){var n=t.get("polyline"),i=t.pipelineContext.large;return{progress:function(r,o){var a=[];if(i){var s=void 0,l=r.end-r.start;if(n){for(var u=0,h=r.start;h0&&(l||s.configLayer(o,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(a/10+.9,1),0)})),r.updateData(i);var u=t.get("clip",!0)&&gM(t.coordinateSystem,!1,t);u?this.group.setClipPath(u):this.group.removeClipPath(),this._lastZlevel=o,this._finished=!0},e.prototype.incrementalPrepareRender=function(t,e,n){var i=t.getData();this._updateLineDraw(i,t).incrementalPrepareUpdate(i),this._clearLayer(n),this._finished=!1},e.prototype.incrementalRender=function(t,e,n){this._lineDraw.incrementalUpdate(t,e.getData()),this._finished=t.end===e.getData().count()},e.prototype.eachRendered=function(t){this._lineDraw&&this._lineDraw.eachRendered(t)},e.prototype.updateTransform=function(t,e,n){var i=t.getData(),r=t.pipelineContext;if(!this._finished||r.large||r.progressiveRender)return{update:!0};var o=pM.reset(t,e,n);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._lineDraw.updateLayout(),this._clearLayer(n)},e.prototype._updateLineDraw=function(t,e){var n=this._lineDraw,i=this._showEffect(e),r=!!e.get("polyline"),o=e.pipelineContext.large;return n&&i===this._hasEffet&&r===this._isPolyline&&o===this._isLargeDraw||(n&&n.remove(),n=this._lineDraw=o?new dM:new sT(r?i?uM:sM:i?oM:iT),this._hasEffet=i,this._isPolyline=r,this._isLargeDraw=o),this.group.add(n.group),n},e.prototype._showEffect=function(t){return!!t.get(["effect","show"])},e.prototype._clearLayer=function(t){var e=t.getZr();"svg"===e.painter.getType()||null==this._lastZlevel||e.painter.getLayer(this._lastZlevel).clear(!0)},e.prototype.remove=function(t,e){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(e)},e.prototype.dispose=function(t,e){this.remove(t,e)},e.type="lines",e}(Fm);var vM="undefined"==typeof Uint32Array?Array:Uint32Array,_M="undefined"==typeof Float64Array?Array:Float64Array;function yM(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=dt(e,(function(t){var e={coords:[t[0].coord,t[1].coord]};return t[0].name&&(e.fromName=t[0].name),t[1].name&&(e.toName=t[1].name),it([e,t[0],t[1]])})))}var xM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.visualStyleAccessPath="lineStyle",n.visualDrawType="stroke",n}return I(e,t),e.prototype.init=function(e){e.data=e.data||[],yM(e);var n=this._processFlatCoordsArray(e.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(e.data=new Float32Array(n.count)),t.prototype.init.apply(this,arguments)},e.prototype.mergeOption=function(e){if(yM(e),e.data){var n=this._processFlatCoordsArray(e.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(e.data=new Float32Array(n.count))}t.prototype.mergeOption.apply(this,arguments)},e.prototype.appendData=function(t){var e=this._processFlatCoordsArray(t.data);e.flatCoords&&(this._flatCoords?(this._flatCoords=Zt(this._flatCoords,e.flatCoords),this._flatCoordsOffset=Zt(this._flatCoordsOffset,e.flatCoordsOffset)):(this._flatCoords=e.flatCoords,this._flatCoordsOffset=e.flatCoordsOffset),t.data=new Float32Array(e.count)),this.getRawData().appendData(t.data)},e.prototype._getCoordsFromItemModel=function(t){var e=this.getData().getItemModel(t);return e.option instanceof Array?e.option:e.getShallow("coords")},e.prototype.getLineCoordsCount=function(t){return this._flatCoordsOffset?this._flatCoordsOffset[2*t+1]:this._getCoordsFromItemModel(t).length},e.prototype.getLineCoords=function(t,e){if(this._flatCoordsOffset){for(var n=this._flatCoordsOffset[2*t],i=this._flatCoordsOffset[2*t+1],r=0;r ")})},e.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},e.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?1e4:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?2e4:this.get("progressiveThreshold"):t},e.prototype.getZLevelKey=function(){var t=this.getModel("effect"),e=t.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:t.get("show")&&e>0?e+"":""},e.type="series.lines",e.dependencies=["grid","polar","geo","calendar"],e.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},e}(Lp);const wM=xM;function bM(t){return t instanceof Array||(t=[t,t]),t}const SM={seriesType:"lines",reset:function(t){var e=bM(t.get("symbol")),n=bM(t.get("symbolSize")),i=t.getData();return i.setVisual("fromSymbol",e&&e[0]),i.setVisual("toSymbol",e&&e[1]),i.setVisual("fromSymbolSize",n&&n[0]),i.setVisual("toSymbolSize",n&&n[1]),{dataEach:i.hasItemOption?function(t,e){var n=t.getItemModel(e),i=bM(n.getShallow("symbol",!0)),r=bM(n.getShallow("symbolSize",!0));i[0]&&t.setItemVisual(e,"fromSymbol",i[0]),i[1]&&t.setItemVisual(e,"toSymbol",i[1]),r[0]&&t.setItemVisual(e,"fromSymbolSize",r[0]),r[1]&&t.setItemVisual(e,"toSymbolSize",r[1])}:null}}};const TM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.hasSymbolVisual=!0,n}return I(e,t),e.prototype.getInitialData=function(t,e){return kx(null,this,{useEncodeDefaulter:!0})},e.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?5e3:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?1e4:this.get("progressiveThreshold"):t},e.prototype.brushSelector=function(t,e,n){return n.point(e.getItemLayout(t))},e.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},e.type="series.scatter",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}},e}(Lp);var MM=function(){},CM=function(t){function e(e){var n=t.call(this,e)||this;return n._off=0,n.hoverDataIdx=-1,n}return I(e,t),e.prototype.getDefaultShape=function(){return new MM},e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.buildPath=function(t,e){var n,i=e.points,r=e.size,o=this.symbolProxy,a=o.shape,s=t.getContext?t.getContext():t,l=s&&r[0]<4,u=this.softClipShape;if(l)this._ctx=s;else{for(this._ctx=null,n=this._off;n=0;s--){var l=2*s,u=i[l]-o/2,h=i[l+1]-a/2;if(t>=u&&e>=h&&t<=u+o&&e<=h+a)return s}return-1},e.prototype.contain=function(t,e){var n=this.transformCoordToLocal(t,e),i=this.getBoundingRect();return t=n[0],e=n[1],i.contain(t,e)?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape,n=e.points,i=e.size,r=i[0],o=i[1],a=1/0,s=1/0,l=-1/0,u=-1/0,h=0;h=0&&(l.dataIndex=n+(t.startIndex||0))}))},t.prototype.remove=function(){this._clear()},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();const AM=LM;const DM=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(t,e,n){var i=t.getData();this._updateSymbolDraw(i,t).updateData(i,{clipShape:this._getClipShape(t)}),this._finished=!0},e.prototype.incrementalPrepareRender=function(t,e,n){var i=t.getData();this._updateSymbolDraw(i,t).incrementalPrepareUpdate(i),this._finished=!1},e.prototype.incrementalRender=function(t,e,n){this._symbolDraw.incrementalUpdate(t,e.getData(),{clipShape:this._getClipShape(e)}),this._finished=t.end===e.getData().count()},e.prototype.updateTransform=function(t,e,n){var i=t.getData();if(this.group.dirty(),!this._finished||i.count()>1e4)return{update:!0};var r=eM("").reset(t,e,n);r.progress&&r.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(i)},e.prototype.eachRendered=function(t){this._symbolDraw&&this._symbolDraw.eachRendered(t)},e.prototype._getClipShape=function(t){if(t.get("clip",!0)){var e=t.coordinateSystem;return e&&e.getArea&&e.getArea(.1)}},e.prototype._updateSymbolDraw=function(t,e){var n=this._symbolDraw,i=e.pipelineContext.large;return n&&i===this._isLargeDraw||(n&&n.remove(),n=this._symbolDraw=i?new AM:new jS,this._isLargeDraw=i,this.group.removeAll()),this.group.add(n.group),n},e.prototype.remove=function(t,e){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},e.prototype.dispose=function(){},e.type="scatter",e}(Fm);const IM=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e}(Gc);var PM=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",ka).models[0]},e.type="cartesian2dAxis",e}(Gc);ut(PM,Uw);var EM={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},OM=nt({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},EM),NM=nt({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},EM);const RM={category:OM,value:NM,time:nt({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},NM),log:ot({logBase:10},NM)};var kM={value:1,category:1,time:1,log:1};function zM(t,e,n,i){ct(kM,(function(r,o){var a=nt(nt({},RM[o],!0),i,!0),s=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e+"Axis."+o,n}return I(n,t),n.prototype.mergeDefaultAndTheme=function(t,e){var n=Rc(this),i=n?zc(t):{};nt(t,e.getTheme().get(o+"Axis")),nt(t,this.getDefaultOption()),t.type=BM(t),n&&kc(t,i,n)},n.prototype.optionUpdated=function(){"category"===this.option.type&&(this.__ordinalMeta=Gx.createByAxisModel(this))},n.prototype.getCategories=function(t){var e=this.option;if("category"===e.type)return t?e.data:this.__ordinalMeta.categories},n.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},n.type=e+"Axis."+o,n.defaultOption=a,n}(n);t.registerComponentModel(s)})),t.registerSubTypeDefaulter(e+"Axis",BM)}function BM(t){return t.type||(t.data?"category":"value")}const FM=function(){function t(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return t.prototype.getAxis=function(t){return this._axes[t]},t.prototype.getAxes=function(){return dt(this._dimList,(function(t){return this._axes[t]}),this)},t.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),pt(this.getAxes(),(function(e){return e.scale.type===t}))},t.prototype.addAxis=function(t){var e=t.dim;this._axes[e]=t,this._dimList.push(e)},t}();var VM=["x","y"];function GM(t){return"interval"===t.type||"time"===t.type}var HM=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cartesian2d",e.dimensions=VM,e}return I(e,t),e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,e=this.getAxis("y").scale;if(GM(t)&&GM(e)){var n=t.getExtent(),i=e.getExtent(),r=this.dataToPoint([n[0],i[0]]),o=this.dataToPoint([n[1],i[1]]),a=n[1]-n[0],s=i[1]-i[0];if(a&&s){var l=(o[0]-r[0])/a,u=(o[1]-r[1])/s,h=r[0]-n[0]*l,c=r[1]-i[0]*u,d=this._transform=[l,0,0,u,h,c];this._invTransform=on([],d)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(t){var e=this.getAxis("x"),n=this.getAxis("y");return e.contain(e.toLocalCoord(t[0]))&&n.contain(n.toLocalCoord(t[1]))},e.prototype.containData=function(t){return this.getAxis("x").containData(t[0])&&this.getAxis("y").containData(t[1])},e.prototype.containZone=function(t,e){var n=this.dataToPoint(t),i=this.dataToPoint(e),r=this.getArea(),o=new _n(n[0],n[1],i[0]-n[0],i[1]-n[1]);return r.intersect(o)},e.prototype.dataToPoint=function(t,e,n){n=n||[];var i=t[0],r=t[1];if(this._transform&&null!=i&&isFinite(i)&&null!=r&&isFinite(r))return xe(n,t,this._transform);var o=this.getAxis("x"),a=this.getAxis("y");return n[0]=o.toGlobalCoord(o.dataToCoord(i,e)),n[1]=a.toGlobalCoord(a.dataToCoord(r,e)),n},e.prototype.clampData=function(t,e){var n=this.getAxis("x").scale,i=this.getAxis("y").scale,r=n.getExtent(),o=i.getExtent(),a=n.parse(t[0]),s=i.parse(t[1]);return(e=e||[])[0]=Math.min(Math.max(Math.min(r[0],r[1]),a),Math.max(r[0],r[1])),e[1]=Math.min(Math.max(Math.min(o[0],o[1]),s),Math.max(o[0],o[1])),e},e.prototype.pointToData=function(t,e){var n=[];if(this._invTransform)return xe(n,t,this._invTransform);var i=this.getAxis("x"),r=this.getAxis("y");return n[0]=i.coordToData(i.toLocalCoord(t[0]),e),n[1]=r.coordToData(r.toLocalCoord(t[1]),e),n},e.prototype.getOtherAxis=function(t){return this.getAxis("x"===t.dim?"y":"x")},e.prototype.getArea=function(t){t=t||0;var e=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),i=Math.min(e[0],e[1])-t,r=Math.min(n[0],n[1])-t,o=Math.max(e[0],e[1])-i+t,a=Math.max(n[0],n[1])-r+t;return new _n(i,r,o,a)},e}(FM);const UM=HM;var WM=function(t){function e(e,n,i,r,o){var a=t.call(this,e,n,i)||this;return a.index=0,a.type=r||"value",a.position=o||"bottom",a}return I(e,t),e.prototype.isHorizontal=function(){var t=this.position;return"top"===t||"bottom"===t},e.prototype.getGlobalExtent=function(t){var e=this.getExtent();return e[0]=this.toGlobalCoord(e[0]),e[1]=this.toGlobalCoord(e[1]),t&&e[0]>e[1]&&e.reverse(),e},e.prototype.pointToData=function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},e.prototype.setCategorySortInfo=function(t){if("category"!==this.type)return!1;this.model.option.categorySortInfo=t,this.scale.setSortInfo(t)},e}(Tb);const jM=WM;function ZM(t,e,n){n=n||{};var i=t.coordinateSystem,r=e.axis,o={},a=r.getAxesOnZeroOf()[0],s=r.position,l=a?"onZero":s,u=r.dim,h=i.getRect(),c=[h.x,h.x+h.width,h.y,h.y+h.height],d={left:0,right:1,top:0,bottom:1,onZero:2},f=e.get("offset")||0,p="x"===u?[c[2]-f,c[3]+f]:[c[0]-f,c[1]+f];if(a){var g=a.toGlobalCoord(a.dataToCoord(0));p[d.onZero]=Math.max(Math.min(g,p[1]),p[0])}o.position=["y"===u?p[d[l]]:c[0],"x"===u?p[d[l]]:c[3]],o.rotation=Math.PI/2*("x"===u?0:1);o.labelDirection=o.tickDirection=o.nameDirection={top:-1,bottom:1,left:-1,right:1}[s],o.labelOffset=a?p[d[s]]-p[d.onZero]:0,e.get(["axisTick","inside"])&&(o.tickDirection=-o.tickDirection),Et(n.labelInside,e.get(["axisLabel","inside"]))&&(o.labelDirection=-o.labelDirection);var m=e.get(["axisLabel","rotate"]);return o.labelRotate="top"===l?-m:m,o.z2=1,o}function XM(t){return"cartesian2d"===t.get("coordinateSystem")}function qM(t){var e={xAxisModel:null,yAxisModel:null};return ct(e,(function(n,i){var r=i.replace(/Model$/,""),o=t.getReferringComponents(r,ka).models[0];e[i]=o})),e}var YM=Math.log;var KM=function(){function t(t,e,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=VM,this._initCartesian(t,e,n),this.model=t}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(t,e){var n=this._axesMap;function i(t){var e,n=mt(t),i=n.length;if(i){for(var r=[],o=i-1;o>=0;o--){var a=t[+n[o]],s=a.model,l=a.scale;Hx(l)&&s.get("alignTicks")&&null==s.get("interval")?r.push(a):(Rw(l,s),Hx(l)&&(e=a))}r.length&&(e||Rw((e=r.pop()).scale,e.model),ct(r,(function(t){!function(t,e,n){var i=tw.prototype,r=i.getTicks.call(n),o=i.getTicks.call(n,!0),a=r.length-1,s=i.getInterval.call(n),l=Nw(t,e),u=l.extent,h=l.fixMin,c=l.fixMax;if("log"===t.type){var d=YM(t.base);u=[YM(u[0])/d,YM(u[1])/d]}t.setExtent(u[0],u[1]),t.calcNiceExtent({splitNumber:a,fixMin:h,fixMax:c});var f=i.getExtent.call(t);h&&(u[0]=f[0]),c&&(u[1]=f[1]);var p=i.getInterval.call(t),g=u[0],m=u[1];if(h&&c)p=(m-g)/a;else if(h)for(m=u[0]+p*a;mu[0]&&isFinite(g)&&isFinite(u[0]);)p=Wx(p),g=u[1]-p*a;else{t.getTicks().length-1>a&&(p=Wx(p));var v=p*a;(g=Yo((m=Math.ceil(u[1]/p)*p)-v))<0&&u[0]>=0?(g=0,m=Yo(v)):m>0&&u[1]<=0&&(m=0,g=-Yo(v))}var _=(r[0].value-o[0].value)/s,y=(r[a].value-o[a].value)/s;i.setExtent.call(t,g+p*_,m+p*y),i.setInterval.call(t,p),(_||y)&&i.setNiceExtent.call(t,g+p,m-p)}(t.scale,t.model,e.scale)})))}}this._updateScale(t,this.model),i(n.x),i(n.y);var r={};ct(n.x,(function(t){QM(n,"y",t,r)})),ct(n.y,(function(t){QM(n,"x",t,r)})),this.resize(this.model,e)},t.prototype.resize=function(t,e,n){var i=t.getBoxLayoutParams(),r=!n&&t.get("containLabel"),o=Oc(i,{width:e.getWidth(),height:e.getHeight()});this._rect=o;var a=this._axesList;function s(){ct(a,(function(t){var e=t.isHorizontal(),n=e?[0,o.width]:[0,o.height],i=t.inverse?1:0;t.setExtent(n[i],n[1-i]),function(t,e){var n=t.getExtent(),i=n[0]+n[1];t.toGlobalCoord="x"===t.dim?function(t){return t+e}:function(t){return i-t+e},t.toLocalCoord="x"===t.dim?function(t){return t-e}:function(t){return i-t+e}}(t,e?o.x:o.y)}))}s(),r&&(ct(a,(function(t){if(!t.model.get(["axisLabel","inside"])){var e=function(t){var e=t.model,n=t.scale;if(e.get(["axisLabel","show"])&&!n.isBlank()){var i,r,o=n.getExtent();r=n instanceof Jx?n.count():(i=n.getTicks()).length;var a,s=t.getLabelModel(),l=zw(t),u=1;r>40&&(u=Math.ceil(r/40));for(var h=0;h0&&i>0||n<0&&i<0)}(t)}const tC=KM;var eC=Math.PI,nC=function(){function t(t,e){this.group=new Eo,this.opt=e,this.axisModel=t,ot(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new Eo({x:e.position[0],y:e.position[1],rotation:e.rotation});n.updateTransform(),this._transformGroup=n}return t.prototype.hasBuilder=function(t){return!!iC[t]},t.prototype.add=function(t){iC[t](this.opt,this.axisModel,this.group,this._transformGroup)},t.prototype.getGroup=function(){return this.group},t.innerTextLayout=function(t,e,n){var i,r,o=ia(e-t);return ra(o)?(r=n>0?"top":"bottom",i="center"):ra(o-eC)?(r=n>0?"bottom":"top",i="center"):(r="middle",i=o>0&&o0?"right":"left":n>0?"left":"right"),{rotation:o,textAlign:i,textVerticalAlign:r}},t.makeAxisEventDataBase=function(t){var e={componentType:t.mainType,componentIndex:t.componentIndex};return e[t.mainType+"Index"]=t.componentIndex,e},t.isLabelSilent=function(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)},t}(),iC={axisLine:function(t,e,n,i){var r=e.get(["axisLine","show"]);if("auto"===r&&t.handleAutoShown&&(r=t.handleAutoShown("axisLine")),r){var o=e.axis.getExtent(),a=i.transform,s=[o[0],0],l=[o[1],0],u=s[0]>l[0];a&&(xe(s,s,a),xe(l,l,a));var h=rt({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),c=new Dg({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:h,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});pm(c.shape,c.style.lineWidth),c.anid="line",n.add(c);var d=e.get(["axisLine","symbol"]);if(null!=d){var f=e.get(["axisLine","symbolSize"]);wt(d)&&(d=[d,d]),(wt(f)||St(f))&&(f=[f,f]);var p=Xv(e.get(["axisLine","symbolOffset"])||0,f),g=f[0],m=f[1];ct([{rotate:t.rotation+Math.PI/2,offset:p[0],r:0},{rotate:t.rotation-Math.PI/2,offset:p[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],(function(e,i){if("none"!==d[i]&&null!=d[i]){var r=jv(d[i],-g/2,-m/2,g,m,h.stroke,!0),o=e.r+e.offset,a=u?l:s;r.attr({rotation:e.rotate,x:a[0]+o*Math.cos(t.rotation),y:a[1]-o*Math.sin(t.rotation),silent:!0,z2:11}),n.add(r)}}))}}},axisTickLabel:function(t,e,n,i){var r=function(t,e,n,i){var r=n.axis,o=n.getModel("axisTick"),a=o.get("show");"auto"===a&&i.handleAutoShown&&(a=i.handleAutoShown("axisTick"));if(!a||r.scale.isBlank())return;for(var s=o.getModel("lineStyle"),l=i.tickDirection*o.get("length"),u=sC(r.getTicksCoords(),e.transform,l,ot(s.getLineStyle(),{stroke:n.get(["axisLine","lineStyle","color"])}),"ticks"),h=0;hc[1]?-1:1,f=["start"===s?c[0]-d*h:"end"===s?c[1]+d*h:(c[0]+c[1])/2,aC(s)?t.labelOffset+l*h:0],p=e.get("nameRotate");null!=p&&(p=p*eC/180),aC(s)?o=nC.innerTextLayout(t.rotation,null!=p?p:t.rotation,l):(o=function(t,e,n,i){var r,o,a=ia(n-t),s=i[0]>i[1],l="start"===e&&!s||"start"!==e&&s;ra(a-eC/2)?(o=l?"bottom":"top",r="center"):ra(a-1.5*eC)?(o=l?"top":"bottom",r="center"):(o="middle",r=a<1.5*eC&&a>eC/2?l?"left":"right":l?"right":"left");return{rotation:a,textAlign:r,textVerticalAlign:o}}(t.rotation,s,p||0,c),null!=(a=t.axisNameAvailableWidth)&&(a=Math.abs(a/Math.sin(o.rotation)),!isFinite(a)&&(a=null)));var g=u.getFont(),m=e.get("nameTruncate",!0)||{},v=m.ellipsis,_=Et(t.nameTruncateMaxWidth,m.maxWidth,a),y=new eu({x:f[0],y:f[1],rotation:o.rotation,silent:nC.isLabelSilent(e),style:lh(u,{text:r,font:g,overflow:"truncate",width:_,ellipsis:v,fill:u.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:u.get("align")||o.textAlign,verticalAlign:u.get("verticalAlign")||o.textVerticalAlign}),z2:1});if(Am({el:y,componentModel:e,itemName:r}),y.__fullText=r,y.anid="name",e.get("triggerEvent")){var x=nC.makeAxisEventDataBase(e);x.targetType="axisName",x.name=r,nu(y).eventData=x}i.add(y),y.updateTransform(),n.add(y),y.decomposeTransform()}}};function rC(t){t&&(t.ignore=!0)}function oC(t,e){var n=t&&t.getBoundingRect().clone(),i=e&&e.getBoundingRect().clone();if(n&&i){var r=Qe([]);return nn(r,r,-t.rotation),n.applyTransform(tn([],r,t.getLocalTransform())),i.applyTransform(tn([],r,e.getLocalTransform())),n.intersect(i)}}function aC(t){return"middle"===t||"center"===t}function sC(t,e,n,i,r){for(var o=[],a=[],s=[],l=0;l=0||t===e}function cC(t){var e=(t.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return e&&e.axesInfo[fC(t)]}function dC(t){return!!t.get(["handle","show"])}function fC(t){return t.type+"||"+t.id}var pC={},gC=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(e,n,i,r){this.axisPointerClass&&function(t){var e=cC(t);if(e){var n=e.axisPointerModel,i=e.axis.scale,r=n.option,o=n.get("status"),a=n.get("value");null!=a&&(a=i.parse(a));var s=dC(n);null==o&&(r.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==a||a>l[1])&&(a=l[1]),aa)return!0;if(o){var s=cC(t).seriesDataCount,l=i.getExtent();return Math.abs(l[0]-l[1])/s>a}return!1}return!0===n},t.prototype.makeElOption=function(t,e,n,i,r){},t.prototype.createPointerEl=function(t,e,n,i){var r=e.pointer;if(r){var o=LC(t).pointerEl=new a[r.type](AC(e.pointer));t.add(o)}},t.prototype.createLabelEl=function(t,e,n,i){if(e.label){var r=LC(t).labelEl=new eu(AC(e.label));t.add(r),OC(r,i)}},t.prototype.updatePointerEl=function(t,e,n){var i=LC(t).pointerEl;i&&e.pointer&&(i.setStyle(e.pointer.style),n(i,{shape:e.pointer.shape}))},t.prototype.updateLabelEl=function(t,e,n,i){var r=LC(t).labelEl;r&&(r.setStyle(e.label.style),n(r,{x:e.label.x,y:e.label.y}),OC(r,i))},t.prototype._renderHandle=function(t){if(!this._dragging&&this.updateHandleTransform){var e,n=this._axisPointerModel,i=this._api.getZr(),r=this._handle,o=n.getModel("handle"),a=n.get("status");if(!o.get("show")||!a||"hide"===a)return r&&i.remove(r),void(this._handle=null);this._handle||(e=!0,r=this._handle=Tm(o.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){Ze(t.event)},onmousedown:DC(this._onHandleDragMove,this,0,0),drift:DC(this._onHandleDragMove,this),ondragend:DC(this._onHandleDragEnd,this)}),i.add(r)),RC(r,n,!1),r.setStyle(o.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=o.get("size");yt(s)||(s=[s,s]),r.scaleX=s[0]/2,r.scaleY=s[1]/2,Wm(this,"_doDispatchAxisPointer",o.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,e)}},t.prototype._moveHandleToValue=function(t,e){PC(this._axisPointerModel,!e&&this._moveAnimation,this._handle,NC(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(t,e){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(NC(n),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(NC(i)),LC(n).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){if(this._handle){var t=this._payloadInfo,e=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:e.axis.dim,axisIndex:e.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var t=this._axisPointerModel.get("value");this._moveHandleToValue(t),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),n=this._group,i=this._handle;e&&n&&(this._lastGraphicKey=null,n&&e.remove(n),i&&e.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),jm(this,"_doDispatchAxisPointer")},t.prototype.doClear=function(){},t.prototype.buildLabel=function(t,e,n){return{x:t[n=n||0],y:t[1-n],width:e[n],height:e[1-n]}},t}();function PC(t,e,n,i){EC(LC(n).lastProp,i)||(LC(n).lastProp=i,e?Ju(n,i,t):(n.stopAnimation(),n.attr(i)))}function EC(t,e){if(Tt(t)&&Tt(e)){var n=!0;return ct(e,(function(e,i){n=n&&EC(t[i],e)})),!!n}return t===e}function OC(t,e){t[e.get(["label","show"])?"show":"hide"]()}function NC(t){return{x:t.x||0,y:t.y||0,rotation:t.rotation||0}}function RC(t,e,n){var i=e.get("z"),r=e.get("zlevel");t&&t.traverse((function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=r&&(t.zlevel=r),t.silent=n)}))}function kC(t,e,n,i,r){var o=zC(n.get("value"),e.axis,e.ecModel,n.get("seriesDataIndices"),{precision:n.get(["label","precision"]),formatter:n.get(["label","formatter"])}),a=n.getModel("label"),s=_c(a.get("padding")||0),l=a.getFont(),u=po(o,l),h=r.position,c=u.width+s[1]+s[3],d=u.height+s[0]+s[2],f=r.align;"right"===f&&(h[0]-=c),"center"===f&&(h[0]-=c/2);var p=r.verticalAlign;"bottom"===p&&(h[1]-=d),"middle"===p&&(h[1]-=d/2),function(t,e,n,i){var r=i.getWidth(),o=i.getHeight();t[0]=Math.min(t[0]+e,r)-e,t[1]=Math.min(t[1]+n,o)-n,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}(h,c,d,i);var g=a.get("backgroundColor");g&&"auto"!==g||(g=e.get(["axisLine","lineStyle","color"])),t.label={x:h[0],y:h[1],style:lh(a,{text:o,font:l,fill:a.getTextColor(),padding:s,backgroundColor:g}),z2:10}}function zC(t,e,n,i,r){t=e.scale.parse(t);var o=e.scale.getLabel({value:t},{precision:r.precision}),a=r.formatter;if(a){var s={value:Bw(e,{value:t}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};ct(i,(function(t){var e=n.getSeriesByIndex(t.seriesIndex),i=t.dataIndexInside,r=e&&e.getDataParams(i);r&&s.seriesData.push(r)})),wt(a)?o=a.replace("{value}",o):xt(a)&&(o=a(s))}return o}function BC(t,e,n){var i=[1,0,0,1,0,0];return nn(i,i,n.rotation),en(i,i,n.position),_m([t.dataToCoord(e),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],i)}var FC=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.makeElOption=function(t,e,n,i,r){var o=n.axis,a=o.grid,s=i.get("type"),l=VC(a,o).getOtherAxis(o).getGlobalExtent(),u=o.toGlobalCoord(o.dataToCoord(e,!0));if(s&&"none"!==s){var h=function(t){var e,n=t.get("type"),i=t.getModel(n+"Style");return"line"===n?(e=i.getLineStyle()).fill=null:"shadow"===n&&((e=i.getAreaStyle()).stroke=null),e}(i),c=GC[s](o,u,l);c.style=h,t.graphicKey=c.type,t.pointer=c}!function(t,e,n,i,r,o){var a=lC.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=r.get(["label","margin"]),kC(e,i,r,o,{position:BC(i.axis,t,n),align:a.textAlign,verticalAlign:a.textVerticalAlign})}(e,t,ZM(a.model,n),n,i,r)},e.prototype.getHandleTransform=function(t,e,n){var i=ZM(e.axis.grid.model,e,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var r=BC(e.axis,t,i);return{x:r[0],y:r[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,e,n,i){var r=n.axis,o=r.grid,a=r.getGlobalExtent(!0),s=VC(o,r).getOtherAxis(r).getGlobalExtent(),l="x"===r.dim?0:1,u=[t.x,t.y];u[l]+=e[l],u[l]=Math.min(a[1],u[l]),u[l]=Math.max(a[0],u[l]);var h=(s[1]+s[0])/2,c=[h,h];c[l]=u[l];return{x:u[0],y:u[1],rotation:t.rotation,cursorPoint:c,tooltipOption:[{verticalAlign:"middle"},{align:"center"}][l]}},e}(IC);function VC(t,e){var n={};return n[e.dim+"AxisIndex"]=e.index,t.getCartesian(n)}var GC={line:function(t,e,n){var i=function(t,e,n){return{x1:t[n=n||0],y1:t[1-n],x2:e[n],y2:e[1-n]}}([e,n[0]],[e,n[1]],HC(t));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(t,e,n){var i,r,o,a=Math.max(1,t.getBandWidth()),s=n[1]-n[0];return{type:"Rect",shape:(i=[e-a/2,n[0]],r=[a,s],o=HC(t),{x:i[o=o||0],y:i[1-o],width:r[o],height:r[1-o]})}}};function HC(t){return"x"===t.dim?0:1}const UC=FC;const WC=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e}(Gc);var jC=Ea(),ZC=ct;function XC(t,e,n){if(!O.node){var i=e.getZr();jC(i).records||(jC(i).records={}),function(t,e){if(jC(t).initialized)return;function n(n,i){t.on(n,(function(n){var r=function(t){var e={showTip:[],hideTip:[]},n=function(i){var r=e[i.type];r?r.push(i):(i.dispatchAction=n,t.dispatchAction(i))};return{dispatchAction:n,pendings:e}}(e);ZC(jC(t).records,(function(t){t&&i(t,n,r.dispatchAction)})),function(t,e){var n,i=t.showTip.length,r=t.hideTip.length;i?n=t.showTip[i-1]:r&&(n=t.hideTip[r-1]);n&&(n.dispatchAction=null,e.dispatchAction(n))}(r.pendings,e)}))}jC(t).initialized=!0,n("click",_t(YC,"click")),n("mousemove",_t(YC,"mousemove")),n("globalout",qC)}(i,e),(jC(i).records[t]||(jC(i).records[t]={})).handler=n}}function qC(t,e,n){t.handler("leave",null,n)}function YC(t,e,n,i){e.handler(t,n,i)}function KC(t,e){if(!O.node){var n=e.getZr();(jC(n).records||{})[t]&&(jC(n).records[t]=null)}}var JC=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(t,e,n){var i=e.getComponent("tooltip"),r=t.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";XC("axisPointer",n,(function(t,e,n){"none"!==r&&("leave"===t||r.indexOf(t)>=0)&&n({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})}))},e.prototype.remove=function(t,e){KC("axisPointer",e)},e.prototype.dispose=function(t,e){KC("axisPointer",e)},e.type="axisPointer",e}(Dp);const QC=JC;function $C(t,e){var n,i=[],r=t.seriesIndex;if(null==r||!(n=e.getSeriesByIndex(r)))return{point:[]};var o=n.getData(),a=Pa(o,t);if(null==a||a<0||yt(a))return{point:[]};var s=o.getItemGraphicEl(a),l=n.coordinateSystem;if(n.getTooltipPosition)i=n.getTooltipPosition(a)||[];else if(l&&l.dataToPoint)if(t.isStacked){var u=l.getBaseAxis(),h=l.getOtherAxis(u).dim,c=u.dim,d="x"===h||"radius"===h?1:0,f=o.mapDimension(c),p=[];p[d]=o.get(f,a),p[1-d]=o.get(o.getCalculationInfo("stackResultDimension"),a),i=l.dataToPoint(p)||[]}else i=l.dataToPoint(o.getValues(dt(l.dimensions,(function(t){return o.mapDimension(t)})),a))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),i=[g.x+g.width/2,g.y+g.height/2]}return{point:i,el:s}}var tL=Ea();function eL(t,e,n){var i=t.currTrigger,r=[t.x,t.y],o=t,a=t.dispatchAction||vt(n.dispatchAction,n),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){aL(r)&&(r=$C({seriesIndex:o.seriesIndex,dataIndex:o.dataIndex},e).point);var l=aL(r),u=o.axesInfo,h=s.axesInfo,c="leave"===i||aL(r),d={},f={},p={list:[],map:{}},g={showPointer:_t(iL,f),showTooltip:_t(rL,p)};ct(s.coordSysMap,(function(t,e){var n=l||t.containPoint(r);ct(s.coordSysAxesInfo[e],(function(t,e){var i=t.axis,o=function(t,e){for(var n=0;n<(t||[]).length;n++){var i=t[n];if(e.axis.dim===i.axisDim&&e.axis.model.componentIndex===i.axisIndex)return i}}(u,t);if(!c&&n&&(!u||o)){var a=o&&o.value;null!=a||l||(a=i.pointToData(r)),null!=a&&nL(t,a,g,!1,d)}}))}));var m={};return ct(h,(function(t,e){var n=t.linkGroup;n&&!f[e]&&ct(n.axesInfo,(function(e,i){var r=f[i];if(e!==t&&r){var o=r.value;n.mapper&&(o=t.axis.scale.parse(n.mapper(o,oL(e),oL(t)))),m[t.key]=o}}))})),ct(m,(function(t,e){nL(h[e],t,g,!0,d)})),function(t,e,n){var i=n.axesInfo=[];ct(e,(function(e,n){var r=e.axisPointerModel.option,o=t[n];o?(!e.useHandle&&(r.status="show"),r.value=o.value,r.seriesDataIndices=(o.payloadBatch||[]).slice()):!e.useHandle&&(r.status="hide"),"show"===r.status&&i.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:r.value})}))}(f,h,d),function(t,e,n,i){if(aL(e)||!t.list.length)return void i({type:"hideTip"});var r=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:r.dataIndexInside,dataIndex:r.dataIndex,seriesIndex:r.seriesIndex,dataByCoordSys:t.list})}(p,r,t,a),function(t,e,n){var i=n.getZr(),r="axisPointerLastHighlights",o=tL(i)[r]||{},a=tL(i)[r]={};ct(t,(function(t,e){var n=t.axisPointerModel.option;"show"===n.status&&t.triggerEmphasis&&ct(n.seriesDataIndices,(function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t}))}));var s=[],l=[];ct(o,(function(t,e){!a[e]&&l.push(t)})),ct(a,(function(t,e){!o[e]&&s.push(t)})),l.length&&n.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&n.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}(h,0,n),d}}function nL(t,e,n,i,r){var o=t.axis;if(!o.scale.isBlank()&&o.containData(e))if(t.involveSeries){var a=function(t,e){var n=e.axis,i=n.dim,r=t,o=[],a=Number.MAX_VALUE,s=-1;return ct(e.seriesModels,(function(e,l){var u,h,c=e.getData().mapDimensionsAll(i);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(c,t,n);h=d.dataIndices,u=d.nestestValue}else{if(!(h=e.getData().indicesOfNearest(c[0],t,"category"===n.type?.5:null)).length)return;u=e.getData().get(c[0],h[0])}if(null!=u&&isFinite(u)){var f=t-u,p=Math.abs(f);p<=a&&((p=0&&s<0)&&(a=p,s=f,r=u,o.length=0),ct(h,(function(t){o.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})})))}})),{payloadBatch:o,snapToValue:r}}(e,t),s=a.payloadBatch,l=a.snapToValue;s[0]&&null==r.seriesIndex&&rt(r,s[0]),!i&&t.snap&&o.containData(l)&&null!=l&&(e=l),n.showPointer(t,e,s),n.showTooltip(t,a,l)}else n.showPointer(t,e)}function iL(t,e,n,i){t[e.key]={value:n,payloadBatch:i}}function rL(t,e,n,i){var r=n.payloadBatch,o=e.axis,a=o.model,s=e.axisPointerModel;if(e.triggerTooltip&&r.length){var l=e.coordSys.model,u=fC(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:o.dim,axisIndex:a.componentIndex,axisType:a.type,axisId:a.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:r.slice()})}}function oL(t){var e=t.axis.model,n={},i=n.axisDim=t.axis.dim;return n.axisIndex=n[i+"AxisIndex"]=e.componentIndex,n.axisName=n[i+"AxisName"]=e.name,n.axisId=n[i+"AxisId"]=e.id,n}function aL(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function sL(t){mC.registerAxisPointerClass("CartesianAxisPointer",UC),t.registerComponentModel(WC),t.registerComponentView(QC),t.registerPreprocessor((function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!yt(e)&&(t.axisPointer.link=[e])}})),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,(function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=uC(t,e)})),t.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},eL)}const lL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e}(Gc);function uL(t){var e=t.get("confine");return null!=e?!!e:"richText"===t.get("renderMode")}function hL(t){if(O.domSupported)for(var e=document.documentElement.style,n=0,i=t.length;n-1?(u+="top:50%",h+="translateY(-50%) rotate("+(a="left"===s?-225:-45)+"deg)"):(u+="left:50%",h+="translateX(-50%) rotate("+(a="top"===s?225:45)+"deg)");var c=a*Math.PI/180,d=l+r,f=d*Math.abs(Math.cos(c))+d*Math.abs(Math.sin(c)),p=e+" solid "+r+"px;";return'
'}(n,i,r)),wt(t))o.innerHTML=t+a;else if(t){o.innerHTML="",yt(t)||(t=[t]);for(var s=0;s=0?this._tryShow(n,i):"leave"===e&&this._hide(i))}),this))},e.prototype._keepShow=function(){var t=this._tooltipModel,e=this._ecModel,n=this._api,i=t.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==i&&"click"!==i){var r=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout((function(){!n.isDisposed()&&r.manuallyShowTip(t,e,n,{x:r._lastX,y:r._lastY,dataByCoordSys:r._lastDataByCoordSys})}))}},e.prototype.manuallyShowTip=function(t,e,n,i){if(i.from!==this.uid&&!O.node&&n.getDom()){var r=DL(i,n);this._ticket="";var o=i.dataByCoordSys,a=function(t,e,n){var i=Ra(t).queryOptionMap,r=i.keys()[0];if(!r||"series"===r)return;var o=Ba(e,r,i.get(r),{useDefault:!1,enableAll:!1,enableNone:!1}),a=o.models[0];if(!a)return;var s,l=n.getViewOfComponentModel(a);if(l.group.traverse((function(e){var n=nu(e).tooltipConfig;if(n&&n.name===t.name)return s=e,!0})),s)return{componentMainType:r,componentIndex:a.componentIndex,el:s}}(i,e,n);if(a){var s=a.el.getBoundingRect().clone();s.applyTransform(a.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:a.el,position:i.position,positionDefault:"bottom"},r)}else if(i.tooltip&&null!=i.x&&null!=i.y){var l=CL;l.x=i.x,l.y=i.y,l.update(),nu(l).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:l},r)}else if(o)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:o,tooltipOption:i.tooltipOption},r);else if(null!=i.seriesIndex){if(this._manuallyAxisShowTip(t,e,n,i))return;var u=$C(i,e),h=u.point[0],c=u.point[1];null!=h&&null!=c&&this._tryShow({offsetX:h,offsetY:c,target:u.el,position:i.position,positionDefault:"bottom"},r)}else null!=i.x&&null!=i.y&&(n.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:n.getZr().findHover(i.x,i.y).target},r))}},e.prototype.manuallyHideTip=function(t,e,n,i){var r=this._tooltipContent;this._tooltipModel&&r.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(DL(i,n))},e.prototype._manuallyAxisShowTip=function(t,e,n,i){var r=i.seriesIndex,o=i.dataIndex,a=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=r&&null!=o&&null!=a){var s=e.getSeriesByIndex(r);if(s)if("axis"===AL([s.getData().getItemModel(o),s,(s.coordinateSystem||{}).model],this._tooltipModel).get("trigger"))return n.dispatchAction({type:"updateAxisPointer",seriesIndex:r,dataIndex:o,position:i.position}),!0}},e.prototype._tryShow=function(t,e){var n=t.target;if(this._tooltipModel){this._lastX=t.offsetX,this._lastY=t.offsetY;var i=t.dataByCoordSys;if(i&&i.length)this._showAxisTooltip(i,t);else if(n){var r,o;if("legend"===nu(n).ssrType)return;this._lastDataByCoordSys=null,Ev(n,(function(t){return null!=nu(t).dataIndex?(r=t,!0):null!=nu(t).tooltipConfig?(o=t,!0):void 0}),!0),r?this._showSeriesItemTooltip(t,r,e):o?this._showComponentItemTooltip(t,o,e):this._hide(e)}else this._lastDataByCoordSys=null,this._hide(e)}},e.prototype._showOrMove=function(t,e){var n=t.get("showDelay");e=vt(e,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(e,n):e()},e.prototype._showAxisTooltip=function(t,e){var n=this._ecModel,i=this._tooltipModel,r=[e.offsetX,e.offsetY],o=AL([e.tooltipOption],i),a=this._renderMode,s=[],l=op("section",{blocks:[],noHeader:!0}),u=[],h=new gp;ct(t,(function(t){ct(t.dataByAxis,(function(t){var e=n.getComponent(t.axisDim+"Axis",t.axisIndex),r=t.value;if(e&&null!=r){var o=zC(r,e.axis,n,t.seriesDataIndices,t.valueLabelOpt),c=op("section",{header:o,noHeader:!Bt(o),sortBlocks:!0,blocks:[]});l.blocks.push(c),ct(t.seriesDataIndices,(function(l){var d=n.getSeriesByIndex(l.seriesIndex),f=l.dataIndexInside,p=d.getDataParams(f);if(!(p.dataIndex<0)){p.axisDim=t.axisDim,p.axisIndex=t.axisIndex,p.axisType=t.axisType,p.axisId=t.axisId,p.axisValue=Bw(e.axis,{value:r}),p.axisValueLabel=o,p.marker=h.makeTooltipMarker("item",Cc(p.color),a);var g=Sf(d.formatTooltip(f,!0,null)),m=g.frag;if(m){var v=AL([d],i).get("valueFormatter");c.blocks.push(v?rt({valueFormatter:v},m):m)}g.text&&u.push(g.text),s.push(p)}}))}}))})),l.blocks.reverse(),u.reverse();var c=e.position,d=o.get("order"),f=cp(l,h,a,d,n.get("useUTC"),o.get("textStyle"));f&&u.unshift(f);var p="richText"===a?"\n\n":"
",g=u.join(p);this._showOrMove(o,(function(){this._updateContentNotChangedOnAxis(t,s)?this._updatePosition(o,c,r[0],r[1],this._tooltipContent,s):this._showTooltipContent(o,g,s,Math.random()+"",r[0],r[1],c,null,h)}))},e.prototype._showSeriesItemTooltip=function(t,e,n){var i=this._ecModel,r=nu(e),o=r.seriesIndex,a=i.getSeriesByIndex(o),s=r.dataModel||a,l=r.dataIndex,u=r.dataType,h=s.getData(u),c=this._renderMode,d=t.positionDefault,f=AL([h.getItemModel(l),s,a&&(a.coordinateSystem||{}).model],this._tooltipModel,d?{position:d}:null),p=f.get("trigger");if(null==p||"item"===p){var g=s.getDataParams(l,u),m=new gp;g.marker=m.makeTooltipMarker("item",Cc(g.color),c);var v=Sf(s.formatTooltip(l,!1,u)),_=f.get("order"),y=f.get("valueFormatter"),x=v.frag,w=x?cp(y?rt({valueFormatter:y},x):x,m,c,_,i.get("useUTC"),f.get("textStyle")):v.text,b="item_"+s.name+"_"+l;this._showOrMove(f,(function(){this._showTooltipContent(f,w,g,b,t.offsetX,t.offsetY,t.position,t.target,m)})),n({type:"showTip",dataIndexInside:l,dataIndex:h.getRawIndex(l),seriesIndex:o,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,e,n){var i="html"===this._renderMode,r=nu(e),o=r.tooltipConfig.option||{},a=o.encodeHTMLContent;if(wt(o)){o={content:o,formatter:o},a=!0}a&&i&&o.content&&((o=et(o)).content=ze(o.content));var s=[o],l=this._ecModel.getComponent(r.componentMainType,r.componentIndex);l&&s.push(l),s.push({formatter:o.content});var u=t.positionDefault,h=AL(s,this._tooltipModel,u?{position:u}:null),c=h.get("content"),d=Math.random()+"",f=new gp;this._showOrMove(h,(function(){var n=et(h.get("formatterParams")||{});this._showTooltipContent(h,c,n,d,t.offsetX,t.offsetY,t.position,e,f)})),n({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,e,n,i,r,o,a,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent;u.setEnterable(t.get("enterable"));var h=t.get("formatter");a=a||t.get("position");var c=e,d=this._getNearestPoint([r,o],n,t.get("trigger"),t.get("borderColor")).color;if(h)if(wt(h)){var f=t.ecModel.get("useUTC"),p=yt(n)?n[0]:n;c=h,p&&p.axisType&&p.axisType.indexOf("time")>=0&&(c=$h(p.axisValue,c,f)),c=bc(c,n,!0)}else if(xt(h)){var g=vt((function(e,i){e===this._ticket&&(u.setContent(i,l,t,d,a),this._updatePosition(t,a,r,o,u,n,s))}),this);this._ticket=i,c=h(n,i,g)}else c=h;u.setContent(c,l,t,d,a),u.show(t,d),this._updatePosition(t,a,r,o,u,n,s)}},e.prototype._getNearestPoint=function(t,e,n,i){return"axis"===n||yt(e)?{color:i||("html"===this._renderMode?"#fff":"none")}:yt(e)?void 0:{color:i||e.color||e.borderColor}},e.prototype._updatePosition=function(t,e,n,i,r,o,a){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var u=r.getSize(),h=t.get("align"),c=t.get("verticalAlign"),d=a&&a.getBoundingRect().clone();if(a&&d.applyTransform(a.transform),xt(e)&&(e=e([n,i],o,r.el,d,{viewSize:[s,l],contentSize:u.slice()})),yt(e))n=qo(e[0],s),i=qo(e[1],l);else if(Tt(e)){var f=e;f.width=u[0],f.height=u[1];var p=Oc(f,{width:s,height:l});n=p.x,i=p.y,h=null,c=null}else if(wt(e)&&a){var g=function(t,e,n,i){var r=n[0],o=n[1],a=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=e.width,h=e.height;switch(t){case"inside":s=e.x+u/2-r/2,l=e.y+h/2-o/2;break;case"top":s=e.x+u/2-r/2,l=e.y-o-a;break;case"bottom":s=e.x+u/2-r/2,l=e.y+h+a;break;case"left":s=e.x-r-a,l=e.y+h/2-o/2;break;case"right":s=e.x+u+a,l=e.y+h/2-o/2}return[s,l]}(e,d,u,t.get("borderWidth"));n=g[0],i=g[1]}else{g=function(t,e,n,i,r,o,a){var s=n.getSize(),l=s[0],u=s[1];null!=o&&(t+l+o+2>i?t-=l+o:t+=o);null!=a&&(e+u+a>r?e-=u+a:e+=a);return[t,e]}(n,i,r,s,l,h?null:20,c?null:20);n=g[0],i=g[1]}if(h&&(n-=IL(h)?u[0]/2:"right"===h?u[0]:0),c&&(i-=IL(c)?u[1]/2:"bottom"===c?u[1]:0),uL(t)){g=function(t,e,n,i,r){var o=n.getSize(),a=o[0],s=o[1];return t=Math.min(t+a,i)-a,e=Math.min(e+s,r)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}(n,i,r,s,l);n=g[0],i=g[1]}r.moveTo(n,i)},e.prototype._updateContentNotChangedOnAxis=function(t,e){var n=this._lastDataByCoordSys,i=this._cbParamsList,r=!!n&&n.length===t.length;return r&&ct(n,(function(n,o){var a=n.dataByAxis||[],s=(t[o]||{}).dataByAxis||[];(r=r&&a.length===s.length)&&ct(a,(function(t,n){var o=s[n]||{},a=t.seriesDataIndices||[],l=o.seriesDataIndices||[];(r=r&&t.value===o.value&&t.axisType===o.axisType&&t.axisId===o.axisId&&a.length===l.length)&&ct(a,(function(t,e){var n=l[e];r=r&&t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex})),i&&ct(t.seriesDataIndices,(function(t){var n=t.seriesIndex,o=e[n],a=i[n];o&&a&&a.data!==o.data&&(r=!1)}))}))})),this._lastDataByCoordSys=t,this._cbParamsList=e,!!r},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,e){!O.node&&e.getDom()&&(jm(this,"_updatePosition"),this._tooltipContent.dispose(),KC("itemTooltip",e))},e.type="tooltip",e}(Dp);function AL(t,e,n){var i,r=e.ecModel;n?(i=new Ih(n,r,r),i=new Ih(e.option,i,r)):i=e;for(var o=t.length-1;o>=0;o--){var a=t[o];a&&(a instanceof Ih&&(a=a.get("tooltip",!0)),wt(a)&&(a={formatter:a}),a&&(i=new Ih(a,i,r)))}return i}function DL(t,e){return t.dispatchAction||vt(e.dispatchAction,e)}function IL(t){return"center"===t||"middle"===t}const PL=LL;var EL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.layoutMode={type:"box",ignoreSize:!0},n}return I(e,t),e.type="title",e.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},e}(Gc),OL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.render=function(t,e,n){if(this.group.removeAll(),t.get("show")){var i=this.group,r=t.getModel("textStyle"),o=t.getModel("subtextStyle"),a=t.get("textAlign"),s=Ot(t.get("textBaseline"),t.get("textVerticalAlign")),l=new eu({style:lh(r,{text:t.get("text"),fill:r.getTextColor()},{disableBox:!0}),z2:10}),u=l.getBoundingRect(),h=t.get("subtext"),c=new eu({style:lh(o,{text:h,fill:o.getTextColor(),y:u.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),d=t.get("link"),f=t.get("sublink"),p=t.get("triggerEvent",!0);l.silent=!d&&!p,c.silent=!f&&!p,d&&l.on("click",(function(){Lc(d,"_"+t.get("target"))})),f&&c.on("click",(function(){Lc(f,"_"+t.get("subtarget"))})),nu(l).eventData=nu(c).eventData=p?{componentType:"title",componentIndex:t.componentIndex}:null,i.add(l),h&&i.add(c);var g=i.getBoundingRect(),m=t.getBoxLayoutParams();m.width=g.width,m.height=g.height;var v=Oc(m,{width:n.getWidth(),height:n.getHeight()},t.get("padding"));a||("middle"===(a=t.get("left")||t.get("right"))&&(a="center"),"right"===a?v.x+=v.width:"center"===a&&(v.x+=v.width/2)),s||("center"===(s=t.get("top")||t.get("bottom"))&&(s="middle"),"bottom"===s?v.y+=v.height:"middle"===s&&(v.y+=v.height/2),s=s||"top"),i.x=v.x,i.y=v.y,i.markRedraw();var _={align:a,verticalAlign:s};l.setStyle(_),c.setStyle(_),g=i.getBoundingRect();var y=v.margin,x=t.getItemStyle(["color","opacity"]);x.fill=t.get("backgroundColor");var w=new Fl({shape:{x:g.x-y[3],y:g.y-y[0],width:g.width+y[1]+y[3],height:g.height+y[0]+y[2],r:t.get("borderRadius")},style:x,subPixelOptimize:!0,silent:!0});i.add(w)}},e.type="title",e}(Dp);var NL=["x","y","radius","angle","single"],RL=["cartesian2d","polar","singleAxis"];function kL(t){return t+"Axis"}function zL(t,e){var n,i=jt(),r=[],o=jt();t.eachComponent({mainType:"dataZoom",query:e},(function(t){o.get(t.uid)||s(t)}));do{n=!1,t.eachComponent("dataZoom",a)}while(n);function a(t){!o.get(t.uid)&&function(t){var e=!1;return t.eachTargetAxis((function(t,n){var r=i.get(t);r&&r[n]&&(e=!0)})),e}(t)&&(s(t),n=!0)}function s(t){o.set(t.uid,!0),r.push(t),t.eachTargetAxis((function(t,e){(i.get(t)||i.set(t,[]))[e]=!0}))}return r}var BL=function(){function t(){this.indexList=[],this.indexMap=[]}return t.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},t}();function FL(t){var e={};return ct(["start","end","startValue","endValue","throttle"],(function(n){t.hasOwnProperty(n)&&(e[n]=t[n])})),e}const VL=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.type="dataZoom.select",e}(function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=["percent","percent"],n}return I(e,t),e.prototype.init=function(t,e,n){var i=FL(t);this.settledOption=i,this.mergeDefaultAndTheme(t,n),this._doInit(i)},e.prototype.mergeOption=function(t){var e=FL(t);nt(this.option,t,!0),nt(this.settledOption,e,!0),this._doInit(e)},e.prototype._doInit=function(t){var e=this.option;this._setDefaultThrottle(t),this._updateRangeUse(t);var n=this.settledOption;ct([["start","startValue"],["end","endValue"]],(function(t,i){"value"===this._rangePropMode[i]&&(e[t[0]]=n[t[0]]=null)}),this),this._resetTarget()},e.prototype._resetTarget=function(){var t=this.get("orient",!0),e=this._targetAxisInfoMap=jt();this._fillSpecifiedTargetAxis(e)?this._orient=t||this._makeAutoOrientByTargetAxis():(this._orient=t||"horizontal",this._fillAutoTargetAxisByOrient(e,this._orient)),this._noTarget=!0,e.each((function(t){t.indexList.length&&(this._noTarget=!1)}),this)},e.prototype._fillSpecifiedTargetAxis=function(t){var e=!1;return ct(NL,(function(n){var i=this.getReferringComponents(kL(n),za);if(i.specified){e=!0;var r=new BL;ct(i.models,(function(t){r.add(t.componentIndex)})),t.set(n,r)}}),this),e},e.prototype._fillAutoTargetAxisByOrient=function(t,e){var n=this.ecModel,i=!0;if(i){var r="vertical"===e?"y":"x";o(n.findComponents({mainType:r+"Axis"}),r)}i&&o(n.findComponents({mainType:"singleAxis",filter:function(t){return t.get("orient",!0)===e}}),"single");function o(e,n){var r=e[0];if(r){var o=new BL;if(o.add(r.componentIndex),t.set(n,o),i=!1,"x"===n||"y"===n){var a=r.getReferringComponents("grid",ka).models[0];a&&ct(e,(function(t){r.componentIndex!==t.componentIndex&&a===t.getReferringComponents("grid",ka).models[0]&&o.add(t.componentIndex)}))}}}i&&ct(NL,(function(e){if(i){var r=n.findComponents({mainType:kL(e),filter:function(t){return"category"===t.get("type",!0)}});if(r[0]){var o=new BL;o.add(r[0].componentIndex),t.set(e,o),i=!1}}}),this)},e.prototype._makeAutoOrientByTargetAxis=function(){var t;return this.eachTargetAxis((function(e){!t&&(t=e)}),this),"y"===t?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(t){if(t.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var e=this.ecModel.option;this.option.throttle=e.animation&&e.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(t){var e=this._rangePropMode,n=this.get("rangeMode");ct([["start","startValue"],["end","endValue"]],(function(i,r){var o=null!=t[i[0]],a=null!=t[i[1]];o&&!a?e[r]="percent":!o&&a?e[r]="value":n?e[r]=n[r]:o&&(e[r]="percent")}))},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var t;return this.eachTargetAxis((function(e,n){null==t&&(t=this.ecModel.getComponent(kL(e),n))}),this),t},e.prototype.eachTargetAxis=function(t,e){this._targetAxisInfoMap.each((function(n,i){ct(n.indexList,(function(n){t.call(e,i,n)}))}))},e.prototype.getAxisProxy=function(t,e){var n=this.getAxisModel(t,e);if(n)return n.__dzAxisProxy},e.prototype.getAxisModel=function(t,e){var n=this._targetAxisInfoMap.get(t);if(n&&n.indexMap[e])return this.ecModel.getComponent(kL(t),e)},e.prototype.setRawRange=function(t){var e=this.option,n=this.settledOption;ct([["start","startValue"],["end","endValue"]],(function(i){null==t[i[0]]&&null==t[i[1]]||(e[i[0]]=n[i[0]]=t[i[0]],e[i[1]]=n[i[1]]=t[i[1]])}),this),this._updateRangeUse(t)},e.prototype.setCalculatedRange=function(t){var e=this.option;ct(["start","startValue","end","endValue"],(function(n){e[n]=t[n]}))},e.prototype.getPercentRange=function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},e.prototype.getValueRange=function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var n=this.findRepresentativeAxisProxy();return n?n.getDataValueWindow():void 0},e.prototype.findRepresentativeAxisProxy=function(t){if(t)return t.__dzAxisProxy;for(var e,n=this._targetAxisInfoMap.keys(),i=0;io&&(e[1-i]=e[i]+u.sign*o),e}function UL(t,e){var n=t[e]-t[1-e];return{span:Math.abs(n),sign:n>0?-1:n<0?1:e?-1:1}}function WL(t,e){return Math.min(null!=e[1]?e[1]:1/0,Math.max(null!=e[0]?e[0]:-1/0,t))}var jL=ct,ZL=Ko,XL=function(){function t(t,e,n,i){this._dimName=t,this._axisIndex=e,this.ecModel=i,this._dataZoomModel=n}return t.prototype.hostedBy=function(t){return this._dataZoomModel===t},t.prototype.getDataValueWindow=function(){return this._valueWindow.slice()},t.prototype.getDataPercentWindow=function(){return this._percentWindow.slice()},t.prototype.getTargetSeriesModels=function(){var t=[];return this.ecModel.eachSeries((function(e){if(function(t){var e=t.get("coordinateSystem");return st(RL,e)>=0}(e)){var n=kL(this._dimName),i=e.getReferringComponents(n,ka).models[0];i&&this._axisIndex===i.componentIndex&&t.push(e)}}),this),t},t.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},t.prototype.getMinMaxSpan=function(){return et(this._minMaxSpan)},t.prototype.calculateDataWindow=function(t){var e,n=this._dataExtent,i=this.getAxisModel().axis.scale,r=this._dataZoomModel.getRangePropMode(),o=[0,100],a=[],s=[];jL(["start","end"],(function(l,u){var h=t[l],c=t[l+"Value"];"percent"===r[u]?(null==h&&(h=o[u]),c=i.parse(Xo(h,o,n))):(e=!0,h=Xo(c=null==c?n[u]:i.parse(c),n,o)),s[u]=null==c||isNaN(c)?n[u]:c,a[u]=null==h||isNaN(h)?o[u]:h})),ZL(s),ZL(a);var l=this._minMaxSpan;function u(t,e,n,r,o){var a=o?"Span":"ValueSpan";HL(0,t,n,"all",l["min"+a],l["max"+a]);for(var s=0;s<2;s++)e[s]=Xo(t[s],n,r,!0),o&&(e[s]=i.parse(e[s]))}return e?u(s,a,n,o,!1):u(a,s,o,n,!0),{valueWindow:s,percentWindow:a}},t.prototype.reset=function(t){if(t===this._dataZoomModel){var e=this.getTargetSeriesModels();this._dataExtent=function(t,e,n){var i=[1/0,-1/0];jL(n,(function(t){!function(t,e,n){e&&ct(Hw(e,n),(function(n){var i=e.getApproximateExtent(n);i[0]t[1]&&(t[1]=i[1])}))}(i,t.getData(),e)}));var r=t.getAxisModel(),o=Ew(r.axis.scale,r,i).calculate();return[o.min,o.max]}(this,this._dimName,e),this._updateMinMaxSpan();var n=this.calculateDataWindow(t.settledOption);this._valueWindow=n.valueWindow,this._percentWindow=n.percentWindow,this._setAxisModel()}},t.prototype.filterData=function(t,e){if(t===this._dataZoomModel){var n=this._dimName,i=this.getTargetSeriesModels(),r=t.get("filterMode"),o=this._valueWindow;"none"!==r&&jL(i,(function(t){var e=t.getData(),i=e.mapDimensionsAll(n);if(i.length){if("weakFilter"===r){var a=e.getStore(),s=dt(i,(function(t){return e.getDimensionIndex(t)}),e);e.filterSelf((function(t){for(var e,n,r,l=0;lo[1];if(h&&!c&&!d)return!0;h&&(r=!0),c&&(e=!0),d&&(n=!0)}return r&&e&&n}))}else jL(i,(function(n){if("empty"===r)t.setData(e=e.map(n,(function(t){return function(t){return t>=o[0]&&t<=o[1]}(t)?t:NaN})));else{var i={};i[n]=o,e.selectRange(i)}}));jL(i,(function(t){e.setApproximateExtent(o,t)}))}}))}},t.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},e=this._dataZoomModel,n=this._dataExtent;jL(["min","max"],(function(i){var r=e.get(i+"Span"),o=e.get(i+"ValueSpan");null!=o&&(o=this.getAxisModel().axis.scale.parse(o)),null!=o?r=Xo(n[0]+o,n,[0,100],!0):null!=r&&(o=Xo(r,[0,100],n,!0)-n[0]),t[i+"Span"]=r,t[i+"ValueSpan"]=o}),this)},t.prototype._setAxisModel=function(){var t=this.getAxisModel(),e=this._percentWindow,n=this._valueWindow;if(e){var i=$o(n,[0,500]);i=Math.min(i,20);var r=t.axis.scale.rawExtentInfo;0!==e[0]&&r.setDeterminedMinMax("min",+n[0].toFixed(i)),100!==e[1]&&r.setDeterminedMinMax("max",+n[1].toFixed(i)),r.freeze()}},t}();const qL=XL;const YL={getTargetSeries:function(t){function e(e){t.eachComponent("dataZoom",(function(n){n.eachTargetAxis((function(i,r){var o=t.getComponent(kL(i),r);e(i,r,o,n)}))}))}e((function(t,e,n,i){n.__dzAxisProxy=null}));var n=[];e((function(e,i,r,o){r.__dzAxisProxy||(r.__dzAxisProxy=new qL(e,i,o,t),n.push(r.__dzAxisProxy))}));var i=jt();return ct(n,(function(t){ct(t.getTargetSeriesModels(),(function(t){i.set(t.uid,t)}))})),i},overallReset:function(t,e){t.eachComponent("dataZoom",(function(t){t.eachTargetAxis((function(e,n){t.getAxisProxy(e,n).reset(t)})),t.eachTargetAxis((function(n,i){t.getAxisProxy(n,i).filterData(t,e)}))})),t.eachComponent("dataZoom",(function(t){var e=t.findRepresentativeAxisProxy();if(e){var n=e.getDataPercentWindow(),i=e.getDataValueWindow();t.setCalculatedRange({start:n[0],end:n[1],startValue:i[0],endValue:i[1]})}}))}};var KL=!1;function JL(t){KL||(KL=!0,t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,YL),function(t){t.registerAction("dataZoom",(function(t,e){ct(zL(e,t),(function(e){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})}))}))}(t),t.registerSubTypeDefaulter("dataZoom",(function(){return"slider"})))}function QL(t){t.registerComponentModel(VL),t.registerComponentView(GL),JL(t)}var $L=function(){},tA={};function eA(t,e){tA[t]=e}function nA(t){return tA[t]}const iA=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return I(e,t),e.prototype.optionUpdated=function(){t.prototype.optionUpdated.apply(this,arguments);var e=this.ecModel;ct(this.option.feature,(function(t,n){var i=nA(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(e)),nt(t,i.defaultOption))}))},e.type="toolbox",e.layoutMode={type:"box",ignoreSize:!0},e.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}},e}(Gc);function rA(t,e){var n=_c(e.get("padding")),i=e.getItemStyle(["color","opacity"]);return i.fill=e.get("backgroundColor"),t=new Fl({shape:{x:t.x-n[3],y:t.y-n[0],width:t.width+n[1]+n[3],height:t.height+n[0]+n[2],r:e.get("borderRadius")},style:i,silent:!0,z2:-1})}var oA=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.render=function(t,e,n,i){var r=this.group;if(r.removeAll(),t.get("show")){var o=+t.get("itemSize"),a="vertical"===t.get("orient"),s=t.get("feature")||{},l=this._features||(this._features={}),u=[];ct(s,(function(t,e){u.push(e)})),new ex(this._featureNames||[],u).add(h).update(h).remove(_t(h,null)).execute(),this._featureNames=u,function(t,e,n){var i=e.getBoxLayoutParams(),r=e.get("padding"),o={width:n.getWidth(),height:n.getHeight()},a=Oc(i,o,r);Ec(e.get("orient"),t,e.get("itemGap"),a.width,a.height),Nc(t,i,o,r)}(r,t,n),r.add(rA(r.getBoundingRect(),t)),a||r.eachChild((function(t){var e=t.__title,i=t.ensureState("emphasis"),a=i.textConfig||(i.textConfig={}),s=t.getTextContent(),l=s&&s.ensureState("emphasis");if(l&&!xt(l)&&e){var u=l.style||(l.style={}),h=po(e,eu.makeFont(u)),c=t.x+r.x,d=!1;t.y+r.y+o+h.height>n.getHeight()&&(a.position="top",d=!0);var f=d?-5-h.height:o+10;c+h.width/2>n.getWidth()?(a.position=["100%",f],u.align="right"):c-h.width/2<0&&(a.position=[0,f],u.align="left")}}))}function h(h,c){var d,f=u[h],p=u[c],g=s[f],m=new Ih(g,t,t.ecModel);if(i&&null!=i.newTitle&&i.featureName===f&&(g.title=i.newTitle),f&&!p){if(function(t){return 0===t.indexOf("my")}(f))d={onclick:m.option.onclick,featureName:f};else{var v=nA(f);if(!v)return;d=new v}l[f]=d}else if(!(d=l[p]))return;d.uid=Eh("toolbox-feature"),d.model=m,d.ecModel=e,d.api=n;var _=d instanceof $L;f||!p?!m.get("show")||_&&d.unusable?_&&d.remove&&d.remove(e,n):(!function(i,s,l){var u,h,c=i.getModel("iconStyle"),d=i.getModel(["emphasis","iconStyle"]),f=s instanceof $L&&s.getIcons?s.getIcons():i.get("icon"),p=i.get("title")||{};wt(f)?(u={})[l]=f:u=f;wt(p)?(h={})[l]=p:h=p;var g=i.iconPaths={};ct(u,(function(l,u){var f=Tm(l,{},{x:-o/2,y:-o/2,width:o,height:o});f.setStyle(c.getItemStyle()),f.ensureState("emphasis").style=d.getItemStyle();var p=new eu({style:{text:h[u],align:d.get("textAlign"),borderRadius:d.get("textBorderRadius"),padding:d.get("textPadding"),fill:null,font:ph({fontStyle:d.get("textFontStyle"),fontFamily:d.get("textFontFamily"),fontSize:d.get("textFontSize"),fontWeight:d.get("textFontWeight")},e)},ignore:!0});f.setTextContent(p),Am({el:f,componentModel:t,itemName:u,formatterParamsExtra:{title:h[u]}}),f.__title=h[u],f.on("mouseover",(function(){var e=d.getItemStyle(),i=a?null==t.get("right")&&"right"!==t.get("left")?"right":"left":null==t.get("bottom")&&"bottom"!==t.get("top")?"bottom":"top";p.setStyle({fill:d.get("textFill")||e.fill||e.stroke||"#000",backgroundColor:d.get("textBackgroundColor")}),f.setTextConfig({position:d.get("textPosition")||i}),p.ignore=!t.get("showTitle"),n.enterEmphasis(this)})).on("mouseout",(function(){"emphasis"!==i.get(["iconStatus",u])&&n.leaveEmphasis(this),p.hide()})),("emphasis"===i.get(["iconStatus",u])?Iu:Pu)(f),r.add(f),f.on("click",vt(s.onclick,s,e,n,u)),g[u]=f}))}(m,d,f),m.setIconStatus=function(t,e){var n=this.option,i=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[t]=e,i[t]&&("emphasis"===e?Iu:Pu)(i[t])},d instanceof $L&&d.render&&d.render(m,e,n,i)):_&&d.dispose&&d.dispose(e,n)}},e.prototype.updateView=function(t,e,n,i){ct(this._features,(function(t){t instanceof $L&&t.updateView&&t.updateView(t.model,e,n,i)}))},e.prototype.remove=function(t,e){ct(this._features,(function(n){n instanceof $L&&n.remove&&n.remove(t,e)})),this.group.removeAll()},e.prototype.dispose=function(t,e){ct(this._features,(function(n){n instanceof $L&&n.dispose&&n.dispose(t,e)}))},e.type="toolbox",e}(Dp);const aA=oA;const sA=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.onclick=function(t,e){var n=this.model,i=n.get("name")||t.get("title.0.text")||"echarts",r="svg"===e.getZr().painter.getType(),o=r?"svg":n.get("type",!0)||"png",a=e.getConnectedDataURL({type:o,backgroundColor:n.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",connectedBackgroundColor:n.get("connectedBackgroundColor"),excludeComponents:n.get("excludeComponents"),pixelRatio:n.get("pixelRatio")}),s=O.browser;if("function"!=typeof MouseEvent||!s.newEdge&&(s.ie||s.edge))if(window.navigator.msSaveOrOpenBlob||r){var l=a.split(","),u=l[0].indexOf("base64")>-1,h=r?decodeURIComponent(l[1]):l[1];u&&(h=window.atob(h));var c=i+"."+o;if(window.navigator.msSaveOrOpenBlob){for(var d=h.length,f=new Uint8Array(d);d--;)f[d]=h.charCodeAt(d);var p=new Blob([f]);window.navigator.msSaveOrOpenBlob(p,c)}else{var g=document.createElement("iframe");document.body.appendChild(g);var m=g.contentWindow,v=m.document;v.open("image/svg+xml","replace"),v.write(h),v.close(),m.focus(),v.execCommand("SaveAs",!0,c),document.body.removeChild(g)}}else{var _=n.get("lang"),y='',x=window.open();x.document.write(y),x.document.title=i}else{var w=document.createElement("a");w.download=i+"."+o,w.target="_blank",w.href=a;var b=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});w.dispatchEvent(b)}},e.getDefaultOption=function(t){return{show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:t.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:t.getLocaleModel().get(["toolbox","saveAsImage","lang"])}},e}($L);var lA="__ec_magicType_stack__",uA=[["line","bar"],["stack"]],hA=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.getIcons=function(){var t=this.model,e=t.get("icon"),n={};return ct(t.get("type"),(function(t){e[t]&&(n[t]=e[t])})),n},e.getDefaultOption=function(t){return{show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:t.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}}},e.prototype.onclick=function(t,e,n){var i=this.model,r=i.get(["seriesIndex",n]);if(cA[n]){var o,a={series:[]};ct(uA,(function(t){st(t,n)>=0&&ct(t,(function(t){i.setIconStatus(t,"normal")}))})),i.setIconStatus(n,"emphasis"),t.eachComponent({mainType:"series",query:null==r?null:{seriesIndex:r}},(function(t){var e=t.subType,r=t.id,o=cA[n](e,r,t,i);o&&(ot(o,t.option),a.series.push(o));var s=t.coordinateSystem;if(s&&"cartesian2d"===s.type&&("line"===n||"bar"===n)){var l=s.getAxesByScale("ordinal")[0];if(l){var u=l.dim+"Axis",h=t.getReferringComponents(u,ka).models[0].componentIndex;a[u]=a[u]||[];for(var c=0;c<=h;c++)a[u][h]=a[u][h]||{};a[u][h].boundaryGap="bar"===n}}}));var s=n;"stack"===n&&(o=nt({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),"emphasis"!==i.get(["iconStatus",n])&&(s="tiled")),e.dispatchAction({type:"changeMagicType",currentType:s,newOption:a,newTitle:o,featureName:"magicType"})}},e}($L),cA={line:function(t,e,n,i){if("bar"===t)return nt({id:e,type:"line",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","line"])||{},!0)},bar:function(t,e,n,i){if("line"===t)return nt({id:e,type:"bar",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","bar"])||{},!0)},stack:function(t,e,n,i){var r=n.get("stack")===lA;if("line"===t||"bar"===t)return i.setIconStatus("stack",r?"normal":"emphasis"),nt({id:e,stack:r?"":lA},i.get(["option","stack"])||{},!0)}};Vy({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},(function(t,e){e.mergeOption(t.newOption)}));const dA=hA;var fA=new Array(60).join("-"),pA="\t";function gA(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var mA=new RegExp("[\t]+","g");function vA(t,e){var n=t.split(new RegExp("\n*"+fA+"\n*","g")),i={series:[]};return ct(n,(function(t,n){if(function(t){if(t.slice(0,t.indexOf("\n")).indexOf(pA)>=0)return!0}(t)){var r=function(t){for(var e=t.split(/\n+/g),n=[],i=dt(gA(e.shift()).split(mA),(function(t){return{name:t,data:[]}})),r=0;r6}(t)||o){if(a&&!o){"single"===s.brushMode&&WA(t);var l=et(s);l.brushType=sD(l.brushType,a),l.panelId=a===CA?null:a.panelId,o=t._creatingCover=kA(t,l),t._covers.push(o)}if(o){var u=hD[sD(t._brushType,a)];o.__brushOption.range=u.getCreatingRange(iD(t,o,t._track)),i&&(zA(t,o),u.updateCommon(t,o)),BA(t,o),r={isEnd:i}}}else i&&"single"===s.brushMode&&s.removeOnClick&&HA(t,e,n)&&WA(t)&&(r={isEnd:i,removeOnClick:!0});return r}function sD(t,e){return"auto"===t?e.defaultBrushType:t}var lD={mousedown:function(t){if(this._dragging)uD(this,t);else if(!t.target||!t.target.draggable){rD(t);var e=this.group.transformCoordToLocal(t.offsetX,t.offsetY);this._creatingCover=null,(this._creatingPanel=HA(this,t,e))&&(this._dragging=!0,this._track=[e.slice()])}},mousemove:function(t){var e=t.offsetX,n=t.offsetY,i=this.group.transformCoordToLocal(e,n);if(function(t,e,n){if(t._brushType&&!function(t,e,n){var i=t._zr;return e<0||e>i.getWidth()||n<0||n>i.getHeight()}(t,e.offsetX,e.offsetY)){var i=t._zr,r=t._covers,o=HA(t,e,n);if(!t._dragging)for(var a=0;a=0)&&t(r,i._targetInfoList)}))}return t.prototype.setOutputRanges=function(t,e){return this.matchOutputRanges(t,e,(function(t,e,n){if((t.coordRanges||(t.coordRanges=[])).push(e),!t.coordRange){t.coordRange=e;var i=TD[t.brushType](0,n,e);t.__rangeOffset={offset:CD[t.brushType](i.values,t.range,[1,1]),xyMinMax:i.xyMinMax}}})),t},t.prototype.matchOutputRanges=function(t,e,n){ct(t,(function(t){var i=this.findTargetInfo(t,e);i&&!0!==i&&ct(i.coordSyses,(function(i){var r=TD[t.brushType](1,i,t.range,!0);n(t,r.values,i,e)}))}),this)},t.prototype.setInputRanges=function(t,e){ct(t,(function(t){var n,i,r,o,a,s=this.findTargetInfo(t,e);if(t.range=t.range||[],s&&!0!==s){t.panelId=s.panelId;var l=TD[t.brushType](0,s.coordSys,t.coordRange),u=t.__rangeOffset;t.range=u?CD[t.brushType](l.values,u.offset,(n=l.xyMinMax,i=u.xyMinMax,r=AD(n),o=AD(i),a=[r[0]/o[0],r[1]/o[1]],isNaN(a[0])&&(a[0]=1),isNaN(a[1])&&(a[1]=1),a)):l.values}}),this)},t.prototype.makePanelOpts=function(t,e){return dt(this._targetInfoList,(function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:e?e(n):null,clipPath:fD(i),isTargetByCursor:gD(i,t,n.coordSysModel),getLinearBrushOtherExtent:pD(i)}}))},t.prototype.controlSeries=function(t,e,n){var i=this.findTargetInfo(t,n);return!0===i||i&&st(i.coordSyses,e.coordinateSystem)>=0},t.prototype.findTargetInfo=function(t,e){for(var n=this._targetInfoList,i=xD(e,t),r=0;rt[1]&&t.reverse(),t}function xD(t,e){return Na(t,e,{includeMainTypes:vD})}var wD={grid:function(t,e){var n=t.xAxisModels,i=t.yAxisModels,r=t.gridModels,o=jt(),a={},s={};(n||i||r)&&(ct(n,(function(t){var e=t.axis.grid.model;o.set(e.id,e),a[e.id]=!0})),ct(i,(function(t){var e=t.axis.grid.model;o.set(e.id,e),s[e.id]=!0})),ct(r,(function(t){o.set(t.id,t),a[t.id]=!0,s[t.id]=!0})),o.each((function(t){var r=t.coordinateSystem,o=[];ct(r.getCartesians(),(function(t,e){(st(n,t.getAxis("x").model)>=0||st(i,t.getAxis("y").model)>=0)&&o.push(t)})),e.push({panelId:"grid--"+t.id,gridModel:t,coordSysModel:t,coordSys:o[0],coordSyses:o,getPanelRect:SD.grid,xAxisDeclared:a[t.id],yAxisDeclared:s[t.id]})})))},geo:function(t,e){ct(t.geoModels,(function(t){var n=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:n,coordSyses:[n],getPanelRect:SD.geo})}))}},bD=[function(t,e){var n=t.xAxisModel,i=t.yAxisModel,r=t.gridModel;return!r&&n&&(r=n.axis.grid.model),!r&&i&&(r=i.axis.grid.model),r&&r===e.gridModel},function(t,e){var n=t.geoModel;return n&&n===e.geoModel}],SD={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(vm(t)),e}},TD={lineX:_t(MD,0),lineY:_t(MD,1),rect:function(t,e,n,i){var r=t?e.pointToData([n[0][0],n[1][0]],i):e.dataToPoint([n[0][0],n[1][0]],i),o=t?e.pointToData([n[0][1],n[1][1]],i):e.dataToPoint([n[0][1],n[1][1]],i),a=[yD([r[0],o[0]]),yD([r[1],o[1]])];return{values:a,xyMinMax:a}},polygon:function(t,e,n,i){var r=[[1/0,-1/0],[1/0,-1/0]];return{values:dt(n,(function(n){var o=t?e.pointToData(n,i):e.dataToPoint(n,i);return r[0][0]=Math.min(r[0][0],o[0]),r[1][0]=Math.min(r[1][0],o[1]),r[0][1]=Math.max(r[0][1],o[0]),r[1][1]=Math.max(r[1][1],o[1]),o})),xyMinMax:r}}};function MD(t,e,n,i){var r=n.getAxis(["x","y"][t]),o=yD(dt([0,1],(function(t){return e?r.coordToData(r.toLocalCoord(i[t]),!0):r.toGlobalCoord(r.dataToCoord(i[t]))}))),a=[];return a[t]=o,a[1-t]=[NaN,NaN],{values:o,xyMinMax:a}}var CD={lineX:_t(LD,0),lineY:_t(LD,1),rect:function(t,e,n){return[[t[0][0]-n[0]*e[0][0],t[0][1]-n[0]*e[0][1]],[t[1][0]-n[1]*e[1][0],t[1][1]-n[1]*e[1][1]]]},polygon:function(t,e,n){return dt(t,(function(t,i){return[t[0]-n[0]*e[i][0],t[1]-n[1]*e[i][1]]}))}};function LD(t,e,n,i){return[e[0]-i[t]*n[0],e[1]-i[t]*n[1]]}function AD(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}const DD=_D;var ID,PD,ED=ct,OD=ya+"toolbox-dataZoom_",ND=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return I(e,t),e.prototype.render=function(t,e,n,i){this._brushController||(this._brushController=new dD(n.getZr()),this._brushController.on("brush",vt(this._onBrush,this)).mount()),function(t,e,n,i,r){var o=n._isZoomActive;i&&"takeGlobalCursor"===i.type&&(o="dataZoomSelect"===i.key&&i.dataZoomSelectActive);n._isZoomActive=o,t.setIconStatus("zoom",o?"emphasis":"normal");var a=new DD(kD(t),e,{include:["grid"]}),s=a.makePanelOpts(r,(function(t){return t.xAxisDeclared&&!t.yAxisDeclared?"lineX":!t.xAxisDeclared&&t.yAxisDeclared?"lineY":"rect"}));n._brushController.setPanels(s).enableBrush(!(!o||!s.length)&&{brushType:"auto",brushStyle:t.getModel("brushStyle").getItemStyle()})}(t,e,this,i,n),function(t,e){t.setIconStatus("back",function(t){return SA(t).length}(e)>1?"emphasis":"normal")}(t,e)},e.prototype.onclick=function(t,e,n){RD[n].call(this)},e.prototype.remove=function(t,e){this._brushController&&this._brushController.unmount()},e.prototype.dispose=function(t,e){this._brushController&&this._brushController.dispose()},e.prototype._onBrush=function(t){var e=t.areas;if(t.isEnd&&e.length){var n={},i=this.ecModel;this._brushController.updateCovers([]),new DD(kD(this.model),i,{include:["grid"]}).matchOutputRanges(e,i,(function(t,e,n){if("cartesian2d"===n.type){var i=t.brushType;"rect"===i?(r("x",n,e[0]),r("y",n,e[1])):r({lineX:"x",lineY:"y"}[i],n,e)}})),function(t,e){var n=SA(t);wA(e,(function(e,i){for(var r=n.length-1;r>=0&&!n[r][i];r--);if(r<0){var o=t.queryComponents({mainType:"dataZoom",subType:"select",id:i})[0];if(o){var a=o.getPercentRange();n[0][i]={dataZoomId:i,start:a[0],end:a[1]}}}})),n.push(e)}(i,n),this._dispatchZoomAction(n)}function r(t,e,r){var o=e.getAxis(t),a=o.model,s=function(t,e,n){var i;return n.eachComponent({mainType:"dataZoom",subType:"select"},(function(n){n.getAxisModel(t,e.componentIndex)&&(i=n)})),i}(t,a,i),l=s.findRepresentativeAxisProxy(a).getMinMaxSpan();null==l.minValueSpan&&null==l.maxValueSpan||(r=HL(0,r.slice(),o.scale.getExtent(),0,l.minValueSpan,l.maxValueSpan)),s&&(n[s.id]={dataZoomId:s.id,startValue:r[0],endValue:r[1]})}},e.prototype._dispatchZoomAction=function(t){var e=[];ED(t,(function(t,n){e.push(et(t))})),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},e.getDefaultOption=function(t){return{show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:t.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}}},e}($L),RD={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(function(t){var e=SA(t),n=e[e.length-1];e.length>1&&e.pop();var i={};return wA(n,(function(t,n){for(var r=e.length-1;r>=0;r--)if(t=e[r][n]){i[n]=t;break}})),i}(this.ecModel))}};function kD(t){var e={xAxisIndex:t.get("xAxisIndex",!0),yAxisIndex:t.get("yAxisIndex",!0),xAxisId:t.get("xAxisId",!0),yAxisId:t.get("yAxisId",!0)};return null==e.xAxisIndex&&null==e.xAxisId&&(e.xAxisIndex="all"),null==e.yAxisIndex&&null==e.yAxisId&&(e.yAxisIndex="all"),e}ID="dataZoom",PD=function(t){var e=t.getComponent("toolbox",0),n=["feature","dataZoom"];if(e&&null!=e.get(n)){var i=e.getModel(n),r=[],o=Na(t,kD(i));return ED(o.xAxisModels,(function(t){return a(t,"xAxis","xAxisIndex")})),ED(o.yAxisModels,(function(t){return a(t,"yAxis","yAxisIndex")})),r}function a(t,e,n){var o=t.componentIndex,a={type:"select",$fromToolbox:!0,filterMode:i.get("filterMode",!0)||"filter",id:OD+e+o};a[n]=o,r.push(a)}},zt(null==ad.get(ID)&&PD),ad.set(ID,PD);const zD=ND;const BD=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.layoutMode={type:"box",ignoreSize:!0},n}return I(e,t),e.prototype.init=function(t,e,n){this.mergeDefaultAndTheme(t,n),t.selected=t.selected||{},this._updateSelector(t)},e.prototype.mergeOption=function(e,n){t.prototype.mergeOption.call(this,e,n),this._updateSelector(e)},e.prototype._updateSelector=function(t){var e=t.selector,n=this.ecModel;!0===e&&(e=t.selector=["all","inverse"]),yt(e)&&ct(e,(function(t,i){wt(t)&&(t={type:t}),e[i]=nt(t,function(t,e){return"all"===e?{type:"all",title:t.getLocaleModel().get(["legend","selector","all"])}:"inverse"===e?{type:"inverse",title:t.getLocaleModel().get(["legend","selector","inverse"])}:void 0}(n,t.type))}))},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,n=0;n=0},e.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(Gc);var FD=_t,VD=ct,GD=Eo,HD=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.newlineDisabled=!1,n}return I(e,t),e.prototype.init=function(){this.group.add(this._contentGroup=new GD),this.group.add(this._selectorGroup=new GD),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(t,e,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),t.get("show",!0)){var r=t.get("align"),o=t.get("orient");r&&"auto"!==r||(r="right"===t.get("left")&&"vertical"===o?"right":"left");var a=t.get("selector",!0),s=t.get("selectorPosition",!0);!a||s&&"auto"!==s||(s="horizontal"===o?"end":"start"),this.renderInner(r,t,e,n,a,o,s);var l=t.getBoxLayoutParams(),u={width:n.getWidth(),height:n.getHeight()},h=t.get("padding"),c=Oc(l,u,h),d=this.layoutInner(t,r,c,i,a,s),f=Oc(ot({width:d.width,height:d.height},l),u,h);this.group.x=f.x-d.x,this.group.y=f.y-d.y,this.group.markRedraw(),this.group.add(this._backgroundEl=rA(d,t))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(t,e,n,i,r,o,a){var s=this.getContentGroup(),l=jt(),u=e.get("selectedMode"),h=[];n.eachRawSeries((function(t){!t.get("legendHoverLink")&&h.push(t.id)})),VD(e.getData(),(function(r,o){var a=r.get("name");if(!this.newlineDisabled&&(""===a||"\n"===a)){var c=new GD;return c.newline=!0,void s.add(c)}var d=n.getSeriesByName(a)[0];if(!l.get(a)){if(d){var f=d.getData(),p=f.getVisual("legendLineStyle")||{},g=f.getVisual("legendIcon"),m=f.getVisual("style"),v=this._createItem(d,a,o,r,e,t,p,m,g,u,i);v.on("click",FD(UD,a,null,i,h)).on("mouseover",FD(jD,d.name,null,i,h)).on("mouseout",FD(ZD,d.name,null,i,h)),n.ssr&&v.eachChild((function(t){var e=nu(t);e.seriesIndex=d.seriesIndex,e.dataIndex=o,e.ssrType="legend"})),l.set(a,!0)}else n.eachRawSeries((function(s){if(!l.get(a)&&s.legendVisualProvider){var c=s.legendVisualProvider;if(!c.containName(a))return;var d=c.indexOfName(a),f=c.getItemVisual(d,"style"),p=c.getItemVisual(d,"legendIcon"),g=Ri(f.fill);g&&0===g[3]&&(g[3]=.2,f=rt(rt({},f),{fill:ji(g,"rgba")}));var m=this._createItem(s,a,o,r,e,t,{},f,p,u,i);m.on("click",FD(UD,null,a,i,h)).on("mouseover",FD(jD,null,a,i,h)).on("mouseout",FD(ZD,null,a,i,h)),n.ssr&&m.eachChild((function(t){var e=nu(t);e.seriesIndex=s.seriesIndex,e.dataIndex=o,e.ssrType="legend"})),l.set(a,!0)}}),this);0}}),this),r&&this._createSelector(r,e,i,o,a)},e.prototype._createSelector=function(t,e,n,i,r){var o=this.getSelectorGroup();VD(t,(function(t){var i=t.type,r=new eu({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect",legendId:e.id})}});o.add(r),ah(r,{normal:e.getModel("selectorLabel"),emphasis:e.getModel(["emphasis","selectorLabel"])},{defaultText:t.title}),Hu(r)}))},e.prototype._createItem=function(t,e,n,i,r,o,a,s,l,u,h){var c=t.visualDrawType,d=r.get("itemWidth"),f=r.get("itemHeight"),p=r.isSelected(e),g=i.get("symbolRotate"),m=i.get("symbolKeepAspect"),v=i.get("icon"),_=function(t,e,n,i,r,o,a){function s(t,e){"auto"===t.lineWidth&&(t.lineWidth=e.lineWidth>0?2:0),VD(t,(function(n,i){"inherit"===t[i]&&(t[i]=e[i])}))}var l=e.getModel("itemStyle"),u=l.getItemStyle(),h=0===t.lastIndexOf("empty",0)?"fill":"stroke",c=l.getShallow("decal");u.decal=c&&"inherit"!==c?b_(c,a):i.decal,"inherit"===u.fill&&(u.fill=i[r]);"inherit"===u.stroke&&(u.stroke=i[h]);"inherit"===u.opacity&&(u.opacity=("fill"===r?i:n).opacity);s(u,i);var d=e.getModel("lineStyle"),f=d.getLineStyle();if(s(f,n),"auto"===u.fill&&(u.fill=i.fill),"auto"===u.stroke&&(u.stroke=i.fill),"auto"===f.stroke&&(f.stroke=i.fill),!o){var p=e.get("inactiveBorderWidth"),g=u[h];u.lineWidth="auto"===p?i.lineWidth>0&&g?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),f.stroke=d.get("inactiveColor"),f.lineWidth=d.get("inactiveWidth")}return{itemStyle:u,lineStyle:f}}(l=v||l||"roundRect",i,a,s,c,p,h),y=new GD,x=i.getModel("textStyle");if(!xt(t.getLegendIcon)||v&&"inherit"!==v){var w="inherit"===v&&t.getData().getVisual("symbol")?"inherit"===g?t.getData().getVisual("symbolRotate"):g:0;y.add(function(t){var e=t.icon||"roundRect",n=jv(e,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill,t.symbolKeepAspect);n.setStyle(t.itemStyle),n.rotation=(t.iconRotate||0)*Math.PI/180,n.setOrigin([t.itemWidth/2,t.itemHeight/2]),e.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2);return n}({itemWidth:d,itemHeight:f,icon:l,iconRotate:w,itemStyle:_.itemStyle,lineStyle:_.lineStyle,symbolKeepAspect:m}))}else y.add(t.getLegendIcon({itemWidth:d,itemHeight:f,icon:l,iconRotate:g,itemStyle:_.itemStyle,lineStyle:_.lineStyle,symbolKeepAspect:m}));var b="left"===o?d+5:-5,S=o,T=r.get("formatter"),M=e;wt(T)&&T?M=T.replace("{name}",null!=e?e:""):xt(T)&&(M=T(e));var C=p?x.getTextColor():i.get("inactiveColor");y.add(new eu({style:lh(x,{text:M,x:b,y:f/2,fill:C,align:S,verticalAlign:"middle"},{inheritColor:C})}));var L=new Fl({shape:y.getBoundingRect(),style:{fill:"transparent"}}),A=i.getModel("tooltip");return A.get("show")&&Am({el:L,componentModel:r,itemName:e,itemTooltipOption:A.option}),y.add(L),y.eachChild((function(t){t.silent=!0})),L.silent=!u,this.getContentGroup().add(y),Hu(y),y.__legendDataIndex=n,y},e.prototype.layoutInner=function(t,e,n,i,r,o){var a=this.getContentGroup(),s=this.getSelectorGroup();Ec(t.get("orient"),a,t.get("itemGap"),n.width,n.height);var l=a.getBoundingRect(),u=[-l.x,-l.y];if(s.markRedraw(),a.markRedraw(),r){Ec("horizontal",s,t.get("selectorItemGap",!0));var h=s.getBoundingRect(),c=[-h.x,-h.y],d=t.get("selectorButtonGap",!0),f=t.getOrient().index,p=0===f?"width":"height",g=0===f?"height":"width",m=0===f?"y":"x";"end"===o?c[f]+=l[p]+d:u[f]+=h[p]+d,c[1-f]+=l[g]/2-h[g]/2,s.x=c[0],s.y=c[1],a.x=u[0],a.y=u[1];var v={x:0,y:0};return v[p]=l[p]+d+h[p],v[g]=Math.max(l[g],h[g]),v[m]=Math.min(0,h[m]+c[1-f]),v}return a.x=u[0],a.y=u[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(Dp);function UD(t,e,n,i){ZD(t,e,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=t?t:e}),jD(t,e,n,i)}function WD(t){for(var e,n=t.getZr().storage.getDisplayList(),i=0,r=n.length;in[r],p=[-c.x,-c.y];e||(p[i]=l[s]);var g=[0,0],m=[-d.x,-d.y],v=Ot(t.get("pageButtonGap",!0),t.get("itemGap",!0));f&&("end"===t.get("pageButtonPosition",!0)?m[i]+=n[r]-d[r]:g[i]+=d[r]+v);m[1-i]+=c[o]/2-d[o]/2,l.setPosition(p),u.setPosition(g),h.setPosition(m);var _={x:0,y:0};if(_[r]=f?n[r]:c[r],_[o]=Math.max(c[o],d[o]),_[a]=Math.min(0,d[a]+m[1-i]),u.__rectSize=n[r],f){var y={x:0,y:0};y[r]=Math.max(n[r]-d[r]-v,0),y[o]=_[o],u.setClipPath(new Fl({shape:y})),u.__rectSize=y[r]}else h.eachChild((function(t){t.attr({invisible:!0,silent:!0})}));var x=this._getPageInfo(t);return null!=x.pageIndex&&Ju(l,{x:x.contentPosition[0],y:x.contentPosition[1]},f?t:null),this._updatePageInfoView(t,x),_},e.prototype._pageGo=function(t,e,n){var i=this._getPageInfo(e)[t];null!=i&&n.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:e.id})},e.prototype._updatePageInfoView=function(t,e){var n=this._controllerGroup;ct(["pagePrev","pageNext"],(function(i){var r=null!=e[i+"DataIndex"],o=n.childOfName(i);o&&(o.setStyle("fill",r?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),o.cursor=r?"pointer":"default")}));var i=n.childOfName("pageText"),r=t.get("pageFormatter"),o=e.pageIndex,a=null!=o?o+1:0,s=e.pageCount;i&&r&&i.setStyle("text",wt(r)?r.replace("{current}",null==a?"":a+"").replace("{total}",null==s?"":s+""):r({current:a,total:s}))},e.prototype._getPageInfo=function(t){var e=t.get("scrollDataIndex",!0),n=this.getContentGroup(),i=this._containerGroup.__rectSize,r=t.getOrient().index,o=eI[r],a=nI[r],s=this._findTargetItemIndex(e),l=n.children(),u=l[s],h=l.length,c=h?1:0,d={contentPosition:[n.x,n.y],pageCount:c,pageIndex:c-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!u)return d;var f=_(u);d.contentPosition[r]=-f.s;for(var p=s+1,g=f,m=f,v=null;p<=h;++p)(!(v=_(l[p]))&&m.e>g.s+i||v&&!y(v,g.s))&&(g=m.i>g.i?m:v)&&(null==d.pageNextDataIndex&&(d.pageNextDataIndex=g.i),++d.pageCount),m=v;for(p=s-1,g=f,m=f,v=null;p>=-1;--p)(v=_(l[p]))&&y(m,v.s)||!(g.i=e&&t.s<=e+i}},e.prototype._findTargetItemIndex=function(t){return this._showController?(this.getContentGroup().eachChild((function(i,r){var o=i.__legendDataIndex;null==n&&null!=o&&(n=r),o===t&&(e=r)})),null!=e?e:n):0;var e,n},e.type="legend.scroll",e}(XD);const rI=iI;function oI(t){Jw(JD),t.registerComponentModel($D),t.registerComponentView(rI),function(t){t.registerAction("legendScroll","legendscroll",(function(t,e){var n=t.scrollDataIndex;null!=n&&e.eachComponent({mainType:"legend",subType:"scroll",query:t},(function(t){t.setScrollDataIndex(n)}))}))}(t)}function aI(t,e){var n;return ct(e,(function(e){null!=t[e]&&"auto"!==t[e]&&(n=!0)})),n}var sI=["transition","enterFrom","leaveTo"],lI=sI.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function uI(t,e,n){if(n&&(!t[n]&&e[n]&&(t[n]={}),t=t[n],e=e[n]),t&&e)for(var i=n?sI:lI,r=0;r0&&(a.during=s?vt(bI,{el:e,userDuring:s}):null,a.setToFinal=!0,a.scope=t),rt(a,n[o]),a}function vI(t,e,n,i){var r=(i=i||{}).dataIndex,o=i.isInit,a=i.clearStyle,s=n.isAnimationEnabled(),l=gI(t),u=e.style;l.userDuring=e.during;var h={},c={};if(function(t,e,n){for(var i=0;i=0)){var c=t.getAnimationStyleProps(),d=c?c.style:null;if(d){!r&&(r=i.style={});var f=mt(n);for(u=0;u0&&t.animateFrom(d,f)}else!function(t,e,n,i,r){if(r){var o=mI("update",t,e,i,n);o.duration>0&&t.animateFrom(r,o)}}(t,e,r||0,n,h);_I(t,e),u?t.dirty():t.markRedraw()}function _I(t,e){for(var n=gI(t).leaveToProps,i=0;i=0){!o&&(o=i[t]={});var d=mt(a);for(h=0;h=0;l--){var d,f,p;if(p=null!=(f=Aa((d=n[l]).id,null))?r.get(f):null){var g=p.parent,m=(c=II(g),{}),v=Nc(p,d,g===i?{width:o,height:a}:{width:c.width,height:c.height},null,{hv:d.hv,boundingMode:d.bounding},m);if(!II(p).isNew&&v){for(var _=d.transition,y={},x=0;x=0)?y[w]=b:p[w]=b}Ju(p,y,t,0)}else p.attr(m)}}},e.prototype._clear=function(){var t=this,e=this._elMap;e.each((function(n){NI(n,II(n).option,e,t._lastGraphicModel)})),this._elMap=jt()},e.prototype.dispose=function(){this._clear()},e.type="graphic",e}(Dp);function EI(t){var e=new(Yt(DI,t)?DI[t]:lm(t))({});return II(e).type=t,e}function OI(t,e,n,i){var r=EI(n);return e.add(r),i.set(t,r),II(r).id=t,II(r).isNew=!0,r}function NI(t,e,n,i){t&&t.parent&&("group"===t.type&&t.traverse((function(t){NI(t,e,n,i)})),function(t,e,n,i){if(t){var r=t.parent,o=gI(t).leaveToProps;if(o){var a=mI("update",t,e,n,0);a.done=function(){r.remove(t),i&&i()},t.animateTo(o,a)}else r.remove(t),i&&i()}}(t,e,i),n.removeKey(II(t).id))}function RI(t,e,n,i){t.isGroup||ct([["cursor",Ts.prototype.cursor],["zlevel",i||0],["z",n||0],["z2",0]],(function(n){var i=n[0];Yt(e,i)?t[i]=Ot(e[i],n[1]):null==t[i]&&(t[i]=n[1])})),ct(mt(e),(function(n){if(0===n.indexOf("on")){var i=e[n];t[n]=xt(i)?i:null}})),Yt(e,"draggable")&&(t.draggable=e.draggable),null!=e.name&&(t.name=e.name),null!=e.id&&(t.id=e.id)}var kI=Math.sin,zI=Math.cos,BI=Math.PI,FI=2*Math.PI,VI=180/BI,GI=function(){function t(){}return t.prototype.reset=function(t){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,t||4)},t.prototype.moveTo=function(t,e){this._add("M",t,e)},t.prototype.lineTo=function(t,e){this._add("L",t,e)},t.prototype.bezierCurveTo=function(t,e,n,i,r,o){this._add("C",t,e,n,i,r,o)},t.prototype.quadraticCurveTo=function(t,e,n,i){this._add("Q",t,e,n,i)},t.prototype.arc=function(t,e,n,i,r,o){this.ellipse(t,e,n,n,0,i,r,o)},t.prototype.ellipse=function(t,e,n,i,r,o,a,s){var l=a-o,u=!s,h=Math.abs(l),c=$i(h-FI)||(u?l>=FI:-l>=FI),d=l>0?l%FI:l%FI+FI,f=!1;f=!!c||!$i(h)&&d>=BI==!!u;var p=t+n*zI(o),g=e+i*kI(o);this._start&&this._add("M",p,g);var m=Math.round(r*VI);if(c){var v=1/this._p,_=(u?1:-1)*(FI-v);this._add("A",n,i,m,1,+u,t+n*zI(o+_),e+i*kI(o+_)),v>.01&&this._add("A",n,i,m,0,+u,p,g)}else{var y=t+n*zI(a),x=e+i*kI(a);this._add("A",n,i,m,+f,+u,y,x)}},t.prototype.rect=function(t,e,n,i){this._add("M",t,e),this._add("l",n,0),this._add("l",0,i),this._add("l",-n,0),this._add("Z")},t.prototype.closePath=function(){this._d.length>0&&this._add("Z")},t.prototype._add=function(t,e,n,i,r,o,a,s,l){for(var u=[],h=this._p,c=1;c"}(r,o)+("style"!==r?ze(a):a||"")+(i?""+n+dt(i,(function(e){return t(e)})).join(n)+n:"")+("")}(t)}function tP(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function eP(t,e,n,i){return QI("svg","root",{width:t,height:e,xmlns:qI,"xmlns:xlink":YI,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+t+" "+e},n)}var nP=0;function iP(){return nP++}var rP={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},oP="transform-origin";function aP(t,e,n){var i=rt({},t.shape);rt(i,e),t.buildPath(n,i);var r=new HI;return r.reset(ur(t)),n.rebuildPath(r,1),r.generateStr(),r.getStr()}function sP(t,e){var n=e.originX,i=e.originY;(n||i)&&(t[oP]=n+"px "+i+"px")}var lP={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function uP(t,e){var n=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[n]=t,n}function hP(t){return wt(t)?rP[t]?"cubic-bezier("+rP[t]+")":vi(t)?t:"":""}function cP(t,e,n,i){var r=t.animators,o=r.length,a=[];if(t instanceof Fg){var s=function(t,e,n){var i,r,o=t.shape.paths,a={};if(ct(o,(function(t){var e=tP(n.zrId);e.animation=!0,cP(t,{},e,!0);var o=e.cssAnims,s=e.cssNodes,l=mt(o),u=l.length;if(u){var h=o[r=l[u-1]];for(var c in h){var d=h[c];a[c]=a[c]||{d:""},a[c].d+=d.d||""}for(var f in s){var p=s[f].animation;p.indexOf(r)>=0&&(i=p)}}})),i){e.d=!1;var s=uP(a,n);return i.replace(r,s)}}(t,e,n);if(s)a.push(s);else if(!o)return}else if(!o)return;for(var l={},u=0;u0})).length)return uP(h,n)+" "+r[0]+" both"}for(var m in l){(s=g(l[m]))&&a.push(s)}if(a.length){var v=n.zrId+"-cls-"+iP();n.cssNodes["."+v]={animation:a.join(",")},e.class=v}}function dP(t,e,n,i){var r=JSON.stringify(t),o=n.cssStyleCache[r];o||(o=n.zrId+"-cls-"+iP(),n.cssStyleCache[r]=o,n.cssNodes["."+o+(i?":hover":"")]=t),e.class=e.class?e.class+" "+o:o}var fP=Math.round;function pP(t){return t&&wt(t.src)}function gP(t){return t&&xt(t.toDataURL)}function mP(t,e,n,i){XI((function(r,o){var a="fill"===r||"stroke"===r;a&&sr(o)?LP(e,t,r,i):a&&rr(o)?AP(n,t,r,i):t[r]=o,a&&i.ssr&&"none"===o&&(t["pointer-events"]="visible")}),e,n,!1),function(t,e,n){var i=t.style;if(function(t){return t&&(t.shadowBlur||t.shadowOffsetX||t.shadowOffsetY)}(i)){var r=function(t){var e=t.style,n=t.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(",")}(t),o=n.shadowCache,a=o[r];if(!a){var s=t.getGlobalScale(),l=s[0],u=s[1];if(!l||!u)return;var h=i.shadowOffsetX||0,c=i.shadowOffsetY||0,d=i.shadowBlur,f=Ji(i.shadowColor),p=f.opacity,g=f.color,m=d/2/l+" "+d/2/u;a=n.zrId+"-s"+n.shadowIdx++,n.defs[a]=QI("filter",a,{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},[QI("feDropShadow","",{dx:h/l,dy:c/u,stdDeviation:m,"flood-color":g,"flood-opacity":p})]),o[r]=a}e.filter=lr(a)}}(n,t,i)}function vP(t,e){var n=Ho(e);n&&(n.each((function(e,n){null!=e&&(t[(KI+n).toLowerCase()]=e+"")})),e.isSilent()&&(t[KI+"silent"]="true"))}function _P(t){return $i(t[0]-1)&&$i(t[1])&&$i(t[2])&&$i(t[3]-1)}function yP(t,e,n){if(e&&(!function(t){return $i(t[4])&&$i(t[5])}(e)||!_P(e))){var i=n?10:1e4;t.transform=_P(e)?"translate("+fP(e[4]*i)/i+" "+fP(e[5]*i)/i+")":function(t){return"matrix("+tr(t[0])+","+tr(t[1])+","+tr(t[2])+","+tr(t[3])+","+er(t[4])+","+er(t[5])+")"}(e)}}function xP(t,e,n){for(var i=t.points,r=[],o=0;o=0&&a||o;s&&(r=Yi(s))}var l=i.lineWidth;l&&(l/=!i.strokeNoScale&&t.transform?t.transform[0]:1);var u={cursor:"pointer"};r&&(u.fill=r),i.stroke&&(u.stroke=i.stroke),l&&(u["stroke-width"]=l),dP(u,e,n,!0)}}(t,o,e),QI(s,t.id+"",o)}function CP(t,e){return t instanceof Tl?MP(t,e):t instanceof Pl?function(t,e){var n=t.style,i=n.image;if(i&&!wt(i)&&(pP(i)?i=i.src:gP(i)&&(i=i.toDataURL())),i){var r=n.x||0,o=n.y||0,a={href:i,width:n.width,height:n.height};return r&&(a.x=r),o&&(a.y=o),yP(a,t.transform),mP(a,n,t,e),vP(a,t),e.animation&&cP(t,a,e),QI("image",t.id+"",a)}}(t,e):t instanceof Ll?function(t,e){var n=t.style,i=n.text;if(null!=i&&(i+=""),i&&!isNaN(n.x)&&!isNaN(n.y)){var r=n.font||R,o=n.x||0,a=function(t,e,n){return"top"===n?t+=e/2:"bottom"===n&&(t-=e/2),t}(n.y||0,vo(r),n.textBaseline),s={"dominant-baseline":"central","text-anchor":nr[n.textAlign]||n.textAlign};if(ql(n)){var l="",u=n.fontStyle,h=Zl(n.fontSize);if(!parseFloat(h))return;var c=n.fontFamily||N,d=n.fontWeight;l+="font-size:"+h+";font-family:"+c+";",u&&"normal"!==u&&(l+="font-style:"+u+";"),d&&"normal"!==d&&(l+="font-weight:"+d+";"),s.style=l}else s.style="font: "+r;return i.match(/\s/)&&(s["xml:space"]="preserve"),o&&(s.x=o),a&&(s.y=a),yP(s,t.transform),mP(s,n,t,e),vP(s,t),e.animation&&cP(t,s,e),QI("text",t.id+"",s,void 0,i)}}(t,e):void 0}function LP(t,e,n,i){var r,o=t[n],a={gradientUnits:o.global?"userSpaceOnUse":"objectBoundingBox"};if(or(o))r="linearGradient",a.x1=o.x,a.y1=o.y,a.x2=o.x2,a.y2=o.y2;else{if(!ar(o))return void 0;r="radialGradient",a.cx=Ot(o.x,.5),a.cy=Ot(o.y,.5),a.r=Ot(o.r,.5)}for(var s=o.colorStops,l=[],u=0,h=s.length;ul?UP(t,null==n[c+1]?null:n[c+1].elm,n,s,c):WP(t,e,a,l))}(n,i,r):FP(r)?(FP(t.text)&&kP(n,""),UP(n,null,r,0,r.length-1)):FP(i)?WP(n,i,0,i.length-1):FP(t.text)&&kP(n,""):t.text!==e.text&&(FP(i)&&WP(n,i,0,i.length-1),kP(n,e.text)))}var XP=0,qP=function(){function t(t,e,n){if(this.type="svg",this.refreshHover=function(){0},this.configLayer=function(){0},this.storage=e,this._opts=n=rt({},n),this.root=t,this._id="zr"+XP++,this._oldVNode=eP(n.width,n.height),t&&!n.ssr){var i=this._viewport=document.createElement("div");i.style.cssText="position:relative;overflow:hidden";var r=this._svgDom=this._oldVNode.elm=JI("svg");jP(null,this._oldVNode),i.appendChild(r),t.appendChild(i)}this.resize(n.width,n.height)}return t.prototype.getType=function(){return this.type},t.prototype.getViewportRoot=function(){return this._viewport},t.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},t.prototype.getSvgDom=function(){return this._svgDom},t.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",function(t,e){if(GP(t,e))ZP(t,e);else{var n=t.elm,i=NP(n);HP(e),null!==i&&(PP(i,e.elm,RP(n)),WP(i,[t],0,0))}}(this._oldVNode,t),this._oldVNode=t}},t.prototype.renderOneToVNode=function(t){return CP(t,tP(this._id))},t.prototype.renderToVNode=function(t){t=t||{};var e=this.storage.getDisplayList(!0),n=this._width,i=this._height,r=tP(this._id);r.animation=t.animation,r.willUpdate=t.willUpdate,r.compress=t.compress,r.emphasis=t.emphasis,r.ssr=this._opts.ssr;var o=[],a=this._bgVNode=function(t,e,n,i){var r;if(n&&"none"!==n)if(r=QI("rect","bg",{width:t,height:e,x:"0",y:"0"}),sr(n))LP({fill:n},r.attrs,"fill",i);else if(rr(n))AP({style:{fill:n},dirty:Kt,getBoundingRect:function(){return{width:t,height:e}}},r.attrs,"fill",i);else{var o=Ji(n),a=o.color,s=o.opacity;r.attrs.fill=a,s<1&&(r.attrs["fill-opacity"]=s)}return r}(n,i,this._backgroundColor,r);a&&o.push(a);var s=t.compress?null:this._mainVNode=QI("g","main",{},[]);this._paintList(e,r,s?s.children:o),s&&o.push(s);var l=dt(mt(r.defs),(function(t){return r.defs[t]}));if(l.length&&o.push(QI("defs","defs",{},l)),t.animation){var u=function(t,e,n){var i=(n=n||{}).newline?"\n":"",r=" {"+i,o=i+"}",a=dt(mt(t),(function(e){return e+r+dt(mt(t[e]),(function(n){return n+":"+t[e][n]+";"})).join(i)+o})).join(i),s=dt(mt(e),(function(t){return"@keyframes "+t+r+dt(mt(e[t]),(function(n){return n+r+dt(mt(e[t][n]),(function(i){var r=e[t][n][i];return"d"===i&&(r='path("'+r+'")'),i+":"+r+";"})).join(i)+o})).join(i)+o})).join(i);return a||s?[""].join(i):""}(r.cssNodes,r.cssAnims,{newline:!0});if(u){var h=QI("style","stl",{},[],u);o.push(h)}}return eP(n,i,o,t.useViewBox)},t.prototype.renderToString=function(t){return t=t||{},$I(this.renderToVNode({animation:Ot(t.cssAnimation,!0),emphasis:Ot(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Ot(t.useViewBox,!0)}),{newline:!0})},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t},t.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},t.prototype._paintList=function(t,e,n){for(var i,r,o=t.length,a=[],s=0,l=0,u=0;u=0&&(!c||!r||c[p]!==r[p]);p--);for(var g=f-1;g>p;g--)i=a[--s-1];for(var m=p+1;m=a)}}for(var h=this.__startIndex;h15)break}n.prevElClipPaths&&c.restore()};if(f)if(0===f.length)s=l.__endIndex;else for(var x=d.dpr,w=0;w0&&t>i[0]){for(s=0;st);s++);a=n[i[s]]}if(i.splice(s+1,0,t),n[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?o.insertBefore(e.dom,l.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.painter||(e.painter=this)}},t.prototype.eachLayer=function(t,e){for(var n=this._zlevelList,i=0;i0?eE:0),this._needsManuallyCompositing),u.__builtin__||tt("ZLevel "+l+" has been used by unkown layer "+u.id),u!==o&&(u.__used=!0,u.__startIndex!==r&&(u.__dirty=!0),u.__startIndex=r,u.incremental?u.__drawIndex=-1:u.__drawIndex=r,e(r),o=u),s.__dirty&kn&&!s.__inHover&&(u.__dirty=!0,u.incremental&&u.__drawIndex<0&&(u.__drawIndex=r))}e(r),this.eachBuiltinLayer((function(t,e){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)}))},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(t){t.clear()},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t,ct(this._layers,(function(t){t.setUnpainted()}))},t.prototype.configLayer=function(t,e){if(e){var n=this._layerConfig;n[t]?nt(n[t],e,!0):n[t]=e;for(var i=0;i=400?t.onerror&&t.onerror():t.onload&&t.onload(e.response)},t.onerror&&(e.onerror=t.onerror),e.send(null)}};var vO,_O={supportWebGL:function(){if(null==vO)try{var t=document.createElement("canvas");if(!(t.getContext("webgl")||t.getContext("experimental-webgl")))throw new Error}catch(t){vO=!1}return vO}};_O.Int8Array="undefined"==typeof Int8Array?Array:Int8Array,_O.Uint8Array="undefined"==typeof Uint8Array?Array:Uint8Array,_O.Uint16Array="undefined"==typeof Uint16Array?Array:Uint16Array,_O.Uint32Array="undefined"==typeof Uint32Array?Array:Uint32Array,_O.Int16Array="undefined"==typeof Int16Array?Array:Int16Array,_O.Float32Array="undefined"==typeof Float32Array?Array:Float32Array,_O.Float64Array="undefined"==typeof Float64Array?Array:Float64Array;var yO={};"undefined"!=typeof window?yO=window:void 0!==n.g&&(yO=n.g),_O.requestAnimationFrame=yO.requestAnimationFrame||yO.msRequestAnimationFrame||yO.mozRequestAnimationFrame||yO.webkitRequestAnimationFrame||function(t){setTimeout(t,16)},_O.createCanvas=function(){return document.createElement("canvas")},_O.createImage=function(){return new yO.Image},_O.request={get:mO.get},_O.addEventListener=function(t,e,n,i){t.addEventListener(e,n,i)},_O.removeEventListener=function(t,e,n){t.removeEventListener(e,n)};const xO=_O;var wO=function(){this.head=null,this.tail=null,this._length=0};wO.prototype.insert=function(t){var e=new wO.Entry(t);return this.insertEntry(e),e},wO.prototype.insertAt=function(t,e){if(!(t<0)){for(var n=this.head,i=0;n&&i!=t;)n=n.next,i++;if(n){var r=new wO.Entry(e),o=n.prev;o?(o.next=r,r.prev=o):this.head=r,r.next=n,n.prev=r}else this.insert(e)}},wO.prototype.insertBeforeEntry=function(t,e){var n=new wO.Entry(t),i=e.prev;i?(i.next=n,n.prev=i):this.head=n,n.next=e,e.prev=n,this._length++},wO.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,this.tail=t):this.head=this.tail=t,this._length++},wO.prototype.remove=function(t){var e=t.prev,n=t.next;e?e.next=n:this.head=n,n?n.prev=e:this.tail=e,t.next=t.prev=null,this._length--},wO.prototype.removeAt=function(t){if(!(t<0)){for(var e=this.head,n=0;e&&n!=t;)e=e.next,n++;return e?(this.remove(e),e.value):void 0}},wO.prototype.getHead=function(){if(this.head)return this.head.value},wO.prototype.getTail=function(){if(this.tail)return this.tail.value},wO.prototype.getAt=function(t){if(!(t<0)){for(var e=this.head,n=0;e&&n!=t;)e=e.next,n++;return e.value}},wO.prototype.indexOf=function(t){for(var e=this.head,n=0;e;){if(e.value===t)return n;e=e.next,n++}},wO.prototype.length=function(){return this._length},wO.prototype.isEmpty=function(){return 0===this._length},wO.prototype.forEach=function(t,e){for(var n=this.head,i=0,r=void 0!==e;n;)r?t.call(e,n.value,i):t(n.value,i),n=n.next,i++},wO.prototype.clear=function(){this.tail=this.head=null,this._length=0},wO.Entry=function(t){this.value=t,this.next=null,this.prev=null};const bO=wO;var SO=function(t){this._list=new bO,this._map={},this._maxSize=t||10};SO.prototype.setMaxSize=function(t){this._maxSize=t},SO.prototype.put=function(t,e){if(!this._map.hasOwnProperty(t)){var n=this._list.length();if(n>=this._maxSize&&n>0){var i=this._list.head;this._list.remove(i),delete this._map[i.key]}var r=this._list.insert(e);r.key=t,this._map[t]=r}},SO.prototype.get=function(t){var e=this._map[t];if(this._map.hasOwnProperty(t))return e!==this._list.tail&&(this._list.remove(e),this._list.insertEntry(e)),e.value},SO.prototype.remove=function(t){var e=this._map[t];void 0!==e&&(delete this._map[t],this._list.remove(e))},SO.prototype.clear=function(){this._list.clear(),this._map={}};const TO=SO;var MO={},CO={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function LO(t){return(t=Math.round(t))<0?0:t>255?255:t}function AO(t){return t<0?0:t>1?1:t}function DO(t){return t.length&&"%"===t.charAt(t.length-1)?LO(parseFloat(t)/100*255):LO(parseInt(t,10))}function IO(t){return t.length&&"%"===t.charAt(t.length-1)?AO(parseFloat(t)/100):AO(parseFloat(t))}function PO(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function EO(t,e,n){return t+(e-t)*n}function OO(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function NO(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var RO=new TO(20),kO=null;function zO(t,e){kO&&NO(kO,e),kO=RO.put(t,kO||e.slice())}function BO(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=IO(t[1]),r=IO(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return OO(e=e||[],LO(255*PO(a,o,n+1/3)),LO(255*PO(a,o,n)),LO(255*PO(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}MO.parse=function(t,e){if(t){e=e||[];var n=RO.get(t);if(n)return NO(e,n);var i,r=(t+="").replace(/ /g,"").toLowerCase();if(r in CO)return NO(e,CO[r]),zO(t,e),e;if("#"===r.charAt(0))return 4===r.length?(i=parseInt(r.substr(1),16))>=0&&i<=4095?(OO(e,(3840&i)>>4|(3840&i)>>8,240&i|(240&i)>>4,15&i|(15&i)<<4,1),zO(t,e),e):void OO(e,0,0,0,1):7===r.length?(i=parseInt(r.substr(1),16))>=0&&i<=16777215?(OO(e,(16711680&i)>>16,(65280&i)>>8,255&i,1),zO(t,e),e):void OO(e,0,0,0,1):void 0;var o=r.indexOf("("),a=r.indexOf(")");if(-1!==o&&a+1===r.length){var s=r.substr(0,o),l=r.substr(o+1,a-(o+1)).split(","),u=1;switch(s){case"rgba":if(4!==l.length)return void OO(e,0,0,0,1);u=IO(l.pop());case"rgb":return 3!==l.length?void OO(e,0,0,0,1):(OO(e,DO(l[0]),DO(l[1]),DO(l[2]),u),zO(t,e),e);case"hsla":return 4!==l.length?void OO(e,0,0,0,1):(l[3]=IO(l[3]),BO(l,e),zO(t,e),e);case"hsl":return 3!==l.length?void OO(e,0,0,0,1):(BO(l,e),zO(t,e),e);default:return}}OO(e,0,0,0,1)}},MO.parseToFloat=function(t,e){if(e=MO.parse(t,e))return e[0]/=255,e[1]/=255,e[2]/=255,e},MO.lift=function(t,e){var n=MO.parse(t);if(n){for(var i=0;i<3;i++)n[i]=e<0?n[i]*(1-e)|0:(255-n[i])*e+n[i]|0;return MO.stringify(n,4===n.length?"rgba":"rgb")}},MO.toHex=function(t){var e=MO.parse(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)},MO.fastLerp=function(t,e,n){if(e&&e.length&&t>=0&&t<=1){n=n||[];var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=e[r],s=e[o],l=i-r;return n[0]=LO(EO(a[0],s[0],l)),n[1]=LO(EO(a[1],s[1],l)),n[2]=LO(EO(a[2],s[2],l)),n[3]=AO(EO(a[3],s[3],l)),n}},MO.fastMapToColor=MO.fastLerp,MO.lerp=function(t,e,n){if(e&&e.length&&t>=0&&t<=1){var i=t*(e.length-1),r=Math.floor(i),o=Math.ceil(i),a=MO.parse(e[r]),s=MO.parse(e[o]),l=i-r,u=MO.stringify([LO(EO(a[0],s[0],l)),LO(EO(a[1],s[1],l)),LO(EO(a[2],s[2],l)),AO(EO(a[3],s[3],l))],"rgba");return n?{color:u,leftIndex:r,rightIndex:o,value:i}:u}},MO.mapToColor=MO.lerp,MO.modifyHSL=function(t,e,n,i){if(t=MO.parse(t))return t=function(t){if(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(i,r,o),s=Math.max(i,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,n=0;else{n=u<.5?l/(s+a):l/(2-s-a);var h=((s-i)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;i===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,n,u];return null!=t[3]&&f.push(t[3]),f}}(t),null!=e&&(t[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=n&&(t[1]=IO(n)),null!=i&&(t[2]=IO(i)),MO.stringify(BO(t),"rgba");var r},MO.modifyAlpha=function(t,e){if((t=MO.parse(t))&&null!=e)return t[3]=AO(e),MO.stringify(t,"rgba")},MO.stringify=function(t,e){if(t&&t.length){var n=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(n+=","+t[3]),e+"("+n+")"}};var FO=MO.parseToFloat,VO={};function GO(t){var e=Object.keys(t);e.sort();for(var n=[],i=0;i=0},getEnabledUniforms:function(){return this._enabledUniforms},getTextureUniforms:function(){return this._textureUniforms},set:function(t,e){if("object"==typeof t)for(var n in t){var i=t[n];this.setUniform(n,i)}else this.setUniform(t,e)},get:function(t){var e=this.uniforms[t];if(e)return e.value},attachShader:function(t,e){var n=this.uniforms;this.uniforms=t.createUniforms(),this.shader=t;var i=this.uniforms;this._enabledUniforms=Object.keys(i),this._enabledUniforms.sort(),this._textureUniforms=this._enabledUniforms.filter((function(t){var e=this.uniforms[t].type;return"t"===e||"tv"===e}),this);var r=this.vertexDefines,o=this.fragmentDefines;if(this.vertexDefines=gE.clone(t.vertexDefines),this.fragmentDefines=gE.clone(t.fragmentDefines),e){for(var a in n)i[a]&&(i[a].value=n[a].value);gE.defaults(this.vertexDefines,r),gE.defaults(this.fragmentDefines,o)}var s={};for(var l in t.textures)s[l]={shaderType:t.textures[l].shaderType,type:t.textures[l].type,enabled:!(!e||!this._textureStatus[l])&&this._textureStatus[l].enabled};this._textureStatus=s,this._programKey=""},clone:function(){var t=new this.constructor({name:this.name,shader:this.shader});for(var e in this.uniforms)t.uniforms[e].value=this.uniforms[e].value;return t.depthTest=this.depthTest,t.depthMask=this.depthMask,t.transparent=this.transparent,t.blend=this.blend,t.vertexDefines=gE.clone(this.vertexDefines),t.fragmentDefines=gE.clone(this.fragmentDefines),t.enableTexture(this.getEnabledTextures()),t.precision=this.precision,t},define:function(t,e,n){var i=this.vertexDefines,r=this.fragmentDefines;"vertex"!==t&&"fragment"!==t&&"both"!==t&&arguments.length<3&&(n=e,e=t,t="both"),n=null!=n?n:null,"vertex"!==t&&"both"!==t||i[e]!==n&&(i[e]=n,this._programKey=""),"fragment"!==t&&"both"!==t||r[e]!==n&&(r[e]=n,"both"!==t&&(this._programKey=""))},undefine:function(t,e){"vertex"!==t&&"fragment"!==t&&"both"!==t&&arguments.length<2&&(e=t,t="both"),"vertex"!==t&&"both"!==t||this.isDefined("vertex",e)&&(delete this.vertexDefines[e],this._programKey=""),"fragment"!==t&&"both"!==t||this.isDefined("fragment",e)&&(delete this.fragmentDefines[e],"both"!==t&&(this._programKey=""))},isDefined:function(t,e){switch(t){case"vertex":return void 0!==this.vertexDefines[e];case"fragment":return void 0!==this.fragmentDefines[e]}},getDefine:function(t,e){switch(t){case"vertex":return this.vertexDefines[e];case"fragment":return this.fragmentDefines[e]}},enableTexture:function(t){if(Array.isArray(t))for(var e=0;e0&&(r=1/Math.sqrt(r),t[0]=e[0]*r,t[1]=e[1]*r),t},XO.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},XO.cross=function(t,e,n){var i=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=i,t},XO.lerp=function(t,e,n,i){var r=e[0],o=e[1];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t},XO.random=function(t,e){e=e||1;var n=2*GLMAT_RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},XO.transformMat2=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r,t[1]=n[1]*i+n[3]*r,t},XO.transformMat2d=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r+n[4],t[1]=n[1]*i+n[3]*r+n[5],t},XO.transformMat3=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[3]*r+n[6],t[1]=n[1]*i+n[4]*r+n[7],t},XO.transformMat4=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[4]*r+n[12],t[1]=n[1]*i+n[5]*r+n[13],t},XO.forEach=(UO=XO.create(),function(t,e,n,i,r,o){var a,s;for(e||(e=2),n||(n=0),s=i?Math.min(i*e+n,t.length):t.length,a=n;a0&&i.push("#define "+r.toUpperCase()+"_COUNT "+o)}if(n)for(var a=0;al.getMaxJointNumber()&&(d.USE_SKIN_MATRICES_TEXTURE=null),c+="\n"+aN(d)+"\n"}o&&(c+="\n#define INSTANCING\n");var f=c+aN(e.vertexDefines,s,h),p=c+aN(e.fragmentDefines,s,h),g=f+"\n"+e.shader.vertex,m=["OES_standard_derivatives","EXT_shader_texture_lod"].filter((function(t){return null!=l.getGLExtension(t)}));m.indexOf("EXT_shader_texture_lod")>=0&&(p+="\n#define SUPPORT_TEXTURE_LOD"),m.indexOf("OES_standard_derivatives")>=0&&(p+="\n#define SUPPORT_STANDARD_DERIVATIVES");var v,_,y=function(t){for(var e=[],n=0;n=0){if(1!==s&&4!==s){bN();break}s=2,u=[]}else if(1!==s)if(4!==s)h(c),s=0;else{var d=c;gN.indexOf(d)>=0||mN.indexOf(d)>=0||vN.indexOf(d)>=0?l[a].semantic=d:"ignore"===d||"unconfigurable"===d?l[a].ignore=!0:l[a].value="bool"===t?"true"===d:parseFloat(d)}else l[a].value="bool"===t?"true"===c:parseFloat(c),u=null;else{if(2!==s){bN();break}if(!(u instanceof Array)){bN();break}u.push(+i[++o])}else l[a].value=new xO.Float32Array(u),u=null,s=5;else if(2===s){if(!(u instanceof Array)){bN();break}u.push(+i[++o])}else s=5;else s=4;else{if(0!==s&&3!==s){bN();break}s=1}}return l}function TN(t,e){"object"==typeof t&&(e=t.fragment,t=t.vertex),t=wN(t),e=wN(e),this._shaderID=function(t,e){var n="vertex:"+t+"fragment:"+e;if(yN[n])return yN[n];var i=gE.genGUID();return yN[n]=i,xN[i]={vertex:t,fragment:e},i}(t,e),this._vertexCode=TN.parseImport(t),this._fragmentCode=TN.parseImport(e),this.attributeSemantics={},this.matrixSemantics={},this.uniformSemantics={},this.matrixSemanticKeys=[],this.uniformTemplates={},this.attributes={},this.textures={},this.vertexDefines={},this.fragmentDefines={},this._parseAttributes(),this._parseUniforms(),this._parseDefines()}TN.prototype={constructor:TN,createUniforms:function(){var t={};for(var e in this.uniformTemplates){var n=this.uniformTemplates[e];t[e]={type:n.type,value:n.value()}}return t},_parseImport:function(){this._vertexCode=TN.parseImport(this.vertex),this._fragmentCode=TN.parseImport(this.fragment)},_addSemanticUniform:function(t,e,n){if(gN.indexOf(n)>=0)this.attributeSemantics[n]={symbol:t,type:e};else if(vN.indexOf(n)>=0){var i=!1,r=n;n.match(/TRANSPOSE$/)&&(i=!0,r=n.slice(0,-9)),this.matrixSemantics[n]={symbol:t,type:e,isTranspose:i,semanticNoTranspose:r}}else mN.indexOf(n)>=0&&(this.uniformSemantics[n]={symbol:t,type:e})},_addMaterialUniform:function(t,e,n,i,r,o){o[t]={type:n,value:r?pN.array:i||pN[e],semantic:null}},_parseUniforms:function(){var t={},e=this,n="vertex";function i(t){return null!=t?function(){return t}:null}function r(r,o,a){var s=SN(o,a),l=[];for(var u in s){var h=s[u],c=h.semantic,d=u,f=dN[o],p=i(s[u].value);s[u].isArray&&(d+="["+s[u].arraySize+"]",f+="v"),l.push(d),e._uniformList.push(u),h.ignore||("sampler2D"!==o&&"samplerCube"!==o||(e.textures[u]={shaderType:n,type:o}),c?e._addSemanticUniform(u,f,c):e._addMaterialUniform(u,o,f,p,s[u].isArray,t))}return l.length>0?"uniform "+o+" "+l.join(",")+";\n":""}this._uniformList=[],this._vertexCode=this._vertexCode.replace(uN,r),n="fragment",this._fragmentCode=this._fragmentCode.replace(uN,r),e.matrixSemanticKeys=Object.keys(this.matrixSemantics),this.uniformTemplates=t},_parseAttributes:function(){var t={},e=this;this._vertexCode=this._vertexCode.replace(hN,(function(n,i,r){var o=SN(i,r),a=_N[i]||1,s=[];for(var l in o){var u=o[l].semantic;if(t[l]={type:"float",size:a,semantic:u||null},u){if(gN.indexOf(u)<0)throw new Error('Unkown semantic "'+u+'"');e.attributeSemantics[u]={symbol:l,type:i}}s.push(l)}return"attribute "+i+" "+s.join(",")+";\n"})),this.attributes=t},_parseDefines:function(){var t=this,e="vertex";function n(n,i,r){var o="vertex"===e?t.vertexDefines:t.fragmentDefines;return o[i]||(o[i]="false"!==r&&("true"===r||(r?isNaN(parseFloat(r))?r.trim():parseFloat(r):null))),""}this._vertexCode=this._vertexCode.replace(cN,n),e="fragment",this._fragmentCode=this._fragmentCode.replace(cN,n)},clone:function(){var t=xN[this._shaderID];return new TN(t.vertex,t.fragment)}},Object.defineProperty&&(Object.defineProperty(TN.prototype,"shaderID",{get:function(){return this._shaderID}}),Object.defineProperty(TN.prototype,"vertex",{get:function(){return this._vertexCode}}),Object.defineProperty(TN.prototype,"fragment",{get:function(){return this._fragmentCode}}),Object.defineProperty(TN.prototype,"uniforms",{get:function(){return this._uniformList}}));var MN=/(@import)\s*([0-9a-zA-Z_\-\.]*)/g;TN.parseImport=function(t){return t=t.replace(MN,(function(t,e,n){return(t=TN.source(n))?TN.parseImport(t):(console.error('Shader chunk "'+n+'" not existed in library'),"")}))};var CN=/(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g;TN.import=function(t){t.replace(CN,(function(t,e,n,i){if(i=i.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g,"")){for(var r,o=n.split("."),a=TN.codes,s=0;s 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n}\n@end";var DN={create:function(){var t=new jO(16);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},clone:function(t){var e=new jO(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},copy:function(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},identity:function(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},transpose:function(t,e){if(t===e){var n=e[1],i=e[2],r=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=o,t[11]=e[14],t[12]=r,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},invert:function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15],_=n*s-i*a,y=n*l-r*a,x=n*u-o*a,w=i*l-r*s,b=i*u-o*s,S=r*u-o*l,T=h*g-c*p,M=h*m-d*p,C=h*v-f*p,L=c*m-d*g,A=c*v-f*g,D=d*v-f*m,I=_*D-y*A+x*L+w*C-b*M+S*T;return I?(I=1/I,t[0]=(s*D-l*A+u*L)*I,t[1]=(r*A-i*D-o*L)*I,t[2]=(g*S-m*b+v*w)*I,t[3]=(d*b-c*S-f*w)*I,t[4]=(l*C-a*D-u*M)*I,t[5]=(n*D-r*C+o*M)*I,t[6]=(m*x-p*S-v*y)*I,t[7]=(h*S-d*x+f*y)*I,t[8]=(a*A-s*C+u*T)*I,t[9]=(i*C-n*A-o*T)*I,t[10]=(p*b-g*x+v*_)*I,t[11]=(c*x-h*b-f*_)*I,t[12]=(s*M-a*L-l*T)*I,t[13]=(n*L-i*M+r*T)*I,t[14]=(g*y-p*w-m*_)*I,t[15]=(h*w-c*y+d*_)*I,t):null},adjoint:function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15];return t[0]=s*(d*v-f*m)-c*(l*v-u*m)+g*(l*f-u*d),t[1]=-(i*(d*v-f*m)-c*(r*v-o*m)+g*(r*f-o*d)),t[2]=i*(l*v-u*m)-s*(r*v-o*m)+g*(r*u-o*l),t[3]=-(i*(l*f-u*d)-s*(r*f-o*d)+c*(r*u-o*l)),t[4]=-(a*(d*v-f*m)-h*(l*v-u*m)+p*(l*f-u*d)),t[5]=n*(d*v-f*m)-h*(r*v-o*m)+p*(r*f-o*d),t[6]=-(n*(l*v-u*m)-a*(r*v-o*m)+p*(r*u-o*l)),t[7]=n*(l*f-u*d)-a*(r*f-o*d)+h*(r*u-o*l),t[8]=a*(c*v-f*g)-h*(s*v-u*g)+p*(s*f-u*c),t[9]=-(n*(c*v-f*g)-h*(i*v-o*g)+p*(i*f-o*c)),t[10]=n*(s*v-u*g)-a*(i*v-o*g)+p*(i*u-o*s),t[11]=-(n*(s*f-u*c)-a*(i*f-o*c)+h*(i*u-o*s)),t[12]=-(a*(c*m-d*g)-h*(s*m-l*g)+p*(s*d-l*c)),t[13]=n*(c*m-d*g)-h*(i*m-r*g)+p*(i*d-r*c),t[14]=-(n*(s*m-l*g)-a*(i*m-r*g)+p*(i*l-r*s)),t[15]=n*(s*d-l*c)-a*(i*d-r*c)+h*(i*l-r*s),t},determinant:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],h=t[9],c=t[10],d=t[11],f=t[12],p=t[13],g=t[14],m=t[15];return(e*a-n*o)*(c*m-d*g)-(e*s-i*o)*(h*m-d*p)+(e*l-r*o)*(h*g-c*p)+(n*s-i*a)*(u*m-d*f)-(n*l-r*a)*(u*g-c*f)+(i*l-r*s)*(u*p-h*f)},multiply:function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],c=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],v=e[14],_=e[15],y=n[0],x=n[1],w=n[2],b=n[3];return t[0]=y*i+x*s+w*c+b*g,t[1]=y*r+x*l+w*d+b*m,t[2]=y*o+x*u+w*f+b*v,t[3]=y*a+x*h+w*p+b*_,y=n[4],x=n[5],w=n[6],b=n[7],t[4]=y*i+x*s+w*c+b*g,t[5]=y*r+x*l+w*d+b*m,t[6]=y*o+x*u+w*f+b*v,t[7]=y*a+x*h+w*p+b*_,y=n[8],x=n[9],w=n[10],b=n[11],t[8]=y*i+x*s+w*c+b*g,t[9]=y*r+x*l+w*d+b*m,t[10]=y*o+x*u+w*f+b*v,t[11]=y*a+x*h+w*p+b*_,y=n[12],x=n[13],w=n[14],b=n[15],t[12]=y*i+x*s+w*c+b*g,t[13]=y*r+x*l+w*d+b*m,t[14]=y*o+x*u+w*f+b*v,t[15]=y*a+x*h+w*p+b*_,t},multiplyAffine:function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[4],s=e[5],l=e[6],u=e[8],h=e[9],c=e[10],d=e[12],f=e[13],p=e[14],g=n[0],m=n[1],v=n[2];return t[0]=g*i+m*a+v*u,t[1]=g*r+m*s+v*h,t[2]=g*o+m*l+v*c,g=n[4],m=n[5],v=n[6],t[4]=g*i+m*a+v*u,t[5]=g*r+m*s+v*h,t[6]=g*o+m*l+v*c,g=n[8],m=n[9],v=n[10],t[8]=g*i+m*a+v*u,t[9]=g*r+m*s+v*h,t[10]=g*o+m*l+v*c,g=n[12],m=n[13],v=n[14],t[12]=g*i+m*a+v*u+d,t[13]=g*r+m*s+v*h+f,t[14]=g*o+m*l+v*c+p,t}};DN.mul=DN.multiply,DN.mulAffine=DN.multiplyAffine,DN.translate=function(t,e,n){var i,r,o,a,s,l,u,h,c,d,f,p,g=n[0],m=n[1],v=n[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*v+e[12],t[13]=e[1]*g+e[5]*m+e[9]*v+e[13],t[14]=e[2]*g+e[6]*m+e[10]*v+e[14],t[15]=e[3]*g+e[7]*m+e[11]*v+e[15]):(i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],c=e[8],d=e[9],f=e[10],p=e[11],t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=h,t[8]=c,t[9]=d,t[10]=f,t[11]=p,t[12]=i*g+s*m+c*v+e[12],t[13]=r*g+l*m+d*v+e[13],t[14]=o*g+u*m+f*v+e[14],t[15]=a*g+h*m+p*v+e[15]),t},DN.scale=function(t,e,n){var i=n[0],r=n[1],o=n[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},DN.rotate=function(t,e,n,i){var r,o,a,s,l,u,h,c,d,f,p,g,m,v,_,y,x,w,b,S,T,M,C,L,A=i[0],D=i[1],I=i[2],P=Math.sqrt(A*A+D*D+I*I);return Math.abs(P)0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},PN.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},PN.cross=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2];return t[0]=r*l-o*s,t[1]=o*a-i*l,t[2]=i*s-r*a,t},PN.lerp=function(t,e,n,i){var r=e[0],o=e[1],a=e[2];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t[2]=a+i*(n[2]-a),t},PN.random=function(t,e){e=e||1;var n=2*ZO()*Math.PI,i=2*ZO()-1,r=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*r,t[1]=Math.sin(n)*r,t[2]=i*e,t},PN.transformMat4=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[3]*i+n[7]*r+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*i+n[4]*r+n[8]*o+n[12])/a,t[1]=(n[1]*i+n[5]*r+n[9]*o+n[13])/a,t[2]=(n[2]*i+n[6]*r+n[10]*o+n[14])/a,t},PN.transformMat3=function(t,e,n){var i=e[0],r=e[1],o=e[2];return t[0]=i*n[0]+r*n[3]+o*n[6],t[1]=i*n[1]+r*n[4]+o*n[7],t[2]=i*n[2]+r*n[5]+o*n[8],t},PN.transformQuat=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2],u=n[3],h=u*i+s*o-l*r,c=u*r+l*i-a*o,d=u*o+a*r-s*i,f=-a*i-s*r-l*o;return t[0]=h*u+f*-a+c*-l-d*-s,t[1]=c*u+f*-s+d*-a-h*-l,t[2]=d*u+f*-l+h*-s-c*-a,t},PN.rotateX=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[0],o[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),o[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},PN.rotateY=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),o[1]=r[1],o[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},PN.rotateZ=function(t,e,n,i){var r=[],o=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],o[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),o[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),o[2]=r[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},PN.forEach=function(){var t=PN.create();return function(e,n,i,r,o,a){var s,l;for(n||(n=3),i||(i=0),l=r?Math.min(r*n+i,e.length):e.length,s=i;s1?0:Math.acos(r)};const EN=PN;LN.import(AN);var ON=IN.create,NN={};function RN(t){return t.material}function kN(t,e,n){return e.uniforms[n].value}function zN(t,e,n,i){return n!==i}function BN(t){return!0}function FN(){}var VN={float:jE,byte:FE,ubyte:VE,short:GE,ushort:HE};function GN(t,e,n){this.availableAttributes=t,this.availableAttributeSymbols=e,this.indicesBuffer=n,this.vao=null}function HN(t){var e,n;this.bind=function(t){e||((e=xO.createCanvas()).width=e.height=1,e.getContext("2d"));var i=t.gl,r=!n;r&&(n=i.createTexture()),i.bindTexture(i.TEXTURE_2D,n),r&&i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e)},this.unbind=function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},this.isRenderable=function(){return!0}}var UN=vE.extend((function(){return{canvas:null,_width:100,_height:100,devicePixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,clearColor:[0,0,0,0],clearBit:17664,alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,throwError:!0,gl:null,viewport:{},maxJointNumber:20,__currentFrameBuffer:null,_viewportStack:[],_clearStack:[],_sceneRendering:null}}),(function(){this.canvas||(this.canvas=xO.createCanvas());var t=this.canvas;try{var e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,preserveDrawingBuffer:this.preserveDrawingBuffer};if(this.gl=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!this.gl)throw new Error;this._glinfo=new xE(this.gl),this.gl.targetRenderer&&console.error("Already created a renderer"),this.gl.targetRenderer=this,this.resize()}catch(t){throw"Error creating WebGL Context "+t}this._programMgr=new lN(this),this._placeholderTexture=new HN(this)}),{resize:function(t,e){var n=this.canvas,i=this.devicePixelRatio;null!=t?(n.style&&(n.style.width=t+"px",n.style.height=e+"px"),n.width=t*i,n.height=e*i,this._width=t,this._height=e):(this._width=n.width/i,this._height=n.height/i),this.setViewport(0,0,this._width,this._height)},getWidth:function(){return this._width},getHeight:function(){return this._height},getViewportAspect:function(){var t=this.viewport;return t.width/t.height},setDevicePixelRatio:function(t){this.devicePixelRatio=t,this.resize(this._width,this._height)},getDevicePixelRatio:function(){return this.devicePixelRatio},getGLExtension:function(t){return this._glinfo.getExtension(t)},getGLParameter:function(t){return this._glinfo.getParameter(t)},setViewport:function(t,e,n,i,r){if("object"==typeof t){var o=t;t=o.x,e=o.y,n=o.width,i=o.height,r=o.devicePixelRatio}r=r||this.devicePixelRatio,this.gl.viewport(t*r,e*r,n*r,i*r),this.viewport={x:t,y:e,width:n,height:i,devicePixelRatio:r}},saveViewport:function(){this._viewportStack.push(this.viewport)},restoreViewport:function(){this._viewportStack.length>0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var t=this._clearStack.pop();this.clearColor=t.clearColor,this.clearBit=t.clearBit}},bindSceneRendering:function(t){this._sceneRendering=t},render:function(t,e,n,i){var r=this.gl,o=this.clearColor;if(this.clearBit){r.colorMask(!0,!0,!0,!0),r.depthMask(!0);var a=this.viewport,s=!1,l=a.devicePixelRatio;(a.width!==this._width||a.height!==this._height||l&&l!==this.devicePixelRatio||a.x||a.y)&&(s=!0,r.enable(r.SCISSOR_TEST),r.scissor(a.x*l,a.y*l,a.width*l,a.height*l)),r.clearColor(o[0],o[1],o[2],o[3]),r.clear(this.clearBit),s&&r.disable(r.SCISSOR_TEST)}if(n||t.update(!1),t.updateLights(),e=e||t.getMainCamera()){e.update();var u=t.updateRenderList(e,!0);this._sceneRendering=t;var h=u.opaque,c=u.transparent,d=t.material;t.trigger("beforerender",this,t,e,u),i?(this.renderPreZ(h,t,e),r.depthFunc(r.LEQUAL)):r.depthFunc(r.LESS);for(var f=ON(),p=EN.create(),g=0;g0){var s=t[r-1],l=s.joints?s.joints.length:0;if((o.joints?o.joints.length:0)===l&&o.material===s.material&&o.lightGroup===s.lightGroup){o.__program=s.__program;continue}}var u=this._programMgr.getProgram(o,a,e);this.validateProgram(u),o.__program=u}},renderPass:function(t,e,n){this.trigger("beforerenderpass",this,t,e,n),(n=n||{}).getMaterial=n.getMaterial||RN,n.getUniform=n.getUniform||kN,n.isMaterialChanged=n.isMaterialChanged||zN,n.beforeRender=n.beforeRender||FN,n.afterRender=n.afterRender||FN;var i=n.ifRender||BN;this.updatePrograms(t,this._sceneRendering,n),n.sortCompare&&t.sort(n.sortCompare);var r=this.viewport,o=r.devicePixelRatio,a=[r.x*o,r.y*o,r.width*o,r.height*o],s=this.devicePixelRatio,l=this.__currentFrameBuffer?[this.__currentFrameBuffer.getTextureWidth(),this.__currentFrameBuffer.getTextureHeight()]:[this._width*s,this._height*s],u=[a[2],a[3]],h=Date.now();e?(IN.copy(WN.VIEW,e.viewMatrix.array),IN.copy(WN.PROJECTION,e.projectionMatrix.array),IN.copy(WN.VIEWINVERSE,e.worldTransform.array)):(IN.identity(WN.VIEW),IN.identity(WN.PROJECTION),IN.identity(WN.VIEWINVERSE)),IN.multiply(WN.VIEWPROJECTION,WN.PROJECTION,WN.VIEW),IN.invert(WN.PROJECTIONINVERSE,WN.PROJECTION),IN.invert(WN.VIEWPROJECTIONINVERSE,WN.VIEWPROJECTION);for(var c,d,f,p,g,m,v,_,y,x,w,b,S=this.gl,T=this._sceneRendering,M=null,C=0;Cthis.getMaxJointNumber()){var o=r.getSubSkinMatricesTexture(t.__uid__,t.joints);e.useTextureSlot(this,o,n),e.setUniform(i,"1i","skinMatricesTexture",n),e.setUniform(i,"1f","skinMatricesTextureSize",o.width)}else{var a=r.getSubSkinMatrices(t.__uid__,t.joints);e.setUniformOfSemantic(i,"SKIN_MATRIX",a)}},_renderObject:function(t,e,n){var i=this.gl,r=t.geometry,o=t.mode;null==o&&(o=4);var a=null,s=t.isInstancedMesh&&t.isInstancedMesh();if(!s||(a=this.getGLExtension("ANGLE_instanced_arrays"))){var l;if(s&&(l=this._bindInstancedAttributes(t,n,a)),e.indicesBuffer){var u=this.getGLExtension("OES_element_index_uint")&&r.indices instanceof Uint32Array?i.UNSIGNED_INT:i.UNSIGNED_SHORT;s?a.drawElementsInstancedANGLE(o,e.indicesBuffer.count,u,0,t.getInstanceCount()):i.drawElements(o,e.indicesBuffer.count,u,0)}else s?a.drawArraysInstancedANGLE(o,0,r.vertexCount,t.getInstanceCount()):i.drawArrays(o,0,r.vertexCount);if(s)for(var h=0;hn?n:t}ZN.add=function(t,e,n){return EN.add(t.array,e.array,n.array),t._dirty=!0,t},ZN.set=function(t,e,n,i){EN.set(t.array,e,n,i),t._dirty=!0},ZN.copy=function(t,e){return EN.copy(t.array,e.array),t._dirty=!0,t},ZN.cross=function(t,e,n){return EN.cross(t.array,e.array,n.array),t._dirty=!0,t},ZN.distance=ZN.dist=function(t,e){return EN.distance(t.array,e.array)},ZN.div=function(t,e,n){return EN.divide(t.array,e.array,n.array),t._dirty=!0,t},ZN.divide=ZN.div,ZN.dot=function(t,e){return EN.dot(t.array,e.array)},ZN.len=function(t){return EN.length(t.array)},ZN.lerp=function(t,e,n,i){return EN.lerp(t.array,e.array,n.array,i),t._dirty=!0,t},ZN.min=function(t,e,n){return EN.min(t.array,e.array,n.array),t._dirty=!0,t},ZN.max=function(t,e,n){return EN.max(t.array,e.array,n.array),t._dirty=!0,t},ZN.mul=function(t,e,n){return EN.multiply(t.array,e.array,n.array),t._dirty=!0,t},ZN.multiply=ZN.mul,ZN.negate=function(t,e){return EN.negate(t.array,e.array),t._dirty=!0,t},ZN.normalize=function(t,e){return EN.normalize(t.array,e.array),t._dirty=!0,t},ZN.random=function(t,e){return EN.random(t.array,e),t._dirty=!0,t},ZN.scale=function(t,e,n){return EN.scale(t.array,e.array,n),t._dirty=!0,t},ZN.scaleAndAdd=function(t,e,n,i){return EN.scaleAndAdd(t.array,e.array,n.array,i),t._dirty=!0,t},ZN.squaredDistance=ZN.sqrDist=function(t,e){return EN.sqrDist(t.array,e.array)},ZN.squaredLength=ZN.sqrLen=function(t){return EN.sqrLen(t.array)},ZN.sub=function(t,e,n){return EN.subtract(t.array,e.array,n.array),t._dirty=!0,t},ZN.subtract=ZN.sub,ZN.transformMat3=function(t,e,n){return EN.transformMat3(t.array,e.array,n.array),t._dirty=!0,t},ZN.transformMat4=function(t,e,n){return EN.transformMat4(t.array,e.array,n.array),t._dirty=!0,t},ZN.transformQuat=function(t,e,n){return EN.transformQuat(t.array,e.array,n.array),t._dirty=!0,t};var KN=Math.atan2,JN=Math.asin,QN=Math.abs;ZN.eulerFromQuat=function(t,e,n){t._dirty=!0,e=e.array;var i=t.array,r=e[0],o=e[1],a=e[2],s=e[3],l=r*r,u=o*o,h=a*a,c=s*s;switch(n=(n||"XYZ").toUpperCase()){case"XYZ":i[0]=KN(2*(r*s-o*a),c-l-u+h),i[1]=JN(YN(2*(r*a+o*s),-1,1)),i[2]=KN(2*(a*s-r*o),c+l-u-h);break;case"YXZ":i[0]=JN(YN(2*(r*s-o*a),-1,1)),i[1]=KN(2*(r*a+o*s),c-l-u+h),i[2]=KN(2*(r*o+a*s),c-l+u-h);break;case"ZXY":i[0]=JN(YN(2*(r*s+o*a),-1,1)),i[1]=KN(2*(o*s-a*r),c-l-u+h),i[2]=KN(2*(a*s-r*o),c-l+u-h);break;case"ZYX":i[0]=KN(2*(r*s+a*o),c-l-u+h),i[1]=JN(YN(2*(o*s-r*a),-1,1)),i[2]=KN(2*(r*o+a*s),c+l-u-h);break;case"YZX":i[0]=KN(2*(r*s-a*o),c-l+u-h),i[1]=KN(2*(o*s-r*a),c+l-u-h),i[2]=JN(YN(2*(r*o+a*s),-1,1));break;case"XZY":i[0]=KN(2*(r*s+o*a),c-l+u-h),i[1]=KN(2*(r*a+o*s),c+l-u-h),i[2]=JN(YN(2*(a*s-r*o),-1,1));break;default:console.warn("Unkown order: "+n)}return t},ZN.eulerFromMat3=function(t,e,n){var i=e.array,r=i[0],o=i[3],a=i[6],s=i[1],l=i[4],u=i[7],h=i[2],c=i[5],d=i[8],f=t.array;switch(n=(n||"XYZ").toUpperCase()){case"XYZ":f[1]=JN(YN(a,-1,1)),QN(a)<.99999?(f[0]=KN(-u,d),f[2]=KN(-o,r)):(f[0]=KN(c,l),f[2]=0);break;case"YXZ":f[0]=JN(-YN(u,-1,1)),QN(u)<.99999?(f[1]=KN(a,d),f[2]=KN(s,l)):(f[1]=KN(-h,r),f[2]=0);break;case"ZXY":f[0]=JN(YN(c,-1,1)),QN(c)<.99999?(f[1]=KN(-h,d),f[2]=KN(-o,l)):(f[1]=0,f[2]=KN(s,r));break;case"ZYX":f[1]=JN(-YN(h,-1,1)),QN(h)<.99999?(f[0]=KN(c,d),f[2]=KN(s,r)):(f[0]=0,f[2]=KN(-o,l));break;case"YZX":f[2]=JN(YN(s,-1,1)),QN(s)<.99999?(f[0]=KN(-u,l),f[1]=KN(-h,r)):(f[0]=0,f[1]=KN(a,d));break;case"XZY":f[2]=JN(-YN(o,-1,1)),QN(o)<.99999?(f[0]=KN(c,l),f[1]=KN(a,r)):(f[0]=KN(-u,d),f[1]=0);break;default:console.warn("Unkown order: "+n)}return t._dirty=!0,t},Object.defineProperties(ZN,{POSITIVE_X:{get:function(){return new ZN(1,0,0)}},NEGATIVE_X:{get:function(){return new ZN(-1,0,0)}},POSITIVE_Y:{get:function(){return new ZN(0,1,0)}},NEGATIVE_Y:{get:function(){return new ZN(0,-1,0)}},POSITIVE_Z:{get:function(){return new ZN(0,0,1)}},NEGATIVE_Z:{get:function(){return new ZN(0,0,-1)}},UP:{get:function(){return new ZN(0,1,0)}},ZERO:{get:function(){return new ZN}}});const $N=ZN;var tR,eR,nR,iR,rR,oR=1e-5,aR=function(t,e){this.origin=t||new $N,this.direction=e||new $N};aR.prototype={constructor:aR,intersectPlane:function(t,e){var n=t.normal.array,i=t.distance,r=this.origin.array,o=this.direction.array,a=EN.dot(n,o);if(0===a)return null;e||(e=new $N);var s=(EN.dot(n,r)-i)/a;return EN.scaleAndAdd(e.array,r,o,-s),e._dirty=!0,e},mirrorAgainstPlane:function(t){var e=EN.dot(t.normal.array,this.direction.array);EN.scaleAndAdd(this.direction.array,this.direction.array,t.normal.array,2*-e),this.direction._dirty=!0},distanceToPoint:(rR=EN.create(),function(t){EN.sub(rR,t,this.origin.array);var e=EN.dot(rR,this.direction.array);if(e<0)return EN.distance(this.origin.array,t);var n=EN.lenSquared(rR);return Math.sqrt(n-e*e)}),intersectSphere:function(){var t=EN.create();return function(e,n,i){var r=this.origin.array,o=this.direction.array;e=e.array,EN.sub(t,e,r);var a=EN.dot(t,o),s=EN.squaredLength(t)-a*a,l=n*n;if(!(s>l)){var u=Math.sqrt(l-s),h=a-u,c=a+u;return i||(i=new $N),h<0?c<0?null:(EN.scaleAndAdd(i.array,r,o,c),i):(EN.scaleAndAdd(i.array,r,o,h),i)}}}(),intersectBoundingBox:function(t,e){var n,i,r,o,a,s,l=this.direction.array,u=this.origin.array,h=t.min.array,c=t.max.array,d=1/l[0],f=1/l[1],p=1/l[2];if(d>=0?(n=(h[0]-u[0])*d,i=(c[0]-u[0])*d):(i=(h[0]-u[0])*d,n=(c[0]-u[0])*d),f>=0?(r=(h[1]-u[1])*f,o=(c[1]-u[1])*f):(o=(h[1]-u[1])*f,r=(c[1]-u[1])*f),n>o||r>i)return null;if((r>n||n!=n)&&(n=r),(o=0?(a=(h[2]-u[2])*p,s=(c[2]-u[2])*p):(s=(h[2]-u[2])*p,a=(c[2]-u[2])*p),n>s||a>i)return null;if((a>n||n!=n)&&(n=a),(s=0?n:i;return e||(e=new $N),EN.scaleAndAdd(e.array,u,l,g),e},intersectTriangle:(tR=EN.create(),eR=EN.create(),nR=EN.create(),iR=EN.create(),function(t,e,n,i,r,o){var a=this.direction.array,s=this.origin.array;t=t.array,e=e.array,n=n.array,EN.sub(tR,e,t),EN.sub(eR,n,t),EN.cross(iR,eR,a);var l=EN.dot(tR,iR);if(i){if(l>-1e-5)return null}else if(l>-1e-5&&l1)return null;EN.cross(iR,tR,nR);var h=EN.dot(a,iR)/l;if(h<0||h>1||u+h>1)return null;EN.cross(iR,tR,eR);var c=-EN.dot(nR,iR)/l;return c<0?null:(r||(r=new $N),o&&$N.set(o,1-u-h,u,h),EN.scaleAndAdd(r.array,s,a,c),r)}),applyTransform:function(t){$N.add(this.direction,this.direction,this.origin),$N.transformMat4(this.origin,this.origin,t),$N.transformMat4(this.direction,this.direction,t),$N.sub(this.direction,this.direction,this.origin),$N.normalize(this.direction,this.direction)},copy:function(t){$N.copy(this.origin,t.origin),$N.copy(this.direction,t.direction)},clone:function(){var t=new aR;return t.copy(this),t}};const sR=aR;var lR={create:function(){var t=new jO(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},clone:function(t){var e=new jO(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},fromValues:function(t,e,n,i){var r=new jO(4);return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},set:function(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t},add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},subtract:function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}};lR.sub=lR.subtract,lR.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},lR.mul=lR.multiply,lR.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t},lR.div=lR.divide,lR.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},lR.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},lR.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},lR.scaleAndAdd=function(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t},lR.distance=function(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(n*n+i*i+r*r+o*o)},lR.dist=lR.distance,lR.squaredDistance=function(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],o=e[3]-t[3];return n*n+i*i+r*r+o*o},lR.sqrDist=lR.squaredDistance,lR.length=function(t){var e=t[0],n=t[1],i=t[2],r=t[3];return Math.sqrt(e*e+n*n+i*i+r*r)},lR.len=lR.length,lR.squaredLength=function(t){var e=t[0],n=t[1],i=t[2],r=t[3];return e*e+n*n+i*i+r*r},lR.sqrLen=lR.squaredLength,lR.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},lR.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},lR.normalize=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=n*n+i*i+r*r+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t[3]=e[3]*a),t},lR.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},lR.lerp=function(t,e,n,i){var r=e[0],o=e[1],a=e[2],s=e[3];return t[0]=r+i*(n[0]-r),t[1]=o+i*(n[1]-o),t[2]=a+i*(n[2]-a),t[3]=s+i*(n[3]-s),t},lR.random=function(t,e){return e=e||1,t[0]=ZO(),t[1]=ZO(),t[2]=ZO(),t[3]=ZO(),lR.normalize(t,t),lR.scale(t,t,e),t},lR.transformMat4=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3];return t[0]=n[0]*i+n[4]*r+n[8]*o+n[12]*a,t[1]=n[1]*i+n[5]*r+n[9]*o+n[13]*a,t[2]=n[2]*i+n[6]*r+n[10]*o+n[14]*a,t[3]=n[3]*i+n[7]*r+n[11]*o+n[15]*a,t},lR.transformQuat=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=n[0],s=n[1],l=n[2],u=n[3],h=u*i+s*o-l*r,c=u*r+l*i-a*o,d=u*o+a*r-s*i,f=-a*i-s*r-l*o;return t[0]=h*u+f*-a+c*-l-d*-s,t[1]=c*u+f*-s+d*-a-h*-l,t[2]=d*u+f*-l+h*-s-c*-a,t},lR.forEach=function(){var t=lR.create();return function(e,n,i,r,o,a){var s,l;for(n||(n=4),i||(i=0),l=r?Math.min(r*n+i,e.length):e.length,s=i;s.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(EN.cross(dR,e,n),t[0]=dR[0],t[1]=dR[1],t[2]=dR[2],t[3]=1+i,mR.normalize(t,t))}),mR.setAxes=(gR=cR.create(),function(t,e,n,i){return gR[0]=n[0],gR[3]=n[1],gR[6]=n[2],gR[1]=i[0],gR[4]=i[1],gR[7]=i[2],gR[2]=-e[0],gR[5]=-e[1],gR[8]=-e[2],mR.normalize(t,mR.fromMat3(t,gR))}),mR.clone=uR.clone,mR.fromValues=uR.fromValues,mR.copy=uR.copy,mR.set=uR.set,mR.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},mR.setAxisAngle=function(t,e,n){n*=.5;var i=Math.sin(n);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(n),t},mR.add=uR.add,mR.multiply=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=n[0],l=n[1],u=n[2],h=n[3];return t[0]=i*h+a*s+r*u-o*l,t[1]=r*h+a*l+o*s-i*u,t[2]=o*h+a*u+i*l-r*s,t[3]=a*h-i*s-r*l-o*u,t},mR.mul=mR.multiply,mR.scale=uR.scale,mR.rotateX=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+a*s,t[1]=r*l+o*s,t[2]=o*l-r*s,t[3]=a*l-i*s,t},mR.rotateY=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l-o*s,t[1]=r*l+a*s,t[2]=o*l+i*s,t[3]=a*l-r*s,t},mR.rotateZ=function(t,e,n){n*=.5;var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+r*s,t[1]=r*l-i*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t},mR.calculateW=function(t,e){var n=e[0],i=e[1],r=e[2];return t[0]=n,t[1]=i,t[2]=r,t[3]=Math.sqrt(Math.abs(1-n*n-i*i-r*r)),t},mR.dot=uR.dot,mR.lerp=uR.lerp,mR.slerp=function(t,e,n,i){var r,o,a,s,l,u=e[0],h=e[1],c=e[2],d=e[3],f=n[0],p=n[1],g=n[2],m=n[3];return(o=u*f+h*p+c*g+d*m)<0&&(o=-o,f=-f,p=-p,g=-g,m=-m),1-o>1e-6?(r=Math.acos(o),a=Math.sin(r),s=Math.sin((1-i)*r)/a,l=Math.sin(i*r)/a):(s=1-i,l=i),t[0]=s*u+l*f,t[1]=s*h+l*p,t[2]=s*c+l*g,t[3]=s*d+l*m,t},mR.invert=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=n*n+i*i+r*r+o*o,s=a?1/a:0;return t[0]=-n*s,t[1]=-i*s,t[2]=-r*s,t[3]=o*s,t},mR.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},mR.length=uR.length,mR.len=mR.length,mR.squaredLength=uR.squaredLength,mR.sqrLen=mR.squaredLength,mR.normalize=uR.normalize,mR.fromMat3=function(t,e){var n,i=e[0]+e[4]+e[8];if(i>0)n=Math.sqrt(i+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var r=0;e[4]>e[0]&&(r=1),e[8]>e[3*r+r]&&(r=2);var o=(r+1)%3,a=(r+2)%3;n=Math.sqrt(e[3*r+r]-e[3*o+o]-e[3*a+a]+1),t[r]=.5*n,n=.5/n,t[3]=(e[3*o+a]-e[3*a+o])*n,t[o]=(e[3*o+r]+e[3*r+o])*n,t[a]=(e[3*a+r]+e[3*r+a])*n}return t};const vR=mR;var _R,yR,xR,wR,bR=function(){this._axisX=new $N,this._axisY=new $N,this._axisZ=new $N,this.array=IN.create(),this._dirty=!0};bR.prototype={constructor:bR,setArray:function(t){for(var e=0;e0){var e=this.min,n=this.max,i=e.array,r=n.array;zR(i,t[0]),zR(r,t[0]);for(var o=1;or[0]&&(r[0]=a[0]),a[1]>r[1]&&(r[1]=a[1]),a[2]>r[2]&&(r[2]=a[2])}e._dirty=!0,n._dirty=!0}},union:function(t){var e=this.min,n=this.max;return EN.min(e.array,e.array,t.min.array),EN.max(n.array,n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},intersection:function(t){var e=this.min,n=this.max;return EN.max(e.array,e.array,t.min.array),EN.min(n.array,n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},intersectBoundingBox:function(t){var e=this.min.array,n=this.max.array,i=t.min.array,r=t.max.array;return!(e[0]>r[0]||e[1]>r[1]||e[2]>r[2]||n[0]=r[0]&&n[1]>=r[1]&&n[2]>=r[2]},containPoint:function(t){var e=this.min.array,n=this.max.array,i=t.array;return e[0]<=i[0]&&e[1]<=i[1]&&e[2]<=i[2]&&n[0]>=i[0]&&n[1]>=i[1]&&n[2]>=i[2]},isFinite:function(){var t=this.min.array,e=this.max.array;return isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])&&isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])},applyTransform:function(t){this.transformFrom(this,t)},transformFrom:(IR=EN.create(),PR=EN.create(),ER=EN.create(),OR=EN.create(),NR=EN.create(),RR=EN.create(),function(t,e){var n=t.min.array,i=t.max.array,r=e.array;return IR[0]=r[0]*n[0],IR[1]=r[1]*n[0],IR[2]=r[2]*n[0],PR[0]=r[0]*i[0],PR[1]=r[1]*i[0],PR[2]=r[2]*i[0],ER[0]=r[4]*n[1],ER[1]=r[5]*n[1],ER[2]=r[6]*n[1],OR[0]=r[4]*i[1],OR[1]=r[5]*i[1],OR[2]=r[6]*i[1],NR[0]=r[8]*n[2],NR[1]=r[9]*n[2],NR[2]=r[10]*n[2],RR[0]=r[8]*i[2],RR[1]=r[9]*i[2],RR[2]=r[10]*i[2],n=this.min.array,i=this.max.array,n[0]=Math.min(IR[0],PR[0])+Math.min(ER[0],OR[0])+Math.min(NR[0],RR[0])+r[12],n[1]=Math.min(IR[1],PR[1])+Math.min(ER[1],OR[1])+Math.min(NR[1],RR[1])+r[13],n[2]=Math.min(IR[2],PR[2])+Math.min(ER[2],OR[2])+Math.min(NR[2],RR[2])+r[14],i[0]=Math.max(IR[0],PR[0])+Math.max(ER[0],OR[0])+Math.max(NR[0],RR[0])+r[12],i[1]=Math.max(IR[1],PR[1])+Math.max(ER[1],OR[1])+Math.max(NR[1],RR[1])+r[13],i[2]=Math.max(IR[2],PR[2])+Math.max(ER[2],OR[2])+Math.max(NR[2],RR[2])+r[14],this.min._dirty=!0,this.max._dirty=!0,this}),applyProjection:function(t){var e=this.min.array,n=this.max.array,i=t.array,r=e[0],o=e[1],a=e[2],s=n[0],l=n[1],u=e[2],h=n[0],c=n[1],d=n[2];if(1===i[15])e[0]=i[0]*r+i[12],e[1]=i[5]*o+i[13],n[2]=i[10]*a+i[14],n[0]=i[0]*h+i[12],n[1]=i[5]*c+i[13],e[2]=i[10]*d+i[14];else{var f=-1/a;e[0]=i[0]*r*f,e[1]=i[5]*o*f,n[2]=(i[10]*a+i[14])*f,f=-1/u,n[0]=i[0]*s*f,n[1]=i[5]*l*f,f=-1/d,e[2]=(i[10]*d+i[14])*f}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var t=this.vertices;if(!t){t=[];for(var e=0;e<8;e++)t[e]=EN.fromValues(0,0,0);this.vertices=t}var n=this.min.array,i=this.max.array;return kR(t[0],n[0],n[1],n[2]),kR(t[1],n[0],i[1],n[2]),kR(t[2],i[0],n[1],n[2]),kR(t[3],i[0],i[1],n[2]),kR(t[4],n[0],n[1],i[2]),kR(t[5],n[0],i[1],i[2]),kR(t[6],i[0],n[1],i[2]),kR(t[7],i[0],i[1],i[2]),this},copy:function(t){var e=this.min,n=this.max;return zR(e.array,t.min.array),zR(n.array,t.max.array),e._dirty=!0,n._dirty=!0,this},clone:function(){var t=new BR;return t.copy(this),t}};const FR=BR;var VR,GR=0,HR=vE.extend({name:"",position:null,rotation:null,scale:null,worldTransform:null,localTransform:null,autoUpdateLocalTransform:!0,_parent:null,_scene:null,_needsUpdateWorldTransform:!0,_inIterating:!1,__depth:0},(function(){this.name||(this.name=(this.type||"NODE")+"_"+GR++),this.position||(this.position=new $N),this.rotation||(this.rotation=new DR),this.scale||(this.scale=new $N(1,1,1)),this.worldTransform=new MR,this.localTransform=new MR,this._children=[]}),{target:null,invisible:!1,isSkinnedMesh:function(){return!1},isRenderable:function(){return!1},setName:function(t){var e=this._scene;if(e){var n=e._nodeRepository;delete n[this.name],n[t]=this}this.name=t},add:function(t){var e=t._parent;if(e!==this){e&&e.remove(t),t._parent=this,this._children.push(t);var n=this._scene;n&&n!==t.scene&&t.traverse(this._addSelfToScene,this),t._needsUpdateWorldTransform=!0}},remove:function(t){var e=this._children,n=e.indexOf(t);n<0||(e.splice(n,1),t._parent=null,this._scene&&t.traverse(this._removeSelfFromScene,this))},removeAll:function(){for(var t=this._children,e=0;e0},beforeRender:function(t){},afterRender:function(t,e){},getBoundingBox:function(t,e){return e=UR.prototype.getBoundingBox.call(this,t,e),this.geometry&&this.geometry.boundingBox&&e.union(this.geometry.boundingBox),e},clone:(WR=["castShadow","receiveShadow","mode","culling","cullFace","frontFace","frustumCulling","renderOrder","lineWidth","ignorePicking","ignorePreZ","ignoreGBuffer"],function(){var t=UR.prototype.clone.call(this);t.geometry=this.geometry,t.material=this.material;for(var e=0;e=0&&w[y]>1e-4&&(EN.transformMat4(T,x,v[b[y]]),EN.scaleAndAdd(S,S,T,w[y]));M.set(_,S)}}for(_=0;_>e;return t+1},dispose:function(t){var e=this._cache;e.use(t.__uid__);var n=e.get("webgl_texture");n&&t.gl.deleteTexture(n),e.deleteContext(t.__uid__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty(QR.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty(QR.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}),QR.BYTE=FE,QR.UNSIGNED_BYTE=VE,QR.SHORT=GE,QR.UNSIGNED_SHORT=HE,QR.INT=UE,QR.UNSIGNED_INT=WE,QR.FLOAT=jE,QR.HALF_FLOAT=36193,QR.UNSIGNED_INT_24_8_WEBGL=34042,QR.DEPTH_COMPONENT=ZE,QR.DEPTH_STENCIL=cO,QR.ALPHA=XE,QR.RGB=qE,QR.RGBA=YE,QR.LUMINANCE=KE,QR.LUMINANCE_ALPHA=JE,QR.SRGB=35904,QR.SRGB_ALPHA=35906,QR.COMPRESSED_RGB_S3TC_DXT1_EXT=33776,QR.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777,QR.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778,QR.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779,QR.NEAREST=QE,QR.LINEAR=$E,QR.NEAREST_MIPMAP_NEAREST=tO,QR.LINEAR_MIPMAP_NEAREST=eO,QR.NEAREST_MIPMAP_LINEAR=nO,QR.LINEAR_MIPMAP_LINEAR=iO,QR.REPEAT=aO,QR.CLAMP_TO_EDGE=sO,QR.MIRRORED_REPEAT=lO;const $R=QR;var tk=ZR.extend({skeleton:null,joints:null},(function(){this.joints||(this.joints=[])}),{offsetMatrix:null,isInstancedMesh:function(){return!1},isSkinnedMesh:function(){return!!(this.skeleton&&this.joints&&this.joints.length>0)},clone:function(){var t=ZR.prototype.clone.call(this);return t.skeleton=this.skeleton,this.joints&&(t.joints=this.joints.slice()),t}});tk.POINTS=TE,tk.LINES=ME,tk.LINE_LOOP=CE,tk.LINE_STRIP=LE,tk.TRIANGLES=AE,tk.TRIANGLE_STRIP=DE,tk.TRIANGLE_FAN=IE,tk.BACK=RE,tk.FRONT=NE,tk.FRONT_AND_BACK=kE,tk.CW=zE,tk.CCW=BE;const ek=tk;var nk={isPowerOfTwo:function(t){return!(t&t-1)},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}};const ik=nk;var rk=ik.isPowerOfTwo;function ok(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}var ak=$R.extend((function(){return{image:null,pixels:null,mipmaps:[],convertToPOT:!1}}),{textureType:"texture2D",update:function(t){var e=t.gl;e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),this.updateCommon(t);var n=this.format,i=this.type,r=!(!this.convertToPOT||this.mipmaps.length||!this.image||this.wrapS!==$R.REPEAT&&this.wrapT!==$R.REPEAT||!this.NPOT);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,r?this.wrapS:this.getAvailableWrapS()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,r?this.wrapT:this.getAvailableWrapT()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r?this.magFilter:this.getAvailableMagFilter()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,r?this.minFilter:this.getAvailableMinFilter());var o=t.getGLExtension("EXT_texture_filter_anisotropic");(o&&this.anisotropic>1&&e.texParameterf(e.TEXTURE_2D,o.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i)&&(t.getGLExtension("OES_texture_half_float")||(i=jE));if(this.mipmaps.length)for(var a=this.width,s=this.height,l=0;l=$R.COMPRESSED_RGB_S3TC_DXT1_EXT?t.compressedTexImage2D(t.TEXTURE_2D,n,o,i,r,0,e.pixels):t.texImage2D(t.TEXTURE_2D,n,o,i,r,0,o,a,e.pixels)},generateMipmap:function(t){var e=t.gl;this.useMipmap&&!this.NPOT&&(e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),e.generateMipmap(e.TEXTURE_2D))},isPowerOfTwo:function(){return rk(this.width)&&rk(this.height)},isRenderable:function(){return this.image?this.image.width>0&&this.image.height>0:!(!this.width||!this.height)},bind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,this.getWebGLTexture(t))},unbind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},load:function(t,e){var n=xO.createImage();e&&(n.crossOrigin=e);var i=this;return n.onload=function(){i.dirty(),i.trigger("success",i)},n.onerror=function(){i.trigger("error",i)},n.src=t,this.image=n,this}});Object.defineProperty(ak.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(t){this.image?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}}),Object.defineProperty(ak.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(t){this.image?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});const sk=ak;function lk(t){return{byte:xO.Int8Array,ubyte:xO.Uint8Array,short:xO.Int16Array,ushort:xO.Uint16Array}[t]||xO.Float32Array}function uk(t){return"attr_"+t}function hk(t,e,n,i){switch(this.name=t,this.type=e,this.size=n,this.semantic=i||"",this.value=null,n){case 1:this.get=function(t){return this.value[t]},this.set=function(t,e){this.value[t]=e},this.copy=function(t,e){this.value[t]=this.value[t]};break;case 2:this.get=function(t,e){var n=this.value;return e[0]=n[2*t],e[1]=n[2*t+1],e},this.set=function(t,e){var n=this.value;n[2*t]=e[0],n[2*t+1]=e[1]},this.copy=function(t,e){var n=this.value;e*=2,n[t*=2]=n[e],n[t+1]=n[e+1]};break;case 3:this.get=function(t,e){var n=3*t,i=this.value;return e[0]=i[n],e[1]=i[n+1],e[2]=i[n+2],e},this.set=function(t,e){var n=3*t,i=this.value;i[n]=e[0],i[n+1]=e[1],i[n+2]=e[2]},this.copy=function(t,e){var n=this.value;e*=3,n[t*=3]=n[e],n[t+1]=n[e+1],n[t+2]=n[e+2]};break;case 4:this.get=function(t,e){var n=this.value,i=4*t;return e[0]=n[i],e[1]=n[i+1],e[2]=n[i+2],e[3]=n[i+3],e},this.set=function(t,e){var n=this.value,i=4*t;n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2],n[i+3]=e[3]},this.copy=function(t,e){var n=this.value;e*=4,n[t*=4]=n[e],n[t+1]=n[e+1],n[t+2]=n[e+2],n[t+3]=n[e+3]}}}function ck(t,e,n,i,r){this.name=t,this.type=e,this.buffer=n,this.size=i,this.semantic=r,this.symbol="",this.needsRemove=!1}function dk(t){this.buffer=t,this.count=0}hk.prototype.init=function(t){if(!this.value||this.value.length!==t*this.size){var e=lk(this.type);this.value=new e(t*this.size)}},hk.prototype.fromArray=function(t){var e,n=lk(this.type);if(t[0]&&t[0].length){var i=0,r=this.size;e=new n(t.length*r);for(var o=0;o=0){e||(e=[]);var n=this.indices;return e[0]=n[3*t],e[1]=n[3*t+1],e[2]=n[3*t+2],e}},setTriangleIndices:function(t,e){var n=this.indices;n[3*t]=e[0],n[3*t+1]=e[1],n[3*t+2]=e[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(t){var e,n=this.vertexCount>65535?xO.Uint32Array:xO.Uint16Array;if(t[0]&&t[0].length){var i=0;e=new n(3*t.length);for(var r=0;r=0&&(e.splice(n,1),delete this.attributes[t],!0)},getAttribute:function(t){return this.attributes[t]},getEnabledAttributes:function(){var t=this._enabledAttributes,e=this._attributeList;if(t)return t;for(var n=[],i=this.vertexCount,r=0;ro[0]&&(o[0]=s),l>o[1]&&(o[1]=l),u>o[2]&&(o[2]=u)}n._dirty=!0,i._dirty=!0}},generateVertexNormals:function(){if(this.vertexCount){var t=this.indices,e=this.attributes,n=e.position.value,i=e.normal.value;if(i&&i.length===n.length)for(var r=0;r65535&&(this.indices=new xO.Uint32Array(this.indices));for(var t=this.attributes,e=this.indices,n=this.getEnabledAttributes(),i={},r=0;rthis.distance,r=1;r<8;r++)if(EN.dot(e[r].array,n)>this.distance!=i)return!0},intersectLine:(Ek=EN.create(),function(t,e,n){var i=this.distanceToPoint(t),r=this.distanceToPoint(e);if(i>0&&r>0||i<0&&r<0)return null;var o=this.normal.array,a=this.distance,s=t.array;EN.sub(Ek,e.array,t.array),EN.normalize(Ek,Ek);var l=EN.dot(o,Ek);if(0===l)return null;n||(n=new $N);var u=(EN.dot(o,s)-a)/l;return EN.scaleAndAdd(n.array,s,Ek,-u),n._dirty=!0,n}),applyTransform:(Dk=IN.create(),Ik=uR.create(),Pk=uR.create(),Pk[3]=1,function(t){t=t.array,EN.scale(Pk,this.normal.array,this.distance),uR.transformMat4(Pk,Pk,t),this.distance=EN.dot(Pk,this.normal.array),IN.invert(Dk,t),IN.transpose(Dk,Dk),Ik[3]=0,EN.copy(Ik,this.normal.array),uR.transformMat4(Ik,Ik,Dk),EN.copy(this.normal.array,Ik)}),copy:function(t){EN.copy(this.normal.array,t.normal.array),this.normal._dirty=!0,this.distance=t.distance},clone:function(){var t=new Ok;return t.copy(this),t}};const Nk=Ok;var Rk,kk=EN.set,zk=EN.copy,Bk=EN.transformMat4,Fk=Math.min,Vk=Math.max,Gk=function(){this.planes=[];for(var t=0;t<6;t++)this.planes.push(new Nk);this.boundingBox=new FR,this.vertices=[];for(t=0;t<8;t++)this.vertices[t]=EN.fromValues(0,0,0)};Gk.prototype={setFromProjection:function(t){var e=this.planes,n=t.array,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],l=n[5],u=n[6],h=n[7],c=n[8],d=n[9],f=n[10],p=n[11],g=n[12],m=n[13],v=n[14],_=n[15];kk(e[0].normal.array,a-i,h-s,p-c),e[0].distance=-(_-g),e[0].normalize(),kk(e[1].normal.array,a+i,h+s,p+c),e[1].distance=-(_+g),e[1].normalize(),kk(e[2].normal.array,a+r,h+l,p+d),e[2].distance=-(_+m),e[2].normalize(),kk(e[3].normal.array,a-r,h-l,p-d),e[3].distance=-(_-m),e[3].normalize(),kk(e[4].normal.array,a-o,h-u,p-f),e[4].distance=-(_-v),e[4].normalize(),kk(e[5].normal.array,a+o,h+u,p+f),e[5].distance=-(_+v),e[5].normalize();var y=this.boundingBox,x=this.vertices;if(0===_){var w=l/i,b=-v/(f-1),S=-v/(f+1),T=-S/l,M=-b/l;y.min.set(-T*w,-T,S),y.max.set(T*w,T,b),kk(x[0],-T*w,-T,S),kk(x[1],-T*w,T,S),kk(x[2],T*w,-T,S),kk(x[3],T*w,T,S),kk(x[4],-M*w,-M,b),kk(x[5],-M*w,M,b),kk(x[6],M*w,-M,b),kk(x[7],M*w,M,b)}else{var C=(-1-g)/i,L=(1-g)/i,A=(1-m)/l,D=(-1-m)/l,I=(-1-v)/f,P=(1-v)/f;y.min.set(Math.min(C,L),Math.min(D,A),Math.min(P,I)),y.max.set(Math.max(L,C),Math.max(A,D),Math.max(I,P));var E=y.min.array,O=y.max.array;kk(x[0],E[0],E[1],E[2]),kk(x[1],E[0],O[1],E[2]),kk(x[2],O[0],E[1],E[2]),kk(x[3],O[0],O[1],E[2]),kk(x[4],E[0],E[1],O[2]),kk(x[5],E[0],O[1],O[2]),kk(x[6],O[0],E[1],O[2]),kk(x[7],O[0],O[1],O[2])}},getTransformedBoundingBox:(Rk=EN.create(),function(t,e){var n=this.vertices,i=e.array,r=t.min,o=t.max,a=r.array,s=o.array,l=n[0];Bk(Rk,l,i),zk(a,Rk),zk(s,Rk);for(var u=1;u<8;u++)l=n[u],Bk(Rk,l,i),a[0]=Fk(Rk[0],a[0]),a[1]=Fk(Rk[1],a[1]),a[2]=Fk(Rk[2],a[2]),s[0]=Vk(Rk[0],s[0]),s[1]=Vk(Rk[1],s[1]),s[2]=Vk(Rk[2],s[2]);return r._dirty=!0,o._dirty=!0,t})};const Hk=Gk;var Uk,Wk=UR.extend((function(){return{projectionMatrix:new MR,invProjectionMatrix:new MR,viewMatrix:new MR,frustum:new Hk}}),(function(){this.update(!0)}),{update:function(t){UR.prototype.update.call(this,t),MR.invert(this.viewMatrix,this.worldTransform),this.updateProjectionMatrix(),MR.invert(this.invProjectionMatrix,this.projectionMatrix),this.frustum.setFromProjection(this.projectionMatrix)},setViewMatrix:function(t){MR.copy(this.viewMatrix,t),MR.invert(this.worldTransform,t),this.decomposeWorldTransform()},decomposeProjectionMatrix:function(){},setProjectionMatrix:function(t){MR.copy(this.projectionMatrix,t),MR.invert(this.invProjectionMatrix,t),this.decomposeProjectionMatrix()},updateProjectionMatrix:function(){},castRay:(Uk=uR.create(),function(t,e){var n=void 0!==e?e:new sR,i=t.array[0],r=t.array[1];return uR.set(Uk,i,r,-1,1),uR.transformMat4(Uk,Uk,this.invProjectionMatrix.array),uR.transformMat4(Uk,Uk,this.worldTransform.array),EN.scale(n.origin.array,Uk,1/Uk[3]),uR.set(Uk,i,r,1,1),uR.transformMat4(Uk,Uk,this.invProjectionMatrix.array),uR.transformMat4(Uk,Uk,this.worldTransform.array),EN.scale(Uk,Uk,1/Uk[3]),EN.sub(n.direction.array,Uk,n.origin.array),EN.normalize(n.direction.array,n.direction.array),n.direction._dirty=!0,n.origin._dirty=!0,n})});const jk=Wk;var Zk=IN.create(),Xk=IN.create(),qk={};function Yk(t){var e=[],n=Object.keys(t);n.sort();for(var i=0;i0&&console.warn("Found multiple camera in one scene. Use the fist one."),this._cameraList.push(t)):t instanceof Ak&&this.lights.push(t),t.name&&(this._nodeRepository[t.name]=t)},removeFromScene:function(t){var e;t instanceof jk?(e=this._cameraList.indexOf(t))>=0&&this._cameraList.splice(e,1):t instanceof Ak&&(e=this.lights.indexOf(t))>=0&&this.lights.splice(e,1),t.name&&delete this._nodeRepository[t.name]},getNode:function(t){return this._nodeRepository[t]},setMainCamera:function(t){var e=this._cameraList.indexOf(t);e>=0&&this._cameraList.splice(e,1),this._cameraList.unshift(t)},getMainCamera:function(){return this._cameraList[0]},getLights:function(){return this.lights},updateLights:function(){var t=this.lights;this._previousLightNumber=this._lightNumber;for(var e={},n=0;n0&&this._doUpdateRenderList(a,e,n,i,r)}},isFrustumCulled:(Jk=new FR,Qk=new MR,function(t,e,n){var i=t.boundingBox;if(i||(i=t.skeleton&&t.skeleton.boundingBox?t.skeleton.boundingBox:t.geometry.boundingBox),!i)return!1;if(Qk.array=n,Jk.transformFrom(i,Qk),t.castShadow&&this.viewBoundingBoxLastFrame.union(Jk),t.frustumCulling){if(!Jk.intersectBoundingBox(e.frustum.boundingBox))return!0;Qk.array=e.projectionMatrix.array,Jk.max.array[2]>0&&Jk.min.array[2]<0&&(Jk.max.array[2]=-1e-20),Jk.applyProjection(Qk);var r=Jk.min.array,o=Jk.max.array;if(o[0]<-1||r[0]>1||o[1]<-1||r[1]>1||o[2]<-1||r[2]>1)return!0}return!1}),_updateLightUniforms:function(){var t=this.lights;t.sort(tz);var e=this._lightUniforms;for(var n in e)for(var i in e[n])e[n][i].value.length=0;for(var r=0;r=this._maxSize&&o>0){var s=n.head;n.remove(s),delete i[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new nz(e),a.key=t,n.insertEntry(a),i[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],n=this._list;if(null!=e)return e!==n.tail&&(n.remove(e),n.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();const oz=rz;var az=ik.isPowerOfTwo,sz=["px","nx","py","ny","pz","nz"],lz=$R.extend((function(){return{image:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},pixels:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},mipmaps:[]}}),{textureType:"textureCube",update:function(t){var e=t.gl;e.bindTexture(e.TEXTURE_CUBE_MAP,this._cache.get("webgl_texture")),this.updateCommon(t);var n=this.format,i=this.type;e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,this.getAvailableWrapS()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,this.getAvailableWrapT()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,this.getAvailableMagFilter()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,this.getAvailableMinFilter());var r=t.getGLExtension("EXT_texture_filter_anisotropic");(r&&this.anisotropic>1&&e.texParameterf(e.TEXTURE_CUBE_MAP,r.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i)&&(t.getGLExtension("OES_texture_half_float")||(i=jE));if(this.mipmaps.length)for(var o=this.width,a=this.height,s=0;s0&&t.height>0}Object.defineProperty(lz.prototype,"width",{get:function(){return this.image&&this.image.px?this.image.px.width:this._width},set:function(t){this.image&&this.image.px?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}}),Object.defineProperty(lz.prototype,"height",{get:function(){return this.image&&this.image.px?this.image.px.height:this._height},set:function(t){this.image&&this.image.px?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});const hz=lz;var cz=jk.extend({fov:50,aspect:1,near:.1,far:2e3},{updateProjectionMatrix:function(){var t=this.fov/180*Math.PI;this.projectionMatrix.perspective(t,this.aspect,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array,e=2*Math.atan(1/t[5]);this.fov=e/Math.PI*180,this.aspect=t[5]/t[0],this.near=t[14]/(t[10]-1),this.far=t[14]/(t[10]+1)},clone:function(){var t=jk.prototype.clone.call(this);return t.fov=this.fov,t.aspect=this.aspect,t.near=this.near,t.far=this.far,t}});const dz=cz;var fz="framebuffer",pz="renderbuffer",gz=pz+"_width",mz=pz+"_height",vz=pz+"_attached",_z="depthtexture_attached",yz=uO,xz=hO,wz=fO,bz=dO,Sz=vE.extend({depthBuffer:!0,viewport:null,_width:0,_height:0,_textures:null,_boundRenderer:null},(function(){this._cache=new JR,this._textures={}}),{getTextureWidth:function(){return this._width},getTextureHeight:function(){return this._height},bind:function(t){if(t.__currentFrameBuffer){if(t.__currentFrameBuffer===this)return;console.warn("Renderer already bound with another framebuffer. Unbind it first")}t.__currentFrameBuffer=this;var e=t.gl;e.bindFramebuffer(yz,this._getFrameBufferGL(t)),this._boundRenderer=t;var n=this._cache;n.put("viewport",t.viewport);var i,r,o=!1;for(var a in this._textures){o=!0;var s=this._textures[a];s&&(i=s.texture.width,r=s.texture.height,this._doAttach(t,s.texture,a,s.target))}this._width=i,this._height=r,!o&&this.depthBuffer&&console.error("Must attach texture before bind, or renderbuffer may have incorrect width and height."),this.viewport?t.setViewport(this.viewport):t.setViewport(0,0,i,r,1);var l=n.get("attached_textures");if(l)for(var a in l)if(!this._textures[a]){var u=l[a];this._doDetach(e,a,u)}if(!n.get(_z)&&this.depthBuffer){n.miss(pz)&&n.put(pz,e.createRenderbuffer());var h=n.get(pz);i===n.get(gz)&&r===n.get(mz)||(e.bindRenderbuffer(xz,h),e.renderbufferStorage(xz,e.DEPTH_COMPONENT16,i,r),n.put(gz,i),n.put(mz,r),e.bindRenderbuffer(xz,null)),n.get(vz)||(e.framebufferRenderbuffer(yz,wz,xz,h),n.put(vz,!0))}},unbind:function(t){t.__currentFrameBuffer=null,t.gl.bindFramebuffer(yz,null),this._boundRenderer=null,this._cache.use(t.__uid__);var e=this._cache.get("viewport");e&&t.setViewport(e),this.updateMipmap(t)},updateMipmap:function(t){var e=t.gl;for(var n in this._textures){var i=this._textures[n];if(i){var r=i.texture;if(!r.NPOT&&r.useMipmap&&r.minFilter===$R.LINEAR_MIPMAP_LINEAR){var o="textureCube"===r.textureType?oO:rO;e.bindTexture(o,r.getWebGLTexture(t)),e.generateMipmap(o),e.bindTexture(o,null)}}}},checkStatus:function(t){return t.checkFramebufferStatus(yz)},_getFrameBufferGL:function(t){var e=this._cache;return e.use(t.__uid__),e.miss(fz)&&e.put(fz,t.gl.createFramebuffer()),e.get(fz)},attach:function(t,e,n){if(!t.width)throw new Error("The texture attached to color buffer is not a valid.");e=e||bz,n=n||rO;var i,r=this._boundRenderer;if(r&&r.gl){var o=this._cache;o.use(r.__uid__),i=o.get("attached_textures")}var a=this._textures[e];if(!a||a.target!==n||a.texture!==t||!i||null==i[e]){var s=!0;r&&(s=this._doAttach(r,t,e,n),this.viewport||r.setViewport(0,0,t.width,t.height,1)),s&&(this._textures[e]=this._textures[e]||{},this._textures[e].texture=t,this._textures[e].target=n)}},_doAttach:function(t,e,n,i){var r=t.gl,o=e.getWebGLTexture(t),a=this._cache.get("attached_textures");if(a&&a[n]){var s=a[n];if(s.texture===e&&s.target===i)return}var l=!0;if(((n=+n)===wz||n===gO)&&(t.getGLExtension("WEBGL_depth_texture")||(console.error("Depth texture is not supported by the browser"),l=!1),e.format!==ZE&&e.format!==cO&&(console.error("The texture attached to depth buffer is not a valid."),l=!1),l)){var u=this._cache.get(pz);u&&(r.framebufferRenderbuffer(yz,wz,xz,null),r.deleteRenderbuffer(u),this._cache.put(pz,!1)),this._cache.put(vz,!1),this._cache.put(_z,!0)}return r.framebufferTexture2D(yz,n,i,o,0),a||(a={},this._cache.put("attached_textures",a)),a[n]=a[n]||{},a[n].texture=e,a[n].target=i,l},_doDetach:function(t,e,n){t.framebufferTexture2D(yz,e,n,null,0);var i=this._cache.get("attached_textures");i&&i[e]&&(i[e]=null),e!==wz&&e!==gO||this._cache.put(_z,!1)},detach:function(t,e){(this._textures[t]=null,this._boundRenderer)&&(this._cache.use(this._boundRenderer.__uid__),this._doDetach(this._boundRenderer.gl,t,e))},dispose:function(t){var e=t.gl,n=this._cache;n.use(t.__uid__);var i=n.get(pz);i&&e.deleteRenderbuffer(i);var r=n.get(fz);r&&e.deleteFramebuffer(r),n.deleteContext(t.__uid__),this._textures={}}});Sz.DEPTH_ATTACHMENT=wz,Sz.COLOR_ATTACHMENT0=bz,Sz.STENCIL_ATTACHMENT=pO,Sz.DEPTH_STENCIL_ATTACHMENT=gO;const Tz=Sz;var Mz=["px","nx","py","ny","pz","nz"],Cz=vE.extend((function(){var t={position:new $N,far:1e3,near:.1,texture:null,shadowMapPass:null},e=t._cameras={px:new dz({fov:90}),nx:new dz({fov:90}),py:new dz({fov:90}),ny:new dz({fov:90}),pz:new dz({fov:90}),nz:new dz({fov:90})};return e.px.lookAt($N.POSITIVE_X,$N.NEGATIVE_Y),e.nx.lookAt($N.NEGATIVE_X,$N.NEGATIVE_Y),e.py.lookAt($N.POSITIVE_Y,$N.POSITIVE_Z),e.ny.lookAt($N.NEGATIVE_Y,$N.NEGATIVE_Z),e.pz.lookAt($N.POSITIVE_Z,$N.NEGATIVE_Y),e.nz.lookAt($N.NEGATIVE_Z,$N.NEGATIVE_Y),t._frameBuffer=new Tz,t}),{getCamera:function(t){return this._cameras[t]},render:function(t,e,n){var i=t.gl;n||e.update();for(var r=this.texture.width,o=2*Math.atan(r/(r-.5))/Math.PI*180,a=0;a<6;a++){var s=Mz[a],l=this._cameras[s];if($N.copy(l.position,this.position),l.far=this.far,l.near=this.near,l.fov=o,this.shadowMapPass){l.update();var u=e.getBoundingBox();u.applyTransform(l.viewMatrix),e.viewBoundingBoxLastFrame.copy(u),this.shadowMapPass.render(t,e,l,!0)}this._frameBuffer.attach(this.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+a),this._frameBuffer.bind(t),t.render(e,l,!0),this._frameBuffer.unbind(t)}},dispose:function(t){this._frameBuffer.dispose(t)}});const Lz=Cz;var Az=xk.extend({dynamic:!1,widthSegments:1,heightSegments:1},(function(){this.build()}),{build:function(){for(var t=this.heightSegments,e=this.widthSegments,n=this.attributes,i=[],r=[],o=[],a=[],s=0;s<=t;s++)for(var l=s/t,u=0;u<=e;u++){var h=u/e;if(i.push([2*h-1,2*l-1,0]),r&&r.push([h,l]),o&&o.push([0,0,1]),u0?this.material.define("fragment","LOD"):this.material.undefine("fragment","LOD"),t.renderPass([this],n)}});const Rz=Nz,kz=Rz;function zz(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}var Bz=zz("DXT1"),Fz=zz("DXT3"),Vz=zz("DXT5"),Gz={parse:function(t,e){var n=new Int32Array(t,0,31);if(542327876!==n[0])return null;if(4&!n(20))return null;var i,r,o=n(21),a=n[4],s=n[3],l=512&n[28],u=131072&n[2];switch(o){case Bz:i=8,r=$R.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Fz:i=16,r=$R.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Vz:i=16,r=$R.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}var h=n[1]+4,c=l?6:1,d=1;u&&(d=Math.max(1,n[7]));for(var f=[],p=0;p0){var r=Math.pow(2,t[3]-128-8+i);e[n+0]=t[0]*r,e[n+1]=t[1]*r,e[n+2]=t[2]*r}else e[n+0]=0,e[n+1]=0,e[n+2]=0;return e[n+3]=1,e}function jz(t,e,n,i){for(var r,o,a=0,s=0,l=i;l>0;)if(t[s][0]=e[n++],t[s][1]=e[n++],t[s][2]=e[n++],t[s][3]=e[n++],1===t[s][0]&&1===t[s][1]&&1===t[s][2]){for(var u=t[s][3]<>>0;u>0;u--)r=t[s-1],(o=t[s])[0]=r[0],o[1]=r[1],o[2]=r[2],o[3]=r[3],s++,l--;a+=8}else s++,l--,a=0;return n}function Zz(t,e,n,i){if(i<8|i>32767)return jz(t,e,n,i);if(2!=(r=e[n++]))return jz(t,e,n-1,i);if(t[0][1]=e[n++],t[0][2]=e[n++],r=e[n++],(t[0][2]<<8>>>0|r)>>>0!==i)return null;for(var r=0;r<4;r++)for(var o=0;o128){a=(127&a)>>>0;for(var s=e[n++];a--;)t[o++][r]=s}else for(;a--;)t[o++][r]=e[n++]}return n}var Xz={parseRGBE:function(t,e,n){null==n&&(n=0);var i=new Uint8Array(t),r=i.length;if("#?"===function(t,e,n){for(var i="",r=e;r=r)){o+=2;for(var a="";o20)return console.warn("Given image is not a height map"),t}var d,f,p,g;l%(4*i)==0?(d=a.data[l],p=a.data[l+4]):l%(4*i)==4*(i-1)?(d=a.data[l-4],p=a.data[l]):(d=a.data[l-4],p=a.data[l+4]),l<4*i?(f=a.data[l],g=a.data[l+4*i]):l>i*(r-1)*4?(f=a.data[l-4*i],g=a.data[l]):(f=a.data[l-4*i],g=a.data[l+4*i]),s.data[l]=d-p+127,s.data[l+1]=f-g+127,s.data[l+2]=255,s.data[l+3]=255}return o.putImageData(s,0,0),n},isHeightImage:function(t,e,n){if(!t||!t.width||!t.height)return!1;var i=document.createElement("canvas"),r=i.getContext("2d"),o=e||32;n=n||20,i.width=i.height=o,r.drawImage(t,0,0,o,o);for(var a=r.getImageData(0,0,o,o),s=0;sn)return!1}return!0},_fetchTexture:function(t,e,n){xO.request.get({url:t,responseType:"arraybuffer",onload:e,onerror:n})},createChessboard:function(t,e,n,i){t=t||512,e=e||64,n=n||"black",i=i||"white";var r=Math.ceil(t/e),o=document.createElement("canvas");o.width=t,o.height=t;var a=o.getContext("2d");a.fillStyle=i,a.fillRect(0,0,t,t),a.fillStyle=n;for(var s=0;s=0||(Jz.forEach((function(e){t.on(e,this[Qz(e)],this)}),this),this._meshes.push(t))},detachFromMesh:function(t){var e=this._meshes.indexOf(t);e>=0&&this._meshes.splice(e,1),Jz.forEach((function(e){t.off(e,this[Qz(e)])}),this)},dispose:function(){this._meshes.forEach((function(t){this.detachFromMesh(t)}),this)}};const tB=$z;var eB=jk.extend({left:-1,right:1,near:-1,far:1,top:1,bottom:-1},{updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array;this.left=(-1-t[12])/t[0],this.right=(1-t[12])/t[0],this.top=(1-t[13])/t[5],this.bottom=(-1-t[13])/t[5],this.near=-(-1-t[14])/t[10],this.far=-(1-t[14])/t[10]},clone:function(){var t=jk.prototype.clone.call(this);return t.left=this.left,t.right=this.right,t.near=this.near,t.far=this.far,t.top=this.top,t.bottom=this.bottom,t}});const nB=eB;LN.import("\n@export clay.compositor.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end");var iB=new Dz,rB=new ek({geometry:iB,frustumCulling:!1}),oB=new nB;const aB=vE.extend((function(){return{fragment:"",outputs:null,material:null,blendWithPrevious:!1,clearColor:!1,clearDepth:!0}}),(function(){var t=new LN(LN.source("clay.compositor.vertex"),this.fragment),e=new HO({shader:t});e.enableTexturesAll(),this.material=e}),{setUniform:function(t,e){this.material.setUniform(t,e)},getUniform:function(t){var e=this.material.uniforms[t];if(e)return e.value},attachOutput:function(t,e){this.outputs||(this.outputs={}),e=e||dO,this.outputs[e]=t},detachOutput:function(t){for(var e in this.outputs)this.outputs[e]===t&&(this.outputs[e]=null)},bind:function(t,e){if(this.outputs)for(var n in this.outputs){var i=this.outputs[n];i&&e.attach(i,n)}e&&e.bind(t)},unbind:function(t,e){e.unbind(t)},render:function(t,e){var n=t.gl;if(e){this.bind(t,e);var i=t.getGLExtension("EXT_draw_buffers");if(i&&this.outputs){var r=[];for(var o in this.outputs)(o=+o)>=n.COLOR_ATTACHMENT0&&o<=n.COLOR_ATTACHMENT0+8&&r.push(o);i.drawBuffersEXT(r)}}this.trigger("beforerender",this,t);var a=this.clearDepth?n.DEPTH_BUFFER_BIT:0;if(n.depthMask(!0),this.clearColor){a|=n.COLOR_BUFFER_BIT,n.colorMask(!0,!0,!0,!0);var s=this.clearColor;Array.isArray(s)&&n.clearColor(s[0],s[1],s[2],s[3])}n.clear(a),this.blendWithPrevious?(n.enable(n.BLEND),this.material.transparent=!0):(n.disable(n.BLEND),this.material.transparent=!1),this.renderQuad(t),this.trigger("afterrender",this,t),e&&this.unbind(t,e)},renderQuad:function(t){rB.material=this.material,t.renderPass([rB],oB)},dispose:function(t){}});var sB={},lB=["px","nx","py","ny","pz","nz"];sB.prefilterEnvironmentMap=function(t,e,n,i,r){r&&i||(i=sB.generateNormalDistribution(),r=sB.integrateBRDF(t,i));var o=(n=n||{}).width||64,a=n.height||64,s=n.type||e.type,l=new hz({width:o,height:a,type:s,flipY:!1,mipmaps:[]});l.isPowerOfTwo()||console.warn("Width and height must be power of two to enable mipmap.");var u=Math.min(o,a),h=Math.log(u)/Math.log(2)+1,c=new HO({shader:new LN({vertex:LN.source("clay.skybox.vertex"),fragment:"#define SHADER_NAME prefilter\n#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\nuniform float roughness : 0.5;\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvoid main() {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n vec3 N = V;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n"})});c.set("normalDistribution",i),n.encodeRGBM&&c.define("fragment","RGBM_ENCODE"),n.decodeRGBM&&c.define("fragment","RGBM_DECODE");var d,f=new ez;if("texture2D"===e.textureType){var p=new hz({width:o,height:a,type:s===$R.FLOAT?$R.HALF_FLOAT:s});Kz.panoramaToCubeMap(t,e,p,{encodeRGBM:n.decodeRGBM}),e=p}(d=new Rz({scene:f,material:c})).material.set("environmentMap",e);var g=new Lz({texture:l});n.encodeRGBM&&(s=l.type=$R.UNSIGNED_BYTE);for(var m=new sk({width:o,height:a,type:s}),v=new Tz({depthBuffer:!1}),_=xO[s===$R.UNSIGNED_BYTE?"Uint8Array":"Float32Array"],y=0;y 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nfloat G_Smith(float roughness, float NoV, float NoL) {\n float k = roughness * roughness / 2.0;\n float G1V = NoV / (NoV * (1.0 - k) + k);\n float G1L = NoL / (NoL * (1.0 - k) + k);\n return G1L * G1V;\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / viewportSize;\n float NoV = uv.x;\n float roughness = uv.y;\n vec3 V;\n V.x = sqrt(1.0 - NoV * NoV);\n V.y = 0.0;\n V.z = NoV;\n float A = 0.0;\n float B = 0.0;\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(L.z, 0.0, 1.0);\n float NoH = clamp(H.z, 0.0, 1.0);\n float VoH = clamp(dot(V, H), 0.0, 1.0);\n if (NoL > 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n"}),r=new sk({width:512,height:256,type:$R.HALF_FLOAT,wrapS:$R.CLAMP_TO_EDGE,wrapT:$R.CLAMP_TO_EDGE,minFilter:$R.NEAREST,magFilter:$R.NEAREST,useMipmap:!1});return i.setUniform("normalDistribution",e),i.setUniform("viewportSize",[512,256]),i.attachOutput(r),i.render(t,n),n.dispose(t),r},sB.generateNormalDistribution=function(t,e){for(var n=new sk({width:t=t||256,height:e=e||1024,type:$R.FLOAT,minFilter:$R.NEAREST,magFilter:$R.NEAREST,wrapS:$R.CLAMP_TO_EDGE,wrapT:$R.CLAMP_TO_EDGE,useMipmap:!1}),i=new Float32Array(e*t*4),r=[],o=0;o>>16)>>>0;u=(((16711935&(u=((252645135&(u=((858993459&(u=((1431655765&u)<<1|(2863311530&u)>>>1)>>>0))<<2|(3435973836&u)>>>2)>>>0))<<4|(4042322160&u)>>>4)>>>0))<<8|(4278255360&u)>>>8)>>>0)/4294967296;var h=Math.sqrt((1-u)/(1+(s*s-1)*u));r[l]=h}for(l=0;l65535?Uint32Array:Uint16Array,_=this.indices=new v(e*t*6),y=this.radius,x=this.phiStart,w=this.phiLength,b=this.thetaStart,S=this.thetaLength,T=[],M=[],C=0,L=1/(y=this.radius);for(d=0;d<=t;d++)for(c=0;c<=e;c++)u=c/e,h=d/t,a=-y*Math.cos(x+u*w)*Math.sin(b+h*S),s=y*Math.cos(b+h*S),l=y*Math.sin(x+u*w)*Math.sin(b+h*S),T[0]=a,T[1]=s,T[2]=l,M[0]=u,M[1]=h,n.set(C,T),i.set(C,M),T[0]*=L,T[1]*=L,T[2]*=L,r.set(C,T),C++;var A=e+1,D=0;for(d=0;d=0)s=a*n.length;else for(var l=0;l-1e-8&&t=1?1:function(t,e,n,i,r,o){var a=i+3*(e-n)-t,s=3*(n-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,d=l*l-3*s*u,f=0;if(MF(h)&&MF(c))MF(s)?o[0]=0:(T=-l/s)>=0&&T<=1&&(o[f++]=T);else{var p=c*c-4*h*d;if(MF(p)){var g=c/h,m=-g/2;(T=-s/a+g)>=0&&T<=1&&(o[f++]=T),m>=0&&m<=1&&(o[f++]=m)}else if(p>0){var v=wF(p),_=h*s+1.5*a*(-c+v),y=h*s+1.5*a*(-c-v);(T=(-s-((_=_<0?-xF(-_,TF):xF(_,TF))+(y=y<0?-xF(-y,TF):xF(y,TF))))/(3*a))>=0&&T<=1&&(o[f++]=T)}else{var x=(2*h*s-3*a*c)/(2*wF(h*h*h)),w=Math.acos(x)/3,b=wF(h),S=Math.cos(w),T=(-s-2*b*S)/(3*a),M=(m=(-s+b*(S+SF*Math.sin(w)))/(3*a),(-s+b*(S-SF*Math.sin(w)))/(3*a));T>=0&&T<=1&&(o[f++]=T),m>=0&&m<=1&&(o[f++]=m),M>=0&&M<=1&&(o[f++]=M)}}return f}(0,i,o,1,t,s)&&CF(0,r,a,1,s[0])}}}var DF=function(){function t(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||vF,this.ondestroy=t.ondestroy||vF,this.onrestart=t.onrestart||vF,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var n=this._life,i=t-this._startTime-this._pausedTime,r=i/n;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=i%n;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=hF(t)?t:ZB[t]||AF(t)},t}();const IF=DF;var PF={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function EF(t){return(t=Math.round(t))<0?0:t>255?255:t}function OF(t){return t<0?0:t>1?1:t}function NF(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?EF(parseFloat(e)/100*255):EF(parseInt(e,10))}function RF(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?OF(parseFloat(e)/100):OF(parseFloat(e))}function kF(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function zF(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function BF(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var FF=new oz(20),VF=null;function GF(t,e){VF&&BF(VF,e),VF=FF.put(t,VF||e.slice())}function HF(t,e){if(t){e=e||[];var n=FF.get(t);if(n)return BF(e,n);var i=(t+="").replace(/ /g,"").toLowerCase();if(i in PF)return BF(e,PF[i]),GF(t,e),e;var r,o=i.length;if("#"===i.charAt(0))return 4===o||5===o?(r=parseInt(i.slice(1,4),16))>=0&&r<=4095?(zF(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(i.slice(4),16)/15:1),GF(t,e),e):void zF(e,0,0,0,1):7===o||9===o?(r=parseInt(i.slice(1,7),16))>=0&&r<=16777215?(zF(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(i.slice(7),16)/255:1),GF(t,e),e):void zF(e,0,0,0,1):void 0;var a=i.indexOf("("),s=i.indexOf(")");if(-1!==a&&s+1===o){var l=i.substr(0,a),u=i.substr(a+1,s-(a+1)).split(","),h=1;switch(l){case"rgba":if(4!==u.length)return 3===u.length?zF(e,+u[0],+u[1],+u[2],1):zF(e,0,0,0,1);h=RF(u.pop());case"rgb":return u.length>=3?(zF(e,NF(u[0]),NF(u[1]),NF(u[2]),3===u.length?h:RF(u[3])),GF(t,e),e):void zF(e,0,0,0,1);case"hsla":return 4!==u.length?void zF(e,0,0,0,1):(u[3]=RF(u[3]),UF(u,e),GF(t,e),e);case"hsl":return 3!==u.length?void zF(e,0,0,0,1):(UF(u,e),GF(t,e),e);default:return}}zF(e,0,0,0,1)}}function UF(t,e){var n=(parseFloat(t[0])%360+360)%360/360,i=RF(t[1]),r=RF(t[2]),o=r<=.5?r*(i+1):r+i-r*i,a=2*r-o;return zF(e=e||[],EF(255*kF(a,o,n+1/3)),EF(255*kF(a,o,n)),EF(255*kF(a,o,n-1/3)),1),4===t.length&&(e[3]=t[3]),e}new oz(100);var WF=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},jF=new function(){this.browser=new WF,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(jF.wxa=!0,jF.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?jF.worker=!0:!jF.hasGlobalWindow||"Deno"in window?(jF.node=!0,jF.svgSupported=!0):function(t,e){var n=e.browser,i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);i&&(n.firefox=!0,n.version=i[1]);r&&(n.ie=!0,n.version=r[1]);o&&(n.edge=!0,n.version=o[1],n.newEdge=+o[1].split(".")[0]>18);a&&(n.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,e.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||n.ie&&+n.version>=9}(navigator.userAgent,jF);const ZF=jF;Math.round;ZF.hasGlobalWindow&&hF(window.btoa);var XF=Array.prototype.slice;function qF(t,e,n){return(e-t)*n+t}function YF(t,e,n,i){for(var r=e.length,o=0;oi?e:t,o=Math.min(n,i),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa)i.length=a;else for(var s=o;s=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,n){this._needsSort=!0;var i=this.keyframes,r=i.length,o=!1,a=6,s=e;if(oF(e)){var l=function(t){return oF(t&&t[0])?2:1}(e);a=l,(1===l&&!cF(e[0])||2===l&&!cF(e[0][0]))&&(o=!0)}else if(cF(e)&&!function(t){return t!=t}(e))a=0;else if(function(t){return"string"==typeof t}(e))if(isNaN(+e)){var u=HF(e);u&&(s=u,a=3)}else a=0;else if(function(t){return null!=t.colorStops}(e)){var h=rF({},s);h.colorStops=aF(e.colorStops,(function(t){return{offset:t.offset,color:HF(t.color)}})),"linear"===e.type?a=4:function(t){return"radial"===t.type}(e)&&(a=5),s=h}0===r?this.valType=a:a===this.valType&&6!==a||(o=!0),this.discrete=this.discrete||o;var c={time:t,value:s,rawValue:e,percent:0};return n&&(c.easing=n,c.easingFunc=hF(n)?n:ZB[n]||AF(n)),i.push(c),c},t.prototype.prepare=function(t,e){var n=this.keyframes;this._needsSort&&n.sort((function(t,e){return t.time-e.time}));for(var i=this.valType,r=n.length,o=n[r-1],a=this.discrete,s=iV(i),l=nV(i),u=0;u=0&&!(l[n].percent<=e);n--);n=f(n,u-2)}else{for(n=d;ne);n++);n=f(n-1,u-2)}r=l[n+1],i=l[n]}if(i&&r){this._lastFr=n,this._lastFrP=e;var p=r.percent-i.percent,g=0===p?1:f((e-i.percent)/p,1);r.easingFunc&&(g=r.easingFunc(g));var m=o?this._additiveValue:c?rV:t[h];if(!iV(s)&&!c||m||(m=this._additiveValue=[]),this.discrete)t[h]=g<1?i.rawValue:r.rawValue;else if(iV(s))1===s?YF(m,i[a],r[a],g):function(t,e,n,i){for(var r=e.length,o=r&&e[0].length,a=0;a0&&s.addKeyframe(0,tV(l),i),this._trackKeys.push(a)}s.addKeyframe(t,tV(e[a]),i)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,n=0;n0)){this._started=1;for(var e=this,n=[],i=this._maxTime||0,r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[i]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}();const sV=aV;var lV={_animators:null,getAnimators:function(){return this._animators=this._animators||[],this._animators},animate:function(t,e){this._animators=this._animators||[];var n;if(t){for(var i=t.split("."),r=this,o=0,a=i.length;o=0&&s.splice(t,1)})),s.push(l),this.__zr&&this.__zr.animation.addAnimator(l),l},stopAnimation:function(t){this._animators=this._animators||[];for(var e=this._animators,n=e.length,i=0;i 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n@export clay.chunk.instancing_header\n#ifdef INSTANCING\nattribute vec4 instanceMat1;\nattribute vec4 instanceMat2;\nattribute vec4 instanceMat3;\n#endif\n@end\n@export clay.chunk.instancing_matrix\nmat4 instanceMat = mat4(\n vec4(instanceMat1.xyz, 0.0),\n vec4(instanceMat2.xyz, 0.0),\n vec4(instanceMat3.xyz, 0.0),\n vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0)\n);\n@end\n@export clay.util.parallax_correct\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n return normalize(fixedPos - boxCenter);\n}\n@end\n@export clay.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end\n@export clay.util.ACES\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n@end";function cV(t){return t instanceof HTMLCanvasElement||t instanceof HTMLImageElement||t instanceof Image}Object.assign(UR.prototype,uV),LN.import(hV),LN.import(AN),LN.import("\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n"),LN.import("@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\nattribute vec3 normal: NORMAL;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nvarying vec3 v_Normal;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\nvarying vec3 v_Normal;\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end"),LN.import("/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),LN.import("@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import clay.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import clay.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),LN.import("@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n"),LN.import("@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n v_Texcoord = texcoord;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import clay.sm.depth.fragment\n\n@end");var dV=ez.prototype.addToScene,fV=ez.prototype.removeFromScene;ez.prototype.addToScene=function(t){if(dV.call(this,t),this.__zr){var e=this.__zr;t.traverse((function(t){t.__zr=e,t.addAnimatorsToZr&&t.addAnimatorsToZr(e)}))}},ez.prototype.removeFromScene=function(t){fV.call(this,t),t.traverse((function(t){var e=t.__zr;t.__zr=null,e&&t.removeAnimatorsFromZr&&t.removeAnimatorsFromZr(e)}))},HO.prototype.setTextureImage=function(t,e,n,i){if(this.shader){var r,o,a=n.getZr(),s=this;return s.autoUpdateTextureStatus=!1,s.disableTexture(t),(o=e)&&"none"!==o&&(r=pV.loadTexture(e,n,i,(function(e){s.enableTexture(t),a&&a.refresh()})),s.set(t,r)),r}};var pV={};pV.Renderer=jN,pV.Node=UR,pV.Mesh=ek,pV.Shader=LN,pV.Material=HO,pV.Texture=$R,pV.Texture2D=sk,pV.Geometry=xk,pV.SphereGeometry=bB,pV.PlaneGeometry=Dz,pV.CubeGeometry=Oz,pV.AmbientLight=TB,pV.DirectionalLight=CB,pV.PointLight=AB,pV.SpotLight=IB,pV.PerspectiveCamera=dz,pV.OrthographicCamera=nB,pV.Vector2=JO,pV.Vector3=$N,pV.Vector4=NB,pV.Quaternion=DR,pV.Matrix2=BB,pV.Matrix2d=HB,pV.Matrix3=WB,pV.Matrix4=MR,pV.Plane=Nk,pV.Ray=sR,pV.BoundingBox=FR,pV.Frustum=Hk;var gV=null;function mV(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function vV(t){if((t.wrapS===$R.REPEAT||t.wrapT===$R.REPEAT)&&t.image){var e=mV(t.width),n=mV(t.height);if(e!==t.width||n!==t.height){var i=document.createElement("canvas");i.width=e,i.height=n,i.getContext("2d").drawImage(t.image,0,0,e,n),t.image=i}}}pV.loadTexture=function(t,e,n,i){"function"==typeof n&&(i=n,n={}),n=n||{};for(var r=Object.keys(n).sort(),o="",a=0;a3?e[3]=t[3]:e[3]=1,e):((e=Ri(t||"#000",e)||[0,0,0,0])[0]/=255,e[1]/=255,e[2]/=255,e)},pV.directionFromAlphaBeta=function(t,e){var n=t/180*Math.PI+Math.PI/2,i=-e/180*Math.PI+Math.PI/2,r=[],o=Math.sin(n);return r[0]=o*Math.cos(i),r[1]=-Math.cos(n),r[2]=o*Math.sin(i),r},pV.getShadowResolution=function(t){var e=1024;switch(t){case"low":e=512;break;case"medium":break;case"high":e=2048;break;case"ultra":e=4096}return e},pV.COMMON_SHADERS=["lambert","color","realistic","hatching","shadow"],pV.createShader=function(t){"ecgl.shadow"===t&&(t="ecgl.displayShadow");var e=LN.source(t+".vertex"),n=LN.source(t+".fragment");e||console.error("Vertex shader of '%s' not exits",t),n||console.error("Fragment shader of '%s' not exits",t);var i=new LN(e,n);return i.name=t,i},pV.createMaterial=function(t,e){e instanceof Array||(e=[e]);var n=pV.createShader(t),i=new HO({shader:n});return e.forEach((function(t){"string"==typeof t&&i.define(t)})),i},pV.setMaterialFromModel=function(t,e,n,i){e.autoUpdateTextureStatus=!1;var r=n.getModel(t+"Material"),o=r.get("detailTexture"),a=xB.firstNotNull(r.get("textureTiling"),1),s=xB.firstNotNull(r.get("textureOffset"),0);"number"==typeof a&&(a=[a,a]),"number"==typeof s&&(s=[s,s]);var l=a[0]>1||a[1]>1?pV.Texture.REPEAT:pV.Texture.CLAMP_TO_EDGE,u={anisotropic:8,wrapS:l,wrapT:l};if("realistic"===t){var h=r.get("roughness"),c=r.get("metalness");null!=c?isNaN(c)&&(e.setTextureImage("metalnessMap",c,i,u),c=xB.firstNotNull(r.get("metalnessAdjust"),.5)):c=0,null!=h?isNaN(h)&&(e.setTextureImage("roughnessMap",h,i,u),h=xB.firstNotNull(r.get("roughnessAdjust"),.5)):h=.5;var d=r.get("normalTexture");e.setTextureImage("detailMap",o,i,u),e.setTextureImage("normalMap",d,i,u),e.set({roughness:h,metalness:c,detailUvRepeat:a,detailUvOffset:s})}else if("lambert"===t)e.setTextureImage("detailMap",o,i,u),e.set({detailUvRepeat:a,detailUvOffset:s});else if("color"===t)e.setTextureImage("detailMap",o,i,u),e.set({detailUvRepeat:a,detailUvOffset:s});else if("hatching"===t){var f=r.get("hatchingTextures")||[];f.length;for(var p=0;p<6;p++)e.setTextureImage("hatch"+(p+1),f[p],i,{anisotropic:8,wrapS:pV.Texture.REPEAT,wrapT:pV.Texture.REPEAT});e.set({detailUvRepeat:a,detailUvOffset:s})}},pV.updateVertexAnimation=function(t,e,n,i){var r=i.get("animation"),o=i.get("animationDurationUpdate"),a=i.get("animationEasingUpdate"),s=n.shadowDepthMaterial;if(r&&e&&o>0&&e.geometry.vertexCount===n.geometry.vertexCount){n.material.define("vertex","VERTEX_ANIMATION"),n.ignorePreZ=!0,s&&s.define("vertex","VERTEX_ANIMATION");for(var l=0;l=0&&this._viewsToDispose.splice(e,1),this.views.push(t),t.layer=this;var n=this.zr;t.scene.traverse((function(t){t.__zr=n,t.addAnimatorsToZr&&t.addAnimatorsToZr(n)}))}},xV.prototype.removeView=function(t){if(t.layer===this){var e=this.views.indexOf(t);e>=0&&(this.views.splice(e,1),t.scene.traverse(wV,this),t.layer=null,this._viewsToDispose.push(t))}},xV.prototype.removeViewsAll=function(){this.views.forEach((function(t){t.scene.traverse(wV,this),t.layer=null,this._viewsToDispose.push(t)}),this),this.views.length=0},xV.prototype.resize=function(t,e){this.renderer.resize(t,e)},xV.prototype.clear=function(){var t=this.renderer.gl,e=this._backgroundColor||[0,0,0,0];t.clearColor(e[0],e[1],e[2],e[3]),t.depthMask(!0),t.colorMask(!0,!0,!0,!0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT)},xV.prototype.clearDepth=function(){var t=this.renderer.gl;t.clear(t.DEPTH_BUFFER_BIT)},xV.prototype.clearColor=function(){var t=this.renderer.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},xV.prototype.needsRefresh=function(){this.zr.refresh()},xV.prototype.refresh=function(t){this._backgroundColor=t?_V.parseColor(t):[0,0,0,0],this.renderer.clearColor=this._backgroundColor;for(var e=0;e20)){t=t.event;var i=this.pickObject(t.offsetX,t.offsetY);i&&(this._dispatchEvent(t.type,t,i),this._dispatchDataEvent(t.type,t,i));var r=this._clickToSetFocusPoint(t);if(r)r.view.setDOFFocusOnPoint(r.distance)&&this.zr.refresh()}}},xV.prototype._clickToSetFocusPoint=function(t){for(var e=this.renderer,n=e.viewport,i=this.views.length-1;i>=0;i--){var r=this.views[i];if(r.hasDOF()&&r.containPoint(t.offsetX,t.offsetY)){this._picking.scene=r.scene,this._picking.camera=r.camera,e.viewport=r.viewport;var o=this._picking.pick(t.offsetX,t.offsetY,!0);if(o)return o.view=r,o}}e.viewport=n},xV.prototype.onglobalout=function(t){var e=this._hovered;e&&this._dispatchEvent("mouseout",t,{target:e.target})},xV.prototype.pickObject=function(t,e){for(var n=[],i=this.renderer,r=i.viewport,o=0;o=0&&(h.dataIndex=this._lastDataIndex,h.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(u,"mouseout",e)),s=!0):null!=a&&a!==this._lastEventData&&(null!=this._lastEventData&&(h.eventData=this._lastEventData,this.zr.handler.dispatchToElement(u,"mouseout",e)),s=!0),this._lastEventData=a,this._lastDataIndex=r,this._lastSeriesIndex=o),h.eventData=a,h.dataIndex=r,h.seriesIndex=o,(null!=a||parseInt(r,10)>=0&&parseInt(o,10)>=0)&&(this.zr.handler.dispatchToElement(u,t,e),s&&this.zr.handler.dispatchToElement(u,"mouseover",e))},xV.prototype._dispatchToView=function(t,e){for(var n=0;nt&&a=0&&(!function(t){DV(t,"itemStyle"),DV(t,"lineStyle"),DV(t,"areaStyle"),DV(t,"label")}(e),"mapbox"===e.coordinateSystem&&(e.coordinateSystem="mapbox3D",t.mapbox3D=t.mapbox))})),IV(t.xAxis3D),IV(t.yAxis3D),IV(t.zAxis3D),IV(t.grid3D),DV(t.geo3D)}));const EV={defaultOption:{viewControl:{projection:"perspective",autoRotate:!1,autoRotateDirection:"cw",autoRotateSpeed:10,autoRotateAfterStill:3,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",distance:150,minDistance:40,maxDistance:400,orthographicSize:150,maxOrthographicSize:400,minOrthographicSize:20,center:[0,0,0],alpha:0,beta:0,minAlpha:-90,maxAlpha:90}},setView:function(t){t=t||{},this.option.viewControl=this.option.viewControl||{},null!=t.alpha&&(this.option.viewControl.alpha=t.alpha),null!=t.beta&&(this.option.viewControl.beta=t.beta),null!=t.distance&&(this.option.viewControl.distance=t.distance),null!=t.center&&(this.option.viewControl.center=t.center)}},OV={defaultOption:{postEffect:{enable:!1,bloom:{enable:!0,intensity:.1},depthOfField:{enable:!1,focalRange:20,focalDistance:50,blurRadius:10,fstop:2.8,quality:"medium"},screenSpaceAmbientOcclusion:{enable:!1,radius:2,quality:"medium",intensity:1},screenSpaceReflection:{enable:!1,quality:"medium",maxRoughness:.8},colorCorrection:{enable:!0,exposure:0,brightness:0,contrast:1,saturation:1,lookupTexture:""},edge:{enable:!1},FXAA:{enable:!1}},temporalSuperSampling:{enable:"auto"}}},NV={defaultOption:{light:{main:{shadow:!1,shadowQuality:"high",color:"#fff",intensity:1,alpha:0,beta:0},ambient:{color:"#fff",intensity:.2},ambientCubemap:{texture:null,exposure:1,diffuseIntensity:.5,specularIntensity:.5}}}};var RV=Gc.extend({type:"grid3D",dependencies:["xAxis3D","yAxis3D","zAxis3D"],defaultOption:{show:!0,zlevel:-10,left:0,top:0,width:"100%",height:"100%",environment:"auto",boxWidth:100,boxHeight:100,boxDepth:100,axisPointer:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.8)",width:1},label:{show:!0,formatter:null,margin:8,textStyle:{fontSize:14,color:"#fff",backgroundColor:"rgba(0,0,0,0.5)",padding:3,borderRadius:3}}},axisLine:{show:!0,lineStyle:{color:"#333",width:2,type:"solid"}},axisTick:{show:!0,inside:!1,length:3,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}},light:{main:{alpha:30,beta:40},ambient:{intensity:.4}},viewControl:{alpha:20,beta:40,autoRotate:!1,distance:200,minDistance:40,maxDistance:400}}});nt(RV.prototype,EV),nt(RV.prototype,OV),nt(RV.prototype,NV);const kV=RV;var zV=xB.firstNotNull,BV={left:0,middle:1,right:2};function FV(t){return t instanceof Array||(t=[t,t]),t}var VV=vE.extend((function(){return{zr:null,viewGL:null,_center:new $N,minDistance:.5,maxDistance:1.5,maxOrthographicSize:300,minOrthographicSize:30,minAlpha:-90,maxAlpha:90,minBeta:-1/0,maxBeta:1/0,autoRotateAfterStill:0,autoRotateDirection:"cw",autoRotateSpeed:60,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",_mode:"rotate",_camera:null,_needsUpdate:!1,_rotating:!1,_phi:0,_theta:0,_mouseX:0,_mouseY:0,_rotateVelocity:new JO,_panVelocity:new JO,_distance:500,_zoomSpeed:0,_stillTimeout:0,_animators:[]}}),(function(){["_mouseDownHandler","_mouseWheelHandler","_mouseMoveHandler","_mouseUpHandler","_pinchHandler","_contextMenuHandler","_update"].forEach((function(t){this[t]=this[t].bind(this)}),this)}),{init:function(){var t=this.zr;t&&(t.on("mousedown",this._mouseDownHandler),t.on("globalout",this._mouseUpHandler),t.on("mousewheel",this._mouseWheelHandler),t.on("pinch",this._pinchHandler),t.animation.on("frame",this._update),t.dom.addEventListener("contextmenu",this._contextMenuHandler))},dispose:function(){var t=this.zr;t&&(t.off("mousedown",this._mouseDownHandler),t.off("mousemove",this._mouseMoveHandler),t.off("mouseup",this._mouseUpHandler),t.off("mousewheel",this._mouseWheelHandler),t.off("pinch",this._pinchHandler),t.off("globalout",this._mouseUpHandler),t.dom.removeEventListener("contextmenu",this._contextMenuHandler),t.animation.off("frame",this._update)),this.stopAllAnimation()},getDistance:function(){return this._distance},setDistance:function(t){this._distance=t,this._needsUpdate=!0},getOrthographicSize:function(){return this._orthoSize},setOrthographicSize:function(t){this._orthoSize=t,this._needsUpdate=!0},getAlpha:function(){return this._theta/Math.PI*180},getBeta:function(){return-this._phi/Math.PI*180},getCenter:function(){return this._center.toArray()},setAlpha:function(t){t=Math.max(Math.min(this.maxAlpha,t),this.minAlpha),this._theta=t/180*Math.PI,this._needsUpdate=!0},setBeta:function(t){t=Math.max(Math.min(this.maxBeta,t),this.minBeta),this._phi=-t/180*Math.PI,this._needsUpdate=!0},setCenter:function(t){this._center.setArray(t)},setViewGL:function(t){this.viewGL=t},getCamera:function(){return this.viewGL.camera},setFromViewControlModel:function(t,e){var n=(e=e||{}).baseDistance||0,i=e.baseOrthoSize||1,r=t.get("projection");"perspective"!==r&&"orthographic"!==r&&"isometric"!==r&&(r="perspective"),this._projection=r,this.viewGL.setProjection(r);var o=t.get("distance")+n,a=t.get("orthographicSize")+i;[["damping",.8],["autoRotate",!1],["autoRotateAfterStill",3],["autoRotateDirection","cw"],["autoRotateSpeed",10],["minDistance",30],["maxDistance",400],["minOrthographicSize",30],["maxOrthographicSize",300],["minAlpha",-90],["maxAlpha",90],["minBeta",-1/0],["maxBeta",1/0],["rotateSensitivity",1],["zoomSensitivity",1],["panSensitivity",1],["panMouseButton","left"],["rotateMouseButton","middle"]].forEach((function(e){this[e[0]]=zV(t.get(e[0]),e[1])}),this),this.minDistance+=n,this.maxDistance+=n,this.minOrthographicSize+=i,this.maxOrthographicSize+=i;var s=t.ecModel,l={};["animation","animationDurationUpdate","animationEasingUpdate"].forEach((function(e){l[e]=zV(t.get(e),s&&s.get(e))}));var u=zV(e.alpha,t.get("alpha"))||0,h=zV(e.beta,t.get("beta"))||0,c=zV(e.center,t.get("center"))||[0,0,0];l.animation&&l.animationDurationUpdate>0&&this._notFirst?this.animateTo({alpha:u,beta:h,center:c,distance:o,orthographicSize:a,easing:l.animationEasingUpdate,duration:l.animationDurationUpdate}):(this.setDistance(o),this.setAlpha(u),this.setBeta(h),this.setCenter(c),this.setOrthographicSize(a)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){0},animateTo:function(t){var e=this.zr,n=this,i={},r={};return null!=t.distance&&(i.distance=this.getDistance(),r.distance=t.distance),null!=t.orthographicSize&&(i.orthographicSize=this.getOrthographicSize(),r.orthographicSize=t.orthographicSize),null!=t.alpha&&(i.alpha=this.getAlpha(),r.alpha=t.alpha),null!=t.beta&&(i.beta=this.getBeta(),r.beta=t.beta),null!=t.center&&(i.center=this.getCenter(),r.center=t.center),this._addAnimator(e.animation.animate(i).when(t.duration||1e3,r).during((function(){null!=i.alpha&&n.setAlpha(i.alpha),null!=i.beta&&n.setBeta(i.beta),null!=i.distance&&n.setDistance(i.distance),null!=i.center&&n.setCenter(i.center),null!=i.orthographicSize&&n.setOrthographicSize(i.orthographicSize),n._needsUpdate=!0}))).start(t.easing||"linear")},stopAllAnimation:function(){for(var t=0;t0},_update:function(t){if(this._rotating){var e=("cw"===this.autoRotateDirection?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=e*t/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(t=Math.min(t,50),this._updateDistanceOrSize(t),this._updatePan(t),this._updateRotate(t),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(t){var e=this._rotateVelocity;this._phi=e.y*t/20+this._phi,this._theta=e.x*t/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(e,Math.pow(this.damping,t/16))},_updateDistanceOrSize:function(t){"perspective"===this._projection?this._setDistance(this._distance+this._zoomSpeed*t/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*t/20),this._zoomSpeed*=Math.pow(this.damping,t/16)},_setDistance:function(t){this._distance=Math.max(Math.min(t,this.maxDistance),this.minDistance)},_setOrthoSize:function(t){this._orthoSize=Math.max(Math.min(t,this.maxOrthographicSize),this.minOrthographicSize);var e=this.getCamera(),n=this._orthoSize,i=n/this.viewGL.viewport.height*this.viewGL.viewport.width;e.left=-i/2,e.right=i/2,e.top=n/2,e.bottom=-n/2},_updatePan:function(t){var e=this._panVelocity,n=this._distance,i=this.getCamera(),r=i.worldTransform.y,o=i.worldTransform.x;this._center.scaleAndAdd(o,-e.x*n/200).scaleAndAdd(r,-e.y*n/200),this._vectorDamping(e,0)},_updateTransform:function(){var t=this.getCamera(),e=new $N,n=this._theta+Math.PI/2,i=this._phi+Math.PI/2,r=Math.sin(n);e.x=r*Math.cos(i),e.y=-Math.cos(n),e.z=r*Math.sin(i),t.position.copy(this._center).scaleAndAdd(e,this._distance),t.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var t=this.autoRotateAfterStill,e=this;!isNaN(t)&&t>0&&(this._stillTimeout=setTimeout((function(){e._rotating=!0}),1e3*t))},_vectorDamping:function(t,e){var n=t.len();(n*=e)<1e-4&&(n=0),t.normalize().scale(n)},_decomposeTransform:function(){if(this.getCamera()){this.getCamera().updateWorldTransform();var t=this.getCamera().worldTransform.z,e=Math.asin(t.y),n=Math.atan2(t.x,t.z);this._theta=e,this._phi=-n,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(t){if(!t.target&&!this._isAnimating()){var e=t.offsetX,n=t.offsetY;this.viewGL&&!this.viewGL.containPoint(e,n)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),t.event.targetTouches?1===t.event.targetTouches.length&&(this._mode="rotate"):t.event.button===BV[this.rotateMouseButton]?this._mode="rotate":t.event.button===BV[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=t.offsetX,this._mouseY=t.offsetY)}},_mouseMoveHandler:function(t){if(!(t.target&&t.target.__isGLToZRProxy||this._isAnimating())){var e=FV(this.panSensitivity),n=FV(this.rotateSensitivity);"rotate"===this._mode?(this._rotateVelocity.y=(t.offsetX-this._mouseX)/this.zr.getHeight()*2*n[0],this._rotateVelocity.x=(t.offsetY-this._mouseY)/this.zr.getWidth()*2*n[1]):"pan"===this._mode&&(this._panVelocity.x=(t.offsetX-this._mouseX)/this.zr.getWidth()*e[0]*400,this._panVelocity.y=(-t.offsetY+this._mouseY)/this.zr.getHeight()*e[1]*400),this._mouseX=t.offsetX,this._mouseY=t.offsetY,t.event.preventDefault()}},_mouseWheelHandler:function(t){if(!this._isAnimating()){var e=t.event.wheelDelta||-t.event.detail;this._zoomHandler(t,e)}},_pinchHandler:function(t){this._isAnimating()||(this._zoomHandler(t,t.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(t,e){if(0!==e){var n,i=t.offsetX,r=t.offsetY;if(!this.viewGL||this.viewGL.containPoint(i,r))n="perspective"===this._projection?Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(e>0?-1:1)*n*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&"rotate"===this._mode&&this._startCountingStill(),t.event.preventDefault()}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return"right"===this.rotateMouseButton||"right"===this.panMouseButton},_contextMenuHandler:function(t){this._isRightMouseButtonUsed()&&t.preventDefault()},_addAnimator:function(t){var e=this._animators;return e.push(t),t.done((function(){var n=e.indexOf(t);n>=0&&e.splice(n,1)})),t}});Object.defineProperty(VV.prototype,"autoRotate",{get:function(t){return this._autoRotate},set:function(t){this._autoRotate=t,this._rotating=t}});const GV=VV,HV={convertToDynamicArray:function(t){t&&this.resetOffset();var e=this.attributes;for(var n in e)t||!e[n].value?e[n].value=[]:e[n].value=Array.prototype.slice.call(e[n].value);t||!this.indices?this.indices=[]:this.indices=Array.prototype.slice.call(this.indices)},convertToTypedArray:function(){var t=this.attributes;for(var e in t)t[e].value&&t[e].value.length>0?t[e].value=new Float32Array(t[e].value):t[e].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}},UV={vec2:qO,vec3:EN,vec4:uR,mat2:kB,mat2d:VB,mat3:cR,mat4:IN,quat:vR};var WV=UV.vec3,jV=[[0,0],[1,1]],ZV=xk.extend((function(){return{segmentScale:1,dynamic:!0,useNativeLine:!0,attributes:{position:new xk.Attribute("position","float",3,"POSITION"),positionPrev:new xk.Attribute("positionPrev","float",3),positionNext:new xk.Attribute("positionNext","float",3),prevPositionPrev:new xk.Attribute("prevPositionPrev","float",3),prevPosition:new xk.Attribute("prevPosition","float",3),prevPositionNext:new xk.Attribute("prevPositionNext","float",3),offset:new xk.Attribute("offset","float",1),color:new xk.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(t){var e=this.attributes;this.vertexCount!==t&&(e.position.init(t),e.color.init(t),this.useNativeLine||(e.positionPrev.init(t),e.positionNext.init(t),e.offset.init(t)),t>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(this.indices=0===t?null:this.vertexCount>65535?new Uint32Array(3*t):new Uint16Array(3*t))},_getCubicCurveApproxStep:function(t,e,n,i){return 1/(WV.dist(t,e)+WV.dist(n,e)+WV.dist(i,n)+1)*this.segmentScale},getCubicCurveVertexCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?2*o:2*o+2},getCubicCurveTriangleCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?0:2*o},getLineVertexCount:function(){return this.getPolylineVertexCount(jV)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(jV)},getPolylineVertexCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/3;return this.useNativeLine?2*(e-1):2*(e-1)+2},getPolylineTriangleCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/3;return this.useNativeLine?0:2*Math.max(e-1,0)},addCubicCurve:function(t,e,n,i,r,o){null==o&&(o=1);var a=t[0],s=t[1],l=t[2],u=e[0],h=e[1],c=e[2],d=n[0],f=n[1],p=n[2],g=i[0],m=i[1],v=i[2],_=this._getCubicCurveApproxStep(t,e,n,i),y=_*_,x=y*_,w=3*_,b=3*y,S=6*y,T=6*x,M=a-2*u+d,C=s-2*h+f,L=l-2*c+p,A=3*(u-d)-a+g,D=3*(h-f)-s+m,I=3*(c-p)-l+v,P=a,E=s,O=l,N=(u-a)*w+M*b+A*x,R=(h-s)*w+C*b+D*x,k=(c-l)*w+L*b+I*x,z=M*S+A*T,B=C*S+D*T,F=L*S+I*T,V=A*T,G=D*T,H=I*T,U=0,W=0,j=Math.ceil(1/_),Z=new Float32Array(3*(j+1)),X=(Z=[],0);for(W=0;W1&&(P=N>0?Math.min(P,g):Math.max(P,g),E=R>0?Math.min(E,m):Math.max(E,m),O=k>0?Math.min(O,v):Math.max(O,v));return this.addPolyline(Z,r,o)},addLine:function(t,e,n,i){return this.addPolyline([t,e],n,i)},addPolyline:function(t,e,n,i,r){if(t.length){var o="number"!=typeof t[0];if(null==r&&(r=o?t.length:t.length/3),!(r<2)){null==i&&(i=0),null==n&&(n=1),this._itemVertexOffsets.push(this._vertexOffset);var a,s,l=(o="number"!=typeof t[0])?"number"!=typeof e[0]:e.length/4===r,u=this.attributes.position,h=this.attributes.positionPrev,c=this.attributes.positionNext,d=this.attributes.color,f=this.attributes.offset,p=this.indices,g=this._vertexOffset;n=Math.max(n,.01);for(var m=i;m1&&(u.copy(g,g-1),d.copy(g,g-1),g++):(m0&&(c.set(g-2,a),c.set(g-1,a)),u.set(g,a),u.set(g+1,a),d.set(g,s),d.set(g+1,s),f.set(g,n/2),f.set(g+1,-n/2),g+=2),this.useNativeLine)d.set(g,s),u.set(g,a),g++;else if(m>0){var y=3*this._triangleOffset;(p=this.indices)[y]=g-4,p[y+1]=g-3,p[y+2]=g-2,p[y+3]=g-3,p[y+4]=g-1,p[y+5]=g-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,w=this._vertexOffset+2*r;h.copy(x,x+2),h.copy(x+1,x+3),c.copy(w-1,w-3),c.copy(w-2,w-4)}return this._vertexOffset=g,this._vertexOffset}}},setItemColor:function(t,e){for(var n=this._itemVertexOffsets[t],i=ta&&(r=this._x=0,o+=this._rowHeight+l,this._y=o,this._rowHeight=0),this._x+=e+l,this._rowHeight=Math.max(this._rowHeight,n),o+n+l>s)return null;t.x+=this.offsetX*this.dpr+r,t.y+=this.offsetY*this.dpr+o,this._zr.add(t);var u=[this.offsetX/this.width,this.offsetY/this.height];return[[r/a+u[0],o/s+u[1]],[(r+e)/a+u[0],(o+n)/s+u[1]]]},_fitElement:function(t,e,n){var i=t.getBoundingRect(),r=e/i.width,o=n/i.height;t.x=-i.x*r,t.y=-i.y*o,t.scaleX=r,t.scaleY=o,t.update()}},YV.prototype={clear:function(){for(var t=0;t=t)){var r=(n+this._nodeWidth)*this._dpr,o=(i+this._nodeHeight)*this._dpr;try{this._zr.resize({width:r,height:o})}catch(t){this._canvas.width=r,this._canvas.height=o}var a=new qV(this._zr,n,i,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(a),a}},add:function(t,e,n){if(this._coords[t.id])return this._coords[t.id];var i=this._getCurrentNode().add(t,e,n);if(!i){var r=this._expand();if(!r)return;i=r.add(t,e,n)}return this._coords[t.id]=i,i},getCoordsScale:function(){var t=this._dpr;return[this._nodeWidth/this._canvas.width*t,this._nodeHeight/this._canvas.height*t]},getCoords:function(t){return this._coords[t]},dispose:function(){this._zr.dispose()}};const KV=YV;function JV(){}JV.prototype={constructor:JV,setScene:function(t){this._scene=t,this._skybox&&this._skybox.attachScene(this._scene)},initLight:function(t){this._lightRoot=t,this.mainLight=new _V.DirectionalLight({shadowBias:.005}),this.ambientLight=new _V.AmbientLight,t.add(this.mainLight),t.add(this.ambientLight)},dispose:function(){this._lightRoot&&(this._lightRoot.remove(this.mainLight),this._lightRoot.remove(this.ambientLight))},updateLight:function(t){var e=this.mainLight,n=this.ambientLight,i=t.getModel("light"),r=i.getModel("main"),o=i.getModel("ambient");e.intensity=r.get("intensity"),n.intensity=o.get("intensity"),e.color=_V.parseColor(r.get("color")).slice(0,3),n.color=_V.parseColor(o.get("color")).slice(0,3);var a=r.get("alpha")||0,s=r.get("beta")||0;e.position.setArray(_V.directionFromAlphaBeta(a,s)),e.lookAt(_V.Vector3.ZERO),e.castShadow=r.get("shadow"),e.shadowResolution=_V.getShadowResolution(r.get("shadowQuality"))},updateAmbientCubemap:function(t,e,n){var i=e.getModel("light.ambientCubemap"),r=i.get("texture");if(r){this._cubemapLightsCache=this._cubemapLightsCache||{};var o=this._cubemapLightsCache[r];if(!o){var a=this;o=this._cubemapLightsCache[r]=_V.createAmbientCubemap(i.option,t,n,(function(){a._isSkyboxFromAmbientCubemap&&a._skybox.setEnvironmentMap(o.specular.cubemap),n.getZr().refresh()}))}this._lightRoot.add(o.diffuse),this._lightRoot.add(o.specular),this._currentCubemapLights=o}else this._currentCubemapLights&&(this._lightRoot.remove(this._currentCubemapLights.diffuse),this._lightRoot.remove(this._currentCubemapLights.specular),this._currentCubemapLights=null)},updateSkybox:function(t,e,n){var i=e.get("environment"),r=this;var o=(r._skybox=r._skybox||new Rz,r._skybox);if(i&&"none"!==i)if("auto"===i)if(this._isSkyboxFromAmbientCubemap=!0,this._currentCubemapLights){var a=this._currentCubemapLights.specular.cubemap;o.setEnvironmentMap(a),this._scene&&o.attachScene(this._scene),o.material.set("lod",3)}else this._skybox&&this._skybox.detachScene();else if("object"==typeof i&&i.colorStops||"string"==typeof i&&Ri(i)){this._isSkyboxFromAmbientCubemap=!1;var s=new _V.Texture2D({anisotropic:8,flipY:!1});o.setEnvironmentMap(s);var l=s.image=document.createElement("canvas");l.width=l.height=16,v_(l.getContext("2d"),new Fl({shape:{x:0,y:0,width:16,height:16},style:{fill:i}})),o.attachScene(this._scene)}else{this._isSkyboxFromAmbientCubemap=!1;s=_V.loadTexture(i,n,{anisotropic:8,flipY:!1});o.setEnvironmentMap(s),o.attachScene(this._scene)}else this._skybox&&this._skybox.detachScene(this._scene),this._skybox=null;var u=e.coordinateSystem;if(this._skybox)if(!u||!u.viewGL||"auto"===i||i.match&&i.match(/.hdr$/))this._skybox.material.undefine("fragment","SRGB_DECODE");else{var h=u.viewGL.isLinearSpace()?"define":"undefine";this._skybox.material[h]("fragment","SRGB_DECODE")}}};const QV=JV;var $V=UV.vec3,tG=xk.extend((function(){return{segmentScale:1,useNativeLine:!0,attributes:{position:new xk.Attribute("position","float",3,"POSITION"),normal:new xk.Attribute("normal","float",3,"NORMAL"),color:new xk.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setQuadCount:function(t){var e=this.attributes,n=this.getQuadVertexCount()*t,i=this.getQuadTriangleCount()*t;this.vertexCount!==n&&(e.position.init(n),e.normal.init(n),e.color.init(n)),this.triangleCount!==i&&(this.indices=n>65535?new Uint32Array(3*i):new Uint16Array(3*i))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var t=$V.create(),e=$V.create(),n=$V.create(),i=[0,3,1,3,2,1];return function(r,o){var a=this.attributes.position,s=this.attributes.normal,l=this.attributes.color;$V.sub(t,r[1],r[0]),$V.sub(e,r[2],r[1]),$V.cross(n,t,e),$V.normalize(n,n);for(var u=0;u<4;u++)a.set(this._vertexOffset+u,r[u]),l.set(this._vertexOffset+u,o),s.set(this._vertexOffset+u,n);var h=3*this._faceOffset;for(u=0;u<6;u++)this.indices[h+u]=i[u]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});ot(tG.prototype,HV);const eG=tG;var nG=xB.firstNotNull,iG={x:0,y:2,z:1};function rG(t,e,n){this.rootNode=new _V.Node;var i=new _V.Mesh({geometry:new XV({useNativeLine:!1}),material:e,castShadow:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:1}),r=new _V.Mesh({geometry:new eG,material:n,castShadow:!1,culling:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:0});this.rootNode.add(r),this.rootNode.add(i),this.faceInfo=t,this.plane=new _V.Plane,this.linesMesh=i,this.quadsMesh=r}rG.prototype.update=function(t,e,n){var i=t.coordinateSystem,r=[i.getAxis(this.faceInfo[0]),i.getAxis(this.faceInfo[1])],o=this.linesMesh.geometry,a=this.quadsMesh.geometry;o.convertToDynamicArray(!0),a.convertToDynamicArray(!0),this._updateSplitLines(o,r,t,n),this._udpateSplitAreas(a,r,t,n),o.convertToTypedArray(),a.convertToTypedArray();var s=i.getAxis(this.faceInfo[2]);!function(t,e,n,i){var r=[0,0,0],o=i<0?n.getExtentMin():n.getExtentMax();r[iG[n.dim]]=o,t.position.setArray(r),t.rotation.identity(),e.distance=-Math.abs(o),e.normal.set(0,0,0),"x"===n.dim?(t.rotation.rotateY(i*Math.PI/2),e.normal.x=-i):"z"===n.dim?(t.rotation.rotateX(-i*Math.PI/2),e.normal.y=-i):(i>0&&t.rotation.rotateY(Math.PI),e.normal.z=-i)}(this.rootNode,this.plane,s,this.faceInfo[3])},rG.prototype._updateSplitLines=function(t,e,n,i){var r=i.getDevicePixelRatio();e.forEach((function(i,o){var a=i.model,s=e[1-o].getExtent();if(!i.scale.isBlank()){var l=a.getModel("splitLine",n.getModel("splitLine"));if(l.get("show")){var u=l.getModel("lineStyle"),h=u.get("color"),c=nG(u.get("opacity"),1),d=nG(u.get("width"),1);h=yt(h)?h:[h];for(var f=i.getTicksCoords({tickModel:l}),p=0,g=0;g65535?new Uint32Array(3*n):new Uint16Array(3*n))},setSpriteAlign:function(t,e,n,i,r){var o,a,s,l;switch(null==n&&(n="left"),null==i&&(i="top"),r=r||0,n){case"left":o=r,s=e[0]+r;break;case"center":case"middle":o=-e[0]/2,s=e[0]/2;break;case"right":o=-e[0]-r,s=-r}switch(i){case"bottom":a=r,l=e[1]+r;break;case"middle":a=-e[1]/2,l=e[1]/2;break;case"top":a=-e[1]-r,l=-r}var u=4*t,h=this.attributes.offset;h.set(u,[o,l]),h.set(u+1,[s,l]),h.set(u+2,[s,a]),h.set(u+3,[o,a])},addSprite:function(t,e,n,i,r,o){var a=this._vertexOffset;this.setSprite(this._vertexOffset/4,t,e,n,i,r,o);for(var s=0;s 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end";var mG=xB.firstNotNull;_V.Shader.import(gG);var vG={x:0,y:2,z:1};const _G=Dp.extend({type:"grid3D",__ecgl__:!0,init:function(t,e){var n=new _V.Material({shader:_V.createShader("ecgl.color"),depthMask:!1,transparent:!0}),i=new _V.Material({shader:_V.createShader("ecgl.meshLines3D"),depthMask:!1,transparent:!0});n.define("fragment","DOUBLE_SIDED"),n.define("both","VERTEX_COLOR"),this.groupGL=new _V.Node,this._control=new GV({zr:e.getZr()}),this._control.init(),this._faces=[["y","z","x",-1,"left"],["y","z","x",1,"right"],["x","y","z",-1,"bottom"],["x","y","z",1,"top"],["x","z","y",-1,"far"],["x","z","y",1,"near"]].map((function(t){var e=new oG(t,i,n);return this.groupGL.add(e.rootNode),e}),this),this._axes=["x","y","z"].map((function(t){var e=new pG(t,i);return this.groupGL.add(e.rootNode),e}),this);var r=e.getDevicePixelRatio();this._axisLabelSurface=new KV({width:256,height:256,devicePixelRatio:r}),this._axisLabelSurface.onupdate=function(){e.getZr().refresh()},this._axisPointerLineMesh=new _V.Mesh({geometry:new XV({useNativeLine:!1}),material:i,castShadow:!1,ignorePicking:!0,renderOrder:3}),this.groupGL.add(this._axisPointerLineMesh),this._axisPointerLabelsSurface=new KV({width:128,height:128,devicePixelRatio:r}),this._axisPointerLabelsMesh=new uG({ignorePicking:!0,renderOrder:4,castShadow:!1}),this._axisPointerLabelsMesh.material.set("textureAtlas",this._axisPointerLabelsSurface.getTexture()),this.groupGL.add(this._axisPointerLabelsMesh),this._lightRoot=new _V.Node,this._sceneHelper=new QV,this._sceneHelper.initLight(this._lightRoot)},render:function(t,e,n){this._model=t,this._api=n;var i=t.coordinateSystem;i.viewGL.add(this._lightRoot),t.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL);var r=this._control;r.setViewGL(i.viewGL);var o=t.getModel("viewControl");r.setFromViewControlModel(o,0),this._axisLabelSurface.clear(),r.off("update"),t.get("show")&&(this._faces.forEach((function(i){i.update(t,e,n)}),this),this._axes.forEach((function(e){e.update(t,this._axisLabelSurface,n)}),this)),r.on("update",this._onCameraChange.bind(this,t,n),this),this._sceneHelper.setScene(i.viewGL.scene),this._sceneHelper.updateLight(t),i.viewGL.setPostEffect(t.getModel("postEffect"),n),i.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._initMouseHandler(t)},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n)},showAxisPointer:function(t,e,n,i){this._doShowAxisPointer(),this._updateAxisPointer(i.value)},hideAxisPointer:function(t,e,n,i){this._doHideAxisPointer()},_initMouseHandler:function(t){var e=t.coordinateSystem.viewGL;t.get("show")&&t.get("axisPointer.show")?e.on("mousemove",this._updateAxisPointerOnMousePosition,this):e.off("mousemove",this._updateAxisPointerOnMousePosition)},_updateAxisPointerOnMousePosition:function(t){if(!t.target){for(var e,n=this._model.coordinateSystem,i=n.viewGL,r=i.castRay(t.offsetX,t.offsetY,new _V.Ray),o=0;oi[1]?0:1,a=this._faces[2*n+o],s=this._faces[2*n+1-o];a.rootNode.invisible=!0,s.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var t=this._model.coordinateSystem,e=t.getAxis("x"),n=t.getAxis("y"),i=t.getAxis("z"),r=i.getExtentMax(),o=i.getExtentMin(),a=e.getExtentMin(),s=e.getExtentMax(),l=n.getExtentMax(),u=n.getExtentMin(),h=this._axes[0].rootNode,c=this._axes[1].rootNode,d=this._axes[2].rootNode,f=this._faces,p=f[4].rootNode.invisible?u:l,g=f[2].rootNode.invisible?r:o,m=f[0].rootNode.invisible?a:s,v=f[2].rootNode.invisible?r:o,_=f[0].rootNode.invisible?s:a,y=f[4].rootNode.invisible?u:l;h.rotation.identity(),c.rotation.identity(),d.rotation.identity(),f[4].rootNode.invisible&&(this._axes[0].flipped=!0,h.rotation.rotateX(Math.PI)),f[0].rootNode.invisible&&(this._axes[1].flipped=!0,c.rotation.rotateZ(Math.PI)),f[4].rootNode.invisible&&(this._axes[2].flipped=!0,d.rotation.rotateY(Math.PI)),h.position.set(0,g,p),c.position.set(m,v,0),d.position.set(_,0,y),h.update(),c.update(),d.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var t=this._control.getCamera(),e=[new _V.Vector4,new _V.Vector4],n=new _V.Vector4;this.groupGL.getWorldPosition(n),n.w=1,n.transformMat4(t.viewMatrix).transformMat4(t.projectionMatrix),n.x/=n.w,n.y/=n.w,this._axes.forEach((function(i){for(var r=i.axisLineCoords,o=(i.labelsMesh.geometry,0);on.y?"bottom":"top"):(s="middle",a=h>n.x?"left":"right"),i.setSpriteAlign(a,s,this._api)}),this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(t){var e=this._model.coordinateSystem,n=e.dataToPoint(t),i=this._axisPointerLineMesh.geometry,r=this._model.getModel("axisPointer"),o=this._api.getDevicePixelRatio();function a(t){return xB.firstNotNull(t.model.get("axisPointer.show"),r.get("show"))}function s(t){var e=t.model.getModel("axisPointer",r).getModel("lineStyle"),n=_V.parseColor(e.get("color")),i=mG(e.get("width"),1),o=mG(e.get("opacity"),1);return n[3]*=o,{color:n,lineWidth:i}}i.convertToDynamicArray(!0);for(var l=0;l 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n#ifdef USE_VSM\n depth = depth * 0.5 + 0.5;\n float moment1 = depth;\n float moment2 = depth * depth;\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n moment2 += 0.25*(dx*dx+dy*dy);\n #endif\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\n#else\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\n #else\n depth += bias;\n #endif\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\n#endif\n}\n@end\n@export clay.sm.debug_depth\nuniform sampler2D depthMap;\nvarying vec2 v_Texcoord;\n@import clay.util.decode_float\nvoid main() {\n vec4 tex = texture2D(depthMap, v_Texcoord);\n#ifdef USE_VSM\n gl_FragColor = vec4(tex.rgb, 1.0);\n#else\n float depth = decodeFloat(tex);\n gl_FragColor = vec4(depth, depth, depth, 1.0);\n#endif\n}\n@end\n@export clay.sm.distance.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 world : WORLD;\nattribute vec3 position : POSITION;\n@import clay.chunk.skinning_header\nvarying vec3 v_WorldPosition;\nvoid main (){\n vec4 P = vec4(position, 1.0);\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = skinMatrixWS * P;\n#endif\n#ifdef INSTANCING\n @import clay.chunk.instancing_matrix\n P = instanceMat * P;\n#endif\n gl_Position = worldViewProjection * P;\n v_WorldPosition = (world * P).xyz;\n}\n@end\n@export clay.sm.distance.fragment\nuniform vec3 lightPosition;\nuniform float range : 100;\nvarying vec3 v_WorldPosition;\n@import clay.util.encode_float\nvoid main(){\n float dist = distance(lightPosition, v_WorldPosition);\n#ifdef USE_VSM\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\n#else\n dist = dist / range;\n gl_FragColor = encodeFloat(dist);\n#endif\n}\n@end\n@export clay.plugin.shadow_map_common\n@import clay.util.decode_float\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\n vec4 tex = texture2D(map, uv);\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\n float shadowContrib = tapShadowMap(map, uv, z);\n vec2 offset = vec2(1.0 / textureSize) * scale;\n#ifdef PCF_KERNEL_SIZE\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\n }}\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\n#else\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\n return shadowContrib / 9.0;\n#endif\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\n return pcf(map, uv, z, textureSize, vec2(1.0));\n}\nfloat chebyshevUpperBound(vec2 moments, float z){\n float p = 0.0;\n z = z * 0.5 + 0.5;\n if (z <= moments.x) {\n p = 1.0;\n }\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.0000001);\n float mD = moments.x - z;\n float pMax = variance / (variance + mD * mD);\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\n return max(p, pMax);\n}\nfloat computeShadowContrib(\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\n) {\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\n posInLightSpace.xyz /= posInLightSpace.w;\n float z = posInLightSpace.z;\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\n #ifdef USE_VSM\n vec2 moments = texture2D(map, uv * scale + offset).xy;\n return chebyshevUpperBound(moments, z);\n #else\n return pcf(map, uv * scale + offset, z, textureSize, scale);\n #endif\n }\n return 1.0;\n}\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\n}\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\n{\n float dist = length(direction);\n vec4 shadowTex = textureCube(map, direction);\n#ifdef USE_VSM\n vec2 moments = shadowTex.xy;\n float variance = moments.y - moments.x * moments.x;\n float mD = moments.x - dist;\n float p = variance / (variance + mD * mD);\n if(moments.x + 0.001 < dist){\n return clamp(p, 0.0, 1.0);\n }else{\n return 1.0;\n }\n#else\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\n#endif\n}\n@end\n@export clay.plugin.compute_shadow_map\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\n#if defined(SHADOW_CASCADE)\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\n#else\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#endif\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\nuniform bool shadowEnabled : true;\n#ifdef PCF_KERNEL_SIZE\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\n#endif\n@import clay.plugin.shadow_map_common\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\n spotLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n#ifdef SHADOW_CASCADE\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\n / (gl_DepthRange.far - gl_DepthRange.near);\n float shadowContrib;\n shadowContribs[0] = 1.0;\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\n if (\n depth >= shadowCascadeClipsNear[_idx_] &&\n depth <= shadowCascadeClipsFar[_idx_]\n ) {\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[0],\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\n );\n shadowContribs[0] = shadowContrib;\n }\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#else\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\n vec3 lightPosition;\n vec3 direction;\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n lightPosition = pointLightPosition[_idx_];\n direction = position - lightPosition;\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\n }}\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n@end");var PG,EG,OG,NG,RG,kG,zG,BG=vE.extend((function(){return{softShadow:BG.PCF,shadowBlur:1,lightFrustumBias:"auto",kernelPCF:new Float32Array([1,0,1,1,-1,1,0,1,-1,0,-1,-1,1,-1,0,-1]),precision:"highp",_lastRenderNotCastShadow:!1,_frameBuffer:new Tz,_textures:{},_shadowMapNumber:{POINT_LIGHT:0,DIRECTIONAL_LIGHT:0,SPOT_LIGHT:0},_depthMaterials:{},_distanceMaterials:{},_receivers:[],_lightsCastShadow:[],_lightCameras:{},_lightMaterials:{},_texturePool:new LG}}),(function(){this._gaussianPassH=new aB({fragment:LN.source("clay.compositor.gaussian_blur")}),this._gaussianPassV=new aB({fragment:LN.source("clay.compositor.gaussian_blur")}),this._gaussianPassH.setUniform("blurSize",this.shadowBlur),this._gaussianPassH.setUniform("blurDir",0),this._gaussianPassV.setUniform("blurSize",this.shadowBlur),this._gaussianPassV.setUniform("blurDir",1),this._outputDepthPass=new aB({fragment:LN.source("clay.sm.debug_depth")})}),{render:function(t,e,n,i){n||(n=e.getMainCamera()),this.trigger("beforerender",this,t,e,n),this._renderShadowPass(t,e,n,i),this.trigger("afterrender",this,t,e,n)},renderDebug:function(t,e){t.saveClear();var n=t.viewport,i=0,r=e||n.width/4,o=r;for(var a in this.softShadow===BG.VSM?this._outputDepthPass.material.define("fragment","USE_VSM"):this._outputDepthPass.material.undefine("fragment","USE_VSM"),this._textures){var s=this._textures[a];t.setViewport(i,0,r*s.width/s.height,o),this._outputDepthPass.setUniform("depthMap",s),this._outputDepthPass.render(t),i+=r*s.width/s.height}t.setViewport(n),t.restoreClear()},_updateReceivers:function(t,e){if(e.receiveShadow?(this._receivers.push(e),e.material.set("shadowEnabled",1),e.material.set("pcfKernel",this.kernelPCF)):e.material.set("shadowEnabled",0),this.softShadow===BG.VSM)e.material.define("fragment","USE_VSM"),e.material.undefine("fragment","PCF_KERNEL_SIZE");else{e.material.undefine("fragment","USE_VSM");var n=this.kernelPCF;n&&n.length?e.material.define("fragment","PCF_KERNEL_SIZE",n.length/2):e.material.undefine("fragment","PCF_KERNEL_SIZE")}},_update:function(t,e){var n=this;e.traverse((function(e){e.isRenderable()&&n._updateReceivers(t,e)}));for(var i=0;i4){console.warn("Support at most 4 cascade");continue}p.shadowCascade>1&&(a=p),this.renderDirectionalLightShadow(t,e,n,p,c,h,u)}else"SPOT_LIGHT"===p.type?this.renderSpotLightShadow(t,e,p,l,s):"POINT_LIGHT"===p.type&&this.renderPointLightShadow(t,e,p,d);this._shadowMapNumber[p.type]++}for(var g in this._shadowMapNumber){var m=this._shadowMapNumber[g],v=g+"_SHADOWMAP_COUNT";for(f=0;f0?_.define("fragment",v,m):_.isDefined("fragment",v)&&_.undefine("fragment",v))}}for(f=0;f0){var x=u.map(T);if(y.directionalLightShadowMaps={value:u,type:"tv"},y.directionalLightMatrices={value:h,type:"m4v"},y.directionalLightShadowMapSizes={value:x,type:"1fv"},a){var w=c.slice(),b=c.slice();w.pop(),b.shift(),w.reverse(),b.reverse(),h.reverse(),y.shadowCascadeClipsNear={value:w,type:"1fv"},y.shadowCascadeClipsFar={value:b,type:"1fv"}}}if(s.length>0){var S=s.map(T);(y=e.shadowUniforms).spotLightShadowMaps={value:s,type:"tv"},y.spotLightMatrices={value:l,type:"m4v"},y.spotLightShadowMapSizes={value:S,type:"1fv"}}d.length>0&&(y.pointLightShadowMaps={value:d,type:"tv"})}function T(t){return t.height}},renderDirectionalLightShadow:(PG=new Hk,EG=new MR,OG=new FR,NG=new MR,RG=new MR,kG=new MR,zG=new MR,function(t,e,n,i,r,o,a){var s=this._getDepthMaterial(i),l={getMaterial:function(t){return t.shadowDepthMaterial||s},isMaterialChanged:IG,getUniform:DG,ifRender:function(t){return t.castShadow},sortCompare:jN.opaqueSortCompare};if(!e.viewBoundingBoxLastFrame.isFinite()){var u=e.getBoundingBox();e.viewBoundingBoxLastFrame.copy(u).applyTransform(n.viewMatrix)}var h=Math.min(-e.viewBoundingBoxLastFrame.min.z,n.far),c=Math.max(-e.viewBoundingBoxLastFrame.max.z,n.near),d=this._getDirectionalLightCamera(i,e,n),f=kG.array;zG.copy(d.projectionMatrix),IN.invert(RG.array,d.worldTransform.array),IN.multiply(RG.array,RG.array,n.worldTransform.array),IN.multiply(f,zG.array,RG.array);for(var p=[],g=n instanceof dz,m=(n.near+n.far)/(n.near-n.far),v=2*n.near*n.far/(n.near-n.far),_=0;_<=i.shadowCascade;_++){var y=c*Math.pow(h/c,_/i.shadowCascade),x=c+(h-c)*_/i.shadowCascade,w=y*i.cascadeSplitLogFactor+x*(1-i.cascadeSplitLogFactor);p.push(w),r.push(-(-w*m+v)/-w)}var b=this._getTexture(i,i.shadowCascade);a.push(b);var S=t.viewport,T=t.gl;for(this._frameBuffer.attach(b),this._frameBuffer.bind(t),T.clear(T.COLOR_BUFFER_BIT|T.DEPTH_BUFFER_BIT),_=0;_d?s>f?p[r>0?"px":"nx"]=!0:p[a>0?"pz":"nz"]=!0:d>f?p[o>0?"py":"ny"]=!0:p[a>0?"pz":"nz"]=!0}for(n=0;n0)this.outputs[t].keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t])}}});var GG=vE.extend((function(){return{nodes:[]}}),{dirty:function(){this._dirty=!0},addNode:function(t){this.nodes.indexOf(t)>=0||(this.nodes.push(t),this._dirty=!0)},removeNode:function(t){"string"==typeof t&&(t=this.getNodeByName(t));var e=this.nodes.indexOf(t);e>=0&&(this.nodes.splice(e,1),this._dirty=!0)},getNodeByName:function(t){for(var e=0;e=n.COLOR_ATTACHMENT0&&h<=n.COLOR_ATTACHMENT0+8&&u.push(h);l.drawBuffersEXT(u)}t.saveClear(),t.clearBit=wE|SE,e=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),t.restoreClear(),i.unbind(t)}else e=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ);this.trigger("afterrender",e),this._rendering=!1,this._rendered=!0}});const jG=VG.extend((function(){return{texture:null,outputs:{color:{}}}}),(function(){}),{getOutput:function(t,e){return this.texture},beforeFrame:function(){},afterFrame:function(){}});const ZG=VG.extend((function(){return{name:"",inputs:{},outputs:null,shader:"",inputLinks:{},outputLinks:{},pass:null,_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}}),(function(){var t=new aB({fragment:this.shader});this.pass=t}),{render:function(t,e){this.trigger("beforerender",t),this._rendering=!0;var n=t.gl;for(var i in this.inputLinks){var r=(c=this.inputLinks[i]).node.getOutput(t,c.pin);this.pass.setUniform(i,r)}if(this.outputs){this.pass.outputs={};var o={};for(var a in this.outputs){var s=this.updateParameter(a,t);isNaN(s.width)&&this.updateParameter(a,t);var l=this.outputs[a],u=this._compositor.allocateTexture(s);this._outputTextures[a]=u,"string"==typeof(h=l.attachment||n.COLOR_ATTACHMENT0)&&(h=n[h]),o[h]=u}for(var h in this._compositor.getFrameBuffer().bind(t),o)this._compositor.getFrameBuffer().attach(o[h],h);this.pass.render(t),this._compositor.getFrameBuffer().updateMipmap(t)}else this.pass.outputs=null,this._compositor.getFrameBuffer().unbind(t),this.pass.render(t,e);for(var i in this.inputLinks){var c;(c=this.inputLinks[i]).node.removeReference(c.pin)}this._rendering=!1,this._rendered=!0,this.trigger("afterrender",t)},updateParameter:function(t,e){var n,i,r=this.outputs[t],o=r.parameters,a=r._parametersCopy;if(a||(a=r._parametersCopy={}),o)for(var s in o)"width"!==s&&"height"!==s&&(a[s]=o[s]);return n="function"==typeof o.width?o.width.call(this,e):o.width,i="function"==typeof o.height?o.height.call(this,e):o.height,n=Math.ceil(n),i=Math.ceil(i),a.width===n&&a.height===i||this._outputTextures[t]&&this._outputTextures[t].dispose(e),a.width=n,a.height=i,a},setParameter:function(t,e){this.pass.setUniform(t,e)},getParameter:function(t){return this.pass.getUniform(t)},setParameters:function(t){for(var e in t)this.setParameter(e,t[e])},define:function(t,e){this.pass.material.define("fragment",t,e)},undefine:function(t){this.pass.material.undefine("fragment",t)},removeReference:function(t){(this._outputReferences[t]--,0===this._outputReferences[t])&&(this.outputs[t].keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t]))},clear:function(){VG.prototype.clear.call(this),this.pass.material.disableTexturesAll()}}),XG="@export clay.compositor.kernel.gaussian_9\nfloat gaussianKernel[9];\ngaussianKernel[0] = 0.07;\ngaussianKernel[1] = 0.09;\ngaussianKernel[2] = 0.12;\ngaussianKernel[3] = 0.14;\ngaussianKernel[4] = 0.16;\ngaussianKernel[5] = 0.14;\ngaussianKernel[6] = 0.12;\ngaussianKernel[7] = 0.09;\ngaussianKernel[8] = 0.07;\n@end\n@export clay.compositor.kernel.gaussian_13\nfloat gaussianKernel[13];\ngaussianKernel[0] = 0.02;\ngaussianKernel[1] = 0.03;\ngaussianKernel[2] = 0.06;\ngaussianKernel[3] = 0.08;\ngaussianKernel[4] = 0.11;\ngaussianKernel[5] = 0.13;\ngaussianKernel[6] = 0.14;\ngaussianKernel[7] = 0.13;\ngaussianKernel[8] = 0.11;\ngaussianKernel[9] = 0.08;\ngaussianKernel[10] = 0.06;\ngaussianKernel[11] = 0.03;\ngaussianKernel[12] = 0.02;\n@end\n@export clay.compositor.gaussian_blur\n#define SHADER_NAME gaussian_blur\nuniform sampler2D texture;varying vec2 v_Texcoord;\nuniform float blurSize : 2.0;\nuniform vec2 textureSize : [512.0, 512.0];\nuniform float blurDir : 0.0;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main (void)\n{\n @import clay.compositor.kernel.gaussian_9\n vec2 off = blurSize / textureSize;\n off *= vec2(1.0 - blurDir, blurDir);\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n for (int i = 0; i < 9; i++) {\n float w = gaussianKernel[i];\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\n sum += texel * w;\n weightAll += w;\n }\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\n}\n@end\n",qG="\n@export clay.compositor.lut\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform sampler2D lookup;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n float blueColor = tex.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec4 newColor1 = texture2D(lookup, texPos1);\n vec4 newColor2 = texture2D(lookup, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n gl_FragColor = vec4(newColor.rgb, tex.w);\n}\n@end",YG="@export clay.compositor.output\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = tex.rgb;\n#ifdef OUTPUT_ALPHA\n gl_FragColor.a = tex.a;\n#else\n gl_FragColor.a = 1.0;\n#endif\n gl_FragColor = encodeHDR(gl_FragColor);\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",KG="@export clay.compositor.bright\nuniform sampler2D texture;\nuniform float threshold : 1;\nuniform float scale : 1.0;\nuniform vec2 textureSize: [512, 512];\nvarying vec2 v_Texcoord;\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvec4 median(vec4 a, vec4 b, vec4 c)\n{\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\n}\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n#ifdef ANTI_FLICKER\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\n texel = median(median(texel, s1, s2), s3, s4);\n#endif\n float lum = dot(texel.rgb , lumWeight);\n vec4 color;\n if (lum > threshold && texel.a > 0.0)\n {\n color = vec4(texel.rgb * scale, texel.a * scale);\n }\n else\n {\n color = vec4(0.0);\n }\n gl_FragColor = encodeHDR(color);\n}\n@end\n",JG="@export clay.compositor.downsample\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nfloat brightness(vec3 c)\n{\n return max(max(c.r, c.g), c.b);\n}\n@import clay.util.clamp_sample\nvoid main()\n{\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\n#ifdef ANTI_FLICKER\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\n float s1w = 1.0 / (brightness(s1) + 1.0);\n float s2w = 1.0 / (brightness(s2) + 1.0);\n float s3w = 1.0 / (brightness(s3) + 1.0);\n float s4w = 1.0 / (brightness(s4) + 1.0);\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\n vec4 color = vec4(\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\n 1.0\n );\n#else\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n color *= 0.25;\n#endif\n gl_FragColor = encodeHDR(color);\n}\n@end",QG="\n@export clay.compositor.upsample\n#define HIGH_QUALITY\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nuniform float sampleScale: 0.5;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main()\n{\n#ifdef HIGH_QUALITY\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n gl_FragColor = encodeHDR(s / 16.0);\n#else\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n gl_FragColor = encodeHDR(s / 4.0);\n#endif\n}\n@end",$G="@export clay.compositor.hdr.composite\n#define TONEMAPPING\nuniform sampler2D texture;\n#ifdef BLOOM_ENABLED\nuniform sampler2D bloom;\n#endif\n#ifdef LENSFLARE_ENABLED\nuniform sampler2D lensflare;\nuniform sampler2D lensdirt;\n#endif\n#ifdef LUM_ENABLED\nuniform sampler2D lum;\n#endif\n#ifdef LUT_ENABLED\nuniform sampler2D lut;\n#endif\n#ifdef COLOR_CORRECTION\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float saturation : 1.0;\n#endif\n#ifdef VIGNETTE\nuniform float vignetteDarkness: 1.0;\nuniform float vignetteOffset: 1.0;\n#endif\nuniform float exposure : 1.0;\nuniform float bloomIntensity : 0.25;\nuniform float lensflareIntensity : 1;\nvarying vec2 v_Texcoord;\n@import clay.util.srgb\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nfloat eyeAdaption(float fLum)\n{\n return mix(0.2, fLum, 0.5);\n}\n#ifdef LUT_ENABLED\nvec3 lutTransform(vec3 color) {\n float blueColor = color.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return newColor.rgb;\n}\n#endif\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = vec4(0.0);\n vec4 originalTexel = vec4(0.0);\n#ifdef TEXTURE_ENABLED\n texel = decodeHDR(texture2D(texture, v_Texcoord));\n originalTexel = texel;\n#endif\n#ifdef BLOOM_ENABLED\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\n texel.rgb += bloomTexel.rgb * bloomIntensity;\n texel.a += bloomTexel.a * bloomIntensity;\n#endif\n#ifdef LENSFLARE_ENABLED\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\n#endif\n texel.a = min(texel.a, 1.0);\n#ifdef LUM_ENABLED\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\n float exposureBias = adaptedLumDest * exposure;\n#else\n float exposureBias = exposure;\n#endif\n#ifdef TONEMAPPING\n texel.rgb *= exposureBias;\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n texel = linearTosRGB(texel);\n#ifdef LUT_ENABLED\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\n#endif\n#ifdef COLOR_CORRECTION\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\n#endif\n#ifdef VIGNETTE\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\n#endif\n gl_FragColor = encodeHDR(texel);\n#ifdef DEBUG\n #if DEBUG == 1\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\n #elif DEBUG == 2\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\n #elif DEBUG == 3\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\n #endif\n#endif\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\n }\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",tH="@export clay.compositor.blend\n#define SHADER_NAME blend\n#ifdef TEXTURE1_ENABLED\nuniform sampler2D texture1;\nuniform float weight1 : 1.0;\n#endif\n#ifdef TEXTURE2_ENABLED\nuniform sampler2D texture2;\nuniform float weight2 : 1.0;\n#endif\n#ifdef TEXTURE3_ENABLED\nuniform sampler2D texture3;\nuniform float weight3 : 1.0;\n#endif\n#ifdef TEXTURE4_ENABLED\nuniform sampler2D texture4;\nuniform float weight4 : 1.0;\n#endif\n#ifdef TEXTURE5_ENABLED\nuniform sampler2D texture5;\nuniform float weight5 : 1.0;\n#endif\n#ifdef TEXTURE6_ENABLED\nuniform sampler2D texture6;\nuniform float weight6 : 1.0;\n#endif\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = vec4(0.0);\n#ifdef TEXTURE1_ENABLED\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\n#endif\n#ifdef TEXTURE2_ENABLED\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\n#endif\n#ifdef TEXTURE3_ENABLED\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\n#endif\n#ifdef TEXTURE4_ENABLED\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\n#endif\n#ifdef TEXTURE5_ENABLED\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\n#endif\n#ifdef TEXTURE6_ENABLED\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\n#endif\n gl_FragColor = encodeHDR(tex);\n}\n@end",eH="@export clay.compositor.fxaa\nuniform sampler2D texture;\nuniform vec4 viewport : VIEWPORT;\nvarying vec2 v_Texcoord;\n#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\n@import clay.util.rgbm\nvoid main()\n{\n vec2 resolution = 1.0 / viewport.zw;\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\n vec3 rgbM = rgbaM.xyz;\n float opacity = rgbaM.w;\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float lumaNW = dot( rgbNW, luma );\n float lumaNE = dot( rgbNE, luma );\n float lumaSW = dot( rgbSW, luma );\n float lumaSE = dot( rgbSE, luma );\n float lumaM = dot( rgbM, luma );\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * resolution;\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA *= 0.5;\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\n rgbB *= 0.25;\n rgbB += rgbA * 0.5;\n float lumaB = dot( rgbB, luma );\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\n {\n gl_FragColor = vec4( rgbA, opacity );\n }\n else {\n gl_FragColor = vec4( rgbB, opacity );\n }\n}\n@end";!function(t){t.import("@export clay.compositor.coloradjust\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float exposure : 0.0;\nuniform float gamma : 1.0;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\n float luminance = dot( color, w );\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.brightness\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = tex.rgb + vec3(brightness);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.contrast\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float contrast : 1.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.exposure\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float exposure : 0.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb * pow(2.0, exposure);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.gamma\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float gamma : 1.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = pow(tex.rgb, vec3(gamma));\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.saturation\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb;\n float luminance = dot(color, w);\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end"),t.import(XG),t.import("@export clay.compositor.hdr.log_lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n float luminance = dot(tex.rgb, w);\n luminance = log(luminance + 0.001);\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\n}\n@end\n@export clay.compositor.hdr.lum_adaption\nvarying vec2 v_Texcoord;\nuniform sampler2D adaptedLum;\nuniform sampler2D currentLum;\nuniform float frameTime : 0.02;\n@import clay.util.rgbm\nvoid main()\n{\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\n}\n@end\n@export clay.compositor.lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord );\n float luminance = dot(tex.rgb, w);\n gl_FragColor = vec4(vec3(luminance), 1.0);\n}\n@end"),t.import(qG),t.import("@export clay.compositor.vignette\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float darkness: 1;\nuniform float offset: 1;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = texel.rgb;\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\n}\n@end"),t.import(YG),t.import(KG),t.import(JG),t.import(QG),t.import($G),t.import("@export clay.compositor.lensflare\n#define SAMPLE_NUMBER 8\nuniform sampler2D texture;\nuniform sampler2D lenscolor;\nuniform vec2 textureSize : [512, 512];\nuniform float dispersal : 0.3;\nuniform float haloWidth : 0.4;\nuniform float distortion : 1.0;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvec4 textureDistorted(\n in vec2 texcoord,\n in vec2 direction,\n in vec3 distortion\n) {\n return vec4(\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\n 1.0\n );\n}\nvoid main()\n{\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\n vec4 result = vec4(0.0);\n for (int i = 0; i < SAMPLE_NUMBER; i++)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n }\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n vec2 offset = fract(texcoord + haloVec);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n gl_FragColor = result;\n}\n@end"),t.import(tH),t.import(eH)}(LN);var nH=/^#source\((.*?)\)/;function iH(t,e,n){var i,r,o,a,s=t.type||"filter";if("filter"===s){var l=t.shader.trim(),u=nH.exec(l);if(u?i=LN.source(u[1].trim()):"#"===l.charAt(0)&&(i=e.shaders[l.substr(1)]),i||(i=l),!i)return}if(t.inputs)for(var h in r={},t.inputs)"string"==typeof t.inputs[h]?r[h]=t.inputs[h]:r[h]={node:t.inputs[h].node,pin:t.inputs[h].pin};if(t.outputs)for(var h in o={},t.outputs){var c=t.outputs[h];o[h]={},null!=c.attachment&&(o[h].attachment=c.attachment),null!=c.keepLastFrame&&(o[h].keepLastFrame=c.keepLastFrame),null!=c.outputLastFrame&&(o[h].outputLastFrame=c.outputLastFrame),c.parameters&&(o[h].parameters=aH(c.parameters))}if(a="scene"===s?new WG({name:t.name,scene:n.scene,camera:n.camera,outputs:o}):"texture"===s?new jG({name:t.name,outputs:o}):new ZG({name:t.name,shader:i,inputs:r,outputs:o})){if(t.parameters)for(var h in t.parameters){"string"==typeof(d=t.parameters[h])?"#"===(d=d.trim()).charAt(0)?d=e.textures[d.substr(1)]:a.on("beforerender",sH(h,lH(d))):"function"==typeof d&&a.on("beforerender",d),a.setParameter(h,d)}if(t.defines&&a.pass)for(var h in t.defines){var d=t.defines[h];a.pass.material.define("fragment",h,d)}}return a}function rH(t,e){return t}function oH(t,e){return e}function aH(t){var e={};if(!t)return e;["type","minFilter","magFilter","wrapS","wrapT","flipY","useMipmap"].forEach((function(n){var i=t[n];null!=i&&("string"==typeof i&&(i=$R[i]),e[n]=i)}));var n=t.scale||1;return["width","height"].forEach((function(i){if(null!=t[i]){var r=t[i];"string"==typeof r?(r=r.trim(),e[i]=function(t,e,n){return n=n||1,function(t){var i=t.getDevicePixelRatio(),r=t.getWidth()*n,o=t.getHeight()*n;return e(r,o,i)}}(0,lH(r),n)):e[i]=r}})),e.width||(e.width=rH),e.height||(e.height=oH),null!=t.useMipmap&&(e.useMipmap=t.useMipmap),e}function sH(t,e){return function(n){var i=n.getDevicePixelRatio(),r=n.getWidth(),o=n.getHeight(),a=e(r,o,i);this.setParameter(t,a)}}function lH(t){var e=/^expr\((.*)\)$/.exec(t);if(e)try{var n=new Function("width","height","dpr","return "+e[1]);return n(1,1),n}catch(t){throw new Error("Invalid expression.")}}const uH=function(t,e){var n=new UG;e=e||{};var i={textures:{},parameters:{}};for(var r in t.parameters){var o=t.parameters[r];i.parameters[r]=aH(o)}return function(t,e,n,i){if(!t.textures)return void i({});var r={},o=0,a=!1,s=n.textureRootPath;gE.each(t.textures,(function(t,e){var n,l=t.path,u=aH(t.parameters);if(Array.isArray(l)&&6===l.length)s&&(l=l.map((function(t){return gE.relative2absolute(t,s)}))),n=new hz(u);else{if("string"!=typeof l)return;s&&(l=gE.relative2absolute(l,s)),n=new sk(u)}n.load(l),o++,n.once("success",(function(){r[e]=n,0===--o&&(i(r),a=!0)}))})),0!==o||a||i(r)}(t,0,e,(function(r){i.textures=r,function(){for(var r=0;r0;)n+=i*(r%e),r=Math.floor(r/e),i/=e;return n};function cH(t){for(var e=new Uint8Array(t*t*4),n=0,i=new $N,r=0;r 0.99999) {\n gl_FragColor = vec4(1.0);\n return;\n }\n mat3 kernelBasis;\n#endif\n\n float z = depthTexel.r * 2.0 - 1.0;\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * projectedPos;\n\n vec3 position = p4.xyz / p4.w;\n\n float ao = ssaoEstimator(position, kernelBasis);\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n\n@end\n\n\n@export ecgl.ssao.blur\n#define SHADER_NAME SSAO_BLUR\n\nuniform sampler2D ssaoTexture;\n\n#ifdef NORMALTEX_ENABLED\nuniform sampler2D normalTex;\n#endif\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\nuniform int direction: 0.0;\n\n#ifdef DEPTHTEX_ENABLED\nuniform sampler2D depthTex;\nuniform mat4 projection;\nuniform float depthRange : 0.5;\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n#endif\n\nvoid main()\n{\n float kernel[5];\n kernel[0] = 0.122581;\n kernel[1] = 0.233062;\n kernel[2] = 0.288713;\n kernel[3] = 0.233062;\n kernel[4] = 0.122581;\n\n vec2 off = vec2(0.0);\n if (direction == 0) {\n off[0] = blurSize / textureSize.x;\n }\n else {\n off[1] = blurSize / textureSize.y;\n }\n\n vec2 coord = v_Texcoord;\n\n float sum = 0.0;\n float weightAll = 0.0;\n\n#ifdef NORMALTEX_ENABLED\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\n#endif\n#if defined(DEPTHTEX_ENABLED)\n float centerDepth = getLinearDepth(v_Texcoord);\n#endif\n\n for (int i = 0; i < 5; i++) {\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\n\n float w = kernel[i];\n#ifdef NORMALTEX_ENABLED\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\n#endif\n#ifdef DEPTHTEX_ENABLED\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\n#endif\n\n weightAll += w;\n sum += texture2D(ssaoTexture, coord).r * w;\n }\n\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\n}\n\n@end\n"),pH.prototype.setDepthTexture=function(t){this._depthTex=t},pH.prototype.setNormalTexture=function(t){this._normalTex=t,this._ssaoPass.material[t?"enableTexture":"disableTexture"]("normalTex"),this.setKernelSize(this._kernelSize)},pH.prototype.update=function(t,e,n){var i=t.getWidth(),r=t.getHeight(),o=this._ssaoPass,a=this._blurPass;o.setUniform("kernel",this._kernels[n%this._kernels.length]),o.setUniform("depthTex",this._depthTex),null!=this._normalTex&&o.setUniform("normalTex",this._normalTex),o.setUniform("depthTexSize",[this._depthTex.width,this._depthTex.height]);var s=new MR;MR.transpose(s,e.worldTransform),o.setUniform("projection",e.projectionMatrix.array),o.setUniform("projectionInv",e.invProjectionMatrix.array),o.setUniform("viewInverseTranspose",s.array);var l=this._ssaoTexture,u=this._blurTexture,h=this._blurTexture2;l.width=i/2,l.height=r/2,u.width=i,u.height=r,h.width=i,h.height=r,this._framebuffer.attach(l),this._framebuffer.bind(t),t.gl.clearColor(1,1,1,1),t.gl.clear(t.gl.COLOR_BUFFER_BIT),o.render(t),a.setUniform("textureSize",[i/2,r/2]),a.setUniform("projection",e.projectionMatrix.array),this._framebuffer.attach(u),a.setUniform("direction",0),a.setUniform("ssaoTexture",l),a.render(t),this._framebuffer.attach(h),a.setUniform("textureSize",[i,r]),a.setUniform("direction",1),a.setUniform("ssaoTexture",u),a.render(t),this._framebuffer.unbind(t);var c=t.clearColor;t.gl.clearColor(c[0],c[1],c[2],c[3])},pH.prototype.getTargetTexture=function(){return this._blurTexture2},pH.prototype.setParameter=function(t,e){"noiseTexSize"===t?this.setNoiseSize(e):"kernelSize"===t?this.setKernelSize(e):"intensity"===t?this._ssaoPass.material.set("intensity",e):this._ssaoPass.setUniform(t,e)},pH.prototype.setKernelSize=function(t){this._kernelSize=t,this._ssaoPass.material.define("fragment","KERNEL_SIZE",t),this._kernels=this._kernels||[];for(var e=0;e<30;e++)this._kernels[e]=fH(t,e*t,!!this._normalTex)},pH.prototype.setNoiseSize=function(t){var e=this._ssaoPass.getUniform("noiseTex");e?(e.data=cH(t),e.width=e.height=t,e.dirty()):(e=dH(t),this._ssaoPass.setUniform("noiseTex",dH(t))),this._ssaoPass.setUniform("noiseTexSize",[t,t])},pH.prototype.dispose=function(t){this._blurTexture.dispose(t),this._ssaoTexture.dispose(t),this._blurTexture2.dispose(t)};const gH=pH;function mH(t){t=t||{},this._ssrPass=new aB({fragment:LN.source("ecgl.ssr.main"),clearColor:[0,0,0,0]}),this._blurPass1=new aB({fragment:LN.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blurPass2=new aB({fragment:LN.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blendPass=new aB({fragment:LN.source("clay.compositor.blend")}),this._blendPass.material.disableTexturesAll(),this._blendPass.material.enableTexture(["texture1","texture2"]),this._ssrPass.setUniform("gBufferTexture1",t.normalTexture),this._ssrPass.setUniform("gBufferTexture2",t.depthTexture),this._blurPass1.setUniform("gBufferTexture1",t.normalTexture),this._blurPass1.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.setUniform("gBufferTexture1",t.normalTexture),this._blurPass2.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.material.define("fragment","VERTICAL"),this._blurPass2.material.define("fragment","BLEND"),this._ssrTexture=new sk({type:$R.HALF_FLOAT}),this._texture2=new sk({type:$R.HALF_FLOAT}),this._texture3=new sk({type:$R.HALF_FLOAT}),this._prevTexture=new sk({type:$R.HALF_FLOAT}),this._currentTexture=new sk({type:$R.HALF_FLOAT}),this._frameBuffer=new Tz({depthBuffer:!1}),this._normalDistribution=null,this._totalSamples=256,this._samplePerFrame=4,this._ssrPass.material.define("fragment","SAMPLE_PER_FRAME",this._samplePerFrame),this._ssrPass.material.define("fragment","TOTAL_SAMPLES",this._totalSamples),this._downScale=1}LN.import("@export ecgl.ssr.main\n\n#define SHADER_NAME SSR\n#define MAX_ITERATION 20;\n#define SAMPLE_PER_FRAME 5;\n#define TOTAL_SAMPLES 128;\n\nuniform sampler2D sourceTexture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform sampler2D gBufferTexture3;\nuniform samplerCube specularCubemap;\nuniform float specularIntensity: 1;\n\nuniform mat4 projection;\nuniform mat4 projectionInv;\nuniform mat4 toViewSpace;\nuniform mat4 toWorldSpace;\n\nuniform float maxRayDistance: 200;\n\nuniform float pixelStride: 16;\nuniform float pixelStrideZCutoff: 50; \nuniform float screenEdgeFadeStart: 0.9; \nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\n\nuniform float nearZ;\nuniform vec2 viewportSize : VIEWPORT_SIZE;\n\nuniform float jitterOffset: 0;\n\nvarying vec2 v_Texcoord;\n\n#ifdef DEPTH_DECODE\n@import clay.util.decode_float\n#endif\n\n#ifdef PHYSICALLY_CORRECT\nuniform sampler2D normalDistribution;\nuniform float sampleOffset: 0;\nuniform vec2 normalDistributionSize;\n\nvec3 transformNormal(vec3 H, vec3 N) {\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\n return transformNormal(H, N);\n}\nfloat G_Smith(float g, float ndv, float ndl) {\n float roughness = 1.0 - g;\n float k = roughness * roughness / 2.0;\n float G1V = ndv / (ndv * (1.0 - k) + k);\n float G1L = ndl / (ndl * (1.0 - k) + k);\n return G1L * G1V;\n}\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n#endif\n\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\n{\n vec4 depthTexel = texture2D(depthTexture, uv);\n return depthTexel.r * 2.0 - 1.0;\n}\n\nfloat linearDepth(float depth)\n{\n if (projection[3][3] == 0.0) {\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n }\n else {\n return (depth - projection[3][2]) / projection[2][2];\n }\n}\n\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\n{\n if (rayZFar > rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n dPQK *= 1.2;\n\n if (intersect) {\n break;\n }\n }\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import clay.util.rand\n\n@import clay.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n#if !defined(PHYSICALLY_CORRECT)\n if (g <= minGlossiness) {\n discard;\n }\n#endif\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n vec3 V = -normalize(rayOrigin);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n float iterationCount;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n#ifdef PHYSICALLY_CORRECT\n vec4 color = vec4(vec3(0.0), 1.0);\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\n vec3 albedo = albedoMetalness.rgb;\n float m = albedoMetalness.a;\n vec3 diffuseColor = albedo * (1.0 - m);\n vec3 spec = mix(vec3(0.04), albedo, m);\n\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\n\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\n vec3 rayDir = normalize(reflect(-V, H));\n#else\n vec3 rayDir = normalize(reflect(-V, N));\n#endif\n vec2 hitPixel;\n vec3 hitPoint;\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\n#ifdef PHYSICALLY_CORRECT\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\n float vdh = clamp(dot(V, H), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n vec3 litTexel = vec3(0.0);\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\n\n }\n else {\n #ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\n#endif\n }\n color.rgb += ndl * litTexel * (\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\n );\n }\n color.rgb /= float(SAMPLE_PER_FRAME);\n#else\n #if !defined(SPECULARCUBEMAP_ENABLED)\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n if (!intersect) {\n discard;\n }\n#endif\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\n vec4 color = texture2D(sourceTexture, hitPixel);\n color.rgb *= alpha;\n\n#ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n alpha = alpha * (intersect ? 1.0 : 0.0);\n float bias = (1.0 -g) * 5.0;\n color.rgb += (1.0 - alpha)\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\n * specularIntensity;\n#endif\n\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform mat4 projection;\nuniform float depthRange : 0.05;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\n#ifdef BLEND\n #ifdef SSAOTEX_ENABLED\nuniform sampler2D ssaoTex;\n #endif\nuniform sampler2D sourceTexture;\n#endif\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n\n@import clay.util.rgbm\n\n\nvoid main()\n{\n @import clay.compositor.kernel.gaussian_9\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n float cD = getLinearDepth(v_Texcoord);\n for (int i = 0; i < 9; i++) {\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i]\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\n\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n float aoFactor = 1.0;\n #ifdef SSAOTEX_ENABLED\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\n #endif\n gl_FragColor = encodeHDR(\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end"),mH.prototype.setAmbientCubemap=function(t,e){this._ssrPass.material.set("specularCubemap",t),this._ssrPass.material.set("specularIntensity",e);var n=t&&e;this._ssrPass.material[n?"enableTexture":"disableTexture"]("specularCubemap")},mH.prototype.update=function(t,e,n,i){var r=t.getWidth(),o=t.getHeight(),a=this._ssrTexture,s=this._texture2,l=this._texture3;a.width=this._prevTexture.width=this._currentTexture.width=r/this._downScale,a.height=this._prevTexture.height=this._currentTexture.height=o/this._downScale,s.width=l.width=r,s.height=l.height=o;var u=this._frameBuffer,h=this._ssrPass,c=this._blurPass1,d=this._blurPass2,f=this._blendPass,p=new MR,g=new MR;MR.transpose(p,e.worldTransform),MR.transpose(g,e.viewMatrix),h.setUniform("sourceTexture",n),h.setUniform("projection",e.projectionMatrix.array),h.setUniform("projectionInv",e.invProjectionMatrix.array),h.setUniform("toViewSpace",p.array),h.setUniform("toWorldSpace",g.array),h.setUniform("nearZ",e.near);var m=i/this._totalSamples*this._samplePerFrame;if(h.setUniform("jitterOffset",m),h.setUniform("sampleOffset",i*this._samplePerFrame),c.setUniform("textureSize",[a.width,a.height]),d.setUniform("textureSize",[r,o]),d.setUniform("sourceTexture",n),c.setUniform("projection",e.projectionMatrix.array),d.setUniform("projection",e.projectionMatrix.array),u.attach(a),u.bind(t),h.render(t),this._physicallyCorrect&&(u.attach(this._currentTexture),f.setUniform("texture1",this._prevTexture),f.setUniform("texture2",a),f.material.set({weight1:i>=1?.95:0,weight2:i>=1?.05:1}),f.render(t)),u.attach(s),c.setUniform("texture",this._physicallyCorrect?this._currentTexture:a),c.render(t),u.attach(l),d.setUniform("texture",s),d.render(t),u.unbind(t),this._physicallyCorrect){var v=this._prevTexture;this._prevTexture=this._currentTexture,this._currentTexture=v}},mH.prototype.getTargetTexture=function(){return this._texture3},mH.prototype.setParameter=function(t,e){"maxIteration"===t?this._ssrPass.material.define("fragment","MAX_ITERATION",e):this._ssrPass.setUniform(t,e)},mH.prototype.setPhysicallyCorrect=function(t){t?(this._normalDistribution||(this._normalDistribution=uB.generateNormalDistribution(64,this._totalSamples)),this._ssrPass.material.define("fragment","PHYSICALLY_CORRECT"),this._ssrPass.material.set("normalDistribution",this._normalDistribution),this._ssrPass.material.set("normalDistributionSize",[64,this._totalSamples])):this._ssrPass.material.undefine("fragment","PHYSICALLY_CORRECT"),this._physicallyCorrect=t},mH.prototype.setSSAOTexture=function(t){var e=this._blurPass2;t?(e.material.enableTexture("ssaoTex"),e.material.set("ssaoTex",t)):e.material.disableTexture("ssaoTex")},mH.prototype.isFinished=function(t){return!this._physicallyCorrect||t>this._totalSamples/this._samplePerFrame},mH.prototype.dispose=function(t){this._ssrTexture.dispose(t),this._texture2.dispose(t),this._texture3.dispose(t),this._prevTexture.dispose(t),this._currentTexture.dispose(t),this._frameBuffer.dispose(t)};const vH=mH,_H=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925];function yH(t,e,n,i,r){var o=t.gl;e.setUniform(o,"1i",n,r),o.activeTexture(o.TEXTURE0+r),i.isRenderable()?i.bind(t):i.unbind(t)}function xH(t,e,n,i,r){var o,a,s,l,u=t.gl;return function(r,h,c){if(!l||l.material!==r.material){var d=r.material,f=r.__program,p=d.get("roughness");null==p&&(p=1);var g=d.get("normalMap")||e,m=d.get("roughnessMap"),v=d.get("bumpMap"),_=d.get("uvRepeat"),y=d.get("uvOffset"),x=d.get("detailUvRepeat"),w=d.get("detailUvOffset"),b=!!v&&d.isTextureEnabled("bumpMap"),S=!!m&&d.isTextureEnabled("roughnessMap"),T=d.isDefined("fragment","DOUBLE_SIDED");v=v||n,m=m||i,c!==h?(h.set("normalMap",g),h.set("bumpMap",v),h.set("roughnessMap",m),h.set("useBumpMap",b),h.set("useRoughnessMap",S),h.set("doubleSide",T),null!=_&&h.set("uvRepeat",_),null!=y&&h.set("uvOffset",y),null!=x&&h.set("detailUvRepeat",x),null!=w&&h.set("detailUvOffset",w),h.set("roughness",p)):(f.setUniform(u,"1f","roughness",p),o!==g&&yH(t,f,"normalMap",g,0),a!==v&&v&&yH(t,f,"bumpMap",v,1),s!==m&&m&&yH(t,f,"roughnessMap",m,2),null!=_&&f.setUniform(u,"2f","uvRepeat",_),null!=y&&f.setUniform(u,"2f","uvOffset",y),null!=x&&f.setUniform(u,"2f","detailUvRepeat",x),null!=w&&f.setUniform(u,"2f","detailUvOffset",w),f.setUniform(u,"1i","useBumpMap",+b),f.setUniform(u,"1i","useRoughnessMap",+S),f.setUniform(u,"1i","doubleSide",+T)),o=g,a=v,s=m,l=r}}}function wH(t){t=t||{},this._depthTex=new sk({format:$R.DEPTH_COMPONENT,type:$R.UNSIGNED_INT}),this._normalTex=new sk({type:$R.HALF_FLOAT}),this._framebuffer=new Tz,this._framebuffer.attach(this._normalTex),this._framebuffer.attach(this._depthTex,Tz.DEPTH_ATTACHMENT),this._normalMaterial=new HO({shader:new LN(LN.source("ecgl.normal.vertex"),LN.source("ecgl.normal.fragment"))}),this._normalMaterial.enableTexture(["normalMap","bumpMap","roughnessMap"]),this._defaultNormalMap=Kz.createBlank("#000"),this._defaultBumpMap=Kz.createBlank("#000"),this._defaultRoughessMap=Kz.createBlank("#000"),this._debugPass=new aB({fragment:LN.source("clay.compositor.output")}),this._debugPass.setUniform("texture",this._normalTex),this._debugPass.material.undefine("fragment","OUTPUT_ALPHA")}LN.import("@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end"),wH.prototype.getDepthTexture=function(){return this._depthTex},wH.prototype.getNormalTexture=function(){return this._normalTex},wH.prototype.update=function(t,e,n){var i=t.getWidth(),r=t.getHeight(),o=this._depthTex,a=this._normalTex,s=this._normalMaterial;o.width=i,o.height=r,a.width=i,a.height=r;var l=e.getRenderList(n).opaque;this._framebuffer.bind(t),t.gl.clearColor(0,0,0,0),t.gl.clear(t.gl.COLOR_BUFFER_BIT|t.gl.DEPTH_BUFFER_BIT),t.gl.disable(t.gl.BLEND),t.renderPass(l,n,{getMaterial:function(){return s},ifRender:function(t){return t.renderNormal},beforeRender:xH(t,this._defaultNormalMap,this._defaultBumpMap,this._defaultRoughessMap,this._normalMaterial),sort:t.opaqueSortCompare}),this._framebuffer.unbind(t)},wH.prototype.renderDebug=function(t){this._debugPass.render(t)},wH.prototype.dispose=function(t){this._depthTex.dispose(t),this._normalTex.dispose(t)};const bH=wH;function SH(t){t=t||{},this._edgePass=new aB({fragment:LN.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",t.normalTexture),this._edgePass.setUniform("depthTexture",t.depthTexture),this._targetTexture=new sk({type:$R.HALF_FLOAT}),this._frameBuffer=new Tz,this._frameBuffer.attach(this._targetTexture)}SH.prototype.update=function(t,e,n,i){var r=t.getWidth(),o=t.getHeight(),a=this._targetTexture;a.width=r,a.height=o;var s=this._frameBuffer;s.bind(t),this._edgePass.setUniform("projectionInv",e.invProjectionMatrix.array),this._edgePass.setUniform("textureSize",[r,o]),this._edgePass.setUniform("texture",n),this._edgePass.render(t),s.unbind(t)},SH.prototype.getTargetTexture=function(){return this._targetTexture},SH.prototype.setParameter=function(t,e){this._edgePass.setUniform(t,e)},SH.prototype.dispose=function(t){this._targetTexture.dispose(t),this._frameBuffer.dispose(t)};const TH=SH,MH={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(clay.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(clay.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_8_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_4_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_2_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bloom_composite",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(clay.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},defines:{}},{name:"FXAA",shader:"#source(clay.compositor.fxaa)",inputs:{texture:"composite"}}]};function CH(t,e){return{color:{parameters:{width:t,height:e}}}}LN.import(XG),LN.import(qG),LN.import(YG),LN.import(KG),LN.import(JG),LN.import(QG),LN.import($G),LN.import(tH),LN.import(eH),LN.import("@export ecgl.dof.coc\n\nuniform sampler2D depth;\n\nuniform float zNear: 0.1;\nuniform float zFar: 2000;\n\nuniform float focalDistance: 3;\nuniform float focalRange: 1;\nuniform float focalLength: 30;\nuniform float fstop: 2.8;\n\nvarying vec2 v_Texcoord;\n\n@import clay.util.encode_float\n\nvoid main()\n{\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\n\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\n\n float aperture = focalLength / fstop;\n\n float coc;\n\n float uppper = focalDistance + focalRange;\n float lower = focalDistance - focalRange;\n if (dist <= uppper && dist >= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import clay.util.rgbm\n@import clay.util.float\n\nvoid main()\n{\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\n vec4 originalColor = texture2D(original, v_Texcoord);\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import clay.util.rgbm\n@import clay.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = texel;\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n texel.rgb *= texel.a;\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n color.rgb /= (color.a + 0.0001);\n gl_FragColor = color;\n#endif\n}\n\n@end"),LN.import("@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end");var LH=["composite","FXAA"];function AH(){this._width,this._height,this._dpr,this._sourceTexture=new sk({type:$R.HALF_FLOAT}),this._depthTexture=new sk({format:$R.DEPTH_COMPONENT,type:$R.UNSIGNED_INT}),this._framebuffer=new Tz,this._framebuffer.attach(this._sourceTexture),this._framebuffer.attach(this._depthTexture,Tz.DEPTH_ATTACHMENT),this._normalPass=new bH,this._compositor=uH(MH);var t=this._compositor.getNodeByName("source");t.texture=this._sourceTexture;var e=this._compositor.getNodeByName("coc");this._sourceNode=t,this._cocNode=e,this._compositeNode=this._compositor.getNodeByName("composite"),this._fxaaNode=this._compositor.getNodeByName("FXAA"),this._dofBlurNodes=["dof_far_blur","dof_near_blur","dof_coc_blur"].map((function(t){return this._compositor.getNodeByName(t)}),this),this._dofBlurKernel=0,this._dofBlurKernelSize=new Float32Array(0),this._finalNodesChain=LH.map((function(t){return this._compositor.getNodeByName(t)}),this);var n={normalTexture:this._normalPass.getNormalTexture(),depthTexture:this._normalPass.getDepthTexture()};this._ssaoPass=new gH(n),this._ssrPass=new vH(n),this._edgePass=new TH(n)}AH.prototype.resize=function(t,e,n){t*=n=n||1,e*=n;var i=this._sourceTexture,r=this._depthTexture;i.width=t,i.height=e,r.width=t,r.height=e;var o={getWidth:function(){return t},getHeight:function(){return e},getDevicePixelRatio:function(){return n}};function a(t,e){if("function"==typeof t[e]){var n=t[e].__original||t[e];t[e]=function(t){return n.call(this,o)},t[e].__original=n}}this._compositor.nodes.forEach((function(t){for(var e in t.outputs){var n=t.outputs[e].parameters;n&&(a(n,"width"),a(n,"height"))}for(var i in t.parameters)a(t.parameters,i)})),this._width=t,this._height=e,this._dpr=n},AH.prototype.getWidth=function(){return this._width},AH.prototype.getHeight=function(){return this._height},AH.prototype._ifRenderNormalPass=function(){return this._enableSSAO||this._enableEdge||this._enableSSR},AH.prototype._getPrevNode=function(t){for(var e=LH.indexOf(t.name)-1,n=this._finalNodesChain[e];n&&!this._compositor.getNodeByName(n.name);)e-=1,n=this._finalNodesChain[e];return n},AH.prototype._getNextNode=function(t){for(var e=LH.indexOf(t.name)+1,n=this._finalNodesChain[e];n&&!this._compositor.getNodeByName(n.name);)e+=1,n=this._finalNodesChain[e];return n},AH.prototype._addChainNode=function(t){var e=this._getPrevNode(t),n=this._getNextNode(t);e&&(t.inputs.texture=e.name,n?(t.outputs=CH(this.getWidth.bind(this),this.getHeight.bind(this)),n.inputs.texture=t.name):t.outputs=null,this._compositor.addNode(t))},AH.prototype._removeChainNode=function(t){var e=this._getPrevNode(t),n=this._getNextNode(t);e&&(n?(e.outputs=CH(this.getWidth.bind(this),this.getHeight.bind(this)),n.inputs.texture=e.name):e.outputs=null,this._compositor.removeNode(t))},AH.prototype.updateNormal=function(t,e,n,i){this._ifRenderNormalPass()&&this._normalPass.update(t,e,n)},AH.prototype.updateSSAO=function(t,e,n,i){this._ssaoPass.update(t,n,i)},AH.prototype.enableSSAO=function(){this._enableSSAO=!0},AH.prototype.disableSSAO=function(){this._enableSSAO=!1},AH.prototype.enableSSR=function(){this._enableSSR=!0},AH.prototype.disableSSR=function(){this._enableSSR=!1},AH.prototype.getSSAOTexture=function(){return this._ssaoPass.getTargetTexture()},AH.prototype.getSourceFrameBuffer=function(){return this._framebuffer},AH.prototype.getSourceTexture=function(){return this._sourceTexture},AH.prototype.disableFXAA=function(){this._removeChainNode(this._fxaaNode)},AH.prototype.enableFXAA=function(){this._addChainNode(this._fxaaNode)},AH.prototype.enableBloom=function(){this._compositeNode.inputs.bloom="bloom_composite",this._compositor.dirty()},AH.prototype.disableBloom=function(){this._compositeNode.inputs.bloom=null,this._compositor.dirty()},AH.prototype.enableDOF=function(){this._compositeNode.inputs.texture="dof_composite",this._compositor.dirty()},AH.prototype.disableDOF=function(){this._compositeNode.inputs.texture="source",this._compositor.dirty()},AH.prototype.enableColorCorrection=function(){this._compositeNode.define("COLOR_CORRECTION"),this._enableColorCorrection=!0},AH.prototype.disableColorCorrection=function(){this._compositeNode.undefine("COLOR_CORRECTION"),this._enableColorCorrection=!1},AH.prototype.enableEdge=function(){this._enableEdge=!0},AH.prototype.disableEdge=function(){this._enableEdge=!1},AH.prototype.setBloomIntensity=function(t){this._compositeNode.setParameter("bloomIntensity",t)},AH.prototype.setSSAOParameter=function(t,e){switch(t){case"quality":var n={low:6,medium:12,high:32,ultra:62}[e]||12;this._ssaoPass.setParameter("kernelSize",n);break;case"radius":this._ssaoPass.setParameter(t,e),this._ssaoPass.setParameter("bias",e/200);break;case"intensity":this._ssaoPass.setParameter(t,e)}},AH.prototype.setDOFParameter=function(t,e){switch(t){case"focalDistance":case"focalRange":case"fstop":this._cocNode.setParameter(t,e);break;case"blurRadius":for(var n=0;n=this._haltonSequence.length},render:function(t,e,n){var i=this._blendPass;0===this._frame?(i.setUniform("weight1",0),i.setUniform("weight2",1)):(i.setUniform("weight1",.9),i.setUniform("weight2",.1)),i.setUniform("texture1",this._prevFrameTex),i.setUniform("texture2",e||this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(t),i.render(t),this._blendFb.unbind(t),n||(this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(t));var r=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=r,this._frame++},dispose:function(t){this._sourceFb.dispose(t),this._blendFb.dispose(t),this._prevFrameTex.dispose(t),this._outputTex.dispose(t),this._sourceTex.dispose(t),this._outputPass.dispose(t),this._blendPass.dispose(t)}};const PH=IH;function EH(t){t=t||"perspective",this.layer=null,this.scene=new ez,this.rootNode=this.scene,this.viewport={x:0,y:0,width:0,height:0},this.setProjection(t),this._compositor=new DH,this._temporalSS=new PH,this._shadowMapPass=new FG;for(var e=[],n=0,i=0;i<30;i++){for(var r=[],o=0;o<6;o++)r.push(4*hH(n,2)-2),r.push(4*hH(n,3)-2),n++;e.push(r)}this._pcfKernels=e,this.scene.on("beforerender",(function(t,e,n){this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,n)}),this)}EH.prototype.setProjection=function(t){var e=this.camera;e&&e.update(),"perspective"===t?this.camera instanceof dz||(this.camera=new dz,e&&this.camera.setLocalTransform(e.localTransform)):this.camera instanceof nB||(this.camera=new nB,e&&this.camera.setLocalTransform(e.localTransform)),this.camera.near=.1,this.camera.far=2e3},EH.prototype.setViewport=function(t,e,n,i,r){this.camera instanceof dz&&(this.camera.aspect=n/i),r=r||1,this.viewport.x=t,this.viewport.y=e,this.viewport.width=n,this.viewport.height=i,this.viewport.devicePixelRatio=r,this._compositor.resize(n*r,i*r),this._temporalSS.resize(n*r,i*r)},EH.prototype.containPoint=function(t,e){var n=this.viewport;return e=this.layer.renderer.getHeight()-e,t>=n.x&&e>=n.y&&t<=n.x+n.width&&e<=n.y+n.height};var OH=new JO;EH.prototype.castRay=function(t,e,n){var i=this.layer.renderer,r=i.viewport;return i.viewport=this.viewport,i.screenToNDC(t,e,OH),this.camera.castRay(OH,n),i.viewport=r,n},EH.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this.scene.updateLights();var t=this.scene.updateRenderList(this.camera);this._needsSortProgressively=!1;for(var e=0;e30},EH.prototype._doRender=function(t,e,n){var i=this.scene,r=this.camera;n=n||0,this._updateTransparent(t,i,r,n),e||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(t,i,r,!0)),this._updateShadowPCFKernel(n);var o,a=t.clearColor;(t.gl.clearColor(a[0],a[1],a[2],a[3]),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,r),this._compositor.updateNormal(t,i,r,this._temporalSS.getFrame())),this._updateSSAO(t,i,r,this._temporalSS.getFrame()),this._enablePostEffect)?((o=this._compositor.getSourceFrameBuffer()).bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),t.render(i,r,!0,!0),o.unbind(t),this.needsTemporalSS()&&e?(this._compositor.composite(t,i,r,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),this._compositor.composite(t,i,r,null,0))):this.needsTemporalSS()&&e?((o=this._temporalSS.getSourceFrameBuffer()).bind(t),t.saveClear(),t.clearBit=t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT,t.render(i,r,!0,!0),t.restoreClear(),o.unbind(t),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),t.render(i,r,!0,!0))},EH.prototype._updateTransparent=function(t,e,n,i){for(var r=new $N,o=new MR,a=n.getWorldPosition(),s=e.getRenderList(n).transparent,l=0;lthis.camera.far||t80*n){i=o=t[0],r=a=t[1];for(var p=n;po&&(o=s),l>a&&(a=l);u=Math.max(o-i,a-r)}return nU(d,f,n,i,r,u),f}function tU(t,e,n,i,r){var o,a;if(r===wU(t,e,n,i)>0)for(o=e;o=e;o-=i)a=_U(o,t[o],t[o+1],a);return a&&pU(a,a.next)&&(yU(a),a=a.next),a}function eU(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=!1,i.steiner||!pU(i,i.next)&&0!==fU(i.prev,i,i.next))i=i.next;else{if(yU(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function nU(t,e,n,i,r,o,a){if(t){!a&&o&&function(t,e,n,i){var r=t;do{null===r.z&&(r.z=uU(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,a,s,l,u=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,u*=2}while(a>1)}(r)}(t,i,r,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?rU(t,i,r,o):iU(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),yU(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?nU(t=oU(t,e,n),e,n,i,r,o,2):2===a&&aU(t,e,n,i,r,o):nU(eU(t),e,n,i,r,o,1);break}}}function iU(t){var e=t.prev,n=t,i=t.next;if(fU(e,n,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(cU(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&fU(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function rU(t,e,n,i){var r=t.prev,o=t,a=t.next;if(fU(r,o,a)>=0)return!1;for(var s=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,h=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,c=uU(s,l,e,n,i),d=uU(u,h,e,n,i),f=t.nextZ;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&cU(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&fU(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&cU(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&fU(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function oU(t,e,n){var i=t;do{var r=i.prev,o=i.next.next;!pU(r,o)&&gU(r,i,i.next,o)&&mU(r,o)&&mU(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),yU(i),yU(i.next),i=t=o),i=i.next}while(i!==t);return i}function aU(t,e,n,i,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&dU(a,s)){var l=vU(a,s);return a=eU(a,a.next),l=eU(l,l.next),nU(a,e,n,i,r,o),void nU(l,e,n,i,r,o)}s=s.next}a=a.next}while(a!==t)}function sU(t,e){return t.x-e.x}function lU(t,e){if(e=function(t,e){var n,i=e,r=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x=i.x&&i.x>=h&&r!==i.x&&cU(on.x)&&mU(i,t)&&(n=i,d=l),i=i.next;return n}(t,e),e){var n=vU(e,t);eU(n,n.next)}}function uU(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function hU(t){var e=t,n=t;do{e.x=0&&(t-a)*(i-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function dU(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&gU(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&mU(t,e)&&mU(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)}function fU(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function pU(t,e){return t.x===e.x&&t.y===e.y}function gU(t,e,n,i){return!!(pU(t,e)&&pU(n,i)||pU(t,i)&&pU(n,e))||fU(t,e,n)>0!=fU(t,e,i)>0&&fU(n,i,t)>0!=fU(n,i,e)>0}function mU(t,e){return fU(t.prev,t,t.next)<0?fU(t,e,t.next)>=0&&fU(t,t.prev,e)>=0:fU(t,e,t.prev)<0||fU(t,t.next,e)<0}function vU(t,e){var n=new xU(t.i,t.x,t.y),i=new xU(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function _U(t,e,n,i){var r=new xU(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function yU(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function xU(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function wU(t,e,n,i){for(var r=0,o=e,a=n-i;ol&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u});var u;l=o[a].pivot+1;(u=o[a].right)>l&&s.push({pivot:Math.floor((u+l)/2),left:l,right:u})}o=this._parts=s}else for(a=0;a=2e4},doSortTriangles:function(t,e){var n=this.indices;if(0===e){var i=this.attributes.position;t=t.array;this._triangleZList&&this._triangleZList.length===this.triangleCount||(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new n.constructor(n.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var r,o=0,a=0;a0,n={},i=0;i65535?new Uint32Array(3*a):new Uint16Array(3*a),d.material.shader!==e&&d.material.attachShader(e,!0),_V.setMaterialFromModel(e.__shading,d.material,t,n),s>0&&(this._linesMesh.geometry.resetOffset(),this._linesMesh.geometry.setVertexCount(s),this._linesMesh.geometry.setTriangleCount(l)),this._dataIndexOfVertex=new Uint32Array(o),this._vertexRangeOfDataIndex=new Uint32Array(2*(r-i))},_updateRegionMesh:function(t,e,n,i){for(var r=t.getData(),o=0,a=0,s=!1,l=this._polygonMesh,u=this._linesMesh,h=n;h0;b&&(w*=e.getDevicePixelRatio(),this._updateLinesGeometry(u.geometry,t,h,_,w,t.coordinateSystem.transform)),u.invisible=!b,u.material.set({color:m})}(l=this._polygonMesh).material.transparent=s,l.material.depthMask=!s,l.geometry.updateBoundingBox(),l.frontFace=this.extrudeY?_V.Mesh.CCW:_V.Mesh.CW,l.material.get("normalMap")&&l.geometry.generateTangents(),l.seriesIndex=t.seriesIndex,l.on("mousemove",this._onmousemove,this),l.on("mouseout",this._onmouseout,this)},_updateDebugWireframe:function(t){var e=t.getModel("debug.wireframe");if(e.get("show")){var n=_V.parseColor(e.get("lineStyle.color")||"rgba(0,0,0,0.5)"),i=xB.firstNotNull(e.get("lineStyle.width"),1),r=this._polygonMesh;r.geometry.generateBarycentric(),r.material.define("both","WIREFRAME_TRIANGLE"),r.material.set("wireframeLineColor",n),r.material.set("wireframeLineWidth",i)}},_onmousemove:function(t){var e=this._dataIndexOfVertex[t.triangle[0]];null==e&&(e=-1),e!==this._lastHoverDataIndex&&(this.downplay(this._lastHoverDataIndex),this.highlight(e),this._labelsBuilder.updateLabels([e])),this._lastHoverDataIndex=e,this._polygonMesh.dataIndex=e},_onmouseout:function(t){t.target&&(this.downplay(this._lastHoverDataIndex),this._lastHoverDataIndex=-1,this._polygonMesh.dataIndex=-1),this._labelsBuilder.updateLabels([])},_updateGroundPlane:function(t,e,n){var i=t.getModel("groundPlane",t);if(this._groundMesh.invisible=!i.get("show",!0),!this._groundMesh.invisible){var r=t.get("shading"),o=this._groundMaterials[r];o||(o=this._groundMaterials.lambert),_V.setMaterialFromModel(r,o,i,n),o.get("normalMap")&&this._groundMesh.geometry.generateTangents(),this._groundMesh.material=o,this._groundMesh.material.set("color",_V.parseColor(i.get("color"))),this._groundMesh.scale.set(e.size[0],e.size[2],1)}},_triangulation:function(t,e,n){this._triangulationResults=[];for(var i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0],o=t.coordinateSystem,a=e;a1?i:0,I[V][m]=C.points[H+2],l.set(r+V,I[V]),s?(N[0]=(C.points[H]*v[0]-_[0])/x,N[1]=(C.points[H+2]*v[m]-_[m])/x):(N[0]=(G?R:R+F)/x,N[1]=(I[V][g]*v[g]-_[g])/x),h.set(r+V,N)}kU.sub(P,I[1],I[0]),kU.sub(E,I[3],I[0]),kU.cross(O,P,E),kU.normalize(O,O);for(V=0;V<4;V++)u.set(r+V,O),f&&c.set(r+V,a);for(V=0;V<6;V++)p[3*o+V]=D[V]+r;r+=4,o+=2,R+=F}}return e.dirty(),{vertexOffset:r,triangleOffset:o}},_getRegionLinesInfo:function(t,e,n){var i=0,r=0;e.getRegionModel(t).getModel("itemStyle").get("borderWidth")>0&&e.getRegionPolygonCoords(t).forEach((function(t){var e=t.exterior,o=t.interiors;i+=n.getPolylineVertexCount(e),r+=n.getPolylineTriangleCount(e);for(var a=0;athis._endIndex)){e-=this._startIndex;for(var i=this._vertexRangeOfDataIndex[2*e];i0},_displacementChanged:!0,_displacementScale:0,updateDisplacementHash:function(){var t=this.getDisplacementTexture(),e=this.getDisplacemenScale();this._displacementChanged=this._displacementTexture!==t||this._displacementScale!==e,this._displacementTexture=t,this._displacementScale=e},isDisplacementChanged:function(){return this._displacementChanged}});nt(tW.prototype,EV),nt(tW.prototype,OV),nt(tW.prototype,NV),nt(tW.prototype,qH);const eW=tW;var nW=Math.PI,iW=Math.sin,rW=Math.cos,oW=Math.tan,aW=Math.asin,sW=Math.atan2,lW=nW/180;var uW=23.4397*lW;function hW(t,e){return sW(iW(t)*rW(uW)-oW(e)*iW(uW),rW(t))}function cW(t,e,n){return sW(iW(t),rW(t)*iW(e)-oW(n)*rW(e))}function dW(t,e,n){return aW(iW(e)*iW(n)+rW(e)*rW(n)*rW(t))}function fW(t){var e,n,i=function(t){return lW*(357.5291+.98560028*t)}(t),r=function(t){return t+lW*(1.9148*iW(t)+.02*iW(2*t)+3e-4*iW(3*t))+102.9372*lW+nW}(i);return{dec:(e=r,n=0,aW(iW(n)*rW(uW)+rW(n)*iW(uW)*iW(e))),ra:hW(r,0)}}var pW={};pW.getPosition=function(t,e,n){var i=lW*-n,r=lW*e,o=function(t){return function(t){return t.valueOf()/864e5-.5+2440588}(t)-2451545}(t),a=fW(o),s=function(t,e){return lW*(280.16+360.9856235*t)-e}(o,i)-a.ra;return{azimuth:cW(s,r,a.dec),altitude:dW(s,r,a.dec)}};const gW=pW;_V.Shader.import(hV),_V.Shader.import("@export ecgl.atmosphere.vertex\nattribute vec3 position: POSITION;\nattribute vec3 normal : NORMAL;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 normalMatrix : WORLDINVERSETRANSPOSE;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n v_Normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end\n\n\n@export ecgl.atmosphere.fragment\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform float glowPower;\nuniform vec3 glowColor;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n float intensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor = vec4(glowColor, intensity * intensity);\n}\n@end");const mW=Dp.extend({type:"globe",__ecgl__:!0,_displacementScale:0,init:function(t,e){this.groupGL=new _V.Node,this._sphereGeometry=new _V.SphereGeometry({widthSegments:200,heightSegments:100,dynamic:!0}),this._overlayGeometry=new _V.SphereGeometry({widthSegments:80,heightSegments:40}),this._planeGeometry=new _V.PlaneGeometry,this._earthMesh=new _V.Mesh({renderNormal:!0}),this._atmosphereMesh=new _V.Mesh,this._atmosphereGeometry=new _V.SphereGeometry({widthSegments:80,heightSegments:40}),this._atmosphereMaterial=new _V.Material({shader:new _V.Shader(_V.Shader.source("ecgl.atmosphere.vertex"),_V.Shader.source("ecgl.atmosphere.fragment")),transparent:!0}),this._atmosphereMesh.geometry=this._atmosphereGeometry,this._atmosphereMesh.material=this._atmosphereMaterial,this._atmosphereMesh.frontFace=_V.Mesh.CW,this._lightRoot=new _V.Node,this._sceneHelper=new QV,this._sceneHelper.initLight(this._lightRoot),this.groupGL.add(this._atmosphereMesh),this.groupGL.add(this._earthMesh),this._control=new GV({zr:e.getZr()}),this._control.init(),this._layerMeshes={}},render:function(t,e,n){var i=t.coordinateSystem,r=t.get("shading");i.viewGL.add(this._lightRoot),t.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL),this._sceneHelper.setScene(i.viewGL.scene),i.viewGL.setPostEffect(t.getModel("postEffect"),n),i.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling"));var o=this._earthMesh;o.geometry=this._sphereGeometry;var a="ecgl."+r;o.material&&o.material.shader.name===a||(o.material=_V.createMaterial(a)),_V.setMaterialFromModel(r,o.material,t,n),["roughnessMap","metalnessMap","detailMap","normalMap"].forEach((function(t){var e=o.material.get(t);e&&(e.flipY=!1)})),o.material.set("color",_V.parseColor(t.get("baseColor")));var s=.99*i.radius;if(o.scale.set(s,s,s),t.get("atmosphere.show")){o.material.define("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!1,this._atmosphereMaterial.setUniforms({glowPower:t.get("atmosphere.glowPower")||6,glowColor:t.get("atmosphere.color")||"#ffffff"}),o.material.setUniforms({glowPower:t.get("atmosphere.innerGlowPower")||2,glowColor:t.get("atmosphere.color")||"#ffffff"});var l=t.get("atmosphere.offset")||5;this._atmosphereMesh.scale.set(s+l,s+l,s+l)}else o.material.undefine("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!0;var u=o.material.setTextureImage("diffuseMap",t.get("baseTexture"),n,{flipY:!1,anisotropic:8});u&&u.surface&&u.surface.attachToMesh(o);var h=o.material.setTextureImage("bumpMap",t.get("heightTexture"),n,{flipY:!1,anisotropic:8});h&&h.surface&&h.surface.attachToMesh(o),o.material[t.get("postEffect.enable")?"define":"undefine"]("fragment","SRGB_DECODE"),this._updateLight(t,n),this._displaceVertices(t,n),this._updateViewControl(t,n),this._updateLayers(t,n)},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n)},_updateLayers:function(t,e){var n=t.coordinateSystem,i=t.get("layers"),r=n.radius,o=[],a=[],s=[],l=[];ct(i,(function(t){var i=new Ih(t),u=i.get("type"),h=_V.loadTexture(i.get("texture"),e,{flipY:!1,anisotropic:8});if(h.surface&&h.surface.attachToMesh(this._earthMesh),"blend"===u){var c=i.get("blendTo"),d=xB.firstNotNull(i.get("intensity"),1);"emission"===c?(s.push(h),l.push(d)):(o.push(h),a.push(d))}else{var f=i.get("id"),p=this._layerMeshes[f];p||(p=this._layerMeshes[f]=new _V.Mesh({geometry:this._overlayGeometry,castShadow:!1,ignorePicking:!0})),"lambert"===i.get("shading")?(p.material=p.__lambertMaterial||new _V.Material({autoUpdateTextureStatus:!1,shader:_V.createShader("ecgl.lambert"),transparent:!0,depthMask:!1}),p.__lambertMaterial=p.material):(p.material=p.__colorMaterial||new _V.Material({autoUpdateTextureStatus:!1,shader:_V.createShader("ecgl.color"),transparent:!0,depthMask:!1}),p.__colorMaterial=p.material),p.material.enableTexture("diffuseMap");var g=i.get("distance"),m=r+(null==g?n.radius/100:g);p.scale.set(m,m,m),r=m;var v=this._blankTexture||(this._blankTexture=_V.createBlankTexture("rgba(255, 255, 255, 0)"));p.material.set("diffuseMap",v),_V.loadTexture(i.get("texture"),e,{flipY:!1,anisotropic:8},(function(t){t.surface&&t.surface.attachToMesh(p),p.material.set("diffuseMap",t),e.getZr().refresh()})),i.get("show")?this.groupGL.add(p):this.groupGL.remove(p)}}),this);var u=this._earthMesh.material;u.define("fragment","LAYER_DIFFUSEMAP_COUNT",o.length),u.define("fragment","LAYER_EMISSIVEMAP_COUNT",s.length),u.set("layerDiffuseMap",o),u.set("layerDiffuseIntensity",a),u.set("layerEmissiveMap",s),u.set("layerEmissionIntensity",l);var h=t.getModel("debug.wireframe");if(h.get("show")){u.define("both","WIREFRAME_TRIANGLE");var c=_V.parseColor(h.get("lineStyle.color")||"rgba(0,0,0,0.5)"),d=xB.firstNotNull(h.get("lineStyle.width"),1);u.set("wireframeLineWidth",d),u.set("wireframeLineColor",c)}else u.undefine("both","WIREFRAME_TRIANGLE")},_updateViewControl:function(t,e){var n=t.coordinateSystem,i=t.getModel("viewControl"),r=(n.viewGL.camera,this);var o=this._control;o.setViewGL(n.viewGL);var a,s,l=i.get("targetCoord");null!=l&&(s=l[0]+90,a=l[1]),o.setFromViewControlModel(i,{baseDistance:n.radius,alpha:a,beta:s}),o.off("update"),o.on("update",(function(){e.dispatchAction({type:"globeChangeCamera",alpha:o.getAlpha(),beta:o.getBeta(),distance:o.getDistance()-n.radius,center:o.getCenter(),from:r.uid,globeId:t.id})}))},_displaceVertices:function(t,e){var n=t.get("displacementQuality"),i=t.get("debug.wireframe.show"),r=t.coordinateSystem;if(t.isDisplacementChanged()||n!==this._displacementQuality||i!==this._showDebugWireframe){this._displacementQuality=n,this._showDebugWireframe=i;var o=this._sphereGeometry,a={low:100,medium:200,high:400,ultra:800}[n]||200,s=a/2;(o.widthSegments!==a||i)&&(o.widthSegments=a,o.heightSegments=s,o.build()),this._doDisplaceVertices(o,r),i&&o.generateBarycentric()}},_doDisplaceVertices:function(t,e){var n=t.attributes.position.value,i=t.attributes.texcoord0.value,r=t.__originalPosition;r&&r.length===n.length||((r=new Float32Array(n.length)).set(n),t.__originalPosition=r);for(var o=e.displacementWidth,a=e.displacementHeight,s=e.displacementData,l=0;l50&&(o=1e3);var a=[];EW.perspective(a,NW,this.width/this.height,1,o),this.viewGL.camera.projectionMatrix.setArray(a),this.viewGL.camera.decomposeProjectionMatrix();a=EW.identity([]);var s=this.dataToPoint(this.center);EW.scale(a,a,[1,-1,1]),EW.translate(a,a,[0,0,-t]),EW.rotateX(a,a,e),EW.rotateZ(a,a,-this.bearing/180*Math.PI),EW.translate(a,a,[-s[0]*this.getScale()*kW,-s[1]*this.getScale()*kW,0]),this.viewGL.camera.viewMatrix.array=a;var l=[];EW.invert(l,a),this.viewGL.camera.worldTransform.array=l,this.viewGL.camera.decomposeWorldTransform();var u,h=OW*this.getScale();if(this.altitudeExtent&&!isNaN(this.boxHeight)){var c=this.altitudeExtent[1]-this.altitudeExtent[0];u=this.boxHeight/c*this.getScale()/Math.pow(2,this._initialZoom-this.zoomOffset)}else u=h/(2*Math.PI*6378e3*Math.abs(Math.cos(this.center[1]*(Math.PI/180))))*this.altitudeScale*kW;this.viewGL.rootNode.scale.set(this.getScale()*kW,this.getScale()*kW,u)}},getScale:function(){return Math.pow(2,this.zoom-this.zoomOffset)},projectOnTile:function(t,e){return this.projectOnTileWithScale(t,this.getScale()*OW,e)},projectOnTileWithScale:function(t,e,n){var i=t[0],r=t[1]*RW/180,o=e*(i*RW/180+RW)/(2*RW),a=e*(RW-Math.log(Math.tan(RW/4+.5*r)))/(2*RW);return(n=n||[])[0]=o,n[1]=a,n},unprojectFromTile:function(t,e){return this.unprojectOnTileWithScale(t,this.getScale()*OW,e)},unprojectOnTileWithScale:function(t,e,n){var i=t[0],r=t[1],o=i/e*(2*RW)-RW,a=2*(Math.atan(Math.exp(RW-r/e*(2*RW)))-RW/4);return(n=n||[])[0]=180*o/RW,n[1]=180*a/RW,n},dataToPoint:function(t,e){return(e=this.projectOnTileWithScale(t,OW,e))[0]-=this._origin[0],e[1]-=this._origin[1],e[2]=isNaN(t[2])?0:t[2],isNaN(t[2])||(e[2]=t[2],this.altitudeExtent&&(e[2]-=this.altitudeExtent[0])),e}};const BW=zW;function FW(){BW.apply(this,arguments)}FW.prototype=new BW,FW.prototype.constructor=FW,FW.prototype.type="mapbox3D";function VW(t,e,n){function i(t,e){var n=e.getWidth(),i=e.getHeight(),r=e.getDevicePixelRatio();this.viewGL.setViewport(0,0,n,i,r),this.width=n,this.height=i,this.altitudeScale=t.get("altitudeScale"),this.boxHeight=t.get("boxHeight")}function r(t,e){if("auto"!==this.model.get("boxHeight")){var n=[1/0,-1/0];t.eachSeries((function(t){if(t.coordinateSystem===this){var e=t.getData(),i=t.coordDimToDataDim("alt")[0];if(i){var r=e.getDataExtent(i,!0);n[0]=Math.min(n[0],r[0]),n[1]=Math.max(n[1],r[1])}}}),this),n&&isFinite(n[1]-n[0])&&(this.altitudeExtent=n)}}return{dimensions:e.prototype.dimensions,create:function(o,a){var s=[];return o.eachComponent(t,(function(t){var n=t.__viewGL;n||(n=t.__viewGL=new NH).setRootNode(new _V.Node);var o=new e;o.viewGL=t.__viewGL,o.resize=i,o.resize(t,a),s.push(o),t.coordinateSystem=o,o.model=t,o.update=r})),o.eachSeries((function(e){if(e.get("coordinateSystem")===t){var n=e.getReferringComponents(t).models[0];if(n||(n=o.getComponent(t)),!n)throw new Error(t+' "'+xB.firstNotNull(e.get(t+"Index"),e.get(t+"Id"),0)+'" not found');e.coordinateSystem=n.coordinateSystem}})),n&&n(s,o,a),s}}}const GW=VW("mapbox3D",FW,(function(t){t.forEach((function(t){t.setCameraOption(t.model.getMapboxCameraOption())}))}));Jw((function(t){t.registerComponentModel(CW),t.registerComponentView(PW),t.registerCoordinateSystem("mapbox3D",GW),t.registerAction({type:"mapbox3DChangeCamera",event:"mapbox3dcamerachanged",update:"mapbox3D:updateCamera"},(function(t,e){e.eachComponent({mainType:"mapbox3D",query:t},(function(e){e.setMapboxCameraOption(t)}))}))}));var HW=["zoom","center","pitch","bearing"],UW=Gc.extend({type:"maptalks3D",layoutMode:"box",coordinateSystem:null,defaultOption:{zlevel:-10,urlTemplate:"http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",attribution:'© OpenStreetMap contributors, © CARTO',center:[0,0],zoom:0,pitch:0,bearing:0,light:{main:{alpha:20,beta:30}},altitudeScale:1,boxHeight:"auto"},getMaptalksCameraOption:function(){var t=this;return HW.reduce((function(e,n){return e[n]=t.get(n),e}),{})},setMaptalksCameraOption:function(t){null!=t&&HW.forEach((function(e){null!=t[e]&&(this.option[e]=t[e])}),this)},getMaptalks:function(){return this._maptalks},setMaptalks:function(t){this._maptalks=t}});nt(UW.prototype,OV),nt(UW.prototype,NV);const WW=UW;function jW(t,e,n,i){if(this.id=t,this.zr=e,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute;left:0;right:0;top:0;bottom:0;",!maptalks)throw new Error("Maptalks library must be included. See https://maptalks.org");this._maptalks=new maptalks.Map(this.dom,{center:n,zoom:i,doubleClickZoom:!1,fog:!1}),this._initEvents()}jW.prototype.setUnpainted=function(){},jW.prototype.resize=function(){this._maptalks.checkSize()},jW.prototype.getMaptalks=function(){return this._maptalks},jW.prototype.clear=function(){},jW.prototype.refresh=function(){this._maptalks.checkSize()};var ZW=["mousedown","mouseup","click","dblclick","mousemove","mousewheel","DOMMouseScroll","touchstart","touchend","touchmove","touchcancel"];jW.prototype._initEvents=function(){var t=this.dom;this._handlers=this._handlers||{contextmenu:function(t){return t.preventDefault(),!1}},ZW.forEach((function(e){this._handlers[e]=function(n){var i={};for(var r in n)i[r]=n[r];i.bubbles=!1;var o=new n.constructor(n.type,i);"mousewheel"===e||"DOMMouseScroll"===e?t.dispatchEvent(o):t.firstElementChild.dispatchEvent(o)},this.zr.dom.addEventListener(e,this._handlers[e])}),this),this.zr.dom.addEventListener("contextmenu",this._handlers.contextmenu)},jW.prototype.dispose=function(){ZW.forEach((function(t){this.zr.dom.removeEventListener(t,this._handlers[t])}),this),this._maptalks.remove()};const XW=jW;_V.Shader.import(IW);const qW=Dp.extend({type:"maptalks3D",__ecgl__:!0,init:function(t,e){this._groundMesh=new _V.Mesh({geometry:new _V.PlaneGeometry,material:new _V.Material({shader:new _V.Shader({vertex:_V.Shader.source("ecgl.displayShadow.vertex"),fragment:_V.Shader.source("ecgl.displayShadow.fragment")}),depthMask:!1}),renderOrder:-100,culling:!1,castShadow:!1,$ignorePicking:!0,renderNormal:!0})},_initMaptalksLayer:function(t,e){var n=e.getZr();this._zrLayer=new XW("maptalks3D",n,t.get("center"),t.get("zoom")),n.painter.insertLayer(-1e3,this._zrLayer),this._lightRoot=new _V.Node,this._sceneHelper=new QV(this._lightRoot),this._sceneHelper.initLight(this._lightRoot);var i=this._zrLayer.getMaptalks(),r=this._dispatchInteractAction.bind(this,e,i);["zoomend","zooming","zoomstart","dragrotating","pitch","pitchend","movestart","moving","moveend","resize","touchstart","touchmove","touchend","animating"].forEach((function(t){i.on(t,r)}))},render:function(t,e,n){this._zrLayer||this._initMaptalksLayer(t,n);var i=this._zrLayer.getMaptalks(),r=t.get("urlTemplate"),o=i.getBaseLayer();r!==this._oldUrlTemplate&&(o?o.setOptions({urlTemplate:r,attribution:t.get("attribution")}):(o=new maptalks.TileLayer("maptalks-echarts-gl-baselayer",{urlTemplate:r,subdomains:["a","b","c"],attribution:t.get("attribution")}),i.setBaseLayer(o))),this._oldUrlTemplate=r,i.setCenter(t.get("center")),i.setZoom(t.get("zoom"),{animation:!1}),i.setPitch(t.get("pitch")),i.setBearing(t.get("bearing")),t.setMaptalks(i);var a=t.coordinateSystem;a.viewGL.scene.add(this._lightRoot),a.viewGL.add(this._groundMesh),this._updateGroundMesh(),this._sceneHelper.setScene(a.viewGL.scene),this._sceneHelper.updateLight(t),a.viewGL.setPostEffect(t.getModel("postEffect"),n),a.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._maptalks3DModel=t},afterRender:function(t,e,n,i){var r=i.renderer;this._sceneHelper.updateAmbientCubemap(r,t,n),this._sceneHelper.updateSkybox(r,t,n),t.coordinateSystem.viewGL.scene.traverse((function(t){t.material&&(t.material.define("fragment","NORMAL_UP_AXIS",2),t.material.define("fragment","NORMAL_FRONT_AXIS",1))}))},updateCamera:function(t,e,n,i){t.coordinateSystem.setCameraOption(i),this._updateGroundMesh(),n.getZr().refresh()},_dispatchInteractAction:function(t,e,n){var i;t.dispatchAction({type:"maptalks3DChangeCamera",pitch:e.getPitch(),zoom:(i=e.getResolution(),19-Math.log(i/YW)/Math.LN2+1),center:e.getCenter().toArray(),bearing:e.getBearing(),maptalks3DId:this._maptalks3DModel&&this._maptalks3DModel.id})},_updateGroundMesh:function(){if(this._maptalks3DModel){var t=this._maptalks3DModel.coordinateSystem,e=t.dataToPoint(t.center);this._groundMesh.position.set(e[0],e[1],-.001);var n=new _V.Plane(new _V.Vector3(0,0,1),0),i=t.viewGL.camera.castRay(new _V.Vector2(-1,-1)),r=t.viewGL.camera.castRay(new _V.Vector2(1,1)),o=i.intersectPlane(n),a=r.intersectPlane(n),s=o.dist(a)/t.viewGL.rootNode.scale.x;this._groundMesh.scale.set(s,s,1)}},dispose:function(t,e){this._zrLayer&&this._zrLayer.dispose(),e.getZr().painter.delLayer(-1e3)}}),YW=12756274*Math.PI/(256*Math.pow(2,20));function KW(){BW.apply(this,arguments),this.maxPitch=85,this.zoomOffset=1}KW.prototype=new BW,KW.prototype.constructor=KW,KW.prototype.type="maptalks3D";const JW=VW("maptalks3D",KW,(function(t){t.forEach((function(t){t.setCameraOption(t.model.getMaptalksCameraOption())}))}));Jw((function(t){t.registerComponentModel(WW),t.registerComponentView(qW),t.registerCoordinateSystem("maptalks3D",JW),t.registerAction({type:"maptalks3DChangeCamera",event:"maptalks3dcamerachanged",update:"maptalks3D:updateCamera"},(function(t,e){e.eachComponent({mainType:"maptalks3D",query:t},(function(e){e.setMaptalksCameraOption(t)}))}))}));var QW=UV.vec3,$W=jw.isDimensionStacked;const tj=function(t,e){var n=t.getData(),i=t.get("barSize");if(null==i){var r,o,a=e.size,s=e.getAxis("x"),l=e.getAxis("y");r="category"===s.type?.7*s.getBandWidth():.6*Math.round(a[0]/Math.sqrt(n.count())),o="category"===l.type?.7*l.getBandWidth():.6*Math.round(a[1]/Math.sqrt(n.count())),i=[r,o]}else yt(i)||(i=[i,i]);var u=e.getAxis("z").scale.getExtent(),h=function(t){var e=t[0],n=t[1];return!(e>0&&n>0||e<0&&n<0)}(u),c=["x","y","z"].map((function(e){return t.coordDimToDataDim(e)[0]})),d=$W(n,c[2]),f=d?n.getCalculationInfo("stackResultDimension"):c[2];n.each(c,(function(t,r,o,a){var s=n.get(f,a),l=d?s-o:h?0:u[0],c=e.dataToPoint([t,r,l]),p=e.dataToPoint([t,r,s]),g=QW.dist(c,p),m=[0,p[1]"+r.join("
")}(r):ze(mc(r)),a=i.getName(e),s=EU(i,e);Tt(s)&&s.colorStops&&(s=(s.colorStops[0]||{}).color);var l=Sc(s=s||"transparent"),u=t.name;return"\0-"===u&&(u=""),u=u?ze(u)+(n?": ":"
"):"",n?l+u+o:u+l+(a?ze(a)+": "+o:o)}function uj(t,e,n){n=n||t.getSource();var i=e||Hy(t.get("coordinateSystem"))||["x","y","z"],r=Lx(n,{dimensionsDefine:n.dimensionsDefine||t.get("dimensions"),encodeDefine:n.encodeDefine||t.get("encode"),coordDimensions:i.map((function(e){var n=t.getReferringComponents(e+"Axis3D").models[0];return{type:n&&"category"===n.get("type")?"ordinal":"float",name:e}}))});"cartesian3D"===t.get("coordinateSystem")&&r.forEach((function(e){if(i.indexOf(e.coordDim)>=0){var n=t.getReferringComponents(e.coordDim+"Axis3D").models[0];n&&"category"===n.get("type")&&(e.ordinalMeta=n.getOrdinalMeta())}}));var o=jw.enableDataStack(t,r,{byIndex:!0,stackedCoordDimension:"z"}),a=new Cx(r,t);return a.setCalculationInfo(o),a.initData(n),a}var hj=Lp.extend({type:"series.bar3D",dependencies:["globe"],visualStyleAccessPathvisu:"itemStyle",getInitialData:function(t,e){return uj(this)},getFormattedLabel:function(t,e,n,i){var r=sj.getFormattedLabel(this,t,e,n,i);return null==r&&(r=this.getData().get("z",t)),r},formatTooltip:function(t){return lj(this,t)},defaultOption:{coordinateSystem:"cartesian3D",globeIndex:0,grid3DIndex:0,zlevel:-10,bevelSize:0,bevelSmoothness:2,onGridPlane:"xy",shading:"color",minHeight:0,itemStyle:{opacity:1},label:{show:!1,distance:2,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},emphasis:{label:{show:!0}},animationDurationUpdate:500}});nt(hj.prototype,qH);const cj=hj;var dj,fj,pj,gj,mj,vj,_j,yj,xj=UV.vec3,wj=UV.mat3,bj=xk.extend((function(){return{attributes:{position:new xk.Attribute("position","float",3,"POSITION"),normal:new xk.Attribute("normal","float",3,"NORMAL"),color:new xk.Attribute("color","float",4,"COLOR"),prevPosition:new xk.Attribute("prevPosition","float",3),prevNormal:new xk.Attribute("prevNormal","float",3)},dynamic:!0,enableNormal:!1,bevelSize:1,bevelSegments:0,_dataIndices:null,_vertexOffset:0,_triangleOffset:0}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0},setBarCount:function(t){var e=this.enableNormal,n=this.getBarVertexCount()*t,i=this.getBarTriangleCount()*t;this.vertexCount!==n&&(this.attributes.position.init(n),e?this.attributes.normal.init(n):this.attributes.normal.value=null,this.attributes.color.init(n)),this.triangleCount!==i&&(this.indices=n>65535?new Uint32Array(3*i):new Uint16Array(3*i),this._dataIndices=new Uint32Array(n))},getBarVertexCount:function(){var t=this.bevelSize>0?this.bevelSegments:0;return t>0?this._getBevelBarVertexCount(t):this.enableNormal?24:8},getBarTriangleCount:function(){var t=this.bevelSize>0?this.bevelSegments:0;return t>0?this._getBevelBarTriangleCount(t):12},_getBevelBarVertexCount:function(t){return 4*(t+1)*(t+1)*2},_getBevelBarTriangleCount:function(t){return(4*t+3+1)*(2*t+1)*2+4},setColor:function(t,e){for(var n=this.getBarVertexCount(),i=n*(t+1),r=n*t;r0&&this.bevelSegments>0)this._addBevelBar(t,c,g,m,this.bevelSize,this.bevelSegments,v);else{xj.copy(r,c),xj.normalize(r,r),xj.cross(o,g,r),xj.normalize(o,o),xj.cross(i,r,o),xj.normalize(o,o),xj.negate(a,i),xj.negate(s,r),xj.negate(l,o),e(u[0],t,i,m[0]/2),e(u[0],u[0],o,m[2]/2),e(u[1],t,i,m[0]/2),e(u[1],u[1],l,m[2]/2),e(u[2],t,a,m[0]/2),e(u[2],u[2],l,m[2]/2),e(u[3],t,a,m[0]/2),e(u[3],u[3],o,m[2]/2),e(n,t,r,m[1]),e(u[4],n,i,m[0]/2),e(u[4],u[4],o,m[2]/2),e(u[5],n,i,m[0]/2),e(u[5],u[5],l,m[2]/2),e(u[6],n,a,m[0]/2),e(u[6],u[6],l,m[2]/2),e(u[7],n,a,m[0]/2),e(u[7],u[7],o,m[2]/2);var x=this.attributes;if(this.enableNormal){h[0]=i,h[1]=a,h[2]=r,h[3]=s,h[4]=o,h[5]=l;for(var w=this._vertexOffset,b=0;b0&&(f++,h[3]<.99&&(p=!0))}})),a.geometry.setBarCount(f);var g=n.getLayout("orient"),m=this._barIndexOfData=new Int32Array(n.count());f=0;n.each((function(t){if(n.hasValue(t)){var e=n.getItemLayout(t),i=e[0],r=e[1],a=e[2],s=4*t;h[0]=c[s++],h[1]=c[s++],h[2]=c[s++],h[3]=c[s++],h[3]>0&&(o._barMesh.geometry.addBar(i,r,g,a,h,t),m[t]=f++)}else m[t]=-1})),a.geometry.dirty(),a.geometry.updateBoundingBox();var v=a.material;v.transparent=p,v.depthMask=!p,a.geometry.sortTriangles=p,this._initHandler(t,e)},_initHandler:function(t,e){var n=t.getData(),i=this._barMesh,r="cartesian3D"===t.coordinateSystem.type;i.seriesIndex=t.seriesIndex;var o=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(t){var a=i.geometry.getDataIndexOfVertex(t.triangle[0]);a!==o&&(this._downplay(o),this._highlight(a),this._labelsBuilder.updateLabels([a]),r&&e.dispatchAction({type:"grid3DShowAxisPointer",value:[n.get("x",a),n.get("y",a),n.get("z",a,!0)]})),o=a,i.dataIndex=a}),this),i.on("mouseout",(function(t){this._downplay(o),this._labelsBuilder.updateLabels(),o=-1,i.dataIndex=-1,r&&e.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_highlight:function(t){var e=this._data;if(e){var n=this._barIndexOfData[t];if(!(n<0)){var i=e.getItemModel(t).getModel("emphasis.itemStyle"),r=i.get("color"),o=i.get("opacity");if(null==r)r=zi(EU(e,t),-.4);null==o&&(o=OU(e,t));var a=_V.parseColor(r);a[3]*=o,this._barMesh.geometry.setColor(n,a),this._api.getZr().refresh()}}},_downplay:function(t){var e=this._data;if(e){var n=this._barIndexOfData[t];if(!(n<0)){var i=EU(e,t),r=OU(e,t),o=_V.parseColor(i);o[3]*=r,this._barMesh.geometry.setColor(n,o),this._api.getZr().refresh()}}},highlight:function(t,e,n,i){this._toggleStatus("highlight",t,e,n,i)},downplay:function(t,e,n,i){this._toggleStatus("downplay",t,e,n,i)},_toggleStatus:function(t,e,n,i,r){var o=e.getData(),a=xB.queryDataIndex(o,r),s=this;null!=a?ct(sj.normalizeToArray(a),(function(e){"highlight"===t?this._highlight(e):this._downplay(e)}),this):o.each((function(e){"highlight"===t?s._highlight(e):s._downplay(e)}))},remove:function(){this.groupGL.removeAll()},dispose:function(){this._labelsBuilder.dispose(),this.groupGL.removeAll()}});Jw((function(t){t.registerChartView(Mj),t.registerSeriesModel(cj),oj(t),t.registerProcessor((function(t,e){t.eachSeriesByType("bar3d",(function(t){var e=t.getData();e.filterSelf((function(t){return e.hasValue(t)}))}))}))}));const Cj=Lp.extend({type:"series.line3D",dependencies:["grid3D"],visualStyleAccessPath:"lineStyle",visualDrawType:"stroke",getInitialData:function(t,e){return uj(this)},formatTooltip:function(t){return lj(this,t)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,grid3DIndex:0,lineStyle:{width:2},animationDurationUpdate:500}});function Lj(t,e,n,i,r,o,a){if(0===r)return!1;var s=r,l=0;if(a>e+s&&a>i+s||at+s&&o>n+s||o=0){var m=3*l,v=new $N(this._points[m],this._points[m+1],this._points[m+2]);o.push({dataIndex:l,point:v,pointWorld:v.clone(),target:this._line3DMesh,distance:this._camera.getWorldPosition().dist(v)})}},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});Jw((function(t){t.registerChartView(Dj),t.registerSeriesModel(Cj),t.registerLayout((function(t,e){t.eachSeriesByType("line3D",(function(t){var e=t.getData(),n=t.coordinateSystem;if(n){if("cartesian3D"!==n.type)return void 0;var i=new Float32Array(3*e.count()),r=[],o=[],a=n.dimensions.map((function(e){return t.coordDimToDataDim(e)[0]}));n&&e.each(a,(function(t,e,a,s){r[0]=t,r[1]=e,r[2]=a,n.dataToPoint(r,o),i[3*s]=o[0],i[3*s+1]=o[1],i[3*s+2]=o[2]})),e.setLayout("points",i)}}))}))}));const Ij=Lp.extend({type:"series.scatter3D",dependencies:["globe","grid3D","geo3D"],visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,getInitialData:function(t,e){return uj(this)},getFormattedLabel:function(t,e,n,i){var r=sj.getFormattedLabel(this,t,e,n,i);if(null==r){var o=this.getData(),a=o.dimensions[o.dimensions.length-1];r=o.get(a,t)}return r},formatTooltip:function(t){return lj(this,t)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,progressive:1e5,progressiveThreshold:1e5,grid3DIndex:0,globeIndex:0,symbol:"circle",symbolSize:10,blendMode:"source-over",label:{show:!1,position:"right",distance:5,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},itemStyle:{opacity:.8},emphasis:{label:{show:!0}},animationDurationUpdate:500}});function Pj(t,e,n){(e=e||document.createElement("canvas")).width=t,e.height=t;var i=e.getContext("2d");return n&&n(i),e}var Ej={getMarginByStyle:function(t){var e=t.minMargin||0,n=0;t.stroke&&"none"!==t.stroke&&(n=null==t.lineWidth?1:t.lineWidth);var i=t.shadowBlur||0,r=t.shadowOffsetX||0,o=t.shadowOffsetY||0,a={};return a.left=Math.max(n/2,-r+i,e),a.right=Math.max(n/2,r+i,e),a.top=Math.max(n/2,-o+i,e),a.bottom=Math.max(n/2,o+i,e),a},createSymbolSprite:function(t,e,n,i){var r=function(t,e,n,i){yt(e)||(e=[e,e]);var r=Ej.getMarginByStyle(n,i),o=e[0]+r.left+r.right,a=e[1]+r.top+r.bottom,s=jv(t,0,0,e[0],e[1]),l=Math.max(o,a);s.x=r.left,s.y=r.top,o>a?s.y+=(l-a)/2:s.x+=(l-o)/2;var u=s.getBoundingRect();return s.x-=u.x,s.y-=u.y,s.setStyle(n),s.update(),s.__size=l,s}(t,e,n),o=Ej.getMarginByStyle(n);return{image:Pj(r.__size,i,(function(t){v_(t,r)})),margin:o}},createSDFFromCanvas:function(t,e,n,i){return Pj(e,i,(function(e){var i=t.getContext("2d").getImageData(0,0,t.width,t.height);e.putImageData(function(t,e,n){var i=e.width,r=e.height,o=t.canvas.width,a=t.canvas.height,s=i/o,l=r/a;function u(t){return t<128?1:-1}function h(t,o){var a=1/0;t=Math.floor(t*s);for(var h=(o=Math.floor(o*l))*i+t,c=u(e.data[4*h]),d=Math.max(o-n,0);d=2e4},doSortVertices:function(t,e){var n=this.indices,i=Nj.create();if(!n){n=this.indices=this.vertexCount>65535?new Uint32Array(this.vertexCount):new Uint16Array(this.vertexCount);for(var r=0;r.05);else for(r=0;r<3;r++)this._progressiveQuickSort(3*e+r);this.dirtyIndices()},_simpleSort:function(t){var e=this._zList,n=this.indices;function i(t,n){return e[n]-e[t]}t?Array.prototype.sort.call(n,i):CU.sort(n,i,0,n.length-1)},_progressiveQuickSort:function(t){var e=this._zList,n=this.indices;this._quickSort=this._quickSort||new CU,this._quickSort.step(n,(function(t,n){return e[n]-e[t]}),t)}};var kj=UV.vec4;_V.Shader.import("@export ecgl.sdfSprite.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform float elapsedTime : 0;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_SIZE\nattribute float size;\n#else\nuniform float u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_FillColor: COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute float prevSize;\nuniform float percent : 1.0;\n#endif\n\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvarying float v_Size;\n\nvoid main()\n{\n\n#ifdef POSITIONTEXTURE_ENABLED\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\n#else\n\n #ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n #else\n vec3 pos = position;\n #endif\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n#endif\n\n#ifdef VERTEX_SIZE\n#ifdef VERTEX_ANIMATION\n v_Size = mix(prevSize, size, percent);\n#else\n v_Size = size;\n#endif\n#else\n v_Size = u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\n v_Color = a_FillColor;\n #endif\n\n gl_PointSize = v_Size;\n}\n\n@end\n\n@export ecgl.sdfSprite.fragment\n\nuniform vec4 color: [1, 1, 1, 1];\nuniform vec4 strokeColor: [1, 1, 1, 1];\nuniform float smoothing: 0.07;\n\nuniform float lineWidth: 0.0;\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\nvarying float v_Size;\n\nuniform sampler2D sprite;\n\n@import clay.util.srgb\n\nvoid main()\n{\n gl_FragColor = color;\n\n vec4 _strokeColor = strokeColor;\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n #endif\n\n#ifdef SPRITE_ENABLED\n float d = texture2D(sprite, gl_PointCoord).r;\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\n\n if (lineWidth > 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end");var zj=_V.Mesh.extend((function(){var t=new _V.Geometry({dynamic:!0,attributes:{color:new _V.Geometry.Attribute("color","float",4,"COLOR"),position:new _V.Geometry.Attribute("position","float",3,"POSITION"),size:new _V.Geometry.Attribute("size","float",1),prevPosition:new _V.Geometry.Attribute("prevPosition","float",3),prevSize:new _V.Geometry.Attribute("prevSize","float",1)}});Object.assign(t,Rj);var e=new _V.Material({shader:_V.createShader("ecgl.sdfSprite"),transparent:!0,depthMask:!1});e.enableTexture("sprite"),e.define("both","VERTEX_COLOR"),e.define("both","VERTEX_SIZE");var n=new _V.Texture2D({image:document.createElement("canvas"),flipY:!1});return e.set("sprite",n),t.pick=this._pick.bind(this),{geometry:t,material:e,mode:_V.Mesh.POINTS,sizeScale:1}}),{_pick:function(t,e,n,i,r,o){var a=this._positionNDC;if(a)for(var s=n.viewport,l=2/s.width,u=2/s.height,h=this.geometry.vertexCount-1;h>=0;h--){var c,d=a[2*(c=this.geometry.indices?this.geometry.indices[h]:h)],f=a[2*c+1],p=this.geometry.attributes.size.get(c)/this.sizeScale/2;if(t>d-p*l&&tf-p*u&&e2?(p=this._updateSymbolSprite(t,d,h,c),s.enableTexture("sprite")):s.disableTexture("sprite"),u.position.init(r-i);var g=[];if(f){s.undefine("VERTEX_SIZE"),s.undefine("VERTEX_COLOR");var m=function(t){const e=t.getVisual("style");if(e)return e[t.getVisual("drawType")]}(a),v=function(t){return t.getVisual("style").opacity}(a);_V.parseColor(m,g),g[3]*=v,s.set({color:g,u_Size:h.maxSize*this._sizeScale})}else s.set({color:[1,1,1,1]}),s.define("VERTEX_SIZE"),s.define("VERTEX_COLOR"),u.size.init(r-i),u.color.init(r-i),this._originalOpacity=new Float32Array(r-i);for(var _=a.getLayout("points"),y=u.position.value,x=0;x1?(a[0]=n.maxSize,a[1]=n.maxSize/n.aspect):(a[1]=n.maxSize,a[0]=n.maxSize*n.aspect),a[0]=a[0]||1,a[1]=a[1]||1,this._symbolType===n.type&&(r=this._symbolSize,o=a,r&&o&&r[0]===o[0]&&r[1]===o[1])&&this._lineWidth===e.lineWidth||(Oj.createSymbolSprite(n.type,a,{fill:"#fff",lineWidth:e.lineWidth,stroke:"transparent",shadowColor:"transparent",minMargin:Math.min(a[0]/2,10)},this._spriteImageCanvas),Oj.createSDFFromCanvas(this._spriteImageCanvas,Math.min(this._spriteImageCanvas.width,32),20,this._mesh.material.get("sprite").image),this._symbolType=n.type,this._symbolSize=a,this._lineWidth=e.lineWidth),this._spriteImageCanvas.width/n.maxSize*i},_updateMaterial:function(t,e){var n="lighter"===t.get("blendMode")?_V.additiveBlend:null,i=this._mesh.material;i.blend=n,i.set("lineWidth",e.lineWidth/20);var r=_V.parseColor(e.stroke);i.set("strokeColor",r),i.transparent=!0,i.depthMask=!1,i.depthTest=!this.is2D,i.sortVertices=!this.is2D},_updateLabelBuilder:function(t,e,n){var i=t.getData(),r=this._mesh.geometry,o=r.attributes.position.value,a=(e=this._startDataIndex,this._mesh.sizeScale);this._labelsBuilder.updateData(i,e,n),this._labelsBuilder.getLabelPosition=function(t,n,i){var r=3*(t-e);return[o[r],o[r+1],o[r+2]]},this._labelsBuilder.getLabelDistance=function(t,n,i){return r.attributes.size.get(t-e)/a/2+i},this._labelsBuilder.updateLabels()},_updateAnimation:function(t){_V.updateVertexAnimation([["prevPosition","position"],["prevSize","size"]],this._prevMesh,this._mesh,t)},_updateHandler:function(t,e,n){var i,r=t.getData(),o=this._mesh,a=this,s=-1,l=t.coordinateSystem&&"cartesian3D"===t.coordinateSystem.type;l&&(i=t.coordinateSystem.model),o.seriesIndex=t.seriesIndex,o.off("mousemove"),o.off("mouseout"),o.on("mousemove",(function(e){var u=e.vertexIndex+a._startDataIndex;u!==s&&(this.highlightOnMouseover&&(this.downplay(r,s),this.highlight(r,u),this._labelsBuilder.updateLabels([u])),l&&n.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get(t.coordDimToDataDim("x")[0],u),r.get(t.coordDimToDataDim("y")[0],u),r.get(t.coordDimToDataDim("z")[0],u)],grid3DIndex:i.componentIndex})),o.dataIndex=u,s=u}),this),o.on("mouseout",(function(t){var e=t.vertexIndex+a._startDataIndex;this.highlightOnMouseover&&(this.downplay(r,e),this._labelsBuilder.updateLabels()),s=-1,o.dataIndex=-1,l&&n.dispatchAction({type:"grid3DHideAxisPointer",grid3DIndex:i.componentIndex})}),this)},updateLayout:function(t,e,n){var i=t.getData();if(this._mesh){var r=this._mesh.geometry.attributes.position.value,o=i.getLayout("points");if(this.is2D)for(var a=0;athis._endDataIndex||ethis._endDataIndex||e 1.0 || v_Percent < 0.0) {\n discard;\n }\n\n float fade = v_Percent;\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n\n if (v_Percent > (1.0 - v_SpotPercent)) {\n gl_FragColor.rgb *= spotIntensity;\n }\n\n gl_FragColor.a *= fade;\n}\n\n@end");const lZ=_V.Mesh.extend((function(){var t=new _V.Material({shader:new _V.Shader(_V.Shader.source("ecgl.trail2.vertex"),_V.Shader.source("ecgl.trail2.fragment")),transparent:!0,depthMask:!1}),e=new XV({dynamic:!0});return e.createAttribute("dist","float",1),e.createAttribute("distAll","float",1),e.createAttribute("start","float",1),{geometry:e,material:t,culling:!1,$ignorePicking:!0}}),{updateData:function(t,e,n){var i=t.hostModel,r=this.geometry,o=i.getModel("effect"),a=o.get("trailWidth")*e.getDevicePixelRatio(),s=o.get("trailLength"),l=i.get("effect.constantSpeed"),u=1e3*i.get("effect.period"),h=null!=l;h?this.material.set("speed",l/1e3):this.material.set("period",u),this.material[h?"define":"undefine"]("vertex","CONSTANT_SPEED");var c=i.get("polyline");r.trailLength=s,this.material.set("trailLength",s),r.resetOffset(),["position","positionPrev","positionNext"].forEach((function(t){r.attributes[t].value=n.attributes[t].value}));["dist","distAll","start","offset","color"].forEach((function(t){r.attributes[t].init(r.vertexCount)})),r.indices=n.indices;var d=[],f=o.get("trailColor"),p=o.get("trailOpacity"),g=null!=f,m=null!=p;this.updateWorldTransform();var v=this.worldTransform.x.len(),_=this.worldTransform.y.len(),y=this.worldTransform.z.len(),x=0,w=0;t.each((function(e){var i=t.getItemLayout(e),o=m?p:OU(t,e),s=EU(t,e);null==o&&(o=1),(d=_V.parseColor(g?f:s,d))[3]*=o;for(var l=c?n.getPolylineVertexCount(i):n.getCubicCurveVertexCount(i[0],i[1],i[2],i[3]),b=0,S=[],T=[],M=x;Mx&&(b+=sZ.dist(S,T)),r.attributes.dist.set(M,b),sZ.copy(T,S);w=Math.max(w,b);var C=Math.random()*(h?b:u);for(M=x;M0?1:-1)*a/2),r.attributes.color.set(M,d);x+=l})),this.material.set("spotSize",.1*w*s),this.material.set("spotIntensity",o.get("spotIntensity")),r.dirty()},setAnimationTime:function(t){this.material.set("time",t)}});_V.Shader.import(gG);const uZ=Fm.extend({type:"lines3D",__ecgl__:!0,init:function(t,e){this.groupGL=new _V.Node,this._meshLinesMaterial=new _V.Material({shader:_V.createShader("ecgl.meshLines3D"),transparent:!0,depthMask:!1}),this._linesMesh=new _V.Mesh({geometry:new XV,material:this._meshLinesMaterial,$ignorePicking:!0}),this._trailMesh=new lZ},render:function(t,e,n){this.groupGL.add(this._linesMesh);var i=t.coordinateSystem,r=t.getData();if(i&&i.viewGL){i.viewGL.add(this.groupGL),this._updateLines(t,e,n);var o=i.viewGL.isLinearSpace()?"define":"undefine";this._linesMesh.material[o]("fragment","SRGB_DECODE"),this._trailMesh.material[o]("fragment","SRGB_DECODE")}var a=this._trailMesh;if(a.stopAnimation(),t.get("effect.show")){this.groupGL.add(a),a.updateData(r,n,this._linesMesh.geometry),a.__time=a.__time||0;var s=36e5;this._curveEffectsAnimator=a.animate("",{loop:!0}).when(s,{__time:s}).during((function(){a.setAnimationTime(a.__time)})).start()}else this.groupGL.remove(a),this._curveEffectsAnimator=null;this._linesMesh.material.blend=this._trailMesh.material.blend="lighter"===t.get("blendMode")?_V.additiveBlend:null},pauseEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.pause()},resumeEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.resume()},toggleEffect:function(){var t=this._curveEffectsAnimator;t&&(t.isPaused()?t.resume():t.pause())},_updateLines:function(t,e,n){var i=t.getData(),r=t.coordinateSystem,o=this._linesMesh.geometry,a=t.get("polyline");o.expandLine=!0;var s=function(t){return null!=t.radius?t.radius:null!=t.size?Math.max(t.size[0],t.size[1],t.size[2]):100}(r);o.segmentScale=s/20;var l="lineStyle.width".split("."),u=n.getDevicePixelRatio(),h=0;i.each((function(t){var e=i.getItemModel(t).get(l);null==e&&(e=1),i.setItemVisual(t,"lineWidth",e),h=Math.max(e,h)})),o.useNativeLine=!1;var c=0,d=0;i.each((function(t){var e=i.getItemLayout(t);a?(c+=o.getPolylineVertexCount(e),d+=o.getPolylineTriangleCount(e)):(c+=o.getCubicCurveVertexCount(e[0],e[1],e[2],e[3]),d+=o.getCubicCurveTriangleCount(e[0],e[1],e[2],e[3]))})),o.setVertexCount(c),o.setTriangleCount(d),o.resetOffset();var f=[];i.each((function(t){var e=i.getItemLayout(t),n=EU(i,t),r=OU(i,t),s=i.getItemVisual(t,"lineWidth")*u;null==r&&(r=1),(f=_V.parseColor(n,f))[3]*=r,a?o.addPolyline(e,f,s):o.addCubicCurve(e[0],e[1],e[2],e[3],f,s)})),o.dirty()},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});function hZ(t,e){for(var n=[],i=0;i0;this._updateSurfaceMesh(this._surfaceMesh,t,h,f);var p=this._surfaceMesh.material;f?(p.define("WIREFRAME_QUAD"),p.set("wireframeLineWidth",d),p.set("wireframeLineColor",_V.parseColor(c.get("lineStyle.color")))):p.undefine("WIREFRAME_QUAD"),this._initHandler(t,n),this._updateAnimation(t)},_updateAnimation:function(t){_V.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,t)},_createSurfaceMesh:function(){var t=new _V.Mesh({geometry:new _V.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new _V.Material({shader:new _V.Shader(_V.Shader.source("ecgl.sm.depth.vertex"),_V.Shader.source("ecgl.sm.depth.fragment"))}),culling:!1,renderOrder:10,renderNormal:!0});return t.geometry.createAttribute("barycentric","float",4),t.geometry.createAttribute("prevPosition","float",3),t.geometry.createAttribute("prevNormal","float",3),Object.assign(t.geometry,PU),t},_initHandler:function(t,e){var n=t.getData(),i=this._surfaceMesh,r=t.coordinateSystem;i.seriesIndex=t.seriesIndex;var o=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(t){var a=function(t,e){for(var n=1/0,r=-1,o=[],a=0;a=0){var s=[];i.geometry.attributes.position.get(a,s);for(var l=r.pointToData(s),u=1/0,h=-1,c=[],d=0;d65535?Uint32Array:Uint16Array)((p-1)*(g-1)*6),b=function(t,e,n){n[1]=t*g+e,n[0]=t*g+e+1,n[3]=(t+1)*g+e+1,n[2]=(t+1)*g+e},S=!1;if(l){var T=[],M=[],C=0;m?h.init(r.vertexCount):h.value=null;for(var L=[[],[],[]],A=[],D=[],I=mZ.create(),P=function(t,e,n){var i=3*e;return n[0]=t[i],n[1]=t[i+1],n[2]=t[i+2],n},E=new Float32Array(a.length),O=new Float32Array(a.length/3*4),N=0;N0;){if(Math.floor(s/h)===s/h)return[h,s/h];h--}return[h=Math.floor(Math.sqrt(s)),h]},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function _Z(t,e){for(var n=[],i=0;i "+f)),h++)}var p=Lx(t,{coordDimensions:["value"]});(s=new Cx(p,n)).initData(t);var g=new Cx(["value"],n);return g.initData(u,l),r&&r(s,g),CZ({mainData:s,struct:o,structAttr:"graph",datas:{node:s,edge:g},datasAttr:{node:"data",edge:"edgeData"}}),o.update(),o}(i,n,this,!0,(function(t,n){t.wrapMethod("getItemModel",(function(t){const e=r._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t}));const i=e.getModel([]).getModel;function o(t,e){const n=i.call(this,t,e);return n.resolveParentPath=a,n}function a(t){if(t&&("label"===t[0]||"label"===t[1])){const e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}n.wrapMethod("getItemModel",(function(t){return t.resolveParentPath=a,t.getModel=o,t}))})).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(t,e,n){if("edge"===n){var i=this.getData(),r=this.getDataParams(t,n),o=i.graph.getEdgeByIndex(t),a=i.getName(o.node1.dataIndex),s=i.getName(o.node2.dataIndex),l=[];return null!=a&&l.push(a),null!=s&&l.push(s),l=ze(l.join(" > ")),r.value&&(l+=" : "+ze(r.value)),l}return LZ.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var t=(this.option.categories||[]).map((function(t){return null!=t.value?t:Object.assign({value:0},t)})),e=new Cx(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray((function(t){return e.getItemModel(t,!0)}))},setView:function(t){null!=t.zoom&&(this.option.zoom=t.zoom),null!=t.offset&&(this.option.offset=t.offset)},setNodePosition:function(t){for(var e=0;e65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(this.indices=0===t?null:this.vertexCount>65535?new Uint32Array(3*t):new Uint16Array(3*t))},_getCubicCurveApproxStep:function(t,e,n,i){return 1/(DZ.dist(t,e)+DZ.dist(n,e)+DZ.dist(i,n)+1)*this.segmentScale},getCubicCurveVertexCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?2*o:2*o+2},getCubicCurveTriangleCount:function(t,e,n,i){var r=this._getCubicCurveApproxStep(t,e,n,i),o=Math.ceil(1/r);return this.useNativeLine?0:2*o},getLineVertexCount:function(){return this.getPolylineVertexCount(IZ)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(IZ)},getPolylineVertexCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/2;return this.useNativeLine?2*(e-1):2*(e-1)+2},getPolylineTriangleCount:function(t){var e;"number"==typeof t?e=t:e="number"!=typeof t[0]?t.length:t.length/2;return this.useNativeLine?0:2*(e-1)},addCubicCurve:function(t,e,n,i,r,o){null==o&&(o=1);var a=t[0],s=t[1],l=e[0],u=e[1],h=n[0],c=n[1],d=i[0],f=i[1],p=this._getCubicCurveApproxStep(t,e,n,i),g=p*p,m=g*p,v=3*p,_=3*g,y=6*g,x=6*m,w=a-2*l+h,b=s-2*u+c,S=3*(l-h)-a+d,T=3*(u-c)-s+f,M=a,C=s,L=(l-a)*v+w*_+S*m,A=(u-s)*v+b*_+T*m,D=w*y+S*x,I=b*y+T*x,P=S*x,E=T*x,O=0,N=0,R=Math.ceil(1/p),k=new Float32Array(3*(R+1)),z=(k=[],0);for(N=0;N1&&(M=L>0?Math.min(M,d):Math.max(M,d),C=A>0?Math.min(C,f):Math.max(C,f));this.addPolyline(k,r,o)},addLine:function(t,e,n,i){this.addPolyline([t,e],n,i)},addPolyline:function(){var t=DZ.create(),e=DZ.create(),n=DZ.create(),i=DZ.create(),r=[],o=[],a=[];return function(s,l,u,h,c){if(s.length){var d="number"!=typeof s[0];if(null==c&&(c=d?s.length:s.length/2),!(c<2)){null==h&&(h=0),null==u&&(u=1),this._itemVertexOffsets.push(this._vertexOffset);for(var f,p=d?"number"!=typeof l[0]:l.length/4===c,g=this.attributes.position,m=this.attributes.color,v=this.attributes.offset,_=this.attributes.normal,y=this.indices,x=this._vertexOffset,w=0;w1&&(g.copy(x,x-1),m.copy(x,x-1),x++);else{var T;if(w0){DZ.sub(t,r,a),DZ.sub(e,o,r),DZ.normalize(t,t),DZ.normalize(e,e),DZ.add(i,t,e),DZ.normalize(i,i);var M=u/2*Math.min(1/DZ.dot(t,i),2);n[0]=-i[1],n[1]=i[0],T=M}else DZ.sub(t,o,r),DZ.normalize(t,t),n[0]=-t[1],n[1]=t[0],T=u/2}else DZ.sub(t,r,a),DZ.normalize(t,t),n[0]=-t[1],n[1]=t[0],T=u/2;_.set(x,n),_.set(x+1,n),v.set(x,T),v.set(x+1,-T),DZ.copy(a,r),g.set(x,r),g.set(x+1,r),m.set(x,f),m.set(x+1,f),x+=2}if(this.useNativeLine)m.set(x,f),g.set(x,r),x++;else if(w>0){var C=3*this._faceOffset;(y=this.indices)[C]=x-4,y[C+1]=x-3,y[C+2]=x-2,y[C+3]=x-3,y[C+4]=x-1,y[C+5]=x-2,this._faceOffset+=2}}this._vertexOffset=x}}}}(),setItemColor:function(t,e){for(var n=this._itemVertexOffsets[t],i=t 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end");var OZ={repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null};function NZ(t){var e={type:_V.Texture.FLOAT,minFilter:_V.Texture.NEAREST,magFilter:_V.Texture.NEAREST};this._positionSourceTex=new _V.Texture2D(e),this._positionSourceTex.flipY=!1,this._positionTex=new _V.Texture2D(e),this._positionPrevTex=new _V.Texture2D(e),this._forceTex=new _V.Texture2D(e),this._forcePrevTex=new _V.Texture2D(e),this._weightedSumTex=new _V.Texture2D(e),this._weightedSumTex.width=this._weightedSumTex.height=1,this._globalSpeedTex=new _V.Texture2D(e),this._globalSpeedPrevTex=new _V.Texture2D(e),this._globalSpeedTex.width=this._globalSpeedTex.height=1,this._globalSpeedPrevTex.width=this._globalSpeedPrevTex.height=1,this._nodeRepulsionPass=new aB({fragment:_V.Shader.source("ecgl.forceAtlas2.updateNodeRepulsion")}),this._positionPass=new aB({fragment:_V.Shader.source("ecgl.forceAtlas2.updatePosition")}),this._globalSpeedPass=new aB({fragment:_V.Shader.source("ecgl.forceAtlas2.calcGlobalSpeed")}),this._copyPass=new aB({fragment:_V.Shader.source("clay.compositor.output")});var n=function(t){t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE)};this._edgeForceMesh=new _V.Mesh({geometry:new _V.Geometry({attributes:{node1:new _V.Geometry.Attribute("node1","float",2),node2:new _V.Geometry.Attribute("node2","float",2),weight:new _V.Geometry.Attribute("weight","float",1)},dynamic:!0,mainAttribute:"node1"}),material:new _V.Material({transparent:!0,shader:_V.createShader("ecgl.forceAtlas2.updateEdgeAttraction"),blend:n,depthMask:!1,depthText:!1}),mode:_V.Mesh.POINTS}),this._weightedSumMesh=new _V.Mesh({geometry:new _V.Geometry({attributes:{node:new _V.Geometry.Attribute("node","float",2)},dynamic:!0,mainAttribute:"node"}),material:new _V.Material({transparent:!0,shader:_V.createShader("ecgl.forceAtlas2.calcWeightedSum"),blend:n,depthMask:!1,depthText:!1}),mode:_V.Mesh.POINTS}),this._framebuffer=new Tz({depthBuffer:!1}),this._dummyCamera=new _V.OrthographicCamera({left:-1,right:1,top:1,bottom:-1,near:0,far:100}),this._globalSpeed=0}NZ.prototype.updateOption=function(t){for(var e in OZ)this[e]=OZ[e];var n=this._nodes.length;if(this.jitterTolerence=n>5e4?10:n>5e3?1:.1,this.scaling=n>100?2:10,t)for(var e in OZ)null!=t[e]&&(this[e]=t[e]);if(this.repulsionByDegree)for(var i=this._positionSourceTex.pixels,r=0;rt},NZ.prototype._swapTexture=function(){var t=this._positionPrevTex;this._positionPrevTex=this._positionTex,this._positionTex=t;t=this._forcePrevTex;this._forcePrevTex=this._forceTex,this._forceTex=t;t=this._globalSpeedPrevTex;this._globalSpeedPrevTex=this._globalSpeedTex,this._globalSpeedTex=t},NZ.prototype._initFromSource=function(t){this._framebuffer.attach(this._positionPrevTex),this._framebuffer.bind(t),this._copyPass.setUniform("texture",this._positionSourceTex),this._copyPass.render(t),t.gl.clearColor(0,0,0,0),this._framebuffer.attach(this._forcePrevTex),t.gl.clear(t.gl.COLOR_BUFFER_BIT),this._framebuffer.attach(this._globalSpeedPrevTex),t.gl.clear(t.gl.COLOR_BUFFER_BIT),this._framebuffer.unbind(t)},NZ.prototype._resize=function(t,e){["_positionSourceTex","_positionTex","_positionPrevTex","_forceTex","_forcePrevTex"].forEach((function(n){this[n].width=t,this[n].height=e,this[n].dirty()}),this)},NZ.prototype.dispose=function(t){this._framebuffer.dispose(t),this._copyPass.dispose(t),this._nodeRepulsionPass.dispose(t),this._positionPass.dispose(t),this._globalSpeedPass.dispose(t),this._edgeForceMesh.geometry.dispose(t),this._weightedSumMesh.geometry.dispose(t),this._positionSourceTex.dispose(t),this._positionTex.dispose(t),this._positionPrevTex.dispose(t),this._forceTex.dispose(t),this._forcePrevTex.dispose(t),this._weightedSumTex.dispose(t),this._globalSpeedTex.dispose(t),this._globalSpeedPrevTex.dispose(t)};const RZ=NZ;const kZ=function(){var t=function(){return new Float32Array(2)},e=function(t,e){var n=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(n*n+i*i)},n=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},i=function(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t},r=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},o=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},a=function(t,e){return t[0]=e[0],t[1]=e[1],t},s=function(t,e,n){return t[0]=e,t[1]=n,t};function l(){this.subRegions=[],this.nSubRegions=0,this.node=null,this.mass=0,this.centerOfMass=null,this.bbox=new Float32Array(4),this.size=0}var u=l.prototype;function h(){this.position=new Float32Array(2),this.force=t(),this.forcePrev=t(),this.mass=1,this.inDegree=0,this.outDegree=0}function c(t,e){this.source=t,this.target=e,this.weight=1}function d(){this.autoSettings=!0,this.barnesHutOptimize=!0,this.barnesHutTheta=1.5,this.repulsionByDegree=!0,this.linLogMode=!1,this.strongGravityMode=!1,this.gravity=1,this.scaling=1,this.edgeWeightInfluence=1,this.jitterTolerence=.1,this.preventOverlap=!1,this.dissuadeHubs=!1,this.rootRegion=new l,this.rootRegion.centerOfMass=t(),this.nodes=[],this.edges=[],this.bbox=new Float32Array(4),this.gravityCenter=null,this._massArr=null,this._swingingArr=null,this._sizeArr=null,this._globalSpeed=0}u.beforeUpdate=function(){for(var t=0;t=t&&this.bbox[1]<=e&&this.bbox[3]>=e},u.setBBox=function(t,e,n,i){this.bbox[0]=t,this.bbox[1]=e,this.bbox[2]=n,this.bbox[3]=i,this.size=(n-t+i-e)/2},u._newSubRegion=function(){var t=this.subRegions[this.nSubRegions];return t||(t=new l,this.subRegions[this.nSubRegions]=t),this.nSubRegions++,t},u._addNodeToSubRegion=function(t){var e=this.findSubRegion(t.position[0],t.position[1]),n=this.bbox;if(!e){var i=(n[0]+n[2])/2,r=(n[1]+n[3])/2,o=(n[2]-n[0])/2,a=(n[3]-n[1])/2,s=t.position[0]>=i?1:0,l=t.position[1]>=r?1:0;(e=this._newSubRegion()).setBBox(s*o+n[0],l*a+n[1],(s+1)*o+n[0],(l+1)*a+n[1])}e.addNode(t)},u._updateCenterOfMass=function(t){null==this.centerOfMass&&(this.centerOfMass=new Float32Array(2));var e=this.centerOfMass[0]*this.mass,n=this.centerOfMass[1]*this.mass;e+=t.position[0]*t.mass,n+=t.position[1]*t.mass,this.mass+=t.mass,this.centerOfMass[0]=e/this.mass,this.centerOfMass[1]=n/this.mass};var f=d.prototype;f.initNodes=function(t,e,n){var i=e.length;this.nodes.length=0;for(var r=void 0!==n,o=0;o0&&(this.strongGravityMode?this.applyNodeStrongGravity(h):this.applyNodeGravity(h))}for(l=0;l0&&(m=Math.min(m/this._globalSpeed,1.5)*this._globalSpeed),this._globalSpeed=m;for(l=0;l0&&(_=Math.min(y*_,10)/y,i(u.position,u.position,u.force,_))}},f.applyRegionToNodeRepulsion=function(){var e=t();return function(t,n){if(t.node)this.applyNodeToNodeRepulsion(t.node,n,!0);else{o(e,n.position,t.centerOfMass);var r=e[0]*e[0]+e[1]*e[1];if(r>this.barnesHutTheta*t.size*t.size){var a=this.scaling*n.mass*t.mass/r;i(n.force,n.force,e,a)}else for(var s=0;s0)s=this.scaling*t.mass*n.mass/(l*l);else{if(!(l<0))return;s=100*this.scaling*t.mass*n.mass}}else s=this.scaling*t.mass*n.mass/a;i(t.force,t.force,e,s),i(n.force,n.force,e,-s)}}}}(),f.applyEdgeAttraction=function(){var e=t();return function(t){var r=t.source,a=t.target;o(e,r.position,a.position);var s,l,u=n(e);s=0===this.edgeWeightInfluence?1:1===this.edgeWeightInfluence?t.weight:Math.pow(t.weight,this.edgeWeightInfluence),this.preventOverlap&&(u=u-r.size-a.size)<=0||(l=this.linLogMode?-s*Math.log(u+1)/(u+1):-s,i(r.force,r.force,e,l),i(a.force,a.force,e,-l))}}(),f.applyNodeGravity=function(){var e=t();return function(t){o(e,this.gravityCenter,t.position);var r=n(e);i(t.force,t.force,e,this.gravity*t.mass/(r+1))}}(),f.applyNodeStrongGravity=function(){var e=t();return function(t){o(e,this.gravityCenter,t.position),i(t.force,t.force,e,this.gravity*t.mass)}}(),f.updateBBox=function(){for(var t=1/0,e=1/0,n=-1/0,i=-1/0,r=0;r5e4?10:o>5e3?1:.1,e.scaling=o>100?2:10,e.barnesHutOptimize=o>1e3,t)for(var n in BZ)null!=t[n]&&(e[n]=t[n]);if(!e.gravityCenter){for(var a=[1/0,1/0],s=[-1/0,-1/0],l=0;lt},FZ.prototype.getNodePosition=function(t,e){if(e||(e=new Float32Array(2*this._nodes.length)),this._positionArr)for(var n=0;n0?1.1:.9,o=Math.max(Math.min(this._zoom*r,this.maxZoom),this.minZoom);r=o/this._zoom;var a=this._convertPos(n,i),s=(a.x-this._dx)*(r-1),l=(a.y-this._dy)*(r-1);this._dx-=s,this._dy-=l,this._zoom=o,this._needsUpdate=!0}}},dispose:function(){var t=this.zr;t.off("mousedown",this._mouseDownHandler),t.off("mousemove",this._mouseMoveHandler),t.off("mouseup",this._mouseUpHandler),t.off("mousewheel",this._mouseWheelHandler),t.off("globalout",this._mouseUpHandler),t.animation.off("frame",this._update)}});const HZ=GZ;var UZ=UV.vec2;_V.Shader.import("@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end");var WZ=1;const jZ=Fm.extend({type:"graphGL",__ecgl__:!0,init:function(t,e){this.groupGL=new _V.Node,this.viewGL=new NH("orthographic"),this.viewGL.camera.left=this.viewGL.camera.right=0,this.viewGL.add(this.groupGL),this._pointsBuilder=new Vj(!0,e),this._forceEdgesMesh=new _V.Mesh({material:new _V.Material({shader:_V.createShader("ecgl.forceAtlas2.edges"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new _V.Geometry({attributes:{node:new _V.Geometry.Attribute("node","float",2),color:new _V.Geometry.Attribute("color","float",4,"COLOR")},dynamic:!0,mainAttribute:"node"}),renderOrder:-1,mode:_V.Mesh.LINES}),this._edgesMesh=new _V.Mesh({material:new _V.Material({shader:_V.createShader("ecgl.meshLines2D"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new EZ({useNativeLine:!1,dynamic:!0}),renderOrder:-1,culling:!1}),this._layoutId=0,this._control=new HZ({zr:e.getZr(),viewGL:this.viewGL}),this._control.setTarget(this.groupGL),this._control.init(),this._clickHandler=this._clickHandler.bind(this)},render:function(t,e,n){this.groupGL.add(this._pointsBuilder.rootNode),this._model=t,this._api=n,this._initLayout(t,e,n),this._pointsBuilder.update(t,e,n),this._forceLayoutInstance instanceof RZ||this.groupGL.remove(this._forceEdgesMesh),this._updateCamera(t,n),this._control.off("update"),this._control.on("update",(function(){n.dispatchAction({type:"graphGLRoam",seriesId:t.id,zoom:this._control.getZoom(),offset:this._control.getOffset()}),this._pointsBuilder.updateView(this.viewGL.camera)}),this),this._control.setZoom(xB.firstNotNull(t.get("zoom"),1)),this._control.setOffset(t.get("offset")||[0,0]);var i=this._pointsBuilder.getPointsMesh();if(i.off("mousemove",this._mousemoveHandler),i.off("mouseout",this._mouseOutHandler,this),n.getZr().off("click",this._clickHandler),this._pointsBuilder.highlightOnMouseover=!0,t.get("focusNodeAdjacency")){var r=t.get("focusNodeAdjacencyOn");"click"===r?n.getZr().on("click",this._clickHandler):"mouseover"===r&&(i.on("mousemove",this._mousemoveHandler,this),i.on("mouseout",this._mouseOutHandler,this),this._pointsBuilder.highlightOnMouseover=!1)}this._lastMouseOverDataIndex=-1},_clickHandler:function(t){if(!this._layouting){var e=this._pointsBuilder.getPointsMesh().dataIndex;e>=0?this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:e}):this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id})}},_mousemoveHandler:function(t){if(!this._layouting){var e=this._pointsBuilder.getPointsMesh().dataIndex;e>=0?e!==this._lastMouseOverDataIndex&&this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:e}):this._mouseOutHandler(t),this._lastMouseOverDataIndex=e}},_mouseOutHandler:function(t){this._layouting||(this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id}),this._lastMouseOverDataIndex=-1)},_updateForceEdgesGeometry:function(t,e){var n=this._forceEdgesMesh.geometry,i=e.getEdgeData(),r=0,o=this._forceLayoutInstance,a=2*i.count();n.attributes.node.init(a),n.attributes.color.init(a),i.each((function(e){var a=t[e];n.attributes.node.set(r,o.getNodeUV(a.node1)),n.attributes.node.set(r+1,o.getNodeUV(a.node2));var s=EU(i,a.dataIndex),l=_V.parseColor(s);l[3]*=xB.firstNotNull(OU(i,a.dataIndex),1),n.attributes.color.set(r,l),n.attributes.color.set(r+1,l),r+=2})),n.dirty()},_updateMeshLinesGeometry:function(){var t=this._model.getEdgeData(),e=this._edgesMesh.geometry,n=(t=this._model.getEdgeData(),this._model.getData().getLayout("points"));e.resetOffset(),e.setVertexCount(t.count()*e.getLineVertexCount()),e.setTriangleCount(t.count()*e.getLineTriangleCount());var i=[],r=[],o=["lineStyle","width"];this._originalEdgeColors=new Float32Array(4*t.count()),this._edgeIndicesMap=new Float32Array(t.count()),t.each((function(a){var s=t.graph.getEdgeByIndex(a),l=2*s.node1.dataIndex,u=2*s.node2.dataIndex;i[0]=n[l],i[1]=n[l+1],r[0]=n[u],r[1]=n[u+1];var h=EU(t,s.dataIndex),c=_V.parseColor(h);c[3]*=xB.firstNotNull(OU(t,s.dataIndex),1);var d=t.getItemModel(s.dataIndex),f=xB.firstNotNull(d.get(o),1)*this._api.getDevicePixelRatio();e.addLine(i,r,c,f);for(var p=0;p<4;p++)this._originalEdgeColors[4*s.dataIndex+p]=c[p];this._edgeIndicesMap[s.dataIndex]=a}),this),e.dirty()},_updateForceNodesGeometry:function(t){for(var e=this._pointsBuilder.getPointsMesh(),n=[],i=0;i=f&&(l._syncNodePosition(t),d=0),n.getZr().refresh(),yV((function(){p(e)}))}))};yV((function(){l._forceLayoutInstanceToDispose&&(l._forceLayoutInstanceToDispose.dispose(r.layer.renderer),l._forceLayoutInstanceToDispose=null),p(u)})),this._layouting=!0}}},stopLayout:function(t,e,n,i){i&&null!=i.from&&i.from!==this.uid||(this._layoutId=0,this.groupGL.remove(this._forceEdgesMesh),this.groupGL.add(this._edgesMesh),this._forceLayoutInstance&&this.viewGL.layer&&(i&&i.beforeLayout||(this._syncNodePosition(t),this._updateAfterLayout(t,e,n)),this._api.getZr().refresh(),this._layouting=!1))},_syncNodePosition:function(t){var e=this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);t.getData().setLayout("points",e),t.setNodePosition(e)},_updateAfterLayout:function(t,e,n){this._updateMeshLinesGeometry(),this._pointsBuilder.removePositionTexture(),this._pointsBuilder.updateLayout(t,e,n),this._pointsBuilder.updateView(this.viewGL.camera),this._pointsBuilder.updateLabels(),this._pointsBuilder.showLabels()},focusNodeAdjacency:function(t,e,n,i){var r=this._model.getData();this._downplayAll();var o=i.dataIndex,a=r.graph,s=[],l=a.getNodeByIndex(o);s.push(l),l.edges.forEach((function(t){t.dataIndex<0||(t.node1!==l&&s.push(t.node1),t.node2!==l&&s.push(t.node2))}),this),this._pointsBuilder.fadeOutAll(.05),this._fadeOutEdgesAll(.05),s.forEach((function(t){this._pointsBuilder.highlight(r,t.dataIndex)}),this),this._pointsBuilder.updateLabels(s.map((function(t){return t.dataIndex})));var u=[];l.edges.forEach((function(t){t.dataIndex>=0&&(this._highlightEdge(t.dataIndex),u.push(t))}),this),this._focusNodes=s,this._focusEdges=u},unfocusNodeAdjacency:function(t,e,n,i){this._downplayAll(),this._pointsBuilder.fadeInAll(),this._fadeInEdgesAll(),this._pointsBuilder.updateLabels()},_highlightEdge:function(t){var e=this._model.getEdgeData().getItemModel(t),n=_V.parseColor(e.get("emphasis.lineStyle.color")||e.get("lineStyle.color")),i=xB.firstNotNull(e.get("emphasis.lineStyle.opacity"),e.get("lineStyle.opacity"),1);n[3]*=i,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],n)},_downplayAll:function(){this._focusNodes&&this._focusNodes.forEach((function(t){this._pointsBuilder.downplay(this._model.getData(),t.dataIndex)}),this),this._focusEdges&&this._focusEdges.forEach((function(t){this._downplayEdge(t.dataIndex)}),this)},_downplayEdge:function(t){var e=this._getColor(t,[]);this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],e)},_setEdgeFade:function(){var t=[];return function(e,n){this._getColor(e,t),t[3]*=n,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],t)}}(),_getColor:function(t,e){for(var n=0;n<4;n++)e[n]=this._originalEdgeColors[4*t+n];return e},_fadeOutEdgesAll:function(t){this._model.getData().graph.eachEdge((function(e){this._setEdgeFade(e.dataIndex,t)}),this)},_fadeInEdgesAll:function(){this._fadeOutEdgesAll(1)},_updateCamera:function(t,e){this.viewGL.setViewport(0,0,e.getWidth(),e.getHeight(),e.getDevicePixelRatio());for(var n=this.viewGL.camera,i=t.getData().getLayout("points"),r=UZ.create(1/0,1/0),o=UZ.create(-1/0,-1/0),a=[],s=0;sn.left&&un.top)){var h=Math.max(o[0]-r[0],10),c=h/e.getWidth()*e.getHeight();h*=1.4,c*=1.4,r[0]-=.2*h,n.left=r[0],n.top=l-c/2,n.bottom=l+c/2,n.right=h+r[0],n.near=0,n.far=100}},dispose:function(){var t=this.viewGL.layer.renderer;this._forceLayoutInstance&&this._forceLayoutInstance.dispose(t),this.groupGL.removeAll(),this._layoutId=-1,this._pointsBuilder.dispose()},remove:function(){this.groupGL.removeAll(),this._control.dispose()}});function ZZ(t){return t instanceof Array||(t=[t,t]),t}Jw((function(t){function e(){}t.registerChartView(jZ),t.registerSeriesModel(AZ),t.registerVisual((function(t){const e={};t.eachSeriesByType("graphGL",(function(t){var n=t.getCategoriesData(),i=t.getData(),r={};n.each((function(i){var o=n.getName(i);r["ec-"+o]=i;var a=n.getItemModel(i),s=a.getModel("itemStyle").getItemStyle();s.fill||(s.fill=t.getColorFromPalette(o,e)),n.setItemVisual(i,"style",s);var l=["symbol","symbolSize","symbolKeepAspect"];for(let t=0;t65535?new Uint32Array(3*i):new Uint16Array(3*i))},addLine:function(t){var e=this._vertexOffset;this.attributes.position.set(e,[t[0],t[1],1]),this.attributes.position.set(e+1,[t[0],t[1],-1]),this.attributes.position.set(e+2,[t[0],t[1],2]),this.attributes.position.set(e+3,[t[0],t[1],-2]),this.setTriangleIndices(this._faceOffset++,[e,e+1,e+2]),this.setTriangleIndices(this._faceOffset++,[e+1,e+2,e+3]),this._vertexOffset+=4}});LN.import("@export ecgl.vfParticle.particle.fragment\n\nuniform sampler2D particleTexture;\nuniform sampler2D spawnTexture;\nuniform sampler2D velocityTexture;\n\nuniform float deltaTime;\nuniform float elapsedTime;\n\nuniform float speedScaling : 1.0;\n\nuniform vec2 textureSize;\nuniform vec4 region : [0, 0, 1, 1];\nuniform float firstFrameTime;\n\nvarying vec2 v_Texcoord;\n\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, v_Texcoord);\n bool spawn = false;\n if (p.w <= 0.0) {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.w -= firstFrameTime;\n spawn = true;\n }\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.w -= deltaTime;\n\n if (spawn || p.xy != fract(p.xy)) {\n p.z = 0.0;\n }\n p.xy = fract(p.xy);\n\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\nuniform sampler2D spriteTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef SPRITETEXTURE_ENABLED\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\n if (color.a == 0.0) {\n discard;\n }\n#endif\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.vertex\n\n#define PI 3.1415926\n\nattribute vec3 position : POSITION;\n\nuniform sampler2D particleTexture;\nuniform sampler2D prevParticleTexture;\n\nuniform float size : 1.0;\nuniform vec4 vp: VIEWPORT;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\n@import clay.util.rand\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, position.xy);\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\n\n p.xy = p.xy * 2.0 - 1.0;\n p2.xy = p2.xy * 2.0 - 1.0;\n\n if (p.w > 0.0 && p.z > 1e-5) {\n vec2 dir = normalize(p.xy - p2.xy);\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\n if (abs(position.z) == 2.0) {\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\n v_Uv = p.xy;\n v_Mag = p.z;\n }\n else {\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\n v_Mag = p2.z;\n v_Uv = p2.xy;\n }\n gl_Position = worldViewProjection * gl_Position;\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n #ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n");var YZ=function(){this.motionBlurFactor=.99,this.vectorFieldTexture=new sk({type:$R.FLOAT,flipY:!1}),this.particleLife=[5,20],this._particleType="point",this._particleSize=1,this.particleColor=[1,1,1,1],this.particleSpeedScaling=1,this._thisFrameTexture=null,this._particlePass=null,this._spawnTexture=null,this._particleTexture0=null,this._particleTexture1=null,this._particlePointsMesh=null,this._surfaceFrameBuffer=null,this._elapsedTime=0,this._scene=null,this._camera=null,this._lastFrameTexture=null,this._supersampling=1,this._downsampleTextures=[],this._width=512,this._height=512,this.init()};YZ.prototype={constructor:YZ,init:function(){var t={type:$R.FLOAT,minFilter:$R.NEAREST,magFilter:$R.NEAREST,useMipmap:!1};this._spawnTexture=new sk(t),this._particleTexture0=new sk(t),this._particleTexture1=new sk(t),this._frameBuffer=new Tz({depthBuffer:!1}),this._particlePass=new aB({fragment:LN.source("ecgl.vfParticle.particle.fragment")}),this._particlePass.setUniform("velocityTexture",this.vectorFieldTexture),this._particlePass.setUniform("spawnTexture",this._spawnTexture),this._downsamplePass=new aB({fragment:LN.source("clay.compositor.downsample")});var e=new ek({renderOrder:10,material:new HO({shader:new LN(LN.source("ecgl.vfParticle.renderPoints.vertex"),LN.source("ecgl.vfParticle.renderPoints.fragment"))}),mode:ek.POINTS,geometry:new xk({dynamic:!0,mainAttribute:"texcoord0"})}),n=new ek({renderOrder:10,material:new HO({shader:new LN(LN.source("ecgl.vfParticle.renderLines.vertex"),LN.source("ecgl.vfParticle.renderLines.fragment"))}),geometry:new qZ,culling:!1}),i=new ek({material:new HO({shader:new LN(LN.source("ecgl.color.vertex"),LN.source("ecgl.color.fragment"))}),geometry:new Dz});i.material.enableTexture("diffuseMap"),this._particlePointsMesh=e,this._particleLinesMesh=n,this._lastFrameFullQuadMesh=i,this._camera=new nB,this._thisFrameTexture=new sk,this._lastFrameTexture=new sk},setParticleDensity:function(t,e){for(var n=new Float32Array(4*(t*e)),i=0,r=this.particleLife,o=0;o0?t[t.length-1]:this._lastFrameTexture},setRegion:function(t){this._particlePass.setUniform("region",t)},resize:function(t,e){this._lastFrameTexture.width=t*this._supersampling,this._lastFrameTexture.height=e*this._supersampling,this._thisFrameTexture.width=t*this._supersampling,this._thisFrameTexture.height=e*this._supersampling,this._width=t,this._height=e},setParticleSize:function(t){var e=this._getParticleMesh();if(t<=2)return e.material.disableTexture("spriteTexture"),void(e.material.transparent=!1);this._spriteTexture||(this._spriteTexture=new sk),this._spriteTexture.image&&this._spriteTexture.image.width===t||(this._spriteTexture.image=function(t){var e=document.createElement("canvas");e.width=e.height=t;var n=e.getContext("2d");return n.fillStyle="#fff",n.arc(t/2,t/2,t/2,0,2*Math.PI),n.fill(),e}(t),this._spriteTexture.dirty()),e.material.transparent=!0,e.material.enableTexture("spriteTexture"),e.material.set("spriteTexture",this._spriteTexture),this._particleSize=t},setGradientTexture:function(t){var e=this._getParticleMesh().material;e[t?"enableTexture":"disableTexture"]("gradientTexture"),e.setUniform("gradientTexture",t)},setColorTextureImage:function(t,e){this._getParticleMesh().material.setTextureImage("colorTexture",t,e,{flipY:!0})},setParticleType:function(t){this._particleType=t},clearFrame:function(t){var e=this._frameBuffer;e.attach(this._lastFrameTexture),e.bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),e.unbind(t)},setSupersampling:function(t){this._supersampling=t,this.resize(this._width,this._height)},_updateDownsampleTextures:function(t,e){for(var n=this._downsampleTextures,i=Math.max(Math.floor(Math.log(this._supersampling/e.getDevicePixelRatio())/Math.log(2)),0),r=2,o=this._width*this._supersampling,a=this._height*this._supersampling,s=0;s=359&&(r[0]>0&&(r[0]=0),o[0]1?(e.material.shader!==this._meshLinesShader&&e.material.attachShader(this._meshLinesShader),e.mode=_V.Mesh.TRIANGLES):(e.material.shader!==this._nativeLinesShader&&e.material.attachShader(this._nativeLinesShader),e.mode=_V.Mesh.LINES),n=n||0,i=i||r.count(),s.resetOffset();var h=0,c=0,d=[],f=[],p=[],g=[],m=[],v=.3,_=.7;function y(){f[0]=d[0]*_+g[0]*v-(d[1]-g[1])*o,f[1]=d[1]*_+g[1]*v-(g[0]-d[0])*o,p[0]=d[0]*v+g[0]*_-(d[1]-g[1])*o,p[1]=d[1]*v+g[1]*_-(g[0]-d[0])*o}if(a||0!==o)for(var x=n;x{let o="right";return r.viewSize[0]-t[0]"graph"===t.componentSubType?"edge"===t.dataType?e.utils.getLinkTooltipInfo(t.data):e.utils.getNodeTooltipInfo(t.data):"graphGL"===t.componentSubType?e.utils.getNodeTooltipInfo(t.data):"lines"===t.componentSubType?e.utils.getLinkTooltipInfo(t.data.link):e.utils.getNodeTooltipInfo(t.data.node)}},n.echartsOption);return i.setOption(e.utils.deepMergeObj(r,t)),i.on("click",(t=>{const i=n.onClickElement.bind(e);return e.utils.addActionToUrl(e,t),"graph"===t.componentSubType?i("edge"===t.dataType?"link":"node",t.data):"graphGL"===t.componentSubType?i("node",t.data):"lines"===t.componentSubType?i("link",t.data.link):!t.data.cluster&&i("node",t.data.node)}),{passive:!0}),i}generateGraphOption(t,e){const n=[],i=e.config,r=e.utils.parseUrlFragments(),o=t.nodes.map((t=>{const n=JSON.parse(JSON.stringify(t)),{nodeStyleConfig:o,nodeSizeConfig:a,nodeEmphasisConfig:s}=e.utils.getNodeStyle(t,i,"graph");n.itemStyle=o,n.symbolSize=a,n.emphasis={itemStyle:s.nodeStyle,symbolSize:s.nodeSize};let l="";return"string"==typeof t.label?l=t.label:"string"==typeof t.name?l=t.name:void 0!==t.id&&null!==t.id&&(l=String(t.id)),n.name=l,n._source=JSON.parse(JSON.stringify(t)),e.utils.setIndexedNodeFromUrlFragments(e,r,t),n})),a=t.links.map((t=>{const n=JSON.parse(JSON.stringify(t)),{linkStyleConfig:r,linkEmphasisConfig:o}=e.utils.getLinkStyle(t,i,"graph");return n.lineStyle=r,n.emphasis={lineStyle:o.linkStyle},n})),s={...i.graphConfig.series},l={...s.label||{}};if("number"==typeof e.config.showGraphLabelsAtZoom&&e.config.showGraphLabelsAtZoom>0){const t=e.config.showGraphLabelsAtZoom;l.formatter=n=>(()=>{try{const t=e.echarts.getOption(),n=(Array.isArray(t.series)?t.series:[]).find((t=>t&&"network-graph"===t.id));return n&&"number"==typeof n.zoom?n.zoom:1}catch(t){return 1}})()>=t&&n&&n.data&&n.data.name||""}s.label=l;const u=[{...s,id:"network-graph",type:"graphGL"===i.graphConfig.series.type?"graphGL":"graph",layout:"graphGL"===i.graphConfig.series.type?"forceAtlas2":i.graphConfig.series.layout,nodes:o,links:a}];return{legend:n.length?{data:n}:void 0,series:u,...i.graphConfig.baseOptions}}generateMapOption(t,e,n=[]){const i=e.config,{nodes:r,links:o}=t,a=t.flatNodes||{},s=[];let l=[];const u=e.utils.parseUrlFragments();r.forEach((n=>{if(n.properties&&(t.flatNodes||(a[n.id]=JSON.parse(JSON.stringify(n)))),!n.properties||!n.properties._featureType||"Point"===n.properties._featureType){if(n.properties){const{location:t}=n.properties;if(t&&t.lng&&t.lat){const{nodeEmphasisConfig:r}=e.utils.getNodeStyle(n,i,"map");let o="";"string"==typeof n.label?o=n.label:"string"==typeof n.name?o=n.name:void 0!==n.id&&null!==n.id&&(o=String(n.id)),l.push({name:o,value:[t.lng,t.lat],emphasis:{itemStyle:r.nodeStyle,symbolSize:r.nodeSize},node:n,_source:JSON.parse(JSON.stringify(n))})}else console.error(`Node ${n.id} position is undefined!`)}else console.error(`Node ${n.id} position is undefined!`);e.utils.setIndexedNodeFromUrlFragments(e,u,n)}})),o.forEach((t=>{if(a[t.source])if(a[t.target]){const{linkStyleConfig:n,linkEmphasisConfig:r}=e.utils.getLinkStyle(t,i,"map");s.push({coords:[[a[t.source].properties.location.lng,a[t.source].properties.location.lat],[a[t.target].properties.location.lng,a[t.target].properties.location.lat]],lineStyle:n,emphasis:{lineStyle:r.linkStyle},link:t})}else console.warn(`Node ${t.target} does not exist!`);else console.warn(`Node ${t.source} does not exist!`)})),l=l.concat(n);const h=[{id:"geo-map",type:"effectScatter"===i.mapOptions.nodeConfig.type?"effectScatter":"scatter",name:"nodes",coordinateSystem:"leaflet",data:l,animationDuration:1e3,label:i.mapOptions.nodeConfig.label,itemStyle:{color:t=>{if(t.data&&t.data.cluster&&t.data.itemStyle&&t.data.itemStyle.color)return t.data.itemStyle.color;if(t.data&&t.data.node&&t.data.node.category){const e=i.nodeCategories.find((e=>e.name===t.data.node.category));return e&&e.nodeStyle&&e.nodeStyle.color||i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeStyle&&i.mapOptions.nodeConfig.nodeStyle.color||"#6c757d"}return i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeStyle&&i.mapOptions.nodeConfig.nodeStyle.color||"#6c757d"}},symbolSize:(t,n)=>{if(n.data&&n.data.cluster)return i.mapOptions.clusterConfig&&i.mapOptions.clusterConfig.symbolSize||30;if(n.data&&n.data.node){const{nodeSizeConfig:t}=e.utils.getNodeStyle(n.data.node,i,"map");return"object"==typeof t?i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeSize||17:t}return i.mapOptions.nodeConfig&&i.mapOptions.nodeConfig.nodeSize||17},emphasis:i.mapOptions.nodeConfig.emphasis},Object.assign(i.mapOptions.linkConfig,{id:"map-links",type:"lines",coordinateSystem:"leaflet",data:s})];return{leaflet:{tiles:i.mapTileConfig,mapOptions:i.mapOptions},series:h,...i.mapOptions.baseOptions}}graphRender(t,e){e.utils.echartsSetOption(e.utils.generateGraphOption(t,e),e),window.onresize=()=>{e.echarts.resize()},e.config.showGraphLabelsAtZoom>0&&e.echarts.on("graphRoam",(t=>{if(!t||!t.zoom)return;const n=e.echarts.getOption(),i=n&&n.series&&n.series[0]&&n.series[0].zoom>=e.config.showGraphLabelsAtZoom;i!==e._labelsVisible&&(e.echarts.resize({animation:!1,silent:!0}),e._labelsVisible=i)})),e.utils.setupHashChangeHandler(e),e.event.emit("onLoad"),e.event.emit("onReady"),e.event.emit("renderArray"),e.event.emit("applyUrlFragmentState")}mapRender(t,e){if(!e.config.mapTileConfig[0])throw new Error('You must add the tiles via the "mapTileConfig" param!');e.utils.isGeoJSON(t)&&(e.originalGeoJSON=JSON.parse(JSON.stringify(t)),t=e.utils.geojsonToNetjson(t));const n=e.utils.generateMapOption(t,e);if(e.utils.echartsSetOption(n,e),e.bboxData={nodes:[],links:[]},e.leaflet=e.echarts._api.getCoordinateSystems()[0].getLeaflet(),e.leaflet._zoomAnimated=!1,e.config.geoOptions=e.utils.deepMergeObj({pointToLayer:(t,n)=>g().circleMarker(n,e.config.geoOptions.style),onEachFeature:(t,n)=>{n.on("click",(()=>{const n={...t.properties};e.config.onClickElement.call(e,"Feature",n)}))}},e.config.geoOptions),e.originalGeoJSON){!function(t){if(!t.originalGeoJSON||!Array.isArray(t.originalGeoJSON.features))return;const e=t.leaflet,n=t.originalGeoJSON.features.filter((t=>t&&t.geometry&&("Polygon"===t.geometry.type||"MultiPolygon"===t.geometry.type)));if(!n.length)return;let i=e.getPane("njg-polygons");i||(i=e.createPane("njg-polygons"),i.style.zIndex=410);const r={fillColor:"#1566a9",color:"#1566a9",weight:0,fillOpacity:.6},o=g().geoJSON({type:"FeatureCollection",features:n},{pane:"njg-polygons",style:e=>{const n=e.properties&&e.properties.echartsStyle||{},i={...r,...t.config.geoOptions&&t.config.geoOptions.style};return n.areaColor&&(i.fillColor=n.areaColor),n.color&&(i.color=n.color),void 0!==n.opacity&&(i.fillOpacity=n.opacity),void 0!==n.borderWidth&&(i.weight=n.borderWidth),i},onEachFeature:(e,n)=>{n.on("click",(()=>{const n=e.properties||{};t.config.onClickElement.call(t,"Feature",n)}))},...t.config.geoOptions}).addTo(e);t.leaflet.polygonGeoJSON=o}(e);let n=null;if(e.leaflet.polygonGeoJSON&&"function"==typeof e.leaflet.polygonGeoJSON.getBounds&&(n=e.leaflet.polygonGeoJSON.getBounds()),t.nodes&&t.nodes.length){const e=t.nodes.map((t=>t.properties.location)).map((t=>[t.lat,t.lng]));n?e.forEach((t=>n.extend(t))):n=g().latLngBounds(e)}n&&n.isValid()&&e.leaflet.fitBounds(n,{padding:[20,20]})}if(e.leaflet.getZoom(){const t=e.leaflet.getZoom(),n=t>=e.config.showLabelsAtZoomLevel;e.echarts.setOption({series:[{id:"geo-map",label:{show:n},emphasis:{label:{show:n}}}]});const i=e.leaflet.getMinZoom(),r=e.leaflet.getMaxZoom(),o=document.querySelector(".leaflet-control-zoom-in"),a=document.querySelector(".leaflet-control-zoom-out");o&&a&&(Math.round(t)>=r?o.classList.add("leaflet-disabled"):o.classList.remove("leaflet-disabled"),Math.round(t)<=i?a.classList.add("leaflet-disabled"):a.classList.remove("leaflet-disabled"))})),e.leaflet.on("moveend",(async()=>{const n=e.leaflet.getBounds();if(e.leaflet.getZoom()>=e.config.loadMoreAtZoomLevel&&e.hasMoreData){const i=await e.utils.getBBoxData.call(e,e.JSONParam,n);e.config.prepareData.call(e,i);const r=new Set(e.data.nodes.map((t=>t.id))),o=new Set(e.data.links.map((t=>t.source))),a=new Set(e.data.links.map((t=>t.target))),s=i.nodes.filter((t=>!r.has(t.id))),l=i.links.filter((t=>!o.has(t.source)&&!a.has(t.target))),u=new Set(i.nodes.map((t=>t.id))),h=e.bboxData.nodes.filter((t=>!u.has(t.id))),c=new Set(h.map((t=>t.id)));t.nodes=t.nodes.filter((t=>!c.has(t.id))),e.bboxData.nodes=e.bboxData.nodes.concat(s),e.bboxData.links=e.bboxData.links.concat(l),t={...t,nodes:t.nodes.concat(s),links:t.links.concat(l)},e.echarts.setOption(e.utils.generateMapOption(t,e)),e.data=t}else e.hasMoreData&&e.bboxData.nodes.length>0&&(()=>{const n=new Set(e.bboxData.nodes),i=new Set(e.bboxData.links);t={...t,nodes:t.nodes.filter((t=>!n.has(t))),links:t.links.filter((t=>!i.has(t)))},e.data=t,e.echarts.setOption(e.utils.generateMapOption(t,e)),e.bboxData.nodes=[],e.bboxData.links=[]})()})),e.config.clustering&&e.config.clusteringThresholde.config.disableClusteringAtLevel&&(n=[],i=t.nodes,r=t.links),e.echarts.setOption(e.utils.generateMapOption({...t,nodes:i,links:r},e,n)),e.echarts.on("click",(t=>{if(("scatter"===t.componentSubType||"effectScatter"===t.componentSubType)&&t.data.cluster){const n=e.leaflet.getZoom(),i=Math.min(n+2,e.leaflet.getMaxZoom());e.leaflet.setView([t.data.value[1],t.data.value[0]],i)}})),e.leaflet.on("zoomend",(()=>{if(e.leaflet.getZoom(){e.echarts.appendData({seriesIndex:n,data:t.data})})),e.utils.mergeData(t,e)}e.config.afterUpdate.call(e)}addData(t,e){e.utils.mergeData(t,e),e.data.nodes&&e.data.nodes.length>0&&(e.data.nodes=e.utils.deduplicateNodesById(e.data.nodes)),e.utils.render(),e.config.afterUpdate.call(e)}mergeData(t,e){t.nodes||(t.nodes=[]);const n=new Set;e.data.nodes.forEach((t=>{t.id&&n.add(t.id)}));const i=t.nodes.filter((t=>!t.id||(!n.has(t.id)||(console.warn(`Duplicate node ID ${t.id} detected during merge and skipped.`),!1)))),r=e.data.nodes.concat(i),o=t.links||[],a=e.data.links.concat(o);Object.assign(e.data,t,{nodes:r,links:a})}}const nX=function(t,e){const{util:n,graphic:i,matrix:r}=t,o=e.Layer.extend({initialize(t){this._container=t},onAdd(t){t.getPane(this.options.pane).appendChild(this._container),t.zoomControl.setPosition("topright")},onRemove(){e.DomUtil.remove(this._container)},_update(){}});function a(t,n){this._map=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=n,this._projection=e.Projection.Mercator}function s(t,e,n,i){const{leafletModel:r,seriesModel:o}=n,a=r?r.coordinateSystem:o?o.coordinateSystem||(o.getReferringComponents("leaflet")[0]||{}).coordinateSystem:null;return a===this?a[t](i):null}return a.dimensions=["lng","lat"],a.prototype.dimensions=["lng","lat"],a.prototype.setZoom=function(t){this._zoom=t},a.prototype.setCenter=function(t){this._center=this._projection.project(new e.LatLng(t[1],t[0]))},a.prototype.setMapOffset=function(t){this._mapOffset=t},a.prototype.getLeaflet=function(){return this._map},a.prototype.getViewRect=function(){const t=this._api;return new i.BoundingRect(0,0,t.getWidth(),t.getHeight())},a.prototype.getRoamTransform=function(){return r.create()},a.prototype.dataToPoint=function(t){const n=new e.LatLng(t[1],t[0]),i=this._map.latLngToLayerPoint(n),r=this._mapOffset;return[i.x-r[0],i.y-r[1]]},a.prototype.pointToData=function(t){const e=this._mapOffset,n=this._map.layerPointToLatLng({x:t[0]+e[0],y:t[1]+e[1]});return[n.lng,n.lat]},a.prototype.convertToPixel=n.curry(s,"dataToPoint"),a.prototype.convertFromPixel=n.curry(s,"pointToData"),a.create=function(t,n){let i;const r=[],s=n.getDom();return t.eachComponent("leaflet",(t=>{const l=n.getZr().painter.getViewportRoot();if(void 0===e)throw new Error("Leaflet api is not loaded");if(i)throw new Error("Only one leaflet component can exist");if(!t.__map){let n=s.querySelector(".ec-extension-leaflet");n&&(l.style.left="0px",l.style.top="0px",s.removeChild(n)),n=document.createElement("div"),n.style.cssText="width:100%;height:100%",n.classList.add("ec-extension-leaflet"),s.appendChild(n),t.__map=e.map(n,t.get("mapOptions"));const i=t.__map,r=t.get("tiles"),a={};let u=!1;if(r.forEach((t=>{const n=e.tileLayer(t.urlTemplate,t.options);t.label?(u||(n.addTo(i),u=!0),a[t.label]=n):n.addTo(i)})),r.length>1){const n=t.get("layerControl");e.control.layers(a,{},n).addTo(i)}const h=document.createElement("div");h.style="position: absolute;left: 0;top: 0;z-index: 100",h.appendChild(l),new o(h).addTo(i)}const u=t.__map;i=new a(u,n),r.push(i),i.setMapOffset(t.__mapOffset||[0,0]);const{center:h,zoom:c}=t.get("mapOptions");h&&c&&(i.setZoom(c),i.setCenter(h)),t.coordinateSystem=i})),t.eachSeries((t=>{"leaflet"===t.get("coordinateSystem")&&(t.coordinateSystem=i)})),r},a};function iX(t,e,n){!function(t){t.extendComponentModel({type:"leaflet",getLeaflet(){return this.__map},setCenterAndZoom(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged(t,e){const{option:n}=this;return i=t,r=n.center,!(i&&r&&i[0]===r[0]&&i[1]===r[1]&&e===n.zoom);var i,r},defaultOption:{mapOptions:{},tiles:[{urlTemplate:"http://{s}.tile.osm.org/{z}/{x}/{y}.png",options:{attribution:'© OpenStreetMap contributors'}}],layerControl:{}}})}(t),function(t){t.extendComponentView({type:"leaflet",render(e,n,i){let r=!0;const o=e.getLeaflet(),a=i.getZr().painter.getViewportRoot().parentNode,s=e.coordinateSystem,{roam:l}=e.get("mapOptions");function u(t){if(r)return;const n=o._mapPane;let l=n.style.transform,u=0,h=0;if(l){l=l.replace("translate3d(","");let t=l.split(",");u=-parseInt(t[0],10),h=-parseInt(t[1],10)}else u=-parseInt(n.style.left,10),h=-parseInt(n.style.top,10);let c=[u,h];a.style.left=`${c[0]}px`,a.style.top=`${c[1]}px`,s.setMapOffset(c),e.__mapOffset=c,i.dispatchAction({type:"leafletRoam",animation:{duration:0}})}function h(){r||i.dispatchAction({type:"leafletRoam"})}function c(){u()}function d(){t.getInstanceByDom(i.getDom()).resize()}l&&"scale"!==l?o.dragging.enable():o.dragging.disable(),l&&"move"!==l?(o.scrollWheelZoom.enable(),o.doubleClickZoom.enable(),o.touchZoom.enable()):(o.scrollWheelZoom.disable(),o.doubleClickZoom.disable(),o.touchZoom.disable()),this._oldMoveHandler&&o.off("move",this._oldMoveHandler),this._oldZoomHandler&&o.off("zoom",this._oldZoomHandler),this._oldZoomEndHandler&&o.off("zoomend",this._oldZoomEndHandler),this._oldResizeHandler&&o.off("resize",this._oldResizeHandler),o.on("move",u),o.on("zoom",c),o.on("zoomend",h),o.on("resize",d),this._oldMoveHandler=u,this._oldZoomHandler=c,this._oldZoomEndHandler=h,this._oldResizeHandler=d,r=!1}})}(t),t.registerCoordinateSystem("leaflet",nX(t,e)),t.registerAction({type:"leafletRoam",event:"leafletRoam",update:"updateLayout"},((t,e)=>{e.eachComponent("leaflet",(t=>{const e=t.getLeaflet(),n=e.getCenter();t.setCenterAndZoom([n.lng,n.lat],e.getZoom())}))}))}iX.version="1.0.0";const rX=iX;const oX=class{constructor(t){this.self=t,this.renderModeSelector=null,this.controls=null,this.sideBar=null,this.metaInfoContainer=null,this.nodeLinkInfoContainer=null}createControls(){const t=document.createElement("div");return t.setAttribute("class","njg-controls"),this.self.el.appendChild(t),t}createRenderModeSelector(){const t=document.createElement("div"),e=document.createElement("span");return e.setAttribute("class","iconfont icon-eye"),t.setAttribute("class","njg-selectIcon"),t.appendChild(e),this.controls.appendChild(t),t}createSideBar(){const t=document.createElement("div");t.setAttribute("class","njg-sideBar"),t.classList.add("hidden");const e=document.createElement("button");return t.appendChild(e),e.classList.add("sideBarHandle"),e.onclick=()=>{t.classList.toggle("hidden");const e=document.querySelector(".njg-metaInfoContainer");(this.self.config.showMetaOnNarrowScreens||this.self.el.clientWidth>850)&&e&&(e.style.display="flex")},this.self.el.appendChild(t),t}hideInfoOnNarrowScreen(){!this.self.config.showMetaOnNarrowScreens&&this.self.el.clientWidth<850&&(this.metaInfoContainer.style.display="none"),"none"===this.metaInfoContainer.style.display&&"none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")}createMetaInfoContainer(){const t=document.createElement("div"),e=document.createElement("h2"),n=document.createElement("div");n.classList.add("njg-metaData"),t.classList.add("njg-metaInfoContainer");const i=document.createElement("span");return i.classList.add("njg-closeButton"),e.innerHTML="Info",i.innerHTML=" ✕",e.appendChild(i),t.appendChild(e),t.appendChild(n),this.metaInfoContainer=t,this.sideBar.appendChild(t),this.nodeLinkInfoContainer=this.createNodeLinkInfoContainer(),this.hideInfoOnNarrowScreen(),window.addEventListener("resize",this.hideInfoOnNarrowScreen.bind(this)),i.onclick=()=>{this.metaInfoContainer.style.display="none","none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")},t}createNodeLinkInfoContainer(){const t=document.createElement("div");return t.classList.add("njg-nodeLinkInfoContainer"),t.style.display="none",this.sideBar.appendChild(t),t}getNodeLinkInfo(t,e){const n=document.querySelectorAll(".njg-infoContainer"),i=document.querySelectorAll(".njg-headerContainer");for(let t=0;t"clients"===t?"Clients":/^clients\s*\[\d+\]$/i.test(t)?t.replace(/^clients/i,"Client"):"localAddresses"===t?"Local Addresses":t.replace(/_/g," "),u=(t,e,n,i=0)=>{if(null==n||"string"==typeof n&&(""===n.trim()||/^(undefined|null)$/i.test(n.trim()))&&"0"!==n)return;if(Array.isArray(n)){if(0===n.length){const n=document.createElement("div");n.classList.add("njg-infoItems"),n.style.paddingLeft=12*i+"px";const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");return o.setAttribute("class","njg-valueLabel"),r.innerHTML=l(e),o.innerHTML="[]",n.appendChild(r),n.appendChild(o),void t.appendChild(n)}if(n.every((t=>"object"!=typeof t||null===t))){const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");return a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e),a.innerHTML=n.map((t=>"string"==typeof t?t.replace(/\n/g,"
"):String(t))).join("
"),r.appendChild(o),r.appendChild(a),void t.appendChild(r)}return void n.forEach(((n,r)=>{u(t,`${e} [${r+1}]`,n,i)}))}if("object"==typeof n){if("location"===e&&"number"==typeof n.lat&&"number"==typeof n.lng){const e=document.createElement("div");e.classList.add("njg-infoItems"),e.style.paddingLeft=12*i+"px";const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");return o.setAttribute("class","njg-valueLabel"),r.innerHTML="Location",o.innerHTML=`${Math.round(1e3*n.lat)/1e3}, ${Math.round(1e3*n.lng)/1e3}`,e.appendChild(r),e.appendChild(o),void t.appendChild(e)}const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");return a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e),a.innerHTML="",r.appendChild(o),r.appendChild(a),t.appendChild(r),void Object.keys(n).forEach((e=>{u(t,e,n[e],i+1)}))}const r=document.createElement("div");r.classList.add("njg-infoItems"),r.style.paddingLeft=12*i+"px";const o=document.createElement("span");o.setAttribute("class","njg-keyLabel");const a=document.createElement("span");a.setAttribute("class","njg-valueLabel"),o.innerHTML=l(e);const s="string"==typeof n?n.replace(/\n/g,"
"):String(n);a.innerHTML=s,r.appendChild(o),r.appendChild(a),t.appendChild(r)};Object.keys(e).forEach((t=>u(o,t,e[t],0))),r.appendChild(a),r.appendChild(s),this.nodeLinkInfoContainer.appendChild(r),this.nodeLinkInfoContainer.appendChild(o),s.onclick=()=>{this.nodeLinkInfoContainer.style.display="none",null!==this.metaInfoContainer&&"none"!==this.metaInfoContainer.style.display||this.sideBar.classList.add("hidden")}}init(){this.sideBar=this.createSideBar(),this.self.config.switchMode&&(this.controls=this.createControls(),this.renderModeSelector=this.createRenderModeSelector())}};const aX=function(t,e={}){const n=t.echarts,i=echarts.graphic,r={wifi:e.colors&&e.colors.wifi||"#d35454"},o=e.radius||3,a=e.gap||8;let s=e.minZoomLevel||1.5,l=1;const u=t=>t?"number"==typeof t.clients?t.clients:Array.isArray(t.clients)?t.clients.length:0:0,h=function(){const t=n.getModel().getSeriesByIndex(0);if(!t)return null;const e=(n._chartsViews||[]).find((e=>e&&e.__model&&e.__model.uid===t.uid));return e?e.group:null}();if(!h)return{destroy(){}};const c=new i.Group({silent:!0,z:100,zlevel:1});h.add(c);const d=t&&t.config&&t.config.graphConfig&&t.config.graphConfig.series||{},f=("number"==typeof d.nodeSize?d.nodeSize:18)/2;function p(){l=function(){const t=n.getOption();return t&&t.series&&t.series[0]&&t.series[0].zoom?t.series[0].zoom:1}();const t=l>=s;c.attr("invisible",!t)}function g(){const t=n.getModel().getSeriesByIndex(0);if(!t)return;const e=t.getData();if(!e)return;if(p(),c.removeAll(),l{let s=0;if(0!==n)for(let l=0;s{p(),g()}]];return m.forEach((([t,e])=>n.on(t,e))),g(),{destroy(){m.forEach((([t,e])=>{n&&n.off&&n.off(t,e)})),c&&c.parent&&c.parent.remove(c)},setMinZoomLevel(t){s=t,g()},getMinZoomLevel:()=>s}},sX=n(936),{each:lX}=n(627),uX=n(123);rX(f,g(),{colorTool:sX,each:lX,env:uX}),window.NetJSONGraph=class{constructor(t,e={}){return this.graph=new A(t),this.config=this.initializeConfig(e),this.graph.setConfig(this.config),this.setupGraph(),this.config.onInit.call(this.graph),this.initializeECharts(),this.graph}initializeConfig(t={}){return{...t,render:"map"===t.render?eX.prototype.mapRender:eX.prototype.graphRender,onInit:this.onInit,onRender:this.onRender,onUpdate:this.onUpdate,afterUpdate:this.afterUpdate,onLoad:this.onLoad}}setupGraph(){Object.setPrototypeOf(eX.prototype,this.graph.utils),this.graph.gui=new oX(this.graph),this.graph.utils=new eX,this.graph.setUtils(),this.graph.event=this.graph.utils.createEvent()}initializeECharts(){this.graph.echarts=Ly(this.graph.el,null,{renderer:this.graph.config.svgRender?"svg":"canvas"})}onInit(){return this.config}onRender(){return this.utils.showLoading.call(this),this.gui.init(),this.config}onUpdate(){return this.config}afterUpdate(){return this.config}onLoad(){return this.config.metadata&&this.utils.isNetJSON(this.data)?(this.gui.createMetaInfoContainer(this.graph),this.utils.updateMetadata.call(this)):this.gui.nodeLinkInfoContainer=this.gui.createNodeLinkInfoContainer(),this.config.switchMode&&this.utils.isNetJSON(this.data)&&(this.gui.renderModeSelector.onclick=()=>{if(this.config.render===this.utils.mapRender){this.config.render=this.utils.graphRender;const t=this.echarts.getZr().painter.getViewportRoot().parentNode;this.echarts.clear(),this.utils.graphRender(this.data,this),t.style.background=this.echarts.getZr()._backgroundColor,document.querySelector(".leaflet-control-attribution").style.display="none",document.querySelector(".leaflet-control-zoom").style.display="none"}else this.echarts.clear(),this.config.render=this.utils.mapRender,this.utils.mapRender(this.data,this),document.querySelector(".leaflet-control-attribution").style.display="block",document.querySelector(".leaflet-control-zoom").style.display="block"}),this.utils.hideLoading.call(this),this.attachClientsOverlay=t=>aX(this,t),this.config}},window.echarts=f,window.L=g()})()})(); //# sourceMappingURL=netjsongraph.min.js.map \ No newline at end of file diff --git a/openwisp_monitoring/device/static/monitoring/js/location-inline.js b/openwisp_monitoring/device/static/monitoring/js/location-inline.js new file mode 100644 index 000000000..1f3f212f7 --- /dev/null +++ b/openwisp_monitoring/device/static/monitoring/js/location-inline.js @@ -0,0 +1,53 @@ +"use strict"; + +(function ($) { + $(document).ready(function () { + const location_parent = $("fieldset.module.aligned.loci.coords"); + const floorplan_parent = $("fieldset.module.aligned.indoor.coords"); + const deviceLocationId = $("#id_devicelocation-0-id").val(); + const locationId = $("#id_devicelocation-0-location").val(); + const floor = $("#id_devicelocation-0-floor").val(); + const geoMapId = "dashboard-geo-map"; + const indoorMapId = `${locationId}:${floor}`; + + const open_location_btn = ` +
+
+
+ + + Open Location + +
+
+
+ `; + + const open_indoor_device_btn = ` +
+
+
+ + + Open Device + +
+
+
+ `; + + if (locationId) { + location_parent.append(open_location_btn); + } + + if (floor && locationId) { + floorplan_parent.append(open_indoor_device_btn); + } + }); +})(django.jQuery); diff --git a/openwisp_monitoring/device/templates/admin/dashboard/device_map.html b/openwisp_monitoring/device/templates/admin/dashboard/device_map.html index 428e52e17..6717010f3 100644 --- a/openwisp_monitoring/device/templates/admin/dashboard/device_map.html +++ b/openwisp_monitoring/device/templates/admin/dashboard/device_map.html @@ -14,10 +14,12 @@
{% autoescape on %}{% leaflet_json_config %}{% endautoescape %}
-
-
-

{% trans 'No map data to show' %}.

-

Close

+
+
+
+

{% trans 'No map data to show' %}.

+

Close

+
+
-
diff --git a/openwisp_monitoring/tests/test_selenium.py b/openwisp_monitoring/tests/test_selenium.py index a8f377d86..11475c2ee 100644 --- a/openwisp_monitoring/tests/test_selenium.py +++ b/openwisp_monitoring/tests/test_selenium.py @@ -1,5 +1,6 @@ from time import sleep from unittest.mock import patch +from urllib.parse import quote_plus from django.contrib.auth.models import Permission from django.contrib.staticfiles.testing import StaticLiveServerTestCase @@ -312,6 +313,7 @@ class TestDashboardMap( location_model = Location floorplan_model = Floorplan object_location_model = DeviceLocation + config_app_label = "config" def open_popup(self, mapType, id): self.web_driver.execute_script( @@ -457,6 +459,50 @@ def test_infinite_scroll_on_popup(self): table_entries = self.find_elements(By.CSS_SELECTOR, ".map-detail tbody tr") self.assertEqual(len(table_entries), 20) + def test_url_fragment_actions_on_geo_map(self): + device_location = self._create_object_location() + device = device_location.device + location = device_location.location + self.login() + mapId = "dashboard-geo-map" + + with self.subTest("Test setting url fragments on click event of node"): + self.open_popup("_owGeoMap", location.id) + current_hash = self.web_driver.execute_script( + "return window.location.hash;" + ) + expected_hash = f"id={mapId}&nodeId={location.id}" + self.assertIn(expected_hash, current_hash) + + with self.subTest("Test applying url fragment state on map"): + current_url = self.web_driver.current_url + self.web_driver.switch_to.new_window("tab") + tabs = self.web_driver.window_handles + self.web_driver.switch_to.window(tabs[1]) + self.web_driver.get(current_url) + sleep(0.5) + popup = self.find_element(By.CSS_SELECTOR, ".map-detail") + device_link = self.find_element( + By.XPATH, f".//td[@class='col-name']/a[text()='{device.name}']" + ) + self.assertTrue(popup.is_displayed()) + self.assertTrue(device_link.is_displayed()) + self.web_driver.close() + self.web_driver.switch_to.window(tabs[0]) + + with self.subTest("Test with incorrect node Id"): + incorrect_url = ( + f"{self.live_server_url}/admin/#id={mapId}&nodeId=incorrectId" + ) + self.web_driver.switch_to.new_window("tab") + tabs = self.web_driver.window_handles + self.web_driver.switch_to.window(tabs[1]) + self.web_driver.get(incorrect_url) + sleep(0.5) + self.wait_for_invisibility(By.CSS_SELECTOR, ".map-detail") + self.web_driver.close() + self.web_driver.switch_to.window(tabs[0]) + def test_floorplan_overlay(self): org = self._get_org() location = self._create_location(type="indoor", organization=org) @@ -587,19 +633,21 @@ def test_switching_floorplan_in_fullscreen_mode(self): By.CSS_SELECTOR, "#floor-content-1 canvas", timeout=5 ) self.assertIsNotNone(canvases) - fullscreen_btn = self.find_element( - By.CSS_SELECTOR, "#floor-content-1 .leaflet-control-fullscreen-button" - ) - fullscreen_btn.click() + self.wait_for( + "element_to_be_clickable", + By.CSS_SELECTOR, + "#floor-content-1 .leaflet-control-fullscreen-button", + ).click() sleep(0.5) container = self.find_element( By.CSS_SELECTOR, "#floor-content-1 .leaflet-container" ) self.assertIn("leaflet-fullscreen-on", container.get_attribute("class")) - right_arrow = self.find_element( - By.CSS_SELECTOR, "#floorplan-navigation .right-arrow" - ) - right_arrow.click() + self.wait_for( + "element_to_be_clickable", + By.CSS_SELECTOR, + "#floorplan-navigation .right-arrow", + ).click() sleep(0.5) container = self.find_element( By.CSS_SELECTOR, "#floor-content-1 .leaflet-container", wait_for="presence" @@ -612,6 +660,156 @@ def test_switching_floorplan_in_fullscreen_mode(self): ) self.assertIsNotNone(canvases) + def test_url_fragment_actions_on_indoor_map(self): + org = self._get_org() + device = self._create_device(organization=org) + location = self._create_location(type="indoor", organization=org) + floorplan = self._create_floorplan(floor=1, location=location) + device_location = self._create_object_location( + content_object=device, + location=location, + floorplan=floorplan, + organization=org, + ) + self.login() + self.open_popup("_owGeoMap", location.id) + self.wait_for( + "element_to_be_clickable", + By.CSS_SELECTOR, + ".map-detail .floorplan-btn", + timeout=5, + ).click() + sleep(0.5) + mapId = "dashboard-geo-map" + indoorMapId = f"{location.id}:{floorplan.floor}" + + with self.subTest("Test setting url fragments on click event of node"): + self.open_popup("_owIndoorMap", device.id) + current_hash = self.web_driver.execute_script( + "return window.location.hash;" + ) + indoorMapId_encoded = quote_plus(indoorMapId) + expected_hash = ( + f"#id={mapId}&nodeId={location.id};" + f"id={indoorMapId_encoded}&nodeId={device_location.id}" + ) + self.assertIn(expected_hash, current_hash) + + with self.subTest("Test applying url fragment state on indoor map"): + current_url = self.web_driver.current_url + self.web_driver.switch_to.new_window("tab") + tabs = self.web_driver.window_handles + self.web_driver.switch_to.window(tabs[1]) + self.web_driver.get(current_url) + sleep(0.5) + popup = self.find_element(By.CSS_SELECTOR, ".njg-tooltip-inner") + logs = self.get_browser_logs() + self.assertEqual(len(logs), 0) + self.assertTrue(popup.is_displayed()) + self.assertIn(device.name, popup.get_attribute("innerHTML")) + self.web_driver.close() + self.web_driver.switch_to.window(tabs[0]) + + with self.subTest("Test with incorrect node Id"): + incorrect_url = ( + f"{self.live_server_url}/admin/#id={indoorMapId}&nodeId=incorrectId" + ) + self.web_driver.switch_to.new_window("tab") + tabs = self.web_driver.window_handles + self.web_driver.switch_to.window(tabs[1]) + self.web_driver.get(incorrect_url) + sleep(0.5) + self.wait_for_invisibility(By.CSS_SELECTOR, ".njg-tooltip-inner") + logs = self.get_browser_logs() + self.assertEqual(len(logs), 0) + self.web_driver.close() + self.web_driver.switch_to.window(tabs[0]) + + # Cleanup in case anything fails and don't end up with multiple tabs + tabs = self.web_driver.window_handles + while len(tabs) > 1: + self.web_driver.switch_to.window(tabs[-1]) + self.web_driver.close() + tabs = self.web_driver.window_handles + self.web_driver.switch_to.window(tabs[0]) + + def test_redirect_to_map_view_from_device_location_inline(self): + org = self._get_org() + device = self._create_device(organization=org) + location = self._create_location(type="indoor", organization=org) + floorplan = self._create_floorplan(floor=1, location=location) + device_location = self._create_object_location( + content_object=device, + location=location, + floorplan=floorplan, + organization=org, + ) + self.login() + + with self.subTest("Test redirecting to geo map with visible popup"): + self.open( + reverse( + f"admin:{self.config_app_label}_device_change", args=[device.id] + ) + ) + sleep(0.5) + self.wait_for( + "element_to_be_clickable", + By.CSS_SELECTOR, + 'li.map a[href="#devicelocation-group"]', + timeout=5, + ).click() + sleep(0.5) + mapId = "dashboard-geo-map" + self.wait_for( + "element_to_be_clickable", + By.CSS_SELECTOR, + "#open-location-btn", + timeout=5, + ).click() + current_hash = self.web_driver.execute_script( + "return window.location.hash;" + ) + expected_hash = f"#id={mapId}&nodeId={location.id}" + self.assertEqual(expected_hash, current_hash) + popup = self.find_element(By.CSS_SELECTOR, ".map-detail", timeout=5) + logs = self.get_browser_logs() + self.assertEqual(len(logs), 0) + self.assertTrue(popup.is_displayed()) + self.assertIn(device.name, popup.get_attribute("innerHTML")) + + with self.subTest("Test redirecting to indoor map with visible popup"): + self.open( + reverse( + f"admin:{self.config_app_label}_device_change", args=[device.id] + ) + ) + sleep(0.5) + self.wait_for( + "element_to_be_clickable", + By.CSS_SELECTOR, + 'li.map a[href="#devicelocation-group"]', + timeout=5, + ).click() + sleep(0.5) + indoorMapId = f"{location.id}:{floorplan.floor}" + self.wait_for( + "element_to_be_clickable", + By.CSS_SELECTOR, + "#open-indoor-device-btn", + timeout=5, + ).click() + current_hash = self.web_driver.execute_script( + "return window.location.hash;" + ) + expected_hash = f"#id={indoorMapId}&nodeId={device_location.id}" + self.assertEqual(expected_hash, current_hash) + popup = self.find_element(By.CSS_SELECTOR, ".njg-tooltip-inner", timeout=5) + logs = self.get_browser_logs() + self.assertEqual(len(logs), 0) + self.assertTrue(popup.is_displayed()) + self.assertIn(device.name, popup.get_attribute("innerHTML")) + def test_dashboard_map_without_permissions(self): user = self._create_user( username="testuser", password="password", is_staff=True, is_superuser=True