var kl=Object.defineProperty,Pl=Object.defineProperties;var Cl=Object.getOwnPropertyDescriptors;var yr=Object.getOwnPropertySymbols;var Fl=Object.prototype.hasOwnProperty,Nl=Object.prototype.propertyIsEnumerable;var va=Math.pow,br=(h,e,t)=>e in h?kl(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t,F=(h,e)=>{for(var t in e||(e={}))Fl.call(e,t)&&br(h,t,e[t]);if(yr)for(var t of yr(e))Nl.call(e,t)&&br(h,t,e[t]);return h},$=(h,e)=>Pl(h,Cl(e));var oe=(h,e,t)=>new Promise((a,n)=>{var r=c=>{try{u(t.next(c))}catch(p){n(p)}},o=c=>{try{u(t.throw(c))}catch(p){n(p)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(r,o);u((t=t.apply(h,e)).next())});import{k as ai,q as Qr,h as es,w as Zt,o as x,c as _,a as f,d as V,a2 as xl,A as Ut,a3 as Rl,g as S,a4 as Ve,s as Je,v as Il,C as Xa,u as W,j as Le,n as De,t as P,F as Q,y as de,b as Y,x as ne,K as Ft,B as jt,e as Ja,H as ta,f as Qa,a6 as wa}from"./index-1786725044461.js";import{H as Pe}from"./index.esm.min-90d27a39-1786725044461.js";import{_ as le}from"./index-262a2c3c-1786725044461.js";import{t as Jn,S as la,u as dn,v as Pa,w as _l,V as te,F as Gl,C as gt,G as Te,c as Al,d as Bl,f as El,g as Hn,L as aa,D as Re,a as ye,h as en,R as at,A as Ie,N as vr,b as je,P as $t,o as na,n as ia,x as $l,T as Vl,B as Dl,i as zl,j as Ol,k as Wl,l as Yl,m as jl,y as Hl,z as La,E as wr,H as Lr,I as ql,J as Tr,q as Sr,r as Ul,s as Mr,K as Ta,U as qn,W as kr,M as Kl}from"./screen2Standard-3427eaf8-1786725044461.js";import{g as Kt,M as Zl,h as Xl,L as Jl,B as Sa,a as ra,E as Pr,G as tn,D as Ql,b as eu,l as tu,P as Cr,c as Fr}from"./three.interactive-b0c27e96-1786725044461.js";import{g as sa}from"./index-db918426-1786725044461.js";import{h as au,a as ts,k as j,W as yt,S as nu,l as Un,m as iu,M as ru,n as su,o as ou}from"./index-151544a4-1786725044461.js";import{_ as lu}from"./TopicSwitcher-06eba150-1786725044461.js";import{_ as uu}from"./LayerPanel-48d446bf-1786725044461.js";import{A as cu}from"./assets-cf9c305b-1786725044461.js";import"./_plugin-vue_export-helper-c27b6911-1786725044461.js";const du=au.map(h=>F({},h)),Nr=ts.map(h=>F({},h)),hu=ts.map(h=>{var e,t;return{name:h.name,value:h.value,lng:(e=h.center)==null?void 0:e[0],lat:(t=h.center)==null?void 0:t[1]}}),pu=[{name:"邛溪镇",level:"县城驻地",value:895.94,lng:102.60242339873115,lat:32.83022561372293},{name:"瓦切镇",level:"北部牧区",value:991,lng:102.71535664604494,lat:33.12869670968013},{name:"刷经寺镇",level:"南部通道",value:986.44,lng:102.55651980382184,lat:32.204097908180216},{name:"色地镇",level:"东部片区",value:1199.06,lng:103.12540730227074,lat:33.010462261362875}],ca=256,Qn="/external/satellite/{z}/{x}/{y}.png",fu=900,mu=10,Xt=new Map,da={west:101.852492,south:31.851389,east:103.347518,north:33.319796};function Kn(h,e,t){const a=va(2,t),n=Math.sin(e*Math.PI/180);return{x:(h+180)/360*a,y:(.5-Math.log((1+n)/(1-n))/(4*Math.PI))*a}}function xr(h,e,t){const a=va(2,t),n=h/a*360-180,r=Math.PI-2*Math.PI*e/a,o=180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r)));return[n,o]}function an(h,e,t){return Math.max(e,Math.min(t,h))}function as(h,e,{centerLngLat:t,maxCols:a,maxRows:n}={}){const r=Kn(h.west,h.north,e),o=Kn(h.east,h.south,e),u=Math.floor(r.x),c=Math.floor(o.x),p=Math.floor(r.y),y=Math.floor(o.y);let g=u,L=c,T=p,C=y,N=Math.floor((u+c)/2),B=Math.floor((p+y)/2);if(t&&Number.isFinite(a)&&Number.isFinite(n)){const z=an(Number(t[0]),h.west,h.east),X=an(Number(t[1]),h.south,h.north),ae=Kn(z,X,e);N=Math.floor(ae.x),B=Math.floor(ae.y);const q=Math.max(1,Math.min(Math.floor(a),c-u+1)),I=Math.max(1,Math.min(Math.floor(n),y-p+1));g=an(N-Math.floor(q/2),u,c-q+1),T=an(B-Math.floor(I/2),p,y-I+1),L=g+q-1,C=T+I-1}return{zoom:e,minX:g,maxX:L,minY:T,maxY:C,centerX:N,centerY:B,cols:L-g+1,rows:C-T+1}}function gu({zoom:h=11,centerLngLat:e,maxCols:t,maxRows:a,bounds:n=da}={}){return as(n,h,{centerLngLat:e,maxCols:t,maxRows:a})}function yu(h,e){const[t,a]=xr(h.minX,h.minY,h.zoom),[n,r]=xr(h.maxX+1,h.maxY+1,h.zoom),[o]=e([t,da.south]),[u]=e([n,da.south]),[,c]=e([da.west,a]),[,p]=e([da.west,r]);return{left:o,right:u,bottom:-p,top:-c}}function bu(h,e){const{width:t,height:a}=e;h.save(),h.globalCompositeOperation="multiply",h.fillStyle="rgba(5, 24, 34, 0.22)",h.fillRect(0,0,t,a),h.globalCompositeOperation="screen";const n=h.createRadialGradient(t*.5,a*.48,t*.1,t*.5,a*.5,t*.72);n.addColorStop(0,"rgba(80, 230, 255, 0.16)"),n.addColorStop(1,"rgba(0, 18, 36, 0.03)"),h.fillStyle=n,h.fillRect(0,0,t,a),h.restore()}function vu(h,e){const t=h.createLinearGradient(0,0,e.width,e.height);t.addColorStop(0,"#061927"),t.addColorStop(.5,"#0b2c3c"),t.addColorStop(1,"#07131f"),h.fillStyle=t,h.fillRect(0,0,e.width,e.height)}function wu(h){const e=Xt.get(h);return e||new Promise(t=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>t(a),a.onerror=()=>{Xt.delete(h),t(null)},a.src=h})}function Lu(h){const e=Xt.get(h);if(e)return e;const t=wu(h);for(Xt.set(h,t);Xt.size>fu;){const a=Xt.keys().next().value;if(!a)break;Xt.delete(a)}return t}function Tu(h,e,t,a=Qn){return String(a||Qn).replace(/\{x\}/g,h).replace(/\{y\}/g,e).replace(/\{z\}/g,t)}function Su(u,c,p,y){return oe(this,arguments,function*(h,e,t,a,{tileUrlTemplate:n,onTileStatus:r,applyTone:o=!0}={}){const g=[],L=a.cols*a.rows;let T=0,C=0;r==null||r({type:"loading",text:`正在加载${a.zoom}级影像底图`,loaded:T,failed:C,total:L,zoom:a.zoom,tileRange:a,tileUrlTemplate:n}),h.save(),h.filter="brightness(0.92) contrast(1.22) saturate(1.06)";for(let q=a.minX;q<=a.maxX;q+=1)for(let I=a.minY;I<=a.maxY;I+=1)g.push({x:q,y:I});g.sort((q,I)=>Math.abs(q.x-a.centerX)+Math.abs(q.y-a.centerY)-(Math.abs(I.x-a.centerX)+Math.abs(I.y-a.centerY)));let N=0;function B(){return oe(this,null,function*(){for(;N0?T/L:0,X=T===0?"error":z>=.75?"success":"warning",ae=T===L?`${a.zoom}级影像底图已加载`:T>0?`${a.zoom}级影像底图已加载(${T}/${L}张有效瓦片)`:`${a.zoom}级影像底图加载失败`;r==null||r({type:X,text:ae,loaded:T,failed:C,total:L,zoom:a.zoom,tileRange:a,tileUrlTemplate:n})})}function Rr({geoProjectionCenter:h,geoProjectionScale:e,zoom:t=11,tileUrlTemplate:a=Qn,onTileStatus:n,centerLngLat:r,maxCols:o,maxRows:u,transparentBackground:c=!1,applyTone:p=!0}={}){const y=as(da,t,{centerLngLat:r,maxCols:o,maxRows:u}),g=document.createElement("canvas");g.width=y.cols*ca,g.height=y.rows*ca;const L=g.getContext("2d");c?L.clearRect(0,0,g.width,g.height):vu(L,g);const T=new Jn(g);T.colorSpace=la,T.wrapS=dn,T.wrapT=dn,T.minFilter=Pa,T.magFilter=Pa,T.needsUpdate=!0;const C=Kt().center(h).scale(e).translate([0,0]),N=yu(y,C);return Su(L,g,T,y,{tileUrlTemplate:a,onTileStatus:n,applyTone:p}).catch(B=>{console.warn("load satellite tiles failed:",B),n==null||n({type:"error",text:`${y.zoom}级影像底图加载失败`,loaded:0,failed:y.cols*y.rows,total:y.cols*y.rows,zoom:y.zoom,tileRange:y,tileUrlTemplate:a})}),{texture:T,uvBounds:N,tileRange:y}}function Ir(h,e){const t=e.right-e.left,a=e.top-e.bottom;h.mapGroup.traverse(n=>{var u,c;const r=(c=(u=n.geometry)==null?void 0:u.attributes)==null?void 0:c.position;if(!n.isMesh||!r)return;const o=new Float32Array(r.count*2);for(let p=0;p{n!=null&&n!==""&&t.append(a,n)}),`${h}${h.includes("?")?"&":"?"}${t.toString()}`}function Pu(h,e={}){const t=e.bounds||j,a=e.size||yt;return hn(e.url||ni,{service:"WMS",version:"1.1.1",request:"GetMap",layers:h.layerName,styles:h.styles||"",format:"image/png",transparent:!0,tiled:!0,srs:"EPSG:4326",bbox:[t.west,t.south,t.east,t.north].join(","),width:a.width,height:a.height,CQL_FILTER:e.cqlFilter||h.cqlFilter,SLD_BODY:e.sldBody||h.sldBody,_:Date.now()})}function Cu(h,e={}){var r,o,u,c,p;const t=h.tileMatrixSetID||h.tileMatrixSet||"EPSG:900913",a=Number((c=(u=(o=(r=e.z)!=null?r:e.zoom)!=null?o:h.wmtsZoom)!=null?u:h.homeWmtsZoom)!=null?c:0),n=e.tileMatrix||((p=h.tileMatrixLabels)==null?void 0:p[a])||`${t}:${a}`;return hn(e.url||h.url||ku,{service:"WMTS",version:"1.0.0",request:"GetTile",layer:h.layerName,style:h.style||h.styles||"",format:h.format||"image/png",tileMatrixSet:t,tileMatrix:n,tileRow:e.y,tileCol:e.x})}function Fu(h,e,t={}){var r,o;const a=t.bounds||j,n=t.size||yt;return hn(t.url||ni,{service:"WMS",version:"1.1.1",request:"GetFeatureInfo",layers:h.layerName,query_layers:h.layerName,styles:h.styles||"",info_format:"application/json",feature_count:5,srs:"EPSG:4326",bbox:[a.west,a.south,a.east,a.north].join(","),width:n.width,height:n.height,x:Math.round(e.x),y:Math.round(e.y),buffer:(o=(r=t.buffer)!=null?r:h.queryBuffer)!=null?o:8,CQL_FILTER:t.cqlFilter||h.cqlFilter,SLD_BODY:t.sldBody||h.sldBody})}function _r(a,n){return oe(this,arguments,function*(h,e,t={}){const r=Fu(h,e,t);return ai(r,{credentials:"include"})})}function Nu(h,e={}){return hn(e.url||Mu,{service:"WFS",version:e.version||"1.0.0",request:"GetFeature",typeName:h,outputFormat:"json",propertyName:Array.isArray(e.propertyName)?e.propertyName.join(","):e.propertyName,CQL_FILTER:e.cqlFilter,maxFeatures:e.maxFeatures||2e5})}function Gr(t){return oe(this,arguments,function*(h,e={}){const a=Nu(h,e);return ai(a,{credentials:"include",timeout:e.timeout||2e4})})}const xu=new te(-.17427287762525134,13.678992786206543,20.688611202093714),Ru=new te(0,0,0),Iu=new te(-13.767695123014105,12.990152163077308,39.28228164159694),nn=21,_u=9,Gu=260,Au=12,Bu=700,oa=new Map,Ar="#30DCFF",Eu="#F2FFFF",$u="#8BF7FF",Br=3202303,Vu=15925247,Er=9172991,$r={"family-pasture":"pasture","artificial-grassland":"grass","scale-breeding":"breeding","forage-storage":"storage","slaughter-processing":"processing","farm-equipment":"equipment","social-service":"service"};function Vr(h){return h.sort((e,t)=>t.value-e.value),h}function nt(h){return String(h||"").replace(/\s+/g,"").trim()}function ue(h,e=0){const t=Number(h);return Number.isFinite(t)?t:e}function Ht(h,e,t){const a=Number(h);return Number.isFinite(a)?Math.max(e,Math.min(t,a)):e}function Se(h){return String(h!=null?h:"").replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function Dr(h){return(h==null?void 0:h.scope)==="village"||(h==null?void 0:h.labelMode)==="village"}function zr(h){return(h==null?void 0:h.scope)==="trade-flow"||(h==null?void 0:h.labelMode)==="trade-flow"}function Du(h){return(h==null?void 0:h.showFlowLines)!==!1}function Or(h){return!!(h!=null&&h.hideTownNames||(h==null?void 0:h.showTownNames)===!1)}function Ma(h){return!!(h!=null&&h.hideMapLabels||(h==null?void 0:h.showMapLabels)===!1)}function zu(h){return(h==null?void 0:h.displayMode)==="callout"||(h==null?void 0:h.labelMode)==="callout"}function rn(h){return["wkt-api","geojson","wfs"].includes(String((h==null?void 0:h.sourceType)||"").toLowerCase())}function Ou(h){return(h==null?void 0:h.interactive)===!1||(h==null?void 0:h.key)==="yak-recognition-layer"}function Wr(h){return String((h==null?void 0:h.sourceType)||"").toLowerCase()==="wmts"}function Yr(h,e,t){const a=va(2,t),n=Math.sin(e*Math.PI/180);return{x:(h+180)/360*a,y:(.5-Math.log((1+n)/(1-n))/(4*Math.PI))*a}}function jr(h,e,t){const a=va(2,t),n=h/a*360-180,r=Math.PI-2*Math.PI*e/a,o=180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r)));return[n,o]}function Wu(h,e){const t=Yr(h.west,h.north,e),a=Yr(h.east,h.south,e);return{minX:Math.floor(t.x),maxX:Math.floor(a.x),minY:Math.floor(t.y),maxY:Math.floor(a.y)}}function Yu(h,e,t,a){const[n,r]=jr(h,e,t),[o,u]=jr(h+1,e+1,t),c=j.east-j.west,p=j.north-j.south;return{x:(n-j.west)/c*a.width,y:(j.north-r)/p*a.height,width:(o-n)/c*a.width,height:(r-u)/p*a.height}}function ju(h){const e=oa.get(h);if(e)return e;const t=new Promise(a=>{const n=new Image;n.crossOrigin="anonymous",n.onload=()=>a(n),n.onerror=()=>{oa.delete(h),a(null)},n.src=h});for(oa.set(h,t);oa.size>Bu;){const a=oa.keys().next().value;if(!a)break;oa.delete(a)}return t}function Hr(h){return h?/^https?:\/\//.test(h)||h.startsWith("/")?h:`./${h}`:""}function Hu(h){if(!h)return null;if(typeof h=="string")try{return JSON.parse(h)}catch(e){return console.warn("地图 GeoJSON 解析失败",e),null}return h}function ka(h){const e=Hu(h);return e!=null&&e.features&&e.features.forEach(t=>{var a;((a=t.geometry)==null?void 0:a.type)==="Polygon"&&(t.geometry.coordinates=[t.geometry.coordinates])}),e}function qr(h){var e,t,a;return h!=null&&h.coordinates?h.type==="Polygon"?Array.isArray((a=(t=(e=h.coordinates)==null?void 0:e[0])==null?void 0:t[0])==null?void 0:a[0])?h.coordinates:[h.coordinates]:h.type==="MultiPolygon"?h.coordinates:[]:[]}class qu extends Zl{constructor(e,t,a={}){var u,c,p,y;super(e),this.geoProjectionCenter=[102.6305459723107,32.72169252326339],this.geoProjectionScale=650,this.tradeGeoProjectionCenter=[104,36],this.tradeGeoProjectionScale=11.4,this.tradeNationalDepth=.24,this.depth=.5,this.clicked=!1,this.scene.fog=new Gl(466735,1,50),this.scene.background=new gt(466735),this.camera.instance.position.copy(Iu),this.camera.instance.near=1,this.camera.instance.far=1e4,this.camera.instance.updateProjectionMatrix(),this.defaultMapCameraPosition=xu.clone(),this.defaultMapTarget=Ru.clone(),this.camera.controls.target.copy(this.defaultMapTarget),this.camera.controls.update(),this.activeMapViewTweens=[],this.sceneTweens=[],this.sceneTimers=[],this.interactionManager=new Xl(this.renderer.instance,this.camera.instance,this.canvas),this.assets=t,this.callbacks=a,this.useSatelliteBase=a.useSatelliteBase!==!1,this.showNationalBackdrop=a.showNationalBackdrop===!0,this.topicLayerPresentation=a.topicLayerPresentation||"default",this.hideTownLabelStatsByDefault=a.hideTownLabelStats===!0,this.tileUrlTemplate=a.tileUrlTemplate||"",this.usesCustomSatelliteTiles=this.useSatelliteBase&&!!this.tileUrlTemplate;const n=Math.round(Number(a.satelliteTextureZoom));this.satelliteTextureZoom=Number.isFinite(n)&&n>0?Math.min(nn,n):nu;const r=Math.round(Number(a.satelliteMaxZoom)),o=Number.isFinite(r)&&r>0?Math.min(nn,Math.max(this.satelliteTextureZoom,r)):nn;this.adminBoundaryLineScale=this.normalizeAdminBoundaryLineScale(a.adminBoundaryLineScale),this.mapBoundaryEmphasisMaterial=null,this.dynamicSatelliteMaxZoom=o,this.dynamicSatelliteTileWindow=_u,this.dynamicSatelliteOverlay=null,this.dynamicSatelliteMaterial=null,this.dynamicSatelliteTexture=null,this.dynamicSatelliteCurrentKey="",this.dynamicSatelliteLoadingKey="",this.dynamicSatelliteRequestId=0,this.dynamicSatelliteLastCheck=0,this.topicLayerLoadId=0,this.visibleTopicLayers=[],this.mapAnimationComplete=!1,this.showTownRankingBars=!1,this.showTownRankingPointMarkers=!1,this.currentTownRanking=null,this.villageRankingGroup=null,this.villageRankingLabels=[],this.tradeFlowGroup=null,this.tradeFlowMeshGroup=null,this.tradeFlowLabelGroup=null,this.tradeFlowLabels=[],this.tradeFlowMaterials=[],this.tradeFlowPulseSprites=[],this.isTradeNationalMapActive=!1,this.selectedFeatureGroup=null,this.selectedVectorFeatures=[],this.analysisBoundaryFeature=null,this.analysisMatchedFeatures=[],this.boundaryDrawingEnabled=!1,this.boundaryDrawPoints=[],this.lastBoundaryDrawPoint=null,this.currentVectorFeatures=[],this.yakIndustryPointLabelGroup=null,this.yakIndustryPointLabels=[],this.yakIndustryPointMarkerGroup=null,this.yakIndustryPointMarkers=[],this.yakIndustryMarkerMaterialCache=new Map,this.hongyuanBoundaryPolygons=[],this.townMetaByName=new Map(Nr.map(g=>[nt(g.name),g])),this.staticMapData={china:ka(this.assets.instance.getResource("china")),mapJson:ka(this.assets.instance.getResource("mapJson")),mapStroke:ka(this.assets.instance.getResource("mapStroke"))},this.handleCanvasBoundaryPointerDown=this.handleCanvasBoundaryPointerDown.bind(this),this.handleCanvasBoundaryDoubleClick=this.handleCanvasBoundaryDoubleClick.bind(this),(c=(u=this.canvas)==null?void 0:u.addEventListener)==null||c.call(u,"pointerdown",this.handleCanvasBoundaryPointerDown,!0),(y=(p=this.canvas)==null?void 0:p.addEventListener)==null||y.call(p,"dblclick",this.handleCanvasBoundaryDoubleClick,!0),this.initEnvironment(),this.init()}init(){this.labelGroup=new Te,this.label3d=new Jl(this),this.labelGroup.rotation.x=-Math.PI/2,this.scene.add(this.labelGroup),this.flyLineFocusGroup=new Te,this.flyLineFocusGroup.visible=!1,this.flyLineFocusGroup.rotation.x=-Math.PI/2,this.scene.add(this.flyLineFocusGroup),this.eventElement=[],this.defaultMaterial=null,this.defaultLightMaterial=null,this.createBottomBg(),this.createChinaBlurLine(),this.createGrid(),this.createRotateBorder(),this.createLabel(),this.createMap(),this.createEvent(),this.createFlyLine(),this.createFocus(),this.createParticles(),this.createScatter(),this.createInfoPoint(),this.createStorke();let e=sa.timeline({onComplete:()=>{if(this.mapAnimationComplete=!0,this.applyLayerMapView(this.currentTopicLayer,{force:!0}),this.setTradeNationalMapVisible(!1),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),Ma(this.currentTownRanking)){this.hideAllMapStatisticLabels();return}this.updateVillageRankingLabels(this.currentTownRanking),this.updateTradeFlowLayer(this.currentTownRanking),this.updateInfoPointStats()}});e.pause(),this.animateTl=e,e.addLabel("focusMap",1.5),e.addLabel("focusMapOpacity",2),e.addLabel("bar",3),e.to(this.camera.instance.position,{duration:2,x:this.defaultMapCameraPosition.x,y:this.defaultMapCameraPosition.y,z:this.defaultMapCameraPosition.z,ease:"circ.out",onStart:()=>{this.flyLineFocusGroup.visible=!1}}),e.to(this.focusMapGroup.position,{duration:1,x:0,y:0,z:0},"focusMap"),e.to(this.focusMapGroup.scale,{duration:1,x:1,y:1,z:1,ease:"circ.out",onComplete:()=>{if(this.flyLineGroup.visible=!0,this.scatterGroup.visible=!0,this.InfoPointGroup.visible=!Ma(this.currentTownRanking)&&this.showTownRankingPointMarkers&&this.hasTownRankingRows(),this.setTradeNationalMapVisible(!1),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),Ma(this.currentTownRanking)){this.hideAllMapStatisticLabels();return}this.updateVillageRankingLabels(this.currentTownRanking),this.updateTradeFlowLayer(this.currentTownRanking),this.updateInfoPointStats()}},"focusMap"),e.to(this.focusMapTopMaterial,{duration:1,opacity:this.getFocusMapTopOpacity(),ease:"circ.out"},"focusMapOpacity"),e.to(this.focusMapSideMaterial,{duration:1,opacity:1,ease:"circ.out",onComplete:()=>{this.focusMapSideMaterial.transparent=!1}},"focusMapOpacity"),this.otherLabel.map((a,n)=>{let r=a.element.querySelector(".other-label");e.to(r,{duration:1,delay:.1*n,translateY:0,opacity:1,ease:"circ.out"},"focusMapOpacity")}),e.to(this.mapLineMaterial,{duration:.5,delay:.3,opacity:1},"focusMapOpacity"),this.mapBoundaryEmphasisMaterial&&e.to(this.mapBoundaryEmphasisMaterial,{duration:.5,delay:.3,opacity:this.getAdminBoundaryEmphasisOpacity()},"focusMapOpacity"),e.to(this.rotateBorder1.scale,{delay:.3,duration:1,x:1,y:1,z:1,ease:"circ.out"},"focusMapOpacity"),e.to(this.rotateBorder2.scale,{duration:1,delay:.5,x:1,y:1,z:1,ease:"circ.out",onComplete:()=>{var a,n;this.flyLineFocusGroup.visible=!0,(n=(a=this.callbacks).onPlayComplete)==null||n.call(a)}},"focusMapOpacity"),this.showTownRankingBars&&(this.allBar.map((a,n)=>{e.to(a.scale,{duration:1,delay:.1*n,x:1,y:1,z:1,ease:"circ.out"},"bar")}),this.allBarMaterial.map((a,n)=>{e.to(a,{duration:1,delay:.1*n,opacity:1,ease:"circ.out"},"bar")}));const t=this;this.allProvinceLabel.map((a,n)=>{let r=a.element.querySelector(".provinces-label-wrap"),o=a.element.querySelector(".number .value"),u={progress:0};e.to(r,{duration:1,delay:.2*n,translateY:0,opacity:1,ease:"circ.out"},"bar"),e.to(u,{duration:1,delay:.2*n,progress:1,onStart:()=>{u.progress=0},onUpdate:c},"bar");function c(){var y,g;const p=ue((g=(y=a.userData)==null?void 0:y.targetValue)!=null?g:o.dataset.targetValue);o.innerText=t.formatMapRankingValue(p*u.progress)}}),this.showTownRankingBars&&this.allGuangquan.map((a,n)=>{e.to(a.children[0].scale,{duration:1,delay:.1*n,x:1,y:1,z:1,ease:"circ.out"},"bar"),e.to(a.children[1].scale,{duration:1,delay:.1*n,x:1,y:1,z:1,ease:"circ.out"},"bar")})}initEnvironment(){let e=new Al(13171711,4.2);this.scene.add(e);let t=new Bl(14679295,5.8);t.position.set(-30,6,-8),t.castShadow=!0,t.shadow.radius=20,t.shadow.mapSize.width=1024,t.shadow.mapSize.height=1024,this.scene.add(t),this.createPointLight({color:"#1fd6df",intensity:680,distance:1e4,x:-9,y:3,z:-3}),this.createPointLight({color:"#2af0c6",intensity:260,distance:1e4,x:0,y:2,z:5})}createPointLight(e){const t=new El(1924702,e.intensity,e.distance);t.position.set(e.x,e.y,e.z),this.scene.add(t)}createMap(){let e=new Te,t=new Te;this.mapGroup=e,this.focusMapGroup=t;let{china:a,chinaTopLine:n}=this.createChina(),{map:r,mapTop:o,mapLine:u,mapBoundaryEmphasis:c}=this.createProvince();this.createNationalBackdrop(),a.setParent(e),n.setParent(e),this.createDiffuse(),r.setParent(t),o.setParent(t),u.setParent(t),c==null||c.setParent(t),t.position.set(0,0,-.01),t.scale.set(1,1,0),e.add(t),this.createTopicLayer(),e.rotation.x=-Math.PI/2,e.position.set(0,.2,0),this.scene.add(e),this.createBar()}createChina(){let e={chinaBgMaterialColor:"#0d3349",lineColor:"#39c7ef"},t=this.staticMapData.china,a=new Hn({color:new gt(e.chinaBgMaterialColor),transparent:!0,opacity:.72}),n=new Sa(this,{data:t,geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,merge:!0,material:a,renderOrder:2}),r=new aa({color:e.lineColor,transparent:!0,opacity:.58}),o=new ra(this,{data:t,geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,material:r,renderOrder:3});return o.lineGroup.position.z+=.01,{china:n,chinaTopLine:o}}createNationalBackdrop(){var p;if(!this.showNationalBackdrop||this.nationalBackdropGroup)return!1;let e=null;try{e=ka(this.assets.instance.getResource("chinaMap"))}catch(y){return console.warn("首页全国底图资源未加载",y),!1}if(!((p=e==null?void 0:e.features)!=null&&p.length))return!1;const t=this.geoProjectionCenter,a=120,n=new te(0,0,-.08),r=new Hn({color:new gt("#152c47"),transparent:!0,opacity:.72,depthWrite:!1,fog:!1,side:Re}),o=new Sa(this,{data:e,geoProjectionCenter:t,geoProjectionScale:a,merge:!0,position:n,material:r,renderOrder:0});o.mapGroup.name="home-national-backdrop-fill",o.setParent(this.mapGroup);const u=new aa({color:new gt("#3f82cd"),transparent:!0,opacity:.46,depthWrite:!1,fog:!1}),c=new ra(this,{data:e,geoProjectionCenter:t,geoProjectionScale:a,position:new te(n.x,n.y,n.z+.01),material:u,renderOrder:1});return c.lineGroup.name="home-national-backdrop-line",c.setParent(this.mapGroup),this.nationalBackdropGroup=o.mapGroup,this.nationalBackdropLineGroup=c.lineGroup,!0}createTradeNationalMap(){var g;if(this.tradeNationalMapGroup)return!0;let e=null;try{e=ka(this.assets.instance.getResource("chinaMap"))}catch(L){return console.warn("牦牛交易全国地图资源未加载",L),!1}const t=e;if(!e||!((g=t==null?void 0:t.features)!=null&&g.length))return!1;const a=new Te;a.name="trade-national-map",a.visible=!1,a.rotation.x=-Math.PI/2,a.position.set(0,.04,0);const n=new ye({color:403001,transparent:!0,opacity:.14,side:Re,depthWrite:!1,fog:!1});new Sa(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,position:new te(.05,-.05,-.03),material:n,renderOrder:17}).setParent(a);const{topMaterial:o,sideMaterial:u}=this.createTradeNationalMaterials(),c=new Pr(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,position:new te(0,0,0),depth:this.tradeNationalDepth,topFaceMaterial:o,sideMaterial:u,renderOrder:20,bevelThickness:.024,bevelSegments:1});c.mapGroup.traverse(L=>{L.isMesh&&(L.renderOrder=20)}),c.setParent(a);const p=new aa({color:4777983,transparent:!0,opacity:.52,fog:!1,depthTest:!1}),y=new ra(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,material:p,renderOrder:21});return y.lineGroup.position.z+=this.tradeNationalDepth+.055,y.setParent(a),this.scene.add(a),this.tradeNationalMapGroup=a,this.createTradeNationalLabels(t),!0}createTradeNationalMaterials(){const e=new en({color:16777215,transparent:!0,opacity:.54,roughness:.84,metalness:.08,side:Re,fog:!1});new tn(e,{uColor1:827317,uColor2:403515,size:6.8,dir:"x"});const t=this.assets.instance.getResource("side").clone();t.wrapS=at,t.wrapT=at,t.repeat.set(1,1.2),t.needsUpdate=!0;const a=new en({color:1485501,map:t,transparent:!0,opacity:.58,roughness:.78,metalness:.04,side:Re,fog:!1});return new tn(a,{uColor1:1354174,uColor2:134940,size:Math.max(this.tradeNationalDepth,.1),dir:"y"}),this.time.on("tick",()=>{t.offset.y+=.004}),{topMaterial:e,sideMaterial:a}}createTradeNationalLabels(e){this.tradeNationalLabelGroup=new Te,this.tradeNationalLabelGroup.name="trade-national-label",this.tradeNationalLabelGroup.rotation.x=-Math.PI/2,this.tradeNationalLabelGroup.visible=!1,this.scene.add(this.tradeNationalLabelGroup),this.tradeNationalLabels=[];const t=new Set(["四川","青海","甘肃","陕西","重庆","云南","西藏","新疆"]);(e.features||[]).forEach(a=>{var c;const n=((c=a.properties)==null?void 0:c.name)||"",r=this.normalizeTradeProvinceName(n);if(!t.has(r))return;const o=this.getFeatureCenterLngLat(a);if(!o)return;const u=this.label3d.create("","trade-national-label",!0);u.init(`
${Se(r)}
`,this.getTradeLocalPoint(o.lng,o.lat,.82)),this.label3d.setLabelStyle(u,.012,"x"),u.setParent(this.tradeNationalLabelGroup),u.visible=!0,this.tradeNationalLabels.push(u)})}normalizeTradeProvinceName(e=""){return String(e).replace(/省|市|自治区|壮族|回族|维吾尔|特别行政区/g,"").trim()}getFeatureCenterLngLat(e){var r,o,u;const t=((r=e==null?void 0:e.properties)==null?void 0:r.cp)||((o=e==null?void 0:e.properties)==null?void 0:o.centroid)||((u=e==null?void 0:e.properties)==null?void 0:u.center);if(Array.isArray(t)&&Number.isFinite(Number(t[0]))&&Number.isFinite(Number(t[1])))return{lng:Number(t[0]),lat:Number(t[1])};const a=this.getGeometryCoordinateList(e==null?void 0:e.geometry);if(!a.length)return null;const n=a.reduce((c,p)=>({minLng:Math.min(c.minLng,Number(p[0])),maxLng:Math.max(c.maxLng,Number(p[0])),minLat:Math.min(c.minLat,Number(p[1])),maxLat:Math.max(c.maxLat,Number(p[1]))}),{minLng:1/0,maxLng:-1/0,minLat:1/0,maxLat:-1/0});return{lng:(n.minLng+n.maxLng)/2,lat:(n.minLat+n.maxLat)/2}}isHomeTopicPresentation(){return this.topicLayerPresentation==="home"}createProvince(){let e=this.staticMapData.mapJson;this.mapJsonData=e;const t=this.useSatelliteBase?Rr({geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,zoom:this.satelliteTextureZoom,tileUrlTemplate:this.tileUrlTemplate,onTileStatus:g=>{var L,T;return(T=(L=this.callbacks).onTileStatus)==null?void 0:T.call(L,g)}}):null;t!=null&&t.texture&&this.enhanceTexture(t.texture);let[a,n]=this.createProvinceMaterial();this.focusMapTopMaterial=a,this.focusMapSideMaterial=n;let r=new Pr(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new te(0,0,.11),data:e,depth:this.depth,topFaceMaterial:a,sideMaterial:n,renderOrder:9}),o=new en({color:this.useSatelliteBase?16777215:13172735,map:(t==null?void 0:t.texture)||null,transparent:!0,opacity:this.useSatelliteBase?this.usesCustomSatelliteTiles?1:.94:this.isHomeTopicPresentation()?.58:.88,roughness:this.useSatelliteBase?this.usesCustomSatelliteTiles?.7:.82:.66,metalness:this.useSatelliteBase?0:.08});this.usesCustomSatelliteTiles||new tn(o,{uColor1:this.useSatelliteBase?1629410:this.isHomeTopicPresentation()?683906:1227744,uColor2:this.useSatelliteBase?757673:this.isHomeTopicPresentation()?406090:38069,size:this.useSatelliteBase?15:8.6}),this.defaultMaterial=o,this.defaultLightMaterial=this.defaultMaterial.clone(),this.defaultLightMaterial.color=new gt("rgba(128,244,255,1)"),this.defaultLightMaterial.opacity=.9;let u=new Sa(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new te(0,0,this.depth+.22),data:e,material:o,renderOrder:this.usesCustomSatelliteTiles?14:8});this.satelliteMapTop=u,this.satelliteMaterial=o,t!=null&&t.uvBounds&&Ir(u,t.uvBounds),u.mapGroup.children.map(g=>{g.children.map(L=>{L.type==="Mesh"&&this.eventElement.push(L)})}),this.mapLineMaterial=new aa({color:12254463,opacity:0,transparent:!0,linewidth:this.adminBoundaryLineScale,fog:!1});let c=new ra(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,data:e,material:this.mapLineMaterial,renderOrder:this.isHomeTopicPresentation()?34:26});c.lineGroup.position.z+=this.depth+(this.isHomeTopicPresentation()?.315:.285);let p=null;const y=this.getAdminBoundaryEmphasisRadius();return y>0&&(this.mapBoundaryEmphasisMaterial=new ye({color:9632767,transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1,blending:Ie}),p=new ra(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,data:e,material:this.mapBoundaryEmphasisMaterial,renderOrder:this.usesCustomSatelliteTiles?24:18,type:"Line3",tubeRadius:y}),p.lineGroup.position.z+=this.depth+.255),{map:r,mapTop:u,mapLine:c,mapBoundaryEmphasis:p}}normalizeAdminBoundaryLineScale(e){const t=Number(e);return Number.isFinite(t)?Math.min(4,Math.max(1,t)):1}getAdminBoundaryEmphasisRadius(){return this.adminBoundaryLineScale<=1?0:Math.min(.04,.011*this.adminBoundaryLineScale)}getAdminBoundaryEmphasisOpacity(){return this.adminBoundaryLineScale<=1?0:Math.min(.5,.2+this.adminBoundaryLineScale*.08)}createTopicLayer(){if(!this.mapJsonData)return;this.initHongyuanBoundaryPolygons();const e=document.createElement("canvas");e.width=yt.width,e.height=yt.height;const t=e.getContext("2d");t.clearRect(0,0,e.width,e.height);const a=new Jn(e);a.colorSpace=la,a.wrapS=dn,a.wrapT=dn,a.minFilter=Pa,a.magFilter=Pa,this.enhanceTexture(a),a.needsUpdate=!0;const n=new ye({map:a,transparent:!0,opacity:0,depthWrite:!1,depthTest:!this.isHomeTopicPresentation(),side:Re,fog:!1}),r=this.createLayerUvBounds(),o=new Sa(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new te(0,0,this.depth+(this.isHomeTopicPresentation()?.272:.255)),data:this.mapJsonData,material:n,renderOrder:this.isHomeTopicPresentation()?24:18});Ir(o,r),o.setParent(this.focusMapGroup),this.topicLayerUvBounds=r,this.topicLayerCanvas=e,this.topicLayerContext=t,this.topicLayerTexture=a,this.topicLayerMaterial=n,this.topicLayerMap=o}initHongyuanBoundaryPolygons(){var t,a,n;if((t=this.hongyuanBoundaryPolygons)!=null&&t.length)return;const e=this.staticMapData.mapStroke;this.hongyuanBoundaryPolygons=qr((n=(a=e==null?void 0:e.features)==null?void 0:a[0])==null?void 0:n.geometry)}createSelectedFeatureGroup(){var e;this.selectedFeatureGroup||(this.selectedFeatureGroup=new Te,this.selectedFeatureGroup.name="selected-feature-highlight",this.selectedFeatureGroup.position.z=this.depth+.31,(e=this.focusMapGroup)==null||e.add(this.selectedFeatureGroup))}createLayerUvBounds(){const e=Kt().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]),[t]=e([j.west,j.south]),[a]=e([j.east,j.south]),[,n]=e([j.west,j.north]),[,r]=e([j.west,j.south]);return{left:t,right:a,bottom:-r,top:-n}}setTopicLayer(e){var a,n;if(!e||!this.topicLayerContext||!this.topicLayerTexture)return;this.currentTopicLayer=e,this.visibleTopicLayers=[e],this.clearSelectedFeature(),this.applyLayerMapView(e);const t=++this.topicLayerLoadId;if(this.currentVectorFeatures=[],this.clearYakIndustryPointMarkers(),this.clearYakIndustryPointLabels(),this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(n=(a=this.callbacks).onLayerStatus)==null||n.call(a,{type:"loading",text:`正在加载 ${e.name}`}),rn(e)){this.loadVectorTopicLayer(e,t);return}this.loadTopicLayerImage(e).then(r=>{var o,u,c,p;if(t===this.topicLayerLoadId){if(!(r!=null&&r.image)){this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(u=(o=this.callbacks).onLayerStatus)==null||u.call(o,{type:"error",text:"GeoServer 图层加载失败"});return}this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.drawTopicRasterImage(r.image,r.layer||e),this.topicLayerTexture.needsUpdate=!0,this.updateTopicLayerTextureSampling(e),this.topicLayerMaterial.opacity=this.getTopicLayerMaterialOpacity(e,.84),(p=(c=this.callbacks).onLayerStatus)==null||p.call(c,{type:"success",text:"GeoServer 图层已加载"})}}).catch(()=>{var r,o;t===this.topicLayerLoadId&&(this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(o=(r=this.callbacks).onLayerStatus)==null||o.call(r,{type:"error",text:"GeoServer 图层加载失败"}))})}setTopicLayers(e=[],t=e[0]){var r,o,u,c;if(!this.topicLayerContext||!this.topicLayerTexture)return;const a=e.filter(Boolean);if(!a.length){this.topicLayerLoadId+=1,this.visibleTopicLayers=[],this.currentTopicLayer=null,this.currentVectorFeatures=[],this.clearYakIndustryPointMarkers(),this.clearYakIndustryPointLabels(),this.clearSelectedFeature(),this.applyLayerMapView(null),this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(o=(r=this.callbacks).onLayerStatus)==null||o.call(r,{type:"success",text:"图层已关闭"});return}if(a.length===1){this.setTopicLayer(F(F({},a[0]),(t==null?void 0:t.key)===a[0].key?t:{}));return}this.currentTopicLayer=t||a[a.length-1],this.visibleTopicLayers=a,this.clearSelectedFeature(),this.clearYakIndustryPointMarkers(),this.clearYakIndustryPointLabels(),this.applyLayerMapView(this.currentTopicLayer);const n=++this.topicLayerLoadId;this.currentVectorFeatures=[],this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(c=(u=this.callbacks).onLayerStatus)==null||c.call(u,{type:"loading",text:`正在加载 ${a.length} 个地图图层`}),Promise.all(a.map(p=>this.loadCompositeTopicLayerItem(p))).then(p=>{var L,T,C;if(n!==this.topicLayerLoadId)return;const y=p.filter(Boolean),g=y.find(N=>{var B,z;return N.type==="vector"&&((B=N.layer)==null?void 0:B.key)===((z=this.currentTopicLayer)==null?void 0:z.key)});this.currentVectorFeatures=((L=g==null?void 0:g.geojson)==null?void 0:L.features)||[],this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),y.forEach((N,B)=>{var z,X;if(N.type==="image"){this.topicLayerContext.save();const ae=B===y.length-1?Math.max(.78,(z=N.layer.opacity)!=null?z:.9):Math.min(.52,(X=N.layer.opacity)!=null?X:.52);this.topicLayerContext.globalAlpha=Math.min(1,Math.max(.28,ae)),this.drawTopicRasterImage(N.image,N.layer),this.topicLayerContext.restore();return}this.drawVectorTopicLayer(N.layer,N.geojson.features||[],{clear:!1})}),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),this.topicLayerTexture.needsUpdate=!0,this.updateTopicLayerTextureSampling(this.currentTopicLayer),this.topicLayerMaterial.opacity=y.length?this.getTopicLayerMaterialOpacity(this.currentTopicLayer,1):0,(C=(T=this.callbacks).onLayerStatus)==null||C.call(T,{type:y.length?"success":"error",text:y.length?`已加载 ${y.length} 个地图图层`:"地图图层加载失败"})})}loadCompositeTopicLayerItem(e){return oe(this,null,function*(){if(rn(e))try{const t=yield this.fetchVectorLayerGeojson(e);return{type:"vector",layer:e,geojson:t}}catch(t){return null}return this.loadTopicLayerImage(e).then(t=>t?F({type:"image"},t):null)})}loadTopicLayerImage(e){return Wr(e)?this.loadWmtsTopicLayerImage(e):new Promise(t=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>t({image:a,layer:e}),a.onerror=()=>t(null),a.src=Pu(e)})}loadWmtsTopicLayerImage(e){return oe(this,null,function*(){const t=document.createElement("canvas");t.width=yt.width,t.height=yt.height;const a=t.getContext("2d");if(!a)return null;a.clearRect(0,0,t.width,t.height);const n=this.getWmtsTopicZoom(e),r=Array.isArray(e==null?void 0:e.bounds)&&e.bounds.length>=4?e.bounds.map(Number):null,o=r!=null&&r.every(Number.isFinite)?{west:r[0],south:r[1],east:r[2],north:r[3]}:j,u=Wu(o,n),c=[];for(let L=u.minX;L<=u.maxX;L+=1)for(let T=u.minY;T<=u.maxY;T+=1)c.push({x:L,y:T});let p=0,y=0;const g=()=>oe(this,null,function*(){for(;y0&&(a.save(),a.globalAlpha=.58,a.filter=`blur(${u}px)`,a.drawImage(n,0,0),a.restore()),o>0){const y=[[-o,0],[o,0],[0,-o],[0,o],[-o,-o],[o,-o],[-o,o],[o,o]];a.save(),a.globalAlpha=.72,y.forEach(([g,L])=>a.drawImage(n,g,L)),a.restore()}a.drawImage(n,0,0)}getWmtsTopicZoom(e={}){var o,u,c;const t=Math.round(Number(e.maximumLevel)),a=Number.isFinite(t)&&t>0?t:21,n=Number((c=(u=(o=e.homeWmtsZoom)!=null?o:e.wmtsZoom)!=null?u:e.tileZoom)!=null?c:this.satelliteTextureZoom),r=Number.isFinite(n)&&n>0?Math.round(n):11;return Ht(r,3,Math.min(a,nn))}updateTopicLayerTextureSampling(e={}){if(!this.topicLayerTexture)return;const t=Wr(e)?vr:Pa;this.topicLayerTexture.minFilter=t,this.topicLayerTexture.magFilter=t,this.topicLayerTexture.needsUpdate=!0}drawTopicRasterImage(e,t={}){const a=this.topicLayerCanvas,n=this.topicLayerContext;if(!a||!n)return;if(!t.softMask){this.drawHomeTopicRasterGlow(e,t),n.drawImage(e,0,0,a.width,a.height);return}const r=Math.min(1,Math.max(.08,Number(t.softMaskScale)||.18)),o=document.createElement("canvas");o.width=Math.max(96,Math.round(a.width*r)),o.height=Math.max(96,Math.round(a.height*r));const u=o.getContext("2d");if(!u){n.drawImage(e,0,0,a.width,a.height);return}u.clearRect(0,0,o.width,o.height),u.imageSmoothingEnabled=!0,u.imageSmoothingQuality="high",u.drawImage(e,0,0,o.width,o.height),n.save(),n.imageSmoothingEnabled=!0,n.imageSmoothingQuality="high",n.drawImage(o,0,0,a.width,a.height),n.restore()}drawHomeTopicRasterGlow(e,t={}){var c,p;if(!this.isHomeTopicPresentation())return;const a=this.topicLayerCanvas,n=this.topicLayerContext;if(!a||!n)return;const r=Ht((c=t.homeGlowOpacity)!=null?c:0,0,.8),o=Ht((p=t.homeGlowBlur)!=null?p:0,0,32);if(!r||!o)return;const u=t.homeGlowColor||"#E5FCFF";n.save(),n.globalAlpha=r,n.filter=`drop-shadow(0 0 ${o}px ${u})`,n.drawImage(e,0,0,a.width,a.height),n.restore()}applyLayerMapView(e,t={}){var c,p;if(!((c=this.camera)!=null&&c.instance)||!((p=this.camera)!=null&&p.controls)||!this.mapAnimationComplete&&!t.force)return;const a=e?null:this.currentTownRanking,n=(e==null?void 0:e.mapView)||(e!=null&&e.cameraPosition?{cameraPosition:e.cameraPosition}:null)||(a==null?void 0:a.mapView)||(a!=null&&a.cameraPosition?{cameraPosition:a.cameraPosition}:null),r=n?this.getLayerMapViewTarget(n):this.defaultMapTarget.clone(),o=n?this.getLayerMapViewCameraPosition(n,r):this.defaultMapCameraPosition.clone(),u=n&&Number.isFinite(n.duration)?n.duration:.75;this.animateMapCamera(o,r,u)}getFocusMapTopOpacity(){return this.useSatelliteBase?this.usesCustomSatelliteTiles?.16:1:.78}getTopicLayerMaterialOpacity(e,t=.84){const a=Number(e==null?void 0:e.opacity),n=Number.isFinite(a)?a:t;if(!this.isHomeTopicPresentation())return n;const r=Number(e==null?void 0:e.homePresentationMaxOpacity),o=Number.isFinite(r)?r:.56;return Ht(n,0,o)}getDynamicSatelliteZoom(e){return this.usesCustomSatelliteTiles?e<=4.2?Math.min(this.dynamicSatelliteMaxZoom,21):e<=6.4?Math.min(this.dynamicSatelliteMaxZoom,19):e<=8.4?Math.min(this.dynamicSatelliteMaxZoom,17):e<=11?Math.min(this.dynamicSatelliteMaxZoom,15):e<=14.5?Math.min(this.dynamicSatelliteMaxZoom,13):e<=18?Math.min(this.dynamicSatelliteMaxZoom,11):this.satelliteTextureZoom:this.satelliteTextureZoom}getCameraTargetLngLat(){var r,o,u,c,p,y,g;const e=(c=(u=(o=(r=this.camera)==null?void 0:r.controls)==null?void 0:o.target)==null?void 0:u.clone)==null?void 0:c.call(u);if(!e)return[102.58,32.72];(y=(p=this.focusMapGroup)==null?void 0:p.updateWorldMatrix)==null||y.call(p,!0,!1);const t=this.focusMapGroup?this.focusMapGroup.worldToLocal(e):e,a=Kt().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]),n=((g=a.invert)==null?void 0:g.call(a,[t.x,-t.y]))||[102.58,32.72];return[Math.max(j.west,Math.min(j.east,Number(n[0])||102.58)),Math.max(j.south,Math.min(j.north,Number(n[1])||32.72))]}getDynamicSatelliteTileWindow(e){return e>=21?3:e>=19?5:e>=17?7:e>=15?this.dynamicSatelliteTileWindow:e>=13?Math.min(11,this.dynamicSatelliteTileWindow+2):Math.min(11,this.dynamicSatelliteTileWindow+2)}getDynamicSatelliteKey(e,t){return t?`${e}:${t.minX}-${t.maxX}:${t.minY}-${t.maxY}`:""}updateDynamicSatelliteTiles(e=!1){if(!this.usesCustomSatelliteTiles||!this.mapAnimationComplete)return;const t=Date.now();if(!e&&t-this.dynamicSatelliteLastCheck{var c,p,y,g,L;if((y=(p=this.callbacks).onTileStatus)==null||y.call(p,$(F({},u),{text:((c=u.text)==null?void 0:c.replace("影像底图","高清影像底图"))||u.text})),u.type!=="loading"){if(r!==this.dynamicSatelliteRequestId){(L=(g=o==null?void 0:o.texture)==null?void 0:g.dispose)==null||L.call(g);return}if(this.dynamicSatelliteLoadingKey="",Number(u.loaded||0)<=0){this.dynamicSatelliteCurrentKey===n&&this.hideDynamicSatelliteOverlay();return}this.applyDynamicSatelliteOverlay(o,n)}}}),this.applyDynamicSatelliteOverlay(o,n)}ensureDynamicSatelliteOverlay(){var a;if(this.dynamicSatelliteOverlay)return;const e=new ye({transparent:!0,opacity:0,depthWrite:!1,depthTest:!0,side:Re,fog:!1}),t=new je(new $t(1,1),e);t.name="dynamic-satellite-overlay",t.renderOrder=15,t.visible=!1,t.position.z=this.depth+.248,(a=this.focusMapGroup)==null||a.add(t),this.dynamicSatelliteOverlay=t,this.dynamicSatelliteMaterial=e}applyDynamicSatelliteOverlay(e,t){var o,u;if(!(e!=null&&e.texture)||!(e!=null&&e.uvBounds))return;this.ensureDynamicSatelliteOverlay();const a=e.uvBounds,n=Math.max(1e-4,a.right-a.left),r=Math.max(1e-4,a.top-a.bottom);this.dynamicSatelliteOverlay.position.set((a.left+a.right)/2,(a.bottom+a.top)/2,this.depth+.248),this.dynamicSatelliteOverlay.scale.set(n,r,1),this.dynamicSatelliteOverlay.visible=!0,this.dynamicSatelliteTexture&&this.dynamicSatelliteTexture!==e.texture&&((u=(o=this.dynamicSatelliteTexture).dispose)==null||u.call(o)),this.dynamicSatelliteTexture=e.texture,this.dynamicSatelliteMaterial.map=e.texture,this.dynamicSatelliteMaterial.opacity=1,this.dynamicSatelliteMaterial.needsUpdate=!0,this.dynamicSatelliteCurrentKey=t}hideDynamicSatelliteOverlay(){this.dynamicSatelliteOverlay&&(this.dynamicSatelliteOverlay.visible=!1),this.dynamicSatelliteLoadingKey&&(this.dynamicSatelliteRequestId+=1,this.dynamicSatelliteLoadingKey=""),this.dynamicSatelliteCurrentKey=""}ensureMapRevealed(){var e,t,a,n;if(!this.mapAnimationComplete){if((t=(e=this.animateTl)==null?void 0:e.progress)==null||t.call(e,1,!1),(n=(a=this.animateTl)==null?void 0:a.pause)==null||n.call(a),this.mapAnimationComplete=!0,this.focusMapGroup&&(this.focusMapGroup.position.set(0,0,0),this.focusMapGroup.scale.set(1,1,1)),this.focusMapTopMaterial&&(this.focusMapTopMaterial.opacity=this.getFocusMapTopOpacity()),this.focusMapSideMaterial&&(this.focusMapSideMaterial.opacity=1,this.focusMapSideMaterial.transparent=!1),this.mapGroup&&(this.mapGroup.visible=!0),this.labelGroup&&(this.labelGroup.visible=!0),this.flyLineGroup&&(this.flyLineGroup.visible=!0),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=!0),this.scatterGroup&&(this.scatterGroup.visible=!0),this.InfoPointGroup&&(this.InfoPointGroup.visible=this.showTownRankingPointMarkers&&this.hasTownRankingRows()),this.applyLayerMapView(this.currentTopicLayer,{force:!0}),this.updateDynamicSatelliteTiles(!0),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),Ma(this.currentTownRanking)){this.hideAllMapStatisticLabels();return}this.updateVillageRankingLabels(this.currentTownRanking),this.updateTradeFlowLayer(this.currentTownRanking),this.updateInfoPointStats()}}getLayerMapViewTarget(e){var t;return e!=null&&e.targetLngLat?this.lngLatToWorldPoint(e.targetLngLat,(t=e.targetLocalZ)!=null?t:.72):e!=null&&e.target?this.toVector3(e.target,this.defaultMapTarget):this.defaultMapTarget.clone()}getLayerMapViewCameraPosition(e,t){if(e!=null&&e.cameraPosition)return this.toVector3(e.cameraPosition,this.defaultMapCameraPosition);const a=Number.isFinite(e==null?void 0:e.distanceScale)?e.distanceScale:1,n=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(a),r=t.clone().add(n);return e!=null&&e.cameraOffset&&r.add(this.toVector3(e.cameraOffset,new te(0,0,0))),r}lngLatToWorldPoint(e,t=0){const a=Array.isArray(e)?e:[e==null?void 0:e.lng,e==null?void 0:e.lat],n=Number(a==null?void 0:a[0]),r=Number(a==null?void 0:a[1]);if(!Number.isFinite(n)||!Number.isFinite(r))return this.defaultMapTarget.clone();const[o,u]=this.geoProjection([n,r]),c=new te(o,-u,Number(t)||0);return this.focusMapGroup?this.focusMapGroup.localToWorld(c):c}toVector3(e,t){if(Array.isArray(e)){const[o,u,c]=e.map(Number);return[o,u,c].every(Number.isFinite)?new te(o,u,c):t.clone()}const a=Number(e==null?void 0:e.x),n=Number(e==null?void 0:e.y),r=Number(e==null?void 0:e.z);return[a,n,r].every(Number.isFinite)?new te(a,n,r):t.clone()}animateMapCamera(e,t,a=.75){this.activeMapViewTweens.forEach(o=>{var u;return(u=o==null?void 0:o.kill)==null?void 0:u.call(o)}),this.activeMapViewTweens=[];const n=this.camera.controls,r=()=>n.update();this.activeMapViewTweens.push(sa.to(this.camera.instance.position,{duration:a,x:e.x,y:e.y,z:e.z,ease:"power2.out",onUpdate:r}),sa.to(n.target,{duration:a,x:t.x,y:t.y,z:t.z,ease:"power2.out",onUpdate:r}))}addSceneTween(e){var t;return e&&(this.sceneTweens.push(e),this.scenePaused&&((t=e.pause)==null||t.call(e)),e)}addSceneTimer(e){return e&&this.sceneTimers.push(e),e}focusTownByName(e,t={}){var u,c,p;const a=this.townMetaByName.get(nt(e)),n=t.select?this.selectTownFeatureByName(e,t):!1;if(t.preserveCamera)return n||!!(a!=null&&a.center);if(!(a!=null&&a.center))return n;const r=this.lngLatToWorldPoint(a.center,(u=t.targetLocalZ)!=null?u:.82),o=this.getLayerMapViewCameraPosition({distanceScale:(c=t.distanceScale)!=null?c:.82,cameraOffset:t.cameraOffset||{x:0,y:1.2,z:0}},r);return this.animateMapCamera(o,r,(p=t.duration)!=null?p:.75),!0}isNationalParkTownSelectionActive(){var e;return((e=this.currentTopicLayer)==null?void 0:e.key)==="national-park-zoning"&&this.getTownRankingMeta().onlyRankedTownLabels}getTownNameFromMapEvent(e){var a,n,r,o,u,c,p,y,g,L;return[(r=(n=(a=e==null?void 0:e.target)==null?void 0:a.parent)==null?void 0:n.userData)==null?void 0:r.name,(u=(o=e==null?void 0:e.target)==null?void 0:o.userData)==null?void 0:u.name,(y=(p=(c=e==null?void 0:e.target)==null?void 0:c.parent)==null?void 0:p.userData)==null?void 0:y.townName,(L=(g=e==null?void 0:e.target)==null?void 0:g.userData)==null?void 0:L.townName].find(T=>String(T||"").trim())||""}findTownFeatureByName(e){var n,r,o,u;const t=nt(e);if(!t)return null;const a=(((n=this.mapJsonData)==null?void 0:n.features)||((o=(r=this.staticMapData)==null?void 0:r.mapJson)==null?void 0:o.features)||[]).find(c=>{const p=(c==null?void 0:c.properties)||{};return[p.name,p.fullName,p.full_name,p.townName].some(g=>nt(g)===t)});return a!=null&&a.geometry?{type:"Feature",properties:$(F({},a.properties||{}),{name:((u=a.properties)==null?void 0:u.name)||e,feature_role:"乡镇范围"}),geometry:a.geometry}:null}selectTownFeatureByName(e,t={}){var n,r,o,u,c;const a=this.findTownFeatureByName(e);return a?(this.showSelectedFeature(a,{mode:"town"}),t.silentStatus!==!0&&((c=(u=this.callbacks).onLayerStatus)==null||c.call(u,{type:"success",text:t.statusText||`已选中${((o=a.properties)==null?void 0:o.name)||e}`})),!0):(t.showMissingStatus!==!1&&((r=(n=this.callbacks).onLayerStatus)==null||r.call(n,{type:"warning",text:"未找到对应乡镇边界"})),!1)}handleTownRankingSelect(e,t={}){var u,c;if(!this.isNationalParkTownSelectionActive())return!1;const a=nt(e);if(!a||!this.getTownRankingRows(this.currentTownRanking,Number.POSITIVE_INFINITY,!1).some(p=>nt(p.name)===a))return!1;const o=this.focusTownByName(e,F({select:!0,preserveCamera:!0,statusText:`已选中${e}`},t));return o&&((c=(u=this.callbacks).onFeatureInfo)==null||c.call(u,{feature:null})),o}focusYakIndustryPoint(e={}){var r,o;const t=this.getYakIndustryPayloadCoordinate(e);if(!t)return(o=(r=this.callbacks).onLayerStatus)==null||o.call(r,{type:"warning",text:"当前主体暂无可定位坐标"}),{focused:!1,screen:null};const a=this.findYakIndustryPointFeature(e,t);return a?this.setSelectedVectorFeatures([a]):this.clearSelectedFeature(),{focused:this.flyToLngLat(t,{span:.035,duration:.72,statusText:"已定位产业主体"}),screen:this.getYakIndustryPointScreen(e),feature:a}}focusVectorFeature(e={}){var p,y;const t=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),a=String(e.id||e.key||""),n=String(e.fullName||e.name||"").trim(),r=t.find(g=>{const L=(g==null?void 0:g.properties)||{};return a&&String(L.id||"")===a||n&&String(L.name||L.plot_name||"").trim()===n});if(!r)return(y=(p=this.callbacks).onLayerStatus)==null||y.call(p,{type:"warning",text:"当前图斑尚未加载"}),{focused:!1,screen:null,feature:null};this.setSelectedVectorFeatures([r]);const o=this.getGeometryLngLatBounds(r.geometry);if(!o)return{focused:!1,screen:null,feature:r};const u=[(o.minLng+o.maxLng)/2,(o.minLat+o.maxLat)/2];return{focused:this.flyToLngLat(u,{span:Math.max(o.maxLng-o.minLng,o.maxLat-o.minLat),duration:.75,statusText:"已定位种草图斑"}),screen:this.getVectorFeatureScreen(r),feature:r}}getVectorFeatureScreen(e={}){let t=(e==null?void 0:e.feature)||e;if(!(t!=null&&t.geometry)){const r=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),o=String((e==null?void 0:e.id)||(e==null?void 0:e.key)||"");t=r.find(u=>{var c;return String(((c=u==null?void 0:u.properties)==null?void 0:c.id)||"")===o})||null}const a=this.getGeometryLngLatBounds(t==null?void 0:t.geometry);if(!a)return null;const n=[(a.minLng+a.maxLng)/2,(a.minLat+a.maxLat)/2];return this.lngLatToLayerScreenPoint(n,this.depth+.34)||this.lngLatToScreenPoint(n,this.depth+.32)}getYakIndustryPointScreen(e={}){const t=this.getYakIndustryPayloadCoordinate(e);return t?this.lngLatToLayerScreenPoint(t,this.depth+.36)||this.lngLatToScreenPoint(t,this.depth+.32):null}getYakIndustryPayloadCoordinate(e={}){var r,o,u,c,p;const t=((r=e.geometry)==null?void 0:r.coordinates)||e.coordinates,a=Number((u=(o=e.longitude)!=null?o:e.lng)!=null?u:t==null?void 0:t[0]),n=Number((p=(c=e.latitude)!=null?c:e.lat)!=null?p:t==null?void 0:t[1]);return!Number.isFinite(a)||!Number.isFinite(n)?null:[a,n]}findYakIndustryPointFeature(e={},t=this.getYakIndustryPayloadCoordinate(e)){const a=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),n=String(e.id||e.key||""),r=String(e.fullName||e.name||"").trim(),o=String(e.stageKey||""),u=t&&a.find(p=>{var g;if(((g=p==null?void 0:p.geometry)==null?void 0:g.type)!=="Point")return!1;const y=p.properties||{};return o&&String(y.stageKey||"")!==o?!1:this.getCoordinateDistance(p.geometry.coordinates,t)<=8e-4})||null;if(e.preferCoordinateMatch)return u;const c=a.find(p=>{const y=(p==null?void 0:p.properties)||{};return!!(n&&String(y.id||"")===n||r&&String(y.name||y.fullName||"").trim()===r)});return c||u}loadVectorTopicLayer(e,t){return oe(this,null,function*(){var a,n,r,o;try{const u=yield this.fetchVectorLayerGeojson(e);if(t!==this.topicLayerLoadId)return;this.currentVectorFeatures=u.features||[],this.drawVectorTopicLayer(e,this.currentVectorFeatures),this.updateYakIndustryPointMarkers(e,this.currentVectorFeatures),this.updateYakIndustryPointLabels(e,this.currentVectorFeatures),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=this.getTopicLayerMaterialOpacity(e,.9),(n=(a=this.callbacks).onLayerStatus)==null||n.call(a,{type:"success",text:"真实矢量图层已加载"})}catch(u){if(t!==this.topicLayerLoadId)return;this.currentVectorFeatures=[],this.clearYakIndustryPointMarkers(),this.clearYakIndustryPointLabels(),this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(o=(r=this.callbacks).onLayerStatus)==null||o.call(r,{type:"error",text:"真实矢量图层加载失败"})}})}fetchVectorLayerGeojson(e){return oe(this,null,function*(){var r,o;if(e.sourceType==="geojson"){if(((r=e.geojsonData)==null?void 0:r.type)==="FeatureCollection")return e.geojsonData;const u=yield fetch(Hr(e.dataPath),{credentials:"include"});if(!u.ok)throw new Error(`HTTP ${u.status}`);return yield u.json()}if(e.sourceType==="wfs"){const u=yield Gr(e.layerName,{cqlFilter:e.cqlFilter,maxFeatures:e.maxFeatures||1200,timeout:e.timeout||18e3});return(u==null?void 0:u.type)==="FeatureCollection"?u:{type:"FeatureCollection",features:(u==null?void 0:u.features)||[]}}let t=[],a=null;try{const u=yield fetch(e.apiUrl,{credentials:"include"});if(!u.ok)throw new Error(`HTTP ${u.status}`);const c=yield u.json();t=Array.isArray(c==null?void 0:c.data)?c.data:Array.isArray((o=c==null?void 0:c.data)==null?void 0:o.rows)?c.data.rows:[]}catch(u){a=u}let n=this.buildWktLayerFeatures(t);if((!t.length||!n.length)&&e.fallbackPath){const u=yield fetch(Hr(e.fallbackPath),{credentials:"include"});if(!u.ok)throw a||new Error(`HTTP ${u.status}`);const c=yield u.json();t=Array.isArray(c==null?void 0:c.rows)?c.rows:[],n=this.buildWktLayerFeatures(t)}return{type:"FeatureCollection",features:n}})}buildWktLayerFeatures(e=[]){return(e||[]).map(t=>({type:"Feature",properties:{id:t.id,type:t.type,totalAcreage:t.totalAcreage,cdAcreage:t.cdAcreage,sdAcreage:t.sdAcreage,cdScl:t.cdScl,sdScl:t.sdScl},geometry:this.parseWktGeometry(this.pickWktValue(t))})).filter(t=>t.geometry)}pickWktValue(e={}){return e.wkt||e.WKT||e.geom||e.geometry||e.the_geom||e.theGeom||e.shape||e.Shape}drawVectorTopicLayer(e,t,a={}){const n=this.topicLayerContext;a.clear!==!1&&n.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),n.save(),n.lineJoin="round",n.lineCap="round",this.clipVectorLayerContext(n,e);const o=this.getVisibleVectorFeatures(e,t).filter(u=>{var c;return!(e!=null&&e.hidePointFeatures)||((c=u==null?void 0:u.geometry)==null?void 0:c.type)!=="Point"}).sort((u,c)=>{var g,L;const p=this.getGeometryDrawRank((g=u.geometry)==null?void 0:g.type),y=this.getGeometryDrawRank((L=c.geometry)==null?void 0:L.type);return p-y});o.forEach(u=>{const c=this.getVectorFeatureStyle(e,u);this.drawVectorFeature(n,u.geometry,c)}),this.drawNationalParkBoundaryOverlay(n,e,o),this.drawSelectedVectorOverlay(n),n.restore()}drawNationalParkBoundaryOverlay(e,t,a=[]){(t==null?void 0:t.key)!=="national-park-zoning"||!a.length||a.forEach(n=>{const r=this.getVectorFeatureStyle(t,n);this.drawVectorFeature(e,n.geometry,$(F({},r),{fill:"#071A20",stroke:"#071A20",polygonAlpha:0,lineAlpha:.34,lineWidth:7,glow:!0})),this.drawVectorFeature(e,n.geometry,$(F({},r),{fill:"#E7FFF6",stroke:"#E7FFF6",polygonAlpha:0,lineAlpha:.68,lineWidth:2.1,glow:!1})),this.drawVectorFeature(e,n.geometry,$(F({},r),{fill:r.stroke,stroke:r.stroke,polygonAlpha:0,lineAlpha:.86,lineWidth:1.2,glow:!1}))})}drawSelectedVectorOverlay(e){const t=this.selectedVectorFeatures||[],a=this.analysisMatchedFeatures||[],n=this.analysisBoundaryFeature,r=this.boundaryDrawPoints||[];if(!t.length&&!a.length&&!n&&!r.length)return;const o=this.isEcologicalProjectLayer(this.currentTopicLayer),u={fill:Ar,stroke:$u,polygonAlpha:o?.2:.28,lineAlpha:o?.78:.98,lineWidth:o?6:12,pointRadius:11,glow:!o,halo:!o},c={fill:Ar,stroke:Eu,polygonAlpha:o?.34:.52,lineAlpha:o?.94:1,lineWidth:o?3.2:5,pointRadius:6.5,glow:!1,halo:!1};if(e.save(),t.forEach(p=>{var g;const y=(p==null?void 0:p.geometry)||((g=p==null?void 0:p.feature)==null?void 0:g.geometry);this.drawVectorFeature(e,y,u),this.drawVectorFeature(e,y,c)}),a.forEach(p=>{var g;const y=(p==null?void 0:p.geometry)||((g=p==null?void 0:p.feature)==null?void 0:g.geometry);this.drawVectorFeature(e,y,{fill:"#30DCFF",stroke:"#C9FBFF",polygonAlpha:o?.22:.28,lineAlpha:o?.88:.98,lineWidth:o?2.8:5,pointRadius:6,glow:!o})}),n!=null&&n.geometry&&this.drawVectorFeature(e,n.geometry,{fill:"#24F6C4",stroke:"#FFFFFF",polygonAlpha:o?.12:.18,lineAlpha:o?.92:1,lineWidth:o?3:4,pointRadius:6,glow:!o}),r.length){const p=r.map(g=>[g.lng,g.lat]),y={type:"LineString",coordinates:this.boundaryDrawingEnabled?p:[...p,p[0]].filter(Boolean)};this.drawVectorFeature(e,y,{fill:"#24F6C4",stroke:"#24F6C4",polygonAlpha:o?.08:.12,lineAlpha:1,lineWidth:o?3:4,pointRadius:6,glow:!o}),p.forEach(g=>{this.drawVectorFeature(e,{type:"Point",coordinates:g},{fill:"#FFFFFF",stroke:"#24F6C4",polygonAlpha:.2,lineAlpha:1,lineWidth:o?2.4:3,pointRadius:5.5,glow:!o})})}e.restore()}redrawVectorTopicLayer(){!this.topicLayerContext||!this.topicLayerTexture||!this.currentTopicLayer||!rn(this.currentTopicLayer)||(this.drawVectorTopicLayer(this.currentTopicLayer,this.currentVectorFeatures||[]),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.topicLayerTexture.needsUpdate=!0)}featureMatchesLegend(e={},t={}){var r;const a=Array.isArray(t==null?void 0:t.matches)?t.matches.filter(o=>o==null?void 0:o.field):[];if(a.length)return a.some(o=>{var u;return String((u=e[o.field])!=null?u:"")===String(o.value)});const n=t==null?void 0:t.match;return n!=null&&n.field?String((r=e[n.field])!=null?r:"")===String(n.value):!0}getVisibleVectorFeatures(e,t){var u,c;const a=Array.isArray(e==null?void 0:e.activeLegends)?e.activeLegends.filter(p=>{var y,g;return((y=p==null?void 0:p.matches)==null?void 0:y.length)||((g=p==null?void 0:p.match)==null?void 0:g.field)}):[];if(a.length)return(t||[]).filter(p=>a.some(y=>this.featureMatchesLegend((p==null?void 0:p.properties)||{},y)));const n=e==null?void 0:e.activeLegend;if((u=n==null?void 0:n.matches)!=null&&u.length||(c=n==null?void 0:n.match)!=null&&c.field)return(t||[]).filter(p=>this.featureMatchesLegend((p==null?void 0:p.properties)||{},n));const o=String((e==null?void 0:e.cqlFilter)||"").trim().match(/^([a-zA-Z0-9_]+)\s*=\s*'((?:''|[^'])*)'$/);if(o){const[,p,y]=o,g=y.replace(/''/g,"'");return(t||[]).filter(L=>{var T,C;return String((C=(T=L==null?void 0:L.properties)==null?void 0:T[p])!=null?C:"")===g})}return[...t||[]]}updateYakIndustryPointLabels(e=this.currentTopicLayer,t=this.currentVectorFeatures){if(this.clearYakIndustryPointLabels(),(e==null?void 0:e.showPointLabels)===!1||e!=null&&e.hidePointFeatures||(e==null?void 0:e.key)!=="yak-industry-points"||!this.label3d)return;const a=this.getYakIndustryLabelFeatures(e,t);a.length&&(this.ensureYakIndustryPointLabelGroup(),a.forEach((n,r)=>{var u;let o=this.yakIndustryPointLabels[r];o||(o=this.label3d.create("","yak-industry-point-label",!0),this.label3d.setLabelStyle(o,.012,"x"),o.setParent(this.yakIndustryPointLabelGroup),this.yakIndustryPointLabels.push(o)),o.element.className="yak-industry-point-label",o.init(this.getYakIndustryPointLabelHtml(n),this.getYakIndustryPointLabelPosition(n,r)),o.visible=!0,(u=o.show)==null||u.call(o),o.userData={feature:n}}),this.yakIndustryPointLabels.slice(a.length).forEach(n=>{var r;n.visible=!1,(r=n.hide)==null||r.call(n),n.userData=null}),this.yakIndustryPointLabelGroup.visible=!!this.mapAnimationComplete)}updateYakIndustryPointMarkers(e=this.currentTopicLayer,t=this.currentVectorFeatures){if(this.clearYakIndustryPointMarkers(),(e==null?void 0:e.key)!=="yak-industry-points"||e!=null&&e.hidePointMarkers)return;const a=this.getVisibleVectorFeatures(e,t).filter(n=>{var r;return((r=n==null?void 0:n.geometry)==null?void 0:r.type)==="Point"});a.length&&(this.ensureYakIndustryPointMarkerGroup(),a.forEach((n,r)=>{let o=this.yakIndustryPointMarkers[r];const u=this.getVectorFeatureStyle(e,n),c=this.getYakIndustryMarkerMaterial(u,n),p=this.lngLatToLayerLocalPoint(n.geometry.coordinates,this.depth+.36),y=Number(e==null?void 0:e.pointSpriteScale)||.34,g=this.getYakIndustryMarkerType(n);o||(o=new na(c),o.name="yak-industry-point-marker",o.renderOrder=42,this.bindYakIndustryPointMarkerEvents(o),this.interactionManager.add(o),this.yakIndustryPointMarkerGroup.add(o),this.yakIndustryPointMarkers.push(o)),o.material=c,o.center.set(.5,.5),o.position.copy(p),o.scale.set(y*.88,y*.88,1),o.visible=!0,o.userData={feature:n,layer:e,index:r,markerType:g}}),this.yakIndustryPointMarkers.slice(a.length).forEach(n=>{n.visible=!1,n.userData=null}),this.yakIndustryPointMarkerGroup.visible=!!this.mapAnimationComplete)}ensureYakIndustryPointMarkerGroup(){var e;this.yakIndustryPointMarkerGroup||(this.yakIndustryPointMarkerGroup=new Te,this.yakIndustryPointMarkerGroup.name="yak-industry-point-markers",this.yakIndustryPointMarkerGroup.visible=!1,(e=this.focusMapGroup)==null||e.add(this.yakIndustryPointMarkerGroup))}clearYakIndustryPointMarkers(){var e;this.yakIndustryPointMarkerGroup&&(this.yakIndustryPointMarkerGroup.visible=!1),(e=this.yakIndustryPointMarkers)==null||e.forEach(t=>{t.visible=!1})}bindYakIndustryPointMarkerEvents(e){e.addEventListener("mousedown",t=>{var r,o,u,c,p,y,g,L,T;if(this.clicked||!((r=this.yakIndustryPointMarkerGroup)!=null&&r.visible))return!1;const a=(u=(o=t.target)==null?void 0:o.userData)==null?void 0:u.feature;if(!a)return!1;this.clicked=!0;const n=((c=a.geometry)==null?void 0:c.coordinates)||[];this.setSelectedVectorFeatures([a]),(T=(L=this.callbacks).onFeatureInfo)==null||T.call(L,{feature:{id:((p=a.properties)==null?void 0:p.id)||((y=a.properties)==null?void 0:y.feature_id)||((g=a.properties)==null?void 0:g.project_name),properties:a.properties||{},feature:a,layer:this.currentTopicLayer,lngLat:{lng:Number(n[0]),lat:Number(n[1])}},screen:this.getPointFeatureScreenPoint(a)})}),e.addEventListener("mouseup",()=>{this.clicked=!1}),e.addEventListener("mouseover",()=>{e.visible&&(document.body.style.cursor="pointer")}),e.addEventListener("mouseout",()=>{document.body.style.cursor="default"})}getYakIndustryMarkerMaterial(e,t){const a=e.markerType||this.getYakIndustryMarkerType(t),n=`${e.fill||"#24F6C4"}-${e.stroke||"#B7FFF2"}-${a}`,r=this.yakIndustryMarkerMaterialCache.get(n);if(r)return r;const o=this.createYakIndustryMarkerTexture(e.fill,e.stroke,a),u=new ia({map:o,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1});return this.yakIndustryMarkerMaterialCache.set(n,u),u}getYakIndustryMarkerType(e={}){var a;const t=String(((a=e==null?void 0:e.properties)==null?void 0:a.stageKey)||"");return $r[t]||"point"}createYakIndustryMarkerTexture(e="#24F6C4",t="#B7FFF2",a="point"){const n=document.createElement("canvas");n.width=112,n.height=112;const r=n.getContext("2d"),o=56,u=56;r.clearRect(0,0,n.width,n.height),r.beginPath(),r.arc(o,u,42,0,Math.PI*2),r.fillStyle=this.hexToRgba(e,.18),r.shadowColor=e,r.shadowBlur=20,r.fill(),this.drawYakIndustryMarkerFrame(r,a,o,u,e,t||e),r.save(),r.shadowBlur=0,r.beginPath(),r.arc(o,u,19,0,Math.PI*2),r.fillStyle="rgba(3, 23, 34, 0.64)",r.fill(),r.strokeStyle=this.hexToRgba("#FFFFFF",.32),r.lineWidth=2,r.stroke(),r.restore(),this.drawYakIndustryMarkerGlyph(r,a,o,u,"#FFFFFF");const c=new Jn(n);return c.colorSpace=la,c.needsUpdate=!0,c}drawYakIndustryMarkerFrame(e,t,a,n,r="#24F6C4",o="#B7FFF2"){if(e.save(),e.translate(a,n),e.fillStyle=this.hexToRgba(r,.92),e.strokeStyle=this.hexToRgba(o||r,.98),e.lineWidth=4,e.shadowColor=o||r,e.shadowBlur=14,t==="pasture")e.beginPath(),e.moveTo(-34,-9),e.lineTo(0,-38),e.lineTo(34,-9),e.lineTo(28,-9),e.lineTo(28,24),e.quadraticCurveTo(28,31,21,31),e.lineTo(-21,31),e.quadraticCurveTo(-28,31,-28,24),e.lineTo(-28,-9),e.closePath();else if(t==="grass")e.beginPath(),e.moveTo(0,-38),e.bezierCurveTo(31,-22,34,18,0,38),e.bezierCurveTo(-34,18,-31,-22,0,-38),e.closePath();else if(t==="breeding"){e.beginPath();for(let u=0;u<6;u+=1){const c=-Math.PI/2+Math.PI*2*u/6,p=Math.cos(c)*35,y=Math.sin(c)*35;u===0?e.moveTo(p,y):e.lineTo(p,y)}e.closePath()}else if(t==="storage")e.beginPath(),e.moveTo(-34,-25),e.lineTo(25,-25),e.lineTo(35,-13),e.lineTo(35,27),e.lineTo(-25,27),e.lineTo(-35,15),e.lineTo(-35,-25),e.closePath();else if(t==="processing"){e.beginPath();for(let u=0;u<10;u+=1){const c=-Math.PI/2+Math.PI*2*u/10,p=u%2===0?38:30,y=Math.cos(c)*p,g=Math.sin(c)*p;u===0?e.moveTo(y,g):e.lineTo(y,g)}e.closePath()}else if(t==="equipment"){e.beginPath();for(let u=0;u<16;u+=1){const c=-Math.PI/2+Math.PI*2*u/16,p=u%2===0?38:30,y=Math.cos(c)*p,g=Math.sin(c)*p;u===0?e.moveTo(y,g):e.lineTo(y,g)}e.closePath()}else t==="service"?(e.beginPath(),e.moveTo(0,-39),e.lineTo(31,-24),e.lineTo(25,14),e.quadraticCurveTo(0,39,-25,14),e.lineTo(-31,-24),e.closePath()):(e.beginPath(),e.arc(0,0,34,0,Math.PI*2));e.fill(),e.stroke(),e.restore()}drawYakIndustryMarkerGlyph(e,t,a,n,r="#24F6C4"){if(e.save(),e.translate(a,n),e.lineCap="round",e.lineJoin="round",e.shadowBlur=0,e.fillStyle=this.hexToRgba(r,.98),e.strokeStyle=this.hexToRgba(r,.98),e.lineWidth=3,t==="pasture")e.beginPath(),e.moveTo(-12,-2),e.lineTo(0,-11),e.lineTo(12,-2),e.stroke(),e.fillRect(-9,-2,18,12),e.clearRect(-3,2,6,8);else if(t==="grass")e.beginPath(),e.moveTo(0,10),e.quadraticCurveTo(-10,1,-7,-10),e.moveTo(0,10),e.quadraticCurveTo(10,1,7,-10),e.moveTo(0,10),e.quadraticCurveTo(0,0,1,-12),e.stroke();else if(t==="breeding")e.beginPath(),e.moveTo(-8,-5),e.quadraticCurveTo(-15,-12,-18,-4),e.moveTo(8,-5),e.quadraticCurveTo(15,-12,18,-4),e.stroke(),e.beginPath(),e.ellipse(0,1,11,12,0,0,Math.PI*2),e.fill(),e.fillStyle=this.hexToRgba("#08202D",.85),e.fillRect(-5,-2,3,3),e.fillRect(2,-2,3,3);else if(t==="storage")e.beginPath(),e.moveTo(-13,-3),e.lineTo(0,-11),e.lineTo(13,-3),e.lineTo(13,9),e.lineTo(-13,9),e.closePath(),e.fill(),e.strokeStyle=this.hexToRgba("#08202D",.72),e.lineWidth=2,e.beginPath(),e.moveTo(-8,0),e.lineTo(8,0),e.moveTo(-8,5),e.lineTo(8,5),e.stroke();else if(t==="processing")e.beginPath(),e.moveTo(-13,8),e.lineTo(-13,-1),e.lineTo(-5,-6),e.lineTo(-5,-1),e.lineTo(3,-6),e.lineTo(3,-1),e.lineTo(12,-6),e.lineTo(12,8),e.closePath(),e.fill(),e.fillRect(-13,-11,5,7),e.fillStyle=this.hexToRgba("#08202D",.72),e.fillRect(-8,2,4,3),e.fillRect(0,2,4,3),e.fillRect(7,2,4,3);else if(t==="equipment"){for(let o=0;o<8;o+=1)e.save(),e.rotate(Math.PI*2*o/8),e.fillRect(8,-2,5,4),e.restore();e.beginPath(),e.arc(0,0,9,0,Math.PI*2),e.fill(),e.fillStyle=this.hexToRgba("#FFFFFF",.98),e.beginPath(),e.arc(0,0,4,0,Math.PI*2),e.fill()}else t==="service"?(e.beginPath(),e.moveTo(0,-13),e.lineTo(12,-7),e.lineTo(9,6),e.quadraticCurveTo(0,14,-9,6),e.lineTo(-12,-7),e.closePath(),e.fill(),e.strokeStyle=this.hexToRgba("#FFFFFF",.94),e.lineWidth=2.4,e.beginPath(),e.moveTo(0,-7),e.lineTo(0,6),e.moveTo(-6,-1),e.lineTo(6,-1),e.stroke()):(e.beginPath(),e.arc(0,0,7,0,Math.PI*2),e.fill());e.restore()}ensureYakIndustryPointLabelGroup(){this.yakIndustryPointLabelGroup||(this.yakIndustryPointLabelGroup=new Te,this.yakIndustryPointLabelGroup.name="yak-industry-point-labels",this.yakIndustryPointLabelGroup.rotation.x=-Math.PI/2,this.yakIndustryPointLabelGroup.visible=!1,this.scene.add(this.yakIndustryPointLabelGroup))}clearYakIndustryPointLabels(){var e;this.yakIndustryPointLabelGroup&&(this.yakIndustryPointLabelGroup.visible=!1),(e=this.yakIndustryPointLabels)==null||e.forEach(t=>{var a;t.visible=!1,(a=t.hide)==null||a.call(t)})}getYakIndustryLabelFeatures(e,t){const a=this.getVisibleVectorFeatures(e,t).filter(c=>{var p;return((p=c==null?void 0:c.geometry)==null?void 0:p.type)==="Point"}),n=Number(e==null?void 0:e.pointLabelLimit)||(a.length>36?12:Math.min(a.length,16)),r=a.map(c=>{var p;return{feature:c,score:this.getYakIndustryFeatureScore(c),town:nt((p=c.properties)==null?void 0:p.town)}}).sort((c,p)=>{var y,g;return p.score-c.score||String(((y=c.feature.properties)==null?void 0:y.name)||"").localeCompare(String(((g=p.feature.properties)==null?void 0:g.name)||""),"zh-CN")}),o=[],u=new Set;return r.forEach(c=>{o.length>=n||!c.town||u.has(c.town)||(o.push(c.feature),u.add(c.town))}),r.forEach(c=>{o.length>=n||o.includes(c.feature)||o.push(c.feature)}),o}getYakIndustryFeatureScore(e){const t=(e==null?void 0:e.properties)||{},a=[t.outputValue,t.capacity,t.value,t.count,t["年产值 (万元)"],t["年总产值 (万元)"],t["设计存栏量 (头)"],t["总库容 (吨)"]].map(n=>this.parseMapMetricNumber(n));return Math.max(...a,0)}parseMapMetricNumber(e){if(typeof e=="number")return Number.isFinite(e)?e:0;const t=String(e!=null?e:"").replace(/,/g,"").match(/-?\d+(?:\.\d+)?/);return t&&Number(t[0])||0}getYakIndustryPointLabelPosition(e,t=0){var n;const a=this.lngLatToLayerLocalPoint((n=e==null?void 0:e.geometry)==null?void 0:n.coordinates,this.depth+.42+Math.min(t,5)*.01);return a.x+=(t%3-1)*.08,a.y+=t%2===0?.07:-.06,a}getYakIndustryPointLabelHtml(e){const t=(e==null?void 0:e.properties)||{},a=this.compactYakIndustryLabelName(t.name||t.fullName||"产业主体"),n=this.formatYakIndustryLabelText(t.categoryName||t.stageName||"产业主体"),r=t.town||t.village||"红原县",o=this.getYakIndustryPointMetricText(t),u=this.getYakIndustryLabelColor(t);return`
${Se(n)}
${Se(a)}
${Se(r)} ${o?`${Se(o)}`:""}
`}compactYakIndustryLabelName(e=""){const t=String(e).replace(/^四川红原/,"").replace(/^红原县/,"").replace(/有限责任公司$/,"").replace(/农民专业合作社$/,"合作社").replace(/\s+/g," ").trim();return t.length>16?`${t.slice(0,15)}…`:t}formatYakIndustryLabelText(e=""){return String(e).replace(/\bcxpt[-_./\s]*/gi,"").replace(/^cxpt/i,"").replace(/\s+/g," ").trim()}getYakIndustryPointMetricText(e={}){return e.capacity!==void 0&&e.capacity!==null&&e.capacity!==""&&this.parseMapMetricNumber(e.capacity)>0?this.formatYakIndustryMetricText(e.capacity,e.capacityUnit):this.parseMapMetricNumber(e.outputValue)>0?`${this.formatMapRankingValue(e.outputValue)}万元`:this.isMeaningfulMapText(e.locationType)?e.locationType:this.isMeaningfulMapText(e.status)?e.status:""}isMeaningfulMapText(e){const t=String(e!=null?e:"").trim();return!!(t&&t!=="0"&&t!=="无"&&t!=="待完善")}formatYakIndustryMetricText(e,t=""){const a=String(e!=null?e:"").trim();return!a||a==="0"?"":typeof e=="string"&&/[^\d.,\s-]/.test(a)?a:`${this.formatMapRankingValue(e)}${t||""}`}getYakIndustryLabelColor(e={}){var n,r,o,u,c,p;const t=String(e.stageKey||""),a=(((n=this.currentTopicLayer)==null?void 0:n.legends)||[]).find(y=>{var g;return String(((g=y.match)==null?void 0:g.value)||"")===t})||(String(((u=(o=(r=this.currentTopicLayer)==null?void 0:r.activeLegend)==null?void 0:o.match)==null?void 0:u.value)||"")===t?this.currentTopicLayer.activeLegend:null);return(a==null?void 0:a.fillColor)||((p=(c=this.currentTopicLayer)==null?void 0:c.activeLegend)==null?void 0:p.fillColor)||"#24F6C4"}clipVectorLayerContext(e,t){if(this.shouldClipLayerToHongyuanBoundary(t)&&this.clipContextToHongyuanBoundary(e),!this.shouldClipLayerToLayerBounds(t))return;const a=this.getLayerClipBounds(t);if(!a)return;const n=this.lngLatToLayerCanvasPoint([a.west,a.north]),r=this.lngLatToLayerCanvasPoint([a.east,a.south]),o=Math.min(n.x,r.x),u=Math.min(n.y,r.y),c=Math.abs(r.x-n.x),p=Math.abs(r.y-n.y);!c||!p||(e.beginPath(),e.rect(o,u,c,p),e.clip())}clipContextToHongyuanBoundary(e){const t=this.hongyuanBoundaryPolygons||[];t.length&&(e.beginPath(),t.forEach(a=>{a.forEach(n=>{n.forEach((r,o)=>{const u=this.lngLatToLayerCanvasPoint(r);o===0?e.moveTo(u.x,u.y):e.lineTo(u.x,u.y)}),e.closePath()})}),e.clip("evenodd"))}shouldClipLayerToHongyuanBoundary(e=this.currentTopicLayer){if(!e||e.clipToHongyuanBoundary===!1)return!1;if(e.clipToHongyuanBoundary===!0)return!0;const t=String((e==null?void 0:e.key)||"");return!!(t==="national-park-zoning"||t.startsWith("yak-"))}shouldClipLayerToLayerBounds(e=this.currentTopicLayer){return!!(e!=null&&e.clipBounds&&(e==null?void 0:e.clipToLayerBounds)!==!1)}isLngLatInHongyuanBoundary(e){const t=this.hongyuanBoundaryPolygons||[];return t.length?t.some(a=>this.isLngLatInPolygon(e,a)):!0}isLngLatInLayerClipBounds(e,t=this.currentTopicLayer){const a=this.getLayerClipBounds(t);return a?e.lng>=a.west&&e.lng<=a.east&&e.lat>=a.south&&e.lat<=a.north:!0}getLayerClipBounds(e){const t=e==null?void 0:e.clipBounds;if(!t)return null;const a=Math.max(Number(t.west),j.west),n=Math.max(Number(t.south),j.south),r=Math.min(Number(t.east),j.east),o=Math.min(Number(t.north),j.north);return![a,n,r,o].every(Number.isFinite)||a>=r||n>=o?null:{west:a,south:n,east:r,north:o}}getGeometryDrawRank(e){return String(e).includes("Polygon")?1:String(e).includes("LineString")?2:3}isEcologicalProjectLayer(e=this.currentTopicLayer){return["restoration-projects","engineering-analysis-projects"].includes(e==null?void 0:e.key)}getVectorFeatureStyle(e,t){var c,p,y;const a=t.properties||{},r=(e.legends||[]).find(g=>{var L,T;return(((L=g==null?void 0:g.matches)==null?void 0:L.length)||((T=g==null?void 0:g.match)==null?void 0:T.field))&&this.featureMatchesLegend(a,g)})||e.activeLegend||((c=e.legends)==null?void 0:c[0])||{},o=String(((p=t.geometry)==null?void 0:p.type)||"").includes("LineString"),u=((y=t.geometry)==null?void 0:y.type)==="Point";if(this.isEcologicalProjectLayer(e)){const g=o||String(a.feature_role||"")==="线性设施";return{fill:g||u?r.strokeColor||r.fillColor||"#D2EA78":r.fillColor||"#75AD49",stroke:r.strokeColor||r.fillColor||"#D2EA78",polygonAlpha:g?.08:.22,lineAlpha:g?.9:.82,lineWidth:g?3:1.85,pointRadius:u?3.8:4,glow:!1}}return(e==null?void 0:e.key)==="yak-epidemic-village-boundary"?{fill:r.fillColor||"#24F6C4",stroke:r.strokeColor||"#C9FBFF",polygonAlpha:.16,lineAlpha:1,lineWidth:3.2,pointRadius:4.5,glow:!0}:(e==null?void 0:e.key)==="artificial-grassland-plots"?{fill:r.fillColor||"#24F6C4",stroke:r.strokeColor||"#A7F8FF",polygonAlpha:.2,lineAlpha:.94,lineWidth:1.6,pointRadius:4.5,glow:!0}:(e==null?void 0:e.key)==="yak-industry-points"?{fill:r.fillColor||"#24F6C4",stroke:r.strokeColor||r.fillColor||"#B7FFF2",polygonAlpha:.36,lineAlpha:.82,lineWidth:1.6,pointRadius:this.getVectorPointRadius(e,t),glow:!0,halo:!0,marker:!0,markerType:$r[String(a.stageKey||"")]||"point"}:(e==null?void 0:e.key)==="national-park-zoning"?{fill:r.fillColor||"#30DCFF",stroke:r.strokeColor||"#F2FFFF",polygonAlpha:.38,lineAlpha:.96,lineWidth:2.7,pointRadius:4.5,glow:!1}:e!=null&&e.boundaryOnly?{fill:r.fillColor||"#24F6C4",stroke:r.strokeColor||r.fillColor||"#18F8FF",polygonAlpha:.04,lineAlpha:.96,lineWidth:10,pointRadius:4.5,glow:!0}:{fill:o||u?r.strokeColor||r.fillColor||"#30DCFF":r.fillColor||"#30DCFF",stroke:r.strokeColor||r.fillColor||"#30DCFF",polygonAlpha:.36,lineAlpha:o?.92:.9,lineWidth:o?5:2.4,pointRadius:u?this.getVectorPointRadius(e,t):4.5,glow:!0}}getVectorPointRadius(e,t){var n,r;const a=Number(((n=t==null?void 0:t.properties)==null?void 0:n.count)||((r=t==null?void 0:t.properties)==null?void 0:r.value)||0);return(e==null?void 0:e.key)==="yak-recognition-layer"?Math.max(3.8,Math.min(8.6,3.6+Math.sqrt(a)/68)):(e==null?void 0:e.key)==="yak-industry-points"?10.4:4.5}drawVectorFeature(e,t,a){if(t!=null&&t.coordinates){if(t.type==="Polygon"){this.drawPolygonPath(e,t.coordinates,a);return}if(t.type==="MultiPolygon"){t.coordinates.forEach(n=>this.drawPolygonPath(e,n,a));return}if(t.type==="LineString"){this.drawLinePath(e,t.coordinates,a);return}if(t.type==="MultiLineString"){t.coordinates.forEach(n=>this.drawLinePath(e,n,a));return}t.type==="Point"&&this.drawPointPath(e,t.coordinates,a)}}drawPolygonPath(e,t,a){Array.isArray(t==null?void 0:t[0])&&(e.save(),e.beginPath(),t.forEach(n=>{n.forEach((r,o)=>{const u=this.lngLatToLayerCanvasPoint(r);o===0?e.moveTo(u.x,u.y):e.lineTo(u.x,u.y)}),e.closePath()}),e.fillStyle=this.hexToRgba(a.fill,a.polygonAlpha),e.strokeStyle=this.hexToRgba(a.stroke,a.lineAlpha),e.lineWidth=a.lineWidth,a.glow&&(e.shadowColor=a.stroke,e.shadowBlur=14),e.fill("evenodd"),e.stroke(),e.restore())}drawLinePath(e,t,a){!Array.isArray(t)||t.length<2||(e.save(),e.beginPath(),t.forEach((n,r)=>{const o=this.lngLatToLayerCanvasPoint(n);r===0?e.moveTo(o.x,o.y):e.lineTo(o.x,o.y)}),e.strokeStyle=this.hexToRgba(a.stroke,a.lineAlpha),e.lineWidth=a.lineWidth,e.shadowColor=a.stroke,e.shadowBlur=12,e.stroke(),e.restore())}drawPointPath(e,t,a){var r;if(a.marker){this.drawMarkerPointPath(e,t,a);return}const n=this.lngLatToLayerCanvasPoint(t);e.save(),a.halo&&(e.beginPath(),e.arc(n.x,n.y,a.pointRadius*2.35,0,Math.PI*2),e.fillStyle=this.hexToRgba(a.fill,.18),e.shadowColor=a.fill,e.shadowBlur=18,e.fill()),e.beginPath(),e.arc(n.x,n.y,a.pointRadius,0,Math.PI*2),e.fillStyle=this.hexToRgba(a.fill,.96),e.shadowColor=a.stroke,e.shadowBlur=a.halo?8:12,e.fill(),a.lineWidth&&(e.lineWidth=a.lineWidth,e.strokeStyle=this.hexToRgba(a.stroke,(r=a.lineAlpha)!=null?r:.9),e.stroke()),e.restore()}drawMarkerPointPath(e,t,a){const n=this.lngLatToLayerCanvasPoint(t),r=a.pointRadius||6;e.save(),e.beginPath(),e.arc(n.x,n.y+r*.22,r*2.55,0,Math.PI*2),e.fillStyle=this.hexToRgba(a.fill,.16),e.shadowColor=a.fill,e.shadowBlur=24,e.fill(),e.beginPath(),e.moveTo(n.x,n.y+r*2.05),e.bezierCurveTo(n.x+r*1.46,n.y+r*.62,n.x+r*1.34,n.y-r*1.34,n.x,n.y-r*1.62),e.bezierCurveTo(n.x-r*1.34,n.y-r*1.34,n.x-r*1.46,n.y+r*.62,n.x,n.y+r*2.05),e.closePath(),e.fillStyle=this.hexToRgba(a.fill,.94),e.strokeStyle=this.hexToRgba(a.stroke,.98),e.lineWidth=Math.max(2,a.lineWidth||2),e.shadowColor=a.stroke,e.shadowBlur=14,e.fill(),e.stroke(),e.beginPath(),e.arc(n.x,n.y-r*.34,r*.52,0,Math.PI*2),e.fillStyle=this.hexToRgba("#FFFFFF",.96),e.shadowBlur=0,e.fill(),e.beginPath(),e.arc(n.x,n.y-r*.34,r*.82,0,Math.PI*2),e.lineWidth=Math.max(1.2,r*.14),e.strokeStyle=this.hexToRgba("#FFFFFF",.42),e.stroke(),e.restore()}lngLatToLayerCanvasPoint(e){const t=Number(e==null?void 0:e[0]),a=Number(e==null?void 0:e[1]);return{x:(t-j.west)/(j.east-j.west)*this.topicLayerCanvas.width,y:(j.north-a)/(j.north-j.south)*this.topicLayerCanvas.height}}hexToRgba(e,t=1){const a=String(e||"#30DCFF").replace("#",""),n=a.length===3?a.split("").map(p=>p+p).join(""):a,r=Number.parseInt(n,16);if(!Number.isFinite(r))return`rgba(48, 220, 255, ${t})`;const o=r>>16&255,u=r>>8&255,c=r&255;return`rgba(${o}, ${u}, ${c}, ${t})`}parseWktGeometry(e){var o;const t=String(e||"").trim();if(!t)return null;const a=t.match(/^([A-Z]+)(?:\s+[A-Z]+)?\s*\(/i),n=(o=a==null?void 0:a[1])==null?void 0:o.toUpperCase();if(!n)return null;const r=t.slice(t.indexOf("("));return n==="POLYGON"?{type:"Polygon",coordinates:this.parseWktPolygonBody(r)}:n==="MULTIPOLYGON"?{type:"MultiPolygon",coordinates:this.parseWktMultiPolygonBody(r)}:n==="POINT"?{type:"Point",coordinates:this.parseWktPoint(r)}:n==="MULTIPOINT"?{type:"MultiPoint",coordinates:this.getWktChildGroups(r).map(u=>this.parseWktPoint(u)).filter(Boolean)}:n==="LINESTRING"?{type:"LineString",coordinates:this.parseWktRing(r)}:n==="MULTILINESTRING"?{type:"MultiLineString",coordinates:this.getWktChildGroups(r).map(u=>this.parseWktRing(u)).filter(u=>u.length)}:null}parseWktMultiPolygonBody(e){return this.getWktChildGroups(e).map(t=>this.parseWktPolygonBody(t)).filter(t=>t.length)}parseWktPolygonBody(e){return this.getWktChildGroups(e).map(t=>this.parseWktRing(t)).filter(t=>t.length>=3)}getWktChildGroups(e){const t=String(e||"").trim(),a=t.startsWith("(")&&t.endsWith(")")?t.slice(1,-1):t,n=[];let r=0,o=-1;for(let u=0;u=0&&(n.push(a.slice(o,u+1)),o=-1))}return n.length?n:[a]}parseWktRing(e){return String(e||"").replace(/^\(+|\)+$/g,"").split(",").map(a=>a.trim().split(/\s+/).slice(0,2).map(Number)).filter(([a,n])=>Number.isFinite(a)&&Number.isFinite(n))}parseWktPoint(e){const t=String(e||"").replace(/^\(+|\)+$/g,"").trim().split(/\s+/).slice(0,2).map(Number);return t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1])?[t[0],t[1]]:null}createProvinceMaterial(){const e=!this.useSatelliteBase;let t=new Hn({color:16777215,transparent:!0,opacity:0,depthWrite:!this.usesCustomSatelliteTiles,fog:!1,side:Re});t.onBeforeCompile=r=>{r.uniforms=$(F({},r.uniforms),{uColor1:{value:new gt(e?2780818:2152676)},uColor2:{value:new gt(e?1058614:475482)}}),r.vertexShader=r.vertexShader.replace("void main() {",` attribute float alpha; varying vec3 vPosition; varying float vAlpha; void main() { vAlpha = alpha; vPosition = position; `),r.fragmentShader=r.fragmentShader.replace("void main() {",` varying vec3 vPosition; varying float vAlpha; uniform vec3 uColor1; uniform vec3 uColor2; void main() { `),r.fragmentShader=r.fragmentShader.replace("#include ",` #ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= transmissionAlpha + 0.1; #endif vec3 gradient = mix(uColor1, uColor2, vPosition.x/15.78); ${e?`outgoingLight = outgoingLight * gradient; float topAlpha = 0.56;`:`outgoingLight = mix(outgoingLight * vec3(1.18), outgoingLight * gradient, 0.32); float topAlpha = 0.92;`} if(vPosition.z>0.3){ diffuseColor.a *= topAlpha; } gl_FragColor = vec4( outgoingLight, diffuseColor.a ); `)};let a=this.assets.instance.getResource("side");a.wrapS=at,a.wrapT=at,a.repeat.set(1,1.8),a.offset.y+=.065;let n=new en({color:2148829,map:a,fog:!1,opacity:0,side:Re,roughness:.58,metalness:.08});return this.time.on("tick",()=>{a.offset.y+=.005}),n.onBeforeCompile=r=>{r.uniforms=$(F({},r.uniforms),{uColor1:{value:new gt(1629410)},uColor2:{value:new gt(205365)}}),r.vertexShader=r.vertexShader.replace("void main() {",` attribute float alpha; varying vec3 vPosition; varying float vAlpha; void main() { vAlpha = alpha; vPosition = position; `),r.fragmentShader=r.fragmentShader.replace("void main() {",` varying vec3 vPosition; varying float vAlpha; uniform vec3 uColor1; uniform vec3 uColor2; void main() { `),r.fragmentShader=r.fragmentShader.replace("#include ",` #ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= transmissionAlpha + 0.1; #endif vec3 gradient = mix(uColor1, uColor2, vPosition.z/1.2); outgoingLight = outgoingLight*gradient*vec3(1.12); gl_FragColor = vec4( outgoingLight, diffuseColor.a ); `)},[t,n]}getDefaultTownRanking(){return{title:"乡镇统计加载中",unit:"",rows:Nr.map(e=>({name:e.name,value:0,unit:""}))}}getTownRankingMeta(e=this.currentTownRanking){var n,r,o,u;const t=this.getDefaultTownRanking(),a=zu(e);return{title:(e==null?void 0:e.title)||t.title,unit:(e==null?void 0:e.unit)||t.unit,metricLabel:(e==null?void 0:e.metricLabel)||(e==null?void 0:e.legendName)||"",note:(e==null?void 0:e.note)||"",hideTownNames:Or(e),hideMapLabels:Ma(e),hideTownLabelStats:(n=e==null?void 0:e.hideTownLabelStats)!=null?n:this.hideTownLabelStatsByDefault,calloutMode:a,showBars:(r=e==null?void 0:e.showBars)!=null?r:!1,showPointMarkers:(o=e==null?void 0:e.showPointMarkers)!=null?o:a,onlyRankedTownLabels:(u=e==null?void 0:e.onlyRankedTownLabels)!=null?u:!1,showMissingTownStats:(e==null?void 0:e.showMissingTownStats)===!0}}getTownRankingRows(e=this.currentTownRanking,t=7,a=!0){var c;const n=this.getDefaultTownRanking(),r=(c=e==null?void 0:e.rows)!=null&&c.length?e.rows:a?n.rows:[],o=this.getTownRankingMeta(e),u=r.map(p=>{const y=this.townMetaByName.get(nt(p.name));return y?$(F(F({},y),p),{name:y.name,enName:y.enName,center:y.center,centroid:y.centroid,value:ue(p.value),unit:p.unit||o.unit,metricTitle:o.title}):null}).filter(Boolean).sort((p,y)=>y.value-p.value).map((p,y)=>$(F({},p),{rank:y+1}));return Number.isFinite(t)?u.slice(0,t):u}getVillageRankingRows(e=this.currentTownRanking){const t=this.getTownRankingMeta(e);return((e==null?void 0:e.rows)||[]).map((a,n)=>{var p,y,g,L,T,C,N,B;const r=ue((p=a.lng)!=null?p:a.longitude,NaN),o=ue((y=a.lat)!=null?y:a.latitude,NaN);if(!Number.isFinite(r)||!Number.isFinite(o))return null;const u=ue((g=a.displayValue)!=null?g:a.value),c=ue((C=(T=(L=a.rawValue)!=null?L:a.earTagCount)!=null?T:a.ear_tag_count)!=null?C:a.value);return $(F({},a),{key:a.key||`${a.town||""}-${a.village||a.name||n}`,name:a.name||a.village||`村${n+1}`,town:a.town||"",lng:r,lat:o,value:u,rawValue:c,recordCount:ue((N=a.recordCount)!=null?N:a.record_count,0),imageRate:ue((B=a.imageRate)!=null?B:a.image_rate,0),unit:a.displayUnit||a.unit||t.unit,metricTitle:t.title,metricLabel:a.metricLabel||t.metricLabel||""})}).filter(Boolean).sort((a,n)=>n.rawValue-a.rawValue).map((a,n)=>$(F({},a),{rank:n+1}))}getVillageRankingHtml(e,t){const a=t.hideTownNames?"":`${Se(e.town||"红原县")}`;return e.displayMode==="park-village"||t.displayMode==="park-village"?`
${Se(e.name)} ${a}
${Se(e.metricLabel||t.metricLabel||"")} ${this.formatMapRankingValue(e.value)} ${Se(e.unit||t.unit||"")}
`:`
${Se(e.name)} ${a}
${Se(e.metricLabel||"防疫")} ${this.formatMapRankingValue(e.value)} ${Se(e.unit||t.unit||"")}
台账 ${this.formatMapCompactValue(e.recordCount)}条 耳标 ${this.formatMapCompactValue(e.rawValue)}头
`}ensureVillageRankingGroup(){this.villageRankingGroup||(this.villageRankingGroup=new Te,this.villageRankingGroup.rotation.x=-Math.PI/2,this.villageRankingGroup.visible=!1,this.scene.add(this.villageRankingGroup),this.villageRankingLabels=[])}hideVillageRankingLabels(){var e;this.villageRankingGroup&&(this.villageRankingGroup.visible=!1),(e=this.villageRankingLabels)==null||e.forEach(t=>{t.visible=!1})}hideAllMapStatisticLabels(){var e,t,a,n;this.updateTownNameLabelStats(null),this.setTownNameLabelsVisible(!1),this.hideVillageRankingLabels(),this.hideTradeFlowLayer(),this.clearInfoPointStats(),(e=this.allProvinceLabel)==null||e.forEach(r=>{r.visible=!1}),(t=this.allBar)==null||t.forEach(r=>{r.visible=!1,r.scale.set(1,1,0)}),(a=this.allBarMaterial)==null||a.forEach(r=>{r.opacity=0}),(n=this.allGuangquan)==null||n.forEach(r=>{r.visible=!1})}setTownNameLabelsVisible(e=!0){var t;(t=this.townNameLabels)==null||t.forEach(a=>{a.visible=e})}updateVillageRankingLabels(e=this.currentTownRanking){if(this.ensureVillageRankingGroup(),!Dr(e)){this.hideVillageRankingLabels();return}const t=this.getVillageRankingRows(e),a=this.getTownRankingMeta(e);if(!t.length){this.hideVillageRankingLabels();return}this.villageRankingGroup.visible=this.mapAnimationComplete,t.forEach((n,r)=>{let o=this.villageRankingLabels[r];o||(o=this.label3d.create("","epidemic-village-label",!0),this.label3d.setLabelStyle(o,.0135,"x"),o.setParent(this.villageRankingGroup),this.villageRankingLabels.push(o));const[u,c]=this.geoProjection([n.lng,n.lat]),p=(r%3-1)*.06,y=Math.floor(r/3)%2*.04;o.init(this.getVillageRankingHtml(n,a),new te(u+p,-c+y,this.depth+1.55+Math.min(r,6)*.015)),o.visible=!0,o.userData=F({},n)}),this.villageRankingLabels.slice(t.length).forEach(n=>{n.visible=!1})}ensureTradeFlowGroup(){this.tradeFlowGroup||(this.tradeFlowGroup=new Te,this.tradeFlowGroup.name="yak-trade-flow",this.tradeFlowGroup.visible=!1,this.tradeFlowMeshGroup=new Te,this.tradeFlowMeshGroup.name="yak-trade-flow-mesh",this.tradeFlowMeshGroup.rotation.x=-Math.PI/2,this.tradeFlowLabelGroup=new Te,this.tradeFlowLabelGroup.name="yak-trade-flow-label",this.tradeFlowLabelGroup.rotation.x=-Math.PI/2,this.tradeFlowGroup.add(this.tradeFlowMeshGroup,this.tradeFlowLabelGroup),this.scene.add(this.tradeFlowGroup))}hideTradeFlowLayer(){var e,t;this.tradeFlowGroup&&(this.tradeFlowGroup.visible=!1),(e=this.tradeFlowLabels)==null||e.forEach(a=>{a.visible=!1}),(t=this.tradeFlowPulseSprites)==null||t.forEach(a=>{a.visible=!1})}clearTradeFlowLayer(){this.tradeFlowMeshGroup&&(this.tradeFlowMeshGroup.children.forEach(e=>{var t;(t=e.traverse)==null||t.call(e,a=>this.disposeObject3D(a))}),this.tradeFlowMeshGroup.clear(),this.tradeFlowMaterials=[],this.tradeFlowPulseSprites=[])}getTradeFlowSource(e=this.currentTownRanking){var r,o,u,c;const t=(e==null?void 0:e.source)||{},a=ue((r=t.lng)!=null?r:t.longitude,NaN),n=ue((o=t.lat)!=null?o:t.latitude,NaN);return!Number.isFinite(a)||!Number.isFinite(n)?null:{name:t.name||"红原牦牛交易市场",lng:a,lat:n,total:ue((c=(u=t.total)!=null?u:t.headCount)!=null?c:t.value,NaN)}}getTradeFlowRows(e=this.currentTownRanking){const t=this.getTownRankingMeta(e);return((e==null?void 0:e.rows)||[]).map((a,n)=>{var L,T,C,N,B,z;const r=ue((L=a.lng)!=null?L:a.longitude,NaN),o=ue((T=a.lat)!=null?T:a.latitude,NaN),u=ue((B=(N=(C=a.headCount)!=null?C:a.head_count)!=null?N:a.rawValue)!=null?B:a.value),c=a.displayName||a.display_name||a.name,p=a.mapTownName||a.map_town_name||a.town||a.startTown||a.start_town||c,y=this.townMetaByName.get(nt(p)),g=Number.isFinite(r)&&Number.isFinite(o)?{lng:r,lat:o}:y!=null&&y.center?{lng:y.center[0],lat:y.center[1]}:null;return!g||!Number.isFinite(u)?null:$(F(F({},a),y),{key:a.key||`${(y==null?void 0:y.name)||c||p||"trade-source"}-${n}`,name:c||p||(y==null?void 0:y.name)||`来源${n+1}`,townName:(y==null?void 0:y.name)||p,lng:g.lng,lat:g.lat,labelSide:a.labelSide||a.label_side||this.getTradeSourceLabelSide(y,n),value:u,headCount:u,recordCount:ue((z=a.recordCount)!=null?z:a.record_count,0),unit:a.unit||t.unit||"头"})}).filter(Boolean).sort((a,n)=>n.value-a.value).map((a,n)=>$(F({},a),{rank:n+1}))}getTradeMarketHtml(e,t){const a=Number.isFinite(e.total)?e.total:t.reduce((n,r)=>n+ue(r.value),0);return`
${Se(e.name)}
${this.formatMapIntegerValue(a)}头
`}getTradeFlowDisplayName(e=""){const t=String(e||"").replace(/^.*红原县/,"").replace(/\s+/g,"");return t.length>7?`${t.slice(0,7)}…`:t||"来源区域"}getTradeFlowLabelHtml(e){return`
${String(e.rank).padStart(2,"0")}${Se(this.getTradeFlowDisplayName(e.name))}
${this.formatMapIntegerValue(e.value)}${Se(e.unit||"头")}
`}getTradeFlowLabelOffset(e,t){return new te(0,0,0)}getTradeSourceLabelSide(e,t=0){var r,o;const a=Number((r=e==null?void 0:e.center)==null?void 0:r[0]),n=Number((o=e==null?void 0:e.center)==null?void 0:o[1]);return Number.isFinite(a)&&athis.geoProjectionCenter[0]+.2?"right":Number.isFinite(n)&&n>this.geoProjectionCenter[1]+.22?"top":Number.isFinite(n)&&n0&&(c.normalize().multiplyScalar((a%2===0?1:-1)*Math.min(.18,.05+u*.02)),o.add(c)),new $l([n,o,r])}tradeGeoProjection(e){return Kt().center(this.tradeGeoProjectionCenter).scale(this.tradeGeoProjectionScale).translate([0,0])(e)}setTradeNationalMapVisible(e){const t=!!e;if(!(!t&&!this.isTradeNationalMapActive&&!this.tradeNationalMapGroup&&!this.tradeFlowGroup)){if(t&&!this.createTradeNationalMap()){this.isTradeNationalMapActive=!1;return}this.isTradeNationalMapActive=t,this.tradeNationalMapGroup&&(this.tradeNationalMapGroup.visible=t&&this.mapAnimationComplete),this.tradeNationalLabelGroup&&(this.tradeNationalLabelGroup.visible=t&&this.mapAnimationComplete),this.mapGroup&&(this.mapGroup.visible=!t),this.labelGroup&&(this.labelGroup.visible=!t),this.flyLineGroup&&(this.flyLineGroup.visible=!t&&this.mapAnimationComplete),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=!t&&this.mapAnimationComplete),this.scatterGroup&&(this.scatterGroup.visible=!t&&this.mapAnimationComplete),this.topicLayerMaterial&&t&&(this.topicLayerMaterial.opacity=0),t&&this.mapAnimationComplete?this.animateMapCamera(new te(0,11.4,16.2),new te(0,-.05,0),.65):!t&&this.mapAnimationComplete&&this.applyLayerMapView(this.currentTopicLayer,{force:!0})}}createTradeSourceMarker(e,t,a,n,r=!0){const o=new gt(t%3===1?16766828:t%3===2?2617536:3202303),u=this.getTradeFlowPoint(e,.72);if(n&&r){const N=this.getLocalTradeFlowCurve(e,n,t),B=new ye({color:o,transparent:!0,opacity:.42,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),z=.012+Math.min(.012,ue(e.value)/Math.max(a,1)*.01),X=new je(new Vl(N,48,z,8,!1),B);X.renderOrder=31,this.tradeFlowMeshGroup.add(X),this.tradeFlowMaterials.push(B);const ae=new ia({map:this.assets.instance.getResource("point"),color:o,transparent:!0,opacity:.92,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),q=new na(ae),I=.12+Math.min(.08,ue(e.value)/Math.max(a,1)*.06);q.renderOrder=36,q.scale.set(I,I,I),q.userData={curve:N,phase:t*.13%1,speed:.16+Math.min(.16,ue(e.value)/Math.max(a,1)*.12)},q.position.copy(N.getPointAt(q.userData.phase)),this.tradeFlowPulseSprites.push(q),this.tradeFlowMeshGroup.add(q)}const c=new ia({map:this.assets.instance.getResource("point"),color:o,transparent:!0,opacity:.95,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),p=new na(c),y=.22+Math.min(.34,ue(e.value)/Math.max(a,1)*.28);p.renderOrder=34,p.scale.set(y,y,y),p.position.copy(u),this.tradeFlowMeshGroup.add(p);const g=this.assets.instance.getResource("guangquan1"),L=new ye({map:g,alphaMap:g,color:o,transparent:!0,opacity:.52,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie,side:Re}),T=.38+Math.min(.36,ue(e.value)/Math.max(a,1)*.28),C=new je(new $t(T,T),L);C.renderOrder=29,C.position.copy(this.getTradeFlowPoint(e,.5)),this.tradeFlowMeshGroup.add(C)}createTradeMarketMarker(e){const t=this.assets.instance.getResource("point"),a=this.assets.instance.getResource("guangquan1"),n=this.getTradeLocalPoint(e.lng,e.lat,.82),r=new ia({map:t,color:16773997,transparent:!0,opacity:1,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),o=new na(r);o.renderOrder=35,o.scale.set(.34,.34,.34),o.position.copy(n),this.tradeFlowMeshGroup.add(o);const u=new ye({map:a,alphaMap:a,color:16773997,transparent:!0,opacity:.72,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie,side:Re}),c=new je(new $t(.58,.58),u);c.renderOrder=29,c.position.copy(this.getTradeLocalPoint(e.lng,e.lat,.58)),this.tradeFlowMeshGroup.add(c)}disposeObject3D(e){var t,a,n,r;(a=(t=e.geometry)==null?void 0:t.dispose)==null||a.call(t),Array.isArray(e.material)?e.material.forEach(o=>{var u;return(u=o==null?void 0:o.dispose)==null?void 0:u.call(o)}):(r=(n=e.material)==null?void 0:n.dispose)==null||r.call(n)}updateTradeFlowPulses(e=.016){var t,a;!((t=this.tradeFlowGroup)!=null&&t.visible)||!((a=this.tradeFlowPulseSprites)!=null&&a.length)||this.tradeFlowPulseSprites.forEach(n=>{var u;const r=(u=n.userData)==null?void 0:u.curve;if(!r)return;const o=(ue(n.userData.phase)+ue(n.userData.speed,.16)*e)%1;n.userData.phase=o,n.position.copy(r.getPointAt(o))})}updateTradeFlowLayer(e=this.currentTownRanking){if(!zr(e)){this.hideTradeFlowLayer();return}this.ensureTradeFlowGroup();const t=this.getTradeFlowSource(e),a=this.getTradeFlowRows(e);if(!t||!a.length){this.clearTradeFlowLayer(),this.hideTradeFlowLayer();return}this.clearTradeFlowLayer(),this.tradeFlowGroup.visible=this.mapAnimationComplete;const n=Du(e);this.createTradeMarketMarker(t);const r=Math.max(...a.map(c=>c.value),1);a.forEach((c,p)=>{this.createTradeSourceMarker(c,p,r,t,n)});const o=a.length+1;for(let c=this.tradeFlowLabels.length;c{const y=this.tradeFlowLabels[p+1];y.element.className="trade-flow-label",y.init(this.getTradeFlowLabelHtml(c),this.getTradeFlowPoint(c,.78).add(this.getTradeFlowLabelOffset(c,p))),y.visible=!0,y.userData=F({},c)}),this.tradeFlowLabels.slice(o).forEach(c=>{c.visible=!1})}hasTownRankingRows(e=this.currentTownRanking){return this.getTownRankingRows(e,Number.POSITIVE_INFINITY,!1).length>0}formatMapRankingValue(e){const t=ue(e);return Math.abs(t)>=100?String(Math.round(t)):Math.abs(t)>=10?String(Number(t.toFixed(1))):String(Number(t.toFixed(2)))}formatMapCompactValue(e){const t=ue(e);return Math.abs(t)>=1e4?`${Number((t/1e4).toFixed(Math.abs(t)>=1e5?1:2))}万`:Math.abs(t)>=1e3?`${Number((t/1e3).toFixed(1))}千`:this.formatMapRankingValue(t)}formatMapIntegerValue(e){const t=ue(e);return Math.round(t).toLocaleString("zh-CN")}getBarHeight(e,t){return t?Math.max(2.8*.12,2.8*(ue(e)/t)):2.8*.25}createBarGeometry(e){const a=new Dl(.06999999999999999,.06999999999999999,e);return a.translate(0,0,e/2),a}getProvinceLabelHtml(e,t,a){return`
${a.title}
${this.formatMapRankingValue(e.value)}${e.unit||a.unit}
${e.name}
${t+1}
`}updateBarItem(e,t,a,n,r=!0){var p,y;const o=this.getBarHeight(t.value,n),[u,c]=this.geoProjection(t.centroid);return e.visible=!0,(y=(p=e.geometry)==null?void 0:p.dispose)==null||y.call(p),e.geometry=this.createBarGeometry(o),e.position.set(u,-c,this.depth+.45),e.userData=$(F({},t),{targetValue:t.value,geoHeight:o}),e.children.forEach(g=>{var L,T,C,N;(T=(L=g.geometry)==null?void 0:L.dispose)==null||T.call(L),Array.isArray(g.material)?g.material.forEach(B=>{var z;return(z=B==null?void 0:B.dispose)==null?void 0:z.call(B)}):(N=(C=g.material)==null?void 0:C.dispose)==null||N.call(C)}),e.clear(),e.add(...this.createHUIGUANG(o,a>3?16776948:7863285)),r?sa.to(e.scale,{duration:.45,x:1,y:1,z:1,ease:"power2.out"}):this.mapAnimationComplete&&e.scale.set(1,1,1),{x:u,y:c,geoHeight:o}}updateProvinceLabel(e,t,a,n,r,o=!0){var C;const u=ue((C=e.userData)==null?void 0:C.targetValue,t.value);e.visible=!0,e.userData=$(F({},t),{targetValue:t.value}),e.position.copy(n);const c=e.element.querySelector(".label-title"),p=e.element.querySelector(".number .value"),y=e.element.querySelector(".number .unit"),g=e.element.querySelector(".name"),L=e.element.querySelector(".no");!c||!p||!y||!g||!L?e.element.innerHTML=this.getProvinceLabelHtml(t,a,r):(c.innerText=r.title,p.dataset.targetValue=String(t.value),p.innerText=this.formatMapRankingValue(t.value),y.innerText=t.unit||r.unit,g.innerText=t.name,L.innerText=a+1);const T=e.element.querySelector(".provinces-label-wrap");if(this.mapAnimationComplete&&(T.style.opacity="1",T.style.transform="translate3d(0, 0, 0)"),o&&this.mapAnimationComplete){const N=e.element.querySelector(".number .value"),z={value:u};sa.to(z,{value:t.value,duration:.45,ease:"power2.out",onUpdate:()=>{N.innerText=this.formatMapRankingValue(z.value)},onComplete:()=>{N.dataset.previousValue=String(t.value),N.innerText=this.formatMapRankingValue(t.value)}})}}clearTownNameLabelStat(e){const t=e.element.querySelector(".town-stat-label"),a=e.element.querySelector(".town-stat-value"),n=e.element.querySelector(".town-stat-unit"),r=e.element.querySelector(".town-rank"),o=e.element.querySelector(".town-stat-metric");t==null||t.classList.remove("has-stat"),e.element.style.pointerEvents="none",e.element.style.cursor="",a&&(a.innerText=""),n&&(n.innerText=""),r&&(r.innerText=""),o&&(o.innerText="")}updateTownNameLabelStats(e=this.currentTownRanking){var o;if(!((o=this.townNameLabels)!=null&&o.length))return;const t=this.getTownRankingRows(e,Number.POSITIVE_INFINITY,!1),a=this.getTownRankingMeta(e);if(a.hideTownLabelStats){this.townNameLabels.forEach(u=>{var y,g;const c=((y=u.userData)==null?void 0:y.townName)||((g=u.userData)==null?void 0:g.name),p=u.element.querySelector(".town-name");p&&(p.innerText=c||""),this.clearTownNameLabelStat(u),u.visible=!a.hideTownNames});return}const n=new Map(t.map(u=>[nt(u.name),u])),r=!!(a.showMissingTownStats&&e&&t.length&&(a.metricLabel||a.unit||a.title));this.townNameLabels.forEach(u=>{var X,ae;const c=((X=u.userData)==null?void 0:X.townName)||((ae=u.userData)==null?void 0:ae.name),p=n.get(nt(c));if(a.onlyRankedTownLabels&&!p){this.clearTownNameLabelStat(u),u.element.style.pointerEvents="none",u.element.style.cursor="",u.visible=!1;return}const y=p||(r?{name:c,value:0,unit:a.unit,metricLabel:a.metricLabel,rank:null}:null);if(!y){this.clearTownNameLabelStat(u),u.element.style.pointerEvents="none",u.element.style.cursor="";return}const g=u.element.querySelector(".town-stat-label"),L=u.element.querySelector(".town-name"),T=u.element.querySelector(".town-stat-value"),C=u.element.querySelector(".town-stat-unit"),N=u.element.querySelector(".town-rank"),B=u.element.querySelector(".town-stat-metric");g==null||g.classList.add("has-stat"),L&&(L.innerText=c),B&&(B.innerText=y.metricLabel||a.metricLabel||""),T&&(T.innerText=this.formatMapRankingValue(y.value)),C&&(C.innerText=y.unit||a.unit||""),N&&(N.innerText=y.rank?`第${y.rank}名`:"");const z=this.isNationalParkTownSelectionActive()&&!!p;u.element.style.pointerEvents=z?"auto":"none",u.element.style.cursor=z?"pointer":"",u.userData=$(F(F({},u.userData),y),{townName:c,targetValue:y.value})})}getInfoPointHtml(e,t=this.getTownRankingMeta()){const a=String(e.metricLabel||t.metricLabel||t.title||"统计指标").replace(/排行$/,""),n=Number(e.rank),r=Number.isFinite(n)?String(n).padStart(2,"0"):"--";return`
${r} ${Se(e.name||"红原县")}
${Se(a)}
${this.formatMapRankingValue(e.value)} ${Se(e.unit||t.unit||"")}
`}updateInfoPointStats(){var o,u;if(!((o=this.infoPointSprites)!=null&&o.length)||!((u=this.infoLabelElement)!=null&&u.length))return;if(!this.showTownRankingPointMarkers){this.clearInfoPointStats();return}const e=this.getTownRankingRows(this.currentTownRanking,Number.POSITIVE_INFINITY,!1);if(!e.length){this.clearInfoPointStats();return}const t=this.getTownRankingMeta(),a=e.slice(0,this.infoPointSprites.length),n=Math.max(...a.map(c=>c.value),1);this.infoPointSprites.forEach((c,p)=>{const y=a[p],g=this.infoLabelElement[p];if(!y){c.visible=!1,c.scale.set(0,0,0),g&&(g.visible=!1);return}const[L,T]=this.geoProjection(y.centroid||y.center),C=[L,-T,this.depth+.72];c.userData=$(F(F({},c.userData),y),{position:C,value:y.value,unit:y.unit||t.unit,rank:y.rank,metricTitle:t.title,index:p}),c.position.set(...C),c.visible=this.showTownRankingPointMarkers;const N=.78+y.value/n*.44;if(c.scale.set(N,N,N),g){const B=(p%2===0?.22:-.18)+(p===0?.12:0),z=p%3===0?.08:-.04;g.position.set(L+B,-T+z,this.depth+1.88+Math.min(p,4)*.03),g.userData=$(F({},y),{index:p}),g.element.innerHTML=this.getInfoPointHtml(y,t)}});const r=this.infoLabelElement[this.infoPointIndex];r&&this.showTownRankingPointMarkers&&this.mapAnimationComplete&&(r.visible=!0),this.showTownRankingPointMarkers&&this.mapAnimationComplete&&!this.infoPointLabelTime&&this.createInfoPointLabelLoop()}clearInfoPointStats(){var e,t;clearInterval(this.infoPointLabelTime),this.infoPointLabelTime=null,this.infoPointIndex=0,this.InfoPointGroup&&(this.InfoPointGroup.visible=!1),(e=this.infoLabelElement)==null||e.forEach(a=>{a.visible=!1}),(t=this.infoPointSprites)==null||t.forEach(a=>{a.visible=!1,a.scale.set(0,0,0)})}createBar(){const e=this.getTownRankingRows();this.getTownRankingMeta();const t=new Te;this.barGroup=t;const a=Math.max(...e.map(n=>n.value),1);this.allBar=[],this.allBarMaterial=[],this.allGuangquan=[],this.allProvinceLabel=[],e.map((n,r)=>{const o=this.getBarHeight(n.value,a),u=new ye({color:16777215,transparent:!0,opacity:0,depthTest:!1,fog:!1});new tn(u,{uColor1:r>3?16506760:5291006,uColor2:r>3?16776948:7863285,size:o,dir:"y"});const c=new je(this.createBarGeometry(o),u);c.renderOrder=5;const[p,y]=this.geoProjection(n.centroid);c.position.set(p,-y,this.depth+.45),c.scale.set(1,1,0),c.userData=$(F({},n),{targetValue:n.value,geoHeight:o});const g=this.createQuan(new te(p,this.depth+.44,y),r);c.add(...this.createHUIGUANG(o,r>3?16776948:7863285)),t.add(c),t.rotation.x=-Math.PI/2,this.allBar.push(c),this.allBarMaterial.push(u),this.allGuangquan.push(g)}),this.scene.add(t),this.updateTownNameLabelStats(this.currentTownRanking)}setTownRanking(e){var r,o,u,c,p,y,g,L,T,C,N,B,z,X,ae,q;this.currentTownRanking=e;const t=this.getTownRankingMeta(e);if(this.showTownRankingBars=!!t.showBars,this.showTownRankingPointMarkers=!!t.showPointMarkers,t.hideMapLabels){this.hideAllMapStatisticLabels(),this.mapGroup&&(this.mapGroup.visible=!0),this.labelGroup&&(this.labelGroup.visible=!0),this.flyLineGroup&&(this.flyLineGroup.visible=this.mapAnimationComplete),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=this.mapAnimationComplete),this.scatterGroup&&(this.scatterGroup.visible=this.mapAnimationComplete);return}if(zr(e)){this.setTradeNationalMapVisible(!1),this.updateTownNameLabelStats(null),this.setTownNameLabelsVisible(!1),this.hideVillageRankingLabels(),this.clearInfoPointStats(),this.mapGroup&&(this.mapGroup.visible=!0),this.labelGroup&&(this.labelGroup.visible=!1),this.flyLineGroup&&(this.flyLineGroup.visible=!1),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=!1),this.scatterGroup&&(this.scatterGroup.visible=!1),(r=this.allBar)!=null&&r.length&&(this.allBar.forEach(I=>{I.visible=!1,I.scale.set(1,1,0)}),(o=this.allBarMaterial)==null||o.forEach(I=>{I.opacity=0}),(u=this.allProvinceLabel)==null||u.forEach(I=>{I.visible=!1}),(c=this.allGuangquan)==null||c.forEach(I=>{I.visible=!1})),this.updateTradeFlowLayer(e),(e!=null&&e.mapView||e!=null&&e.cameraPosition)&&this.applyLayerMapView(null);return}if(this.setTradeNationalMapVisible(!1),this.hideTradeFlowLayer(),this.mapGroup&&(this.mapGroup.visible=!0),this.labelGroup&&(this.labelGroup.visible=!0),this.flyLineGroup&&(this.flyLineGroup.visible=this.mapAnimationComplete),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=this.mapAnimationComplete),this.scatterGroup&&(this.scatterGroup.visible=this.mapAnimationComplete),Dr(e)){this.updateTownNameLabelStats(null),this.setTownNameLabelsVisible(!Or(e)),this.clearInfoPointStats(),this.updateVillageRankingLabels(e),(p=this.allBar)!=null&&p.length&&(this.allBar.forEach(I=>{I.visible=!1,I.scale.set(1,1,0)}),(y=this.allBarMaterial)==null||y.forEach(I=>{I.opacity=0}),(g=this.allProvinceLabel)==null||g.forEach(I=>{I.visible=!1}),(L=this.allGuangquan)==null||L.forEach(I=>{I.visible=!1}));return}if(this.setTownNameLabelsVisible(!t.calloutMode&&!t.hideTownNames),this.hideVillageRankingLabels(),t.calloutMode?this.updateTownNameLabelStats(null):this.updateTownNameLabelStats(e),!((T=this.allBar)!=null&&T.length))return;if(!this.showTownRankingBars){this.allBar.forEach(I=>{I.visible=!1,I.scale.set(1,1,0)}),(C=this.allBarMaterial)==null||C.forEach(I=>{I.opacity=0}),(N=this.allProvinceLabel)==null||N.forEach(I=>{I.visible=!1}),(B=this.allGuangquan)==null||B.forEach(I=>{I.visible=!1}),this.showTownRankingPointMarkers?(this.InfoPointGroup&&(this.InfoPointGroup.visible=this.mapAnimationComplete&&this.hasTownRankingRows(e)),this.updateInfoPointStats()):this.clearInfoPointStats();return}const a=this.getTownRankingRows(e,7,!1);if(!a.length){this.allBar.forEach(I=>{I.visible=!1,I.scale.set(1,1,0)}),(z=this.allProvinceLabel)==null||z.forEach(I=>{I.visible=!1}),(X=this.allGuangquan)==null||X.forEach(I=>{I.visible=!1}),this.clearInfoPointStats();return}this.InfoPointGroup&&(this.InfoPointGroup.visible=this.showTownRankingPointMarkers&&this.mapAnimationComplete),(ae=this.infoPointSprites)==null||ae.forEach(I=>{I.visible=this.showTownRankingPointMarkers});const n=Math.max(...a.map(I=>I.value),1);this.allBar.forEach((I,Ce)=>{const He=Ce{I.visible=!1}),this.allGuangquan.forEach((I,Ce)=>{I.visible=Ce{const He=this.allBar[Ce],Qe=this.allGuangquan[Ce];if(!He)return;const{x:bt,y:O}=this.updateBarItem(He,I,Ce,n,this.mapAnimationComplete);Qe&&(Qe.visible=!0,Qe.position.set(0,0,0),Qe.children.forEach(We=>{We.position.set(bt,this.depth+.44,O),this.mapAnimationComplete&&We.scale.set(1,1,1)}))}),this.updateInfoPointStats()}createEvent(){let e=[];const t=n=>{n.traverse(r=>{r.isMesh&&(r.material=this.defaultMaterial)})},a=n=>{n.traverse(r=>{r.isMesh&&(r.material=this.defaultLightMaterial)})};this.eventElement.map(n=>{this.interactionManager.add(n),n.addEventListener("mousedown",r=>{this.handleMapClick(r)}),n.addEventListener("mouseover",r=>{e.includes(r.target.parent)||e.push(r.target.parent),document.body.style.cursor="pointer",a(r.target.parent)}),n.addEventListener("mouseout",r=>{e=e.filter(o=>o.userData.name!==r.target.parent.userData.name),e.length>0&&e[e.length-1],t(r.target.parent),document.body.style.cursor="default"})})}createHUIGUANG(e,t){let a=new $t(.35,e);a.translate(0,e/2,0);const n=this.assets.instance.getResource("huiguang");n.colorSpace=la,n.wrapS=at,n.wrapT=at;let r=new ye({color:t,map:n,transparent:!0,opacity:.4,depthWrite:!1,side:Re,blending:Ie}),o=new je(a,r);o.renderOrder=10,o.rotateX(Math.PI/2);let u=o.clone(),c=o.clone();return u.rotateY(Math.PI/180*60),c.rotateY(Math.PI/180*120),[o,u,c]}createQuan(e,t){const a=this.assets.instance.getResource("guangquan1"),n=this.assets.instance.getResource("guangquan2");let r=new $t(.5,.5),o=new ye({color:16777215,map:a,alphaMap:a,opacity:1,transparent:!0,depthTest:!1,fog:!1,blending:Ie}),u=new ye({color:16777215,map:n,alphaMap:n,opacity:1,transparent:!0,depthTest:!1,fog:!1,blending:Ie}),c=new je(r,o),p=new je(r,u);return c.renderOrder=6,p.renderOrder=6,c.rotateX(-Math.PI/2),p.rotateX(-Math.PI/2),c.position.copy(e),p.position.copy(e),p.position.y-=.001,c.scale.set(0,0,0),p.scale.set(0,0,0),this.quanGroup=new Te,this.quanGroup.add(c,p),this.scene.add(this.quanGroup),this.time.on("tick",()=>{c.rotation.z+=.05}),this.quanGroup}createDiffuse(){let e=new $t(200,200),t=new ye({color:0,depthWrite:!1,transparent:!0,blending:zl});t.blendEquation=Ol,t.blendSrc=Wl,t.blendDst=Yl,new Ql({material:t,time:this.time,size:60,diffuseSpeed:8,diffuseColor:7442830,diffuseWidth:2,callback:n=>{const r=setTimeout(()=>{this.addSceneTween(sa.to(n.uniforms.uTime,{value:4,repeat:-1,duration:6,ease:"power1.easeIn"}))},3);this.addSceneTimer(r)}});let a=new je(e,t);a.renderOrder=3,a.rotation.x=-Math.PI/2,a.position.set(0,.21,0),this.scene.add(a)}createGrid(){new eu(this,{gridSize:54,gridDivision:24,gridColor:1990543,shapeSize:.55,shapeColor:3309487,pointSize:.085,pointColor:1993891,pointBlending:Ie})}createBottomBg(){let e=new $t(24,24);const t=this.assets.instance.getResource("ocean");t.colorSpace=la,t.wrapS=at,t.wrapT=at,t.repeat.set(1,1);let a=new ye({map:t,opacity:.92,fog:!1}),n=new je(e,a);n.rotation.x=-Math.PI/2,n.position.set(0,-.7,0),this.scene.add(n)}createChinaBlurLine(){let e=new $t(154,154);const t=this.assets.instance.getResource("chinaBlurLine");t.colorSpace=la,t.wrapS=at,t.wrapT=at,t.generateMipmaps=!1,t.minFilter=vr,t.repeat.set(1,1);let a=new ye({color:4162253,alphaMap:t,transparent:!0,opacity:.62}),n=new je(e,a);n.rotateX(-Math.PI/2),n.position.set(-19.3,-.5,-19.7),this.scene.add(n)}createLabel(){let e=this,t=this.labelGroup,a=this.label3d,n=[],r=[];du.map(u=>{if(u.hide==!0)return!1;let c=o(u,a,t);n.push(c),r.push(c)}),this.otherLabel=n,this.townNameLabels=r;function o(u,c,p){let y=c.create("",`china-label ${u.blur?" blur":""}`,!0);const[g,L]=e.geoProjection(u.center);return y.init(`
${u.name}
`,new te(g,-L,e.depth+.85)),c.setLabelStyle(y,.018,"x"),y.setParent(p),y.userData=$(F({},u),{labelType:"town-label",baseScale:.018,townName:u.name}),y.element.addEventListener("pointerdown",T=>{e.handleTownRankingSelect(u.name,{preserveCamera:!0,statusText:`已选中${u.name}`})&&(T.preventDefault(),T.stopPropagation())}),y}}createRotateBorder(){let e=13.2,t=this.assets.instance.getResource("rotationBorder1"),a=this.assets.instance.getResource("rotationBorder2"),n=new Cr(this,{width:e*1.178,needRotate:!0,rotateSpeed:.001,material:new ye({map:t,color:4763647,transparent:!0,opacity:.26,side:Re,depthWrite:!1,blending:Ie}),position:new te(0,.31,0)});n.instance.rotation.x=-Math.PI/2,n.instance.renderOrder=6,n.instance.scale.set(0,0,0),n.setParent(this.scene);let r=new Cr(this,{width:e*1.116,needRotate:!0,rotateSpeed:-.004,material:new ye({map:a,color:4763647,transparent:!0,opacity:.5,side:Re,depthWrite:!1,blending:Ie}),position:new te(0,.33,0)});r.instance.rotation.x=-Math.PI/2,r.instance.renderOrder=6,r.instance.scale.set(0,0,0),r.setParent(this.scene),this.rotateBorder1=n.instance,this.rotateBorder2=r.instance}createFlyLine(){this.flyLineGroup=new Te,this.flyLineGroup.visible=!1,this.scene.add(this.flyLineGroup)}createFocus(){this.flyLineFocusGroup.clear()}createParticles(){this.particles=new Fr(this,{num:10,range:30,dir:"up",speed:.05,material:new jl({map:Fr.createTexture(),size:1,color:61166,transparent:!0,opacity:1,depthTest:!1,depthWrite:!1,vertexColors:!0,blending:Ie,sizeAttenuation:!0})}),this.particleGroup=new Te,this.scene.add(this.particleGroup),this.particleGroup.rotation.x=-Math.PI/2,this.particles.setParent(this.particleGroup),this.particles.enable=!0,this.particleGroup.visible=!0}createScatter(){this.scatterGroup=new Te,this.scatterGroup.visible=!1,this.scatterGroup.rotation.x=-Math.PI/2,this.scene.add(this.scatterGroup);const e=this.assets.instance.getResource("arrow"),t=new ia({map:e,color:16776948,fog:!1,transparent:!0,depthTest:!1});let a=Vr(hu),n=a[0].value;a.map(r=>{const o=new na(t);o.renderOrder=23;let u=.1+r.value/n*.2;o.scale.set(u,u,u);let[c,p]=this.geoProjection([r.lng,r.lat]);o.position.set(c,-p,this.depth+.45),o.userData.position=[c,-p,this.depth+.45],this.scatterGroup.add(o)})}createInfoPoint(){let e=this;this.InfoPointGroup=new Te,this.scene.add(this.InfoPointGroup),this.InfoPointGroup.visible=!1,this.InfoPointGroup.rotation.x=-Math.PI/2,this.infoPointIndex=0,this.infoPointLabelTime=null,this.infoLabelElement=[],this.infoPointSprites=[];let t=this.label3d;const a=this.assets.instance.getResource("point");let n=[16776948,7863285],r=Vr(pu),o=r[0].value;r.map((c,p)=>{const y=new ia({map:a,color:n[p%n.length],fog:!1,transparent:!0,depthTest:!1}),g=new na(y);g.renderOrder=23;let L=.7+c.value/o*.4;g.scale.set(L,L,L);let[T,C]=this.geoProjection([c.lng,c.lat]),N=[T,-C,this.depth+.7];g.position.set(...N),g.userData.position=[...N],g.userData={position:[T,-C,this.depth+.7],name:c.name,value:c.value,level:c.level,index:p},this.InfoPointGroup.add(g);let B=u(c,t,this.InfoPointGroup,p);this.infoLabelElement.push(B),this.infoPointSprites.push(g),this.interactionManager.add(g),g.addEventListener("mousedown",z=>{var X,ae;if(this.clicked||!this.InfoPointGroup.visible)return!1;this.clicked=!0,this.infoPointIndex=z.target.userData.index,this.infoLabelElement.map(q=>{q.visible=!1}),B.visible=!0,this.handleTownRankingSelect(((X=z.target.userData)==null?void 0:X.name)||((ae=z.target.userData)==null?void 0:ae.townName)),this.createInfoPointLabelLoop()}),g.addEventListener("mouseup",z=>{this.clicked=!1}),g.addEventListener("mouseover",z=>{document.body.style.cursor="pointer"}),g.addEventListener("mouseout",z=>{document.body.style.cursor="default"})});function u(c,p,y,g){let L=p.create("","info-point",!0);const[T,C]=e.geoProjection([c.lng,c.lat]);return L.init(e.getInfoPointHtml($(F({},c),{value:0,rank:g+1,unit:""}),e.getTownRankingMeta()),new te(T,-C,e.depth+1.9)),p.setLabelStyle(L,.015,"x"),L.setParent(y),L.visible=!1,L}}createInfoPointLabelLoop(){var e;this.scenePaused||!((e=this.infoLabelElement)!=null&&e.length)||(clearInterval(this.infoPointLabelTime),this.infoPointLabelTime=setInterval(()=>{this.infoPointIndex++,this.infoPointIndex>=this.infoLabelElement.length&&(this.infoPointIndex=0),this.infoLabelElement.map((t,a)=>{this.infoPointIndex===a?t.visible=!0:t.visible=!1})},3e3))}createStorke(){const e=this.staticMapData.mapStroke,t=this.assets.instance.getResource("pathLine3");t.wrapS=t.wrapT=at,t.repeat.set(2,1);let a=new ra(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new te(0,0,this.depth+.24),data:e,material:new ye({color:2868444,map:t,alphaMap:t,fog:!1,transparent:!0,opacity:1,blending:Ie}),type:"Line3",renderOrder:22,tubeRadius:.03});this.focusMapGroup.add(a.lineGroup),this.time.on("tick",()=>{t.offset.x+=.005})}handleMapClick(e){return oe(this,null,function*(){var r,o,u,c,p,y,g,L,T,C,N,B,z,X,ae,q,I,Ce,He,Qe,bt,O,We,vt,Rt,st,It,wt,Me,ot,_e,Fe,me,Ne,lt,Lt,ze,qe,be,ut,M;if(!this.currentTopicLayer)return;const t=this.getScreenPointFromEvent(e),a=this.getLngLatFromEvent(e);if(!a){this.clearSelectedFeature(),(o=(r=this.callbacks).onFeatureInfo)==null||o.call(r,{feature:null});return}if(this.boundaryDrawingEnabled){const v=((u=e==null?void 0:e.data)==null?void 0:u.originalEvent)||(e==null?void 0:e.originalEvent)||e;if(v!=null&&v.__analysisBoundaryHandled)return;this.addBoundaryDrawPoint(a);return}if(this.shouldClipLayerToHongyuanBoundary(this.currentTopicLayer)&&!this.isLngLatInHongyuanBoundary(a)){this.clearSelectedFeature(),(p=(c=this.callbacks).onFeatureInfo)==null||p.call(c,{feature:null}),(g=(y=this.callbacks).onLayerStatus)==null||g.call(y,{type:"success",text:"当前点击位置不在红原县边界内"});return}if(this.shouldClipLayerToLayerBounds(this.currentTopicLayer)&&!this.isLngLatInLayerClipBounds(a,this.currentTopicLayer)){this.clearSelectedFeature(),(T=(L=this.callbacks).onFeatureInfo)==null||T.call(L,{feature:null}),(N=(C=this.callbacks).onLayerStatus)==null||N.call(C,{type:"success",text:"当前点击位置不在图层显示范围内"});return}if(Ou(this.currentTopicLayer)){this.clearSelectedFeature(),(z=(B=this.callbacks).onFeatureInfo)==null||z.call(B,{feature:null});return}if(rn(this.currentTopicLayer)){const v=this.pickVectorFeatureAtPoint(a,t),R=(v==null?void 0:v.feature)||v;let D=(v==null?void 0:v.screen)||t;if(R)this.shouldClipLayerToHongyuanBoundary(this.currentTopicLayer)?(this.clearSelectedGeometryGroup(),this.setSelectedVectorFeatures([R])):this.showSelectedFeature(R),((X=this.currentTopicLayer)==null?void 0:X.key)==="yak-industry-points"&&(this.setSelectedVectorFeatures([R]),D=this.getPointFeatureScreenPoint(R)||D),(He=(Ce=this.callbacks).onFeatureInfo)==null||He.call(Ce,{feature:{id:((ae=R.properties)==null?void 0:ae.id)||((q=R.properties)==null?void 0:q.feature_id)||((I=R.properties)==null?void 0:I.project_name),properties:R.properties||{},feature:R,layer:this.currentTopicLayer,lngLat:a},screen:D}),(bt=(Qe=this.callbacks).onLayerStatus)==null||bt.call(Qe,{type:"success",text:"真实矢量要素已选中"});else{const H=this.getTownNameFromMapEvent(e);if(this.handleTownRankingSelect(H))return;this.clearSelectedFeature(),(We=(O=this.callbacks).onFeatureInfo)==null||We.call(O,{feature:null}),(Rt=(vt=this.callbacks).onLayerStatus)==null||Rt.call(vt,{type:"success",text:"当前点击位置无生态保护要素"})}return}const n=this.lngLatToWmsPixel(a);(It=(st=this.callbacks).onFeatureInfo)==null||It.call(st,{feature:null}),(Me=(wt=this.callbacks).onFeatureLoading)==null||Me.call(wt,!0);try{const v=yield _r(this.currentTopicLayer,n,{size:yt,buffer:10}),R=this.normalizeFeatureInfoAtPoint(v,a),D=R?null:yield this.queryFallbackFeatureInfo(a),H=R||(D==null?void 0:D.feature);if(H){const ee=yield this.enrichFeatureInfo(H,n,a);this.showSelectedFeature(ee.feature||ee),(_e=(ot=this.callbacks).onFeatureInfo)==null||_e.call(ot,{feature:$(F({},ee),{layer:(D==null?void 0:D.layer)||this.currentTopicLayer,lngLat:a}),screen:t})}else this.clearSelectedFeature(),(me=(Fe=this.callbacks).onFeatureInfo)==null||me.call(Fe,{feature:null});H||(lt=(Ne=this.callbacks).onLayerStatus)==null||lt.call(Ne,{type:"success",text:"当前点击位置无图斑"})}catch(v){this.clearSelectedFeature(),(ze=(Lt=this.callbacks).onFeatureInfo)==null||ze.call(Lt,{feature:null}),(be=(qe=this.callbacks).onLayerStatus)==null||be.call(qe,{type:"error",text:"图斑信息查询失败"})}finally{(M=(ut=this.callbacks).onFeatureLoading)==null||M.call(ut,!1)}})}handleCanvasBoundaryPointerDown(e){var a,n;if(!this.boundaryDrawingEnabled)return;const t=this.getLngLatFromCanvasEvent(e);t&&this.addBoundaryDrawPoint(t)&&(e.__analysisBoundaryHandled=!0),(a=e.preventDefault)==null||a.call(e),(n=e.stopPropagation)==null||n.call(e)}handleCanvasBoundaryDoubleClick(e){var a,n;if(!this.boundaryDrawingEnabled)return;const t=this.getLngLatFromCanvasEvent(e);(this.boundaryDrawPoints||[]).length<3&&t&&this.addBoundaryDrawPoint(t),(this.boundaryDrawPoints||[]).length>=3&&(this.finishBoundaryDrawing(),e.__analysisBoundaryHandled=!0),(a=e.preventDefault)==null||a.call(e),(n=e.stopPropagation)==null||n.call(e)}getLngLatFromCanvasEvent(e){var L,T,C;if(!((L=this.camera)!=null&&L.instance)||!this.focusMapGroup||!this.canvas)return null;const t=this.canvas.getBoundingClientRect();if(!t.width||!t.height)return null;const a=(T=this.interactionManager)==null?void 0:T.raycaster;if(!(a!=null&&a.setFromCamera))return null;const n={x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height)*2+1};a.setFromCamera(n,this.camera.instance);const o=((C=a.intersectObjects(this.eventElement||[],!0)[0])==null?void 0:C.point)||this.getRayMapPlaneIntersection(a.ray);if(!o)return null;const u=this.focusMapGroup.worldToLocal(o.clone()),p=Kt().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]).invert([u.x,-u.y]);if(!p)return null;const y=Number(p[0]),g=Number(p[1]);return!Number.isFinite(y)||!Number.isFinite(g)?null:yj.east+.03||gj.north+.03?this.getFallbackLngLatFromPointer(e,t):{lng:y,lat:g}}getFallbackLngLatFromPointer(e,t=(n=>(n=(a=>(a=this.canvas)==null?void 0:a.getBoundingClientRect)())==null?void 0:n.call(a))()){if(!(t!=null&&t.width)||!(t!=null&&t.height))return null;const r=Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),o=Math.min(1,Math.max(0,(e.clientY-t.top)/t.height)),u=j.west+(j.east-j.west)*r,c=j.north-(j.north-j.south)*o;return{lng:u,lat:c}}getRayMapPlaneIntersection(e){if(!(e!=null&&e.origin)||!(e!=null&&e.direction)||!this.focusMapGroup)return null;const t=this.focusMapGroup.worldToLocal(e.origin.clone()),n=this.focusMapGroup.worldToLocal(e.origin.clone().add(e.direction.clone())).sub(t),r=this.depth+.22;if(Math.abs(n.z)<1e-8)return null;const o=(r-t.z)/n.z;if(!Number.isFinite(o)||o<0)return null;const u=t.add(n.multiplyScalar(o));return this.focusMapGroup.localToWorld(u)}enrichFeatureInfo(e,t,a){return oe(this,null,function*(){const n=this.getLayerTopicKey(this.currentTopicLayer);if(!["grassland","wetland","woodland"].includes(n))return e;const o=(Un[n]||[]).find(g=>g.key===`${n}-distribution`),u=(this.visibleTopicLayers||[]).filter(g=>this.getLayerTopicKey(g)===n).slice(0,5),c=[o,this.currentTopicLayer,...u].filter(g=>g==null?void 0:g.layerName).filter((g,L,T)=>T.findIndex(C=>this.getLayerQueryKey(C)===this.getLayerQueryKey(g))===L);if(!c.length)return e;const p=yield Promise.allSettled([...c.filter(g=>this.getLayerQueryKey(g)!==this.getLayerQueryKey(this.currentTopicLayer)).map(g=>oe(this,null,function*(){const L=yield _r(g,t,{size:yt,buffer:10}),T=this.normalizeFeatureInfoAtPoint(L,a);return T?{layer:g,feature:T,source:"wms"}:null})),...c.map(g=>oe(this,null,function*(){const L=yield this.queryLayerFeatureByPoint(g,a);return L?{layer:g,feature:L,source:"wfs"}:null}))]),y=F({},e.properties||{});return p.forEach(g=>{var L,T;g.status!=="fulfilled"||!((T=(L=g.value)==null?void 0:L.feature)!=null&&T.properties)||this.mergeBusinessProperties(y,g.value.feature.properties,g.value.layer)}),$(F({},e),{properties:y,relatedFeatures:p.filter(g=>{var L;return g.status==="fulfilled"&&((L=g.value)==null?void 0:L.feature)}).map(g=>g.value),feature:$(F({},e.feature||{}),{properties:y})})})}queryFallbackFeatureInfo(e){return oe(this,null,function*(){const t=this.getLayerTopicKey(this.currentTopicLayer);if(!["grassland","wetland","woodland"].includes(t))return null;const n=[(Un[t]||[]).find(r=>r.key===`${t}-distribution`),this.currentTopicLayer,...(this.visibleTopicLayers||[]).filter(r=>this.getLayerTopicKey(r)===t)].filter((r,o,u)=>(r==null?void 0:r.layerName)&&u.findIndex(c=>this.getLayerQueryKey(c)===this.getLayerQueryKey(r))===o);for(const r of n){const o=yield this.queryLayerFeatureByPoint(r,e,{requireContainment:!0});if(o)return{layer:r,feature:o}}return null})}normalizeFeatureInfoAtPoint(e,t){const a=Array.isArray(e==null?void 0:e.features)?e.features:[];if(!a.length)return null;const n=this.pickFeatureAtPoint(a,t,{requireContainment:!0});if(!n)return null;const r=n.properties||{};return{id:n.id||r.gid||r.objectid||r.OBJECTID,properties:r,feature:n}}queryLayerFeatureByPoint(n,r){return oe(this,arguments,function*(e,t,a={}){var C,N,B;if(!(e!=null&&e.layerName)||!Number.isFinite(t==null?void 0:t.lng)||!Number.isFinite(t==null?void 0:t.lat))return null;const o=e.pointQueryTolerance||.0015,u=e.geometryField||"geom",c=t.lng-o,p=t.lat-o,y=t.lng+o,g=t.lat+o,L=yield Gr(e.layerName,{cqlFilter:`BBOX(${u},${c},${p},${y},${g})`,maxFeatures:8,timeout:12e3}),T=this.pickFeatureAtPoint((L==null?void 0:L.features)||[],t,a);return T?{id:T.id||((C=T.properties)==null?void 0:C.gid)||((N=T.properties)==null?void 0:N.objectid)||((B=T.properties)==null?void 0:B.OBJECTID),properties:T.properties||{},feature:T}:null})}pickFeatureAtPoint(e,t,a={}){var r;if(!Array.isArray(e)||!e.length)return null;const n=e.filter(o=>this.isLngLatInGeometry(t,o.geometry)).sort((o,u)=>this.getGeometryAreaScore(o.geometry)-this.getGeometryAreaScore(u.geometry));return n.length?n[0]:a.requireContainment?null:((r=e.map(o=>({feature:o,distance:this.getGeometryDistanceScore(o.geometry,t)})).sort((o,u)=>o.distance-u.distance)[0])==null?void 0:r.feature)||null}isLngLatInGeometry(e,t){return!e||!(t!=null&&t.coordinates)?!1:t.type==="Polygon"?this.isLngLatInPolygon(e,t.coordinates):t.type==="MultiPolygon"?t.coordinates.some(a=>this.isLngLatInPolygon(e,a)):!1}isLngLatInPolygon(e,t=[]){return!t.length||!this.isLngLatInRing(e,t[0])?!1:!t.slice(1).some(n=>this.isLngLatInRing(e,n))}isLngLatInRing(e,t=[]){if(t.length<3)return!1;let a=!1;const n=e.lng,r=e.lat;for(let o=0,u=t.length-1;or!=T>r&&n<(L-y)*(r-g)/(T-g)+y&&(a=!a)}return a}isPointOnSegment(e,t,a,n,r,o){const u=(e-a)*(o-n)-(t-n)*(r-a);return Math.abs(u)>1e-10?!1:(e-a)*(e-r)+(t-n)*(t-o)<=1e-10}getGeometryAreaScore(e){return e!=null&&e.coordinates?e.type==="Polygon"?this.getLngLatPolygonAreaScore(e.coordinates):e.type==="MultiPolygon"?e.coordinates.reduce((t,a)=>t+this.getLngLatPolygonAreaScore(a),0):Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY}getLngLatPolygonAreaScore(e=[]){const t=e[0]||[];if(t.length<3)return Number.POSITIVE_INFINITY;let a=0;for(let n=0;n({minLng:Math.min(a.minLng,Number((n==null?void 0:n[0])||0)),minLat:Math.min(a.minLat,Number((n==null?void 0:n[1])||0)),maxLng:Math.max(a.maxLng,Number((n==null?void 0:n[0])||0)),maxLat:Math.max(a.maxLat,Number((n==null?void 0:n[1])||0))}),{minLng:Number.POSITIVE_INFINITY,minLat:Number.POSITIVE_INFINITY,maxLng:Number.NEGATIVE_INFINITY,maxLat:Number.NEGATIVE_INFINITY}):null}getGeometryCoordinateList(e){const t=[],a=n=>{if(Array.isArray(n)){if(typeof n[0]=="number"&&typeof n[1]=="number"){t.push(n);return}n.forEach(a)}};return a(e==null?void 0:e.coordinates),t}pickVectorFeatureAtPoint(e,t){var o;const a=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]);if(((o=this.currentTopicLayer)==null?void 0:o.key)==="yak-industry-points"){const u=this.pickPointFeatureAtScreenPoint(a,t);if(u)return u}const n=a.filter(u=>this.isLngLatInGeometry(e,u.geometry)).sort((u,c)=>this.getGeometryAreaScore(u.geometry)-this.getGeometryAreaScore(c.geometry));if(n.length)return n[0];const r=a.find(u=>this.isPointOrLineNearLngLat(u.geometry,e));return r||null}pickPointFeatureAtScreenPoint(e,t){var r;if(!t||!((r=this.camera)!=null&&r.instance)||!this.focusMapGroup||!this.canvas)return null;const n=(e||[]).filter(o=>{var u;return((u=o==null?void 0:o.geometry)==null?void 0:u.type)==="Point"}).map(o=>{const u=this.getPointFeatureScreenPoint(o);return u?{feature:o,screen:u,distance:Math.hypot(u.x-t.x,u.y-t.y)}:null}).filter(Boolean).sort((o,u)=>o.distance-u.distance)[0];return(n==null?void 0:n.distance)<=22?{feature:n.feature,screen:n.screen}:null}getPointFeatureScreenPoint(e){var a,n;const t=(e==null?void 0:e.geometry)||((a=e==null?void 0:e.feature)==null?void 0:a.geometry);return(t==null?void 0:t.type)!=="Point"?null:((n=this.currentTopicLayer)==null?void 0:n.key)==="yak-industry-points"?this.lngLatToLayerScreenPoint(t.coordinates,this.depth+.36):this.lngLatToScreenPoint(t.coordinates,this.depth+.32)}lngLatToLayerLocalPoint(e,t=0){const a=()=>{const p=Number(e==null?void 0:e[0]),y=Number(e==null?void 0:e[1]);if(!Number.isFinite(p)||!Number.isFinite(y))return new te(0,0,Number(t)||0);const[g,L]=this.geoProjection([p,y]);return new te(g,-L,Number(t)||0)},n=this.topicLayerUvBounds;if(!n)return a();const r=this.lngLatToLayerCanvasPoint(e),o=this.topicLayerCanvas;if(!(o!=null&&o.width)||!(o!=null&&o.height))return a();const u=n.left+r.x/o.width*(n.right-n.left),c=n.bottom+(o.height-r.y)/o.height*(n.top-n.bottom);return new te(u,c,Number(t)||0)}lngLatToLayerScreenPoint(e,t=0){return this.localMapPointToScreenPoint(this.lngLatToLayerLocalPoint(e,t))}lngLatToScreenPoint(e,t=0){const a=Number(e==null?void 0:e[0]),n=Number(e==null?void 0:e[1]);if(!Number.isFinite(a)||!Number.isFinite(n))return null;const r=this.lngLatToWorldPoint([a,n],t);return this.worldPointToScreenPoint(r)}localMapPointToScreenPoint(e){const t=this.focusMapGroup?this.focusMapGroup.localToWorld(e):e;return this.worldPointToScreenPoint(t)}worldPointToScreenPoint(e){var n;if(!((n=this.camera)!=null&&n.instance)||!this.canvas||!e)return null;const t=this.canvas.getBoundingClientRect();if(!t.width||!t.height)return null;const a=e.clone().project(this.camera.instance);return!Number.isFinite(a.x)||!Number.isFinite(a.y)?null:{x:t.left+(a.x+1)/2*t.width,y:t.top+(1-a.y)/2*t.height}}focusProject(e){var L,T,C,N;const t=String(e||"").trim();if(!t)return!1;const a=(this.currentVectorFeatures||[]).filter(B=>{var z;return String(((z=B==null?void 0:B.properties)==null?void 0:z.project_name)||"").trim()===t});if(!a.length)return(T=(L=this.callbacks).onLayerStatus)==null||T.call(L,{type:"success",text:"当前项目图斑尚未加载"}),!1;const n=this.getFeatureListLngLatBounds(a);if(!n)return!1;const r=this.getProjectHighlightFeatures(a);r.length?(this.showSelectedFeatures(r),this.setSelectedVectorFeatures(r)):this.clearSelectedFeature();const o=[(n.minLng+n.maxLng)/2,(n.minLat+n.maxLat)/2],u=Math.max(n.maxLng-n.minLng,n.maxLat-n.minLat),c=Math.max(.22,Math.min(.55,u*1.25)),p=this.lngLatToWorldPoint(o,.72),y=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(c),g=p.clone().add(y);return this.animateMapCamera(g,p,.75),(N=(C=this.callbacks).onLayerStatus)==null||N.call(C,{type:"success",text:"已定位项目"}),!0}setBoundaryDrawing(e){var t,a,n,r;this.boundaryDrawingEnabled=!!e,this.boundaryDrawingEnabled?(this.boundaryDrawPoints=[],this.lastBoundaryDrawPoint=null,this.analysisBoundaryFeature=null,this.analysisMatchedFeatures=[],this.clearSelectedFeature(),(a=(t=this.callbacks).onLayerStatus)==null||a.call(t,{type:"success",text:"请在地图上依次点击绘制分析边界"})):(r=(n=this.callbacks).onLayerStatus)==null||r.call(n,{type:"success",text:"已退出边界绘制"}),this.redrawVectorTopicLayer()}addBoundaryDrawPoint(e){var r,o,u,c;if(!Number.isFinite(e==null?void 0:e.lng)||!Number.isFinite(e==null?void 0:e.lat))return!1;const t=Date.now(),a=this.lastBoundaryDrawPoint;return a&&t-a.time<350&&Math.hypot(e.lng-a.lng,e.lat-a.lat)<8e-4?!1:(this.lastBoundaryDrawPoint={lng:e.lng,lat:e.lat,time:t},this.boundaryDrawPoints=[...this.boundaryDrawPoints||[],{lng:e.lng,lat:e.lat}],(o=(r=this.callbacks).onDrawBoundary)==null||o.call(r,{status:"drawing",points:this.boundaryDrawPoints,pointCount:this.boundaryDrawPoints.length}),(c=(u=this.callbacks).onLayerStatus)==null||c.call(u,{type:"success",text:`已添加边界点 ${this.boundaryDrawPoints.length} 个`}),this.redrawVectorTopicLayer(),!0)}undoBoundaryPoint(){var e,t,a;return(e=this.boundaryDrawPoints)!=null&&e.length?(this.boundaryDrawPoints=this.boundaryDrawPoints.slice(0,-1),(a=(t=this.callbacks).onDrawBoundary)==null||a.call(t,{status:"drawing",points:this.boundaryDrawPoints,pointCount:this.boundaryDrawPoints.length}),this.redrawVectorTopicLayer(),!0):!1}finishBoundaryDrawing(){var o,u,c,p,y,g;const e=this.boundaryDrawPoints||[];if(e.length<3)return(u=(o=this.callbacks).onLayerStatus)==null||u.call(o,{type:"error",text:"至少需要 3 个点才能形成分析边界"}),null;const t=e.map(L=>[L.lng,L.lat]),a=t[0],n=t[t.length-1];(a[0]!==n[0]||a[1]!==n[1])&&t.push([...a]);const r={type:"Feature",properties:{source:"draw",pointCount:e.length},geometry:{type:"Polygon",coordinates:[t]}};return this.boundaryDrawingEnabled=!1,this.boundaryDrawPoints=[],this.lastBoundaryDrawPoint=null,this.analysisBoundaryFeature=r,(p=(c=this.callbacks).onDrawBoundary)==null||p.call(c,{status:"complete",feature:r,points:e,pointCount:e.length}),(g=(y=this.callbacks).onLayerStatus)==null||g.call(y,{type:"success",text:"分析边界已生成"}),this.redrawVectorTopicLayer(),r}clearAnalysisBoundary(){var e,t;return this.boundaryDrawingEnabled=!1,this.boundaryDrawPoints=[],this.lastBoundaryDrawPoint=null,this.analysisBoundaryFeature=null,this.analysisMatchedFeatures=[],this.redrawVectorTopicLayer(),(t=(e=this.callbacks).onDrawBoundary)==null||t.call(e,{status:"clear",points:[],pointCount:0}),!0}showAnalysisResult(e={}){var r;const t=Object.prototype.hasOwnProperty.call(e,"boundary")||Object.prototype.hasOwnProperty.call(e,"boundaryFeature")||Object.prototype.hasOwnProperty.call(e,"feature"),a=e.boundary||e.boundaryFeature||e.feature||null,n=Array.isArray(e.matches)?e.matches:[];return t&&(this.analysisBoundaryFeature=(a==null?void 0:a.type)==="Feature"?a:a!=null&&a.geometry?{type:"Feature",properties:a.properties||{},geometry:a.geometry}:null),this.analysisMatchedFeatures=n.map(o=>(o==null?void 0:o.feature)||o).filter(o=>o==null?void 0:o.geometry),e.preserveView||(!t&&this.analysisMatchedFeatures.length?this.focusAnalysisFeatures(this.analysisMatchedFeatures):(r=this.analysisBoundaryFeature)!=null&&r.geometry&&this.focusAnalysisGeometry(this.analysisBoundaryFeature.geometry)),this.redrawVectorTopicLayer(),!0}focusAnalysisFeatures(e=[]){const t=this.getFeatureListLngLatBounds(e);if(!t)return!1;const a=[(t.minLng+t.maxLng)/2,(t.minLat+t.maxLat)/2];return this.flyToLngLat(a,{span:Math.max(t.maxLng-t.minLng,t.maxLat-t.minLat),statusText:"已定位命中项目"})}focusAnalysisGeometry(e){const t=this.getGeometryLngLatBounds(e);if(!t)return!1;const a=[(t.minLng+t.maxLng)/2,(t.minLat+t.maxLat)/2];return this.flyToLngLat(a,{span:Math.max(t.maxLng-t.minLng,t.maxLat-t.minLat),statusText:"已定位分析边界"})}focusPasture(e={}){var n,r;const a=[...this.normalizePastureGrasslandRows(e==null?void 0:e.grasslands),...this.normalizePastureGrasslandRows(e==null?void 0:e.wkt)].map((o,u)=>{const c=this.normalizePastureGrasslandGeometry(o);if(!c)return null;const p=this.normalizePastureGrasslandProperties(o);return{type:"Feature",properties:$(F({},p),{id:p.id||p.gid||`${(e==null?void 0:e.name)||"pasture"}-${u}`,pasture_name:(e==null?void 0:e.name)||p.pastureName||p.name}),geometry:c}}).filter(Boolean);if(a.length){const o=this.getFeatureListLngLatBounds(a);if(!o)return!1;this.showSelectedFeatures(a,{mode:"pasture"}),this.setSelectedVectorFeatures(a);const u=[(o.minLng+o.maxLng)/2,(o.minLat+o.maxLat)/2];return this.flyToLngLat(u,{span:Math.max(o.maxLng-o.minLng,o.maxLat-o.minLat),statusText:"已定位具体草场"}),!0}return(r=(n=this.callbacks).onLayerStatus)==null||r.call(n,{type:"warning",text:"当前牧户暂无可定位数据"}),!1}normalizePastureGrasslandRows(e){return e?typeof e=="string"?[e]:Array.isArray(e)?e:(e==null?void 0:e.type)==="FeatureCollection"&&Array.isArray(e.features)?e.features:(e==null?void 0:e.type)==="Feature"||this.isGeoJsonGeometry(e)?[e]:Array.isArray(e==null?void 0:e.rows)?e.rows:Array.isArray(e==null?void 0:e.data)?e.data:e!=null&&e.data?this.normalizePastureGrasslandRows(e.data):Array.isArray(e==null?void 0:e.list)?e.list:Array.isArray(e==null?void 0:e.features)?e.features:e!=null&&e.wkt||e!=null&&e.geo||e!=null&&e.geom||e!=null&&e.geometryWkt||e!=null&&e.geometry_wkt||e!=null&&e.shape||e!=null&&e.location||e!=null&&e.geometry?[e]:[]:[]}normalizePastureGrasslandGeometry(e){var t;return typeof e=="string"?this.parseGeometryText(e):(e==null?void 0:e.type)==="Feature"?this.normalizePastureGrasslandGeometry(e.geometry):this.isGeoJsonGeometry(e)?e:typeof(e==null?void 0:e.geometry)=="string"?this.parseGeometryText(e.geometry):((t=e==null?void 0:e.geometry)==null?void 0:t.type)==="Feature"?this.normalizePastureGrasslandGeometry(e.geometry.geometry):this.isGeoJsonGeometry(e==null?void 0:e.geometry)?e.geometry:this.parseGeometryText((e==null?void 0:e.wkt)||(e==null?void 0:e.geo)||(e==null?void 0:e.geom)||(e==null?void 0:e.geometryWkt)||(e==null?void 0:e.geometry_wkt)||(e==null?void 0:e.shape)||(e==null?void 0:e.location))}normalizePastureGrasslandProperties(e){return!e||typeof e!="object"||Array.isArray(e)?{wkt:e}:e.type==="Feature"?e.properties||{}:e}parseGeometryText(e){const t=String(e||"").trim();if(!t)return null;if(t.startsWith("{")||t.startsWith("["))try{const a=JSON.parse(t);if((a==null?void 0:a.type)==="Feature")return this.normalizePastureGrasslandGeometry(a);if(this.isGeoJsonGeometry(a))return a}catch(a){return null}return this.parseWktGeometry(t)}isGeoJsonGeometry(e){return!!(e&&["Polygon","MultiPolygon","LineString","MultiLineString","Point"].includes(e.type)&&e.coordinates)}flyToLngLat(e,t={}){var g,L;const a=Array.isArray(e)?e:[e==null?void 0:e.lng,e==null?void 0:e.lat],n=Number(a==null?void 0:a[0]),r=Number(a==null?void 0:a[1]);if(!Number.isFinite(n)||!Number.isFinite(r))return!1;const o=Number(t.span),u=Number.isFinite(o)?Math.max(.2,Math.min(.55,o*1.25)):.32,c=this.lngLatToWorldPoint([n,r],.72),p=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(u),y=c.clone().add(p);return this.animateMapCamera(y,c,t.duration||.75),(L=(g=this.callbacks).onLayerStatus)==null||L.call(g,{type:"success",text:t.statusText||"已定位"}),!0}getProjectHighlightFeatures(e){const t=e.filter(n=>{var o;const r=String(((o=n==null?void 0:n.geometry)==null?void 0:o.type)||"");return r.includes("Polygon")||r.includes("LineString")}),a=t.filter(n=>{var r;return((r=n==null?void 0:n.properties)==null?void 0:r.feature_role)==="工程范围"});return a.length?a:t}getFeatureListLngLatBounds(e){return e.reduce((t,a)=>{const n=this.getGeometryLngLatBounds(a.geometry);return n?t?{minLng:Math.min(t.minLng,n.minLng),minLat:Math.min(t.minLat,n.minLat),maxLng:Math.max(t.maxLng,n.maxLng),maxLat:Math.max(t.maxLat,n.maxLat)}:F({},n):t},null)}isPointOrLineNearLngLat(e,t){return e!=null&&e.coordinates?e.type==="Point"?this.getCoordinateDistance(e.coordinates,[t.lng,t.lat])<=.02:e.type==="LineString"?this.isCoordinateNearLine(e.coordinates,t,.004):e.type==="MultiLineString"?e.coordinates.some(a=>this.isCoordinateNearLine(a,t,.004)):!1:!1}isCoordinateNearLine(e,t,a){if(!Array.isArray(e)||e.length<2)return!1;const n=[t.lng,t.lat];for(let r=1;rr.some(o=>o.key===a||o.layerName===t));return(n==null?void 0:n[0])||""}getLayerQueryKey(e){return[(e==null?void 0:e.layerName)||"",(e==null?void 0:e.styles)||"",(e==null?void 0:e.cqlFilter)||"",(e==null?void 0:e.key)||""].join("|")}mergeBusinessProperties(e,t,a){const n=(a==null?void 0:a.key)||"";if(Object.entries(t||{}).forEach(([r,o])=>{o==null||o===""||(e[r]===void 0||e[r]===null||e[r]==="")&&(e[r]=o)}),n==="basic-grassland"){const r=(t==null?void 0:t.basic_type_name)||(t==null?void 0:t.grassland_category_name)||(t==null?void 0:t.land_class_name)||(t==null?void 0:t.land_use_name)||(t==null?void 0:t.base_grass);r!=null&&r!==""&&(e.basic_type_name=r)}if(n==="grassland-level"){const r=(t==null?void 0:t.grassland_level)||(t==null?void 0:t.level)||(t==null?void 0:t.grassland_level_name)||(t==null?void 0:t.level_name);r!=null&&r!==""&&(e.grassland_level=r)}if(n==="grassland-type"||n==="wetland-type"){const r=(t==null?void 0:t.grass_min_type)||(t==null?void 0:t.grass_type)||(t==null?void 0:t.grassland_type)||(t==null?void 0:t.type_name)||(t==null?void 0:t.type);r!=null&&r!==""&&(e.grass_min_type=r)}if(n==="grassland-yield"||n==="wetland-yield"){const r=(t==null?void 0:t.yield)||(t==null?void 0:t.xc_yield)||(t==null?void 0:t.xb_xc_yield)||(t==null?void 0:t.fresh_grass_yield)||(t==null?void 0:t.value),o=(t==null?void 0:t.mu_yield)||(t==null?void 0:t.xc_mu_yield)||(t==null?void 0:t.xb_xc_mu_yield)||(t==null?void 0:t.yield_per_mu);r!=null&&r!==""&&(e.fresh_grass_yield=r),o!=null&&o!==""&&(e.mu_yield=o)}if(n==="grassland-health"){const r=(t==null?void 0:t.health_level)||(t==null?void 0:t.health_level_name)||(t==null?void 0:t.ndvi_level)||(t==null?void 0:t.level)||(t==null?void 0:t.level_name),o=(t==null?void 0:t.ndvi)||(t==null?void 0:t.NDVI)||(t==null?void 0:t.value);r!=null&&r!==""&&(e.health_level=r),o!=null&&o!==""&&(e.ndvi=o);const u=(t==null?void 0:t.degradation_level)||(t==null?void 0:t.degradation_level_name)||(t==null?void 0:t.level)||(t==null?void 0:t.level_name);u!=null&&u!==""&&(e.degradation_level=u)}}getScreenPointFromEvent(e){var a;const t=((a=e==null?void 0:e.data)==null?void 0:a.originalEvent)||(e==null?void 0:e.originalEvent)||e;return(t==null?void 0:t.clientX)!==void 0&&(t==null?void 0:t.clientY)!==void 0?{x:t.clientX,y:t.clientY}:null}getLngLatFromEvent(e){var u,c,p;const a=(p=(((c=(u=this.interactionManager)==null?void 0:u.raycaster)==null?void 0:c.intersectObject(e.target,!1))||[])[0])==null?void 0:p.point;if(!a)return null;const n=this.focusMapGroup.worldToLocal(a.clone()),o=Kt().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]).invert([n.x,-n.y]);return o?{lng:o[0],lat:o[1]}:null}lngLatToWmsPixel({lng:e,lat:t}){const a=(e-j.west)/(j.east-j.west)*yt.width,n=(j.north-t)/(j.north-j.south)*yt.height;return{x:a,y:n}}showSelectedFeature(e,t={}){var n;const a=(e==null?void 0:e.geometry)||((n=e==null?void 0:e.feature)==null?void 0:n.geometry);this.clearSelectedFeature(),this.createSelectedFeatureGroup(),this.addSelectedGeometry(a,t),this.selectedFeatureGroup.children.length||this.clearSelectedFeature()}showSelectedFeatures(e=[],t={}){this.clearSelectedFeature(),this.createSelectedFeatureGroup(),e.forEach(a=>{var r;const n=(a==null?void 0:a.geometry)||((r=a==null?void 0:a.feature)==null?void 0:r.geometry);this.addSelectedGeometry(n,t)}),this.selectedFeatureGroup.children.length||this.clearSelectedFeature()}setSelectedVectorFeatures(e=[]){this.selectedVectorFeatures=[...e],this.redrawVectorTopicLayer()}getSelectedFeatureStyle(e={}){const t=e.mode==="pasture",a=e.mode==="town";return{fillColor:Br,fillOpacity:t?.46:a?.24:.54,lineColor:Vu,lineOpacity:.98,glowColor:Er,glowOpacity:t?.92:.96,renderOrderBase:t?42:a?40:35,boundary:t||a,boundaryColor:Br,boundaryGlowColor:Er,boundaryWidth:a?.012:.018,boundaryGlowWidth:a?.045:.06,boundaryOpacity:.95,boundaryGlowOpacity:a?.34:.42}}addSelectedGeometry(e,t={}){if(!(e!=null&&e.coordinates)||!this.selectedFeatureGroup)return;const a=this.getSelectedFeatureStyle(t),n=this.getDisplayFeaturePolygons(e),r=new ye({color:a.fillColor,transparent:!0,opacity:a.fillOpacity,side:Re,depthWrite:!1,fog:!1}),o=new aa({color:a.lineColor,transparent:!0,opacity:a.lineOpacity,linewidth:2,depthTest:!1,depthWrite:!1,fog:!1}),u=new aa({color:a.glowColor,transparent:!0,opacity:a.glowOpacity,linewidth:3,depthTest:!1,depthWrite:!1,fog:!1}),c=a.boundary?new ye({color:a.boundaryColor,transparent:!0,opacity:a.boundaryOpacity,side:Re,depthTest:!1,depthWrite:!1,fog:!1}):null,p=a.boundary?new ye({color:a.boundaryGlowColor,transparent:!0,opacity:a.boundaryGlowOpacity,side:Re,depthTest:!1,depthWrite:!1,fog:!1,blending:Ie}):null;n.length&&n.forEach(g=>{const L=this.createProjectedShape(g);if(!L)return;const T=new Hl(L),C=new je(T,r);C.renderOrder=a.renderOrderBase,this.selectedFeatureGroup.add(C),g.forEach(N=>{const B=this.createProjectedRingPoints(N);if(B.length<3)return;a.boundary&&(this.addSelectedBoundaryBand(B,p,a.boundaryGlowWidth,a.renderOrderBase+1,!0),this.addSelectedBoundaryBand(B,c,a.boundaryWidth,a.renderOrderBase+4,!0));const z=new La().setFromPoints(B),X=new wr(z,o);X.renderOrder=a.renderOrderBase+5,this.selectedFeatureGroup.add(X);const ae=new La().setFromPoints(B),q=new wr(ae,u);q.renderOrder=a.renderOrderBase+3,q.scale.set(1.004,1.004,1),this.selectedFeatureGroup.add(q)})});const y=this.normalizeFeatureLineStrings(e);y.length&&y.forEach(g=>{const L=this.createProjectedRingPoints(g);if(L.length<2)return;a.boundary&&(this.addSelectedBoundaryBand(L,p,a.boundaryGlowWidth,a.renderOrderBase+1,!1),this.addSelectedBoundaryBand(L,c,a.boundaryWidth,a.renderOrderBase+4,!1));const T=new La().setFromPoints(L),C=new Lr(T,u);C.renderOrder=a.renderOrderBase+3,C.scale.set(1.004,1.004,1),this.selectedFeatureGroup.add(C);const N=new La().setFromPoints(L),B=new Lr(N,o);B.renderOrder=a.renderOrderBase+5,this.selectedFeatureGroup.add(B)})}addSelectedBoundaryBand(e,t,a,n,r=!0){if(!t||!this.selectedFeatureGroup)return;const o=this.createPathBandGeometry(e,a,r);if(!o)return;const u=new je(o,t);u.renderOrder=n,this.selectedFeatureGroup.add(u)}createPathBandGeometry(e,t,a=!0){const n=this.normalizePathBandPoints(e,a);if(n.length<(a?3:2))return null;const r=Math.max(Number(t)||0,0)/2;if(!r)return null;const o=[],u=a?n.length:n.length-1;for(let p=0;pNumber.isFinite(n==null?void 0:n.x)&&Number.isFinite(n==null?void 0:n.y)).map(n=>n.clone());if(t&&a.length>2){const n=a[0],r=a[a.length-1];n.distanceToSquared(r)<1e-10&&a.pop()}return a}clearSelectedFeature(){var t;const e=!!((t=this.selectedVectorFeatures)!=null&&t.length);this.selectedVectorFeatures=[],e&&this.redrawVectorTopicLayer(),this.clearSelectedGeometryGroup()}clearSelectedGeometryGroup(){var t,a;if(!this.selectedFeatureGroup)return;const e=new Set;for(;this.selectedFeatureGroup.children.length;){const n=this.selectedFeatureGroup.children.pop();(a=(t=n.geometry)==null?void 0:t.dispose)==null||a.call(t),Array.isArray(n.material)?n.material.forEach(r=>e.add(r)):e.add(n.material)}e.forEach(n=>{var r;return(r=n==null?void 0:n.dispose)==null?void 0:r.call(n)})}normalizeFeaturePolygons(e){return qr(e)}normalizeFeatureLineStrings(e){return e!=null&&e.coordinates?e.type==="LineString"?[e.coordinates]:e.type==="MultiLineString"?e.coordinates:[]:[]}getDisplayFeaturePolygons(e){const t=this.normalizeFeaturePolygons(e),a=this.getLayerClipBounds(this.currentTopicLayer);return a?t.map(n=>{const r=this.clipRingToBounds(n==null?void 0:n[0],a);if(r.length<3)return null;const o=n.slice(1).map(u=>this.clipRingToBounds(u,a)).filter(u=>u.length>=3);return[r,...o]}).filter(Boolean):t}clipRingToBounds(e=[],t){let a=e.map(r=>[Number(r==null?void 0:r[0]),Number(r==null?void 0:r[1])]).filter(([r,o])=>Number.isFinite(r)&&Number.isFinite(o));return[{inside:([r])=>r>=t.west,intersect:(r,o)=>this.getLngLatLineIntersection(r,o,"lng",t.west)},{inside:([r])=>r<=t.east,intersect:(r,o)=>this.getLngLatLineIntersection(r,o,"lng",t.east)},{inside:([,r])=>r>=t.south,intersect:(r,o)=>this.getLngLatLineIntersection(r,o,"lat",t.south)},{inside:([,r])=>r<=t.north,intersect:(r,o)=>this.getLngLatLineIntersection(r,o,"lat",t.north)}].forEach(r=>{const o=a;a=[],o.length&&o.forEach((u,c)=>{const p=o[(c+o.length-1)%o.length],y=r.inside(u),g=r.inside(p);y?(g||a.push(r.intersect(p,u)),a.push(u)):g&&a.push(r.intersect(p,u))})}),a}getLngLatLineIntersection(e,t,a,n){const r=a==="lng"?0:1,o=a==="lng"?1:0,u=t[r]-e[r];if(!u)return[...e];const c=(n-e[r])/u,p=[...e];return p[r]=n,p[o]=e[o]+(t[o]-e[o])*c,p}createProjectedShape(e){const t=e==null?void 0:e[0];if(!Array.isArray(t)||t.length<3)return null;const a=new Tr;return this.createProjectedRingPoints(t).forEach((r,o)=>{o===0?a.moveTo(r.x,r.y):a.lineTo(r.x,r.y)}),e.slice(1).forEach(r=>{const o=this.createProjectedRingPoints(r);if(o.length<3)return;const u=new Tr;o.forEach((c,p)=>{p===0?u.moveTo(c.x,c.y):u.lineTo(c.x,c.y)}),a.holes.push(u)}),a}createProjectedRingPoints(e){if(!Array.isArray(e))return[];const t=[];return e.forEach(a=>{if(!Array.isArray(a)||a.length<2)return;const n=Number(a[0]),r=Number(a[1]);if(!Number.isFinite(n)||!Number.isFinite(r))return;const[o,u]=this.geoProjection([n,r]);t.push(new te(o,-u,0))}),t}enhanceTexture(e){var a,n,r;const t=(n=(a=this.renderer)==null?void 0:a.instance)==null?void 0:n.capabilities;e.anisotropy=((r=t==null?void 0:t.getMaxAnisotropy)==null?void 0:r.call(t))||1,e.needsUpdate=!0}geoProjection(e){return Kt().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0])(e)}updateTownLabelScale(){var u,c,p;const e=this.townNameLabels||this.otherLabel||[],t=(u=this.camera)==null?void 0:u.instance,a=(p=(c=this.camera)==null?void 0:c.controls)==null?void 0:p.target;if(!e.length||!t||!a)return;const n=t.position.distanceTo(a),r=Ht(n*72e-5,.011,.026),o=n>45?"0.76":n<22?"0.94":"1";e.forEach(y=>{var L,T,C;if(((L=y==null?void 0:y.userData)==null?void 0:L.labelType)!=="town-label")return;y.scale.set(r,r,r);const g=(C=(T=y.element)==null?void 0:T.querySelector)==null?void 0:C.call(T,".other-label");g&&(g.style.opacity=o)})}update(e){super.update(e),this.updateDynamicSatelliteTiles(),this.updateTownLabelScale(),this.updateTradeFlowPulses(e),this.interactionManager&&this.interactionManager.update()}pauseScene(){var e,t;this.scenePaused=!0,(t=(e=this.time)==null?void 0:e.pause)==null||t.call(e),this.sceneTweens.forEach(a=>{var n;return(n=a==null?void 0:a.pause)==null?void 0:n.call(a)}),clearInterval(this.infoPointLabelTime),this.infoPointLabelTime=null}resumeScene(){var e,t;this.scenePaused=!1,(t=(e=this.time)==null?void 0:e.resume)==null||t.call(e),this.sceneTweens.forEach(a=>{var n;return(n=a==null?void 0:a.resume)==null?void 0:n.call(a)}),this.showTownRankingPointMarkers&&this.mapAnimationComplete&&!this.infoPointLabelTime&&this.createInfoPointLabelLoop()}destroy(){var e,t,a,n;this.pauseScene(),this.sceneTimers.forEach(r=>clearTimeout(r)),this.sceneTimers=[],this.sceneTweens.forEach(r=>{var o;return(o=r==null?void 0:r.kill)==null?void 0:o.call(r)}),this.sceneTweens=[],this.callbacks={},(t=(e=this.canvas)==null?void 0:e.removeEventListener)==null||t.call(e,"pointerdown",this.handleCanvasBoundaryPointerDown,!0),(n=(a=this.canvas)==null?void 0:a.removeEventListener)==null||n.call(a,"dblclick",this.handleCanvasBoundaryDoubleClick,!0),this.clearTradeFlowLayer(),this.clearSelectedFeature(),super.destroy(),this.label3d&&this.label3d.destroy()}}const Uu={class:"map"},Ku={__name:"map",props:{activeLayer:{type:Object,default:null},mapRanking:{type:Object,default:null},tileUrlTemplate:{type:String,default:""},satelliteTextureZoom:{type:Number,default:0},satelliteMaxZoom:{type:Number,default:21},adminBoundaryLineScale:{type:Number,default:1},useSatelliteBase:{type:Boolean,default:!0},showNationalBackdrop:{type:Boolean,default:!1},topicLayerPresentation:{type:String,default:"default"},hideTownLabelStats:{type:Boolean,default:!1}},emits:["feature-loading","feature-info","layer-status","tile-status","draw-boundary","scene-mounted"],setup(h,{expose:e,emit:t}){const a=h,n=t,r=V(null),o=xl(null);let u=null,c=null,p=null,y=null,g=null,L="",T="",C=!1;Qr(()=>{n("scene-mounted")}),es(()=>{Me()});function N(M){return o.value?!0:r.value?(o.value=new qu(r.value,M,{onFeatureLoading:v=>n("feature-loading",v),onFeatureInfo:v=>n("feature-info",v),onLayerStatus:v=>n("layer-status",v),onTileStatus:v=>n("tile-status",v),onDrawBoundary:v=>n("draw-boundary",v),tileUrlTemplate:a.tileUrlTemplate,satelliteTextureZoom:a.satelliteTextureZoom,satelliteMaxZoom:a.satelliteMaxZoom,adminBoundaryLineScale:a.adminBoundaryLineScale,useSatelliteBase:a.useSatelliteBase,showNationalBackdrop:a.showNationalBackdrop,topicLayerPresentation:a.topicLayerPresentation,hideTownLabelStats:a.hideTownLabelStats}),o.value.time.pause(),L=qe(a.activeLayer),T=ut(a.mapRanking),o.value.setTopicLayers(be(a.activeLayer),a.activeLayer),o.value.setTownRanking(a.mapRanking),me(),Fe(),!0):!1}function B(){return!!o.value}function z(){return oe(this,null,function*(){var M,v,R,D,H,ee;if(o.value&&(X(),!o.value.mapAnimationComplete)){if(C){(v=(M=o.value.animateTl)==null?void 0:M.play)==null||v.call(M),ot();return}C=!0,(D=(R=o.value.animateTl)==null?void 0:R.timeScale)==null||D.call(R,1),(ee=(H=o.value.animateTl)==null?void 0:H.play)==null||ee.call(H),ot()}})}function X(){var M,v;o.value&&(me(),Fe(),window.requestAnimationFrame(()=>{var R,D,H,ee,ce,Ge;(H=(D=(R=o.value)==null?void 0:R.label3d)==null?void 0:D.resize)==null||H.call(D),(Ge=(ce=(ee=o.value)==null?void 0:ee.label3d)==null?void 0:ce.update)==null||Ge.call(ce)}),(v=(M=o.value).resumeScene)==null||v.call(M),o.value.resumeScene||o.value.time.resume())}function ae(){var M,v,R,D,H,ee;o.value&&(_e(),(v=(M=o.value.animateTl)==null?void 0:M.pause)==null||v.call(M),(D=(R=o.value).pauseScene)==null||D.call(R),o.value.pauseScene||(ee=(H=o.value.time)==null?void 0:H.pause)==null||ee.call(H),lt())}function q(){var M,v;(v=(M=o.value)==null?void 0:M.clearSelectedFeature)==null||v.call(M)}function I(M){var v,R;(R=(v=o.value)==null?void 0:v.focusProject)==null||R.call(v,M)}function Ce(M){var v,R;(R=(v=o.value)==null?void 0:v.focusPasture)==null||R.call(v,M)}function He(M,v){var R,D;return(D=(R=o.value)==null?void 0:R.focusTownByName)==null?void 0:D.call(R,M,v)}function Qe(M){var v,R;return(R=(v=o.value)==null?void 0:v.focusYakIndustryPoint)==null?void 0:R.call(v,M)}function bt(M){var v,R;return(R=(v=o.value)==null?void 0:v.focusVectorFeature)==null?void 0:R.call(v,M)}function O(M){var v,R;return(R=(v=o.value)==null?void 0:v.getVectorFeatureScreen)==null?void 0:R.call(v,M)}function We(M){var v,R;return(R=(v=o.value)==null?void 0:v.getYakIndustryPointScreen)==null?void 0:R.call(v,M)}function vt(M){var v,R;(R=(v=o.value)==null?void 0:v.setBoundaryDrawing)==null||R.call(v,M)}function Rt(){var M,v;return(v=(M=o.value)==null?void 0:M.finishBoundaryDrawing)==null?void 0:v.call(M)}function st(){var M,v;(v=(M=o.value)==null?void 0:M.undoBoundaryPoint)==null||v.call(M)}function It(){var M,v;(v=(M=o.value)==null?void 0:M.clearAnalysisBoundary)==null||v.call(M)}function wt(M){var v,R;(R=(v=o.value)==null?void 0:v.showAnalysisResult)==null||R.call(v,M)}function Me(){var M,v;_e(),lt(),(v=(M=o.value)==null?void 0:M.destroy)==null||v.call(M),o.value=null}function ot(){_e(),g=window.setTimeout(()=>{var M,v;g=null,(v=(M=o.value)==null?void 0:M.ensureMapRevealed)==null||v.call(M)},5200)}function _e(){g&&(window.clearTimeout(g),g=null)}function Fe(){c&&window.cancelAnimationFrame(c),c=window.requestAnimationFrame(()=>{var M,v,R,D,H;c=null,(R=(v=(M=o.value)==null?void 0:M.sizes)==null?void 0:v.init)==null||R.call(v),(H=(D=o.value)==null?void 0:D.resize)==null||H.call(D)}),p&&window.clearTimeout(p),p=window.setTimeout(()=>{var M,v,R,D,H;p=null,(R=(v=(M=o.value)==null?void 0:M.sizes)==null?void 0:v.init)==null||R.call(v),(H=(D=o.value)==null?void 0:D.resize)==null||H.call(D)},180)}function me(){var v;lt();const M=(v=r.value)==null?void 0:v.parentNode;M&&window.ResizeObserver&&(u=new ResizeObserver(()=>Fe()),u.observe(M)),y=window.setInterval(Ne,1e3),Ut(Fe)}function Ne(){var ce;if(!o.value||!r.value)return;const M=r.value.parentNode,v=(M==null?void 0:M.offsetWidth)||window.innerWidth||1,R=(M==null?void 0:M.offsetHeight)||window.innerHeight||1,D=((ce=o.value.sizes)==null?void 0:ce.pixelRatio)||1,H=Math.floor(v*D),ee=Math.floor(R*D);(r.value.width!==H||r.value.height!==ee)&&Fe()}function lt(){u&&(u.disconnect(),u=null),c&&(window.cancelAnimationFrame(c),c=null),p&&(window.clearTimeout(p),p=null),y&&(window.clearInterval(y),y=null)}function Lt(){if(!o.value)return;me();const M=()=>{var v,R,D,H,ee,ce,Ge,Oe,Ae,Be,Ee,Ue,et,he,pe,Z,tt,ct,ve,Tt,St;o.value&&((R=(v=o.value)==null?void 0:v.resumeScene)==null||R.call(v),o.value.resumeScene||(H=(D=o.value.time)==null?void 0:D.resume)==null||H.call(D),(Ge=(ce=(ee=o.value)==null?void 0:ee.sizes)==null?void 0:ce.init)==null||Ge.call(ce),(Ae=(Oe=o.value)==null?void 0:Oe.resize)==null||Ae.call(Oe),(Ue=(Ee=(Be=o.value)==null?void 0:Be.label3d)==null?void 0:Ee.resize)==null||Ue.call(Ee),(pe=(he=(et=o.value)==null?void 0:et.label3d)==null?void 0:he.update)==null||pe.call(he),(tt=(Z=o.value)==null?void 0:Z.setTopicLayers)==null||tt.call(Z,be(a.activeLayer),a.activeLayer),(ve=(ct=o.value)==null?void 0:ct.setTownRanking)==null||ve.call(ct,a.mapRanking),(St=(Tt=o.value)==null?void 0:Tt.ensureMapRevealed)==null||St.call(Tt))};Fe(),window.requestAnimationFrame(M),window.setTimeout(()=>{M()},80),window.setTimeout(()=>{M()},220)}function ze(){if(!o.value)return;me();const M=()=>{var R,D,H,ee,ce,Ge,Oe,Ae,Be,Ee,Ue,et,he,pe,Z,tt;const v=o.value;v&&((R=v.resumeScene)==null||R.call(v),v.resumeScene||(H=(D=v.time)==null?void 0:D.resume)==null||H.call(D),(ce=(ee=v.sizes)==null?void 0:ee.init)==null||ce.call(ee),(Ge=v.resize)==null||Ge.call(v),(Oe=v.ensureMapRevealed)==null||Oe.call(v),(Ae=v.setTradeNationalMapVisible)==null||Ae.call(v,!1),(Be=v.setTopicLayers)==null||Be.call(v,be(a.activeLayer),a.activeLayer),(Ee=v.setTownRanking)==null||Ee.call(v,a.mapRanking),(Ue=v.applyLayerMapView)==null||Ue.call(v,v.currentTopicLayer||a.activeLayer||null,{force:!0}),(he=(et=v.label3d)==null?void 0:et.resize)==null||he.call(et),(Z=(pe=v.label3d)==null?void 0:pe.update)==null||Z.call(pe),(tt=v.updateDynamicSatelliteTiles)==null||tt.call(v,!0))};Fe(),window.requestAnimationFrame(M),window.setTimeout(M,100),window.setTimeout(M,260)}Zt(()=>a.activeLayer,M=>{const v=qe(M);v!==L&&(L=v,o.value&&o.value.setTopicLayers(be(M),M))},{deep:!0}),Zt(()=>a.mapRanking,M=>{const v=ut(M);v!==T&&(T=v,o.value&&o.value.setTownRanking(M))},{deep:!0}),e({loadMap:N,hasMap:B,play:z,resume:X,pause:ae,clearSelectedFeature:q,focusProject:I,focusPasture:Ce,focusTown:He,focusYakIndustryPoint:Qe,focusVectorFeature:bt,getVectorFeatureScreen:O,getYakIndustryPointScreen:We,setBoundaryDrawing:vt,finishBoundaryDrawing:Rt,undoBoundaryPoint:st,clearAnalysisBoundary:It,showAnalysisResult:wt,refreshView:Lt,resetView:ze,destroyMap:Me,canvasMap:o});function qe(M){return M?be(M).map(v=>{var R,D;return[v.key||"",v.layerName||"",v.styles||"",v.sldBody||"",v.cqlFilter||"",((R=v.activeLegend)==null?void 0:R.key)||"",Array.isArray(v.activeLegends)?v.activeLegends.map(H=>(H==null?void 0:H.key)||"").join(","):"",v.timelineDate||"",((D=v.timelineItem)==null?void 0:D.key)||"",v.sourceType||"",v.dataPath||"",v.fallbackPath||""].join("|")}).join("||"):""}function be(M){if(!M)return[];const v=Array.isArray(M.overlayLayers)?M.overlayLayers.filter(Boolean):[];return[M,...v]}function ut(M){var v,R,D,H,ee,ce,Ge,Oe,Ae,Be;return M?[M.status||"",M.topicKey||"",M.layerKey||"",M.title||"",M.metricLabel||"",M.scope||"",M.displayMode||"",(v=M.showPointMarkers)!=null?v:"",(R=M.showBars)!=null?R:"",(D=M.showTownNames)!=null?D:"",(H=M.showMapLabels)!=null?H:"",(ee=M.hideTownLabelStats)!=null?ee:"",(ce=M.showFlowLines)!=null?ce:"",(Ge=M.onlyRankedTownLabels)!=null?Ge:"",(Oe=M.showMissingTownStats)!=null?Oe:"",((Ae=M.rows)==null?void 0:Ae.length)||0,((Be=M.rows)==null?void 0:Be.map(Ee=>{var Ue;return`${Ee.key||Ee.name||""}:${(Ue=Ee.value)!=null?Ue:""}`}).join(","))||""].join("|"):""}return(M,v)=>(x(),_("div",Uu,[f("canvas",{ref_key:"canvasRef",ref:r},null,512)]))}},it={}.VITE_OPEN_API_BASE||"/openApi",Zu=new Date().getFullYear();function Xu(h,e){return/^https?:\/\//.test(e)?e:`${h}${e.startsWith("/")?e:`/${e}`}`}function Ju(h){if((h==null?void 0:h.success)===!1&&(h==null?void 0:h.code)!==void 0&&![0,200,"0","200"].includes(h.code))throw new Error((h==null?void 0:h.msg)||(h==null?void 0:h.message)||"接口请求失败");return Rl(h)}function rt(h,e,t,a={}){return ai(Xu(h,e),{params:t,timeout:a.timeout||18e3}).then(Ju)}function Qu(){return rt(it,"/screen2/yak-management/distribution").then(h=>ns(h))}function ec(){return rt(it,"/screen2/yak-management/structure").then(h=>ns(h))}function tc(){return rt(it,"/screen2/yak-management/profile").then(h=>h||{})}function Ur(h=Zu){return rt(it,"/screen2/yak-trade/dashboard",typeof h=="object"?h:{year:h}).then(nc)}function ac(){return rt(it,"/screen2/yak-trade/options").then(h=>h||{})}function Kr(h={}){return rt(it,"/screen2/yak-trade/ledger",h).then(ic)}function nc(h={}){var r,o;const e=Array.isArray(h.metrics)?h.metrics:[],t=u=>{var c;return Number(((c=e.find(p=>p.key===u))==null?void 0:c.value)||0)},a=Array.isArray(h.certificateStructure)?h.certificateStructure:[],n=(u,c)=>{var p;return Number(((p=a.find(y=>y.key===u))==null?void 0:p[c])||0)};return $(F({},h),{hasData:(o=(r=h.requestedHasData)!=null?r:h.hasData)!=null?o:!1,year:h.displayYear,metrics:{headCount:t("headCount"),totalHeads:t("headCount"),recordCount:t("recordCount"),totalRecords:t("recordCount"),vehicleCount:t("vehicleCount"),outProvinceHeads:n("A证","value"),outProvinceCount:n("A证","recordCount"),aCertHeads:n("A证","value"),aCertCount:n("A证","recordCount"),inProvinceHeads:n("B证","value"),inProvinceCount:n("B证","recordCount"),bCertHeads:n("B证","value"),bCertCount:n("B证","recordCount")},startTownCounts:h.townRanking||[],usageCounts:h.usageStructure||[],transportNumberCounts:h.vehicleRanking||[],destinationCounts:h.destinationRanking||[]})}function ic(h={}){const e=Array.isArray(h.rows)?h.rows.map(t=>({certId:t.recordKey,factoryCode:t.recordKey,certType:t.certType,certScopeName:t.certType,ownerName:t.ownerDisplay,ownerPhone:"",transportNumber:t.vehicleDisplay,amount:t.amount,unitName:t.unit||"头",animalTypeName:"",usageTypeName:t.usageType,startTown:t.startTown,startRegionFullName:t.startTown,destProvince:t.destProvince,destRegionFullName:t.destProvince,quarantineOfficerName:"",issueTime:t.issueDate,statusName:t.status})):[];return $(F({},h),{rows:e})}function rc(h={}){return rt(it,"/screen2/yak-management/epidemic/analysis",h).then(e=>e||{})}function Zn(h={}){return rt(it,"/screen2/yak-management/epidemic/records",h).then(e=>e||{})}function sc(h={}){return rt(it,"/screen2/yak-management/epidemic/stats",h).then(e=>e||{})}function oc(h={}){return rt(it,"/screen2/yak-management/epidemic/village-stats",h).then(e=>e||{})}function lc(h){return rt(it,"/screen2/yak-management/epidemic/detail",{earTag:h}).then(e=>e||null)}function uc(){return oe(this,null,function*(){return(yield Qu()).map((e,t)=>({key:Jt(e,["areaCode","area_code","code","id"],`yak-town-${t}`),name:Jt(e,["areaName","area_name","zoneName","townName","name"],`区域${t+1}`),value:is(Jt(e,["number","yakCount","yak_count","count","value"])),unit:"头"})).filter(e=>e.name&&Number.isFinite(e.value)).sort((e,t)=>t.value-e.value)})}function cc(){return oe(this,null,function*(){const e=(yield ec()).map((t,a)=>{const n=Jt(t,["sex","gender"],""),r=hc(n),o=Jt(t,["ageRange","age_range","age","name","type"],""),u=[r,o].filter(Boolean).join(" ")||`结构${a+1}`;return{key:Jt(t,["id","key"],`${u}-${a}`),name:u,value:is(Jt(t,["number","count","value"])),unit:"头"}}).filter(t=>t.name&&Number.isFinite(t.value));return dc(e)})}function ns(h){return Array.isArray(h)?h:Array.isArray(h==null?void 0:h.rows)?h.rows:Array.isArray(h==null?void 0:h.list)?h.list:Array.isArray(h==null?void 0:h.records)?h.records:Array.isArray(h==null?void 0:h.data)?h.data:[]}function dc(h=[]){const e=new Map;return h.forEach(t=>{const a=e.get(t.name)||$(F({},t),{value:0});a.value+=t.value,e.set(t.name,a)}),[...e.values()].sort((t,a)=>a.value-t.value)}function Jt(h,e,t=""){for(const a of e){const n=h==null?void 0:h[a];if(n!=null&&n!=="")return n}return t}function hc(h){return["boy","male","公","公牛"].includes(h)?"公牛":["girl","female","母","母牛"].includes(h)?"母牛":h||""}function is(h){if(h==null||h==="")return NaN;const e=Number(String(h).replace(/,/g,"").replace(/%/g,""));return Number.isFinite(e)?e:NaN}let rs=0,ss=0,os=0,Nt=0;const ls=[],ua=[],ei=[],un=[],xt=[],ti=[],us=[];function pc(h={}){const e=new Map((h.metrics||[]).map(t=>[t.key,Number(t.value||0)]));rs=e.get("recognition_count")||0,ss=e.get("expert_correction")||0,os=e.get("trade_deduction")||0,Nt=e.get("estimated_stock")||0,qt(ls,h.towns,t=>{var a,n;return{key:t.key,name:t.name,count:Number((n=(a=t.count)!=null?a:t.value)!=null?n:0),recognitionCount:Number(t.recognitionCount||0),devices:Number(t.devices||0)}}),qt(ua,h.structure,t=>{var a,n;return{key:t.key,name:t.name,count:Number((n=(a=t.count)!=null?a:t.value)!=null?n:0),ratio:Number(t.ratio||0)}}),qt(un,h.genderAge,t=>({age:t.age,cow:Number(t.cow||0),bull:Number(t.bull||0)})),qt(xt,h.forecastPeriods,t=>$(F({},t),{key:String(t.key),shortLabel:t.shortLabel||String(t.key),months:Number(t.months||0),stock:Number(t.stock||0),births:Number(t.births||0),outflow:Number(t.outflow||0),correction:Number(t.correction||0)})),qt(ti,h.forecastFactors,t=>$(F({},t),{value:Number(t.value||0)})),qt(ei,h.tradeImpacts,(t,a)=>$(F({},t),{value:Number(t.value||0),yoy:Number(t.yoy||0),color:["#48cfff","#30dcff","#8bf7ff","#48cfff"][a%4]})),qt(us,h.forecastMonths,t=>({month:t.month,count:Number(t.count||0),speed:Number(t.speed||0)}))}function qt(h,e,t){h.splice(0,h.length,...Array.isArray(e)?e.map(t):[])}function cn(h){return String(h||"").trim()}function fc(h){return xt.find(e=>e.key===h)||xt[1]||xt[0]||{key:String(h||""),label:"暂无预测",shortLabel:"--",months:1,stock:Nt,births:0,outflow:0,correction:0,structure:{}}}function mc(h){return(Array.isArray(h==null?void 0:h.structureRows)?h.structureRows:[]).map(e=>$(F({},e),{count:Number(e.count||0),ratio:Number(e.ratio||0)}))}function gc(h){return(Array.isArray(h==null?void 0:h.townRows)?h.townRows:[]).map(e=>$(F({},e),{count:Number(e.count||0),forecast:Number(e.forecast||0),change:Number(e.change||0)}))}function yc(h){var t;const e=((t=h==null?void 0:h.series)==null?void 0:t.month)||{};return{labels:Array.isArray(e.labels)?e.labels:[],stock:Array.isArray(e.stock)?e.stock.map(Number):[],births:Array.isArray(e.births)?e.births.map(Number):[],outflow:Array.isArray(e.outflow)?e.outflow.map(Number):[]}}function bc(h){const e=new Map;return h.forEach(t=>{const a=cn(t.name),n=e.get(a)||{name:a,count:0};n.count+=Number(t.count||0),e.set(a,n)}),[...e.values()].sort((t,a)=>a.count-t.count)}const vc={class:"yak-management"},wc={key:0},Lc={class:"yak-management-ui"},Tc={key:0,class:"trade-year-switcher","aria-label":"交易年份切换"},Sc=["onClick"],Mc={key:1,class:"epidemic-year-switcher","aria-label":"防疫年份切换"},kc=["onClick"],Pc={key:2,class:"forecast-year-switcher","aria-label":"预测年份切换"},Cc=["onClick"],Fc={class:"yak-left"},Nc={class:"yak-side-stack is-left"},xc={class:"breeding-health-card"},Rc={class:"breeding-health-head"},Ic={class:"breeding-health-grid"},_c={class:"structure-chart-card"},Gc={class:"structure-ratio-card"},Ac={class:"structure-ratio-chart"},Bc={viewBox:"0 0 150 150",preserveAspectRatio:"xMidYMid meet","aria-hidden":"true"},Ec={class:"structure-rose-segments"},$c=["d","fill","stroke"],Vc={class:"structure-ratio-list"},Dc={key:0,class:"yak-data-status"},zc={key:1,class:"yak-data-status is-warning"},Oc={class:"forecast-waterfall-card"},Wc={class:"forecast-waterfall-head"},Yc={class:"forecast-waterfall-list"},jc={class:"forecast-trend-card"},Hc={class:"forecast-density-switcher","aria-label":"预测粒度切换"},qc=["onClick"],Uc={key:0,class:"epidemic-three-pie-card"},Kc={class:"epidemic-three-pie-visual"},Zc={class:"epidemic-three-pie-center"},Xc={class:"epidemic-three-pie-legend"},Jc={key:1,class:"epidemic-empty"},Qc={class:"trade-risk-card"},ed={class:"trade-risk-head"},td={class:"trade-risk-list"},ad={class:"yak-right"},nd={class:"yak-side-stack is-right"},id={class:"structure-chart-card"},rd={class:"structure-summary-card"},sd={key:0,class:"yak-data-status"},od={key:1,class:"yak-data-status is-warning"},ld={class:"forecast-heat-list"},ud=["title"],cd={class:"epidemic-record-table is-full"},dd={class:"epidemic-record-toolbar"},hd={class:"epidemic-record-rows"},pd=["onClick"],fd={key:0,class:"epidemic-empty"},md={class:"epidemic-record-pager"},gd=["disabled"],yd=["disabled"],bd={class:"trade-cert-card"},vd={class:"trade-cert-main"},wd={class:"trade-dest-list"},Ld={key:0,class:"epidemic-empty"},Td={class:"trade-ledger-table"},Sd={class:"trade-ledger-toolbar"},Md={class:"trade-ledger-rows"},kd=["onClick"],Pd={key:0,class:"epidemic-empty"},Cd={class:"trade-ledger-pager"},Fd=["disabled"],Nd=["disabled"],xd={class:"yak-bottom-topic"},Rd={key:3,class:"yak-map-layer-tools"},Id={class:"epidemic-ledger-dialog"},_d={class:"epidemic-ledger-dialog-head"},Gd={class:"epidemic-ledger-filters"},Ad=["value"],Bd=["value"],Ed={class:"epidemic-ledger-workspace"},$d={class:"epidemic-ledger-list"},Vd=["onClick"],Dd={key:0,class:"epidemic-empty"},zd={class:"epidemic-ledger-detail trade-ledger-detail epidemic-ledger-record-detail"},Od={class:"epidemic-detail-head trade-detail-head"},Wd={class:"epidemic-detail-grid is-modal trade-detail-grid epidemic-detail-flat-grid"},Yd={key:0,class:"epidemic-detail-photos"},jd={class:"epidemic-modal-photo-strip"},Hd=["onClick"],qd=["src"],Ud={class:"epidemic-ledger-pager"},Kd=["disabled"],Zd=["disabled"],Xd={class:"epidemic-ledger-dialog trade-ledger-dialog"},Jd={class:"epidemic-ledger-dialog-head"},Qd={class:"epidemic-ledger-filters trade-ledger-filters"},eh=["value"],th=["value"],ah=["value"],nh={class:"epidemic-ledger-workspace trade-ledger-workspace"},ih={class:"epidemic-ledger-list trade-ledger-modal-list"},rh=["onClick"],sh={key:0,class:"epidemic-empty"},oh={class:"epidemic-ledger-detail trade-ledger-detail"},lh={class:"epidemic-detail-head trade-detail-head"},uh={class:"epidemic-detail-grid is-modal trade-detail-grid"},ch={class:"is-wide"},dh={class:"is-wide"},hh={class:"is-wide"},ph={class:"is-wide"},fh=["disabled"],mh={class:"epidemic-ledger-pager"},gh=["disabled"],yh=["disabled"],bh={class:"epidemic-image-preview-dialog"},vh={class:"epidemic-image-preview-head"},wh={class:"epidemic-image-preview-body"},Lh={class:"epidemic-image-preview-frame"},Th=["src"],Sh="",Mh="/external/satellite/{z}/{x}/{y}.png",kh=9,Ph="oss-satellite-dynamic-zoom21-v5",sn="#43d9e8",on=8,Zr=14,Xn=8,Xr=14,ln=6,Ch=4200,Jr="#FFE600",Dh={__name:"index",props:{active:{type:Boolean,default:!0},viewKey:{type:String,default:"structure"}},emits:["module-stats","view-change"],setup(h,{expose:e,emit:t}){const a=h,n=t,r=Sr.sideCardWidth;Sr.sideCardGap;const o=V(typeof window=="undefined"?1080:window.innerHeight),u=S(()=>Ul(o.value)),c=S(()=>Mr(u.value,2)),p=S(()=>u.value),y=S(()=>Mr(u.value,2)),g=Ta.textPrimary,L=Ta.textStrong,T=Ta.textSecondary,C=Ta.textMuted,N=Ta.chartGridLine,B=su,z=B,X=B,ae=ou,q={targetLngLat:[102.6,32.59],targetLocalZ:.72,distanceScale:1.05,duration:.75},I=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff"],Ce=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff"],He=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff","#48cfff"],Qe={name:"红原牦牛交易市场",lng:102.562157,lat:32.820484},bt=[{key:"structure",name:"畜群结构",color:"#30dcff"},{key:"forecast",name:"畜群预测",color:"#8bf7ff"},{key:"epidemic",name:"牦牛防疫",color:"#8bf7ff"},{key:"trade",name:"牦牛交易",color:"#63d7ff"}],O=V(jn(a.viewKey)),We=V([]),vt=V("2027"),Rt=V("month"),st=V(0),It=V([]),wt=V([]),Me=V(0),ot=V(!1),_e=V(""),Fe=[2025,2026],me=V(2026),Ne=V({metrics:{}}),lt=V({rows:[],year:null}),Lt=V({rows:[]}),ze=V([]),qe=V(0),be=V(1),ut=V(""),M=V(""),v=V(!1),R=V(""),D=V(!1),H=V([]),ee=V(0),ce=V(1),Ge=V(!1),Oe=V(""),Ae=V(null),Be=V(null),Ee=V(!1),Ue=V(!1),et=V(""),he=V(Ya()),pe=V({years:[],latestYear:null}),Z=V({metrics:{},hasData:!1}),tt=V([]),ct=V(0),ve=V(null),Tt=V(!1),St=V(""),Mt=V(1),Ca=V(""),pn=V(""),fn=V(!1),Vt=V([]),Fa=V(0),Dt=V(1),mn=V(!1),gn=V(""),Na=V(null),dt=V({keyword:"",startTown:"",usageType:"",certType:""}),xe=V(null),ha=V(null),Qt=V(!1),pa=V(!1),Ye=V(!1),ii=V(0),ri=V(0),xa=V({type:"idle",text:""}),Ra=V({type:"idle",text:""});let yn=null,Ia=!1,si=!1,_t=!1,kt=null,_a=!1,Ga=null,Aa=0,oi=!1,li=!1,ui=!1;const bn=[{key:"day",label:"日",unit:"日",stepDays:1},{key:"week",label:"周",unit:"周",stepDays:7},{key:"month",label:"月",unit:"月",stepDays:30}],Ke=S(()=>(Me.value,fc(vt.value))),cs=new Set(["epidemic","trade"]),vn=S(()=>!cs.has(O.value)),ci=S(()=>vn.value?Mh:""),ds=S(()=>vn.value?"oss-satellite":"solid-3d"),hs=S(()=>`yak-management-map-${ds.value}-${Ph}-${ii.value}`),ps=S(()=>(Me.value,ss+os)),wn=S(()=>Ke.value.stock-Nt),fs=S(()=>Sl(Ke.value)),Ba=S(()=>(Me.value,ml(wt.value,ua))),ms=S(()=>Ba.value.reduce((i,s)=>i+Number(s.count||0),0));S(()=>{const i=ms.value||1;return Ba.value.map((s,l)=>{const d=Number(s.count||0),m=Number(s.ratio);return $(F({},s),{count:d,color:I[l%I.length],percent:Number.isFinite(m)?m:d/i*100})})});const gs=S(()=>pr(Ba.value,ua)),Ea=S(()=>gs.value),di=S(()=>bl(Ea.value)),hi=S(()=>vl(Ba.value,ua)),pi=S(()=>Ll(hi.value)),ys=S(()=>Math.max(...di.value.map(i=>Number(i.count||0)),1)),Ln=S(()=>Ea.value.length?0:-1),bs=S(()=>{const i=Ea.value,s=i.length;if(!s)return[];const l=Math.max(...i.map(b=>Number(b.count||0)),1),d=360/s,m=Math.min(8,d*.16);return i.map((b,w)=>{const k=Number(b.count||0),G=w===Ln.value,E=36+Math.sqrt(k/l)*31+(G?5:0),A=17,K=-90+w*d+m/2,re=-90+(w+1)*d-m/2,se=(K+re)/2,fe=Wt(75,75,E+3,se),$e=Wt(75,75,E+15,se),mt=Wt(75,75,E+20,se);return{key:b.key||b.name||w,index:w,item:b,color:b.color||I[w%I.length],path:yl(75,75,A,E,K,re),lineStart:fe,lineEnd:$e,label:mt,anchor:Math.cos(se*Math.PI/180)>=0?"start":"end"}})}),fi=S(()=>dr(["fertileCow","overageCow"])),mi=S(()=>dr(["femaleCalf","maleCalf"])),Gt=S(()=>(Me.value,(It.value.length?It.value:ls).map(i=>$(F({},i),{name:cn(i.name),count:Number(i.count||0)})).filter(i=>i.name&&Number.isFinite(i.count)&&i.count>=0))),Tn=S(()=>(Me.value,us)),Sn=S(()=>(Me.value,gc(Ke.value))),vs=S(()=>(Me.value,mc(Ke.value))),fa=S(()=>{var i;return((i=Ne.value)==null?void 0:i.metrics)||{}}),Mn=S(()=>{var i;return Pt((i=Ne.value)==null?void 0:i.dateTrend).sort($o)}),$a=S(()=>{var i;return Pt((i=Ne.value)==null?void 0:i.medicineCounts)}),Va=S(()=>$a.value.filter(i=>i.value>0).map((i,s)=>$(F({},i),{key:i.key||`${i.name}-${s}`,unit:"条"}))),ws=S(()=>Va.value.map(i=>`${i.name}:${i.value}`).join("|")||"epidemic-medicine-empty"),Ls=S(()=>{var i;return Pt((i=Ne.value)==null?void 0:i.ownerRanks).slice(0,8)}),At=S(()=>ea(fa.value,["vaccineTypes"])||xi(Ne.value)),Ts=S(()=>{var i;return((i=$a.value.find(s=>s.name&&s.name!=="未填写"))==null?void 0:i.name)||"-"}),ht=S(()=>ea(fa.value,["total","vaccine"]));S(()=>ea(fa.value,["owners"]));const Ss=S(()=>ea(fa.value,["villages"])),kn=S(()=>zt.value.length),Ms=S(()=>{var i;return((i=zt.value[0])==null?void 0:i.name)||"-"}),gi=S(()=>{const i=ze.value.map(s=>s.operateTime).filter(Boolean).sort();return i.length?Et(i[i.length-1]):"-"}),Pn=S(()=>{const i=ea(fa.value,["earTags"]);if(i>0)return i;const s=Math.max(...$a.value.map(l=>Number(l.value||0)),0);return s>0?s:Math.round(ht.value/At.value)}),Cn=S(()=>{var s;const i=Io((s=lt.value)==null?void 0:s.rows);return i.length?i:zt.value.map(l=>({name:l.name,recordCount:Number(l.recordCount||0),earTagCount:Number(l.earTagCount||0),ratio:l.ratio,source:"ledger"}))}),yi=S(()=>{var s;const i=new Set;return Vn((s=Lt.value)==null?void 0:s.rows).filter(l=>Number.isFinite(l.lng)&&Number.isFinite(l.lat)).map((l,d)=>{const m=`${l.lng.toFixed(4)},${l.lat.toFixed(4)}`,b=i.has(m)?(d%3-1)*.012:0;return i.add(m),$(F({},l),{name:l.village,value:l.earTagCount,unit:"万头",lng:l.lng+b,lat:l.lat-b*.65,displayValue:Number((l.earTagCount/1e4).toFixed(2)),displayUnit:"万头",rankLabel:`第${d+1}名`})})}),zt=S(()=>{var s;const i=new Map;return Pt((s=Ne.value)==null?void 0:s.townCounts).forEach(l=>{var b,w;const d=Xe(l.name);if(!d)return;const m=i.get(d)||{recordCount:0,earTagCount:0};m.recordCount+=Number((w=(b=l.recordCount)!=null?b:l.value)!=null?w:0),m.earTagCount+=Number(l.earTagCount||0),i.set(d,m)}),[...i.entries()].map(([l,d])=>{const m=Number(d.recordCount||0),b=Number(d.earTagCount||0)||Math.round(m/At.value),w=ht.value?m/ht.value*100:0;return{name:l,recordCount:m,earTagCount:b,ratio:w}}).sort((l,d)=>Number(d.recordCount||0)-Number(l.recordCount||0))}),ks=S(()=>Math.max(Gt.value.length,kn.value)),Ps=S(()=>new Set(zt.value.map(i=>Xe(i.name)).filter(Boolean))),Bt=S(()=>{const i=Ps.value;return Gt.value.map(s=>Xe(s.name)).filter(s=>s&&!i.has(s))}),Cs=S(()=>{const i=ks.value||kn.value||1;return kn.value/i*100});S(()=>Nt?Pn.value/Nt*100:0);const Da=S(()=>Do());S(()=>ht.value?Bt.value.length?Bt.value.length:Da.value.name&&Da.value.name!=="暂无"?1:0:0);const Fs=S(()=>zo()),Ns=S(()=>Oo()),xs=S(()=>Wo());S(()=>Yo());const Rs=S(()=>jo());S(()=>Rs.value.slice(0,3)),S(()=>ht.value?Bt.value.length?"年度免疫进度需核查":Da.value.desc:"年度计划待核查");const Fn=S(()=>Math.max(Math.ceil(qe.value/on),1)),Is=S(()=>ze.value.slice(0,on)),bi=S(()=>Math.max(Math.ceil(ee.value/Zr),1)),Ot=S(()=>Be.value||Ae.value||{}),vi=S(()=>zn(Ot.value)),_s=S(()=>{const i=Ot.value||{};return[ke("台账编号",i.epidemicId,{wide:!0}),ke("养殖户",i.owner,{wide:!0}),ke("联系电话",Vi(i.phone)),ke("证件类型",i.idType),ke("证件号码",Ko(i.idNo)),ke("镇/乡",i.town),ke("村",i.village),ke("详细地址",i.location,{wide:!0}),ke("畜种",i.livestockType),ke("性别",i.sex),ke("畜龄",i.age),ke("体重",Zo(i.weight)),ke("疫苗/药品",i.medicine),ke("防疫类型",i.preventionType),ke("免疫方式",i.method),ke("剂量",Xo(i.dose)),ke("免疫时间",Et(i.operateTime)),ke("操作员",i.operator)].filter(Boolean)}),Gs=S(()=>{var i;return Pt((i=Ne.value)==null?void 0:i.townCounts).map(s=>s.name)}),As=S(()=>$a.value.map(i=>i.name).filter(i=>i&&i!=="未填写")),wi=S(()=>{var i;return((i=Z.value)==null?void 0:i.metrics)||{}}),Li=S(()=>{var i,s,l,d,m,b,w,k;return Ri((i=pe.value)==null?void 0:i.years,(s=Z.value)==null?void 0:s.availableYears,(l=Z.value)==null?void 0:l.available_years,(d=Z.value)==null?void 0:d.yearSummary,(m=Z.value)==null?void 0:m.year_summary,(b=Z.value)==null?void 0:b.latestYear,(w=Z.value)==null?void 0:w.latest_year,(k=Z.value)==null?void 0:k.year)}),Bs=S(()=>{var i,s;return ja(((i=Z.value)==null?void 0:i.monthTrend)||((s=Z.value)==null?void 0:s.month_trend),"name")});S(()=>{var i,s;return xo(((i=Z.value)==null?void 0:i.yearSummary)||((s=Z.value)==null?void 0:s.year_summary))});const za=S(()=>{var i,s;return ja(((i=Z.value)==null?void 0:i.startTownCounts)||((s=Z.value)==null?void 0:s.start_town_counts),"name")}),Ti=S(()=>{var i,s;return ja(((i=Z.value)==null?void 0:i.usageCounts)||((s=Z.value)==null?void 0:s.usage_counts),"name")});S(()=>{var i,s,l,d,m,b;return ja(((i=Z.value)==null?void 0:i.transportNumberCounts)||((s=Z.value)==null?void 0:s.transport_number_counts)||((l=Z.value)==null?void 0:l.vehicleCounts)||((d=Z.value)==null?void 0:d.vehicle_counts)||((m=Z.value)==null?void 0:m.transportCounts)||((b=Z.value)==null?void 0:b.transport_counts),"transportNumber")});const Nn=S(()=>{const i=za.value.map(l=>{const d=String(l.name||"").trim(),m=Xe(d),b=No(m||d);return $(F({},l),{rawName:d,name:b,displayName:b,town:m,mapTownName:m})}).filter(l=>l.name&&l.name!=="未填写").slice(0,10),s=Math.max(...i.map(l=>l.headCount),1);return i.map((l,d)=>$(F({},l),{key:l.key||`${l.mapTownName||l.name}-${d}`,value:l.headCount,unit:"头",ratio:Math.max(8,Math.round(l.headCount/s*100))}))}),Si=S(()=>tt.value.slice(0,Xn)),xn=S(()=>Math.max(Math.ceil(ct.value/Xn),1)),Rn=S(()=>Math.max(Math.ceil(Fa.value/Xr),1)),ge=S(()=>Na.value||{}),Es=S(()=>ge.value.certId||ge.value.factoryCode||""),$s=S(()=>{var s,l;const i=En(((s=pe.value)==null?void 0:s.startTowns)||((l=pe.value)==null?void 0:l.start_towns));return i.length?i:$n(za.value.map(d=>d.name))}),Vs=S(()=>{var s,l;const i=En(((s=pe.value)==null?void 0:s.usageTypes)||((l=pe.value)==null?void 0:l.usage_types));return i.length?i:$n(Ti.value.map(d=>d.name))}),Ds=S(()=>{var s,l,d,m;const i=Ro(((s=pe.value)==null?void 0:s.certTypeOptions)||((l=pe.value)==null?void 0:l.cert_type_options));return i.length?i:En(((d=pe.value)==null?void 0:d.certTypes)||((m=pe.value)==null?void 0:m.cert_types)).map(b=>({value:b,label:b}))}),zs=S(()=>Nn.value.map((i,s)=>({key:i.key||`${i.name}-${s}`,name:i.displayName||i.name,displayName:i.displayName||i.name,rawName:i.rawName,town:i.mapTownName||i.town||Xe(i.name),mapTownName:i.mapTownName||i.town||Xe(i.name),value:i.headCount,headCount:i.headCount,recordCount:i.recordCount,ratio:i.ratio,unit:"头"}))),Mi=S(()=>{var i;return Ho((i=Z.value)==null?void 0:i.riskItems)}),Os=S(()=>{const i=Mi.value.filter(s=>s.level==="high");return i.length>=2?`${i.length}项重点`:i.length===1?`重点:${i[0].name}`:"整体平稳"}),Ws=S(()=>Gt.value.map(i=>$(F({},i),{breedingCowRatio:fi.value,calfRatio:mi.value,breedingCow:Math.round(i.count*fi.value/100),calf:Math.round(i.count*mi.value/100)}))),Oa=S(()=>{const i=Ws.value,s=i.length,l=Math.max(Math.ceil(s/ln),1),d=st.value%l,m=d*ln,b=Math.min(m+ln,s);return{page:d,pageCount:l,start:m,end:b,total:s,rows:i.slice(m,b)}}),Ys=S(()=>O.value==="forecast"?Sn.value:Gt.value),js=S(()=>O.value==="forecast"?"forecast":"count"),Hs=S(()=>hl(Ys.value,js.value)),ma=S(()=>({key:"yak-marks-layer",sourceType:"wmts",layerName:"v3:yak_recognition",style:"v3:yak_recognition",styles:"v3:yak_recognition",format:"image/png",tileMatrixSetID:"EPSG:900913",minimumLevel:7,maximumLevel:21,bounds:[101.88735023598684,32.187424325001956,103.32644952301061,33.27125655371905],url:"/geoserver/gwc/service/wmts",name:"牦牛识别",opacity:.92,queryBuffer:10,geometryField:"geom",fillColor:"rgba(255, 230, 0, 0)",strokeColor:Jr,glowColor:"rgba(255, 230, 0, 0.42)",lineWidth:1.4,mapView:{targetLngLat:B,distanceScale:.82,targetLocalZ:.76,duration:.85},legends:[{key:"yak-marks",name:"牦牛",fillColor:Jr,strokeColor:"#FFF58A",selectable:!1}]})),qs=S(()=>[ma.value]),Us=S(()=>{const i=Array.isArray(We.value)?We.value:[We.value];return new Set(i.map(String).filter(Boolean))}),In=S(()=>Us.value.has(ma.value.key)),Ks=S(()=>In.value?ma.value.legends||[]:[]),Zs=S(()=>In.value?202:172),Xs=S(()=>{var l;const s=Vn((l=Lt.value)==null?void 0:l.rows).map(d=>Ao(d.town,d.village)).filter(Boolean);return{key:"yak-epidemic-village-boundary",sourceType:"wms",url:"/geoserver/v3/wms",layerName:"v3:yak_epidemic_village",styles:"v3:yak_epidemic_village",name:"防疫村边界",opacity:.86,queryBuffer:8,cqlFilter:s.length?s.join(" OR "):"EXCLUDE",legends:[{key:"yak-epidemic-village-boundary",name:"防疫村边界",fillColor:"#30DCFF",strokeColor:"#C9FBFF",selectable:!1}]}}),Js=S(()=>({key:"yak-trade-town",sourceType:"wms",url:"/geoserver/v3/wms",layerName:"v3:yak_trade_town",name:"交易乡镇",cqlFilter:`record_year=${Number(ve.value||0)}`,fillColor:"rgba(48, 220, 255, 0.12)",strokeColor:"#30DCFF",opacity:.84,overlayLayers:[{key:"yak-trade-market",sourceType:"wms",url:"/geoserver/v3/wms",layerName:"v3:yak_trade_market",name:"牦牛交易市场",fillColor:"#FFE600",strokeColor:"#FFF58A",opacity:.96}]})),ki=S(()=>O.value==="epidemic"?Xs.value:O.value==="trade"?Js.value:Ze.value?In.value?ma.value:null:ma.value),Ze=S(()=>O.value==="structure"||O.value==="forecast"),Qs=S(()=>O.value==="forecast"?X:z),eo=S(()=>Ze.value?null:ki.value),to=S(()=>Ze.value?null:Pi.value),ao=S(()=>Ze.value?!pa.value:!Qt.value),no=S(()=>Ze.value?"地图加载中":"3D 地图加载中"),Pi=S(()=>O.value==="trade"?{scope:"trade-flow",title:`${ve.value||""}出栏来源`,metricLabel:"来源",unit:"头",source:$(F({},Qe),{total:ft("headCount")}),rows:zs.value,showFlowLines:!1,mapView:q}:{scope:O.value==="epidemic"?"village":"town",hideTownNames:O.value==="epidemic",hideTownLabelStats:O.value==="structure"||O.value==="forecast",title:O.value==="forecast"?`${Ke.value.shortLabel}预测存栏`:O.value==="epidemic"?`${me.value}年村级防疫信息`:"乡镇估算存栏",metricLabel:O.value==="forecast"?"预测":O.value==="epidemic"?"防疫":"存栏",unit:"万头",rows:O.value==="epidemic"?yi.value:Hs.value.map(i=>({name:i.name,value:Number((i.value/1e4).toFixed(2)),unit:"万头"}))}),io=S(()=>(Me.value,{color:["#8bf7ff","#30dcff"],tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(i){const s=i.map(l=>`${l.marker}${l.seriesName}:${U(Math.abs(l.value))}头`);return`${i[0].name}
${s.join("
")}`}}),legend:{top:4,right:12,itemWidth:12,itemHeight:8,textStyle:{color:T,fontSize:11}},grid:{left:22,right:22,top:32,bottom:12,containLabel:!0},xAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:i=>ie(Math.abs(i))},splitLine:{lineStyle:{color:N,type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:un.map(i=>i.age),axisLabel:{color:g,fontSize:11,fontWeight:700},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"母牛",type:"bar",stack:"gender",barWidth:12,data:un.map(i=>-i.cow),itemStyle:{borderRadius:[7,0,0,7]}},{name:"公牛",type:"bar",stack:"gender",barWidth:12,data:un.map(i=>i.bull),itemStyle:{borderRadius:[0,7,7,0]}}]})),ro=S(()=>{const i=Gt.value,s=i.map(l=>l.count);return{color:I,tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(l){const d=l.map(m=>`${m.marker}${m.seriesName}:${U(m.value)}头`);return`${l[0].name}
${d.join("
")}
估算存栏:${U(s[l[0].dataIndex])}头
结构依据:畜群结构比例表`}}),legend:{top:-2,right:0,itemWidth:8,itemHeight:6,itemGap:6,textStyle:{color:T,fontSize:10}},grid:{left:54,right:30,top:22,bottom:8},xAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:ie},splitLine:{lineStyle:{color:N,type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",inverse:!0,data:i.map(l=>l.name),axisLabel:{color:g,fontSize:10,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:ua.map(l=>({name:l.name,type:"bar",stack:"town",barWidth:i.length>8?6:11,data:i.map(d=>Math.round(d.count*l.ratio/100))}))}}),so=S(()=>Yn(Gt.value,"count","头",{style:"ladder",tooltipFormatter(i){const s=Gt.value[i.dataIndex];return`${s.name}
估算存栏:${U(s.count)}头
来源:无人机识别`}})),oo=S(()=>{const i=Oa.value,s=i.rows,l=Math.max(...s.map(d=>d.breedingCow+d.calf),1);return{color:["#30dcff","#8bf7ff"],animationDurationUpdate:700,animationEasingUpdate:"cubicOut",tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(d){const m=s[d[0].dataIndex],b=d.filter(w=>["能繁母牛","犊牛合计"].includes(w.seriesName)).map(w=>`${w.marker}${w.seriesName}:${U(w.value)}头`);return`${m.name}
母犊合计:${U(m.breedingCow+m.calf)}头
${b.join("
")}
依据:无人机识别 + 畜群结构比例表`}}),legend:{data:["能繁母牛","犊牛合计"],top:2,left:2,itemWidth:10,itemHeight:7,itemGap:9,textStyle:{color:T,fontSize:10}},graphic:i.total>ln?{type:"text",right:4,top:3,silent:!0,style:{text:`${i.start+1}-${i.end} / ${i.total}`,fill:C,fontSize:10,fontWeight:600}}:void 0,grid:{left:18,right:18,top:42,bottom:44,containLabel:!1},xAxis:{type:"category",data:s.map(d=>d.name),axisLabel:{color:C,fontSize:10,lineHeight:12,interval:0,margin:8,formatter:Eo},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"value",max:Math.ceil(l*1.28),axisLabel:{show:!1},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:N,type:"dashed"}}},series:[{name:"基础群规模",type:"bar",barWidth:15,barGap:"-100%",data:s.map(d=>d.breedingCow+d.calf),tooltip:{show:!1},itemStyle:{borderRadius:[8,8,1,1],color:"rgba(48, 220, 255, 0.07)"},silent:!0},{name:"能繁母牛",type:"bar",stack:"foundation",barWidth:15,data:s.map(d=>d.breedingCow),itemStyle:{borderRadius:[1,1,0,0],color:new Ve(0,0,0,1,[{offset:0,color:"rgba(48, 220, 255, 0.34)"},{offset:1,color:"#30dcff"}])}},{name:"犊牛合计",type:"bar",stack:"foundation",barWidth:15,data:s.map(d=>d.calf),itemStyle:{borderRadius:[8,8,1,1],color:new Ve(0,0,0,1,[{offset:0,color:"#8bf7ff"},{offset:1,color:"rgba(139, 247, 255, 0.2)"}])},label:{show:!0,position:"top",formatter:({dataIndex:d})=>ie(s[d].breedingCow+s[d].calf),color:"#ffffff",fontSize:10,fontWeight:700}}]}}),lo=S(()=>{Me.value;const i=ei.slice().sort((d,m)=>m.value-d.value),s=ei.reduce((d,m)=>d+m.value,0),l=i.map(d=>d.yoy||0);return{color:[sn,"#8bf7ff"],tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(d){const m=i[d[0].dataIndex];return`${m.label}
数量:${U(m.value)}头
占比:${Ct(m.value/s*100)}
同比:${m.yoy>0?"+":""}${m.yoy}%`}}),grid:{left:36,right:30,top:20,bottom:34},xAxis:{type:"category",data:i.map(d=>d.label),axisLabel:{color:g,fontSize:10,fontWeight:700,interval:0,margin:10},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.24)"}},axisTick:{show:!1}},yAxis:[{type:"value",axisLabel:{color:C,fontSize:10,formatter:ie},splitLine:{lineStyle:{color:N,type:"dashed"}}},{type:"value",min:Math.min(-2,Math.floor(Math.min(...l)-1)),max:Math.max(8,Math.ceil(Math.max(...l)+1)),axisLabel:{color:T,fontSize:10,formatter:"{value}%"},splitLine:{show:!1},axisLine:{show:!1},axisTick:{show:!1}}],series:[{name:"数量",type:"bar",barWidth:16,data:i.map(d=>({value:d.value,itemStyle:{borderRadius:[2,2,1,1],color:new Ve(0,0,0,1,[{offset:0,color:sn},{offset:.58,color:"rgba(67, 217, 232, 0.72)"},{offset:1,color:"rgba(67, 217, 232, 0.16)"}]),shadowBlur:2,shadowColor:"rgba(48, 220, 255, 0.16)"},label:{show:!0,position:"top",color:L,fontSize:10,fontFamily:qn.number,fontWeight:700,formatter:({value:m})=>ie(m)}}))},{name:"同比",type:"line",yAxisIndex:1,smooth:!0,symbol:"circle",symbolSize:6,data:l,lineStyle:{width:2,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff",borderColor:"rgba(3, 18, 28, 0.9)",borderWidth:2},label:{show:!0,position:"top",color:"#8bf7ff",fontSize:10,formatter:({value:d})=>`${d>0?"+":""}${d}%`}}]}}),uo=S(()=>{const i=ol(Rt.value),s=ll(Ke.value,i.key),l=dl(s),d=ul(l.length,i.key);return{color:["#30dcff","#8bf7ff","#48cfff"],tooltip:$(F({},we()),{trigger:"axis",triggerOn:"mousemove|click",axisPointer:{type:"cross",crossStyle:{color:"rgba(126, 251, 246, 0.42)"},label:{color:"#eaffff",backgroundColor:"rgba(5, 31, 51, 0.96)"}},formatter(m){var E,A,K;const b=Array.isArray(m)?m:[m],w=b.find(re=>re.seriesType==="candlestick"),k=(w==null?void 0:w.data)||l[(K=(A=w==null?void 0:w.dataIndex)!=null?A:(E=b[0])==null?void 0:E.dataIndex)!=null?K:0];if(!k)return"";const G=k.close-k.open;return[`${k.label}|${i.unit}度预测`,`预测存栏:${U(k.close)}头`,`较上期:${Za(G)}头`,`新生牛犊:${U(k.birth)}头`,`出栏扣减:${U(k.outflow)}头`].join("
")}}),legend:{top:4,right:8,data:["预测存栏","新生牛犊","出栏扣减"],itemWidth:12,itemHeight:8,textStyle:{color:T,fontSize:10}},grid:{left:44,right:40,top:34,bottom:28},xAxis:{type:"category",boundaryGap:!0,data:s.labels,axisLabel:{color:C,fontSize:10,interval:d},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.28)"}},axisTick:{show:!1}},yAxis:[{type:"value",scale:!0,axisLabel:{color:C,fontSize:10,formatter:ie},splitLine:{lineStyle:{color:N,type:"dashed"}}},{type:"value",axisLabel:{color:T,fontSize:10,formatter:ie},splitLine:{show:!1}}],series:[{name:"预测存栏",type:"candlestick",yAxisIndex:0,barWidth:cl(l.length,i.key),data:l,itemStyle:{color:"rgba(48, 220, 255, 0.82)",color0:"rgba(72, 207, 255, 0.82)",borderColor:"#30dcff",borderColor0:"#48cfff",borderWidth:1.4}},{name:"预测存栏线",type:"line",yAxisIndex:0,smooth:!0,symbol:"circle",symbolSize:4,data:l.map(m=>m.close),lineStyle:{width:1.8,color:"rgba(48, 220, 255, 0.86)"},itemStyle:{color:"#30dcff",borderColor:"rgba(3, 18, 28, 0.9)",borderWidth:1},tooltip:{show:!1}},ur("新生牛犊",s.births,"#8bf7ff",1),ur("出栏扣减",s.outflow,"#48cfff",1)]}}),co=S(()=>({color:["#30dcff","#8bf7ff"],tooltip:$(F({},we()),{trigger:"axis"}),legend:{top:4,right:12,itemWidth:12,itemHeight:8,textStyle:{color:T,fontSize:10}},grid:{left:52,right:42,top:34,bottom:28},xAxis:{type:"category",data:Tn.value.map(i=>i.month||i.name),axisLabel:{color:C,fontSize:10,interval:1},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.26)"}},axisTick:{show:!1}},yAxis:[{type:"value",axisLabel:{color:C,fontSize:10,formatter:i=>{const s=Number(i);return Number.isFinite(s)?Math.abs(s)>=1e4?`${Number((s/1e4).toFixed(1))}万`:`${s}`:i}},splitLine:{lineStyle:{color:N,type:"dashed"}}},{type:"value",axisLabel:{color:T,fontSize:10},splitLine:{show:!1}}],series:[{name:"数量",type:"bar",barWidth:12,data:Tn.value.map(i=>i.count||i.value),itemStyle:{borderRadius:[8,8,0,0],color:new Ve(0,0,0,1,[{offset:0,color:"#30dcff"},{offset:1,color:"rgba(48, 220, 255, 0.08)"}])}},{name:"增速",type:"line",yAxisIndex:1,smooth:!0,symbolSize:5,data:Tn.value.map(i=>i.speed||i.growthRate||0),lineStyle:{width:2.4,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff"}}]})),ho=S(()=>(Me.value,{tooltip:we(),radar:{center:["50%","54%"],radius:"68%",splitNumber:4,indicator:ti.map(i=>({name:i.name,max:100})),axisName:{color:"rgba(223, 250, 255, 0.76)",fontSize:11},splitLine:{lineStyle:{color:"rgba(48, 220, 255, 0.22)"}},splitArea:{areaStyle:{color:["rgba(48, 220, 255, 0.04)","rgba(139, 247, 255, 0.018)"]}},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.18)"}}},series:[{type:"radar",data:[{name:"预测因子",value:ti.map(i=>i.value),areaStyle:{color:"rgba(48, 220, 255, 0.22)"},lineStyle:{color:"#30dcff",width:2},itemStyle:{color:"#8bf7ff"}}]}]})),po=S(()=>Yn(Sn.value,"forecast","头")),fo=S(()=>{const i=vs.value,s=i.reduce((l,d,m)=>{const b=d.color||I[m%I.length];return l[`name${m}`]={color:b,fontSize:10,fontWeight:800},l[`percent${m}`]={color:b,fontSize:10,fontFamily:"D-DIN, Arial, sans-serif",fontWeight:800},l},{});return{color:I,tooltip:we(l=>{var m;const d=i.find(b=>b.name===l.name);return`${l.name}
预测占比:${Ct((m=d==null?void 0:d.ratio)!=null?m:l.percent)}
预测数量:${U((d==null?void 0:d.count)||0)}头`}),legend:{orient:"vertical",right:4,top:"middle",itemWidth:8,itemHeight:8,itemGap:6,formatter(l){const d=i.findIndex(b=>b.name===l),m=i[d];return m?`{name${d}|${l}} {percent${d}|${Ct(m.ratio)}}`:l},textStyle:{color:T,fontSize:10,rich:s}},series:[{name:"期末结构预测",type:"pie",radius:["38%","66%"],center:["32%","54%"],startAngle:118,avoidLabelOverlap:!1,label:{show:!1},labelLine:{show:!1},itemStyle:{borderColor:"rgba(3, 18, 31, 0.92)",borderWidth:3},data:i.map(l=>({name:l.name,value:l.count}))}]}}),mo=S(()=>(Me.value,{color:["#8bf7ff","#48cfff","#48cfff"],tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"shadow"}}),legend:{top:4,right:8,itemWidth:12,itemHeight:8,textStyle:{color:T,fontSize:10}},grid:{left:44,right:26,top:34,bottom:28},xAxis:{type:"category",data:xt.map(i=>i.shortLabel),axisLabel:{color:g,fontSize:11,fontWeight:700},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.26)"}},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:i=>Ka(i,1)},splitLine:{lineStyle:{color:N,type:"dashed"}}},series:[{name:"新生牛犊",type:"bar",barWidth:12,data:xt.map(i=>i.births),itemStyle:{borderRadius:[7,7,0,0]}},{name:"出栏流出",type:"bar",barWidth:12,data:xt.map(i=>-i.outflow),itemStyle:{borderRadius:[0,0,7,7]}},{name:"稳态校正",type:"line",smooth:!0,symbolSize:6,data:xt.map(i=>i.correction),lineStyle:{width:2.4}}]})),go=S(()=>{const i=Sn.value,s=Math.max(...i.map(l=>Math.abs(l.change)),1);return i.map(l=>$(F({},l),{width:Math.max(8,Math.round(Math.abs(l.change)/s*100))}))});function yo(i){const s=Number((i==null?void 0:i.change)||0)>=0;return{"--heat-width":`${i.width}%`,"--heat-color":s?"#30dcff":"#8bf7ff","--heat-color-soft":s?"rgba(48, 220, 255, 0.24)":"rgba(139, 247, 255, 0.22)","--heat-color-dim":s?"rgba(48, 220, 255, 0.07)":"rgba(139, 247, 255, 0.07)"}}function bo(i){return`${i.name}:${Za(i.change)}头`}const vo=S(()=>{const i=Mn.value,s=i.map(d=>d.value),l=Math.max(...s,1);return{color:["#30dcff","#8bf7ff"],tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"line",lineStyle:{color:"rgba(48, 220, 255, 0.28)"}},formatter(d){const m=d[0];return`${m.name}
防疫记录:${U(m.value)}条`}}),grid:{left:42,right:24,top:20,bottom:28},xAxis:{type:"category",data:i.map(d=>d.name),axisLabel:{color:C,fontSize:10,interval:Math.max(Math.floor(i.length/7),0)},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.22)"}},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:ie},splitLine:{lineStyle:{color:N,type:"dashed"}}},series:[{name:"防疫记录",type:"bar",barMaxWidth:12,data:s,itemStyle:{borderRadius:[7,7,0,0],color:new Ve(0,0,0,1,[{offset:0,color:"#8bf7ff"},{offset:.45,color:"#30dcff"},{offset:1,color:"rgba(48, 220, 255, 0.08)"}])},label:{show:!0,position:"top",color:"rgba(230, 255, 249, 0.92)",fontSize:10,formatter:({value:d})=>d>=l*.42?ie(d):""}},{name:"作业趋势",type:"line",smooth:!0,showSymbol:!1,data:s,lineStyle:{width:2.4,color:"#8bf7ff"}}]}});S(()=>{const i=Mn.value.length?Mn.value.slice(-6):[{name:"待开展",value:0}],s=i.map(w=>Number(w.value||0)),l=Fs.value,d=l.map(w=>Number(w.value||0)),m=Math.max(...s,1),b=w=>String(w||"").replace(/(镇|乡|村)$/,"");return{color:["#30dcff","#8bf7ff"],title:[{text:"作业节奏",left:4,top:0,textStyle:{color:"rgba(226, 252, 255, 0.82)",fontSize:11,fontWeight:800}},{text:"补免关注",left:"55%",top:0,textStyle:{color:"rgba(226, 252, 255, 0.82)",fontSize:11,fontWeight:800}}],tooltip:$(F({},we()),{trigger:"axis",formatter(w){const k=Array.isArray(w)?w[0]:w;if((k==null?void 0:k.axisIndex)===1){const E=l[k.dataIndex]||{};return`${E.name}
补免关注:${E.label||k.value}`}const G=i[k.dataIndex]||{};return`${G.name}
防疫记录:${U(G.value)}条`}}),grid:[{left:6,right:"52%",top:26,bottom:15},{left:"56%",right:12,top:26,bottom:15}],xAxis:[{type:"category",gridIndex:0,data:i.map(w=>w.name),axisLabel:{color:"rgba(226, 252, 255, 0.56)",fontSize:9,interval:0,formatter:w=>String(w||"").replace(/^(\d{1,2})\D+(\d{1,2}).*$/,"$1/$2")},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.22)"}},axisTick:{show:!1}},{type:"value",gridIndex:1,min:0,max:Math.max(...d,100),show:!1}],yAxis:[{type:"value",gridIndex:0,show:!1},{type:"category",gridIndex:1,inverse:!0,data:l.map(w=>w.name),axisLabel:{color:"rgba(226, 252, 255, 0.68)",fontSize:9,formatter:w=>b(w)},axisLine:{show:!1},axisTick:{show:!1}}],series:[{name:"防疫记录",type:"bar",xAxisIndex:0,yAxisIndex:0,barMaxWidth:9,data:s,itemStyle:{borderRadius:[6,6,0,0],color:new Ve(0,0,0,1,[{offset:0,color:"#8bf7ff"},{offset:.45,color:"#30dcff"},{offset:1,color:"rgba(48, 220, 255, 0.1)"}])},label:{show:!0,position:"top",color:"rgba(230, 255, 249, 0.86)",fontSize:8,formatter:({value:w})=>w>=m*.55?ie(w):""}},{name:"节奏线",type:"line",xAxisIndex:0,yAxisIndex:0,smooth:!0,showSymbol:!1,data:s,lineStyle:{width:1.8,color:"#8bf7ff"},tooltip:{show:!1}},{name:"补免关注",type:"bar",xAxisIndex:1,yAxisIndex:1,barWidth:8,data:d,itemStyle:{borderRadius:[0,7,7,0],color:new Ve(0,0,1,0,[{offset:0,color:"rgba(139, 247, 255, 0.24)"},{offset:1,color:"#8bf7ff"}])},label:{show:!0,position:"right",color:"rgba(201, 251, 255, 0.9)",fontSize:8,formatter:({dataIndex:w})=>{var k;return((k=l[w])==null?void 0:k.label)||""}}}]}}),S(()=>{const i=Ns.value,s=i.map(b=>Number(b.value||0)),l=Math.max(...s,1),d=s.filter(Boolean).reduce((b,w)=>b+w,0)/Math.max(s.filter(Boolean).length,1),m=Math.ceil(l*1.18);return{color:["#30dcff","#8bf7ff"],tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(b){var k;const w=i[(k=b[0])==null?void 0:k.dataIndex]||{};return w.isMissing?`${w.name}
年度防疫:待补强`:`${w.name}
覆盖量:${U(w.value)}头
防疫记录:${U(w.recordCount)}条`}}),grid:{left:56,right:46,top:16,bottom:12},xAxis:{type:"value",min:0,max:m,show:!1},yAxis:{type:"category",inverse:!0,data:i.map(b=>b.name),axisLabel:{color:"rgba(226, 252, 255, 0.82)",fontSize:11,interval:0,formatter:b=>String(b||"").replace(/(镇|乡)$/,"")},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"均衡参照",type:"bar",barWidth:11,silent:!0,barGap:"-100%",data:i.map(()=>m),itemStyle:{borderRadius:[0,8,8,0],borderColor:"rgba(48, 220, 255, 0.12)",borderWidth:1,color:"rgba(48, 220, 255, 0.045)"}},{name:"覆盖量",type:"bar",barWidth:11,barGap:"-100%",z:3,data:i.map(b=>{const w=Number(b.value||0);return{value:w>0?w:Math.max(m*.035,1),rawValue:w,itemStyle:{borderRadius:[0,8,8,0],color:new Ve(0,0,1,0,[{offset:0,color:b.isMissing?"rgba(72, 207, 255, 0.2)":"rgba(48, 220, 255, 0.14)"},{offset:.72,color:b.isMissing?"#48cfff":"#30dcff"},{offset:1,color:b.isMissing?"#8bf7ff":"#9efcff"}]),shadowBlur:b.isMissing?4:5,shadowColor:b.isMissing?"rgba(72, 207, 255, 0.18)":"rgba(48, 220, 255, 0.16)"}}}),label:{show:!0,position:"right",color:"rgba(239, 255, 255, 0.92)",fontSize:11,fontWeight:800,formatter:({dataIndex:b})=>{const w=i[b]||{};return w.isMissing?"待补强":`${ie(w.value)}头`}},markLine:d>0?{symbol:"none",silent:!0,lineStyle:{color:"rgba(139, 247, 255, 0.46)",type:"dashed",width:1},label:{color:"rgba(201, 251, 255, 0.8)",fontSize:10,formatter:"均衡线"},data:[{xAxis:d}]}:void 0}]}}),S(()=>{const i=xs.value,s=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff","#48cfff","#40b8ff","#8bf7ff"],l=i.length?i.map((d,m)=>({name:String(d.name||"").replace(/(村|社区|牧委会)$/,""),value:Math.max(Number(d.value||0),1),rawValue:Number(d.value||0),town:d.town||"",itemStyle:{color:new Ve(0,0,1,1,[{offset:0,color:s[m%s.length]},{offset:1,color:"rgba(17, 70, 92, 0.38)"}])}})):[{name:"待形成",value:1,rawValue:0,town:"",itemStyle:{color:"rgba(48, 220, 255, 0.14)"}}];return{tooltip:$(F({},we()),{formatter(d){const m=d.data||{};return m.rawValue?`${m.town?`${m.town} `:""}${m.name}
覆盖量:${U(m.rawValue)}头`:`${m.name}
暂无村级覆盖量`}}),series:[{type:"treemap",roam:!1,nodeClick:!1,breadcrumb:{show:!1},left:6,right:6,top:7,bottom:5,visibleMin:1,data:l,label:{show:!0,color:"rgba(235, 254, 255, 0.9)",fontSize:10,fontWeight:800,lineHeight:14,formatter(d){var b;const m=Number(((b=d.data)==null?void 0:b.rawValue)||0);return m?`${d.name} ${ie(m)}头`:d.name}},upperLabel:{show:!1},itemStyle:{borderColor:"rgba(4, 24, 36, 0.88)",borderWidth:2,gapWidth:2},emphasis:{label:{color:"#ffffff"},itemStyle:{shadowBlur:6,shadowColor:"rgba(48, 220, 255, 0.18)"}},levels:[{itemStyle:{borderColor:"rgba(14, 75, 98, 0.72)",borderWidth:1,gapWidth:2}}]}]}});const wo=S(()=>{const i=Cn.value,s=i.length>8?10:12,l=s+8,d=i.map(E=>Number(E.recordCount||0)),m=i.map(E=>Number(E.earTagCount||0)),b=Math.max(...d,1),w=i.map(()=>Math.ceil(b*1.08)),k=new Ve(0,0,0,1,[{offset:0,color:"rgba(48, 220, 255, 0.18)"},{offset:.48,color:"rgba(48, 220, 255, 0.06)"},{offset:1,color:"rgba(48, 220, 255, 0.02)"}]),G=new Ve(0,0,0,1,[{offset:0,color:"#31f7ff"},{offset:.36,color:"#1cbcff"},{offset:1,color:"#266dff"}]);return{color:["#31f7ff","#8bf7ff"],title:{text:`台账总量:{value|${ie(ht.value)}条}`,right:0,top:0,textStyle:{color:"#fff",fontSize:12,fontWeight:500,rich:{value:{color:"#22f1ff",borderColor:"#14bdf4",borderWidth:1,borderRadius:2,padding:[2,6,3,6],fontSize:12,fontWeight:700}}}},tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(E){const A=i[E[0].dataIndex];return[`${A.name}`,`防疫记录:${U(A.recordCount)}条`,`耳标数量:${U(A.earTagCount)}头`,"数据来源:防疫台账"].join("
")}}),legend:[{data:["防疫记录"],top:0,left:0,itemWidth:10,itemHeight:10,icon:"circle",textStyle:{color:g,fontSize:11},selectedMode:!1},{data:["耳标数"],top:0,left:82,itemWidth:10,itemHeight:10,icon:"circle",textStyle:{color:g,fontSize:11},selectedMode:!1}],grid:{left:42,right:12,top:46,bottom:68},xAxis:{type:"category",data:i.map(E=>E.name),axisLabel:{color:g,fontSize:10,interval:0,lineHeight:11,margin:8,formatter:Bo},axisLine:{show:!1},axisTick:{show:!1},splitLine:{show:!1}},yAxis:{type:"value",name:"数量/条",max:Math.ceil(b*1.2),nameTextStyle:{color:C,fontSize:10,align:"left"},axisLabel:{color:C,fontSize:10,formatter:ie},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:N,type:"dashed"}}},series:[{name:"统计底柱",type:"bar",barWidth:l,barGap:"-100%",data:w,tooltip:{show:!1},silent:!0,z:1,itemStyle:{borderRadius:[8,8,1,1],borderColor:"rgba(48, 220, 255, 0.22)",borderWidth:1,color:k}},{name:"防疫记录",type:"bar",barGap:"-100%",barWidth:s,barMinHeight:2,z:3,data:d.map(E=>({value:E,itemStyle:{borderRadius:[8,8,1,1],borderColor:"rgba(200, 252, 255, 0.22)",borderWidth:1,color:G,shadowBlur:10,shadowColor:"rgba(49, 247, 255, 0.28)"}}))},{name:"耳标数",type:"line",smooth:!0,showSymbol:!1,z:9,data:m,lineStyle:{width:1.6,color:"#8bf7ff",shadowBlur:0,shadowColor:"transparent"},itemStyle:{color:"#8bf7ff"}}]}}),Lo=S(()=>{const i=Ls.value;return{tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(s){const l=i[s[0].dataIndex];return`${l.name}
防疫记录:${U(l.value)}条`}}),grid:{left:74,right:42,top:12,bottom:8},xAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:ie},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:N,type:"dashed"}}},yAxis:{type:"category",inverse:!0,data:i.map(s=>s.name),axisLabel:{color:g,fontSize:10,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"记录",type:"bar",barWidth:9,data:i.map(s=>({value:s.value,itemStyle:{borderRadius:[1,2,2,1],color:new Ve(0,0,1,0,[{offset:0,color:"rgba(67, 217, 232, 0.14)"},{offset:.58,color:"rgba(67, 217, 232, 0.7)"},{offset:1,color:sn}])}})),label:{show:!0,position:"right",color:"#eaffff",fontSize:10,formatter:({value:s})=>ie(s)}}]}}),To=S(()=>{const i=Bs.value;return{color:["#30dcff","#8bf7ff"],tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(s){const l=s.find(m=>m.seriesName==="流通头数"),d=s.find(m=>m.seriesName==="出证记录");return`${(l==null?void 0:l.axisValue)||""}
流通头数:${U((l==null?void 0:l.value)||0)}头
出证记录:${U((d==null?void 0:d.value)||0)}条`}}),legend:{top:4,right:10,itemWidth:12,itemHeight:8,textStyle:{color:T,fontSize:10}},grid:{left:42,right:38,top:34,bottom:28},xAxis:{type:"category",data:i.map(s=>s.name),axisLabel:{color:C,fontSize:10,interval:1},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.24)"}},axisTick:{show:!1}},yAxis:[{type:"value",axisLabel:{color:C,fontSize:10,formatter:ie},splitLine:{lineStyle:{color:N,type:"dashed"}}},{type:"value",axisLabel:{color:T,fontSize:10,formatter:ie},splitLine:{show:!1}}],series:[{name:"流通头数",type:"bar",barMaxWidth:13,data:i.map(s=>s.headCount),itemStyle:{borderRadius:[7,7,0,0],color:new Ve(0,0,0,1,[{offset:0,color:"#30dcff"},{offset:1,color:"rgba(48, 220, 255, 0.08)"}])}},{name:"出证记录",type:"line",yAxisIndex:1,smooth:!0,symbolSize:5,data:i.map(s=>s.recordCount),lineStyle:{width:2.2,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff",borderColor:"rgba(3, 18, 28, 0.9)",borderWidth:2}}]}}),So=S(()=>Yn(za.value.slice(0,10),"headCount","头",{style:"ladder",axisTextColor:"rgba(255, 255, 255, 0.88)",dimAxisTextColor:"rgba(255, 255, 255, 0.74)",tooltipFormatter(i){const s=za.value[i.dataIndex];return`${s.name}
流通头数:${U(s.headCount)}头
出证记录:${U(s.recordCount)}条`}})),Mo=S(()=>{const i=Ti.value;return{color:He,tooltip:we(s=>{const l=i.find(d=>d.name===s.name);return`${s.name}
占比:${s.percent}%
流通头数:${U(s.value)}头
出证记录:${U((l==null?void 0:l.recordCount)||0)}条`}),legend:{orient:"vertical",right:4,top:"middle",itemWidth:8,itemHeight:8,itemGap:6,textStyle:{color:T,fontSize:10},formatter(s){const l=i.find(d=>d.name===s);return l?`${s} ${ie(l.headCount)}头`:s}},series:[{name:"用途结构",type:"pie",radius:["38%","64%"],center:["32%","54%"],startAngle:110,label:{show:!1},labelLine:{show:!1},itemStyle:{borderColor:"rgba(3, 18, 31, 0.92)",borderWidth:3},data:i.map(s=>({name:s.name,value:s.headCount}))}]}}),ko=S(()=>{const i=[{name:"省外A证",value:ft("outProvinceHeads","aCertHeads")},{name:"省内B证",value:ft("inProvinceHeads","bCertHeads")}];return{color:["#8bf7ff","#30dcff"],tooltip:we(s=>`${s.name}
流通头数:${U(s.value)}头
占比:${s.percent}%`),series:[{type:"pie",radius:["48%","72%"],center:["50%","52%"],label:{show:!1},labelLine:{show:!1},itemStyle:{borderColor:"rgba(3, 18, 31, 0.92)",borderWidth:3},data:i}]}});function _n(){o.value=typeof window=="undefined"?1080:window.innerHeight}function Ci(){var i,s,l,d,m,b;if(Ze.value){(s=(i=ha.value)==null?void 0:i.refreshView)==null||s.call(i);return}(d=(l=xe.value)==null?void 0:l.resume)==null||d.call(l),(b=(m=xe.value)==null?void 0:m.refreshView)==null||b.call(m)}function Fi(){kt&&(window.clearTimeout(kt),kt=null)}function Ni(){var i,s,l,d,m,b;if(Ye.value=!1,xa.value={type:"loading",text:"地图正在复位"},Ra.value={type:"idle",text:""},Ze.value){(s=(i=ha.value)==null?void 0:i.hasMap)!=null&&s.call(i)?(pa.value=!0,(d=(l=ha.value)==null?void 0:l.resetView)==null||d.call(l)):(pa.value=!1,ri.value+=1,Ut(()=>{window.setTimeout(()=>{var w,k;return(k=(w=ha.value)==null?void 0:w.refreshView)==null?void 0:k.call(w)},160)}));return}if((b=(m=xe.value)==null?void 0:m.hasMap)!=null&&b.call(m)){Qt.value=!0,Ci();return}Fi(),Qt.value=!1,_t=!1,ii.value+=1,Ut(()=>{Ua()})}function Po(){Ye.value=!1,Ni()}e({refreshMapView:Ci,resetMap:Ni,setActiveView(i){O.value=jn(i)}}),Qr(()=>{_n(),window.addEventListener("resize",_n),ir(),rr(O.value),Wa()}),es(()=>{var i,s;_a=!0,window.removeEventListener("resize",_n),kt&&window.clearTimeout(kt),Gn(),(s=(i=xe.value)==null?void 0:i.destroyMap)==null||s.call(i)}),Zt([O,Ke,Gt,Pn,ht,me,ve,wi],()=>{rl()},{immediate:!0}),Zt(O,(i,s)=>{n("view-change",i),rr(i);const l=i==="structure"||i==="forecast",d=s==="structure"||s==="forecast",m=!l&&!d&&(i==="trade"||s==="trade");l&&!d&&(Ye.value=!1,pa.value=!1,xa.value={type:"idle",text:""},Ra.value={type:"idle",text:""}),!l&&d&&(ir(),Fi(),Ye.value=!1,Qt.value=!1,_t=!1,xa.value={type:"idle",text:""},Ra.value={type:"idle",text:""},Ut(()=>{var b,w,k,G;Ua(),(w=(b=xe.value)==null?void 0:b.resume)==null||w.call(b),(G=(k=xe.value)==null?void 0:k.refreshView)==null||G.call(k),window.setTimeout(()=>{var E,A;return(A=(E=xe.value)==null?void 0:E.refreshView)==null?void 0:A.call(E)},180)})),m&&Ut(()=>{var b,w,k,G;(w=(b=xe.value)==null?void 0:b.resume)==null||w.call(b),(G=(k=xe.value)==null?void 0:k.refreshView)==null||G.call(k)}),Wa()}),Zt(()=>a.viewKey,i=>{const s=jn(i);s!==O.value&&(O.value=s)}),Zt(()=>a.active,i=>{var s,l,d,m;i?(Ua(),(l=(s=xe.value)==null?void 0:s.resume)==null||l.call(s),Wa()):((m=(d=xe.value)==null?void 0:d.pause)==null||m.call(d),Gn())}),Zt(Oa,i=>{st.value>=i.pageCount&&(st.value=0),Wa()});function Co(i){i!==vt.value&&(vt.value=i)}function Wa(){Gn(),!(!a.active||O.value!=="structure"||_a||Oa.value.pageCount<=1)&&(Ga=window.setInterval(Fo,Ch))}function Fo(){const i=Oa.value.pageCount;i<=1||(st.value=(st.value+1)%i)}function Gn(){Ga&&(window.clearInterval(Ga),Ga=null)}function No(i){return cn(i||"")}function Xe(i){return String(i||"").trim()}function An(i){const s=Number(i);return Number.isFinite(s)&&Fe.includes(s)?s:Fe[Fe.length-1]}function Bn(i=me.value){const s=An(i);return{startDate:`${s}-01-01`,endDate:`${s}-12-31`}}function Ya(){return{keyword:"",town:"",medicine:"",startDate:"",endDate:""}}function Pt(i=[]){return Array.isArray(i)?i.map((s,l)=>{var d,m,b,w,k,G,E,A,K;return{key:s.key||s.id||`${s.name||s.label||"item"}-${l}`,name:String(s.name||s.label||s.town||s.village||"未填写"),value:Number((b=(m=(d=s.value)!=null?d:s.count)!=null?m:s.total)!=null?b:0),recordCount:Number((E=(G=(k=(w=s.recordCount)!=null?w:s.record_count)!=null?k:s.value)!=null?G:s.count)!=null?E:0),earTagCount:Number((K=(A=s.earTagCount)!=null?A:s.ear_tag_count)!=null?K:0)}}).filter(s=>s.name&&Number.isFinite(s.value)):[]}function xi(i={}){const s=Pt(i==null?void 0:i.medicineCounts);return Math.max(s.filter(l=>l.name!=="未填写").length,1)}function Ri(...i){const s=i.flatMap(l=>Array.isArray(l)?l:[l]).map(l=>{var d,m,b;return l&&typeof l=="object"?(b=(m=(d=l.year)!=null?d:l.value)!=null?m:l.latestYear)!=null?b:l.latest_year:l}).map(Number).filter(l=>Number.isFinite(l)&&l>0);return[...new Set(s)].sort((l,d)=>l-d)}function ja(i=[],s="name"){return Array.isArray(i)?i.map((l,d)=>{var m,b,w,k,G,E,A,K,re,se,fe,$e,mt,Yt,ga,ya,ba;return{key:l.key||l.id||`${l[s]||l.name||l.label||"trade"}-${d}`,name:String(l[s]||l.name||l.label||l.town||"未填写"),recordCount:Number((w=(b=(m=l.recordCount)!=null?m:l.record_count)!=null?b:l.count)!=null?w:0),headCount:Number((A=(E=(G=(k=l.headCount)!=null?k:l.head_count)!=null?G:l.amount)!=null?E:l.value)!=null?A:0),lng:pt(($e=(fe=(se=(re=(K=l.lng)!=null?K:l.longitude)!=null?re:l.destLng)!=null?se:l.dest_lng)!=null?fe:l.destLongitude)!=null?$e:l.dest_longitude),lat:pt((ba=(ya=(ga=(Yt=(mt=l.lat)!=null?mt:l.latitude)!=null?Yt:l.destLat)!=null?ga:l.dest_lat)!=null?ya:l.destLatitude)!=null?ba:l.dest_latitude)}}).filter(l=>l.name&&Number.isFinite(l.headCount)):[]}function xo(i=[]){return Array.isArray(i)?i.map(s=>{var l,d,m,b,w,k;return{year:Number(s.year),recordCount:Number((d=(l=s.recordCount)!=null?l:s.record_count)!=null?d:0),headCount:Number((k=(w=(b=(m=s.headCount)!=null?m:s.head_count)!=null?b:s.amount)!=null?w:s.value)!=null?k:0)}}).filter(s=>Number.isFinite(s.year)&&Number.isFinite(s.headCount)):[]}function En(i=[]){return Array.isArray(i)?$n(i.map(s=>{var l,d,m;return s&&typeof s=="object"?(m=(d=(l=s.value)!=null?l:s.label)!=null?d:s.name)!=null?m:"":s})):[]}function Ro(i=[]){return Array.isArray(i)?i.map(s=>{var l,d,m,b,w,k;if(s&&typeof s=="object"){const G=(m=(d=(l=s.value)!=null?l:s.name)!=null?d:s.label)!=null?m:"",E=(k=(w=(b=s.label)!=null?b:s.name)!=null?w:s.value)!=null?k:G;return G?{value:String(G),label:String(E||G)}:null}return s?{value:String(s),label:String(s)}:null}).filter(Boolean):[]}function $n(i=[]){return[...new Set(i.map(s=>String(s||"").trim()).filter(Boolean))]}function Io(i=[]){if(!Array.isArray(i))return[];const s=new Map;i.forEach((d,m)=>{var E,A,K,re,se,fe;const b=Xe(d.name||d.areaName||d.area_name||d.town||d.label||"");if(!b)return;const w=pt((K=(A=(E=d.value)!=null?E:d.number)!=null?A:d.count)!=null?K:d.total);if(!Number.isFinite(w))return;const k=s.get(b)||{key:d.areaCode||d.area_code||`${b}-${m}`,name:b,recordCount:0,earTagCount:0,source:"stats"};k.recordCount+=w;const G=pt((fe=(se=(re=d.earTagCount)!=null?re:d.ear_tag_count)!=null?se:d.headCount)!=null?fe:d.head_count);k.earTagCount+=Number.isFinite(G)?G:0,s.set(b,k)});const l=[...s.values()].reduce((d,m)=>d+Number(m.recordCount||0),0);return[...s.values()].map(d=>$(F({},d),{earTagCount:d.earTagCount||Math.round(Number(d.recordCount||0)/At.value),ratio:l?Number(d.recordCount||0)/l*100:0})).sort((d,m)=>Number(m.recordCount||0)-Number(d.recordCount||0))}function _o(i={}){var m,b;const s=Array.isArray(i)?{rows:i}:i||{},l=s.result||{};return{rows:s.rows||s.data||s.list||s.records||[],year:(b=(m=s.year)!=null?m:l.year)!=null?b:null}}function Vn(i=[]){return Array.isArray(i)?i.map((s,l)=>{var K,re,se,fe,$e,mt,Yt,ga,ya,ba,mr,gr;const d=Xe(s.town||s.townName||s.town_name||""),m=String(s.village||s.villageName||s.village_name||s.name||"").trim(),b=pt((se=(re=(K=s.recordCount)!=null?K:s.record_count)!=null?re:s.records)!=null?se:s.total),w=pt((Yt=(mt=($e=(fe=s.earTagCount)!=null?fe:s.ear_tag_count)!=null?$e:s.headCount)!=null?mt:s.head_count)!=null?Yt:s.value),k=pt((ya=(ga=s.imageCount)!=null?ga:s.image_count)!=null?ya:s.images),G=pt((ba=s.imageRate)!=null?ba:s.image_rate),E=pt((mr=s.lng)!=null?mr:s.longitude),A=pt((gr=s.lat)!=null?gr:s.latitude);return{key:s.key||s.id||`${d}-${m}-${l}`,town:d,village:m,recordCount:Number.isFinite(b)?b:0,earTagCount:Number.isFinite(w)?w:0,imageCount:Number.isFinite(k)?k:0,imageRate:Number.isFinite(G)?G:0,lng:E,lat:A}}).filter(s=>s.town&&s.village&&Number.isFinite(s.earTagCount)).sort((s,l)=>Number(l.earTagCount||0)-Number(s.earTagCount||0)):[]}function Go(i={},s={}){const l=Array.isArray(s)?{rows:s}:s||{},d=l.result||{},m=Vn(l.rows||l.data||l.list||l.records||d.rows||[]),b=new Map;m.forEach(A=>{Ii(A.village).forEach(K=>{b.has(K)||b.set(K,A)})});const w=Pt(i==null?void 0:i.townCounts),k=w.length===1?Xe(w[0].name):"",G=xi(i),E=Pt(i==null?void 0:i.villageCounts).map((A,K)=>{var $e,mt;const re=String(A.name||"").trim(),se=Ii(re).map(Yt=>b.get(Yt)).find(Boolean)||{},fe=Number((mt=($e=A.recordCount)!=null?$e:A.value)!=null?mt:0);return{key:se.key||`${se.town||k||"防疫"}-${re}-${K}`,town:se.town||k,village:re,recordCount:fe,earTagCount:Number(A.earTagCount||0)||Math.round(fe/G),imageCount:se.imageCount||0,imageRate:se.imageRate||0,lng:se.lng,lat:se.lat}}).filter(A=>A.village&&A.recordCount>0);return $(F({},l),{rows:E})}function Ii(i){const s=String(i||"").trim(),l=s.replace(/(村|社区|牧委会)$/,"");return[...new Set([s,l].filter(Boolean))]}function pt(i){if(i==null||i==="")return NaN;const s=Number(String(i).replace(/,/g,"").replace(/%/g,""));return Number.isFinite(s)?s:NaN}function _i(i){return String(i||"").replace(/'/g,"''").replace(/%/g,"\\%").replace(/_/g,"\\_")}function Ao(i,s){const l=Xe(i),d=String(s||"").trim();if(!l||!d)return"";const m=_i(l),b=_i(d);return`(town_name = '${m}' AND village_name = '${b}')`}function Bo(i){const s=String(i||"").trim().replace(/\s+/g,"");return s?Array.from(s).join(` `):""}function Eo(i){const s=String(i||"").trim();if(!s)return"";const l=s.match(/^(.+)(镇|乡|村)$/);return l?`${l[1]} ${l[2]}`:s}function $o(i,s){return Gi(i.name)-Gi(s.name)}function Gi(i){const s=String(i||"").match(/(\d{1,2})\D+(\d{1,2})/);return s?Number(s[1])*100+Number(s[2]):Number.MAX_SAFE_INTEGER}function Dn(i=[]){return Array.isArray(i)?i.map(Ai).filter(Boolean):[]}function Ai(i){return i?{epidemicId:i.epidemicId||i.epidemic_id||i.id||"",earTag:i.earTag||i.ear_tag||"",owner:i.owner||"",idType:i.idType||i.id_type||"",idNo:i.idNo||i.id_no||"",phone:i.phone||"",town:i.town||"",village:i.village||"",location:i.location||"",livestockType:i.livestockType||i.livestock_type||"",age:i.age||"",sex:i.sex||"",weight:i.weight||i.weightKg||i.weight_kg||"",preventionType:i.preventionType||i.prevention_type||"",method:i.method||"",medicine:i.medicine||"",dose:i.dose||"",operator:i.operator||"",operateTime:i.operateTime||i.operate_time||"",imagePaths:i.imagePaths||i.image_paths||""}:null}function Bi(i=[]){return Array.isArray(i)?i.map(Vo).filter(Boolean):[]}function Vo(i){var s,l,d,m;return i?{certId:i.certId||i.cert_id||i.id||"",certType:i.certType||i.cert_type||"",certScopeName:i.certScopeName||i.cert_scope_name||"",factoryCode:i.factoryCode||i.factory_code||"",ownerName:i.ownerName||i.owner_name||"",ownerPhone:i.ownerPhone||i.owner_phone||"",transportNumber:i.transportNumber||i.transport_number||"",amount:Number((m=(d=(l=(s=i.amount)!=null?s:i.headCount)!=null?l:i.head_count)!=null?d:i.value)!=null?m:0),unitName:i.unitName||i.unit_name||"头",animalTypeName:i.animalTypeName||i.animal_type_name||"",usageTypeName:i.usageTypeName||i.usage_type_name||"",startTown:i.startTown||i.start_town||"",startRegionFullName:i.startRegionFullName||i.start_region_full_name||"",destProvince:i.destProvince||i.dest_province||"",destRegionFullName:i.destRegionFullName||i.dest_region_full_name||"",quarantineOfficerName:i.quarantineOfficerName||i.quarantine_officer_name||"",issueTime:i.issueTime||i.issue_time||"",statusName:i.statusName||i.status_name||""}:null}function ea(i,s){for(const l of s){const d=Number(i==null?void 0:i[l]);if(Number.isFinite(d))return d}return 0}function ft(...i){return ea(wi.value,i)}function Ei(i=[],s=2){const l=[...new Set(i.map(d=>String(d||"").trim()).filter(Boolean))];return l.length?l.length<=s?l.join("、"):`${l.slice(0,s).join("、")}等${l.length}个乡镇`:"暂无"}function Do(){const i=Bt.value;if(i.length)return{name:Ei(i,1),desc:"年度防疫覆盖需补强",level:"watch"};const s=zt.value.filter(d=>Number(d.earTagCount||d.recordCount||0)>0).sort((d,m)=>Number(d.earTagCount||d.recordCount||0)-Number(m.earTagCount||m.recordCount||0)),l=s[0];return l?{name:l.name,desc:`${ie(l.earTagCount||l.recordCount)}头,建议补免回访`,level:s.length>=2?"watch":"normal"}:{name:"暂无",desc:"等待年度防疫记录形成",level:"normal"}}function zo(){const i=Bt.value;if(i.length)return i.slice(0,4).map((d,m)=>({key:`missing-${d}`,name:d,value:Math.max(25,100-m*12),label:"待补免",level:"watch"}));const s=zt.value.filter(d=>Number(d.earTagCount||d.recordCount||0)>0);if(!s.length)return[{key:"empty",name:"暂无",value:0,label:"待开展",level:"watch"}];const l=s.reduce((d,m)=>d+Number(m.earTagCount||0),0)/s.length||1;return[...s].sort((d,m)=>Number(d.earTagCount||0)-Number(m.earTagCount||0)).slice(0,4).map(d=>{const m=Number(d.earTagCount||d.recordCount||0),b=Math.max(8,Math.round((l-m)/l*100));return{key:`weak-${d.name}`,name:d.name,value:Math.min(100,b),label:`${ie(m)}头`,level:b>=35?"watch":"normal"}})}function Oo(){const s=(Cn.value.length?Cn.value:zt.value).map((m,b)=>{const w=Xe(m.name),k=Number(m.earTagCount||0),G=Number(m.recordCount||m.value||0),E=k||Math.round(G/At.value);return{key:m.key||`${w}-${b}`,name:w,value:E,recordCount:G,isMissing:!1}}).filter(m=>m.name&&Number.isFinite(m.value)),d=[...Bt.value.map((m,b)=>({key:`missing-${m}-${b}`,name:m,value:0,recordCount:0,isMissing:!0})),...s];return d.length?d.sort((m,b)=>m.isMissing!==b.isMissing?m.isMissing?-1:1:Number(m.value||0)-Number(b.value||0)).slice(0,7):[{key:"empty",name:"待开展",value:0,recordCount:0,isMissing:!0}]}function Wo(){var s;const i=yi.value.map((l,d)=>({key:l.key||`${l.town}-${l.village}-${d}`,name:l.village||l.name,town:l.town,value:Number(l.earTagCount||l.value||0)})).filter(l=>l.name&&Number.isFinite(l.value)&&l.value>0);return i.length?i.sort((l,d)=>d.value-l.value).slice(0,9):Pt((s=Ne.value)==null?void 0:s.villageCounts).map((l,d)=>({key:l.key||`${l.name}-${d}`,name:l.name,town:"",value:Math.round(Number(l.value||0)/At.value)})).filter(l=>l.name&&Number.isFinite(l.value)&&l.value>0).sort((l,d)=>d.value-l.value).slice(0,9)}function Yo(){if(!ht.value)return{level:"watch",title:"年度待开展",desc:"年度免疫记录暂未形成",advice:"建议先核查年度免疫计划与乡镇推进节奏。"};const i=Cs.value,s=Da.value;return Bt.value.length?{level:"watch",title:"补免待核查",desc:`乡镇覆盖${Ct(i)},${s.name}需补强`,advice:`优先核查${Ei(Bt.value,1)}免疫进度。`}:i>=90&&At.value>=4?{level:"stable",title:"运行平稳",desc:`乡镇覆盖${Ct(i)},疫苗谱较完整`,advice:"建议保持当前免疫节奏,持续跟踪补免回访。"}:{level:"normal",title:"均衡回访",desc:`${s.name}相对偏低,适合继续跟进`,advice:`关注${s.name}补免回访,保持覆盖均衡。`}}function jo(){return[{key:"latest",name:"最近免疫",value:gi.value,desc:"最后作业时间",level:gi.value==="-"?"watch":"stable",color:"#8bf7ff"},{key:"top-town",name:"高频乡镇",value:Ms.value,desc:"年度作业集中区",level:"normal",color:"#30dcff"},{key:"vaccine",name:"主用疫苗",value:Ts.value,desc:`${At.value}类疫苗`,level:"normal",color:"#8bf7ff"}]}function Ho(i=[]){if(!Array.isArray(i))return[];const s=["#63d7ff","#30dcff","#48cfff","#48cfff"];return i.map((l,d)=>{const m=l.level==="重点"?"high":l.level==="关注"?"watch":"normal";return{key:l.key||`risk-${d}`,name:l.name||"监管线索",value:l.detail||"暂无",desc:l.level==="重点"?"重点关注":l.level==="关注"?"持续关注":"运行平稳",level:m,badge:l.level||"平稳",color:s[d%s.length]}})}function zn(i={}){return String(i.imagePaths||"").split(";").map(s=>s.trim()).filter(Boolean)}function $i(i){const l=String(i||"").replace(/^images\//,"").split("/").map(encodeURIComponent).join("/");return`${Sh}/${l}`}function qo(i){et.value=$i(i),Ue.value=!0}function On(){Ue.value=!1,et.value=""}function J(i){return i==null||i===""?"-":i}function Uo(i){const s=String(i!=null?i:"").trim();return!!(s&&s!=="-")}function ke(i,s,l={}){return Uo(s)?F({label:i,value:s},l):null}function Et(i){return i?String(i).slice(0,10):"-"}function Vi(i){const s=String(i||"").trim();return s?s.length<7?s:`${s.slice(0,3)}****${s.slice(-4)}`:"-"}function Ko(i){const s=String(i||"").trim();return s?s.length<=4?s:`****${s.slice(-4)}`:"-"}function Zo(i){const s=String(i!=null?i:"").trim();if(!s)return"-";if(/kg|公斤|千克/i.test(s))return s;const l=Number(s);return Number.isFinite(l)?`${U(l)}kg`:s}function Xo(i){return String(i!=null?i:"").trim()||"-"}function Di(i={}){return i.certScopeName||i.certType||"-"}function Jo(){return oe(this,null,function*(){var d;ot.value=!0,_e.value="";const[i,s,l]=yield Promise.allSettled([tc(),uc(),cc()]);i.status==="fulfilled"?(pc(i.value),Me.value+=1):_e.value="牦牛管理基础数据接口异常",s.status==="fulfilled"&&((d=s.value)!=null&&d.length)&&(It.value=bc(s.value.map(m=>({name:cn(m.name),count:Number(m.value)})).filter(m=>m.name&&Number.isFinite(m.count)))),l.status==="fulfilled"?(wt.value=fl(l.value),wt.value.length||(_e.value="结构数据暂无数据")):(_e.value=gl(l.reason,"结构数据异常"),wt.value=[]),ot.value=!1})}function zi(){return oe(this,arguments,function*(i=ve.value){var s,l,d,m,b,w;Tt.value=!0,St.value="";try{(l=(s=pe.value)==null?void 0:s.years)!=null&&l.length||(pe.value=yield ac());const k=Ri((d=pe.value)==null?void 0:d.years),G=Number(((m=pe.value)==null?void 0:m.latestYear)||((b=pe.value)==null?void 0:b.latest_year)||k[k.length-1]),E=Number(i||ve.value||G||k[k.length-1]);ve.value=E;let A=yield Ur({year:E});const K=(w=A==null?void 0:A.hasData)!=null?w:A==null?void 0:A.has_data,re=Number((A==null?void 0:A.latestYear)||(A==null?void 0:A.latest_year)||G);K===!1&&re&&re!==E&&(ve.value=re,A=yield Ur({year:re})),Z.value=A||{metrics:{},hasData:!1},yield Wn(1)}catch(k){St.value="交易数据接口异常",Z.value={metrics:{},hasData:!1},tt.value=[],ct.value=0}finally{Tt.value=!1}})}function Wn(){return oe(this,arguments,function*(i=Mt.value){var l,d;if(!ve.value)return;const s={year:ve.value,page:i,pageSize:Xn,keyword:pn.value};try{const m=yield Kr(s);tt.value=Bi(m.rows),ct.value=Number(((l=m.page)==null?void 0:l.totalCount)||m.totalCount||tt.value.length||0),Mt.value=Number(((d=m.page)==null?void 0:d.page)||i||1)}catch(m){St.value=St.value||"交易台账接口异常",tt.value=[],ct.value=0}})}function Qo(i){const s=Number(i);!Number.isFinite(s)||s===Number(ve.value)||(ve.value=s,Mt.value=1,Ca.value="",pn.value="",zi(s))}function el(i){const s=An(i);s!==Number(me.value)&&(me.value=s,be.value=1,ut.value="",M.value="",ce.value=1,he.value=Ya(),Ki(s))}function Oi(){pn.value=Ca.value.trim(),Wn(1)}function Wi(i){const s=Math.min(Math.max(Number(i)||1,1),xn.value);Wn(s)}function Yi(i=null){fn.value=!0,i&&(Na.value=i),Ha(i?Mt.value:1,i)}function ji(){fn.value=!1}function Hi(){Ha(1)}function tl(){dt.value={keyword:"",startTown:"",usageType:"",certType:""},Ha(1)}function qi(i){const s=Math.min(Math.max(Number(i)||1,1),Rn.value);Ha(s)}function Ha(){return oe(this,arguments,function*(i=Dt.value,s=null){var m,b;if(!ve.value)return;mn.value=!0,gn.value="";const l=dt.value,d={year:ve.value,page:i,pageSize:Xr,keyword:l.keyword.trim(),startTown:l.startTown,usageType:l.usageType,certType:l.certType};try{const w=yield Kr(d);Vt.value=Bi(w.rows),Fa.value=Number(((m=w.page)==null?void 0:m.totalCount)||w.totalCount||Vt.value.length||0),Dt.value=Number(((b=w.page)==null?void 0:b.page)||i||1);const k=s?s.certId||s.factoryCode:"",G=k?Vt.value.find(E=>(E.certId||E.factoryCode)===k)||s:Vt.value[0]||null;Ui(G)}catch(w){gn.value="交易台账接口异常",Vt.value=[],Fa.value=0,Na.value=null}finally{mn.value=!1}})}function Ui(i){Na.value=i||null}function al(i){i!=null&&i.startTown&&(O.value="trade",Ut(()=>{var s,l,d,m,b,w;(l=(s=xe.value)==null?void 0:s.resume)==null||l.call(s),(m=(d=xe.value)==null?void 0:d.refreshView)==null||m.call(d),(w=(b=xe.value)==null?void 0:b.focusTown)==null||w.call(b,Xe(i.startTown),{distanceScale:.78,duration:.8})}))}function Ki(){return oe(this,arguments,function*(i=me.value){var k;const s=An(i),l=Bn(s);me.value=s,v.value=!0,R.value="";const[d,m,b,w]=yield Promise.allSettled([rc(l),Zn(F({page:be.value,pageSize:on,keyword:M.value},l)),sc({year:s}),oc({year:s})]);if(d.status==="fulfilled"?Ne.value=d.value||{metrics:{}}:(R.value="防疫统计接口异常",Ne.value={metrics:{}}),m.status==="fulfilled"){const G=m.value||{};ze.value=Dn(G.rows),qe.value=Number(((k=G.page)==null?void 0:k.totalCount)||G.totalCount||ze.value.length||0)}else R.value=R.value||"防疫台账接口异常",ze.value=[],qe.value=0;b.status==="fulfilled"?lt.value=_o(b.value):lt.value={rows:[],year:null},w.status==="fulfilled"?Lt.value=Go(Ne.value,w.value):Lt.value={rows:[]},v.value=!1})}function Zi(){return oe(this,arguments,function*(i=be.value){var d,m;v.value=!0,R.value="";const s=Math.min(Math.max(Number(i)||1,1),Fn.value),l=Bn(me.value);try{const b=yield Zn(F({page:s,pageSize:on,keyword:M.value},l));ze.value=Dn(b.rows),qe.value=Number(((d=b.page)==null?void 0:d.totalCount)||b.totalCount||ze.value.length||0),be.value=Number(((m=b.page)==null?void 0:m.page)||s||1)}catch(b){R.value="防疫台账接口异常",ze.value=[],qe.value=0,be.value=1}finally{v.value=!1}})}function Xi(){M.value=ut.value.trim(),he.value=$(F({},Ya()),{keyword:M.value}),Zi(1)}function Ji(i){Zi(i)}function Qi(i=null){D.value=!0,i&&(Ae.value=i,Be.value=null),qa(1,i)}function er(){D.value=!1,On()}function tr(){qa(1)}function nl(){he.value=Ya(),qa(1)}function ar(i){qa(i)}function qa(){return oe(this,arguments,function*(i=ce.value,s=null){var b,w;Ge.value=!0,Oe.value="";const l=he.value,d=Bn(me.value),m={keyword:l.keyword.trim(),town:l.town,medicine:l.medicine,startDate:l.startDate||d.startDate,endDate:l.endDate||d.endDate,page:i,pageSize:Zr};try{const k=yield Zn(m);H.value=Dn(k.rows),ee.value=Number(((b=k.page)==null?void 0:b.totalCount)||k.totalCount||H.value.length||0),ce.value=Number(((w=k.page)==null?void 0:w.page)||i||1);const G=s||H.value[0]||null;G?nr(G):(Ae.value=null,Be.value=null)}catch(k){Oe.value="台账接口异常",H.value=[],ee.value=0}finally{Ge.value=!1}})}function nr(i){return oe(this,null,function*(){if(Ae.value=i,Be.value=null,!(i!=null&&i.earTag)&&!(i!=null&&i.epidemicId))return;const s=++Aa;Ee.value=!0;try{const l=yield lc(i.earTag||i.epidemicId);s===Aa&&(Be.value=Ai(l)||i)}catch(l){s===Aa&&(Be.value=i)}finally{s===Aa&&(Ee.value=!1)}})}function ir(){var i;si||Ia||(si=!0,yn=new cu,Ia=!1,(i=yn.ready)==null||i.then(()=>{Ia=!0,Ye.value=!1,Ua()}).catch(s=>{console.warn("[yakManagement] map assets unavailable",s),Qt.value=!1,Ye.value=!0}))}function rr(i){(i==="structure"||i==="forecast")&&!oi&&(oi=!0,Jo()),i==="epidemic"&&!li&&(li=!0,Ki()),i==="trade"&&!ui&&(ui=!0,zi())}function Ua(){_a||!a.active||!Ia||_t||(Ye.value=!1,_t=!0,kt&&window.clearTimeout(kt),kt=window.setTimeout(()=>{kt=null,sr()},600))}function sr(i=0){return oe(this,null,function*(){var l,d;if(_a)return;if(!a.active){_t=!1;return}if(yield Ut(),!a.active){_t=!1;return}const s=xe.value;if((l=s==null?void 0:s.loadMap)==null||l.call(s,yn),s!=null&&s.canvasMap){_t=!1,Qt.value=!0,Ye.value=!1,(d=s.play)==null||d.call(s);return}if(i<24){window.setTimeout(()=>sr(i+1),120);return}_t=!1,Ye.value=!0})}function or(i={}){Ra.value={type:i.type||"idle",text:i.text||""}}function il(){pa.value=!0,Ye.value=!1}function lr(i={}){xa.value={type:i.type||"idle",text:i.text||"",loaded:i.loaded,failed:i.failed,total:i.total,zoom:i.zoom,tileUrlTemplate:i.tileUrlTemplate}}function rl(){if(O.value==="epidemic"){n("module-stats",{moduleKey:"yak-management",items:[{zh:"防疫记录",value:ht.value,unit:"条"},{zh:"防疫耳标",value:Pn.value,unit:"头"},{zh:"疫苗类型",value:At.value,unit:"类"},{zh:"涉及村数",value:Ss.value,unit:"个"}]});return}if(O.value==="forecast"){const i=Ke.value.stock-Nt;n("module-stats",{moduleKey:"yak-management",items:[{zh:"预测期末存栏",value:Ke.value.stock,unit:"头"},{zh:"新生牛犊",value:Ke.value.births,unit:"头"},{zh:"出栏流出",value:Ke.value.outflow,unit:"头"},{zh:"预测净变化",value:i,unit:"头"}]});return}if(O.value==="trade"){n("module-stats",{moduleKey:"yak-management",items:[{zh:"流通总量",value:ft("headCount"),unit:"头"},{zh:"出证记录",value:ft("recordCount"),unit:"条"},{zh:"运输车辆",value:ft("vehicleCount"),unit:"辆"}]});return}n("module-stats",{moduleKey:"yak-management",items:[{zh:"图像识别总数",value:rs,unit:"头"},{zh:"模型修正总数",value:ps.value,unit:"头"},{zh:"当前存栏数量",value:Nt,unit:"头"}]})}function Yn(i,s,l,d={}){const m=d.labelKey||"name",b=i.length>8,w=d.style==="ladder",k=b?w?7:6:i.length>6?11:13,G=d.axisTextColor||g,E=d.dimAxisTextColor||C;return{tooltip:$(F({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(A){if(d.tooltipFormatter)return d.tooltipFormatter(A[0]);const K=i[A[0].dataIndex];return`${K[m]}
数值:${U(K[s])}${l}`}}),grid:{left:b?58:74,right:b?54:58,top:b?6:16,bottom:b?8:14},xAxis:{type:"value",axisLabel:{color:E,fontSize:10,formatter:l==="%"?"{value}%":ie},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:N,type:"dashed"}}},yAxis:{type:"category",inverse:!0,data:i.map(A=>A[m]),axisLabel:{color:G,fontSize:b?10:11,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:[{type:"bar",barWidth:k,barGap:"-100%",data:i.map(A=>({value:A[s],itemStyle:{borderRadius:[1,2,2,1],color:sl(sn),shadowBlur:2,shadowColor:"rgba(48, 220, 255, 0.12)"}})),showBackground:!0,backgroundStyle:{color:w?"rgba(48, 220, 255, 0.05)":"rgba(48, 220, 255, 0.07)",borderRadius:[1,2,2,1]},label:{show:!0,position:"right",color:L,fontFamily:qn.number,fontSize:b?10:kr.chartLabel,fontWeight:700,formatter:({value:A})=>`${l==="%"?Ct(A):ie(A)}`}}]}}function sl(i){return new Ve(0,0,1,0,[{offset:0,color:"rgba(67, 217, 232, 0.14)"},{offset:.58,color:"rgba(67, 217, 232, 0.7)"},{offset:1,color:i}])}function ur(i,s,l,d=0,m=!1){return{name:i,type:"line",yAxisIndex:d,smooth:!0,symbolSize:5,data:s,lineStyle:{width:2.5,color:l},itemStyle:{color:l},areaStyle:m?{color:new Ve(0,0,0,1,[{offset:0,color:`${l}44`},{offset:1,color:`${l}05`}])}:void 0}}function ol(i){return bn.find(s=>s.key===i)||bn[2]}function ll(i,s="month"){var d;if(s==="month")return yc(i);const l=((d=i==null?void 0:i.series)==null?void 0:d[s])||{};return{labels:Array.isArray(l.labels)?l.labels:[],stock:Array.isArray(l.stock)?l.stock.map(Number):[],births:Array.isArray(l.births)?l.births.map(Number):[],outflow:Array.isArray(l.outflow)?l.outflow.map(Number):[]}}function ul(i,s){return s==="day"?Math.max(10,Math.ceil(i/6)):s==="week"?Math.max(2,Math.ceil(i/7)):i>24?4:i>14?2:1}function cl(i,s){return s==="day"?i>700?2:i>360?3:4:s==="week"?i>110?4:6:i>24?7:10}function dl(i){return(i.labels||[]).map((s,l)=>{var A,K,re,se,fe,$e;const d=Number(((A=i.stock)==null?void 0:A[Math.max(l-1,0)])||0),m=Number(((K=i.stock)==null?void 0:K[l])||d),b=Math.max(0,Number(((re=i.births)==null?void 0:re[l])||0)-Number(((se=i.births)==null?void 0:se[Math.max(l-1,0)])||0)),w=Math.max(0,Number(((fe=i.outflow)==null?void 0:fe[l])||0)-Number((($e=i.outflow)==null?void 0:$e[Math.max(l-1,0)])||0)),k=Math.max(120,Math.round((b+w)*.18)),G=Math.max(d,m)+Math.max(k,Math.round(b*.32)),E=Math.max(0,Math.min(d,m)-Math.max(k,Math.round(w*.32)));return{label:s,open:d,close:m,low:E,high:G,birth:b,outflow:w,value:[d,m,E,G]}})}function hl(i,s){const l=new Map;return i.forEach(d=>{const m=pl(d.name);if(!m)return;const b=l.get(m)||{name:m,value:0};b.value+=Number(d[s]||0),l.set(m,b)}),[...l.values()].sort((d,m)=>m.value-d.value)}function pl(i){return{色地镇:"色地镇",瓦切镇:"瓦切镇",安曲镇:"安曲镇",龙日镇:"龙日镇",邛溪镇:"邛溪镇",刷经寺镇:"刷经寺镇",阿木乡:"阿木乡",查尔玛乡:"查尔玛乡",江茸乡:"江茸乡",麦洼乡:"麦洼乡"}[i]||""}function we(i){return{trigger:"item",backgroundColor:"rgba(5, 31, 51, 0.96)",borderColor:"rgba(0, 210, 255, 0.54)",borderWidth:1,padding:[7,10],textStyle:{color:g,fontFamily:qn.ui,fontSize:kr.tooltip,lineHeight:18},extraCssText:"box-shadow:0 0 10px rgba(0,210,255,.12);",formatter:i}}function jn(i){return bt.some(s=>s.key===i)?i:"structure"}function fl(i=[]){return i.map((s,l)=>{var b,w,k,G;const d=String(s.name||s.label||s.type||`结构${l+1}`).trim(),m=cr((w=(b=s.value)!=null?b:s.count)!=null?w:s.number);return{key:s.key||s.id||`${d}-${l}`,name:d,count:m,ratio:Number((G=(k=s.ratio)!=null?k:s.percent)!=null?G:0),source:s.source||"结构统计"}}).filter(s=>s.name&&s.count>0)}function ml(i=[],s=[]){const l=i.some(m=>fr(m))?i:s;return pr(l,s).map((m,b)=>{var G,E;const w=String(m.name||m.label||`结构${b+1}`).trim(),k=cr((E=(G=m.count)!=null?G:m.value)!=null?E:m.number);return $(F({},m),{key:m.key||`${w}-${b}`,name:w,count:k})}).filter(m=>m.name&&m.count>0)}function cr(i){const s=Number(String(i!=null?i:"").replace(/,/g,"").replace(/%/g,""));return Number.isFinite(s)&&s>0?Math.round(s):0}function gl(i,s){const l=String((i==null?void 0:i.message)||i||"");return/未登录|401|HTTP_401/.test(l)?"结构数据未就绪":/超时|timeout/i.test(l)?"结构数据加载超时":s}function U(i){const s=Number(i);return Number.isFinite(s)?s.toLocaleString("zh-CN",{maximumFractionDigits:Number.isInteger(s)?0:2}):"--"}function ie(i){const s=Number(i);return Number.isFinite(s)?Math.abs(s)>=1e4?`${(s/1e4).toFixed(Math.abs(s)>=1e5?0:1)}万`:Math.round(s).toLocaleString("zh-CN"):"--"}function Ka(i,s=2){const l=Number(i);return Number.isFinite(l)?`${(l/1e4).toFixed(s)}万`:"--"}function Ct(i){const s=Number(i);return Number.isFinite(s)?`${Number.isInteger(s)?s:s.toFixed(1)}%`:"--"}function Wt(i,s,l,d){const m=d*Math.PI/180;return{x:Number((i+l*Math.cos(m)).toFixed(2)),y:Number((s+l*Math.sin(m)).toFixed(2))}}function yl(i,s,l,d,m,b){const w=Wt(i,s,d,m),k=Wt(i,s,d,b),G=Wt(i,s,l,b),E=Wt(i,s,l,m),A=b-m>180?1:0;return[`M ${w.x} ${w.y}`,`A ${d} ${d} 0 ${A} 1 ${k.x} ${k.y}`,`L ${G.x} ${G.y}`,`A ${l} ${l} 0 ${A} 0 ${E.x} ${E.y}`,"Z"].join(" ")}function dr(i=[]){return i.reduce((s,l)=>{const d=ua.find(m=>m.key===l);return s+Number((d==null?void 0:d.ratio)||0)},0)}function hr(){return[{key:"fertileCow",name:"适龄能繁母牛",color:"#3ed9e7",matcher:(i,s)=>i==="fertileCow"||s.includes("适龄能繁母牛")},{key:"meatBull",name:"麦洼公牦牛",color:"#5b8ff9",matcher:(i,s)=>i==="meatBull"||s.includes("肉公牛")||s.includes("麦洼公牦牛")},{key:"breedingBull",name:"种公牛",color:"#f6bd16",matcher:(i,s)=>i==="breedingBull"||s.includes("种公牛")},{key:"femaleCalf",name:"母犊牛",color:"#5ad8a6",matcher:(i,s)=>i==="femaleCalf"||s.includes("母犊牛")},{key:"maleCalf",name:"公犊牛",color:"#9270ca",matcher:(i,s)=>i==="maleCalf"||s.includes("公犊牛")},{key:"overageCow",name:"过龄能繁母牛",color:"#e8684a",matcher:(i,s)=>i==="overageCow"||s.includes("过龄能繁母牛")}]}function bl(i=[]){const s=i.reduce((d,m)=>d+Number(m.count||0),0)||1;return[{key:"female",group:"性别",name:"母牛合计",color:"#8bf7ff",matcher:(d,m)=>["fertileCow","femaleCalf","overageCow"].includes(d)||m.includes("母")},{key:"male",group:"性别",name:"公牛合计",color:"#30dcff",matcher:(d,m)=>["meatBull","breedingBull","maleCalf"].includes(d)||m.includes("公")||m.includes("肉牛")},{key:"calf",group:"阶段",name:"犊牛合计",color:"#8bf7ff",matcher:(d,m)=>["femaleCalf","maleCalf"].includes(d)||m.includes("犊牛")},{key:"breeding-cow",group:"阶段",name:"能繁母牛",color:"#48cfff",matcher:(d,m)=>["fertileCow","overageCow"].includes(d)||m.includes("能繁母牛")}].map(d=>{const m=i.filter(b=>d.matcher(String(b.key||""),String(b.name||""))).reduce((b,w)=>b+Number(w.count||0),0);return{key:d.key,group:d.group,name:d.name,color:d.color,count:m,percent:m/s*100}})}function pr(i=[],s=[]){const d=i.some(w=>fr(w))?i:s,m=d.reduce((w,k)=>w+Number(k.count||0),0)||Nt||1;return hr().map(w=>{const k=d.filter(A=>w.matcher(String(A.key||""),String(A.name||""))),G=k.reduce((A,K)=>A+Number(K.count||0),0),E=k.length===1?Number(k[0].ratio):Number.NaN;return{key:w.key,name:w.name,color:w.color,count:G,percent:Number.isFinite(E)&&E>0?E:G/m*100}}).filter(w=>w.count>0||w.percent>0)}function fr(i={}){const s=String(i.key||""),l=String(i.name||"");return hr().some(d=>d.matcher(s,l))}function vl(i=[],s=[]){const d=i.some(w=>wl(w))?i:s,m=d.reduce((w,k)=>w+Number(k.count||0),0)||1,b=(w,k,G,E,A)=>{const K=d.filter(fe=>E(String(fe.key||""),String(fe.name||""))),re=K.reduce((fe,$e)=>fe+Number($e.count||0),0),se=K.length===1?Number(K[0].ratio):Number.NaN;return{key:w,name:k,color:G,count:re,percent:Number.isFinite(se)&&se>0?se:re/m*100,desc:A}};return[b("fertile-cow","适龄能繁母牛","#30dcff",(w,k)=>w==="fertileCow"||k.includes("适龄能繁母牛"),"繁殖基础"),b("calf","犊牛合计","#8bf7ff",(w,k)=>["femaleCalf","maleCalf"].includes(w)||k.includes("犊牛"),"新生补充"),b("overage-cow","过龄能繁母牛","#30dcff",(w,k)=>w==="overageCow"||k.includes("过龄能繁母牛"),"更新压力"),b("breeding-bull","种公牛配比","#48cfff",(w,k)=>w==="breedingBull"||k.includes("种公牛"),"配种支撑")]}function wl(i={}){const s=String(i.key||""),l=String(i.name||"");return["fertileCow","femaleCalf","maleCalf","overageCow","breedingBull"].includes(s)||l.includes("适龄能繁母牛")||l.includes("犊牛")||l.includes("过龄能繁母牛")||l.includes("种公牛")}function Ll(i=[]){const s=w=>{var k;return Number(((k=i.find(G=>G.key===w))==null?void 0:k.percent)||0)},l=s("fertile-cow"),d=s("calf"),m=s("overage-cow"),b=s("breeding-bull");return l>=40&&d>=25&&b>=2&&b<=5&&m<=10?{label:"结构健康",title:"繁殖基础稳定",summary:"适龄母牛足,犊牛补充稳",note:"保持适龄能繁母牛、犊牛补充与种公牛配置稳定。"}:d<25?{label:"结构健康",title:"犊牛补充需关注",summary:"繁殖基础稳定,补充端可优化",note:"关注犊牛成活和季节性补栏,保持生产连续性。"}:b<2?{label:"结构健康",title:"繁殖基础总体稳定",summary:"适龄母牛基础较稳",note:"结合实际配种需求,平稳优化公牛配置。"}:{label:"结构健康",title:"生产阶段较均衡",summary:"繁殖群和犊牛补充连续支撑",note:"延续结构管理,优先保障适龄母牛与犊牛质量。"}}function Tl(i){const s=Number((i==null?void 0:i.count)||0);return Math.max(8,Math.min(100,s/ys.value*100))}function Sl(i={}){const s=Nt,l=[{key:"births",name:"新生牛犊",delta:Number(i.births||0),color:"#30dcff"},{key:"outflow",name:"出栏流出",delta:-Number(i.outflow||0),color:"#48cfff"},{key:"correction",name:"修正损耗",delta:Number(i.correction||0),color:"#8bf7ff"}];let d=s;const m=[{key:"current",name:"当前存栏",type:"anchor",value:s,magnitude:s,from:s,to:s,color:"#30dcff",display:`${Ka(s,2)}头`}];l.forEach(k=>{const G=d,E=d+k.delta;d=E,m.push($(F({},k),{name:`${k.delta>=0?"+":"-"}${k.name}`,type:"delta",from:G,to:E,value:k.delta,magnitude:Math.abs(k.delta),display:`${Ml(k.delta)}头`}))});const b=Number(i.stock||d);m.push({key:"final",name:"=期末预测",type:"final",value:b,magnitude:b,from:b,to:b,color:"#48cfff",display:`${Ka(b,2)}头`});const w=Math.max(...m.map(k=>Number(k.magnitude)||0),1);return m.map(k=>{const G=(Number(k.magnitude)||0)/w*100;return $(F({},k),{left:0,width:Math.max(k.type==="delta"?5:10,Math.min(100,G))})})}function Za(i){const s=Number(i);return Number.isFinite(s)?`${s>=0?"+":"-"}${U(Math.abs(s))}`:"--"}function Ml(i){const s=Number(i);return Number.isFinite(s)?`${s>=0?"+":"-"}${Ka(Math.abs(s))}`:"--"}return(i,s)=>(x(),_("div",vc,[Je((x(),Xa(Ku,{key:hs.value,ref_key:"mapSceneRef",ref:xe,class:"yak-map-scene","active-layer":eo.value,"map-ranking":to.value,"tile-url-template":ci.value,"use-satellite-base":vn.value,"satellite-max-zoom":21,"admin-boundary-line-scale":1.35,onLayerStatus:or,onTileStatus:lr},null,8,["active-layer","map-ranking","tile-url-template","use-satellite-base"])),[[Il,!Ze.value]]),Ze.value?(x(),Xa(ru,{key:ri.value,ref_key:"yakOlMapRef",ref:ha,class:"yak-ol-map-layer",active:a.active&&Ze.value,"tile-url-template":ci.value,center:Qs.value,"initial-zoom":kh,"minimum-zoom-distance":1,"county-view-target-offset":W(ae),"admin-boundary-line-scale":1.65,"auto-apply-layer-map-view":!1,"max-zoom":21,"map-ranking":Pi.value,"overlay-layer":ki.value,onReady:il,onLayerStatus:or,onTileStatus:lr},null,8,["active","tile-url-template","center","county-view-target-offset","map-ranking","overlay-layer"])):Le("",!0),f("div",{class:De(["yak-map-scrim",{"is-ol-map":Ze.value}])},null,2),ao.value?(x(),_("div",{key:1,class:De(["yak-map-loading",{"is-timeout":Ye.value}]),role:"status","aria-live":"polite"},[f("strong",null,P(Ye.value?"地图暂未加载完成":no.value),1),Ye.value?(x(),_(Q,{key:1},[s[24]||(s[24]=f("span",null,"其余业务数据仍可查看,您可以重新加载地图。",-1)),f("button",{type:"button",onClick:Po},"重新加载地图")],64)):(x(),_("span",wc,"正在准备地图资源,请稍候"))],2)):Le("",!0),f("div",Lc,[O.value==="trade"&&Li.value.length?(x(),_("div",Tc,[s[25]||(s[25]=f("span",null,"交易年份",-1)),(x(!0),_(Q,null,de(Li.value,l=>(x(),_("button",{key:l,type:"button",class:De({active:Number(l)===Number(ve.value)}),onClick:d=>Qo(l)},P(l),11,Sc))),128))])):Le("",!0),O.value==="epidemic"&&Fe.length?(x(),_("div",Mc,[s[26]||(s[26]=f("span",null,"防疫年份",-1)),(x(),_(Q,null,de(Fe,l=>f("button",{key:l,type:"button",class:De({active:Number(l)===Number(me.value)}),onClick:d=>el(l)},P(l),11,kc)),64))])):Le("",!0),O.value==="forecast"?(x(),_("div",Pc,[s[27]||(s[27]=f("span",null,"预测年份",-1)),(x(!0),_(Q,null,de(W(xt),l=>(x(),_("button",{key:l.key,type:"button",class:De({active:l.key===vt.value}),onClick:d=>Co(l.key)},P(l.shortLabel),11,Cc))),128))])):Le("",!0),f("div",Fc,[f("div",Nc,[O.value==="structure"?(x(),_(Q,{key:0},[Y(le,{class:"yak-side-card left-card",title:"繁殖基础评估",width:W(r),height:u.value},{default:ne(()=>[f("div",xc,[f("div",Rc,[f("strong",null,P(pi.value.title)+","+P(pi.value.summary),1)]),f("div",Ic,[(x(!0),_(Q,null,de(hi.value,l=>(x(),_("div",{key:l.key,class:"breeding-health-item",style:Ft({"--health-color":l.color,"--health-width":`${Math.max(5,Math.min(100,l.percent))}%`})},[f("span",null,P(l.name),1),f("strong",null,P(Ct(l.percent)),1),s[28]||(s[28]=f("i",null,[f("b")],-1)),f("em",null,P(l.desc),1)],4))),128))])])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"畜群结构占比",width:W(r),height:u.value},{default:ne(()=>[f("div",_c,[f("div",Gc,[f("div",Ac,[(x(),_("svg",Bc,[f("g",Ec,[(x(!0),_(Q,null,de(bs.value,l=>(x(),_("path",{key:l.key,class:De(["structure-rose-segment",{"is-active":l.index===Ln.value}]),d:l.path,fill:l.color,stroke:l.color},null,10,$c))),128))]),s[29]||(s[29]=f("circle",{class:"structure-rose-glow",cx:"75",cy:"75",r:"24"},null,-1)),s[30]||(s[30]=f("circle",{class:"structure-rose-hole",cx:"75",cy:"75",r:"16"},null,-1)),s[31]||(s[31]=f("text",{class:"structure-rose-center",x:"75",y:"72","text-anchor":"middle"},"结构",-1)),s[32]||(s[32]=f("text",{class:"structure-rose-center is-sub",x:"75",y:"83","text-anchor":"middle"},"占比",-1))]))]),f("div",Vc,[(x(!0),_(Q,null,de(Ea.value,(l,d)=>(x(),_("div",{key:l.key||l.name,class:De(["structure-ratio-row",{"is-active":d===Ln.value}]),style:Ft({"--row-color":l.color,"--row-percent":`${Math.max(4,l.percent)}%`})},[f("i",{style:Ft({background:l.color,color:l.color})},null,4),f("span",null,[jt(P(l.name),1),f("small",null,P(Ct(l.percent)),1)]),f("strong",null,P(ie(l.count)),1),s[33]||(s[33]=f("em",null,"头",-1))],6))),128))])]),ot.value?(x(),_("div",Dc,"结构数据加载中")):_e.value?(x(),_("div",zc,P(_e.value),1)):Le("",!0)])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"母牛/公牛年龄结构",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:io.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"牦牛乡镇分布",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:ro.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"])],64)):O.value==="forecast"?(x(),_(Q,{key:1},[Y(le,{class:"yak-side-card left-card",title:"存栏变化拆解",width:W(r),height:u.value},{default:ne(()=>[f("div",Oc,[f("div",Wc,[f("span",null,P(Ke.value.label)+"变化路径",1),f("strong",{class:De({positive:wn.value>0,negative:wn.value<0})},[jt(" 净变化 "+P(Za(wn.value)),1),s[34]||(s[34]=f("em",null,"头",-1))],2)]),f("div",Yc,[(x(!0),_(Q,null,de(fs.value,l=>(x(),_("div",{key:l.key,class:De(["forecast-waterfall-row",[`is-${l.type}`,{positive:l.delta>0,negative:l.delta<0}]]),style:Ft({"--waterfall-left":`${l.left}%`,"--waterfall-width":`${l.width}%`,"--waterfall-color":l.color})},[f("span",null,P(l.name),1),s[35]||(s[35]=f("i",null,[f("b")],-1)),f("strong",null,P(l.display),1)],6))),128))])])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"未来存栏趋势",width:W(r),height:u.value},{default:ne(()=>[f("div",jc,[f("div",Hc,[(x(),_(Q,null,de(bn,l=>f("button",{key:l.key,type:"button",class:De({active:l.key===Rt.value}),onClick:d=>Rt.value=l.key},P(l.label),11,qc)),64))]),Y(W(Pe),{class:"yak-chart forecast-kline-chart",option:uo.value,autoresize:!0},null,8,["option"])])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"月度数量预测",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:co.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"预测因子雷达",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:ho.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"])],64)):O.value==="epidemic"?(x(),_(Q,{key:2},[Y(le,{class:"yak-side-card left-card",title:"防疫统计",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:wo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"养殖户防疫排行",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:Lo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"防疫作业趋势",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:vo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"疫苗类型分布",width:W(r),height:u.value},{default:ne(()=>[Va.value.length?(x(),_("div",Uc,[f("div",Kc,[(x(),Xa(Kl,{key:ws.value,data:Va.value,delay:3e3,colors:Ce,opacity:.62,class:"epidemic-three-pie"},{default:ne(({data:l})=>[f("div",Zc,[f("strong",null,P(ie((l==null?void 0:l.count)||ht.value)),1),f("span",null,P((l==null?void 0:l.name)||"疫苗类型"),1)])]),_:1},8,["data"]))]),f("div",Xc,[(x(!0),_(Q,null,de(Va.value,(l,d)=>(x(),_("div",{key:l.key||l.name,class:"epidemic-three-pie-row"},[f("i",{style:Ft({borderColor:Ce[d%Ce.length]})},null,4),f("span",null,P(l.name),1),f("strong",null,P(ie(l.value)),1),f("em",null,P(l.unit),1)]))),128))])])):(x(),_("div",Jc,"暂无疫苗类型数据"))]),_:1},8,["width","height"])],64)):O.value==="trade"?(x(),_(Q,{key:3},[Y(le,{class:"yak-side-card left-card",title:"交易异常关注",width:W(r),height:u.value},{default:ne(()=>[f("div",Qc,[f("div",ed,[f("span",null,P(ve.value)+"年流通监管线索",1),f("strong",null,P(Os.value),1)]),f("div",td,[(x(!0),_(Q,null,de(Mi.value,l=>(x(),_("div",{key:l.key,class:De(["trade-risk-row",`is-${l.level}`]),style:Ft({"--risk-color":l.color})},[s[36]||(s[36]=f("i",null,null,-1)),f("span",null,[f("em",null,[f("b",null,P(l.badge),1),jt(P(l.name),1)]),f("small",null,P(l.value)+"|"+P(l.desc),1)])],6))),128))])])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"交易流通趋势",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:To.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"来源乡镇分布",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:So.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card left-card",title:"用途结构统计",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:Mo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"])],64)):Le("",!0)])]),f("div",ad,[f("div",nd,[O.value==="structure"?(x(),_(Q,{key:0},[Y(le,{class:"yak-side-card right-card",title:"乡镇存栏排行",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:so.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card right-card",title:"能繁母牛与犊牛分布",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:oo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card right-card",title:"出栏/交易影响",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:lo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card right-card",title:"性别与生产阶段汇总",width:W(r),height:u.value},{default:ne(()=>[f("div",id,[f("div",rd,[(x(!0),_(Q,null,de(di.value,l=>(x(),_("div",{key:l.key||l.name,class:"structure-summary-row",style:Ft({"--structure-color":l.color,"--structure-width":`${Tl(l)}%`})},[f("span",null,[s[37]||(s[37]=f("i",null,null,-1)),jt(P(l.name),1)]),s[39]||(s[39]=f("b",null,[f("em")],-1)),f("strong",null,[jt(P(ie(l.count)),1),s[38]||(s[38]=f("em",null,"头",-1))]),f("small",null,P(Ct(l.percent)),1)],4))),128))]),ot.value?(x(),_("div",sd,"结构数据加载中")):_e.value?(x(),_("div",od,P(_e.value),1)):Le("",!0)])]),_:1},8,["width","height"])],64)):O.value==="forecast"?(x(),_(Q,{key:1},[Y(le,{class:"yak-side-card right-card",title:"乡镇预测排行",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:po.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card right-card",title:"期末结构预测",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:fo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card right-card",title:"补充/流出对比",width:W(r),height:u.value},{default:ne(()=>[Y(W(Pe),{class:"yak-chart",option:mo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card right-card",title:"预测变化热力",width:W(r),height:u.value},{default:ne(()=>[f("div",ld,[(x(!0),_(Q,null,de(go.value,l=>(x(),_("div",{key:l.name,class:De(["heat-row",{"is-negative":l.change<0}]),style:Ft(yo(l)),title:bo(l)},[f("span",null,P(l.name),1),s[40]||(s[40]=f("b",null,[f("i")],-1)),f("strong",null,P(Za(l.change)),1)],14,ud))),128))])]),_:1},8,["width","height"])],64)):O.value==="epidemic"?(x(),Xa(le,{key:2,class:"yak-side-card right-card epidemic-ledger-card",title:"防疫记录台账",width:W(r),height:c.value},{default:ne(()=>[f("div",cd,[f("div",dd,[f("span",null,P(me.value)+"年 共 "+P(U(qe.value))+" 条",1),f("div",null,[Je(f("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>ut.value=l),type:"search",placeholder:"耳标/养殖户/疫苗",onKeyup:Ja(Xi,["enter"])},null,544),[[ta,ut.value]]),f("button",{type:"button",onClick:Xi},"搜索"),f("button",{type:"button",class:"is-more",onClick:s[1]||(s[1]=l=>Qi())},"查看更多")])]),s[41]||(s[41]=f("div",{class:"epidemic-record-header"},[f("span",null,"电子耳标"),f("span",null,"养殖户"),f("span",null,"镇/乡"),f("span",null,"疫苗"),f("span",null,"时间")],-1)),f("div",hd,[(x(!0),_(Q,null,de(Is.value,l=>(x(),_("button",{key:l.epidemicId||l.earTag,type:"button",onClick:d=>Qi(l)},[f("span",null,P(J(l.earTag)),1),f("span",null,P(J(l.owner)),1),f("span",null,P(J(l.town)),1),f("strong",null,P(J(l.medicine)),1),f("span",null,P(Et(l.operateTime)),1)],8,pd))),128)),ze.value.length?Le("",!0):(x(),_("div",fd,P(v.value?"防疫台账读取中":R.value||"暂无防疫记录"),1))]),f("div",md,[f("span",null,"第 "+P(be.value)+" / "+P(Fn.value)+" 页",1),f("button",{type:"button",disabled:be.value<=1,onClick:s[2]||(s[2]=l=>Ji(be.value-1))},"上一页",8,gd),f("button",{type:"button",disabled:be.value>=Fn.value,onClick:s[3]||(s[3]=l=>Ji(be.value+1))},"下一页",8,yd)])])]),_:1},8,["width","height"])):O.value==="trade"?(x(),_(Q,{key:3},[Y(le,{class:"yak-side-card right-card",title:"出证结构统计",width:W(r),height:u.value},{default:ne(()=>[f("div",bd,[f("div",vd,[f("span",null,[s[43]||(s[43]=f("em",null,"省外流通 A证",-1)),f("strong",null,[jt(P(U(ft("outProvinceHeads","aCertHeads"))),1),s[42]||(s[42]=f("b",null,"头",-1))]),f("small",null,P(U(ft("outProvinceCount","aCertCount")))+"条记录",1)]),f("span",null,[s[45]||(s[45]=f("em",null,"省内流通 B证",-1)),f("strong",null,[jt(P(U(ft("inProvinceHeads","bCertHeads"))),1),s[44]||(s[44]=f("b",null,"头",-1))]),f("small",null,P(U(ft("inProvinceCount","bCertCount")))+"条记录",1)])]),Y(W(Pe),{class:"trade-cert-chart",option:ko.value,autoresize:!0},null,8,["option"])])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card right-card trade-source-card",title:"出栏来源排行",width:W(r),height:p.value},{default:ne(()=>[f("div",wd,[(x(!0),_(Q,null,de(Nn.value,(l,d)=>(x(),_("div",{key:l.name,class:"trade-dest-row",style:Ft({"--trade-ratio":`${l.ratio}%`})},[f("span",null,P(d+1),1),f("strong",null,P(l.name),1),f("em",null,P(ie(l.headCount))+"头",1)],4))),128)),Nn.value.length?Le("",!0):(x(),_("div",Ld,P(Tt.value?"交易数据读取中":St.value||"暂无出栏来源数据"),1))])]),_:1},8,["width","height"]),Y(le,{class:"yak-side-card right-card trade-ledger-card",title:"交易出证台账",width:W(r),height:y.value},{default:ne(()=>[f("div",Td,[f("div",Sd,[f("span",null,"共 "+P(U(ct.value))+" 条",1),f("div",null,[Je(f("input",{"onUpdate:modelValue":s[4]||(s[4]=l=>Ca.value=l),type:"search",placeholder:"货主/车辆/检疫号/地区",onKeyup:Ja(Oi,["enter"])},null,544),[[ta,Ca.value]]),f("button",{type:"button",onClick:Oi},"搜索"),f("button",{type:"button",class:"is-more",onClick:s[5]||(s[5]=l=>Yi())},"查看更多")])]),s[46]||(s[46]=f("div",{class:"trade-ledger-header"},[f("span",null,"货主"),f("span",null,"车牌"),f("span",null,"数量"),f("span",null,"来源"),f("span",null,"用途"),f("span",null,"时间")],-1)),f("div",Md,[(x(!0),_(Q,null,de(Si.value,l=>(x(),_("button",{key:l.certId,type:"button",onClick:d=>Yi(l)},[f("span",null,P(J(l.ownerName)),1),f("span",null,P(J(l.transportNumber)),1),f("strong",null,P(U(l.amount))+"头",1),f("span",null,P(J(l.startTown)),1),f("span",null,P(J(l.usageTypeName)),1),f("span",null,P(Et(l.issueTime)),1)],8,kd))),128)),Si.value.length?Le("",!0):(x(),_("div",Pd,P(Tt.value?"交易台账读取中":St.value||"暂无交易记录"),1))]),f("div",Cd,[f("span",null,"第 "+P(Mt.value)+" / "+P(xn.value)+" 页",1),f("button",{type:"button",disabled:Mt.value<=1,onClick:s[6]||(s[6]=l=>Wi(Mt.value-1))},"上一页",8,Fd),f("button",{type:"button",disabled:Mt.value>=xn.value,onClick:s[7]||(s[7]=l=>Wi(Mt.value+1))},"下一页",8,Nd)])])]),_:1},8,["width","height"])],64)):Le("",!0)])]),f("div",xd,[Y(lu,{"model-value":O.value,topics:bt,"onUpdate:modelValue":s[8]||(s[8]=l=>O.value=l)},null,8,["model-value"])]),Ze.value?(x(),_("div",Rd,[Y(uu,{modelValue:We.value,"onUpdate:modelValue":s[9]||(s[9]=l=>We.value=l),"topic-key":"yak-management",layers:qs.value,legends:Ks.value,multiple:"",compact:"",width:248,height:Zs.value},null,8,["modelValue","layers","legends","height"])])):Le("",!0)]),D.value?(x(),_("div",{key:2,class:"epidemic-ledger-modal",onClick:Qa(er,["self"])},[f("div",Id,[f("div",_d,[f("div",null,[s[47]||(s[47]=f("span",null,"牦牛防疫台账",-1)),f("strong",null,P(me.value)+"年 "+P(U(ee.value))+" 条记录",1)]),f("button",{type:"button",onClick:er},"关闭")]),f("div",Gd,[Je(f("input",{"onUpdate:modelValue":s[10]||(s[10]=l=>he.value.keyword=l),type:"search",placeholder:"耳标 / 养殖户 / 药品","aria-label":"耳标 / 养殖户 / 药品",onKeyup:Ja(tr,["enter"])},null,544),[[ta,he.value.keyword]]),Je(f("select",{"onUpdate:modelValue":s[11]||(s[11]=l=>he.value.town=l)},[s[48]||(s[48]=f("option",{value:""},"全部镇/乡",-1)),(x(!0),_(Q,null,de(Gs.value,l=>(x(),_("option",{key:l,value:l},P(l),9,Ad))),128))],512),[[wa,he.value.town]]),Je(f("select",{"onUpdate:modelValue":s[12]||(s[12]=l=>he.value.medicine=l)},[s[49]||(s[49]=f("option",{value:""},"全部疫苗",-1)),(x(!0),_(Q,null,de(As.value,l=>(x(),_("option",{key:l,value:l},P(l),9,Bd))),128))],512),[[wa,he.value.medicine]]),Je(f("input",{"onUpdate:modelValue":s[13]||(s[13]=l=>he.value.startDate=l),type:"date"},null,512),[[ta,he.value.startDate]]),Je(f("input",{"onUpdate:modelValue":s[14]||(s[14]=l=>he.value.endDate=l),type:"date"},null,512),[[ta,he.value.endDate]]),f("button",{type:"button",onClick:tr},"检索"),f("button",{type:"button",class:"is-ghost",onClick:nl},"重置")]),f("div",Ed,[f("div",$d,[s[50]||(s[50]=f("div",{class:"epidemic-ledger-table-head"},[f("span",null,"电子耳标"),f("span",null,"养殖户"),f("span",null,"镇/乡"),f("span",null,"村"),f("span",null,"疫苗"),f("span",null,"免疫时间"),f("span",null,"图片")],-1)),(x(!0),_(Q,null,de(H.value,l=>{var d,m;return x(),_("button",{key:l.epidemicId||l.earTag,type:"button",class:De({active:(((d=Ae.value)==null?void 0:d.epidemicId)||((m=Ae.value)==null?void 0:m.earTag))===(l.epidemicId||l.earTag)}),onClick:b=>nr(l)},[f("span",null,P(J(l.earTag)),1),f("span",null,P(J(l.owner)),1),f("span",null,P(J(l.town)),1),f("span",null,P(J(l.village)),1),f("strong",null,P(J(l.medicine)),1),f("span",null,P(Et(l.operateTime)),1),f("span",null,P(zn(l).length?`${zn(l).length}张`:"无"),1)],10,Vd)}),128)),H.value.length?Le("",!0):(x(),_("div",Dd,P(Ge.value?"台账读取中":Oe.value||"暂无匹配记录"),1))]),f("div",zd,[f("div",Od,[f("div",null,[f("span",null,P(J(Ot.value.earTag)),1),f("em",null,P(J(Ot.value.medicine||Ot.value.preventionType)),1)]),f("strong",null,P(Ee.value?"加载中":Et(Ot.value.operateTime)),1)]),f("div",Wd,[(x(!0),_(Q,null,de(_s.value,l=>(x(),_("span",{key:l.label,class:De({"is-wide":l.wide})},[f("em",null,P(l.label),1),f("strong",null,P(l.value),1)],2))),128))]),vi.value.length?(x(),_("div",Yd,[s[51]||(s[51]=f("div",{class:"epidemic-detail-photo-title"},"现场照片",-1)),f("div",jd,[(x(!0),_(Q,null,de(vi.value.slice(0,6),l=>(x(),_("button",{key:l,type:"button",class:"epidemic-modal-photo-thumb",onClick:Qa(d=>qo(l),["stop"])},[f("img",{src:$i(l),alt:"防疫照片"},null,8,qd)],8,Hd))),128))])])):Le("",!0)])]),f("div",Ud,[f("span",null,"第 "+P(ce.value)+" / "+P(bi.value)+" 页",1),f("button",{type:"button",disabled:ce.value<=1,onClick:s[15]||(s[15]=l=>ar(ce.value-1))},"上一页",8,Kd),f("button",{type:"button",disabled:ce.value>=bi.value,onClick:s[16]||(s[16]=l=>ar(ce.value+1))},"下一页",8,Zd)])])])):Le("",!0),fn.value?(x(),_("div",{key:3,class:"epidemic-ledger-modal trade-ledger-modal",onClick:Qa(ji,["self"])},[f("div",Xd,[f("div",Jd,[f("div",null,[s[52]||(s[52]=f("span",null,"牦牛交易出证台账",-1)),f("strong",null,P(ve.value)+"年 "+P(U(Fa.value))+" 条记录",1)]),f("button",{type:"button",onClick:ji},"关闭")]),f("div",Qd,[Je(f("input",{"onUpdate:modelValue":s[17]||(s[17]=l=>dt.value.keyword=l),type:"search",placeholder:"货主 / 车辆 / 检疫号 / 地区",onKeyup:Ja(Hi,["enter"])},null,544),[[ta,dt.value.keyword]]),Je(f("select",{"onUpdate:modelValue":s[18]||(s[18]=l=>dt.value.startTown=l)},[s[53]||(s[53]=f("option",{value:""},"全部来源乡镇",-1)),(x(!0),_(Q,null,de($s.value,l=>(x(),_("option",{key:l,value:l},P(l),9,eh))),128))],512),[[wa,dt.value.startTown]]),Je(f("select",{"onUpdate:modelValue":s[19]||(s[19]=l=>dt.value.usageType=l)},[s[54]||(s[54]=f("option",{value:""},"全部用途",-1)),(x(!0),_(Q,null,de(Vs.value,l=>(x(),_("option",{key:l,value:l},P(l),9,th))),128))],512),[[wa,dt.value.usageType]]),Je(f("select",{"onUpdate:modelValue":s[20]||(s[20]=l=>dt.value.certType=l)},[s[55]||(s[55]=f("option",{value:""},"全部证书",-1)),(x(!0),_(Q,null,de(Ds.value,l=>(x(),_("option",{key:l.value,value:l.value},P(l.label),9,ah))),128))],512),[[wa,dt.value.certType]]),f("button",{type:"button",onClick:Hi},"检索"),f("button",{type:"button",class:"is-ghost",onClick:tl},"重置")]),f("div",nh,[f("div",ih,[s[56]||(s[56]=f("div",{class:"trade-ledger-modal-table-head"},[f("span",null,"货主"),f("span",null,"证书"),f("span",null,"车牌号"),f("span",null,"数量"),f("span",null,"来源"),f("span",null,"用途"),f("span",null,"出证时间"),f("span",null,"状态")],-1)),(x(!0),_(Q,null,de(Vt.value,l=>(x(),_("button",{key:l.certId||l.factoryCode,type:"button",class:De({active:Es.value===(l.certId||l.factoryCode)}),onClick:d=>Ui(l)},[f("span",null,P(J(l.ownerName)),1),f("span",null,P(J(l.certType||l.certScopeName)),1),f("span",null,P(J(l.transportNumber)),1),f("strong",null,P(U(l.amount))+"头",1),f("span",null,P(J(l.startTown)),1),f("span",null,P(J(l.usageTypeName)),1),f("span",null,P(Et(l.issueTime)),1),f("span",null,P(J(l.statusName)),1)],10,rh))),128)),Vt.value.length?Le("",!0):(x(),_("div",sh,P(mn.value?"交易台账读取中":gn.value||"暂无匹配记录"),1))]),f("div",oh,[f("div",lh,[f("div",null,[f("span",null,P(J(ge.value.factoryCode||ge.value.certId)),1),f("em",null,P(Di(ge.value)),1)]),f("strong",null,P(Et(ge.value.issueTime)),1)]),f("div",uh,[f("span",ch,[s[57]||(s[57]=f("em",null,"货主",-1)),f("strong",null,P(J(ge.value.ownerName)),1)]),f("span",null,[s[58]||(s[58]=f("em",null,"联系方式",-1)),f("strong",null,P(Vi(ge.value.ownerPhone)),1)]),f("span",null,[s[59]||(s[59]=f("em",null,"证书类型",-1)),f("strong",null,P(Di(ge.value)),1)]),f("span",null,[s[60]||(s[60]=f("em",null,"车牌号",-1)),f("strong",null,P(J(ge.value.transportNumber)),1)]),f("span",null,[s[61]||(s[61]=f("em",null,"牦牛数量",-1)),f("strong",null,P(U(ge.value.amount))+"头",1)]),f("span",null,[s[62]||(s[62]=f("em",null,"用途",-1)),f("strong",null,P(J(ge.value.usageTypeName)),1)]),f("span",null,[s[63]||(s[63]=f("em",null,"来源乡镇",-1)),f("strong",null,P(J(ge.value.startTown)),1)]),f("span",null,[s[64]||(s[64]=f("em",null,"目的省份",-1)),f("strong",null,P(J(ge.value.destProvince)),1)]),f("span",null,[s[65]||(s[65]=f("em",null,"检疫员",-1)),f("strong",null,P(J(ge.value.quarantineOfficerName)),1)]),f("span",dh,[s[66]||(s[66]=f("em",null,"状态",-1)),f("strong",null,P(J(ge.value.statusName)),1)]),f("span",hh,[s[67]||(s[67]=f("em",null,"来源地区",-1)),f("strong",null,P(J(ge.value.startRegionFullName)),1)]),f("span",ph,[s[68]||(s[68]=f("em",null,"目的地",-1)),f("strong",null,P(J(ge.value.destRegionFullName)),1)])]),f("button",{type:"button",class:"trade-detail-locate",disabled:!ge.value.startTown,onClick:s[21]||(s[21]=l=>al(ge.value))}," 查看乡镇位置 ",8,fh)])]),f("div",mh,[f("span",null,"第 "+P(Dt.value)+" / "+P(Rn.value)+" 页",1),f("button",{type:"button",disabled:Dt.value<=1,onClick:s[22]||(s[22]=l=>qi(Dt.value-1))},"上一页",8,gh),f("button",{type:"button",disabled:Dt.value>=Rn.value,onClick:s[23]||(s[23]=l=>qi(Dt.value+1))},"下一页",8,yh)])])])):Le("",!0),Ue.value?(x(),_("div",{key:4,class:"epidemic-image-preview-modal",onClick:Qa(On,["self"])},[f("div",bh,[f("div",vh,[f("div",null,[s[69]||(s[69]=f("span",null,"防疫照片",-1)),f("strong",null,P(J(Ot.value.earTag)),1)]),f("button",{type:"button",onClick:On},"关闭")]),f("div",wh,[f("div",Lh,[f("img",{src:et.value,alt:"防疫照片预览"},null,8,Th)])])])])):Le("",!0)]))}};export{Dh as default};