var fl=Object.defineProperty,ml=Object.defineProperties;var gl=Object.getOwnPropertyDescriptors;var qa=Object.getOwnPropertySymbols;var ir=Object.prototype.hasOwnProperty,nr=Object.prototype.propertyIsEnumerable;var ma=Math.pow,ar=(b,e,t)=>e in b?fl(b,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):b[e]=t,R=(b,e)=>{for(var t in e||(e={}))ir.call(e,t)&&ar(b,t,e[t]);if(qa)for(var t of qa(e))nr.call(e,t)&&ar(b,t,e[t]);return b},$=(b,e)=>ml(b,gl(e));var rr=(b,e)=>{var t={};for(var a in b)ir.call(b,a)&&e.indexOf(a)<0&&(t[a]=b[a]);if(b!=null&&qa)for(var a of qa(b))e.indexOf(a)<0&&nr.call(b,a)&&(t[a]=b[a]);return t};var he=(b,e,t)=>new Promise((a,n)=>{var s=d=>{try{u(t.next(d))}catch(h){n(h)}},o=d=>{try{u(t.throw(d))}catch(h){n(h)}},u=d=>d.done?a(d.value):Promise.resolve(d.value).then(s,o);u((t=t.apply(b,e)).next())});import{q as Yr,h as jr,w as qt,o as I,c as _,a as f,d as V,K as yl,A as jt,g as k,L as Ee,s as Qe,v as bl,C as Ua,j as Le,n as Ye,t as P,F as ie,y as pe,u as j,b as H,x as oe,J as Ct,B as Wt,e as Ka,H as Xt,f as Za,N as ga}from"./index-1784128751722.js";import{H as Pe}from"./index.esm.min-0f127c34-1784128751722.js";import{_ as le}from"./index-714f134b-1784128751722.js";import{t as Zi,S as na,u as ni,v as Sa,w as vl,V as re,F as wl,C as bt,G as Te,c as Ll,d as Tl,f as Sl,g as Wi,L as Jt,D as Re,a as be,h as Xa,R as st,A as Ie,N as sr,b as qe,P as _t,o as Qt,n as ea,x as Ml,T as kl,B as Pl,i as Cl,j as Fl,k as xl,l as Nl,m as Rl,y as Il,z as ya,E as or,H as lr,I as Gl,J as ur,q as cr,r as _l,s as dr,K as ba,U as Yi,W as hr,M as Bl}from"./screen2Standard-f53151f5-1784128751722.js";import{g as Ht,M as Al,h as El,L as $l,B as va,a as ta,E as pr,G as Ja,D as Vl,b as zl,l as Ol,P as fr,c as mr,d as Dl,m as Wl,t as Yl,k as ot,n as jl,o as gr,p as Hl,q as ql,r as ji,s as wa,u as yr,v as br,f as Bt,w as vr,x as Ul,y as Kl,e as Zl,i as Xl,j as Jl}from"./data-c5b8cbc7-1784128751722.js";import{g as aa}from"./index-e9f36657-1784128751722.js";import{h as Ql,a as Hr,S as eu,W as At,H as U,j as Hi,k as tu}from"./townshipBoundaries-822b7d9e-1784128751722.js";import{b as au,g as wr,a as Lr,c as iu}from"./geoserver-4a830e65-1784128751722.js";import{_ as nu}from"./TopicSwitcher-fc56decc-1784128751722.js";import{_ as ru}from"./LayerPanel-a02dc038-1784128751722.js";import{A as su}from"./assets-906723ee-1784128751722.js";import{M as ou}from"./index-b9fefda3-1784128751722.js";import{a as lu,b as uu,c as cu,d as du,g as Tr,e as Sr,f as hu,h as qi,i as pu,j as fu,k as mu}from"./yakApi-af76f1a1-1784128751722.js";import{y as gu}from"./livestockData-36ec0ae2-1784128751722.js";import"./index-aff3f8e5-1784128751722.js";const yu=Ql.map(b=>R({},b)),Mr=Hr.map(b=>R({},b)),bu=Hr.map(b=>{var e,t;return{name:b.name,value:b.value,lng:(e=b.center)==null?void 0:e[0],lat:(t=b.center)==null?void 0:t[1]}}),vu=[{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}],ra=256,Xi="https://qkl-map.oss-cn-chengdu.aliyuncs.com/hy-result/{z}/{x}/{y}.png",wu=900,Lu=10,Ut=new Map,sa={west:101.852492,south:31.851389,east:103.347518,north:33.319796};function Ui(b,e,t){const a=ma(2,t),n=Math.sin(e*Math.PI/180);return{x:(b+180)/360*a,y:(.5-Math.log((1+n)/(1-n))/(4*Math.PI))*a}}function kr(b,e,t){const a=ma(2,t),n=b/a*360-180,s=Math.PI-2*Math.PI*e/a,o=180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)));return[n,o]}function Qa(b,e,t){return Math.max(e,Math.min(t,b))}function qr(b,e,{centerLngLat:t,maxCols:a,maxRows:n}={}){const s=Ui(b.west,b.north,e),o=Ui(b.east,b.south,e),u=Math.floor(s.x),d=Math.floor(o.x),h=Math.floor(s.y),g=Math.floor(o.y);let m=u,L=d,S=h,C=g,x=Math.floor((u+d)/2),E=Math.floor((h+g)/2);if(t&&Number.isFinite(a)&&Number.isFinite(n)){const D=Qa(Number(t[0]),b.west,b.east),Q=Qa(Number(t[1]),b.south,b.north),se=Ui(D,Q,e);x=Math.floor(se.x),E=Math.floor(se.y);const Z=Math.max(1,Math.min(Math.floor(a),d-u+1)),G=Math.max(1,Math.min(Math.floor(n),g-h+1));m=Qa(x-Math.floor(Z/2),u,d-Z+1),S=Qa(E-Math.floor(G/2),h,g-G+1),L=m+Z-1,C=S+G-1}return{zoom:e,minX:m,maxX:L,minY:S,maxY:C,centerX:x,centerY:E,cols:L-m+1,rows:C-S+1}}function Tu({zoom:b=11,centerLngLat:e,maxCols:t,maxRows:a,bounds:n=sa}={}){return qr(n,b,{centerLngLat:e,maxCols:t,maxRows:a})}function Su(b,e){const[t,a]=kr(b.minX,b.minY,b.zoom),[n,s]=kr(b.maxX+1,b.maxY+1,b.zoom),[o]=e([t,sa.south]),[u]=e([n,sa.south]),[,d]=e([sa.west,a]),[,h]=e([sa.west,s]);return{left:o,right:u,bottom:-h,top:-d}}function Mu(b,e){const{width:t,height:a}=e;b.save(),b.globalCompositeOperation="multiply",b.fillStyle="rgba(5, 24, 34, 0.22)",b.fillRect(0,0,t,a),b.globalCompositeOperation="screen";const n=b.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)"),b.fillStyle=n,b.fillRect(0,0,t,a),b.restore()}function ku(b,e){const t=b.createLinearGradient(0,0,e.width,e.height);t.addColorStop(0,"#061927"),t.addColorStop(.5,"#0b2c3c"),t.addColorStop(1,"#07131f"),b.fillStyle=t,b.fillRect(0,0,e.width,e.height)}function Pu(b){const e=Ut.get(b);return e||new Promise(t=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>t(a),a.onerror=()=>{Ut.delete(b),t(null)},a.src=b})}function Cu(b){const e=Ut.get(b);if(e)return e;const t=Pu(b);for(Ut.set(b,t);Ut.size>wu;){const a=Ut.keys().next().value;if(!a)break;Ut.delete(a)}return t}function Fu(b,e,t,a=Xi){return String(a||Xi).replace(/\{x\}/g,b).replace(/\{y\}/g,e).replace(/\{z\}/g,t)}function xu(u,d,h,g){return he(this,arguments,function*(b,e,t,a,{tileUrlTemplate:n,onTileStatus:s,applyTone:o=!0}={}){const m=[],L=a.cols*a.rows;let S=0,C=0;s==null||s({type:"loading",text:`正在加载${a.zoom}级影像底图`,loaded:S,failed:C,total:L,zoom:a.zoom,tileRange:a,tileUrlTemplate:n}),b.save(),b.filter="brightness(0.92) contrast(1.22) saturate(1.06)";for(let Z=a.minX;Z<=a.maxX;Z+=1)for(let G=a.minY;G<=a.maxY;G+=1)m.push({x:Z,y:G});m.sort((Z,G)=>Math.abs(Z.x-a.centerX)+Math.abs(Z.y-a.centerY)-(Math.abs(G.x-a.centerX)+Math.abs(G.y-a.centerY)));let x=0;function E(){return he(this,null,function*(){for(;x0?S/L:0,Q=S===0?"error":D>=.75?"success":"warning",se=S===L?`${a.zoom}级影像底图已加载`:S>0?`${a.zoom}级影像底图已加载(${S}/${L}张有效瓦片)`:`${a.zoom}级影像底图加载失败`;s==null||s({type:Q,text:se,loaded:S,failed:C,total:L,zoom:a.zoom,tileRange:a,tileUrlTemplate:n})})}function Pr({geoProjectionCenter:b,geoProjectionScale:e,zoom:t=11,tileUrlTemplate:a=Xi,onTileStatus:n,centerLngLat:s,maxCols:o,maxRows:u,transparentBackground:d=!1,applyTone:h=!0}={}){const g=qr(sa,t,{centerLngLat:s,maxCols:o,maxRows:u}),m=document.createElement("canvas");m.width=g.cols*ra,m.height=g.rows*ra;const L=m.getContext("2d");d?L.clearRect(0,0,m.width,m.height):ku(L,m);const S=new Zi(m);S.colorSpace=na,S.wrapS=ni,S.wrapT=ni,S.minFilter=Sa,S.magFilter=Sa,S.needsUpdate=!0;const C=Ht().center(b).scale(e).translate([0,0]),x=Su(g,C);return xu(L,m,S,g,{tileUrlTemplate:a,onTileStatus:n,applyTone:h}).catch(E=>{console.warn("load satellite tiles failed:",E),n==null||n({type:"error",text:`${g.zoom}级影像底图加载失败`,loaded:0,failed:g.cols*g.rows,total:g.cols*g.rows,zoom:g.zoom,tileRange:g,tileUrlTemplate:a})}),{texture:S,uvBounds:x,tileRange:g}}function Cr(b,e){const t=e.right-e.left,a=e.top-e.bottom;b.mapGroup.traverse(n=>{var u,d;const s=(d=(u=n.geometry)==null?void 0:u.attributes)==null?void 0:d.position;if(!n.isMesh||!s)return;const o=new Float32Array(s.count*2);for(let h=0;ht.value-e.value),b}function lt(b){return String(b||"").replace(/\s+/g,"").trim()}function ue(b,e=0){const t=Number(b);return Number.isFinite(t)?t:e}function Yt(b,e,t){const a=Number(b);return Number.isFinite(a)?Math.max(e,Math.min(t,a)):e}function Se(b){return String(b!=null?b:"").replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function Gr(b){return(b==null?void 0:b.scope)==="village"||(b==null?void 0:b.labelMode)==="village"}function _r(b){return(b==null?void 0:b.scope)==="trade-flow"||(b==null?void 0:b.labelMode)==="trade-flow"}function zu(b){return(b==null?void 0:b.showFlowLines)!==!1}function Br(b){return!!(b!=null&&b.hideTownNames||(b==null?void 0:b.showTownNames)===!1)}function La(b){return!!(b!=null&&b.hideMapLabels||(b==null?void 0:b.showMapLabels)===!1)}function Ou(b){return(b==null?void 0:b.displayMode)==="callout"||(b==null?void 0:b.labelMode)==="callout"}function ti(b){return["wkt-api","geojson","wfs"].includes(String((b==null?void 0:b.sourceType)||"").toLowerCase())}function Du(b){return(b==null?void 0:b.interactive)===!1||(b==null?void 0:b.key)==="yak-recognition-layer"}function Ar(b){return String((b==null?void 0:b.sourceType)||"").toLowerCase()==="wmts"}function Er(b,e,t){const a=ma(2,t),n=Math.sin(e*Math.PI/180);return{x:(b+180)/360*a,y:(.5-Math.log((1+n)/(1-n))/(4*Math.PI))*a}}function $r(b,e,t){const a=ma(2,t),n=b/a*360-180,s=Math.PI-2*Math.PI*e/a,o=180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)));return[n,o]}function Wu(b,e){const t=Er(b.west,b.north,e),a=Er(b.east,b.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(b,e,t,a){const[n,s]=$r(b,e,t),[o,u]=$r(b+1,e+1,t),d=U.east-U.west,h=U.north-U.south;return{x:(n-U.west)/d*a.width,y:(U.north-s)/h*a.height,width:(o-n)/d*a.width,height:(s-u)/h*a.height}}function ju(b){const e=ia.get(b);if(e)return e;const t=new Promise(a=>{const n=new Image;n.crossOrigin="anonymous",n.onload=()=>a(n),n.onerror=()=>{ia.delete(b),a(null)},n.src=b});for(ia.set(b,t);ia.size>Au;){const a=ia.keys().next().value;if(!a)break;ia.delete(a)}return t}function Vr(b){return b?/^https?:\/\//.test(b)||b.startsWith("/")?b:`./${b}`:""}function Hu(b){if(!b)return null;if(typeof b=="string")try{return JSON.parse(b)}catch(e){return console.warn("地图 GeoJSON 解析失败",e),null}return b}function Ta(b){const e=Hu(b);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 zr(b){var e,t,a;return b!=null&&b.coordinates?b.type==="Polygon"?Array.isArray((a=(t=(e=b.coordinates)==null?void 0:e[0])==null?void 0:t[0])==null?void 0:a[0])?b.coordinates:[b.coordinates]:b.type==="MultiPolygon"?b.coordinates:[]:[]}class qu extends Al{constructor(e,t,a={}){var u,d,h,g;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 wl(466735,1,50),this.scene.background=new bt(466735),this.camera.instance.position.copy(Iu),this.camera.instance.near=1,this.camera.instance.far=1e4,this.camera.instance.updateProjectionMatrix(),this.defaultMapCameraPosition=Nu.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 El(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(ei,n):eu;const s=Math.round(Number(a.satelliteMaxZoom)),o=Number.isFinite(s)&&s>0?Math.min(ei,Math.max(this.satelliteTextureZoom,s)):ei;this.adminBoundaryLineScale=this.normalizeAdminBoundaryLineScale(a.adminBoundaryLineScale),this.mapBoundaryEmphasisMaterial=null,this.dynamicSatelliteMaxZoom=o,this.dynamicSatelliteTileWindow=Gu,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(Mr.map(m=>[lt(m.name),m])),this.staticMapData={china:Ta(this.assets.instance.getResource("china")),mapJson:Ta(this.assets.instance.getResource("mapJson")),mapStroke:Ta(this.assets.instance.getResource("mapStroke"))},this.handleCanvasBoundaryPointerDown=this.handleCanvasBoundaryPointerDown.bind(this),this.handleCanvasBoundaryDoubleClick=this.handleCanvasBoundaryDoubleClick.bind(this),(d=(u=this.canvas)==null?void 0:u.addEventListener)==null||d.call(u,"pointerdown",this.handleCanvasBoundaryPointerDown,!0),(g=(h=this.canvas)==null?void 0:h.addEventListener)==null||g.call(h,"dblclick",this.handleCanvasBoundaryDoubleClick,!0),this.initEnvironment(),this.init()}init(){this.labelGroup=new Te,this.label3d=new $l(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=aa.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),La(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=!La(this.currentTownRanking)&&this.showTownRankingPointMarkers&&this.hasTownRankingRows(),this.setTradeNationalMapVisible(!1),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),La(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 s=a.element.querySelector(".other-label");e.to(s,{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 s=a.element.querySelector(".provinces-label-wrap"),o=a.element.querySelector(".number .value"),u={progress:0};e.to(s,{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:d},"bar");function d(){var g,m;const h=ue((m=(g=a.userData)==null?void 0:g.targetValue)!=null?m:o.dataset.targetValue);o.innerText=t.formatMapRankingValue(h*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 Ll(13171711,4.2);this.scene.add(e);let t=new Tl(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 Sl(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:s,mapTop:o,mapLine:u,mapBoundaryEmphasis:d}=this.createProvince();this.createNationalBackdrop(),a.setParent(e),n.setParent(e),this.createDiffuse(),s.setParent(t),o.setParent(t),u.setParent(t),d==null||d.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 Wi({color:new bt(e.chinaBgMaterialColor),transparent:!0,opacity:.72}),n=new va(this,{data:t,geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,merge:!0,material:a,renderOrder:2}),s=new Jt({color:e.lineColor,transparent:!0,opacity:.58}),o=new ta(this,{data:t,geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,material:s,renderOrder:3});return o.lineGroup.position.z+=.01,{china:n,chinaTopLine:o}}createNationalBackdrop(){var h;if(!this.showNationalBackdrop||this.nationalBackdropGroup)return!1;let e=null;try{e=Ta(this.assets.instance.getResource("chinaMap"))}catch(g){return console.warn("首页全国底图资源未加载",g),!1}if(!((h=e==null?void 0:e.features)!=null&&h.length))return!1;const t=this.geoProjectionCenter,a=120,n=new re(0,0,-.08),s=new Wi({color:new bt("#152c47"),transparent:!0,opacity:.72,depthWrite:!1,fog:!1,side:Re}),o=new va(this,{data:e,geoProjectionCenter:t,geoProjectionScale:a,merge:!0,position:n,material:s,renderOrder:0});o.mapGroup.name="home-national-backdrop-fill",o.setParent(this.mapGroup);const u=new Jt({color:new bt("#3f82cd"),transparent:!0,opacity:.46,depthWrite:!1,fog:!1}),d=new ta(this,{data:e,geoProjectionCenter:t,geoProjectionScale:a,position:new re(n.x,n.y,n.z+.01),material:u,renderOrder:1});return d.lineGroup.name="home-national-backdrop-line",d.setParent(this.mapGroup),this.nationalBackdropGroup=o.mapGroup,this.nationalBackdropLineGroup=d.lineGroup,!0}createTradeNationalMap(){var m;if(this.tradeNationalMapGroup)return!0;let e=null;try{e=Ta(this.assets.instance.getResource("chinaMap"))}catch(L){return console.warn("牦牛交易全国地图资源未加载",L),!1}const t=e;if(!e||!((m=t==null?void 0:t.features)!=null&&m.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 be({color:403001,transparent:!0,opacity:.14,side:Re,depthWrite:!1,fog:!1});new va(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,position:new re(.05,-.05,-.03),material:n,renderOrder:17}).setParent(a);const{topMaterial:o,sideMaterial:u}=this.createTradeNationalMaterials(),d=new pr(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,position:new re(0,0,0),depth:this.tradeNationalDepth,topFaceMaterial:o,sideMaterial:u,renderOrder:20,bevelThickness:.024,bevelSegments:1});d.mapGroup.traverse(L=>{L.isMesh&&(L.renderOrder=20)}),d.setParent(a);const h=new Jt({color:4777983,transparent:!0,opacity:.52,fog:!1,depthTest:!1}),g=new ta(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,material:h,renderOrder:21});return g.lineGroup.position.z+=this.tradeNationalDepth+.055,g.setParent(a),this.scene.add(a),this.tradeNationalMapGroup=a,this.createTradeNationalLabels(t),!0}createTradeNationalMaterials(){const e=new Xa({color:16777215,transparent:!0,opacity:.54,roughness:.84,metalness:.08,side:Re,fog:!1});new Ja(e,{uColor1:827317,uColor2:403515,size:6.8,dir:"x"});const t=this.assets.instance.getResource("side").clone();t.wrapS=st,t.wrapT=st,t.repeat.set(1,1.2),t.needsUpdate=!0;const a=new Xa({color:1485501,map:t,transparent:!0,opacity:.58,roughness:.78,metalness:.04,side:Re,fog:!1});return new Ja(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 d;const n=((d=a.properties)==null?void 0:d.name)||"",s=this.normalizeTradeProvinceName(n);if(!t.has(s))return;const o=this.getFeatureCenterLngLat(a);if(!o)return;const u=this.label3d.create("","trade-national-label",!0);u.init(`
${Se(s)}
`,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 s,o,u;const t=((s=e==null?void 0:e.properties)==null?void 0:s.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((d,h)=>({minLng:Math.min(d.minLng,Number(h[0])),maxLng:Math.max(d.maxLng,Number(h[0])),minLat:Math.min(d.minLat,Number(h[1])),maxLat:Math.max(d.maxLat,Number(h[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?Pr({geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,zoom:this.satelliteTextureZoom,tileUrlTemplate:this.tileUrlTemplate,onTileStatus:m=>{var L,S;return(S=(L=this.callbacks).onTileStatus)==null?void 0:S.call(L,m)}}):null;t!=null&&t.texture&&this.enhanceTexture(t.texture);let[a,n]=this.createProvinceMaterial();this.focusMapTopMaterial=a,this.focusMapSideMaterial=n;let s=new pr(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new re(0,0,.11),data:e,depth:this.depth,topFaceMaterial:a,sideMaterial:n,renderOrder:9}),o=new Xa({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 Ja(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 bt("rgba(128,244,255,1)"),this.defaultLightMaterial.opacity=.9;let u=new va(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new re(0,0,this.depth+.22),data:e,material:o,renderOrder:this.usesCustomSatelliteTiles?14:8});this.satelliteMapTop=u,this.satelliteMaterial=o,t!=null&&t.uvBounds&&Cr(u,t.uvBounds),u.mapGroup.children.map(m=>{m.children.map(L=>{L.type==="Mesh"&&this.eventElement.push(L)})}),this.mapLineMaterial=new Jt({color:12254463,opacity:0,transparent:!0,linewidth:this.adminBoundaryLineScale,fog:!1});let d=new ta(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,data:e,material:this.mapLineMaterial,renderOrder:this.isHomeTopicPresentation()?34:26});d.lineGroup.position.z+=this.depth+(this.isHomeTopicPresentation()?.315:.285);let h=null;const g=this.getAdminBoundaryEmphasisRadius();return g>0&&(this.mapBoundaryEmphasisMaterial=new be({color:9632767,transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1,blending:Ie}),h=new ta(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,data:e,material:this.mapBoundaryEmphasisMaterial,renderOrder:this.usesCustomSatelliteTiles?24:18,type:"Line3",tubeRadius:g}),h.lineGroup.position.z+=this.depth+.255),{map:s,mapTop:u,mapLine:d,mapBoundaryEmphasis:h}}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=At.width,e.height=At.height;const t=e.getContext("2d");t.clearRect(0,0,e.width,e.height);const a=new Zi(e);a.colorSpace=na,a.wrapS=ni,a.wrapT=ni,a.minFilter=Sa,a.magFilter=Sa,this.enhanceTexture(a),a.needsUpdate=!0;const n=new be({map:a,transparent:!0,opacity:0,depthWrite:!1,depthTest:!this.isHomeTopicPresentation(),side:Re,fog:!1}),s=this.createLayerUvBounds(),o=new va(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new re(0,0,this.depth+(this.isHomeTopicPresentation()?.272:.255)),data:this.mapJsonData,material:n,renderOrder:this.isHomeTopicPresentation()?24:18});Cr(o,s),o.setParent(this.focusMapGroup),this.topicLayerUvBounds=s,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=zr((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=Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]),[t]=e([U.west,U.south]),[a]=e([U.east,U.south]),[,n]=e([U.west,U.north]),[,s]=e([U.west,U.south]);return{left:t,right:a,bottom:-s,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}`}),ti(e)){this.loadVectorTopicLayer(e,t);return}this.loadTopicLayerImage(e).then(s=>{var o,u,d,h;if(t===this.topicLayerLoadId){if(!(s!=null&&s.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(s.image,s.layer||e),this.topicLayerTexture.needsUpdate=!0,this.updateTopicLayerTextureSampling(e),this.topicLayerMaterial.opacity=this.getTopicLayerMaterialOpacity(e,.84),(h=(d=this.callbacks).onLayerStatus)==null||h.call(d,{type:"success",text:"GeoServer 图层已加载"})}}).catch(()=>{var s,o;t===this.topicLayerLoadId&&(this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(o=(s=this.callbacks).onLayerStatus)==null||o.call(s,{type:"error",text:"GeoServer 图层加载失败"}))})}setTopicLayers(e=[],t=e[0]){var s,o,u,d;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=(s=this.callbacks).onLayerStatus)==null||o.call(s,{type:"success",text:"图层已关闭"});return}if(a.length===1){this.setTopicLayer(R(R({},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,(d=(u=this.callbacks).onLayerStatus)==null||d.call(u,{type:"loading",text:`正在加载 ${a.length} 个地图图层`}),Promise.all(a.map(h=>this.loadCompositeTopicLayerItem(h))).then(h=>{var L,S,C;if(n!==this.topicLayerLoadId)return;const g=h.filter(Boolean),m=g.find(x=>{var E,D;return x.type==="vector"&&((E=x.layer)==null?void 0:E.key)===((D=this.currentTopicLayer)==null?void 0:D.key)});this.currentVectorFeatures=((L=m==null?void 0:m.geojson)==null?void 0:L.features)||[],this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),g.forEach((x,E)=>{var D,Q;if(x.type==="image"){this.topicLayerContext.save();const se=E===g.length-1?Math.max(.78,(D=x.layer.opacity)!=null?D:.9):Math.min(.52,(Q=x.layer.opacity)!=null?Q:.52);this.topicLayerContext.globalAlpha=Math.min(1,Math.max(.28,se)),this.drawTopicRasterImage(x.image,x.layer),this.topicLayerContext.restore();return}this.drawVectorTopicLayer(x.layer,x.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=g.length?this.getTopicLayerMaterialOpacity(this.currentTopicLayer,1):0,(C=(S=this.callbacks).onLayerStatus)==null||C.call(S,{type:g.length?"success":"error",text:g.length?`已加载 ${g.length} 个地图图层`:"地图图层加载失败"})})}loadCompositeTopicLayerItem(e){return he(this,null,function*(){if(ti(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?R({type:"image"},t):null)})}loadTopicLayerImage(e){return Ar(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=au(e)})}loadWmtsTopicLayerImage(e){return he(this,null,function*(){const t=document.createElement("canvas");t.width=At.width,t.height=At.height;const a=t.getContext("2d");if(!a)return null;a.clearRect(0,0,t.width,t.height);const n=this.getWmtsTopicZoom(e),s=Wu(U,n),o=[];for(let g=s.minX;g<=s.maxX;g+=1)for(let m=s.minY;m<=s.maxY;m+=1)o.push({x:g,y:m});let u=0,d=0;const h=()=>he(this,null,function*(){for(;d0&&(a.save(),a.globalAlpha=.58,a.filter=`blur(${u}px)`,a.drawImage(n,0,0),a.restore()),o>0){const g=[[-o,0],[o,0],[0,-o],[0,o],[-o,-o],[o,-o],[-o,o],[o,o]];a.save(),a.globalAlpha=.72,g.forEach(([m,L])=>a.drawImage(n,m,L)),a.restore()}a.drawImage(n,0,0)}getWmtsTopicZoom(e={}){var o,u,d;const t=Math.round(Number(e.maximumLevel)),a=Number.isFinite(t)&&t>0?t:21,n=Number((d=(u=(o=e.homeWmtsZoom)!=null?o:e.wmtsZoom)!=null?u:e.tileZoom)!=null?d:this.satelliteTextureZoom),s=Number.isFinite(n)&&n>0?Math.round(n):11;return Yt(s,3,Math.min(a,ei))}updateTopicLayerTextureSampling(e={}){if(!this.topicLayerTexture)return;const t=Ar(e)?sr:Sa;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 s=Math.min(1,Math.max(.08,Number(t.softMaskScale)||.18)),o=document.createElement("canvas");o.width=Math.max(96,Math.round(a.width*s)),o.height=Math.max(96,Math.round(a.height*s));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 d,h;if(!this.isHomeTopicPresentation())return;const a=this.topicLayerCanvas,n=this.topicLayerContext;if(!a||!n)return;const s=Yt((d=t.homeGlowOpacity)!=null?d:0,0,.8),o=Yt((h=t.homeGlowBlur)!=null?h:0,0,32);if(!s||!o)return;const u=t.homeGlowColor||"#E5FCFF";n.save(),n.globalAlpha=s,n.filter=`drop-shadow(0 0 ${o}px ${u})`,n.drawImage(e,0,0,a.width,a.height),n.restore()}applyLayerMapView(e,t={}){var d,h;if(!((d=this.camera)!=null&&d.instance)||!((h=this.camera)!=null&&h.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),s=n?this.getLayerMapViewTarget(n):this.defaultMapTarget.clone(),o=n?this.getLayerMapViewCameraPosition(n,s):this.defaultMapCameraPosition.clone(),u=n&&Number.isFinite(n.duration)?n.duration:.75;this.animateMapCamera(o,s,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 s=Number(e==null?void 0:e.homePresentationMaxOpacity),o=Number.isFinite(s)?s:.56;return Yt(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 s,o,u,d,h,g,m;const e=(d=(u=(o=(s=this.camera)==null?void 0:s.controls)==null?void 0:o.target)==null?void 0:u.clone)==null?void 0:d.call(u);if(!e)return[102.58,32.72];(g=(h=this.focusMapGroup)==null?void 0:h.updateWorldMatrix)==null||g.call(h,!0,!1);const t=this.focusMapGroup?this.focusMapGroup.worldToLocal(e):e,a=Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]),n=((m=a.invert)==null?void 0:m.call(a,[t.x,-t.y]))||[102.58,32.72];return[Math.max(U.west,Math.min(U.east,Number(n[0])||102.58)),Math.max(U.south,Math.min(U.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<_u)return;this.dynamicSatelliteLastCheck=t;const a=this.camera.instance.position.distanceTo(this.camera.controls.target),n=this.getDynamicSatelliteZoom(a);if(n<=this.satelliteTextureZoom){this.hideDynamicSatelliteOverlay();return}const s=this.getCameraTargetLngLat(),o=this.getDynamicSatelliteTileWindow(n),u=Tu({zoom:n,centerLngLat:s,maxCols:o,maxRows:o}),d=this.getDynamicSatelliteKey(n,u);!d||d===this.dynamicSatelliteCurrentKey||d===this.dynamicSatelliteLoadingKey||this.loadDynamicSatelliteOverlay({zoom:n,centerLngLat:s,maxTiles:o,key:d})}loadDynamicSatelliteOverlay({zoom:e,centerLngLat:t,maxTiles:a,key:n}){const s=++this.dynamicSatelliteRequestId;this.dynamicSatelliteLoadingKey=n;let o;o=Pr({geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,zoom:e,centerLngLat:t,maxCols:a,maxRows:a,tileUrlTemplate:this.tileUrlTemplate,transparentBackground:!0,applyTone:!1,onTileStatus:u=>{var d,h,g,m,L;if((g=(h=this.callbacks).onTileStatus)==null||g.call(h,$(R({},u),{text:((d=u.text)==null?void 0:d.replace("影像底图","高清影像底图"))||u.text})),u.type!=="loading"){if(s!==this.dynamicSatelliteRequestId){(L=(m=o==null?void 0:o.texture)==null?void 0:m.dispose)==null||L.call(m);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 be({transparent:!0,opacity:0,depthWrite:!1,depthTest:!0,side:Re,fog:!1}),t=new qe(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),s=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,s,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),La(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),s=t.clone().add(n);return e!=null&&e.cameraOffset&&s.add(this.toVector3(e.cameraOffset,new re(0,0,0))),s}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]),s=Number(a==null?void 0:a[1]);if(!Number.isFinite(n)||!Number.isFinite(s))return this.defaultMapTarget.clone();const[o,u]=this.geoProjection([n,s]),d=new re(o,-u,Number(t)||0);return this.focusMapGroup?this.focusMapGroup.localToWorld(d):d}toVector3(e,t){if(Array.isArray(e)){const[o,u,d]=e.map(Number);return[o,u,d].every(Number.isFinite)?new re(o,u,d):t.clone()}const a=Number(e==null?void 0:e.x),n=Number(e==null?void 0:e.y),s=Number(e==null?void 0:e.z);return[a,n,s].every(Number.isFinite)?new re(a,n,s):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,s=()=>n.update();this.activeMapViewTweens.push(aa.to(this.camera.instance.position,{duration:a,x:e.x,y:e.y,z:e.z,ease:"power2.out",onUpdate:s}),aa.to(n.target,{duration:a,x:t.x,y:t.y,z:t.z,ease:"power2.out",onUpdate:s}))}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,d,h;const a=this.townMetaByName.get(lt(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 s=this.lngLatToWorldPoint(a.center,(u=t.targetLocalZ)!=null?u:.82),o=this.getLayerMapViewCameraPosition({distanceScale:(d=t.distanceScale)!=null?d:.82,cameraOffset:t.cameraOffset||{x:0,y:1.2,z:0}},s);return this.animateMapCamera(o,s,(h=t.duration)!=null?h:.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,s,o,u,d,h,g,m,L;return[(s=(n=(a=e==null?void 0:e.target)==null?void 0:a.parent)==null?void 0:n.userData)==null?void 0:s.name,(u=(o=e==null?void 0:e.target)==null?void 0:o.userData)==null?void 0:u.name,(g=(h=(d=e==null?void 0:e.target)==null?void 0:d.parent)==null?void 0:h.userData)==null?void 0:g.townName,(L=(m=e==null?void 0:e.target)==null?void 0:m.userData)==null?void 0:L.townName].find(S=>String(S||"").trim())||""}findTownFeatureByName(e){var n,s,o,u;const t=lt(e);if(!t)return null;const a=(((n=this.mapJsonData)==null?void 0:n.features)||((o=(s=this.staticMapData)==null?void 0:s.mapJson)==null?void 0:o.features)||[]).find(d=>{const h=(d==null?void 0:d.properties)||{};return[h.name,h.fullName,h.full_name,h.townName].some(m=>lt(m)===t)});return a!=null&&a.geometry?{type:"Feature",properties:$(R({},a.properties||{}),{name:((u=a.properties)==null?void 0:u.name)||e,feature_role:"乡镇范围"}),geometry:a.geometry}:null}selectTownFeatureByName(e,t={}){var n,s,o,u,d;const a=this.findTownFeatureByName(e);return a?(this.showSelectedFeature(a,{mode:"town"}),t.silentStatus!==!0&&((d=(u=this.callbacks).onLayerStatus)==null||d.call(u,{type:"success",text:t.statusText||`已选中${((o=a.properties)==null?void 0:o.name)||e}`})),!0):(t.showMissingStatus!==!1&&((s=(n=this.callbacks).onLayerStatus)==null||s.call(n,{type:"warning",text:"未找到对应乡镇边界"})),!1)}handleTownRankingSelect(e,t={}){var u,d;if(!this.isNationalParkTownSelectionActive())return!1;const a=lt(e);if(!a||!this.getTownRankingRows(this.currentTownRanking,Number.POSITIVE_INFINITY,!1).some(h=>lt(h.name)===a))return!1;const o=this.focusTownByName(e,R({select:!0,preserveCamera:!0,statusText:`已选中${e}`},t));return o&&((d=(u=this.callbacks).onFeatureInfo)==null||d.call(u,{feature:null})),o}focusYakIndustryPoint(e={}){var s,o;const t=this.getYakIndustryPayloadCoordinate(e);if(!t)return(o=(s=this.callbacks).onLayerStatus)==null||o.call(s,{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 h,g;const t=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),a=String(e.id||e.key||""),n=String(e.fullName||e.name||"").trim(),s=t.find(m=>{const L=(m==null?void 0:m.properties)||{};return a&&String(L.id||"")===a||n&&String(L.name||L.plot_name||"").trim()===n});if(!s)return(g=(h=this.callbacks).onLayerStatus)==null||g.call(h,{type:"warning",text:"当前图斑尚未加载"}),{focused:!1,screen:null,feature:null};this.setSelectedVectorFeatures([s]);const o=this.getGeometryLngLatBounds(s.geometry);if(!o)return{focused:!1,screen:null,feature:s};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(s),feature:s}}getVectorFeatureScreen(e={}){let t=(e==null?void 0:e.feature)||e;if(!(t!=null&&t.geometry)){const s=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),o=String((e==null?void 0:e.id)||(e==null?void 0:e.key)||"");t=s.find(u=>{var d;return String(((d=u==null?void 0:u.properties)==null?void 0:d.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 s,o,u,d,h;const t=((s=e.geometry)==null?void 0:s.coordinates)||e.coordinates,a=Number((u=(o=e.longitude)!=null?o:e.lng)!=null?u:t==null?void 0:t[0]),n=Number((h=(d=e.latitude)!=null?d:e.lat)!=null?h: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||""),s=String(e.fullName||e.name||"").trim(),o=String(e.stageKey||""),u=t&&a.find(h=>{var m;if(((m=h==null?void 0:h.geometry)==null?void 0:m.type)!=="Point")return!1;const g=h.properties||{};return o&&String(g.stageKey||"")!==o?!1:this.getCoordinateDistance(h.geometry.coordinates,t)<=8e-4})||null;if(e.preferCoordinateMatch)return u;const d=a.find(h=>{const g=(h==null?void 0:h.properties)||{};return!!(n&&String(g.id||"")===n||s&&String(g.name||g.fullName||"").trim()===s)});return d||u}loadVectorTopicLayer(e,t){return he(this,null,function*(){var a,n,s,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=(s=this.callbacks).onLayerStatus)==null||o.call(s,{type:"error",text:"真实矢量图层加载失败"})}})}fetchVectorLayerGeojson(e){return he(this,null,function*(){var s,o;if(e.sourceType==="geojson"){if(((s=e.geojsonData)==null?void 0:s.type)==="FeatureCollection")return e.geojsonData;const u=yield fetch(Vr(e.dataPath),{credentials:"include"});if(!u.ok)throw new Error(`HTTP ${u.status}`);return yield u.json()}if(e.sourceType==="wfs"){const u=yield wr(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 d=yield u.json();t=Array.isArray(d==null?void 0:d.data)?d.data:Array.isArray((o=d==null?void 0:d.data)==null?void 0:o.rows)?d.data.rows:[]}catch(u){a=u}let n=this.buildWktLayerFeatures(t);if((!t.length||!n.length)&&e.fallbackPath){const u=yield fetch(Vr(e.fallbackPath),{credentials:"include"});if(!u.ok)throw a||new Error(`HTTP ${u.status}`);const d=yield u.json();t=Array.isArray(d==null?void 0:d.rows)?d.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 d;return!(e!=null&&e.hidePointFeatures)||((d=u==null?void 0:u.geometry)==null?void 0:d.type)!=="Point"}).sort((u,d)=>{var m,L;const h=this.getGeometryDrawRank((m=u.geometry)==null?void 0:m.type),g=this.getGeometryDrawRank((L=d.geometry)==null?void 0:L.type);return h-g});o.forEach(u=>{const d=this.getVectorFeatureStyle(e,u);this.drawVectorFeature(n,u.geometry,d)}),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 s=this.getVectorFeatureStyle(t,n);this.drawVectorFeature(e,n.geometry,$(R({},s),{fill:"#071A20",stroke:"#071A20",polygonAlpha:0,lineAlpha:.34,lineWidth:7,glow:!0})),this.drawVectorFeature(e,n.geometry,$(R({},s),{fill:"#E7FFF6",stroke:"#E7FFF6",polygonAlpha:0,lineAlpha:.68,lineWidth:2.1,glow:!1})),this.drawVectorFeature(e,n.geometry,$(R({},s),{fill:s.stroke,stroke:s.stroke,polygonAlpha:0,lineAlpha:.86,lineWidth:1.2,glow:!1}))})}drawSelectedVectorOverlay(e){const t=this.selectedVectorFeatures||[],a=this.analysisMatchedFeatures||[],n=this.analysisBoundaryFeature,s=this.boundaryDrawPoints||[];if(!t.length&&!a.length&&!n&&!s.length)return;const o=this.isEcologicalProjectLayer(this.currentTopicLayer),u={fill:Fr,stroke:$u,polygonAlpha:o?.2:.28,lineAlpha:o?.78:.98,lineWidth:o?6:12,pointRadius:11,glow:!o,halo:!o},d={fill:Fr,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(h=>{var m;const g=(h==null?void 0:h.geometry)||((m=h==null?void 0:h.feature)==null?void 0:m.geometry);this.drawVectorFeature(e,g,u),this.drawVectorFeature(e,g,d)}),a.forEach(h=>{var m;const g=(h==null?void 0:h.geometry)||((m=h==null?void 0:h.feature)==null?void 0:m.geometry);this.drawVectorFeature(e,g,{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}),s.length){const h=s.map(m=>[m.lng,m.lat]),g={type:"LineString",coordinates:this.boundaryDrawingEnabled?h:[...h,h[0]].filter(Boolean)};this.drawVectorFeature(e,g,{fill:"#24F6C4",stroke:"#24F6C4",polygonAlpha:o?.08:.12,lineAlpha:1,lineWidth:o?3:4,pointRadius:6,glow:!o}),h.forEach(m=>{this.drawVectorFeature(e,{type:"Point",coordinates:m},{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||!ti(this.currentTopicLayer)||(this.drawVectorTopicLayer(this.currentTopicLayer,this.currentVectorFeatures||[]),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.topicLayerTexture.needsUpdate=!0)}featureMatchesLegend(e={},t={}){var s;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((s=e[n.field])!=null?s:"")===String(n.value):!0}getVisibleVectorFeatures(e,t){var u,d;const a=Array.isArray(e==null?void 0:e.activeLegends)?e.activeLegends.filter(h=>{var g,m;return((g=h==null?void 0:h.matches)==null?void 0:g.length)||((m=h==null?void 0:h.match)==null?void 0:m.field)}):[];if(a.length)return(t||[]).filter(h=>a.some(g=>this.featureMatchesLegend((h==null?void 0:h.properties)||{},g)));const n=e==null?void 0:e.activeLegend;if((u=n==null?void 0:n.matches)!=null&&u.length||(d=n==null?void 0:n.match)!=null&&d.field)return(t||[]).filter(h=>this.featureMatchesLegend((h==null?void 0:h.properties)||{},n));const o=String((e==null?void 0:e.cqlFilter)||"").trim().match(/^([a-zA-Z0-9_]+)\s*=\s*'((?:''|[^'])*)'$/);if(o){const[,h,g]=o,m=g.replace(/''/g,"'");return(t||[]).filter(L=>{var S,C;return String((C=(S=L==null?void 0:L.properties)==null?void 0:S[h])!=null?C:"")===m})}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,s)=>{var u;let o=this.yakIndustryPointLabels[s];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,s)),o.visible=!0,(u=o.show)==null||u.call(o),o.userData={feature:n}}),this.yakIndustryPointLabels.slice(a.length).forEach(n=>{var s;n.visible=!1,(s=n.hide)==null||s.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 s;return((s=n==null?void 0:n.geometry)==null?void 0:s.type)==="Point"});a.length&&(this.ensureYakIndustryPointMarkerGroup(),a.forEach((n,s)=>{let o=this.yakIndustryPointMarkers[s];const u=this.getVectorFeatureStyle(e,n),d=this.getYakIndustryMarkerMaterial(u,n),h=this.lngLatToLayerLocalPoint(n.geometry.coordinates,this.depth+.36),g=Number(e==null?void 0:e.pointSpriteScale)||.34,m=this.getYakIndustryMarkerType(n);o||(o=new Qt(d),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=d,o.center.set(.5,.5),o.position.copy(h),o.scale.set(g*.88,g*.88,1),o.visible=!0,o.userData={feature:n,layer:e,index:s,markerType:m}}),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 s,o,u,d,h,g,m,L,S;if(this.clicked||!((s=this.yakIndustryPointMarkerGroup)!=null&&s.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=((d=a.geometry)==null?void 0:d.coordinates)||[];this.setSelectedVectorFeatures([a]),(S=(L=this.callbacks).onFeatureInfo)==null||S.call(L,{feature:{id:((h=a.properties)==null?void 0:h.id)||((g=a.properties)==null?void 0:g.feature_id)||((m=a.properties)==null?void 0:m.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}`,s=this.yakIndustryMarkerMaterialCache.get(n);if(s)return s;const o=this.createYakIndustryMarkerTexture(e.fill,e.stroke,a),u=new ea({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 Rr[t]||"point"}createYakIndustryMarkerTexture(e="#24F6C4",t="#B7FFF2",a="point"){const n=document.createElement("canvas");n.width=112,n.height=112;const s=n.getContext("2d"),o=56,u=56;s.clearRect(0,0,n.width,n.height),s.beginPath(),s.arc(o,u,42,0,Math.PI*2),s.fillStyle=this.hexToRgba(e,.18),s.shadowColor=e,s.shadowBlur=20,s.fill(),this.drawYakIndustryMarkerFrame(s,a,o,u,e,t||e),s.save(),s.shadowBlur=0,s.beginPath(),s.arc(o,u,19,0,Math.PI*2),s.fillStyle="rgba(3, 23, 34, 0.64)",s.fill(),s.strokeStyle=this.hexToRgba("#FFFFFF",.32),s.lineWidth=2,s.stroke(),s.restore(),this.drawYakIndustryMarkerGlyph(s,a,o,u,"#FFFFFF");const d=new Zi(n);return d.colorSpace=na,d.needsUpdate=!0,d}drawYakIndustryMarkerFrame(e,t,a,n,s="#24F6C4",o="#B7FFF2"){if(e.save(),e.translate(a,n),e.fillStyle=this.hexToRgba(s,.92),e.strokeStyle=this.hexToRgba(o||s,.98),e.lineWidth=4,e.shadowColor=o||s,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 d=-Math.PI/2+Math.PI*2*u/6,h=Math.cos(d)*35,g=Math.sin(d)*35;u===0?e.moveTo(h,g):e.lineTo(h,g)}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 d=-Math.PI/2+Math.PI*2*u/10,h=u%2===0?38:30,g=Math.cos(d)*h,m=Math.sin(d)*h;u===0?e.moveTo(g,m):e.lineTo(g,m)}e.closePath()}else if(t==="equipment"){e.beginPath();for(let u=0;u<16;u+=1){const d=-Math.PI/2+Math.PI*2*u/16,h=u%2===0?38:30,g=Math.cos(d)*h,m=Math.sin(d)*h;u===0?e.moveTo(g,m):e.lineTo(g,m)}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,s="#24F6C4"){if(e.save(),e.translate(a,n),e.lineCap="round",e.lineJoin="round",e.shadowBlur=0,e.fillStyle=this.hexToRgba(s,.98),e.strokeStyle=this.hexToRgba(s,.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(d=>{var h;return((h=d==null?void 0:d.geometry)==null?void 0:h.type)==="Point"}),n=Number(e==null?void 0:e.pointLabelLimit)||(a.length>36?12:Math.min(a.length,16)),s=a.map(d=>{var h;return{feature:d,score:this.getYakIndustryFeatureScore(d),town:lt((h=d.properties)==null?void 0:h.town)}}).sort((d,h)=>{var g,m;return h.score-d.score||String(((g=d.feature.properties)==null?void 0:g.name)||"").localeCompare(String(((m=h.feature.properties)==null?void 0:m.name)||""),"zh-CN")}),o=[],u=new Set;return s.forEach(d=>{o.length>=n||!d.town||u.has(d.town)||(o.push(d.feature),u.add(d.town))}),s.forEach(d=>{o.length>=n||o.includes(d.feature)||o.push(d.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||"产业主体"),s=t.town||t.village||"红原县",o=this.getYakIndustryPointMetricText(t),u=this.getYakIndustryLabelColor(t);return`
${Se(n)}
${Se(a)}
${Se(s)} ${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,s,o,u,d,h;const t=String(e.stageKey||""),a=(((n=this.currentTopicLayer)==null?void 0:n.legends)||[]).find(g=>{var m;return String(((m=g.match)==null?void 0:m.value)||"")===t})||(String(((u=(o=(s=this.currentTopicLayer)==null?void 0:s.activeLegend)==null?void 0:o.match)==null?void 0:u.value)||"")===t?this.currentTopicLayer.activeLegend:null);return(a==null?void 0:a.fillColor)||((h=(d=this.currentTopicLayer)==null?void 0:d.activeLegend)==null?void 0:h.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]),s=this.lngLatToLayerCanvasPoint([a.east,a.south]),o=Math.min(n.x,s.x),u=Math.min(n.y,s.y),d=Math.abs(s.x-n.x),h=Math.abs(s.y-n.y);!d||!h||(e.beginPath(),e.rect(o,u,d,h),e.clip())}clipContextToHongyuanBoundary(e){const t=this.hongyuanBoundaryPolygons||[];t.length&&(e.beginPath(),t.forEach(a=>{a.forEach(n=>{n.forEach((s,o)=>{const u=this.lngLatToLayerCanvasPoint(s);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),U.west),n=Math.max(Number(t.south),U.south),s=Math.min(Number(t.east),U.east),o=Math.min(Number(t.north),U.north);return![a,n,s,o].every(Number.isFinite)||a>=s||n>=o?null:{west:a,south:n,east:s,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 d,h,g;const a=t.properties||{},s=(e.legends||[]).find(m=>{var L,S;return(((L=m==null?void 0:m.matches)==null?void 0:L.length)||((S=m==null?void 0:m.match)==null?void 0:S.field))&&this.featureMatchesLegend(a,m)})||e.activeLegend||((d=e.legends)==null?void 0:d[0])||{},o=String(((h=t.geometry)==null?void 0:h.type)||"").includes("LineString"),u=((g=t.geometry)==null?void 0:g.type)==="Point";if(this.isEcologicalProjectLayer(e)){const m=o||String(a.feature_role||"")==="线性设施";return{fill:m||u?s.strokeColor||s.fillColor||"#D2EA78":s.fillColor||"#75AD49",stroke:s.strokeColor||s.fillColor||"#D2EA78",polygonAlpha:m?.08:.22,lineAlpha:m?.9:.82,lineWidth:m?3:1.85,pointRadius:u?3.8:4,glow:!1}}return(e==null?void 0:e.key)==="yak-epidemic-village-boundary"?{fill:s.fillColor||"#24F6C4",stroke:s.strokeColor||"#C9FBFF",polygonAlpha:.16,lineAlpha:1,lineWidth:3.2,pointRadius:4.5,glow:!0}:(e==null?void 0:e.key)==="artificial-grassland-plots"?{fill:s.fillColor||"#24F6C4",stroke:s.strokeColor||"#A7F8FF",polygonAlpha:.2,lineAlpha:.94,lineWidth:1.6,pointRadius:4.5,glow:!0}:(e==null?void 0:e.key)==="yak-industry-points"?{fill:s.fillColor||"#24F6C4",stroke:s.strokeColor||s.fillColor||"#B7FFF2",polygonAlpha:.36,lineAlpha:.82,lineWidth:1.6,pointRadius:this.getVectorPointRadius(e,t),glow:!0,halo:!0,marker:!0,markerType:Rr[String(a.stageKey||"")]||"point"}:(e==null?void 0:e.key)==="national-park-zoning"?{fill:s.fillColor||"#30DCFF",stroke:s.strokeColor||"#F2FFFF",polygonAlpha:.38,lineAlpha:.96,lineWidth:2.7,pointRadius:4.5,glow:!1}:e!=null&&e.boundaryOnly?{fill:s.fillColor||"#24F6C4",stroke:s.strokeColor||s.fillColor||"#18F8FF",polygonAlpha:.04,lineAlpha:.96,lineWidth:10,pointRadius:4.5,glow:!0}:{fill:o||u?s.strokeColor||s.fillColor||"#30DCFF":s.fillColor||"#30DCFF",stroke:s.strokeColor||s.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,s;const a=Number(((n=t==null?void 0:t.properties)==null?void 0:n.count)||((s=t==null?void 0:t.properties)==null?void 0:s.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((s,o)=>{const u=this.lngLatToLayerCanvasPoint(s);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,s)=>{const o=this.lngLatToLayerCanvasPoint(n);s===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 s;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,(s=a.lineAlpha)!=null?s:.9),e.stroke()),e.restore()}drawMarkerPointPath(e,t,a){const n=this.lngLatToLayerCanvasPoint(t),s=a.pointRadius||6;e.save(),e.beginPath(),e.arc(n.x,n.y+s*.22,s*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+s*2.05),e.bezierCurveTo(n.x+s*1.46,n.y+s*.62,n.x+s*1.34,n.y-s*1.34,n.x,n.y-s*1.62),e.bezierCurveTo(n.x-s*1.34,n.y-s*1.34,n.x-s*1.46,n.y+s*.62,n.x,n.y+s*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-s*.34,s*.52,0,Math.PI*2),e.fillStyle=this.hexToRgba("#FFFFFF",.96),e.shadowBlur=0,e.fill(),e.beginPath(),e.arc(n.x,n.y-s*.34,s*.82,0,Math.PI*2),e.lineWidth=Math.max(1.2,s*.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-U.west)/(U.east-U.west)*this.topicLayerCanvas.width,y:(U.north-a)/(U.north-U.south)*this.topicLayerCanvas.height}}hexToRgba(e,t=1){const a=String(e||"#30DCFF").replace("#",""),n=a.length===3?a.split("").map(h=>h+h).join(""):a,s=Number.parseInt(n,16);if(!Number.isFinite(s))return`rgba(48, 220, 255, ${t})`;const o=s>>16&255,u=s>>8&255,d=s&255;return`rgba(${o}, ${u}, ${d}, ${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 s=t.slice(t.indexOf("("));return n==="POLYGON"?{type:"Polygon",coordinates:this.parseWktPolygonBody(s)}:n==="MULTIPOLYGON"?{type:"MultiPolygon",coordinates:this.parseWktMultiPolygonBody(s)}:n==="POINT"?{type:"Point",coordinates:this.parseWktPoint(s)}:n==="MULTIPOINT"?{type:"MultiPoint",coordinates:this.getWktChildGroups(s).map(u=>this.parseWktPoint(u)).filter(Boolean)}:n==="LINESTRING"?{type:"LineString",coordinates:this.parseWktRing(s)}:n==="MULTILINESTRING"?{type:"MultiLineString",coordinates:this.getWktChildGroups(s).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 s=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 Wi({color:16777215,transparent:!0,opacity:0,depthWrite:!this.usesCustomSatelliteTiles,fog:!1,side:Re});t.onBeforeCompile=s=>{s.uniforms=$(R({},s.uniforms),{uColor1:{value:new bt(e?2780818:2152676)},uColor2:{value:new bt(e?1058614:475482)}}),s.vertexShader=s.vertexShader.replace("void main() {",` attribute float alpha; varying vec3 vPosition; varying float vAlpha; void main() { vAlpha = alpha; vPosition = position; `),s.fragmentShader=s.fragmentShader.replace("void main() {",` varying vec3 vPosition; varying float vAlpha; uniform vec3 uColor1; uniform vec3 uColor2; void main() { `),s.fragmentShader=s.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=st,a.wrapT=st,a.repeat.set(1,1.8),a.offset.y+=.065;let n=new Xa({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=s=>{s.uniforms=$(R({},s.uniforms),{uColor1:{value:new bt(1629410)},uColor2:{value:new bt(205365)}}),s.vertexShader=s.vertexShader.replace("void main() {",` attribute float alpha; varying vec3 vPosition; varying float vAlpha; void main() { vAlpha = alpha; vPosition = position; `),s.fragmentShader=s.fragmentShader.replace("void main() {",` varying vec3 vPosition; varying float vAlpha; uniform vec3 uColor1; uniform vec3 uColor2; void main() { `),s.fragmentShader=s.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:Mr.map(e=>({name:e.name,value:0,unit:""}))}}getTownRankingMeta(e=this.currentTownRanking){var n,s,o,u;const t=this.getDefaultTownRanking(),a=Ou(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:Br(e),hideMapLabels:La(e),hideTownLabelStats:(n=e==null?void 0:e.hideTownLabelStats)!=null?n:this.hideTownLabelStatsByDefault,calloutMode:a,showBars:(s=e==null?void 0:e.showBars)!=null?s:!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 d;const n=this.getDefaultTownRanking(),s=(d=e==null?void 0:e.rows)!=null&&d.length?e.rows:a?n.rows:[],o=this.getTownRankingMeta(e),u=s.map(h=>{const g=this.townMetaByName.get(lt(h.name));return g?$(R(R({},g),h),{name:g.name,enName:g.enName,center:g.center,centroid:g.centroid,value:ue(h.value),unit:h.unit||o.unit,metricTitle:o.title}):null}).filter(Boolean).sort((h,g)=>g.value-h.value).map((h,g)=>$(R({},h),{rank:g+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 h,g,m,L,S,C,x,E;const s=ue((h=a.lng)!=null?h:a.longitude,NaN),o=ue((g=a.lat)!=null?g:a.latitude,NaN);if(!Number.isFinite(s)||!Number.isFinite(o))return null;const u=ue((m=a.displayValue)!=null?m:a.value),d=ue((C=(S=(L=a.rawValue)!=null?L:a.earTagCount)!=null?S:a.ear_tag_count)!=null?C:a.value);return $(R({},a),{key:a.key||`${a.town||""}-${a.village||a.name||n}`,name:a.name||a.village||`村${n+1}`,town:a.town||"",lng:s,lat:o,value:u,rawValue:d,recordCount:ue((x=a.recordCount)!=null?x:a.record_count,0),imageRate:ue((E=a.imageRate)!=null?E: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)=>$(R({},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(s=>{s.visible=!1}),(t=this.allBar)==null||t.forEach(s=>{s.visible=!1,s.scale.set(1,1,0)}),(a=this.allBarMaterial)==null||a.forEach(s=>{s.opacity=0}),(n=this.allGuangquan)==null||n.forEach(s=>{s.visible=!1})}setTownNameLabelsVisible(e=!0){var t;(t=this.townNameLabels)==null||t.forEach(a=>{a.visible=e})}updateVillageRankingLabels(e=this.currentTownRanking){if(this.ensureVillageRankingGroup(),!Gr(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,s)=>{let o=this.villageRankingLabels[s];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,d]=this.geoProjection([n.lng,n.lat]),h=(s%3-1)*.06,g=Math.floor(s/3)%2*.04;o.init(this.getVillageRankingHtml(n,a),new re(u+h,-d+g,this.depth+1.55+Math.min(s,6)*.015)),o.visible=!0,o.userData=R({},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 s,o,u,d;const t=(e==null?void 0:e.source)||{},a=ue((s=t.lng)!=null?s: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((d=(u=t.total)!=null?u:t.headCount)!=null?d:t.value,NaN)}}getTradeFlowRows(e=this.currentTownRanking){const t=this.getTownRankingMeta(e);return((e==null?void 0:e.rows)||[]).map((a,n)=>{var L,S,C,x,E,D;const s=ue((L=a.lng)!=null?L:a.longitude,NaN),o=ue((S=a.lat)!=null?S:a.latitude,NaN),u=ue((E=(x=(C=a.headCount)!=null?C:a.head_count)!=null?x:a.rawValue)!=null?E:a.value),d=a.displayName||a.display_name||a.name,h=a.mapTownName||a.map_town_name||a.town||a.startTown||a.start_town||d,g=this.townMetaByName.get(lt(h)),m=Number.isFinite(s)&&Number.isFinite(o)?{lng:s,lat:o}:g!=null&&g.center?{lng:g.center[0],lat:g.center[1]}:null;return!m||!Number.isFinite(u)?null:$(R(R({},a),g),{key:a.key||`${(g==null?void 0:g.name)||d||h||"trade-source"}-${n}`,name:d||h||(g==null?void 0:g.name)||`来源${n+1}`,townName:(g==null?void 0:g.name)||h,lng:m.lng,lat:m.lat,labelSide:a.labelSide||a.label_side||this.getTradeSourceLabelSide(g,n),value:u,headCount:u,recordCount:ue((D=a.recordCount)!=null?D:a.record_count,0),unit:a.unit||t.unit||"头"})}).filter(Boolean).sort((a,n)=>n.value-a.value).map((a,n)=>$(R({},a),{rank:n+1}))}getTradeMarketHtml(e,t){const a=Number.isFinite(e.total)?e.total:t.reduce((n,s)=>n+ue(s.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 re(0,0,0)}getTradeSourceLabelSide(e,t=0){var s,o;const a=Number((s=e==null?void 0:e.center)==null?void 0:s[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&&(d.normalize().multiplyScalar((a%2===0?1:-1)*Math.min(.18,.05+u*.02)),o.add(d)),new Ml([n,o,s])}tradeGeoProjection(e){return Ht().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 re(0,11.4,16.2),new re(0,-.05,0),.65):!t&&this.mapAnimationComplete&&this.applyLayerMapView(this.currentTopicLayer,{force:!0})}}createTradeSourceMarker(e,t,a,n,s=!0){const o=new bt(t%3===1?16766828:t%3===2?2617536:3202303),u=this.getTradeFlowPoint(e,.72);if(n&&s){const x=this.getLocalTradeFlowCurve(e,n,t),E=new be({color:o,transparent:!0,opacity:.42,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),D=.012+Math.min(.012,ue(e.value)/Math.max(a,1)*.01),Q=new qe(new kl(x,48,D,8,!1),E);Q.renderOrder=31,this.tradeFlowMeshGroup.add(Q),this.tradeFlowMaterials.push(E);const se=new ea({map:this.assets.instance.getResource("point"),color:o,transparent:!0,opacity:.92,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),Z=new Qt(se),G=.12+Math.min(.08,ue(e.value)/Math.max(a,1)*.06);Z.renderOrder=36,Z.scale.set(G,G,G),Z.userData={curve:x,phase:t*.13%1,speed:.16+Math.min(.16,ue(e.value)/Math.max(a,1)*.12)},Z.position.copy(x.getPointAt(Z.userData.phase)),this.tradeFlowPulseSprites.push(Z),this.tradeFlowMeshGroup.add(Z)}const d=new ea({map:this.assets.instance.getResource("point"),color:o,transparent:!0,opacity:.95,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),h=new Qt(d),g=.22+Math.min(.34,ue(e.value)/Math.max(a,1)*.28);h.renderOrder=34,h.scale.set(g,g,g),h.position.copy(u),this.tradeFlowMeshGroup.add(h);const m=this.assets.instance.getResource("guangquan1"),L=new be({map:m,alphaMap:m,color:o,transparent:!0,opacity:.52,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie,side:Re}),S=.38+Math.min(.36,ue(e.value)/Math.max(a,1)*.28),C=new qe(new _t(S,S),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),s=new ea({map:t,color:16773997,transparent:!0,opacity:1,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),o=new Qt(s);o.renderOrder=35,o.scale.set(.34,.34,.34),o.position.copy(n),this.tradeFlowMeshGroup.add(o);const u=new be({map:a,alphaMap:a,color:16773997,transparent:!0,opacity:.72,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie,side:Re}),d=new qe(new _t(.58,.58),u);d.renderOrder=29,d.position.copy(this.getTradeLocalPoint(e.lng,e.lat,.58)),this.tradeFlowMeshGroup.add(d)}disposeObject3D(e){var t,a,n,s;(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)}):(s=(n=e.material)==null?void 0:n.dispose)==null||s.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 s=(u=n.userData)==null?void 0:u.curve;if(!s)return;const o=(ue(n.userData.phase)+ue(n.userData.speed,.16)*e)%1;n.userData.phase=o,n.position.copy(s.getPointAt(o))})}updateTradeFlowLayer(e=this.currentTownRanking){if(!_r(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=zu(e);this.createTradeMarketMarker(t);const s=Math.max(...a.map(d=>d.value),1);a.forEach((d,h)=>{this.createTradeSourceMarker(d,h,s,t,n)});const o=a.length+1;for(let d=this.tradeFlowLabels.length;d{const g=this.tradeFlowLabels[h+1];g.element.className="trade-flow-label",g.init(this.getTradeFlowLabelHtml(d),this.getTradeFlowPoint(d,.78).add(this.getTradeFlowLabelOffset(d,h))),g.visible=!0,g.userData=R({},d)}),this.tradeFlowLabels.slice(o).forEach(d=>{d.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 Pl(.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,s=!0){var h,g;const o=this.getBarHeight(t.value,n),[u,d]=this.geoProjection(t.centroid);return e.visible=!0,(g=(h=e.geometry)==null?void 0:h.dispose)==null||g.call(h),e.geometry=this.createBarGeometry(o),e.position.set(u,-d,this.depth+.45),e.userData=$(R({},t),{targetValue:t.value,geoHeight:o}),e.children.forEach(m=>{var L,S,C,x;(S=(L=m.geometry)==null?void 0:L.dispose)==null||S.call(L),Array.isArray(m.material)?m.material.forEach(E=>{var D;return(D=E==null?void 0:E.dispose)==null?void 0:D.call(E)}):(x=(C=m.material)==null?void 0:C.dispose)==null||x.call(C)}),e.clear(),e.add(...this.createHUIGUANG(o,a>3?16776948:7863285)),s?aa.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:d,geoHeight:o}}updateProvinceLabel(e,t,a,n,s,o=!0){var C;const u=ue((C=e.userData)==null?void 0:C.targetValue,t.value);e.visible=!0,e.userData=$(R({},t),{targetValue:t.value}),e.position.copy(n);const d=e.element.querySelector(".label-title"),h=e.element.querySelector(".number .value"),g=e.element.querySelector(".number .unit"),m=e.element.querySelector(".name"),L=e.element.querySelector(".no");!d||!h||!g||!m||!L?e.element.innerHTML=this.getProvinceLabelHtml(t,a,s):(d.innerText=s.title,h.dataset.targetValue=String(t.value),h.innerText=this.formatMapRankingValue(t.value),g.innerText=t.unit||s.unit,m.innerText=t.name,L.innerText=a+1);const S=e.element.querySelector(".provinces-label-wrap");if(this.mapAnimationComplete&&(S.style.opacity="1",S.style.transform="translate(50%, 0)"),o&&this.mapAnimationComplete){const x=e.element.querySelector(".number .value"),D={value:u};aa.to(D,{value:t.value,duration:.45,ease:"power2.out",onUpdate:()=>{x.innerText=this.formatMapRankingValue(D.value)},onComplete:()=>{x.dataset.previousValue=String(t.value),x.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"),s=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=""),s&&(s.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 g,m;const d=((g=u.userData)==null?void 0:g.townName)||((m=u.userData)==null?void 0:m.name),h=u.element.querySelector(".town-name");h&&(h.innerText=d||""),this.clearTownNameLabelStat(u),u.visible=!a.hideTownNames});return}const n=new Map(t.map(u=>[lt(u.name),u])),s=!!(a.showMissingTownStats&&e&&t.length&&(a.metricLabel||a.unit||a.title));this.townNameLabels.forEach(u=>{var Q,se;const d=((Q=u.userData)==null?void 0:Q.townName)||((se=u.userData)==null?void 0:se.name),h=n.get(lt(d));if(a.onlyRankedTownLabels&&!h){this.clearTownNameLabelStat(u),u.element.style.pointerEvents="none",u.element.style.cursor="",u.visible=!1;return}const g=h||(s?{name:d,value:0,unit:a.unit,metricLabel:a.metricLabel,rank:null}:null);if(!g){this.clearTownNameLabelStat(u),u.element.style.pointerEvents="none",u.element.style.cursor="";return}const m=u.element.querySelector(".town-stat-label"),L=u.element.querySelector(".town-name"),S=u.element.querySelector(".town-stat-value"),C=u.element.querySelector(".town-stat-unit"),x=u.element.querySelector(".town-rank"),E=u.element.querySelector(".town-stat-metric");m==null||m.classList.add("has-stat"),L&&(L.innerText=d),E&&(E.innerText=g.metricLabel||a.metricLabel||""),S&&(S.innerText=this.formatMapRankingValue(g.value)),C&&(C.innerText=g.unit||a.unit||""),x&&(x.innerText=g.rank?`第${g.rank}名`:"");const D=this.isNationalParkTownSelectionActive()&&!!h;u.element.style.pointerEvents=D?"auto":"none",u.element.style.cursor=D?"pointer":"",u.userData=$(R(R({},u.userData),g),{townName:d,targetValue:g.value})})}getInfoPointHtml(e,t=this.getTownRankingMeta()){const a=String(e.metricLabel||t.metricLabel||t.title||"统计指标").replace(/排行$/,""),n=Number(e.rank),s=Number.isFinite(n)?String(n).padStart(2,"0"):"--";return`
${s} ${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(d=>d.value),1);this.infoPointSprites.forEach((d,h)=>{const g=a[h],m=this.infoLabelElement[h];if(!g){d.visible=!1,d.scale.set(0,0,0),m&&(m.visible=!1);return}const[L,S]=this.geoProjection(g.centroid||g.center),C=[L,-S,this.depth+.72];d.userData=$(R(R({},d.userData),g),{position:C,value:g.value,unit:g.unit||t.unit,rank:g.rank,metricTitle:t.title,index:h}),d.position.set(...C),d.visible=this.showTownRankingPointMarkers;const x=.78+g.value/n*.44;if(d.scale.set(x,x,x),m){const E=(h%2===0?.22:-.18)+(h===0?.12:0),D=h%3===0?.08:-.04;m.position.set(L+E,-S+D,this.depth+1.88+Math.min(h,4)*.03),m.userData=$(R({},g),{index:h}),m.element.innerHTML=this.getInfoPointHtml(g,t)}});const s=this.infoLabelElement[this.infoPointIndex];s&&this.showTownRankingPointMarkers&&this.mapAnimationComplete&&(s.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,s)=>{const o=this.getBarHeight(n.value,a),u=new be({color:16777215,transparent:!0,opacity:0,depthTest:!1,fog:!1});new Ja(u,{uColor1:s>3?16506760:5291006,uColor2:s>3?16776948:7863285,size:o,dir:"y"});const d=new qe(this.createBarGeometry(o),u);d.renderOrder=5;const[h,g]=this.geoProjection(n.centroid);d.position.set(h,-g,this.depth+.45),d.scale.set(1,1,0),d.userData=$(R({},n),{targetValue:n.value,geoHeight:o});const m=this.createQuan(new re(h,this.depth+.44,g),s);d.add(...this.createHUIGUANG(o,s>3?16776948:7863285)),t.add(d),t.rotation.x=-Math.PI/2,this.allBar.push(d),this.allBarMaterial.push(u),this.allGuangquan.push(m)}),this.scene.add(t),this.updateTownNameLabelStats(this.currentTownRanking)}setTownRanking(e){var s,o,u,d,h,g,m,L,S,C,x,E,D,Q,se,Z;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(_r(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),(s=this.allBar)!=null&&s.length&&(this.allBar.forEach(G=>{G.visible=!1,G.scale.set(1,1,0)}),(o=this.allBarMaterial)==null||o.forEach(G=>{G.opacity=0}),(u=this.allProvinceLabel)==null||u.forEach(G=>{G.visible=!1}),(d=this.allGuangquan)==null||d.forEach(G=>{G.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),Gr(e)){this.updateTownNameLabelStats(null),this.setTownNameLabelsVisible(!Br(e)),this.clearInfoPointStats(),this.updateVillageRankingLabels(e),(h=this.allBar)!=null&&h.length&&(this.allBar.forEach(G=>{G.visible=!1,G.scale.set(1,1,0)}),(g=this.allBarMaterial)==null||g.forEach(G=>{G.opacity=0}),(m=this.allProvinceLabel)==null||m.forEach(G=>{G.visible=!1}),(L=this.allGuangquan)==null||L.forEach(G=>{G.visible=!1}));return}if(this.setTownNameLabelsVisible(!t.calloutMode&&!t.hideTownNames),this.hideVillageRankingLabels(),t.calloutMode?this.updateTownNameLabelStats(null):this.updateTownNameLabelStats(e),!((S=this.allBar)!=null&&S.length))return;if(!this.showTownRankingBars){this.allBar.forEach(G=>{G.visible=!1,G.scale.set(1,1,0)}),(C=this.allBarMaterial)==null||C.forEach(G=>{G.opacity=0}),(x=this.allProvinceLabel)==null||x.forEach(G=>{G.visible=!1}),(E=this.allGuangquan)==null||E.forEach(G=>{G.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(G=>{G.visible=!1,G.scale.set(1,1,0)}),(D=this.allProvinceLabel)==null||D.forEach(G=>{G.visible=!1}),(Q=this.allGuangquan)==null||Q.forEach(G=>{G.visible=!1}),this.clearInfoPointStats();return}this.InfoPointGroup&&(this.InfoPointGroup.visible=this.showTownRankingPointMarkers&&this.mapAnimationComplete),(se=this.infoPointSprites)==null||se.forEach(G=>{G.visible=this.showTownRankingPointMarkers});const n=Math.max(...a.map(G=>G.value),1);this.allBar.forEach((G,Ce)=>{const je=Ce{G.visible=!1}),this.allGuangquan.forEach((G,Ce)=>{G.visible=Ce{const je=this.allBar[Ce],et=this.allGuangquan[Ce];if(!je)return;const{x:vt,y:W}=this.updateBarItem(je,G,Ce,n,this.mapAnimationComplete);et&&(et.visible=!0,et.position.set(0,0,0),et.children.forEach(He=>{He.position.set(vt,this.depth+.44,W),this.mapAnimationComplete&&He.scale.set(1,1,1)}))}),this.updateInfoPointStats()}createEvent(){let e=[];const t=n=>{n.traverse(s=>{s.isMesh&&(s.material=this.defaultMaterial)})},a=n=>{n.traverse(s=>{s.isMesh&&(s.material=this.defaultLightMaterial)})};this.eventElement.map(n=>{this.interactionManager.add(n),n.addEventListener("mousedown",s=>{this.handleMapClick(s)}),n.addEventListener("mouseover",s=>{e.includes(s.target.parent)||e.push(s.target.parent),document.body.style.cursor="pointer",a(s.target.parent)}),n.addEventListener("mouseout",s=>{e=e.filter(o=>o.userData.name!==s.target.parent.userData.name),e.length>0&&e[e.length-1],t(s.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=na,n.wrapS=st,n.wrapT=st;let s=new be({color:t,map:n,transparent:!0,opacity:.4,depthWrite:!1,side:Re,blending:Ie}),o=new qe(a,s);o.renderOrder=10,o.rotateX(Math.PI/2);let u=o.clone(),d=o.clone();return u.rotateY(Math.PI/180*60),d.rotateY(Math.PI/180*120),[o,u,d]}createQuan(e,t){const a=this.assets.instance.getResource("guangquan1"),n=this.assets.instance.getResource("guangquan2");let s=new _t(.5,.5),o=new be({color:16777215,map:a,alphaMap:a,opacity:1,transparent:!0,depthTest:!1,fog:!1,blending:Ie}),u=new be({color:16777215,map:n,alphaMap:n,opacity:1,transparent:!0,depthTest:!1,fog:!1,blending:Ie}),d=new qe(s,o),h=new qe(s,u);return d.renderOrder=6,h.renderOrder=6,d.rotateX(-Math.PI/2),h.rotateX(-Math.PI/2),d.position.copy(e),h.position.copy(e),h.position.y-=.001,d.scale.set(0,0,0),h.scale.set(0,0,0),this.quanGroup=new Te,this.quanGroup.add(d,h),this.scene.add(this.quanGroup),this.time.on("tick",()=>{d.rotation.z+=.05}),this.quanGroup}createDiffuse(){let e=new _t(200,200),t=new be({color:0,depthWrite:!1,transparent:!0,blending:Cl});t.blendEquation=Fl,t.blendSrc=xl,t.blendDst=Nl,new Vl({material:t,time:this.time,size:60,diffuseSpeed:8,diffuseColor:7442830,diffuseWidth:2,callback:n=>{const s=setTimeout(()=>{this.addSceneTween(aa.to(n.uniforms.uTime,{value:4,repeat:-1,duration:6,ease:"power1.easeIn"}))},3);this.addSceneTimer(s)}});let a=new qe(e,t);a.renderOrder=3,a.rotation.x=-Math.PI/2,a.position.set(0,.21,0),this.scene.add(a)}createGrid(){new zl(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=na,t.wrapS=st,t.wrapT=st,t.repeat.set(1,1);let a=new be({map:t,opacity:.92,fog:!1}),n=new qe(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=na,t.wrapS=st,t.wrapT=st,t.generateMipmaps=!1,t.minFilter=sr,t.repeat.set(1,1);let a=new be({color:4162253,alphaMap:t,transparent:!0,opacity:.62}),n=new qe(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=[],s=[];yu.map(u=>{if(u.hide==!0)return!1;let d=o(u,a,t);n.push(d),s.push(d)}),this.otherLabel=n,this.townNameLabels=s;function o(u,d,h){let g=d.create("",`china-label ${u.blur?" blur":""}`,!0);const[m,L]=e.geoProjection(u.center);return g.init(`
${u.name}
`,new re(m,-L,e.depth+.85)),d.setLabelStyle(g,.018,"x"),g.setParent(h),g.userData=$(R({},u),{labelType:"town-label",baseScale:.018,townName:u.name}),g.element.addEventListener("pointerdown",S=>{e.handleTownRankingSelect(u.name,{preserveCamera:!0,statusText:`已选中${u.name}`})&&(S.preventDefault(),S.stopPropagation())}),g}}createRotateBorder(){let e=13.2,t=this.assets.instance.getResource("rotationBorder1"),a=this.assets.instance.getResource("rotationBorder2"),n=new fr(this,{width:e*1.178,needRotate:!0,rotateSpeed:.001,material:new be({map:t,color:4763647,transparent:!0,opacity:.26,side:Re,depthWrite:!1,blending:Ie}),position:new re(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 s=new fr(this,{width:e*1.116,needRotate:!0,rotateSpeed:-.004,material:new be({map:a,color:4763647,transparent:!0,opacity:.5,side:Re,depthWrite:!1,blending:Ie}),position:new re(0,.33,0)});s.instance.rotation.x=-Math.PI/2,s.instance.renderOrder=6,s.instance.scale.set(0,0,0),s.setParent(this.scene),this.rotateBorder1=n.instance,this.rotateBorder2=s.instance}createFlyLine(){this.flyLineGroup=new Te,this.flyLineGroup.visible=!1,this.scene.add(this.flyLineGroup)}createFocus(){this.flyLineFocusGroup.clear()}createParticles(){this.particles=new mr(this,{num:10,range:30,dir:"up",speed:.05,material:new Rl({map:mr.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 ea({map:e,color:16776948,fog:!1,transparent:!0,depthTest:!1});let a=Ir(bu),n=a[0].value;a.map(s=>{const o=new Qt(t);o.renderOrder=23;let u=.1+s.value/n*.2;o.scale.set(u,u,u);let[d,h]=this.geoProjection([s.lng,s.lat]);o.position.set(d,-h,this.depth+.45),o.userData.position=[d,-h,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],s=Ir(vu),o=s[0].value;s.map((d,h)=>{const g=new ea({map:a,color:n[h%n.length],fog:!1,transparent:!0,depthTest:!1}),m=new Qt(g);m.renderOrder=23;let L=.7+d.value/o*.4;m.scale.set(L,L,L);let[S,C]=this.geoProjection([d.lng,d.lat]),x=[S,-C,this.depth+.7];m.position.set(...x),m.userData.position=[...x],m.userData={position:[S,-C,this.depth+.7],name:d.name,value:d.value,level:d.level,index:h},this.InfoPointGroup.add(m);let E=u(d,t,this.InfoPointGroup,h);this.infoLabelElement.push(E),this.infoPointSprites.push(m),this.interactionManager.add(m),m.addEventListener("mousedown",D=>{var Q,se;if(this.clicked||!this.InfoPointGroup.visible)return!1;this.clicked=!0,this.infoPointIndex=D.target.userData.index,this.infoLabelElement.map(Z=>{Z.visible=!1}),E.visible=!0,this.handleTownRankingSelect(((Q=D.target.userData)==null?void 0:Q.name)||((se=D.target.userData)==null?void 0:se.townName)),this.createInfoPointLabelLoop()}),m.addEventListener("mouseup",D=>{this.clicked=!1}),m.addEventListener("mouseover",D=>{document.body.style.cursor="pointer"}),m.addEventListener("mouseout",D=>{document.body.style.cursor="default"})});function u(d,h,g,m){let L=h.create("","info-point",!0);const[S,C]=e.geoProjection([d.lng,d.lat]);return L.init(e.getInfoPointHtml($(R({},d),{value:0,rank:m+1,unit:""}),e.getTownRankingMeta()),new re(S,-C,e.depth+1.9)),h.setLabelStyle(L,.015,"x"),L.setParent(g),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=st,t.repeat.set(2,1);let a=new ta(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new re(0,0,this.depth+.24),data:e,material:new be({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 he(this,null,function*(){var s,o,u,d,h,g,m,L,S,C,x,E,D,Q,se,Z,G,Ce,je,et,vt,W,He,tt,Ft,ut,xt,Kt,ct,dt,$e,Fe,ge,xe,ht,wt,Ve,Ue,ve,pt,M;if(!this.currentTopicLayer)return;const t=this.getScreenPointFromEvent(e),a=this.getLngLatFromEvent(e);if(!a){this.clearSelectedFeature(),(o=(s=this.callbacks).onFeatureInfo)==null||o.call(s,{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(),(h=(d=this.callbacks).onFeatureInfo)==null||h.call(d,{feature:null}),(m=(g=this.callbacks).onLayerStatus)==null||m.call(g,{type:"success",text:"当前点击位置不在红原县边界内"});return}if(this.shouldClipLayerToLayerBounds(this.currentTopicLayer)&&!this.isLngLatInLayerClipBounds(a,this.currentTopicLayer)){this.clearSelectedFeature(),(S=(L=this.callbacks).onFeatureInfo)==null||S.call(L,{feature:null}),(x=(C=this.callbacks).onLayerStatus)==null||x.call(C,{type:"success",text:"当前点击位置不在图层显示范围内"});return}if(Du(this.currentTopicLayer)){this.clearSelectedFeature(),(D=(E=this.callbacks).onFeatureInfo)==null||D.call(E,{feature:null});return}if(ti(this.currentTopicLayer)){const v=this.pickVectorFeatureAtPoint(a,t),N=(v==null?void 0:v.feature)||v;let z=(v==null?void 0:v.screen)||t;if(N)this.shouldClipLayerToHongyuanBoundary(this.currentTopicLayer)?(this.clearSelectedGeometryGroup(),this.setSelectedVectorFeatures([N])):this.showSelectedFeature(N),((Q=this.currentTopicLayer)==null?void 0:Q.key)==="yak-industry-points"&&(this.setSelectedVectorFeatures([N]),z=this.getPointFeatureScreenPoint(N)||z),(je=(Ce=this.callbacks).onFeatureInfo)==null||je.call(Ce,{feature:{id:((se=N.properties)==null?void 0:se.id)||((Z=N.properties)==null?void 0:Z.feature_id)||((G=N.properties)==null?void 0:G.project_name),properties:N.properties||{},feature:N,layer:this.currentTopicLayer,lngLat:a},screen:z}),(vt=(et=this.callbacks).onLayerStatus)==null||vt.call(et,{type:"success",text:"真实矢量要素已选中"});else{const q=this.getTownNameFromMapEvent(e);if(this.handleTownRankingSelect(q))return;this.clearSelectedFeature(),(He=(W=this.callbacks).onFeatureInfo)==null||He.call(W,{feature:null}),(Ft=(tt=this.callbacks).onLayerStatus)==null||Ft.call(tt,{type:"success",text:"当前点击位置无生态保护要素"})}return}const n=this.lngLatToWmsPixel(a);(xt=(ut=this.callbacks).onFeatureInfo)==null||xt.call(ut,{feature:null}),(ct=(Kt=this.callbacks).onFeatureLoading)==null||ct.call(Kt,!0);try{const v=yield Lr(this.currentTopicLayer,n,{size:At,buffer:10}),N=this.normalizeFeatureInfoAtPoint(v,a),z=N?null:yield this.queryFallbackFeatureInfo(a),q=N||(z==null?void 0:z.feature);if(q){const ne=yield this.enrichFeatureInfo(q,n,a);this.showSelectedFeature(ne.feature||ne),($e=(dt=this.callbacks).onFeatureInfo)==null||$e.call(dt,{feature:$(R({},ne),{layer:(z==null?void 0:z.layer)||this.currentTopicLayer,lngLat:a}),screen:t})}else this.clearSelectedFeature(),(ge=(Fe=this.callbacks).onFeatureInfo)==null||ge.call(Fe,{feature:null});q||(ht=(xe=this.callbacks).onLayerStatus)==null||ht.call(xe,{type:"success",text:"当前点击位置无图斑"})}catch(v){this.clearSelectedFeature(),(Ve=(wt=this.callbacks).onFeatureInfo)==null||Ve.call(wt,{feature:null}),(ve=(Ue=this.callbacks).onLayerStatus)==null||ve.call(Ue,{type:"error",text:"图斑信息查询失败"})}finally{(M=(pt=this.callbacks).onFeatureLoading)==null||M.call(pt,!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,S,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=(S=this.interactionManager)==null?void 0:S.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()),h=Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]).invert([u.x,-u.y]);if(!h)return null;const g=Number(h[0]),m=Number(h[1]);return!Number.isFinite(g)||!Number.isFinite(m)?null:gU.east+.03||mU.north+.03?this.getFallbackLngLatFromPointer(e,t):{lng:g,lat:m}}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 s=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=U.west+(U.east-U.west)*s,d=U.north-(U.north-U.south)*o;return{lng:u,lat:d}}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),s=this.depth+.22;if(Math.abs(n.z)<1e-8)return null;const o=(s-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 he(this,null,function*(){const n=this.getLayerTopicKey(this.currentTopicLayer);if(!["grassland","wetland","woodland"].includes(n))return e;const o=(Hi[n]||[]).find(m=>m.key===`${n}-distribution`),u=(this.visibleTopicLayers||[]).filter(m=>this.getLayerTopicKey(m)===n).slice(0,5),d=[o,this.currentTopicLayer,...u].filter(m=>m==null?void 0:m.layerName).filter((m,L,S)=>S.findIndex(C=>this.getLayerQueryKey(C)===this.getLayerQueryKey(m))===L);if(!d.length)return e;const h=yield Promise.allSettled([...d.filter(m=>this.getLayerQueryKey(m)!==this.getLayerQueryKey(this.currentTopicLayer)).map(m=>he(this,null,function*(){const L=yield Lr(m,t,{size:At,buffer:10}),S=this.normalizeFeatureInfoAtPoint(L,a);return S?{layer:m,feature:S,source:"wms"}:null})),...d.map(m=>he(this,null,function*(){const L=yield this.queryLayerFeatureByPoint(m,a);return L?{layer:m,feature:L,source:"wfs"}:null}))]),g=R({},e.properties||{});return h.forEach(m=>{var L,S;m.status!=="fulfilled"||!((S=(L=m.value)==null?void 0:L.feature)!=null&&S.properties)||this.mergeBusinessProperties(g,m.value.feature.properties,m.value.layer)}),$(R({},e),{properties:g,relatedFeatures:h.filter(m=>{var L;return m.status==="fulfilled"&&((L=m.value)==null?void 0:L.feature)}).map(m=>m.value),feature:$(R({},e.feature||{}),{properties:g})})})}queryFallbackFeatureInfo(e){return he(this,null,function*(){const t=this.getLayerTopicKey(this.currentTopicLayer);if(!["grassland","wetland","woodland"].includes(t))return null;const n=[(Hi[t]||[]).find(s=>s.key===`${t}-distribution`),this.currentTopicLayer,...(this.visibleTopicLayers||[]).filter(s=>this.getLayerTopicKey(s)===t)].filter((s,o,u)=>(s==null?void 0:s.layerName)&&u.findIndex(d=>this.getLayerQueryKey(d)===this.getLayerQueryKey(s))===o);for(const s of n){const o=yield this.queryLayerFeatureByPoint(s,e,{requireContainment:!0});if(o)return{layer:s,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 s=n.properties||{};return{id:n.id||s.gid||s.objectid||s.OBJECTID,properties:s,feature:n}}queryLayerFeatureByPoint(n,s){return he(this,arguments,function*(e,t,a={}){var C,x,E;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",d=t.lng-o,h=t.lat-o,g=t.lng+o,m=t.lat+o,L=yield wr(e.layerName,{cqlFilter:`BBOX(${u},${d},${h},${g},${m})`,maxFeatures:8,timeout:12e3}),S=this.pickFeatureAtPoint((L==null?void 0:L.features)||[],t,a);return S?{id:S.id||((C=S.properties)==null?void 0:C.gid)||((x=S.properties)==null?void 0:x.objectid)||((E=S.properties)==null?void 0:E.OBJECTID),properties:S.properties||{},feature:S}:null})}pickFeatureAtPoint(e,t,a={}){var s;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:((s=e.map(o=>({feature:o,distance:this.getGeometryDistanceScore(o.geometry,t)})).sort((o,u)=>o.distance-u.distance)[0])==null?void 0:s.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,s=e.lat;for(let o=0,u=t.length-1;os!=S>s&&n<(L-g)*(s-m)/(S-m)+g&&(a=!a)}return a}isPointOnSegment(e,t,a,n,s,o){const u=(e-a)*(o-n)-(t-n)*(s-a);return Math.abs(u)>1e-10?!1:(e-a)*(e-s)+(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,d)=>this.getGeometryAreaScore(u.geometry)-this.getGeometryAreaScore(d.geometry));if(n.length)return n[0];const s=a.find(u=>this.isPointOrLineNearLngLat(u.geometry,e));return s||null}pickPointFeatureAtScreenPoint(e,t){var s;if(!t||!((s=this.camera)!=null&&s.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 h=Number(e==null?void 0:e[0]),g=Number(e==null?void 0:e[1]);if(!Number.isFinite(h)||!Number.isFinite(g))return new re(0,0,Number(t)||0);const[m,L]=this.geoProjection([h,g]);return new re(m,-L,Number(t)||0)},n=this.topicLayerUvBounds;if(!n)return a();const s=this.lngLatToLayerCanvasPoint(e),o=this.topicLayerCanvas;if(!(o!=null&&o.width)||!(o!=null&&o.height))return a();const u=n.left+s.x/o.width*(n.right-n.left),d=n.bottom+(o.height-s.y)/o.height*(n.top-n.bottom);return new re(u,d,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 s=this.lngLatToWorldPoint([a,n],t);return this.worldPointToScreenPoint(s)}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,S,C,x;const t=String(e||"").trim();if(!t)return!1;const a=(this.currentVectorFeatures||[]).filter(E=>{var D;return String(((D=E==null?void 0:E.properties)==null?void 0:D.project_name)||"").trim()===t});if(!a.length)return(S=(L=this.callbacks).onLayerStatus)==null||S.call(L,{type:"success",text:"当前项目图斑尚未加载"}),!1;const n=this.getFeatureListLngLatBounds(a);if(!n)return!1;const s=this.getProjectHighlightFeatures(a);s.length?(this.showSelectedFeatures(s),this.setSelectedVectorFeatures(s)):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),d=Math.max(.22,Math.min(.55,u*1.25)),h=this.lngLatToWorldPoint(o,.72),g=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(d),m=h.clone().add(g);return this.animateMapCamera(m,h,.75),(x=(C=this.callbacks).onLayerStatus)==null||x.call(C,{type:"success",text:"已定位项目"}),!0}setBoundaryDrawing(e){var t,a,n,s;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:"请在地图上依次点击绘制分析边界"})):(s=(n=this.callbacks).onLayerStatus)==null||s.call(n,{type:"success",text:"已退出边界绘制"}),this.redrawVectorTopicLayer()}addBoundaryDrawPoint(e){var s,o,u,d;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=(s=this.callbacks).onDrawBoundary)==null||o.call(s,{status:"drawing",points:this.boundaryDrawPoints,pointCount:this.boundaryDrawPoints.length}),(d=(u=this.callbacks).onLayerStatus)==null||d.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,d,h,g,m;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 s={type:"Feature",properties:{source:"draw",pointCount:e.length},geometry:{type:"Polygon",coordinates:[t]}};return this.boundaryDrawingEnabled=!1,this.boundaryDrawPoints=[],this.lastBoundaryDrawPoint=null,this.analysisBoundaryFeature=s,(h=(d=this.callbacks).onDrawBoundary)==null||h.call(d,{status:"complete",feature:s,points:e,pointCount:e.length}),(m=(g=this.callbacks).onLayerStatus)==null||m.call(g,{type:"success",text:"分析边界已生成"}),this.redrawVectorTopicLayer(),s}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 s;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):(s=this.analysisBoundaryFeature)!=null&&s.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,s;const a=[...this.normalizePastureGrasslandRows(e==null?void 0:e.grasslands),...this.normalizePastureGrasslandRows(e==null?void 0:e.wkt)].map((o,u)=>{const d=this.normalizePastureGrasslandGeometry(o);if(!d)return null;const h=this.normalizePastureGrasslandProperties(o);return{type:"Feature",properties:$(R({},h),{id:h.id||h.gid||`${(e==null?void 0:e.name)||"pasture"}-${u}`,pasture_name:(e==null?void 0:e.name)||h.pastureName||h.name}),geometry:d}}).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(s=(n=this.callbacks).onLayerStatus)==null||s.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 m,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]),s=Number(a==null?void 0:a[1]);if(!Number.isFinite(n)||!Number.isFinite(s))return!1;const o=Number(t.span),u=Number.isFinite(o)?Math.max(.2,Math.min(.55,o*1.25)):.32,d=this.lngLatToWorldPoint([n,s],.72),h=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(u),g=d.clone().add(h);return this.animateMapCamera(g,d,t.duration||.75),(L=(m=this.callbacks).onLayerStatus)==null||L.call(m,{type:"success",text:t.statusText||"已定位"}),!0}getProjectHighlightFeatures(e){const t=e.filter(n=>{var o;const s=String(((o=n==null?void 0:n.geometry)==null?void 0:o.type)||"");return s.includes("Polygon")||s.includes("LineString")}),a=t.filter(n=>{var s;return((s=n==null?void 0:n.properties)==null?void 0:s.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)}:R({},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 s=1;ss.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(([s,o])=>{o==null||o===""||(e[s]===void 0||e[s]===null||e[s]==="")&&(e[s]=o)}),n==="basic-grassland"){const s=(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);s!=null&&s!==""&&(e.basic_type_name=s)}if(n==="grassland-level"){const s=(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);s!=null&&s!==""&&(e.grassland_level=s)}if(n==="grassland-type"||n==="wetland-type"){const s=(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);s!=null&&s!==""&&(e.grass_min_type=s)}if(n==="grassland-yield"||n==="wetland-yield"){const s=(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);s!=null&&s!==""&&(e.fresh_grass_yield=s),o!=null&&o!==""&&(e.mu_yield=o)}if(n==="grassland-health"){const s=(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);s!=null&&s!==""&&(e.health_level=s),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,d,h;const a=(h=(((d=(u=this.interactionManager)==null?void 0:u.raycaster)==null?void 0:d.intersectObject(e.target,!1))||[])[0])==null?void 0:h.point;if(!a)return null;const n=this.focusMapGroup.worldToLocal(a.clone()),o=Ht().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-U.west)/(U.east-U.west)*At.width,n=(U.north-t)/(U.north-U.south)*At.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 s;const n=(a==null?void 0:a.geometry)||((s=a==null?void 0:a.feature)==null?void 0:s.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:xr,fillOpacity:t?.46:a?.24:.54,lineColor:Vu,lineOpacity:.98,glowColor:Nr,glowOpacity:t?.92:.96,renderOrderBase:t?42:a?40:35,boundary:t||a,boundaryColor:xr,boundaryGlowColor:Nr,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),s=new be({color:a.fillColor,transparent:!0,opacity:a.fillOpacity,side:Re,depthWrite:!1,fog:!1}),o=new Jt({color:a.lineColor,transparent:!0,opacity:a.lineOpacity,linewidth:2,depthTest:!1,depthWrite:!1,fog:!1}),u=new Jt({color:a.glowColor,transparent:!0,opacity:a.glowOpacity,linewidth:3,depthTest:!1,depthWrite:!1,fog:!1}),d=a.boundary?new be({color:a.boundaryColor,transparent:!0,opacity:a.boundaryOpacity,side:Re,depthTest:!1,depthWrite:!1,fog:!1}):null,h=a.boundary?new be({color:a.boundaryGlowColor,transparent:!0,opacity:a.boundaryGlowOpacity,side:Re,depthTest:!1,depthWrite:!1,fog:!1,blending:Ie}):null;n.length&&n.forEach(m=>{const L=this.createProjectedShape(m);if(!L)return;const S=new Il(L),C=new qe(S,s);C.renderOrder=a.renderOrderBase,this.selectedFeatureGroup.add(C),m.forEach(x=>{const E=this.createProjectedRingPoints(x);if(E.length<3)return;a.boundary&&(this.addSelectedBoundaryBand(E,h,a.boundaryGlowWidth,a.renderOrderBase+1,!0),this.addSelectedBoundaryBand(E,d,a.boundaryWidth,a.renderOrderBase+4,!0));const D=new ya().setFromPoints(E),Q=new or(D,o);Q.renderOrder=a.renderOrderBase+5,this.selectedFeatureGroup.add(Q);const se=new ya().setFromPoints(E),Z=new or(se,u);Z.renderOrder=a.renderOrderBase+3,Z.scale.set(1.004,1.004,1),this.selectedFeatureGroup.add(Z)})});const g=this.normalizeFeatureLineStrings(e);g.length&&g.forEach(m=>{const L=this.createProjectedRingPoints(m);if(L.length<2)return;a.boundary&&(this.addSelectedBoundaryBand(L,h,a.boundaryGlowWidth,a.renderOrderBase+1,!1),this.addSelectedBoundaryBand(L,d,a.boundaryWidth,a.renderOrderBase+4,!1));const S=new ya().setFromPoints(L),C=new lr(S,u);C.renderOrder=a.renderOrderBase+3,C.scale.set(1.004,1.004,1),this.selectedFeatureGroup.add(C);const x=new ya().setFromPoints(L),E=new lr(x,o);E.renderOrder=a.renderOrderBase+5,this.selectedFeatureGroup.add(E)})}addSelectedBoundaryBand(e,t,a,n,s=!0){if(!t||!this.selectedFeatureGroup)return;const o=this.createPathBandGeometry(e,a,s);if(!o)return;const u=new qe(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 s=Math.max(Number(t)||0,0)/2;if(!s)return null;const o=[],u=a?n.length:n.length-1;for(let h=0;hNumber.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],s=a[a.length-1];n.distanceToSquared(s)<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(s=>e.add(s)):e.add(n.material)}e.forEach(n=>{var s;return(s=n==null?void 0:n.dispose)==null?void 0:s.call(n)})}normalizeFeaturePolygons(e){return zr(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 s=this.clipRingToBounds(n==null?void 0:n[0],a);if(s.length<3)return null;const o=n.slice(1).map(u=>this.clipRingToBounds(u,a)).filter(u=>u.length>=3);return[s,...o]}).filter(Boolean):t}clipRingToBounds(e=[],t){let a=e.map(s=>[Number(s==null?void 0:s[0]),Number(s==null?void 0:s[1])]).filter(([s,o])=>Number.isFinite(s)&&Number.isFinite(o));return[{inside:([s])=>s>=t.west,intersect:(s,o)=>this.getLngLatLineIntersection(s,o,"lng",t.west)},{inside:([s])=>s<=t.east,intersect:(s,o)=>this.getLngLatLineIntersection(s,o,"lng",t.east)},{inside:([,s])=>s>=t.south,intersect:(s,o)=>this.getLngLatLineIntersection(s,o,"lat",t.south)},{inside:([,s])=>s<=t.north,intersect:(s,o)=>this.getLngLatLineIntersection(s,o,"lat",t.north)}].forEach(s=>{const o=a;a=[],o.length&&o.forEach((u,d)=>{const h=o[(d+o.length-1)%o.length],g=s.inside(u),m=s.inside(h);g?(m||a.push(s.intersect(h,u)),a.push(u)):m&&a.push(s.intersect(h,u))})}),a}getLngLatLineIntersection(e,t,a,n){const s=a==="lng"?0:1,o=a==="lng"?1:0,u=t[s]-e[s];if(!u)return[...e];const d=(n-e[s])/u,h=[...e];return h[s]=n,h[o]=e[o]+(t[o]-e[o])*d,h}createProjectedShape(e){const t=e==null?void 0:e[0];if(!Array.isArray(t)||t.length<3)return null;const a=new ur;return this.createProjectedRingPoints(t).forEach((s,o)=>{o===0?a.moveTo(s.x,s.y):a.lineTo(s.x,s.y)}),e.slice(1).forEach(s=>{const o=this.createProjectedRingPoints(s);if(o.length<3)return;const u=new ur;o.forEach((d,h)=>{h===0?u.moveTo(d.x,d.y):u.lineTo(d.x,d.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]),s=Number(a[1]);if(!Number.isFinite(n)||!Number.isFinite(s))return;const[o,u]=this.geoProjection([n,s]);t.push(new re(o,-u,0))}),t}enhanceTexture(e){var a,n,s;const t=(n=(a=this.renderer)==null?void 0:a.instance)==null?void 0:n.capabilities;e.anisotropy=((s=t==null?void 0:t.getMaxAnisotropy)==null?void 0:s.call(t))||1,e.needsUpdate=!0}geoProjection(e){return Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0])(e)}updateTownLabelScale(){var u,d,h;const e=this.townNameLabels||this.otherLabel||[],t=(u=this.camera)==null?void 0:u.instance,a=(h=(d=this.camera)==null?void 0:d.controls)==null?void 0:h.target;if(!e.length||!t||!a)return;const n=t.position.distanceTo(a),s=Yt(n*72e-5,.011,.026),o=n>45?"0.76":n<22?"0.94":"1";e.forEach(g=>{var L,S,C;if(((L=g==null?void 0:g.userData)==null?void 0:L.labelType)!=="town-label")return;g.scale.set(s,s,s);const m=(C=(S=g.element)==null?void 0:S.querySelector)==null?void 0:C.call(S,".other-label");m&&(m.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(s=>clearTimeout(s)),this.sceneTimers=[],this.sceneTweens.forEach(s=>{var o;return(o=s==null?void 0:s.kill)==null?void 0:o.call(s)}),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(b,{expose:e,emit:t}){const a=b,n=t,s=V(null),o=yl(null);let u=null,d=null,h=null,g=null,m=null,L="",S="",C=!1;Yr(()=>{n("scene-mounted")}),jr(()=>{ct()});function x(M){return o.value?!0:s.value?(o.value=new qu(s.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=Ue(a.activeLayer),S=pt(a.mapRanking),o.value.setTopicLayers(ve(a.activeLayer),a.activeLayer),o.value.setTownRanking(a.mapRanking),ge(),Fe(),!0):!1}function E(){return!!o.value}function D(){return he(this,null,function*(){var M,v,N,z,q,ne;if(o.value&&(Q(),!o.value.mapAnimationComplete)){if(C){(v=(M=o.value.animateTl)==null?void 0:M.play)==null||v.call(M),dt();return}C=!0,(z=(N=o.value.animateTl)==null?void 0:N.timeScale)==null||z.call(N,1),(ne=(q=o.value.animateTl)==null?void 0:q.play)==null||ne.call(q),dt()}})}function Q(){var M,v;o.value&&(ge(),Fe(),window.requestAnimationFrame(()=>{var N,z,q,ne,ce,Ge;(q=(z=(N=o.value)==null?void 0:N.label3d)==null?void 0:z.resize)==null||q.call(z),(Ge=(ce=(ne=o.value)==null?void 0:ne.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 se(){var M,v,N,z,q,ne;o.value&&($e(),(v=(M=o.value.animateTl)==null?void 0:M.pause)==null||v.call(M),(z=(N=o.value).pauseScene)==null||z.call(N),o.value.pauseScene||(ne=(q=o.value.time)==null?void 0:q.pause)==null||ne.call(q),ht())}function Z(){var M,v;(v=(M=o.value)==null?void 0:M.clearSelectedFeature)==null||v.call(M)}function G(M){var v,N;(N=(v=o.value)==null?void 0:v.focusProject)==null||N.call(v,M)}function Ce(M){var v,N;(N=(v=o.value)==null?void 0:v.focusPasture)==null||N.call(v,M)}function je(M,v){var N,z;return(z=(N=o.value)==null?void 0:N.focusTownByName)==null?void 0:z.call(N,M,v)}function et(M){var v,N;return(N=(v=o.value)==null?void 0:v.focusYakIndustryPoint)==null?void 0:N.call(v,M)}function vt(M){var v,N;return(N=(v=o.value)==null?void 0:v.focusVectorFeature)==null?void 0:N.call(v,M)}function W(M){var v,N;return(N=(v=o.value)==null?void 0:v.getVectorFeatureScreen)==null?void 0:N.call(v,M)}function He(M){var v,N;return(N=(v=o.value)==null?void 0:v.getYakIndustryPointScreen)==null?void 0:N.call(v,M)}function tt(M){var v,N;(N=(v=o.value)==null?void 0:v.setBoundaryDrawing)==null||N.call(v,M)}function Ft(){var M,v;return(v=(M=o.value)==null?void 0:M.finishBoundaryDrawing)==null?void 0:v.call(M)}function ut(){var M,v;(v=(M=o.value)==null?void 0:M.undoBoundaryPoint)==null||v.call(M)}function xt(){var M,v;(v=(M=o.value)==null?void 0:M.clearAnalysisBoundary)==null||v.call(M)}function Kt(M){var v,N;(N=(v=o.value)==null?void 0:v.showAnalysisResult)==null||N.call(v,M)}function ct(){var M,v;$e(),ht(),(v=(M=o.value)==null?void 0:M.destroy)==null||v.call(M),o.value=null}function dt(){$e(),m=window.setTimeout(()=>{var M,v;m=null,(v=(M=o.value)==null?void 0:M.ensureMapRevealed)==null||v.call(M)},5200)}function $e(){m&&(window.clearTimeout(m),m=null)}function Fe(){d&&window.cancelAnimationFrame(d),d=window.requestAnimationFrame(()=>{var M,v,N,z,q;d=null,(N=(v=(M=o.value)==null?void 0:M.sizes)==null?void 0:v.init)==null||N.call(v),(q=(z=o.value)==null?void 0:z.resize)==null||q.call(z)}),h&&window.clearTimeout(h),h=window.setTimeout(()=>{var M,v,N,z,q;h=null,(N=(v=(M=o.value)==null?void 0:M.sizes)==null?void 0:v.init)==null||N.call(v),(q=(z=o.value)==null?void 0:z.resize)==null||q.call(z)},180)}function ge(){var v;ht();const M=(v=s.value)==null?void 0:v.parentNode;M&&window.ResizeObserver&&(u=new ResizeObserver(()=>Fe()),u.observe(M)),g=window.setInterval(xe,1e3),jt(Fe)}function xe(){var ce;if(!o.value||!s.value)return;const M=s.value.parentNode,v=(M==null?void 0:M.offsetWidth)||window.innerWidth||1,N=(M==null?void 0:M.offsetHeight)||window.innerHeight||1,z=((ce=o.value.sizes)==null?void 0:ce.pixelRatio)||1,q=Math.floor(v*z),ne=Math.floor(N*z);(s.value.width!==q||s.value.height!==ne)&&Fe()}function ht(){u&&(u.disconnect(),u=null),d&&(window.cancelAnimationFrame(d),d=null),h&&(window.clearTimeout(h),h=null),g&&(window.clearInterval(g),g=null)}function wt(){if(!o.value)return;ge();const M=()=>{var v,N,z,q,ne,ce,Ge,ze,_e,Be,Ae,Ke,at,fe,me,ee,it,ft,Me,Lt,Tt;o.value&&((N=(v=o.value)==null?void 0:v.resumeScene)==null||N.call(v),o.value.resumeScene||(q=(z=o.value.time)==null?void 0:z.resume)==null||q.call(z),(Ge=(ce=(ne=o.value)==null?void 0:ne.sizes)==null?void 0:ce.init)==null||Ge.call(ce),(_e=(ze=o.value)==null?void 0:ze.resize)==null||_e.call(ze),(Ke=(Ae=(Be=o.value)==null?void 0:Be.label3d)==null?void 0:Ae.resize)==null||Ke.call(Ae),(me=(fe=(at=o.value)==null?void 0:at.label3d)==null?void 0:fe.update)==null||me.call(fe),(it=(ee=o.value)==null?void 0:ee.setTopicLayers)==null||it.call(ee,ve(a.activeLayer),a.activeLayer),(Me=(ft=o.value)==null?void 0:ft.setTownRanking)==null||Me.call(ft,a.mapRanking),(Tt=(Lt=o.value)==null?void 0:Lt.ensureMapRevealed)==null||Tt.call(Lt))};Fe(),window.requestAnimationFrame(M),window.setTimeout(()=>{M()},80),window.setTimeout(()=>{M()},220)}function Ve(){if(!o.value)return;ge();const M=()=>{var N,z,q,ne,ce,Ge,ze,_e,Be,Ae,Ke,at,fe,me,ee,it;const v=o.value;v&&((N=v.resumeScene)==null||N.call(v),v.resumeScene||(q=(z=v.time)==null?void 0:z.resume)==null||q.call(z),(ce=(ne=v.sizes)==null?void 0:ne.init)==null||ce.call(ne),(Ge=v.resize)==null||Ge.call(v),(ze=v.ensureMapRevealed)==null||ze.call(v),(_e=v.setTradeNationalMapVisible)==null||_e.call(v,!1),(Be=v.setTopicLayers)==null||Be.call(v,ve(a.activeLayer),a.activeLayer),(Ae=v.setTownRanking)==null||Ae.call(v,a.mapRanking),(Ke=v.applyLayerMapView)==null||Ke.call(v,v.currentTopicLayer||a.activeLayer||null,{force:!0}),(fe=(at=v.label3d)==null?void 0:at.resize)==null||fe.call(at),(ee=(me=v.label3d)==null?void 0:me.update)==null||ee.call(me),(it=v.updateDynamicSatelliteTiles)==null||it.call(v,!0))};Fe(),window.requestAnimationFrame(M),window.setTimeout(M,100),window.setTimeout(M,260)}qt(()=>a.activeLayer,M=>{const v=Ue(M);v!==L&&(L=v,o.value&&o.value.setTopicLayers(ve(M),M))},{deep:!0}),qt(()=>a.mapRanking,M=>{const v=pt(M);v!==S&&(S=v,o.value&&o.value.setTownRanking(M))},{deep:!0}),e({loadMap:x,hasMap:E,play:D,resume:Q,pause:se,clearSelectedFeature:Z,focusProject:G,focusPasture:Ce,focusTown:je,focusYakIndustryPoint:et,focusVectorFeature:vt,getVectorFeatureScreen:W,getYakIndustryPointScreen:He,setBoundaryDrawing:tt,finishBoundaryDrawing:Ft,undoBoundaryPoint:ut,clearAnalysisBoundary:xt,showAnalysisResult:Kt,refreshView:wt,resetView:Ve,destroyMap:ct,canvasMap:o});function Ue(M){return M?ve(M).map(v=>{var N,z;return[v.key||"",v.layerName||"",v.styles||"",v.sldBody||"",v.cqlFilter||"",((N=v.activeLegend)==null?void 0:N.key)||"",Array.isArray(v.activeLegends)?v.activeLegends.map(q=>(q==null?void 0:q.key)||"").join(","):"",v.timelineDate||"",((z=v.timelineItem)==null?void 0:z.key)||"",v.sourceType||"",v.dataPath||"",v.fallbackPath||""].join("|")}).join("||"):""}function ve(M){if(!M)return[];const v=Array.isArray(M.overlayLayers)?M.overlayLayers.filter(Boolean):[];return[M,...v]}function pt(M){var v,N,z,q,ne,ce,Ge,ze,_e,Be;return M?[M.status||"",M.topicKey||"",M.layerKey||"",M.title||"",M.metricLabel||"",M.scope||"",M.displayMode||"",(v=M.showPointMarkers)!=null?v:"",(N=M.showBars)!=null?N:"",(z=M.showTownNames)!=null?z:"",(q=M.showMapLabels)!=null?q:"",(ne=M.hideTownLabelStats)!=null?ne:"",(ce=M.showFlowLines)!=null?ce:"",(Ge=M.onlyRankedTownLabels)!=null?Ge:"",(ze=M.showMissingTownStats)!=null?ze:"",((_e=M.rows)==null?void 0:_e.length)||0,((Be=M.rows)==null?void 0:Be.map(Ae=>{var Ke;return`${Ae.key||Ae.name||""}:${(Ke=Ae.value)!=null?Ke:""}`}).join(","))||""].join("|"):""}return(M,v)=>(I(),_("div",Uu,[f("canvas",{ref_key:"canvasRef",ref:s},null,512)]))}};const Zu={class:"yak-management"},Xu={key:1,class:"yak-map-loading"},Ju={class:"yak-management-ui"},Qu={key:0,class:"trade-year-switcher","aria-label":"交易年份切换"},ec=["onClick"],tc={key:1,class:"epidemic-year-switcher","aria-label":"防疫年份切换"},ac=["onClick"],ic={key:2,class:"forecast-year-switcher","aria-label":"预测年份切换"},nc=["onClick"],rc={class:"yak-left"},sc={class:"yak-side-stack is-left"},oc={class:"breeding-health-card"},lc={class:"breeding-health-head"},uc={class:"breeding-health-grid"},cc={class:"structure-chart-card"},dc={class:"structure-ratio-card"},hc={class:"structure-ratio-chart"},pc={viewBox:"0 0 150 150",preserveAspectRatio:"xMidYMid meet","aria-hidden":"true"},fc={class:"structure-rose-segments"},mc=["d","fill","stroke"],gc={class:"structure-ratio-list"},yc={key:0,class:"yak-data-status"},bc={key:1,class:"yak-data-status is-warning"},vc={class:"forecast-waterfall-card"},wc={class:"forecast-waterfall-head"},Lc={class:"forecast-waterfall-list"},Tc={class:"forecast-trend-card"},Sc={class:"forecast-density-switcher","aria-label":"预测粒度切换"},Mc=["onClick"],kc={key:0,class:"epidemic-three-pie-card"},Pc={class:"epidemic-three-pie-visual"},Cc={class:"epidemic-three-pie-center"},Fc={class:"epidemic-three-pie-legend"},xc={key:1,class:"epidemic-empty"},Nc={class:"trade-risk-card"},Rc={class:"trade-risk-head"},Ic={class:"trade-risk-list"},Gc={class:"yak-right"},_c={class:"yak-side-stack is-right"},Bc={class:"structure-chart-card"},Ac={class:"structure-summary-card"},Ec={key:0,class:"yak-data-status"},$c={key:1,class:"yak-data-status is-warning"},Vc={class:"forecast-heat-list"},zc=["title"],Oc={class:"epidemic-record-table is-full"},Dc={class:"epidemic-record-toolbar"},Wc={class:"epidemic-record-rows"},Yc=["onClick"],jc={key:0,class:"epidemic-empty"},Hc={class:"epidemic-record-pager"},qc=["disabled"],Uc=["disabled"],Kc={class:"trade-cert-card"},Zc={class:"trade-cert-main"},Xc={class:"trade-dest-list"},Jc={key:0,class:"epidemic-empty"},Qc={class:"trade-ledger-table"},ed={class:"trade-ledger-toolbar"},td={class:"trade-ledger-rows"},ad=["onClick"],id={key:0,class:"epidemic-empty"},nd={class:"trade-ledger-pager"},rd=["disabled"],sd=["disabled"],od={class:"yak-bottom-topic"},ld={key:3,class:"yak-map-layer-tools"},ud={class:"epidemic-ledger-dialog"},cd={class:"epidemic-ledger-dialog-head"},dd={class:"epidemic-ledger-filters"},hd=["value"],pd=["value"],fd={class:"epidemic-ledger-workspace"},md={class:"epidemic-ledger-list"},gd=["onClick"],yd={key:0,class:"epidemic-empty"},bd={class:"epidemic-ledger-detail trade-ledger-detail epidemic-ledger-record-detail"},vd={class:"epidemic-detail-head trade-detail-head"},wd={class:"epidemic-detail-grid is-modal trade-detail-grid epidemic-detail-flat-grid"},Ld={key:0,class:"epidemic-detail-photos"},Td={class:"epidemic-modal-photo-strip"},Sd=["onClick"],Md=["src"],kd={class:"epidemic-ledger-pager"},Pd=["disabled"],Cd=["disabled"],Fd={class:"epidemic-ledger-dialog trade-ledger-dialog"},xd={class:"epidemic-ledger-dialog-head"},Nd={class:"epidemic-ledger-filters trade-ledger-filters"},Rd=["value"],Id=["value"],Gd=["value"],_d={class:"epidemic-ledger-workspace trade-ledger-workspace"},Bd={class:"epidemic-ledger-list trade-ledger-modal-list"},Ad=["onClick"],Ed={key:0,class:"epidemic-empty"},$d={class:"epidemic-ledger-detail trade-ledger-detail"},Vd={class:"epidemic-detail-head trade-detail-head"},zd={class:"epidemic-detail-grid is-modal trade-detail-grid"},Od={class:"is-wide"},Dd={class:"is-wide"},Wd={class:"is-wide"},Yd={class:"is-wide"},jd=["disabled"],Hd={class:"epidemic-ledger-pager"},qd=["disabled"],Ud=["disabled"],Kd={class:"epidemic-image-preview-dialog"},Zd={class:"epidemic-image-preview-head"},Xd={class:"epidemic-image-preview-body"},Jd={class:"epidemic-image-preview-frame"},Qd=["src"],eh="https://qkl-hy.oss-cn-chengdu.aliyuncs.com/yak-vaccine-images",th="https://qkl-map.oss-cn-chengdu.aliyuncs.com/hy-result/{z}/{x}/{y}.png",ah=8.85,ih="oss-satellite-dynamic-zoom21-v5",ai=8,Or=14,Ki=12,Dr=14,nh=5e3,ii=6,rh=4200,Wr="#FFE600",Th={__name:"index",props:{active:{type:Boolean,default:!0},viewKey:{type:String,default:"structure"}},emits:["module-stats","view-change"],setup(b,{expose:e,emit:t}){const a=b,n=t,s=cr.sideCardWidth;cr.sideCardGap;const o=V(typeof window=="undefined"?1080:window.innerHeight),u=k(()=>_l(o.value)),d=k(()=>dr(u.value,2)),h=k(()=>u.value),g=k(()=>dr(u.value,2)),m=ba.textPrimary,L=ba.textStrong,S=ba.textSecondary,C=ba.textMuted,x=ba.chartGridLine,E=[102.58,32.72],D=E,Q=E,se={lng:0,lat:-.065},Z={targetLngLat:[102.6,32.59],targetLocalZ:.72,distanceScale:1.05,duration:.75},G=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff"],Ce=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff"],je=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff","#48cfff"],et={name:"红原牦牛交易市场",lng:102.562157,lat:32.820484},vt=[{key:"structure",name:"畜群结构",color:"#30dcff"},{key:"forecast",name:"畜群预测",color:"#8bf7ff"},{key:"epidemic",name:"牦牛防疫",color:"#8bf7ff"},{key:"trade",name:"牦牛交易",color:"#63d7ff"}],W=V(Di(a.viewKey)),He=V([]),tt=V("2027"),Ft=V("month"),ut=V(0),xt=V([]),Kt=V([]),ct=V([]),dt=V(!1),$e=V(""),Fe=[2025,2026],ge=V(2026),xe=V({metrics:{}}),ht=V({rows:[],year:null}),wt=V({rows:[]}),Ve=V([]),Ue=V(0),ve=V(1),pt=V(""),M=V(""),v=V(!1),N=V(""),z=V(!1),q=V([]),ne=V(0),ce=V(1),Ge=V(!1),ze=V(""),_e=V(null),Be=V(null),Ae=V(!1),Ke=V(!1),at=V(""),fe=V(za()),me=V({years:[],latestYear:null}),ee=V({metrics:{},hasData:!1}),it=V([]),ft=V(0),Me=V(null),Lt=V(!1),Tt=V(""),St=V(1),Ma=V(""),ri=V(""),si=V(!1),Et=V([]),ka=V(0),$t=V(1),oi=V(!1),li=V(""),Pa=V(null),mt=V({keyword:"",startTown:"",usageType:"",certType:""}),Oe=V(null),oa=V(null),Vt=V(!1),la=V(!1),Ji=V(0),Qi=V(0),ua=V({type:"idle",text:""}),ca=V({type:"idle",text:""});let ui=null,ci=!1,Mt=!1,kt=null,da=!1,Ca=null,Fa=null,xa=0;const di=[{key:"day",label:"日",unit:"日",stepDays:1},{key:"week",label:"周",unit:"周",stepDays:7},{key:"month",label:"月",unit:"月",stepDays:30}],Ze=k(()=>Dl(tt.value)),Ur=new Set(["epidemic","trade"]),hi=k(()=>!Ur.has(W.value)),en=k(()=>hi.value?th:""),Kr=k(()=>hi.value?"oss-satellite":"solid-3d"),Zr=k(()=>`yak-management-map-${Kr.value}-${ih}-${Ji.value}`),Xr=k(()=>Wl+Yl),pi=k(()=>Ze.value.stock-ot),Jr=k(()=>hl(Ze.value)),Na=k(()=>al(ct.value,wa)),Qr=k(()=>Na.value.reduce((i,r)=>i+Number(r.count||0),0));k(()=>{const i=Qr.value||1;return Na.value.map((r,l)=>{const c=Number(r.count||0),p=Number(r.ratio);return $(R({},r),{count:c,color:G[l%G.length],percent:Number.isFinite(p)?p:c/i*100})})});const es=k(()=>Jn(Na.value,wa)),Ra=k(()=>es.value),tn=k(()=>ol(Ra.value)),an=k(()=>ll(Na.value,wa)),nn=k(()=>cl(an.value)),ts=k(()=>Math.max(...tn.value.map(i=>Number(i.count||0)),1)),fi=k(()=>Ra.value.length?0:-1),as=k(()=>{const i=Ra.value,r=i.length;if(!r)return[];const l=Math.max(...i.map(y=>Number(y.count||0)),1),c=360/r,p=Math.min(8,c*.16);return i.map((y,w)=>{const T=Number(y.count||0),F=w===fi.value,B=36+Math.sqrt(T/l)*31+(F?5:0),A=17,Y=-90+w*c+p/2,X=-90+(w+1)*c-p/2,O=(Y+X)/2,J=Dt(75,75,B+3,O),Ne=Dt(75,75,B+15,O),rt=Dt(75,75,B+20,O);return{key:y.key||y.name||w,index:w,item:y,color:y.color||G[w%G.length],path:sl(75,75,A,B,Y,X),lineStart:J,lineEnd:Ne,label:rt,anchor:Math.cos(O*Math.PI/180)>=0?"start":"end"}})}),rn=k(()=>Zn(["fertileCow","overageCow"])),sn=k(()=>Zn(["femaleCalf","maleCalf"])),Nt=k(()=>jl(mo(xt.value.length?xt.value:gr,gr),ot)),mi=k(()=>gu),gi=k(()=>Hl(Ze.value)),is=k(()=>ql(Ze.value)),yi=k(()=>{var i;return((i=xe.value)==null?void 0:i.metrics)||{}}),bi=k(()=>{var i;return Pt((i=xe.value)==null?void 0:i.dateTrend).sort(Mo)}),Ia=k(()=>{var i;return Pt((i=xe.value)==null?void 0:i.medicineCounts)}),Ga=k(()=>Ia.value.filter(i=>i.value>0).map((i,r)=>$(R({},i),{key:i.key||`${i.name}-${r}`,unit:"条"}))),ns=k(()=>Ga.value.map(i=>`${i.name}:${i.value}`).join("|")||"epidemic-medicine-empty"),rs=k(()=>{var i;return Pt((i=xe.value)==null?void 0:i.ownerRanks).slice(0,8)}),Rt=k(()=>yn(xe.value)),ss=k(()=>{var i;return((i=Ia.value.find(r=>r.name&&r.name!=="未填写"))==null?void 0:i.name)||"-"}),gt=k(()=>Da(yi.value,["total","vaccine"]));k(()=>Da(yi.value,["owners"]));const os=k(()=>Number(ge.value)===2026?10:Da(yi.value,["villages"])),vi=k(()=>zt.value.length),ls=k(()=>{var i;return((i=zt.value[0])==null?void 0:i.name)||"-"}),on=k(()=>{const i=Ve.value.map(r=>r.operateTime).filter(Boolean).sort();return i.length?Gt(i[i.length-1]):"-"}),wi=k(()=>{const i=Math.max(...Ia.value.map(r=>Number(r.value||0)),0);return i>0?i:Math.round(gt.value/Rt.value)}),Li=k(()=>{var r;const i=bo((r=ht.value)==null?void 0:r.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"}))}),ln=k(()=>{var r;const i=new Set;return Ai((r=wt.value)==null?void 0:r.rows).filter(l=>Number.isFinite(l.lng)&&Number.isFinite(l.lat)).map((l,c)=>{const p=`${l.lng.toFixed(4)},${l.lat.toFixed(4)}`,y=i.has(p)?(c%3-1)*.012:0;return i.add(p),$(R({},l),{name:l.village,value:l.earTagCount,unit:"万头",lng:l.lng+y,lat:l.lat-y*.65,displayValue:Number((l.earTagCount/1e4).toFixed(2)),displayUnit:"万头",rankLabel:`第${c+1}名`})})}),zt=k(()=>{var r;const i=new Map;return Pt((r=xe.value)==null?void 0:r.townCounts).forEach(l=>{const c=Xe(l.name);c&&i.set(c,Number(i.get(c)||0)+Number(l.value||0))}),[...i.entries()].map(([l,c])=>{const p=Math.round(c/Rt.value),y=gt.value?c/gt.value*100:0;return{name:l,recordCount:c,earTagCount:p,ratio:y}}).sort((l,c)=>Number(c.recordCount||0)-Number(l.recordCount||0))}),us=k(()=>Math.max(Nt.value.length,vi.value)),cs=k(()=>new Set(zt.value.map(i=>Xe(i.name)).filter(Boolean))),It=k(()=>{const i=cs.value;return Nt.value.map(r=>Xe(r.name)).filter(r=>r&&!i.has(r))}),ds=k(()=>{const i=us.value||vi.value||1;return vi.value/i*100});k(()=>wi.value/ot*100);const _a=k(()=>Po());k(()=>gt.value?It.value.length?It.value.length:_a.value.name&&_a.value.name!=="暂无"?1:0:0);const hs=k(()=>Co()),ps=k(()=>Fo()),fs=k(()=>xo());k(()=>No());const ms=k(()=>Ro());k(()=>ms.value.slice(0,3)),k(()=>gt.value?It.value.length?"年度免疫进度需核查":_a.value.desc:"年度计划待核查");const Ti=k(()=>Math.max(Math.ceil(Ue.value/ai),1)),gs=k(()=>Ve.value.slice(0,ai)),un=k(()=>Math.max(Math.ceil(ne.value/Or),1)),Ot=k(()=>Be.value||_e.value||{}),cn=k(()=>$i(Ot.value)),ys=k(()=>{const i=Ot.value||{};return[ke("台账编号",i.epidemicId,{wide:!0}),ke("养殖户",i.owner,{wide:!0}),ke("联系电话",Pn(i.phone)),ke("证件类型",i.idType),ke("证件号码",Bo(i.idNo)),ke("镇/乡",i.town),ke("村",i.village),ke("详细地址",i.location,{wide:!0}),ke("畜种",i.livestockType),ke("性别",i.sex),ke("畜龄",i.age),ke("体重",Ao(i.weight)),ke("疫苗/药品",i.medicine),ke("防疫类型",i.preventionType),ke("免疫方式",i.method),ke("剂量",Eo(i.dose)),ke("免疫时间",Gt(i.operateTime)),ke("操作员",i.operator)].filter(Boolean)}),bs=k(()=>{var i;return Pt((i=xe.value)==null?void 0:i.townCounts).map(r=>r.name)}),vs=k(()=>Ia.value.map(i=>i.name).filter(i=>i&&i!=="未填写")),dn=k(()=>{var i;return((i=ee.value)==null?void 0:i.metrics)||{}}),hn=k(()=>{var i,r,l,c,p,y,w,T;return bn((i=me.value)==null?void 0:i.years,(r=ee.value)==null?void 0:r.availableYears,(l=ee.value)==null?void 0:l.available_years,(c=ee.value)==null?void 0:c.yearSummary,(p=ee.value)==null?void 0:p.year_summary,(y=ee.value)==null?void 0:y.latestYear,(w=ee.value)==null?void 0:w.latest_year,(T=ee.value)==null?void 0:T.year)}),ws=k(()=>{var i,r;return Oa(((i=ee.value)==null?void 0:i.monthTrend)||((r=ee.value)==null?void 0:r.month_trend),"name")});k(()=>{var i,r;return go(((i=ee.value)==null?void 0:i.yearSummary)||((r=ee.value)==null?void 0:r.year_summary))});const Ba=k(()=>{var i,r;return Oa(((i=ee.value)==null?void 0:i.startTownCounts)||((r=ee.value)==null?void 0:r.start_town_counts),"name")}),Si=k(()=>{var i,r;return Oa(((i=ee.value)==null?void 0:i.usageCounts)||((r=ee.value)==null?void 0:r.usage_counts),"name")}),Ls=k(()=>{var i,r,l,c,p,y;return Oa(((i=ee.value)==null?void 0:i.transportNumberCounts)||((r=ee.value)==null?void 0:r.transport_number_counts)||((l=ee.value)==null?void 0:l.vehicleCounts)||((c=ee.value)==null?void 0:c.vehicle_counts)||((p=ee.value)==null?void 0:p.transportCounts)||((y=ee.value)==null?void 0:y.transport_counts),"transportNumber")}),Aa=k(()=>{const i=Ba.value.map(l=>{const c=String(l.name||"").trim(),p=Xe(c),y=Ri(p||c);return $(R({},l),{rawName:c,name:y,displayName:y,town:p,mapTownName:p})}).filter(l=>l.name&&l.name!=="未填写").slice(0,10),r=Math.max(...i.map(l=>l.headCount),1);return i.map((l,c)=>$(R({},l),{key:l.key||`${l.mapTownName||l.name}-${c}`,value:l.headCount,unit:"头",ratio:Math.max(8,Math.round(l.headCount/r*100))}))}),pn=k(()=>it.value.slice(0,Ki)),Mi=k(()=>Math.max(Math.ceil(ft.value/Ki),1)),ki=k(()=>Math.max(Math.ceil(ka.value/Dr),1)),ye=k(()=>Pa.value||{}),Ts=k(()=>ye.value.certId||ye.value.factoryCode||""),Ss=k(()=>{var r,l;const i=_i(((r=me.value)==null?void 0:r.startTowns)||((l=me.value)==null?void 0:l.start_towns));return i.length?i:Bi(Ba.value.map(c=>c.name))}),Ms=k(()=>{var r,l;const i=_i(((r=me.value)==null?void 0:r.usageTypes)||((l=me.value)==null?void 0:l.usage_types));return i.length?i:Bi(Si.value.map(c=>c.name))}),ks=k(()=>{var r,l,c,p;const i=yo(((r=me.value)==null?void 0:r.certTypeOptions)||((l=me.value)==null?void 0:l.cert_type_options));return i.length?i:_i(((c=me.value)==null?void 0:c.certTypes)||((p=me.value)==null?void 0:p.cert_types)).map(y=>({value:y,label:y}))}),Ps=k(()=>Aa.value.map((i,r)=>({key:i.key||`${i.name}-${r}`,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:"头"}))),fn=k(()=>Io()),Cs=k(()=>{const i=fn.value.filter(r=>r.level==="high");return i.length>=2?`${i.length}项重点`:i.length===1?`重点:${i[0].name}`:"整体平稳"}),Fs=k(()=>Nt.value.map(i=>$(R({},i),{breedingCowRatio:rn.value,calfRatio:sn.value,breedingCow:Math.round(i.count*rn.value/100),calf:Math.round(i.count*sn.value/100)}))),Ea=k(()=>{const i=Fs.value,r=i.length,l=Math.max(Math.ceil(r/ii),1),c=ut.value%l,p=c*ii,y=Math.min(p+ii,r);return{page:c,pageCount:l,start:p,end:y,total:r,rows:i.slice(p,y)}}),xs=k(()=>W.value==="forecast"?gi.value:Nt.value),Ns=k(()=>W.value==="forecast"?"forecast":"count"),Rs=k(()=>Qo(xs.value,Ns.value)),ha=k(()=>({key:"yak-marks-layer",sourceType:"wmts",layerName:"ne:daping_yak_marks",style:"ne:yak_marks",styles:"ne:yak_marks",format:"image/png",tileMatrixSetID:"EPSG:900913",maximumLevel:21,url:"/geoserver/gwc/service/wmts",cqlFilter:"gov_show = true",name:"牦牛识别",opacity:.92,queryBuffer:10,geometryField:"geom",fillColor:"rgba(255, 230, 0, 0)",strokeColor:Wr,glowColor:"rgba(255, 230, 0, 0.42)",lineWidth:1.4,mapView:{targetLngLat:E,distanceScale:.82,targetLocalZ:.76,duration:.85},legends:[{key:"yak-marks",name:"牦牛",fillColor:Wr,strokeColor:"#FFF58A",selectable:!1}]})),Is=k(()=>[ha.value]),Gs=k(()=>{const i=Array.isArray(He.value)?He.value:[He.value];return new Set(i.map(String).filter(Boolean))}),Pi=k(()=>Gs.value.has(ha.value.key)),_s=k(()=>Pi.value?ha.value.legends||[]:[]),Bs=k(()=>Pi.value?202:172),As=k(()=>{var l;const r=Ai((l=wt.value)==null?void 0:l.rows).map(c=>Lo(c.town,c.village)).filter(Boolean);return{key:"yak-epidemic-village-boundary",sourceType:"wfs",layerName:"ne:t_pastures_map",styles:"牧场样式",name:"防疫村边界",opacity:.86,queryBuffer:8,cqlFilter:r.length?r.join(" OR "):"EXCLUDE",legends:[{key:"yak-epidemic-village-boundary",name:"防疫村边界",fillColor:"#30DCFF",strokeColor:"#C9FBFF",selectable:!1}]}}),mn=k(()=>W.value==="epidemic"?As.value:W.value==="trade"?null:nt.value?Pi.value?ha.value:null:ha.value),nt=k(()=>W.value==="structure"||W.value==="forecast"),Es=k(()=>W.value==="forecast"?Q:D),$s=k(()=>nt.value?null:mn.value),Vs=k(()=>nt.value?null:Ds.value),zs=k(()=>nt.value?!la.value:!Vt.value),Os=k(()=>"3D地图加载中"),Ds=k(()=>W.value==="trade"?{scope:"trade-flow",title:`${Me.value||""}出栏来源`,metricLabel:"来源",unit:"头",source:$(R({},et),{total:De("headCount")}),rows:Ps.value,showFlowLines:!1,mapView:Z}:{scope:W.value==="epidemic"?"village":"town",hideTownNames:W.value==="epidemic",title:W.value==="forecast"?`${Ze.value.shortLabel}预测存栏`:W.value==="epidemic"?`${ge.value}年村级防疫信息`:"乡镇估算存栏",metricLabel:W.value==="forecast"?"预测":W.value==="epidemic"?"防疫":"存栏",unit:"万头",rows:W.value==="epidemic"?ln.value:Rs.value.map(i=>({name:i.name,value:Number((i.value/1e4).toFixed(2)),unit:"万头"}))}),Ws=k(()=>({color:["#8bf7ff","#30dcff"],tooltip:$(R({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(i){const r=i.map(l=>`${l.marker}${l.seriesName}:${K(Math.abs(l.value))}头`);return`${i[0].name}
${r.join("
")}`}}),legend:{top:4,right:12,itemWidth:12,itemHeight:8,textStyle:{color:S,fontSize:11}},grid:{left:22,right:22,top:32,bottom:12,containLabel:!0},xAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:i=>ae(Math.abs(i))},splitLine:{lineStyle:{color:x,type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:ji.map(i=>i.age),axisLabel:{color:m,fontSize:11,fontWeight:700},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"母牛",type:"bar",stack:"gender",barWidth:12,data:ji.map(i=>-i.cow),itemStyle:{borderRadius:[7,0,0,7]}},{name:"公牛",type:"bar",stack:"gender",barWidth:12,data:ji.map(i=>i.bull),itemStyle:{borderRadius:[0,7,7,0]}}]})),Ys=k(()=>{const i=Nt.value,r=i.map(l=>l.count);return{color:G,tooltip:$(R({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(l){const c=l.map(p=>`${p.marker}${p.seriesName}:${K(p.value)}头`);return`${l[0].name}
${c.join("
")}
估算存栏:${K(r[l[0].dataIndex])}头
结构依据:畜群结构比例表`}}),legend:{top:-2,right:0,itemWidth:8,itemHeight:6,itemGap:6,textStyle:{color:S,fontSize:10}},grid:{left:54,right:30,top:22,bottom:8},xAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:ae},splitLine:{lineStyle:{color:x,type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",inverse:!0,data:i.map(l=>l.name),axisLabel:{color:m,fontSize:10,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:wa.map(l=>({name:l.name,type:"bar",stack:"town",barWidth:i.length>8?6:11,data:i.map(c=>Math.round(c.count*l.ratio/100))}))}}),js=k(()=>Oi(Nt.value,"count","头",{style:"ladder",tooltipFormatter(i){const r=Nt.value[i.dataIndex];return`${r.name}
估算存栏:${K(r.count)}头
来源:无人机识别`}})),Hs=k(()=>{const i=Ea.value,r=i.rows,l=Math.max(...r.map(c=>c.breedingCow+c.calf),1);return{color:["#30dcff","#8bf7ff"],animationDurationUpdate:700,animationEasingUpdate:"cubicOut",tooltip:$(R({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(c){const p=r[c[0].dataIndex],y=c.filter(w=>["能繁母牛","犊牛合计"].includes(w.seriesName)).map(w=>`${w.marker}${w.seriesName}:${K(w.value)}头`);return`${p.name}
母犊合计:${K(p.breedingCow+p.calf)}头
${y.join("
")}
依据:无人机识别 + 畜群结构比例表`}}),legend:{data:["能繁母牛","犊牛合计"],top:2,left:2,itemWidth:10,itemHeight:7,itemGap:9,textStyle:{color:S,fontSize:10}},graphic:i.total>ii?{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:r.map(c=>c.name),axisLabel:{color:C,fontSize:10,lineHeight:12,interval:0,margin:8,formatter:So},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:x,type:"dashed"}}},series:[{name:"基础群规模",type:"bar",barWidth:15,barGap:"-100%",data:r.map(c=>c.breedingCow+c.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:r.map(c=>c.breedingCow),itemStyle:{borderRadius:[1,1,0,0],color:new Ee(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:r.map(c=>c.calf),itemStyle:{borderRadius:[8,8,1,1],color:new Ee(0,0,0,1,[{offset:0,color:"#8bf7ff"},{offset:1,color:"rgba(139, 247, 255, 0.2)"}])},label:{show:!0,position:"top",formatter:({dataIndex:c})=>ae(r[c].breedingCow+r[c].calf),color:"#ffffff",fontSize:10,fontWeight:700}}]}}),qs=k(()=>{const i=yr.slice().sort((c,p)=>p.value-c.value),r=yr.reduce((c,p)=>c+p.value,0),l=i.map(c=>c.yoy||0);return{color:i.map(c=>c.color),tooltip:$(R({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(c){const p=i[c[0].dataIndex];return`${p.label}
数量:${K(p.value)}头
占比:${Je(p.value/r*100)}
同比:${p.yoy>0?"+":""}${p.yoy}%`}}),grid:{left:36,right:30,top:20,bottom:34},xAxis:{type:"category",data:i.map(c=>c.label),axisLabel:{color:m,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:ae},splitLine:{lineStyle:{color:x,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:S,fontSize:10,formatter:"{value}%"},splitLine:{show:!1},axisLine:{show:!1},axisTick:{show:!1}}],series:[{name:"数量",type:"bar",barWidth:16,data:i.map((c,p)=>({value:c.value,itemStyle:{borderRadius:[8,8,2,2],color:new Ee(0,0,0,1,[{offset:0,color:c.color},{offset:.72,color:`${c.color}cc`},{offset:1,color:`${c.color}18`}]),shadowBlur:p===0?4:2,shadowColor:"rgba(48, 220, 255, 0.16)"},label:{show:!0,position:"top",color:L,fontSize:10,fontFamily:Yi.number,fontWeight:700,formatter:({value:y})=>ae(y)}}))},{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:c})=>`${c>0?"+":""}${c}%`}}]}}),Us=k(()=>{const i=Uo(Ft.value),r=Ko(Ze.value,i.key),l=Jo(r),c=Zo(l.length,i.key);return{color:["#30dcff","#8bf7ff","#48cfff"],tooltip:$(R({},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(p){var B,A,Y;const y=Array.isArray(p)?p:[p],w=y.find(X=>X.seriesType==="candlestick"),T=(w==null?void 0:w.data)||l[(Y=(A=w==null?void 0:w.dataIndex)!=null?A:(B=y[0])==null?void 0:B.dataIndex)!=null?Y:0];if(!T)return"";const F=T.close-T.open;return[`${T.label}|${i.unit}度预测`,`预测存栏:${K(T.close)}头`,`较上期:${Ha(F)}头`,`新生牛犊:${K(T.birth)}头`,`出栏扣减:${K(T.outflow)}头`].join("
")}}),legend:{top:4,right:8,data:["预测存栏","新生牛犊","出栏扣减"],itemWidth:12,itemHeight:8,textStyle:{color:S,fontSize:10}},grid:{left:44,right:40,top:34,bottom:28},xAxis:{type:"category",boundaryGap:!0,data:r.labels,axisLabel:{color:C,fontSize:10,interval:c},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.28)"}},axisTick:{show:!1}},yAxis:[{type:"value",scale:!0,axisLabel:{color:C,fontSize:10,formatter:ae},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",axisLabel:{color:S,fontSize:10,formatter:ae},splitLine:{show:!1}}],series:[{name:"预测存栏",type:"candlestick",yAxisIndex:0,barWidth:Xo(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(p=>p.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}},Un("新生牛犊",r.births,"#8bf7ff",1),Un("出栏扣减",r.outflow,"#48cfff",1)]}}),Ks=k(()=>({color:["#30dcff","#8bf7ff"],tooltip:$(R({},we()),{trigger:"axis"}),legend:{top:4,right:12,itemWidth:12,itemHeight:8,textStyle:{color:S,fontSize:10}},grid:{left:52,right:42,top:34,bottom:28},xAxis:{type:"category",data:mi.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 r=Number(i);return Number.isFinite(r)?Math.abs(r)>=1e4?`${Number((r/1e4).toFixed(1))}万`:`${r}`:i}},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",axisLabel:{color:S,fontSize:10},splitLine:{show:!1}}],series:[{name:"数量",type:"bar",barWidth:12,data:mi.value.map(i=>i.count||i.value),itemStyle:{borderRadius:[8,8,0,0],color:new Ee(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:mi.value.map(i=>i.speed||i.growthRate||0),lineStyle:{width:2.4,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff"}}]})),Zs=k(()=>({tooltip:we(),radar:{center:["50%","54%"],radius:"68%",splitNumber:4,indicator:br.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:br.map(i=>i.value),areaStyle:{color:"rgba(48, 220, 255, 0.22)"},lineStyle:{color:"#30dcff",width:2},itemStyle:{color:"#8bf7ff"}}]}]})),Xs=k(()=>Oi(gi.value,"forecast","头")),Js=k(()=>{const i=is.value,r=i.reduce((l,c,p)=>{const y=c.color||G[p%G.length];return l[`name${p}`]={color:y,fontSize:10,fontWeight:800},l[`percent${p}`]={color:y,fontSize:10,fontFamily:"D-DIN, Arial, sans-serif",fontWeight:800},l},{});return{color:G,tooltip:we(l=>{var p;const c=i.find(y=>y.name===l.name);return`${l.name}
预测占比:${Je((p=c==null?void 0:c.ratio)!=null?p:l.percent)}
预测数量:${K((c==null?void 0:c.count)||0)}头`}),legend:{orient:"vertical",right:4,top:"middle",itemWidth:8,itemHeight:8,itemGap:6,formatter(l){const c=i.findIndex(y=>y.name===l),p=i[c];return p?`{name${c}|${l}} {percent${c}|${Je(p.ratio)}}`:l},textStyle:{color:S,fontSize:10,rich:r}},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}))}]}}),Qs=k(()=>({color:["#8bf7ff","#48cfff","#48cfff"],tooltip:$(R({},we()),{trigger:"axis",axisPointer:{type:"shadow"}}),legend:{top:4,right:8,itemWidth:12,itemHeight:8,textStyle:{color:S,fontSize:10}},grid:{left:44,right:26,top:34,bottom:28},xAxis:{type:"category",data:Bt.map(i=>i.shortLabel),axisLabel:{color:m,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=>ja(i,1)},splitLine:{lineStyle:{color:x,type:"dashed"}}},series:[{name:"新生牛犊",type:"bar",barWidth:12,data:Bt.map(i=>i.births),itemStyle:{borderRadius:[7,7,0,0]}},{name:"出栏流出",type:"bar",barWidth:12,data:Bt.map(i=>-i.outflow),itemStyle:{borderRadius:[0,0,7,7]}},{name:"稳态校正",type:"line",smooth:!0,symbolSize:6,data:Bt.map(i=>i.correction),lineStyle:{width:2.4}}]})),eo=k(()=>{const i=gi.value,r=Math.max(...i.map(l=>Math.abs(l.change)),1);return i.map(l=>$(R({},l),{width:Math.max(8,Math.round(Math.abs(l.change)/r*100))}))});function to(i){const r=Number((i==null?void 0:i.change)||0)>=0;return{"--heat-width":`${i.width}%`,"--heat-color":r?"#30dcff":"#8bf7ff","--heat-color-soft":r?"rgba(48, 220, 255, 0.24)":"rgba(139, 247, 255, 0.22)","--heat-color-dim":r?"rgba(48, 220, 255, 0.07)":"rgba(139, 247, 255, 0.07)"}}function ao(i){return`${i.name}:${Ha(i.change)}头`}const io=k(()=>{const i=bi.value,r=i.map(c=>c.value),l=Math.max(...r,1);return{color:["#30dcff","#8bf7ff"],tooltip:$(R({},we()),{trigger:"axis",axisPointer:{type:"line",lineStyle:{color:"rgba(48, 220, 255, 0.28)"}},formatter(c){const p=c[0];return`${p.name}
防疫记录:${K(p.value)}条`}}),grid:{left:42,right:24,top:20,bottom:28},xAxis:{type:"category",data:i.map(c=>c.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:ae},splitLine:{lineStyle:{color:x,type:"dashed"}}},series:[{name:"防疫记录",type:"bar",barMaxWidth:12,data:r,itemStyle:{borderRadius:[7,7,0,0],color:new Ee(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:c})=>c>=l*.42?ae(c):""}},{name:"作业趋势",type:"line",smooth:!0,showSymbol:!1,data:r,lineStyle:{width:2.4,color:"#8bf7ff"}}]}});k(()=>{const i=bi.value.length?bi.value.slice(-6):[{name:"待开展",value:0}],r=i.map(w=>Number(w.value||0)),l=hs.value,c=l.map(w=>Number(w.value||0)),p=Math.max(...r,1),y=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:$(R({},we()),{trigger:"axis",formatter(w){const T=Array.isArray(w)?w[0]:w;if((T==null?void 0:T.axisIndex)===1){const B=l[T.dataIndex]||{};return`${B.name}
补免关注:${B.label||T.value}`}const F=i[T.dataIndex]||{};return`${F.name}
防疫记录:${K(F.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(...c,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=>y(w)},axisLine:{show:!1},axisTick:{show:!1}}],series:[{name:"防疫记录",type:"bar",xAxisIndex:0,yAxisIndex:0,barMaxWidth:9,data:r,itemStyle:{borderRadius:[6,6,0,0],color:new Ee(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>=p*.55?ae(w):""}},{name:"节奏线",type:"line",xAxisIndex:0,yAxisIndex:0,smooth:!0,showSymbol:!1,data:r,lineStyle:{width:1.8,color:"#8bf7ff"},tooltip:{show:!1}},{name:"补免关注",type:"bar",xAxisIndex:1,yAxisIndex:1,barWidth:8,data:c,itemStyle:{borderRadius:[0,7,7,0],color:new Ee(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 T;return((T=l[w])==null?void 0:T.label)||""}}}]}}),k(()=>{const i=ps.value,r=i.map(y=>Number(y.value||0)),l=Math.max(...r,1),c=r.filter(Boolean).reduce((y,w)=>y+w,0)/Math.max(r.filter(Boolean).length,1),p=Math.ceil(l*1.18);return{color:["#30dcff","#8bf7ff"],tooltip:$(R({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(y){var T;const w=i[(T=y[0])==null?void 0:T.dataIndex]||{};return w.isMissing?`${w.name}
年度防疫:待补强`:`${w.name}
覆盖量:${K(w.value)}头
防疫记录:${K(w.recordCount)}条`}}),grid:{left:56,right:46,top:16,bottom:12},xAxis:{type:"value",min:0,max:p,show:!1},yAxis:{type:"category",inverse:!0,data:i.map(y=>y.name),axisLabel:{color:"rgba(226, 252, 255, 0.82)",fontSize:11,interval:0,formatter:y=>String(y||"").replace(/(镇|乡)$/,"")},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"均衡参照",type:"bar",barWidth:11,silent:!0,barGap:"-100%",data:i.map(()=>p),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(y=>{const w=Number(y.value||0);return{value:w>0?w:Math.max(p*.035,1),rawValue:w,itemStyle:{borderRadius:[0,8,8,0],color:new Ee(0,0,1,0,[{offset:0,color:y.isMissing?"rgba(72, 207, 255, 0.2)":"rgba(48, 220, 255, 0.14)"},{offset:.72,color:y.isMissing?"#48cfff":"#30dcff"},{offset:1,color:y.isMissing?"#8bf7ff":"#9efcff"}]),shadowBlur:y.isMissing?4:5,shadowColor:y.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:y})=>{const w=i[y]||{};return w.isMissing?"待补强":`${ae(w.value)}头`}},markLine:c>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:c}]}:void 0}]}}),k(()=>{const i=fs.value,r=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff","#48cfff","#40b8ff","#8bf7ff"],l=i.length?i.map((c,p)=>({name:String(c.name||"").replace(/(村|社区|牧委会)$/,""),value:Math.max(Number(c.value||0),1),rawValue:Number(c.value||0),town:c.town||"",itemStyle:{color:new Ee(0,0,1,1,[{offset:0,color:r[p%r.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:$(R({},we()),{formatter(c){const p=c.data||{};return p.rawValue?`${p.town?`${p.town} `:""}${p.name}
覆盖量:${K(p.rawValue)}头`:`${p.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(c){var y;const p=Number(((y=c.data)==null?void 0:y.rawValue)||0);return p?`${c.name} ${ae(p)}头`:c.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 no=k(()=>{const i=Li.value,r=i.length>8?10:12,l=r+8,c=i.map(B=>Number(B.recordCount||0)),p=i.map(B=>Number(B.earTagCount||0)),y=Math.max(...c,1),w=i.map(()=>Math.ceil(y*1.08)),T=new Ee(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)"}]),F=new Ee(0,0,0,1,[{offset:0,color:"#31f7ff"},{offset:.36,color:"#1cbcff"},{offset:1,color:"#266dff"}]);return{color:["#31f7ff","#8bf7ff"],title:{text:`台账总量:{value|${ae(gt.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:$(R({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(B){const A=i[B[0].dataIndex];return[`${A.name}`,`防疫记录:${K(A.recordCount)}条`,`耳标数量:${K(A.earTagCount)}头`,"数据来源:防疫台账"].join("
")}}),legend:[{data:["防疫记录"],top:0,left:0,itemWidth:10,itemHeight:10,icon:"circle",textStyle:{color:m,fontSize:11},selectedMode:!1},{data:["耳标数"],top:0,left:82,itemWidth:10,itemHeight:10,icon:"circle",textStyle:{color:m,fontSize:11},selectedMode:!1}],grid:{left:42,right:12,top:46,bottom:68},xAxis:{type:"category",data:i.map(B=>B.name),axisLabel:{color:m,fontSize:10,interval:0,lineHeight:11,margin:8,formatter:To},axisLine:{show:!1},axisTick:{show:!1},splitLine:{show:!1}},yAxis:{type:"value",name:"数量/条",max:Math.ceil(y*1.2),nameTextStyle:{color:C,fontSize:10,align:"left"},axisLabel:{color:C,fontSize:10,formatter:ae},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,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:T}},{name:"防疫记录",type:"bar",barGap:"-100%",barWidth:r,barMinHeight:2,z:3,data:c.map(B=>({value:B,itemStyle:{borderRadius:[8,8,1,1],borderColor:"rgba(200, 252, 255, 0.22)",borderWidth:1,color:F,shadowBlur:10,shadowColor:"rgba(49, 247, 255, 0.28)"}}))},{name:"顶部高光",type:"pictorialBar",symbol:"diamond",symbolSize:[r+7,5],symbolOffset:[0,-3],symbolPosition:"end",z:8,tooltip:{show:!1},data:c.map(B=>({value:B,itemStyle:{color:"rgba(207, 252, 255, 0.88)",shadowBlur:8,shadowColor:"rgba(49, 247, 255, 0.72)"}}))},{name:"底座光影",type:"pictorialBar",symbol:"diamond",symbolSize:[l+3,5],symbolOffset:[0,3],z:2,tooltip:{show:!1},data:c,itemStyle:{color:"rgba(48, 220, 255, 0.24)",shadowBlur:10,shadowColor:"rgba(48, 220, 255, 0.45)"}},{name:"耳标数",type:"line",smooth:!0,showSymbol:!1,z:9,data:p,lineStyle:{width:1.6,color:"#8bf7ff",shadowBlur:0,shadowColor:"transparent"},itemStyle:{color:"#8bf7ff"}}]}}),ro=k(()=>{const i=rs.value;return{tooltip:$(R({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(r){const l=i[r[0].dataIndex];return`${l.name}
防疫记录:${K(l.value)}条`}}),grid:{left:74,right:42,top:12,bottom:8},xAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:ae},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,type:"dashed"}}},yAxis:{type:"category",inverse:!0,data:i.map(r=>r.name),axisLabel:{color:m,fontSize:10,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"记录",type:"bar",barWidth:9,data:i.map((r,l)=>({value:r.value,itemStyle:{borderRadius:[0,8,8,0],color:new Ee(0,0,1,0,[{offset:0,color:"rgba(48, 220, 255, 0.12)"},{offset:.62,color:["#30dcff","#8bf7ff","#58d9ff"][l%3]},{offset:1,color:"#ffffff"}])}})),label:{show:!0,position:"right",color:"#eaffff",fontSize:10,formatter:({value:r})=>ae(r)}},{type:"scatter",symbolSize:7,data:i.map(r=>r.value),itemStyle:{color:"#8bf7ff",shadowBlur:2,shadowColor:"rgba(139, 247, 255, 0.16)"}}]}}),so=k(()=>{const i=ws.value;return{color:["#30dcff","#8bf7ff"],tooltip:$(R({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(r){const l=r.find(p=>p.seriesName==="流通头数"),c=r.find(p=>p.seriesName==="出证记录");return`${(l==null?void 0:l.axisValue)||""}
流通头数:${K((l==null?void 0:l.value)||0)}头
出证记录:${K((c==null?void 0:c.value)||0)}条`}}),legend:{top:4,right:10,itemWidth:12,itemHeight:8,textStyle:{color:S,fontSize:10}},grid:{left:42,right:38,top:34,bottom:28},xAxis:{type:"category",data:i.map(r=>r.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:ae},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",axisLabel:{color:S,fontSize:10,formatter:ae},splitLine:{show:!1}}],series:[{name:"流通头数",type:"bar",barMaxWidth:13,data:i.map(r=>r.headCount),itemStyle:{borderRadius:[7,7,0,0],color:new Ee(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(r=>r.recordCount),lineStyle:{width:2.2,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff",borderColor:"rgba(3, 18, 28, 0.9)",borderWidth:2}}]}}),oo=k(()=>Oi(Ba.value.slice(0,10),"headCount","头",{colors:je,style:"ladder",axisTextColor:"rgba(255, 255, 255, 0.88)",dimAxisTextColor:"rgba(255, 255, 255, 0.74)",tooltipFormatter(i){const r=Ba.value[i.dataIndex];return`${r.name}
流通头数:${K(r.headCount)}头
出证记录:${K(r.recordCount)}条`}})),lo=k(()=>{const i=Si.value;return{color:je,tooltip:we(r=>{const l=i.find(c=>c.name===r.name);return`${r.name}
占比:${r.percent}%
流通头数:${K(r.value)}头
出证记录:${K((l==null?void 0:l.recordCount)||0)}条`}),legend:{orient:"vertical",right:4,top:"middle",itemWidth:8,itemHeight:8,itemGap:6,textStyle:{color:S,fontSize:10},formatter(r){const l=i.find(c=>c.name===r);return l?`${r} ${ae(l.headCount)}头`:r}},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(r=>({name:r.name,value:r.headCount}))}]}}),uo=k(()=>{const i=[{name:"省外A证",value:De("outProvinceHeads","aCertHeads")},{name:"省内B证",value:De("inProvinceHeads","bCertHeads")}];return{color:["#8bf7ff","#30dcff"],tooltip:we(r=>`${r.name}
流通头数:${K(r.value)}头
占比:${r.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 Ci(){o.value=typeof window=="undefined"?1080:window.innerHeight}function gn(){var i,r,l,c,p,y;if(nt.value){(r=(i=oa.value)==null?void 0:i.refreshView)==null||r.call(i);return}(c=(l=Oe.value)==null?void 0:l.resume)==null||c.call(l),(y=(p=Oe.value)==null?void 0:p.refreshView)==null||y.call(p)}function Fi(){kt&&(window.clearTimeout(kt),kt=null)}function co(){var i,r,l,c,p,y;if(ua.value={type:"loading",text:"地图正在复位"},ca.value={type:"idle",text:""},nt.value){(r=(i=oa.value)==null?void 0:i.hasMap)!=null&&r.call(i)?(la.value=!0,(c=(l=oa.value)==null?void 0:l.resetView)==null||c.call(l)):(la.value=!1,Qi.value+=1,jt(()=>{window.setTimeout(()=>{var w,T;return(T=(w=oa.value)==null?void 0:w.refreshView)==null?void 0:T.call(w)},160)}));return}if((y=(p=Oe.value)==null?void 0:p.hasMap)!=null&&y.call(p)){Vt.value=!0,gn();return}Fi(),Vt.value=!1,Mt=!1,Ji.value+=1,jt(()=>{pa()})}e({refreshMapView:gn,resetMap:co,setActiveView(i){W.value=Di(i)}}),Yr(()=>{Ci(),window.addEventListener("resize",Ci),Yo(),$o(),An(),Fn(),$a(),Va()}),jr(()=>{var i,r;da=!0,window.removeEventListener("resize",Ci),kt&&window.clearTimeout(kt),xi(),Ni(),(r=(i=Oe.value)==null?void 0:i.destroyMap)==null||r.call(i)}),qt([W,Ze,Nt,wi,gt,ge,Me,dn],()=>{Ho()},{immediate:!0}),qt(W,(i,r)=>{n("view-change",i);const l=i==="structure"||i==="forecast",c=r==="structure"||r==="forecast",p=!l&&!c&&(i==="trade"||r==="trade");l&&!c&&(la.value=!1,ua.value={type:"idle",text:""},ca.value={type:"idle",text:""}),!l&&c&&(Fi(),Vt.value=!1,Mt=!1,ua.value={type:"idle",text:""},ca.value={type:"idle",text:""},jt(()=>{var y,w,T,F;pa(),(w=(y=Oe.value)==null?void 0:y.resume)==null||w.call(y),(F=(T=Oe.value)==null?void 0:T.refreshView)==null||F.call(T),window.setTimeout(()=>{var B,A;return(A=(B=Oe.value)==null?void 0:B.refreshView)==null?void 0:A.call(B)},180)})),p&&(Fi(),Vt.value=!1,Mt=!1,ua.value={type:"idle",text:""},ca.value={type:"idle",text:""},jt(()=>{pa()})),$a(),Va()}),qt(()=>a.viewKey,i=>{const r=Di(i);r!==W.value&&(W.value=r)}),qt(()=>a.active,i=>{var r,l,c,p;i?(pa(),(l=(r=Oe.value)==null?void 0:r.resume)==null||l.call(r),$a(),Va()):((p=(c=Oe.value)==null?void 0:c.pause)==null||p.call(c),xi(),Ni())}),qt(Ea,i=>{ut.value>=i.pageCount&&(ut.value=0),Va()});function ho(i){i!==tt.value&&(tt.value=i,$a())}function $a(){xi(),!(!a.active||W.value!=="forecast"||da)&&(Ca=window.setInterval(po,nh))}function po(){const i=Bt.findIndex(l=>l.key===tt.value),r=i>=0?(i+1)%Bt.length:0;tt.value=Bt[r].key}function xi(){Ca&&(window.clearInterval(Ca),Ca=null)}function Va(){Ni(),!(!a.active||W.value!=="structure"||da||Ea.value.pageCount<=1)&&(Fa=window.setInterval(fo,rh))}function fo(){const i=Ea.value.pageCount;i<=1||(ut.value=(ut.value+1)%i)}function Ni(){Fa&&(window.clearInterval(Fa),Fa=null)}function mo(i=[],r=[]){const l=new Map;return r.forEach(c=>{const p=Ri(c.name);p&&l.set(p,$(R({},c),{name:p,count:Number(c.count||0)}))}),i.forEach(c=>{const p=Ri(c.name);if(!p)return;const y=l.get(p)||{};l.set(p,$(R(R({},y),c),{name:p,count:Number.isFinite(Number(c.count))?Number(c.count):Number(y.count||0)}))}),[...l.values()].sort((c,p)=>Number(p.count||0)-Number(c.count||0))}function Ri(i){return vr(i||"")}function Xe(i){return String(i||"").trim()}function Ii(i){const r=Number(i);return Number.isFinite(r)&&Fe.includes(r)?r:Fe[Fe.length-1]}function Gi(i=ge.value){const r=Ii(i);return{startDate:`${r}-01-01`,endDate:`${r}-12-31`}}function za(){return{keyword:"",town:"",medicine:"",startDate:"",endDate:""}}function Pt(i=[]){return Array.isArray(i)?i.map((r,l)=>{var c,p,y;return{key:r.key||r.id||`${r.name||r.label||"item"}-${l}`,name:String(r.name||r.label||r.town||r.village||"未填写"),value:Number((y=(p=(c=r.value)!=null?c:r.count)!=null?p:r.total)!=null?y:0)}}).filter(r=>r.name&&Number.isFinite(r.value)):[]}function yn(i={}){const r=Pt(i==null?void 0:i.medicineCounts);return Math.max(r.filter(l=>l.name!=="未填写").length,1)}function bn(...i){const r=i.flatMap(l=>Array.isArray(l)?l:[l]).map(l=>{var c,p,y;return l&&typeof l=="object"?(y=(p=(c=l.year)!=null?c:l.value)!=null?p:l.latestYear)!=null?y:l.latest_year:l}).map(Number).filter(l=>Number.isFinite(l)&&l>0);return[...new Set(r)].sort((l,c)=>l-c)}function Oa(i=[],r="name"){return Array.isArray(i)?i.map((l,c)=>{var p,y,w,T,F,B,A,Y,X,O,J,Ne,rt,Zt,de,We,fa;return{key:l.key||l.id||`${l[r]||l.name||l.label||"trade"}-${c}`,name:String(l[r]||l.name||l.label||l.town||"未填写"),recordCount:Number((w=(y=(p=l.recordCount)!=null?p:l.record_count)!=null?y:l.count)!=null?w:0),headCount:Number((A=(B=(F=(T=l.headCount)!=null?T:l.head_count)!=null?F:l.amount)!=null?B:l.value)!=null?A:0),lng:yt((Ne=(J=(O=(X=(Y=l.lng)!=null?Y:l.longitude)!=null?X:l.destLng)!=null?O:l.dest_lng)!=null?J:l.destLongitude)!=null?Ne:l.dest_longitude),lat:yt((fa=(We=(de=(Zt=(rt=l.lat)!=null?rt:l.latitude)!=null?Zt:l.destLat)!=null?de:l.dest_lat)!=null?We:l.destLatitude)!=null?fa:l.dest_latitude)}}).filter(l=>l.name&&Number.isFinite(l.headCount)):[]}function go(i=[]){return Array.isArray(i)?i.map(r=>{var l,c,p,y,w,T;return{year:Number(r.year),recordCount:Number((c=(l=r.recordCount)!=null?l:r.record_count)!=null?c:0),headCount:Number((T=(w=(y=(p=r.headCount)!=null?p:r.head_count)!=null?y:r.amount)!=null?w:r.value)!=null?T:0)}}).filter(r=>Number.isFinite(r.year)&&Number.isFinite(r.headCount)):[]}function _i(i=[]){return Array.isArray(i)?Bi(i.map(r=>{var l,c,p;return r&&typeof r=="object"?(p=(c=(l=r.value)!=null?l:r.label)!=null?c:r.name)!=null?p:"":r})):[]}function yo(i=[]){return Array.isArray(i)?i.map(r=>{var l,c,p,y,w,T;if(r&&typeof r=="object"){const F=(p=(c=(l=r.value)!=null?l:r.name)!=null?c:r.label)!=null?p:"",B=(T=(w=(y=r.label)!=null?y:r.name)!=null?w:r.value)!=null?T:F;return F?{value:String(F),label:String(B||F)}:null}return r?{value:String(r),label:String(r)}:null}).filter(Boolean):[]}function Bi(i=[]){return[...new Set(i.map(r=>String(r||"").trim()).filter(Boolean))]}function bo(i=[]){if(!Array.isArray(i))return[];const r=new Map;i.forEach((c,p)=>{var B,A,Y,X,O,J;const y=Xe(c.name||c.areaName||c.area_name||c.town||c.label||"");if(!y)return;const w=yt((Y=(A=(B=c.value)!=null?B:c.number)!=null?A:c.count)!=null?Y:c.total);if(!Number.isFinite(w))return;const T=r.get(y)||{key:c.areaCode||c.area_code||`${y}-${p}`,name:y,recordCount:0,earTagCount:0,source:"stats"};T.recordCount+=w;const F=yt((J=(O=(X=c.earTagCount)!=null?X:c.ear_tag_count)!=null?O:c.headCount)!=null?J:c.head_count);T.earTagCount+=Number.isFinite(F)?F:0,r.set(y,T)});const l=[...r.values()].reduce((c,p)=>c+Number(p.recordCount||0),0);return[...r.values()].map(c=>$(R({},c),{earTagCount:c.earTagCount||Math.round(Number(c.recordCount||0)/Rt.value),ratio:l?Number(c.recordCount||0)/l*100:0})).sort((c,p)=>Number(p.recordCount||0)-Number(c.recordCount||0))}function vo(i={}){var p,y;const r=Array.isArray(i)?{rows:i}:i||{},l=r.result||{};return{rows:r.rows||r.data||r.list||r.records||[],year:(y=(p=r.year)!=null?p:l.year)!=null?y:null}}function Ai(i=[]){return Array.isArray(i)?i.map((r,l)=>{var Y,X,O,J,Ne,rt,Zt,de,We,fa,er,tr;const c=Xe(r.town||r.townName||r.town_name||""),p=String(r.village||r.villageName||r.village_name||r.name||"").trim(),y=yt((O=(X=(Y=r.recordCount)!=null?Y:r.record_count)!=null?X:r.records)!=null?O:r.total),w=yt((Zt=(rt=(Ne=(J=r.earTagCount)!=null?J:r.ear_tag_count)!=null?Ne:r.headCount)!=null?rt:r.head_count)!=null?Zt:r.value),T=yt((We=(de=r.imageCount)!=null?de:r.image_count)!=null?We:r.images),F=yt((fa=r.imageRate)!=null?fa:r.image_rate),B=yt((er=r.lng)!=null?er:r.longitude),A=yt((tr=r.lat)!=null?tr:r.latitude);return{key:r.key||r.id||`${c}-${p}-${l}`,town:c,village:p,recordCount:Number.isFinite(y)?y:0,earTagCount:Number.isFinite(w)?w:0,imageCount:Number.isFinite(T)?T:0,imageRate:Number.isFinite(F)?F:0,lng:B,lat:A}}).filter(r=>r.town&&r.village&&Number.isFinite(r.earTagCount)).sort((r,l)=>Number(l.earTagCount||0)-Number(r.earTagCount||0)):[]}function wo(i={},r={}){const l=Array.isArray(r)?{rows:r}:r||{},c=l.result||{},p=Ai(l.rows||l.data||l.list||l.records||c.rows||[]),y=new Map;p.forEach(A=>{vn(A.village).forEach(Y=>{y.has(Y)||y.set(Y,A)})});const w=Pt(i==null?void 0:i.townCounts),T=w.length===1?Xe(w[0].name):"",F=yn(i),B=Pt(i==null?void 0:i.villageCounts).map((A,Y)=>{const X=String(A.name||"").trim(),O=vn(X).map(Ne=>y.get(Ne)).find(Boolean)||{},J=Number(A.value||0);return{key:O.key||`${O.town||T||"防疫"}-${X}-${Y}`,town:O.town||T,village:X,recordCount:J,earTagCount:Math.round(J/F),imageCount:O.imageCount||0,imageRate:O.imageRate||0,lng:O.lng,lat:O.lat}}).filter(A=>A.village&&A.recordCount>0);return $(R({},l),{rows:B})}function vn(i){const r=String(i||"").trim(),l=r.replace(/(村|社区|牧委会)$/,"");return[...new Set([r,l].filter(Boolean))]}function yt(i){if(i==null||i==="")return NaN;const r=Number(String(i).replace(/,/g,"").replace(/%/g,""));return Number.isFinite(r)?r:NaN}function wn(i){return String(i||"").replace(/'/g,"''").replace(/%/g,"\\%").replace(/_/g,"\\_")}function Lo(i,r){const l=Xe(i),c=String(r||"").trim();if(!l||!c)return"";const p=`${l}${c}`,y=wn(p),w=wn(c);return`(full_name LIKE '%${y}%' OR name = '${y}' OR name = '${w}')`}function To(i){const r=String(i||"").trim().replace(/\s+/g,"");return r?Array.from(r).join(` `):""}function So(i){const r=String(i||"").trim();if(!r)return"";const l=r.match(/^(.+)(镇|乡|村)$/);return l?`${l[1]} ${l[2]}`:r}function Mo(i,r){return Ln(i.name)-Ln(r.name)}function Ln(i){const r=String(i||"").match(/(\d{1,2})\D+(\d{1,2})/);return r?Number(r[1])*100+Number(r[2]):Number.MAX_SAFE_INTEGER}function Ei(i=[]){return Array.isArray(i)?i.map(Tn).filter(Boolean):[]}function Tn(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 Sn(i=[]){return Array.isArray(i)?i.map(ko).filter(Boolean):[]}function ko(i){var r,l,c,p;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((p=(c=(l=(r=i.amount)!=null?r:i.headCount)!=null?l:i.head_count)!=null?c:i.value)!=null?p: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 Da(i,r){for(const l of r){const c=Number(i==null?void 0:i[l]);if(Number.isFinite(c))return c}return 0}function De(...i){return Da(dn.value,i)}function Mn(i=[],r=2){const l=[...new Set(i.map(c=>String(c||"").trim()).filter(Boolean))];return l.length?l.length<=r?l.join("、"):`${l.slice(0,r).join("、")}等${l.length}个乡镇`:"暂无"}function Po(){const i=It.value;if(i.length)return{name:Mn(i,1),desc:"年度防疫覆盖需补强",level:"watch"};const r=zt.value.filter(c=>Number(c.earTagCount||c.recordCount||0)>0).sort((c,p)=>Number(c.earTagCount||c.recordCount||0)-Number(p.earTagCount||p.recordCount||0)),l=r[0];return l?{name:l.name,desc:`${ae(l.earTagCount||l.recordCount)}头,建议补免回访`,level:r.length>=2?"watch":"normal"}:{name:"暂无",desc:"等待年度防疫记录形成",level:"normal"}}function Co(){const i=It.value;if(i.length)return i.slice(0,4).map((c,p)=>({key:`missing-${c}`,name:c,value:Math.max(25,100-p*12),label:"待补免",level:"watch"}));const r=zt.value.filter(c=>Number(c.earTagCount||c.recordCount||0)>0);if(!r.length)return[{key:"empty",name:"暂无",value:0,label:"待开展",level:"watch"}];const l=r.reduce((c,p)=>c+Number(p.earTagCount||0),0)/r.length||1;return[...r].sort((c,p)=>Number(c.earTagCount||0)-Number(p.earTagCount||0)).slice(0,4).map(c=>{const p=Number(c.earTagCount||c.recordCount||0),y=Math.max(8,Math.round((l-p)/l*100));return{key:`weak-${c.name}`,name:c.name,value:Math.min(100,y),label:`${ae(p)}头`,level:y>=35?"watch":"normal"}})}function Fo(){const r=(Li.value.length?Li.value:zt.value).map((p,y)=>{const w=Xe(p.name),T=Number(p.earTagCount||0),F=Number(p.recordCount||p.value||0),B=T||Math.round(F/Rt.value);return{key:p.key||`${w}-${y}`,name:w,value:B,recordCount:F,isMissing:!1}}).filter(p=>p.name&&Number.isFinite(p.value)),c=[...It.value.map((p,y)=>({key:`missing-${p}-${y}`,name:p,value:0,recordCount:0,isMissing:!0})),...r];return c.length?c.sort((p,y)=>p.isMissing!==y.isMissing?p.isMissing?-1:1:Number(p.value||0)-Number(y.value||0)).slice(0,7):[{key:"empty",name:"待开展",value:0,recordCount:0,isMissing:!0}]}function xo(){var r;const i=ln.value.map((l,c)=>({key:l.key||`${l.town}-${l.village}-${c}`,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,c)=>c.value-l.value).slice(0,9):Pt((r=xe.value)==null?void 0:r.villageCounts).map((l,c)=>({key:l.key||`${l.name}-${c}`,name:l.name,town:"",value:Math.round(Number(l.value||0)/Rt.value)})).filter(l=>l.name&&Number.isFinite(l.value)&&l.value>0).sort((l,c)=>c.value-l.value).slice(0,9)}function No(){if(!gt.value)return{level:"watch",title:"年度待开展",desc:"年度免疫记录暂未形成",advice:"建议先核查年度免疫计划与乡镇推进节奏。"};const i=ds.value,r=_a.value;return It.value.length?{level:"watch",title:"补免待核查",desc:`乡镇覆盖${Je(i)},${r.name}需补强`,advice:`优先核查${Mn(It.value,1)}免疫进度。`}:i>=90&&Rt.value>=4?{level:"stable",title:"运行平稳",desc:`乡镇覆盖${Je(i)},疫苗谱较完整`,advice:"建议保持当前免疫节奏,持续跟踪补免回访。"}:{level:"normal",title:"均衡回访",desc:`${r.name}相对偏低,适合继续跟进`,advice:`关注${r.name}补免回访,保持覆盖均衡。`}}function Ro(){return[{key:"latest",name:"最近免疫",value:on.value,desc:"最后作业时间",level:on.value==="-"?"watch":"stable",color:"#8bf7ff"},{key:"top-town",name:"高频乡镇",value:ls.value,desc:"年度作业集中区",level:"normal",color:"#30dcff"},{key:"vaccine",name:"主用疫苗",value:ss.value,desc:`${Rt.value}类疫苗`,level:"normal",color:"#8bf7ff"}]}function Io(){const i=De("headCount","totalHeads","total_heads"),r=Aa.value,l=r.reduce((de,We)=>de+Number(We.headCount||0),0)||i||1,c=r[0],p=c?Number(c.headCount||0)/l*100:0,y=Si.value.filter(de=>de.name&&de.name!=="未填写").sort((de,We)=>Number(We.headCount||0)-Number(de.headCount||0)),w=y.reduce((de,We)=>de+Number(We.headCount||0),0)||i||1,T=y[0],F=T?Number(T.headCount||0)/w*100:0,A=Ls.value.filter(de=>de.name&&de.name!=="未填写").sort((de,We)=>Number(We.headCount||We.recordCount||0)-Number(de.headCount||de.recordCount||0))[0],Y=De("vehicleCount","vehicle_count","transportVehicleCount","transport_vehicle_count"),X=Y>0?i/Y:0,O=De("outProvinceHeads","out_province_heads","aCertHeads","a_cert_heads"),J=De("inProvinceHeads","in_province_heads","bCertHeads","b_cert_heads"),Ne=O+J||i||1,rt=O?O/Ne*100:0;return[{key:"town",name:"高频出栏乡镇",value:(c==null?void 0:c.displayName)||(c==null?void 0:c.name)||"暂无",desc:c?`${ae(c.headCount)}头,占${Je(p)}`:"等待来源乡镇数据",level:p>=35?"high":p>=24?"watch":"normal",color:"#63d7ff"},{key:"usage",name:"交易用途集中度",value:(T==null?void 0:T.name)||"暂无",desc:T?`占${Je(F)}`:"等待用途结构数据",level:F>=60?"high":F>=45?"watch":"normal",color:"#30dcff"},{key:"vehicle",name:A?"运输车辆高频":"车辆周转强度",value:A?`${ae(A.headCount||A.recordCount)}${A.headCount?"头":"条"}`:Y?`车均${K(X)}头`:"--",desc:A?"已接入车辆聚合,明细在台账核查":Y?`${K(Y)}辆参与流通`:"等待车辆聚合数据",level:A||X>=260?"watch":"normal",color:"#48cfff"},{key:"cert-dest",name:"证照/去向线索",value:O?Je(rt):"--",desc:O?`省外流通${ae(O)}头`:"等待证照去向数据",level:rt>=55?"high":rt>=35?"watch":"normal",color:"#48cfff"}].map(de=>$(R({},de),{badge:de.level==="high"?"重点":de.level==="watch"?"关注":"平稳"}))}function $i(i={}){return String(i.imagePaths||"").split(";").map(r=>r.trim()).filter(Boolean)}function kn(i){const l=String(i||"").replace(/^images\//,"").split("/").map(encodeURIComponent).join("/");return`${eh}/${l}`}function Go(i){at.value=kn(i),Ke.value=!0}function Vi(){Ke.value=!1,at.value=""}function te(i){return i==null||i===""?"-":i}function _o(i){const r=String(i!=null?i:"").trim();return!!(r&&r!=="-")}function ke(i,r,l={}){return _o(r)?R({label:i,value:r},l):null}function Gt(i){return i?String(i).slice(0,10):"-"}function Pn(i){const r=String(i||"").trim();return r?r.length<7?r:`${r.slice(0,3)}****${r.slice(-4)}`:"-"}function Bo(i){const r=String(i||"").trim();return r?r.length<=4?r:`****${r.slice(-4)}`:"-"}function Ao(i){const r=String(i!=null?i:"").trim();if(!r)return"-";if(/kg|公斤|千克/i.test(r))return r;const l=Number(r);return Number.isFinite(l)?`${K(l)}kg`:r}function Eo(i){return String(i!=null?i:"").trim()||"-"}function Cn(i={}){return i.certScopeName||i.certType||"-"}function $o(){return he(this,null,function*(){var c,p;dt.value=!0,$e.value="";const[i,r,l]=yield Promise.allSettled([lu(),uu(),cu()]);i.status==="fulfilled"&&((c=i.value)!=null&&c.length)&&(xt.value=Ul(i.value.map(y=>({name:vr(y.name),count:Number(y.value)})).filter(y=>y.name&&Number.isFinite(y.count)))),r.status==="fulfilled"&&((p=r.value)!=null&&p.length)&&(Kt.value=r.value.map(y=>({month:y.name,count:Number(y.value),speed:rl(y.extra)})).filter(y=>y.month&&Number.isFinite(y.count))),l.status==="fulfilled"?(ct.value=tl(l.value),ct.value.length||($e.value="结构数据暂无数据")):($e.value=nl(l.reason,"结构数据异常"),ct.value=[]),dt.value=!1})}function Fn(){return he(this,arguments,function*(i=Me.value){var r,l,c,p,y,w;Lt.value=!0,Tt.value="";try{(l=(r=me.value)==null?void 0:r.years)!=null&&l.length||(me.value=yield du());const T=bn((c=me.value)==null?void 0:c.years),F=Number(((p=me.value)==null?void 0:p.latestYear)||((y=me.value)==null?void 0:y.latest_year)||T[T.length-1]),B=Number(i||Me.value||F||T[T.length-1]);Me.value=B;let A=yield Tr({year:B});const Y=(w=A==null?void 0:A.hasData)!=null?w:A==null?void 0:A.has_data,X=Number((A==null?void 0:A.latestYear)||(A==null?void 0:A.latest_year)||F);Y===!1&&X&&X!==B&&(Me.value=X,A=yield Tr({year:X})),ee.value=A||{metrics:{},hasData:!1},yield zi(1)}catch(T){Tt.value="交易数据接口异常",ee.value={metrics:{},hasData:!1},it.value=[],ft.value=0}finally{Lt.value=!1}})}function zi(){return he(this,arguments,function*(i=St.value){var l,c;if(!Me.value)return;const r={year:Me.value,page:i,pageSize:Ki,keyword:ri.value};try{const p=yield Sr(r);it.value=Sn(p.rows),ft.value=Number(((l=p.page)==null?void 0:l.totalCount)||p.totalCount||it.value.length||0),St.value=Number(((c=p.page)==null?void 0:c.page)||i||1)}catch(p){Tt.value=Tt.value||"交易台账接口异常",it.value=[],ft.value=0}})}function Vo(i){const r=Number(i);!Number.isFinite(r)||r===Number(Me.value)||(Me.value=r,St.value=1,Ma.value="",ri.value="",Fn(r))}function zo(i){const r=Ii(i);r!==Number(ge.value)&&(ge.value=r,ve.value=1,pt.value="",M.value="",ce.value=1,fe.value=za(),An(r))}function xn(){ri.value=Ma.value.trim(),zi(1)}function Nn(i){const r=Math.min(Math.max(Number(i)||1,1),Mi.value);zi(r)}function Rn(i=null){si.value=!0,i&&(Pa.value=i),Wa(i?St.value:1,i)}function In(){si.value=!1}function Gn(){Wa(1)}function Oo(){mt.value={keyword:"",startTown:"",usageType:"",certType:""},Wa(1)}function _n(i){const r=Math.min(Math.max(Number(i)||1,1),ki.value);Wa(r)}function Wa(){return he(this,arguments,function*(i=$t.value,r=null){var p,y;if(!Me.value)return;oi.value=!0,li.value="";const l=mt.value,c={year:Me.value,page:i,pageSize:Dr,keyword:l.keyword.trim(),startTown:l.startTown,usageType:l.usageType,certType:l.certType};try{const w=yield Sr(c);Et.value=Sn(w.rows),ka.value=Number(((p=w.page)==null?void 0:p.totalCount)||w.totalCount||Et.value.length||0),$t.value=Number(((y=w.page)==null?void 0:y.page)||i||1);const T=r?r.certId||r.factoryCode:"",F=T?Et.value.find(B=>(B.certId||B.factoryCode)===T)||r:Et.value[0]||null;Bn(F)}catch(w){li.value="交易台账接口异常",Et.value=[],ka.value=0,Pa.value=null}finally{oi.value=!1}})}function Bn(i){Pa.value=i||null}function Do(i){i!=null&&i.startTown&&(W.value="trade",jt(()=>{var r,l,c,p,y,w;(l=(r=Oe.value)==null?void 0:r.resume)==null||l.call(r),(p=(c=Oe.value)==null?void 0:c.refreshView)==null||p.call(c),(w=(y=Oe.value)==null?void 0:y.focusTown)==null||w.call(y,Xe(i.startTown),{distanceScale:.78,duration:.8})}))}function An(){return he(this,arguments,function*(i=ge.value){var T;const r=Ii(i),l=Gi(r);ge.value=r,v.value=!0,N.value="";const[c,p,y,w]=yield Promise.allSettled([hu(l),qi(R({page:ve.value,pageSize:ai,keyword:M.value},l)),pu({year:r}),fu()]);if(c.status==="fulfilled"?xe.value=c.value||{metrics:{}}:(N.value="防疫统计接口异常",xe.value={metrics:{}}),p.status==="fulfilled"){const F=p.value||{};Ve.value=Ei(F.rows),Ue.value=Number(((T=F.page)==null?void 0:T.totalCount)||F.totalCount||Ve.value.length||0)}else N.value=N.value||"防疫台账接口异常",Ve.value=[],Ue.value=0;y.status==="fulfilled"?ht.value=vo(y.value):ht.value={rows:[],year:null},w.status==="fulfilled"?wt.value=wo(xe.value,w.value):wt.value={rows:[]},v.value=!1})}function En(){return he(this,arguments,function*(i=ve.value){var c,p;v.value=!0,N.value="";const r=Math.min(Math.max(Number(i)||1,1),Ti.value),l=Gi(ge.value);try{const y=yield qi(R({page:r,pageSize:ai,keyword:M.value},l));Ve.value=Ei(y.rows),Ue.value=Number(((c=y.page)==null?void 0:c.totalCount)||y.totalCount||Ve.value.length||0),ve.value=Number(((p=y.page)==null?void 0:p.page)||r||1)}catch(y){N.value="防疫台账接口异常",Ve.value=[],Ue.value=0,ve.value=1}finally{v.value=!1}})}function $n(){M.value=pt.value.trim(),fe.value=$(R({},za()),{keyword:M.value}),En(1)}function Vn(i){En(i)}function zn(i=null){z.value=!0,i&&(_e.value=i,Be.value=null),Ya(1,i)}function On(){z.value=!1,Vi()}function Dn(){Ya(1)}function Wo(){fe.value=za(),Ya(1)}function Wn(i){Ya(i)}function Ya(){return he(this,arguments,function*(i=ce.value,r=null){var y,w;Ge.value=!0,ze.value="";const l=fe.value,c=Gi(ge.value),p={keyword:l.keyword.trim(),town:l.town,medicine:l.medicine,startDate:l.startDate||c.startDate,endDate:l.endDate||c.endDate,page:i,pageSize:Or};try{const T=yield qi(p);q.value=Ei(T.rows),ne.value=Number(((y=T.page)==null?void 0:y.totalCount)||T.totalCount||q.value.length||0),ce.value=Number(((w=T.page)==null?void 0:w.page)||i||1);const F=r||q.value[0]||null;F?Yn(F):(_e.value=null,Be.value=null)}catch(T){ze.value="台账接口异常",q.value=[],ne.value=0}finally{Ge.value=!1}})}function Yn(i){return he(this,null,function*(){if(_e.value=i,Be.value=null,!(i!=null&&i.earTag)&&!(i!=null&&i.epidemicId))return;const r=++xa;Ae.value=!0;try{const l=yield mu(i.earTag||i.epidemicId);r===xa&&(Be.value=Tn(l)||i)}catch(l){r===xa&&(Be.value=i)}finally{r===xa&&(Ae.value=!1)}})}function Yo(){var i;ui=new su,ci=!1,(i=ui.ready)==null||i.then(()=>{ci=!0,pa()}).catch(()=>{Vt.value=!0})}function pa(){da||!a.active||!ci||Mt||(Mt=!0,kt&&window.clearTimeout(kt),kt=window.setTimeout(()=>{kt=null,jn()},600))}function jn(i=0){return he(this,null,function*(){var l,c;if(da)return;if(!a.active){Mt=!1;return}if(yield jt(),!a.active){Mt=!1;return}const r=Oe.value;if((l=r==null?void 0:r.loadMap)==null||l.call(r,ui),r!=null&&r.canvasMap){Mt=!1,Vt.value=!0,(c=r.play)==null||c.call(r);return}if(i<24){window.setTimeout(()=>jn(i+1),120);return}Mt=!1})}function Hn(i={}){ca.value={type:i.type||"idle",text:i.text||""}}function jo(){la.value=!0}function qn(i={}){ua.value={type:i.type||"idle",text:i.text||"",loaded:i.loaded,failed:i.failed,total:i.total,zoom:i.zoom,tileUrlTemplate:i.tileUrlTemplate}}function Ho(){if(W.value==="epidemic"){n("module-stats",{moduleKey:"yak-management",items:[{zh:"防疫记录",value:gt.value,unit:"条"},{zh:"防疫耳标",value:wi.value,unit:"头"},{zh:"疫苗类型",value:Rt.value,unit:"类"},{zh:"涉及村数",value:os.value,unit:"个"}]});return}if(W.value==="forecast"){const i=Ze.value.stock-ot;n("module-stats",{moduleKey:"yak-management",items:[{zh:"预测期末存栏",value:Ze.value.stock,unit:"头"},{zh:"新生牛犊",value:Ze.value.births,unit:"头"},{zh:"出栏流出",value:Ze.value.outflow,unit:"头"},{zh:"预测净变化",value:i,unit:"头"}]});return}if(W.value==="trade"){n("module-stats",{moduleKey:"yak-management",items:[{zh:"流通总量",value:De("headCount"),unit:"头"},{zh:"出证记录",value:De("recordCount"),unit:"条"},{zh:"运输车辆",value:De("vehicleCount"),unit:"辆"}]});return}n("module-stats",{moduleKey:"yak-management",items:[{zh:"图像识别总数",value:Kl,unit:"头"},{zh:"模型修正总数",value:Xr.value,unit:"头"},{zh:"当前存栏数量",value:ot,unit:"头"}]})}function Oi(i,r,l,c={}){const p=c.labelKey||"name",y=c.colors||G,w=Math.max(...i.map(O=>Number(O[r]||0)),1),T=i.length>8,F=c.style==="ladder",B=T?F?7:6:i.length>6?11:13,A=["#30dcff","#58d9ff","#8bf7ff","#48cfff","#16b6e8","#b9fbff"],Y=c.axisTextColor||m,X=c.dimAxisTextColor||C;return{tooltip:$(R({},we()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(O){if(c.tooltipFormatter)return c.tooltipFormatter(O[0]);const J=i[O[0].dataIndex];return`${J[p]}
数值:${K(J[r])}${l}`}}),grid:{left:T?58:74,right:T?54:58,top:T?6:16,bottom:T?8:14},xAxis:{type:"value",axisLabel:{color:X,fontSize:10,formatter:l==="%"?"{value}%":ae},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,type:"dashed"}}},yAxis:{type:"category",inverse:!0,data:i.map(O=>O[p]),axisLabel:{color:Y,fontSize:T?10:11,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:[{type:"bar",barWidth:B,barGap:"-100%",data:i.map((O,J)=>({value:O[r],itemStyle:{borderRadius:F?[1,10,10,1]:[0,7,7,0],color:qo(F?A[J%A.length]:y[J%y.length],F),shadowBlur:F?3:0,shadowColor:F?"rgba(48, 220, 255, 0.16)":"transparent"}})),showBackground:!0,backgroundStyle:{color:F?"rgba(48, 220, 255, 0.05)":"rgba(48, 220, 255, 0.07)",borderRadius:F?[1,10,10,1]:[0,7,7,0]},label:{show:!0,position:"right",color:L,fontFamily:Yi.number,fontSize:T?10:hr.chartLabel,fontWeight:700,formatter:({value:O})=>`${l==="%"?Je(O):ae(O)}`},markLine:c.showAverage===!1?void 0:{silent:!0,symbol:"none",label:{show:!1},lineStyle:{color:"rgba(139, 247, 255, 0.22)",type:"dashed",width:1},data:[{xAxis:Math.round(w*.72)}]}},...F?[{type:"pictorialBar",symbol:"rect",symbolSize:[2,B+5],symbolOffset:[0,0],symbolPosition:"end",z:4,data:i.map((O,J)=>({value:O[r],itemStyle:{color:L,opacity:J<3?.82:.56,shadowBlur:2,shadowColor:"rgba(139, 247, 255, 0.16)"}}))}]:[]]}}function qo(i,r=!1){return new Ee(0,0,1,0,[{offset:0,color:r?`${i}22`:"rgba(48, 220, 255, 0.12)"},{offset:.64,color:r?i:`${i}cc`},{offset:1,color:i}])}function Un(i,r,l,c=0,p=!1){return{name:i,type:"line",yAxisIndex:c,smooth:!0,symbolSize:5,data:r,lineStyle:{width:2.5,color:l},itemStyle:{color:l},areaStyle:p?{color:new Ee(0,0,0,1,[{offset:0,color:`${l}44`},{offset:1,color:`${l}05`}])}:void 0}}function Uo(i){return di.find(r=>r.key===i)||di[2]}function Ko(i,r="month"){if(r==="month")return Zl(i);const l=Xl(i),c=Math.max(1,Math.round(Math.max(1,l-1)*30)),p=r==="week"?7:1,y=Math.ceil(c/p)+1,w=Array.from({length:y},(A,Y)=>{const X=Math.min(c,Y*p);return Jl(X)}),T=w.map((A,Y)=>{const O=Math.min(c,Y*p)/c,J=Math.sin(Y/(r==="week"?1.8:8.5))*Math.sin(Math.PI*O)*Math.min(360,i.months*18);return Math.round(ot+(i.stock-ot)*O+J)}),F=w.map((A,Y)=>{const X=Math.min(c,Y*p)/c;return Math.round(i.births*X)}),B=w.map((A,Y)=>{const X=Math.min(c,Y*p)/c;return Math.round(i.outflow*X)});return{labels:w,stock:T,births:F,outflow:B}}function Zo(i,r){return r==="day"?Math.max(10,Math.ceil(i/6)):r==="week"?Math.max(2,Math.ceil(i/7)):i>24?4:i>14?2:1}function Xo(i,r){return r==="day"?i>700?2:i>360?3:4:r==="week"?i>110?4:6:i>24?7:10}function Jo(i){return(i.labels||[]).map((r,l)=>{var A,Y,X,O,J,Ne;const c=Number(((A=i.stock)==null?void 0:A[Math.max(l-1,0)])||0),p=Number(((Y=i.stock)==null?void 0:Y[l])||c),y=Math.max(0,Number(((X=i.births)==null?void 0:X[l])||0)-Number(((O=i.births)==null?void 0:O[Math.max(l-1,0)])||0)),w=Math.max(0,Number(((J=i.outflow)==null?void 0:J[l])||0)-Number(((Ne=i.outflow)==null?void 0:Ne[Math.max(l-1,0)])||0)),T=Math.max(120,Math.round((y+w)*.18)),F=Math.max(c,p)+Math.max(T,Math.round(y*.32)),B=Math.max(0,Math.min(c,p)-Math.max(T,Math.round(w*.32)));return{label:r,open:c,close:p,low:B,high:F,birth:y,outflow:w,value:[c,p,B,F]}})}function Qo(i,r){const l=new Map;return i.forEach(c=>{const p=el(c.name);if(!p)return;const y=l.get(p)||{name:p,value:0};y.value+=Number(c[r]||0),l.set(p,y)}),[...l.values()].sort((c,p)=>p.value-c.value)}function el(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:m,fontFamily:Yi.ui,fontSize:hr.tooltip,lineHeight:18},extraCssText:"box-shadow:0 0 10px rgba(0,210,255,.12);",formatter:i}}function Di(i){return vt.some(r=>r.key===i)?i:"structure"}function tl(i=[]){return i.map((r,l)=>{var y,w,T,F;const c=String(r.name||r.label||r.type||`结构${l+1}`).trim(),p=Kn((w=(y=r.value)!=null?y:r.count)!=null?w:r.number);return{key:r.key||r.id||`${c}-${l}`,name:c,count:p,ratio:Number((F=(T=r.ratio)!=null?T:r.percent)!=null?F:0),source:r.source||"结构统计"}}).filter(r=>r.name&&r.count>0)}function al(i=[],r=[]){const l=i.some(p=>Qn(p))?i:r,c=Jn(l,r).map((p,y)=>{var F,B;const w=String(p.name||p.label||`结构${y+1}`).trim(),T=Kn((B=(F=p.count)!=null?F:p.value)!=null?B:p.number);return $(R({},p),{key:p.key||`${w}-${y}`,name:w,count:T})}).filter(p=>p.name&&p.count>0);return il(c,ot)}function il(i=[],r=ot){const l=i.reduce((y,w)=>y+Number(w.count||0),0);if(!l||!r)return i;const c=i.map((y,w)=>{const T=Number.isFinite(Number(y.ratio))&&Number(y.ratio)>0?Number(y.ratio):Number(y.count||0)/l*100,F=r*T/100;return $(R({},y),{index:w,ratio:T,count:Math.floor(F),remainder:F-Math.floor(F)})});let p=r-c.reduce((y,w)=>y+w.count,0);return c.slice().sort((y,w)=>w.remainder-y.remainder||y.index-w.index).forEach(y=>{p<=0||(y.count+=1,p-=1)}),c.map(F=>{var B=F,{index:y,remainder:w}=B,T=rr(B,["index","remainder"]);return $(R({},T),{ratio:Number(T.ratio.toFixed(1))})})}function Kn(i){const r=Number(String(i!=null?i:"").replace(/,/g,"").replace(/%/g,""));return Number.isFinite(r)&&r>0?Math.round(r):0}function nl(i,r){const l=String((i==null?void 0:i.message)||i||"");return/未登录|401|HTTP_401/.test(l)?"结构数据未就绪":/超时|timeout/i.test(l)?"结构数据加载超时":r}function rl(i){const r=String(i||"").match(/-?\d+(?:\.\d+)?/);return r?Number(r[0]):0}function K(i){const r=Number(i);return Number.isFinite(r)?r.toLocaleString("zh-CN",{maximumFractionDigits:Number.isInteger(r)?0:2}):"--"}function ae(i){const r=Number(i);return Number.isFinite(r)?Math.abs(r)>=1e4?`${(r/1e4).toFixed(Math.abs(r)>=1e5?0:1)}万`:Math.round(r).toLocaleString("zh-CN"):"--"}function ja(i,r=2){const l=Number(i);return Number.isFinite(l)?`${(l/1e4).toFixed(r)}万`:"--"}function Je(i){const r=Number(i);return Number.isFinite(r)?`${Number.isInteger(r)?r:r.toFixed(1)}%`:"--"}function Dt(i,r,l,c){const p=c*Math.PI/180;return{x:Number((i+l*Math.cos(p)).toFixed(2)),y:Number((r+l*Math.sin(p)).toFixed(2))}}function sl(i,r,l,c,p,y){const w=Dt(i,r,c,p),T=Dt(i,r,c,y),F=Dt(i,r,l,y),B=Dt(i,r,l,p),A=y-p>180?1:0;return[`M ${w.x} ${w.y}`,`A ${c} ${c} 0 ${A} 1 ${T.x} ${T.y}`,`L ${F.x} ${F.y}`,`A ${l} ${l} 0 ${A} 0 ${B.x} ${B.y}`,"Z"].join(" ")}function Zn(i=[]){return i.reduce((r,l)=>{const c=wa.find(p=>p.key===l);return r+Number((c==null?void 0:c.ratio)||0)},0)}function Xn(){return[{key:"fertileCow",name:"适龄能繁母牛",color:"#30dcff",matcher:(i,r)=>i==="fertileCow"||r.includes("适龄能繁母牛")},{key:"meatBull",name:"麦洼公牦牛",color:"#48cfff",matcher:(i,r)=>i==="meatBull"||r.includes("肉公牛")||r.includes("麦洼公牦牛")},{key:"breedingBull",name:"种公牛",color:"#58d9ff",matcher:(i,r)=>i==="breedingBull"||r.includes("种公牛")},{key:"femaleCalf",name:"母犊牛",color:"#30dcff",matcher:(i,r)=>i==="femaleCalf"||r.includes("母犊牛")},{key:"maleCalf",name:"公犊牛",color:"#8bf7ff",matcher:(i,r)=>i==="maleCalf"||r.includes("公犊牛")},{key:"overageCow",name:"过龄能繁母牛",color:"#48cfff",matcher:(i,r)=>i==="overageCow"||r.includes("过龄能繁母牛")}]}function ol(i=[]){const r=i.reduce((c,p)=>c+Number(p.count||0),0)||1;return[{key:"female",group:"性别",name:"母牛合计",color:"#8bf7ff",matcher:(c,p)=>["fertileCow","femaleCalf","overageCow"].includes(c)||p.includes("母")},{key:"male",group:"性别",name:"公牛合计",color:"#30dcff",matcher:(c,p)=>["meatBull","breedingBull","maleCalf"].includes(c)||p.includes("公")||p.includes("肉牛")},{key:"calf",group:"阶段",name:"犊牛合计",color:"#8bf7ff",matcher:(c,p)=>["femaleCalf","maleCalf"].includes(c)||p.includes("犊牛")},{key:"breeding-cow",group:"阶段",name:"能繁母牛",color:"#48cfff",matcher:(c,p)=>["fertileCow","overageCow"].includes(c)||p.includes("能繁母牛")}].map(c=>{const p=i.filter(y=>c.matcher(String(y.key||""),String(y.name||""))).reduce((y,w)=>y+Number(w.count||0),0);return{key:c.key,group:c.group,name:c.name,color:c.color,count:p,percent:p/r*100}})}function Jn(i=[],r=[]){const c=i.some(w=>Qn(w))?i:r,p=c.reduce((w,T)=>w+Number(T.count||0),0)||ot||1;return Xn().map(w=>{const T=c.filter(A=>w.matcher(String(A.key||""),String(A.name||""))),F=T.reduce((A,Y)=>A+Number(Y.count||0),0),B=T.length===1?Number(T[0].ratio):Number.NaN;return{key:w.key,name:w.name,color:w.color,count:F,percent:Number.isFinite(B)&&B>0?B:F/p*100}}).filter(w=>w.count>0||w.percent>0)}function Qn(i={}){const r=String(i.key||""),l=String(i.name||"");return Xn().some(c=>c.matcher(r,l))}function ll(i=[],r=[]){const c=i.some(w=>ul(w))?i:r,p=c.reduce((w,T)=>w+Number(T.count||0),0)||1,y=(w,T,F,B,A)=>{const Y=c.filter(J=>B(String(J.key||""),String(J.name||""))),X=Y.reduce((J,Ne)=>J+Number(Ne.count||0),0),O=Y.length===1?Number(Y[0].ratio):Number.NaN;return{key:w,name:T,color:F,count:X,percent:Number.isFinite(O)&&O>0?O:X/p*100,desc:A}};return[y("fertile-cow","适龄能繁母牛","#30dcff",(w,T)=>w==="fertileCow"||T.includes("适龄能繁母牛"),"繁殖基础"),y("calf","犊牛合计","#8bf7ff",(w,T)=>["femaleCalf","maleCalf"].includes(w)||T.includes("犊牛"),"新生补充"),y("overage-cow","过龄能繁母牛","#30dcff",(w,T)=>w==="overageCow"||T.includes("过龄能繁母牛"),"更新压力"),y("breeding-bull","种公牛配比","#48cfff",(w,T)=>w==="breedingBull"||T.includes("种公牛"),"配种支撑")]}function ul(i={}){const r=String(i.key||""),l=String(i.name||"");return["fertileCow","femaleCalf","maleCalf","overageCow","breedingBull"].includes(r)||l.includes("适龄能繁母牛")||l.includes("犊牛")||l.includes("过龄能繁母牛")||l.includes("种公牛")}function cl(i=[]){const r=w=>{var T;return Number(((T=i.find(F=>F.key===w))==null?void 0:T.percent)||0)},l=r("fertile-cow"),c=r("calf"),p=r("overage-cow"),y=r("breeding-bull");return l>=40&&c>=25&&y>=2&&y<=5&&p<=10?{label:"结构健康",title:"繁殖基础稳定",summary:"适龄母牛足,犊牛补充稳",note:"保持适龄能繁母牛、犊牛补充与种公牛配置稳定。"}:c<25?{label:"结构健康",title:"犊牛补充需关注",summary:"繁殖基础稳定,补充端可优化",note:"关注犊牛成活和季节性补栏,保持生产连续性。"}:y<2?{label:"结构健康",title:"繁殖基础总体稳定",summary:"适龄母牛基础较稳",note:"结合实际配种需求,平稳优化公牛配置。"}:{label:"结构健康",title:"生产阶段较均衡",summary:"繁殖群和犊牛补充连续支撑",note:"延续结构管理,优先保障适龄母牛与犊牛质量。"}}function dl(i){const r=Number((i==null?void 0:i.count)||0);return Math.max(8,Math.min(100,r/ts.value*100))}function hl(i={}){const r=ot,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 c=r;const p=[{key:"current",name:"当前存栏",type:"anchor",value:r,magnitude:r,from:r,to:r,color:"#30dcff",display:`${ja(r,2)}头`}];l.forEach(T=>{const F=c,B=c+T.delta;c=B,p.push($(R({},T),{name:`${T.delta>=0?"+":"-"}${T.name}`,type:"delta",from:F,to:B,value:T.delta,magnitude:Math.abs(T.delta),display:`${pl(T.delta)}头`}))});const y=Number(i.stock||c);p.push({key:"final",name:"=期末预测",type:"final",value:y,magnitude:y,from:y,to:y,color:"#48cfff",display:`${ja(y,2)}头`});const w=Math.max(...p.map(T=>Number(T.magnitude)||0),1);return p.map(T=>{const F=(Number(T.magnitude)||0)/w*100;return $(R({},T),{left:0,width:Math.max(T.type==="delta"?5:10,Math.min(100,F))})})}function Ha(i){const r=Number(i);return Number.isFinite(r)?`${r>=0?"+":"-"}${K(Math.abs(r))}`:"--"}function pl(i){const r=Number(i);return Number.isFinite(r)?`${r>=0?"+":"-"}${ja(Math.abs(r))}`:"--"}return(i,r)=>(I(),_("div",Zu,[Qe((I(),Ua(Ku,{key:Zr.value,ref_key:"mapSceneRef",ref:Oe,class:"yak-map-scene","active-layer":$s.value,"map-ranking":Vs.value,"tile-url-template":en.value,"use-satellite-base":hi.value,"satellite-max-zoom":21,"admin-boundary-line-scale":1.35,onLayerStatus:Hn,onTileStatus:qn},null,8,["active-layer","map-ranking","tile-url-template","use-satellite-base"])),[[bl,!nt.value]]),nt.value?(I(),Ua(ou,{key:Qi.value,ref_key:"yakOlMapRef",ref:oa,class:"yak-ol-map-layer",active:a.active&&nt.value,"tile-url-template":en.value,center:Es.value,"initial-zoom":ah,"minimum-zoom-distance":1,"county-view-target-offset":se,"auto-apply-layer-map-view":!1,"max-zoom":21,"overlay-layer":mn.value,onReady:jo,onLayerStatus:Hn,onTileStatus:qn},null,8,["active","tile-url-template","center","overlay-layer"])):Le("",!0),f("div",{class:Ye(["yak-map-scrim",{"is-ol-map":nt.value}])},null,2),zs.value?(I(),_("div",Xu,P(Os.value),1)):Le("",!0),f("div",Ju,[W.value==="trade"&&hn.value.length?(I(),_("div",Qu,[r[24]||(r[24]=f("span",null,"交易年份",-1)),(I(!0),_(ie,null,pe(hn.value,l=>(I(),_("button",{key:l,type:"button",class:Ye({active:Number(l)===Number(Me.value)}),onClick:c=>Vo(l)},P(l),11,ec))),128))])):Le("",!0),W.value==="epidemic"&&Fe.length?(I(),_("div",tc,[r[25]||(r[25]=f("span",null,"防疫年份",-1)),(I(),_(ie,null,pe(Fe,l=>f("button",{key:l,type:"button",class:Ye({active:Number(l)===Number(ge.value)}),onClick:c=>zo(l)},P(l),11,ac)),64))])):Le("",!0),W.value==="forecast"?(I(),_("div",ic,[r[26]||(r[26]=f("span",null,"预测年份",-1)),(I(!0),_(ie,null,pe(j(Bt),l=>(I(),_("button",{key:l.key,type:"button",class:Ye({active:l.key===tt.value}),onClick:c=>ho(l.key)},P(l.shortLabel),11,nc))),128))])):Le("",!0),f("div",rc,[f("div",sc,[W.value==="structure"?(I(),_(ie,{key:0},[H(le,{class:"yak-side-card left-card",title:"繁殖基础评估",width:j(s),height:u.value},{default:oe(()=>[f("div",oc,[f("div",lc,[f("strong",null,P(nn.value.title)+","+P(nn.value.summary),1)]),f("div",uc,[(I(!0),_(ie,null,pe(an.value,l=>(I(),_("div",{key:l.key,class:"breeding-health-item",style:Ct({"--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(Je(l.percent)),1),r[27]||(r[27]=f("i",null,[f("b")],-1)),f("em",null,P(l.desc),1)],4))),128))])])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"畜群结构占比",width:j(s),height:u.value},{default:oe(()=>[f("div",cc,[f("div",dc,[f("div",hc,[(I(),_("svg",pc,[f("g",fc,[(I(!0),_(ie,null,pe(as.value,l=>(I(),_("path",{key:l.key,class:Ye(["structure-rose-segment",{"is-active":l.index===fi.value}]),d:l.path,fill:l.color,stroke:l.color},null,10,mc))),128))]),r[28]||(r[28]=f("circle",{class:"structure-rose-glow",cx:"75",cy:"75",r:"24"},null,-1)),r[29]||(r[29]=f("circle",{class:"structure-rose-hole",cx:"75",cy:"75",r:"16"},null,-1)),r[30]||(r[30]=f("text",{class:"structure-rose-center",x:"75",y:"72","text-anchor":"middle"},"结构",-1)),r[31]||(r[31]=f("text",{class:"structure-rose-center is-sub",x:"75",y:"83","text-anchor":"middle"},"占比",-1))]))]),f("div",gc,[(I(!0),_(ie,null,pe(Ra.value,(l,c)=>(I(),_("div",{key:l.key||l.name,class:Ye(["structure-ratio-row",{"is-active":c===fi.value}]),style:Ct({"--row-color":l.color,"--row-percent":`${Math.max(4,l.percent)}%`})},[f("i",{style:Ct({background:l.color,color:l.color})},null,4),f("span",null,[Wt(P(l.name),1),f("small",null,P(Je(l.percent)),1)]),f("strong",null,P(ae(l.count)),1),r[32]||(r[32]=f("em",null,"头",-1))],6))),128))])]),dt.value?(I(),_("div",yc,"结构数据加载中")):$e.value?(I(),_("div",bc,P($e.value),1)):Le("",!0)])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"母牛/公牛年龄结构",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Ws.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"牦牛乡镇分布",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Ys.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"])],64)):W.value==="forecast"?(I(),_(ie,{key:1},[H(le,{class:"yak-side-card left-card",title:"存栏变化拆解",width:j(s),height:u.value},{default:oe(()=>[f("div",vc,[f("div",wc,[f("span",null,P(Ze.value.label)+"变化路径",1),f("strong",{class:Ye({positive:pi.value>0,negative:pi.value<0})},[Wt(" 净变化 "+P(Ha(pi.value)),1),r[33]||(r[33]=f("em",null,"头",-1))],2)]),f("div",Lc,[(I(!0),_(ie,null,pe(Jr.value,l=>(I(),_("div",{key:l.key,class:Ye(["forecast-waterfall-row",[`is-${l.type}`,{positive:l.delta>0,negative:l.delta<0}]]),style:Ct({"--waterfall-left":`${l.left}%`,"--waterfall-width":`${l.width}%`,"--waterfall-color":l.color})},[f("span",null,P(l.name),1),r[34]||(r[34]=f("i",null,[f("b")],-1)),f("strong",null,P(l.display),1)],6))),128))])])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"未来存栏趋势",width:j(s),height:u.value},{default:oe(()=>[f("div",Tc,[f("div",Sc,[(I(),_(ie,null,pe(di,l=>f("button",{key:l.key,type:"button",class:Ye({active:l.key===Ft.value}),onClick:c=>Ft.value=l.key},P(l.label),11,Mc)),64))]),H(j(Pe),{class:"yak-chart forecast-kline-chart",option:Us.value,autoresize:!0},null,8,["option"])])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"月度数量预测",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Ks.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"预测因子雷达",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Zs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"])],64)):W.value==="epidemic"?(I(),_(ie,{key:2},[H(le,{class:"yak-side-card left-card",title:"防疫统计",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:no.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"养殖户防疫排行",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:ro.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"防疫作业趋势",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:io.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"疫苗类型分布",width:j(s),height:u.value},{default:oe(()=>[Ga.value.length?(I(),_("div",kc,[f("div",Pc,[(I(),Ua(Bl,{key:ns.value,data:Ga.value,delay:3e3,colors:Ce,opacity:.62,class:"epidemic-three-pie"},{default:oe(({data:l})=>[f("div",Cc,[f("strong",null,P(ae((l==null?void 0:l.count)||gt.value)),1),f("span",null,P((l==null?void 0:l.name)||"疫苗类型"),1)])]),_:1},8,["data"]))]),f("div",Fc,[(I(!0),_(ie,null,pe(Ga.value,(l,c)=>(I(),_("div",{key:l.key||l.name,class:"epidemic-three-pie-row"},[f("i",{style:Ct({borderColor:Ce[c%Ce.length]})},null,4),f("span",null,P(l.name),1),f("strong",null,P(ae(l.value)),1),f("em",null,P(l.unit),1)]))),128))])])):(I(),_("div",xc,"暂无疫苗类型数据"))]),_:1},8,["width","height"])],64)):W.value==="trade"?(I(),_(ie,{key:3},[H(le,{class:"yak-side-card left-card",title:"交易异常关注",width:j(s),height:u.value},{default:oe(()=>[f("div",Nc,[f("div",Rc,[f("span",null,P(Me.value)+"年流通监管线索",1),f("strong",null,P(Cs.value),1)]),f("div",Ic,[(I(!0),_(ie,null,pe(fn.value,l=>(I(),_("div",{key:l.key,class:Ye(["trade-risk-row",`is-${l.level}`]),style:Ct({"--risk-color":l.color})},[r[35]||(r[35]=f("i",null,null,-1)),f("span",null,[f("em",null,[f("b",null,P(l.badge),1),Wt(P(l.name),1)]),f("small",null,P(l.value)+"|"+P(l.desc),1)])],6))),128))])])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"交易流通趋势",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:so.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"来源乡镇分布",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:oo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"用途结构统计",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:lo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"])],64)):Le("",!0)])]),f("div",Gc,[f("div",_c,[W.value==="structure"?(I(),_(ie,{key:0},[H(le,{class:"yak-side-card right-card",title:"乡镇存栏排行",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:js.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"能繁母牛与犊牛分布",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Hs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"出栏/交易影响",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:qs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"性别与生产阶段汇总",width:j(s),height:u.value},{default:oe(()=>[f("div",Bc,[f("div",Ac,[(I(!0),_(ie,null,pe(tn.value,l=>(I(),_("div",{key:l.key||l.name,class:"structure-summary-row",style:Ct({"--structure-color":l.color,"--structure-width":`${dl(l)}%`})},[f("span",null,[r[36]||(r[36]=f("i",null,null,-1)),Wt(P(l.name),1)]),r[38]||(r[38]=f("b",null,[f("em")],-1)),f("strong",null,[Wt(P(ae(l.count)),1),r[37]||(r[37]=f("em",null,"头",-1))]),f("small",null,P(Je(l.percent)),1)],4))),128))]),dt.value?(I(),_("div",Ec,"结构数据加载中")):$e.value?(I(),_("div",$c,P($e.value),1)):Le("",!0)])]),_:1},8,["width","height"])],64)):W.value==="forecast"?(I(),_(ie,{key:1},[H(le,{class:"yak-side-card right-card",title:"乡镇预测排行",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Xs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"期末结构预测",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Js.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"补充/流出对比",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Qs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"预测变化热力",width:j(s),height:u.value},{default:oe(()=>[f("div",Vc,[(I(!0),_(ie,null,pe(eo.value,l=>(I(),_("div",{key:l.name,class:Ye(["heat-row",{"is-negative":l.change<0}]),style:Ct(to(l)),title:ao(l)},[f("span",null,P(l.name),1),r[39]||(r[39]=f("b",null,[f("i")],-1)),f("strong",null,P(Ha(l.change)),1)],14,zc))),128))])]),_:1},8,["width","height"])],64)):W.value==="epidemic"?(I(),Ua(le,{key:2,class:"yak-side-card right-card epidemic-ledger-card",title:"防疫记录台账",width:j(s),height:d.value},{default:oe(()=>[f("div",Oc,[f("div",Dc,[f("span",null,P(ge.value)+"年 共 "+P(K(Ue.value))+" 条",1),f("div",null,[Qe(f("input",{"onUpdate:modelValue":r[0]||(r[0]=l=>pt.value=l),type:"search",placeholder:"耳标/养殖户/疫苗",onKeyup:Ka($n,["enter"])},null,544),[[Xt,pt.value]]),f("button",{type:"button",onClick:$n},"搜索"),f("button",{type:"button",class:"is-more",onClick:r[1]||(r[1]=l=>zn())},"查看更多")])]),r[40]||(r[40]=f("div",{class:"epidemic-record-header"},[f("span",null,"电子耳标"),f("span",null,"养殖户"),f("span",null,"镇/乡"),f("span",null,"疫苗"),f("span",null,"时间")],-1)),f("div",Wc,[(I(!0),_(ie,null,pe(gs.value,l=>(I(),_("button",{key:l.epidemicId||l.earTag,type:"button",onClick:c=>zn(l)},[f("span",null,P(te(l.earTag)),1),f("span",null,P(te(l.owner)),1),f("span",null,P(te(l.town)),1),f("strong",null,P(te(l.medicine)),1),f("span",null,P(Gt(l.operateTime)),1)],8,Yc))),128)),Ve.value.length?Le("",!0):(I(),_("div",jc,P(v.value?"防疫台账读取中":N.value||"暂无防疫记录"),1))]),f("div",Hc,[f("span",null,"第 "+P(ve.value)+" / "+P(Ti.value)+" 页",1),f("button",{type:"button",disabled:ve.value<=1,onClick:r[2]||(r[2]=l=>Vn(ve.value-1))},"上一页",8,qc),f("button",{type:"button",disabled:ve.value>=Ti.value,onClick:r[3]||(r[3]=l=>Vn(ve.value+1))},"下一页",8,Uc)])])]),_:1},8,["width","height"])):W.value==="trade"?(I(),_(ie,{key:3},[H(le,{class:"yak-side-card right-card",title:"出证结构统计",width:j(s),height:u.value},{default:oe(()=>[f("div",Kc,[f("div",Zc,[f("span",null,[r[42]||(r[42]=f("em",null,"省外流通 A证",-1)),f("strong",null,[Wt(P(K(De("outProvinceHeads","aCertHeads"))),1),r[41]||(r[41]=f("b",null,"头",-1))]),f("small",null,P(K(De("outProvinceCount","aCertCount")))+"条记录",1)]),f("span",null,[r[44]||(r[44]=f("em",null,"省内流通 B证",-1)),f("strong",null,[Wt(P(K(De("inProvinceHeads","bCertHeads"))),1),r[43]||(r[43]=f("b",null,"头",-1))]),f("small",null,P(K(De("inProvinceCount","bCertCount")))+"条记录",1)])]),H(j(Pe),{class:"trade-cert-chart",option:uo.value,autoresize:!0},null,8,["option"])])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card trade-source-card",title:"出栏来源排行",width:j(s),height:h.value},{default:oe(()=>[f("div",Xc,[(I(!0),_(ie,null,pe(Aa.value,(l,c)=>(I(),_("div",{key:l.name,class:"trade-dest-row",style:Ct({"--trade-ratio":`${l.ratio}%`})},[f("span",null,P(c+1),1),f("strong",null,P(l.name),1),f("em",null,P(ae(l.headCount))+"头",1)],4))),128)),Aa.value.length?Le("",!0):(I(),_("div",Jc,P(Lt.value?"交易数据读取中":Tt.value||"暂无出栏来源数据"),1))])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card trade-ledger-card",title:"交易出证台账",width:j(s),height:g.value},{default:oe(()=>[f("div",Qc,[f("div",ed,[f("span",null,"共 "+P(K(ft.value))+" 条",1),f("div",null,[Qe(f("input",{"onUpdate:modelValue":r[4]||(r[4]=l=>Ma.value=l),type:"search",placeholder:"货主/车辆/检疫号/地区",onKeyup:Ka(xn,["enter"])},null,544),[[Xt,Ma.value]]),f("button",{type:"button",onClick:xn},"搜索"),f("button",{type:"button",class:"is-more",onClick:r[5]||(r[5]=l=>Rn())},"查看更多")])]),r[45]||(r[45]=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",td,[(I(!0),_(ie,null,pe(pn.value,l=>(I(),_("button",{key:l.certId,type:"button",onClick:c=>Rn(l)},[f("span",null,P(te(l.ownerName)),1),f("span",null,P(te(l.transportNumber)),1),f("strong",null,P(K(l.amount))+"头",1),f("span",null,P(te(l.startTown)),1),f("span",null,P(te(l.usageTypeName)),1),f("span",null,P(Gt(l.issueTime)),1)],8,ad))),128)),pn.value.length?Le("",!0):(I(),_("div",id,P(Lt.value?"交易台账读取中":Tt.value||"暂无交易记录"),1))]),f("div",nd,[f("span",null,"第 "+P(St.value)+" / "+P(Mi.value)+" 页",1),f("button",{type:"button",disabled:St.value<=1,onClick:r[6]||(r[6]=l=>Nn(St.value-1))},"上一页",8,rd),f("button",{type:"button",disabled:St.value>=Mi.value,onClick:r[7]||(r[7]=l=>Nn(St.value+1))},"下一页",8,sd)])])]),_:1},8,["width","height"])],64)):Le("",!0)])]),f("div",od,[H(nu,{"model-value":W.value,topics:vt,"onUpdate:modelValue":r[8]||(r[8]=l=>W.value=l)},null,8,["model-value"])]),nt.value?(I(),_("div",ld,[H(ru,{modelValue:He.value,"onUpdate:modelValue":r[9]||(r[9]=l=>He.value=l),"topic-key":"yak-management",layers:Is.value,legends:_s.value,multiple:"",compact:"",width:248,height:Bs.value},null,8,["modelValue","layers","legends","height"])])):Le("",!0)]),z.value?(I(),_("div",{key:2,class:"epidemic-ledger-modal",onClick:Za(On,["self"])},[f("div",ud,[f("div",cd,[f("div",null,[r[46]||(r[46]=f("span",null,"牦牛防疫台账",-1)),f("strong",null,P(ge.value)+"年 "+P(K(ne.value))+" 条记录",1)]),f("button",{type:"button",onClick:On},"关闭")]),f("div",dd,[Qe(f("input",{"onUpdate:modelValue":r[10]||(r[10]=l=>fe.value.keyword=l),type:"search",placeholder:"耳标 / 养殖户 / 药品","aria-label":"耳标 / 养殖户 / 药品",onKeyup:Ka(Dn,["enter"])},null,544),[[Xt,fe.value.keyword]]),Qe(f("select",{"onUpdate:modelValue":r[11]||(r[11]=l=>fe.value.town=l)},[r[47]||(r[47]=f("option",{value:""},"全部镇/乡",-1)),(I(!0),_(ie,null,pe(bs.value,l=>(I(),_("option",{key:l,value:l},P(l),9,hd))),128))],512),[[ga,fe.value.town]]),Qe(f("select",{"onUpdate:modelValue":r[12]||(r[12]=l=>fe.value.medicine=l)},[r[48]||(r[48]=f("option",{value:""},"全部疫苗",-1)),(I(!0),_(ie,null,pe(vs.value,l=>(I(),_("option",{key:l,value:l},P(l),9,pd))),128))],512),[[ga,fe.value.medicine]]),Qe(f("input",{"onUpdate:modelValue":r[13]||(r[13]=l=>fe.value.startDate=l),type:"date"},null,512),[[Xt,fe.value.startDate]]),Qe(f("input",{"onUpdate:modelValue":r[14]||(r[14]=l=>fe.value.endDate=l),type:"date"},null,512),[[Xt,fe.value.endDate]]),f("button",{type:"button",onClick:Dn},"检索"),f("button",{type:"button",class:"is-ghost",onClick:Wo},"重置")]),f("div",fd,[f("div",md,[r[49]||(r[49]=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)),(I(!0),_(ie,null,pe(q.value,l=>{var c,p;return I(),_("button",{key:l.epidemicId||l.earTag,type:"button",class:Ye({active:(((c=_e.value)==null?void 0:c.epidemicId)||((p=_e.value)==null?void 0:p.earTag))===(l.epidemicId||l.earTag)}),onClick:y=>Yn(l)},[f("span",null,P(te(l.earTag)),1),f("span",null,P(te(l.owner)),1),f("span",null,P(te(l.town)),1),f("span",null,P(te(l.village)),1),f("strong",null,P(te(l.medicine)),1),f("span",null,P(Gt(l.operateTime)),1),f("span",null,P($i(l).length?`${$i(l).length}张`:"无"),1)],10,gd)}),128)),q.value.length?Le("",!0):(I(),_("div",yd,P(Ge.value?"台账读取中":ze.value||"暂无匹配记录"),1))]),f("div",bd,[f("div",vd,[f("div",null,[f("span",null,P(te(Ot.value.earTag)),1),f("em",null,P(te(Ot.value.medicine||Ot.value.preventionType)),1)]),f("strong",null,P(Ae.value?"加载中":Gt(Ot.value.operateTime)),1)]),f("div",wd,[(I(!0),_(ie,null,pe(ys.value,l=>(I(),_("span",{key:l.label,class:Ye({"is-wide":l.wide})},[f("em",null,P(l.label),1),f("strong",null,P(l.value),1)],2))),128))]),cn.value.length?(I(),_("div",Ld,[r[50]||(r[50]=f("div",{class:"epidemic-detail-photo-title"},"现场照片",-1)),f("div",Td,[(I(!0),_(ie,null,pe(cn.value.slice(0,6),l=>(I(),_("button",{key:l,type:"button",class:"epidemic-modal-photo-thumb",onClick:Za(c=>Go(l),["stop"])},[f("img",{src:kn(l),alt:"防疫照片"},null,8,Md)],8,Sd))),128))])])):Le("",!0)])]),f("div",kd,[f("span",null,"第 "+P(ce.value)+" / "+P(un.value)+" 页",1),f("button",{type:"button",disabled:ce.value<=1,onClick:r[15]||(r[15]=l=>Wn(ce.value-1))},"上一页",8,Pd),f("button",{type:"button",disabled:ce.value>=un.value,onClick:r[16]||(r[16]=l=>Wn(ce.value+1))},"下一页",8,Cd)])])])):Le("",!0),si.value?(I(),_("div",{key:3,class:"epidemic-ledger-modal trade-ledger-modal",onClick:Za(In,["self"])},[f("div",Fd,[f("div",xd,[f("div",null,[r[51]||(r[51]=f("span",null,"牦牛交易出证台账",-1)),f("strong",null,P(Me.value)+"年 "+P(K(ka.value))+" 条记录",1)]),f("button",{type:"button",onClick:In},"关闭")]),f("div",Nd,[Qe(f("input",{"onUpdate:modelValue":r[17]||(r[17]=l=>mt.value.keyword=l),type:"search",placeholder:"货主 / 车辆 / 检疫号 / 地区",onKeyup:Ka(Gn,["enter"])},null,544),[[Xt,mt.value.keyword]]),Qe(f("select",{"onUpdate:modelValue":r[18]||(r[18]=l=>mt.value.startTown=l)},[r[52]||(r[52]=f("option",{value:""},"全部来源乡镇",-1)),(I(!0),_(ie,null,pe(Ss.value,l=>(I(),_("option",{key:l,value:l},P(l),9,Rd))),128))],512),[[ga,mt.value.startTown]]),Qe(f("select",{"onUpdate:modelValue":r[19]||(r[19]=l=>mt.value.usageType=l)},[r[53]||(r[53]=f("option",{value:""},"全部用途",-1)),(I(!0),_(ie,null,pe(Ms.value,l=>(I(),_("option",{key:l,value:l},P(l),9,Id))),128))],512),[[ga,mt.value.usageType]]),Qe(f("select",{"onUpdate:modelValue":r[20]||(r[20]=l=>mt.value.certType=l)},[r[54]||(r[54]=f("option",{value:""},"全部证书",-1)),(I(!0),_(ie,null,pe(ks.value,l=>(I(),_("option",{key:l.value,value:l.value},P(l.label),9,Gd))),128))],512),[[ga,mt.value.certType]]),f("button",{type:"button",onClick:Gn},"检索"),f("button",{type:"button",class:"is-ghost",onClick:Oo},"重置")]),f("div",_d,[f("div",Bd,[r[55]||(r[55]=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)),(I(!0),_(ie,null,pe(Et.value,l=>(I(),_("button",{key:l.certId||l.factoryCode,type:"button",class:Ye({active:Ts.value===(l.certId||l.factoryCode)}),onClick:c=>Bn(l)},[f("span",null,P(te(l.ownerName)),1),f("span",null,P(te(l.certType||l.certScopeName)),1),f("span",null,P(te(l.transportNumber)),1),f("strong",null,P(K(l.amount))+"头",1),f("span",null,P(te(l.startTown)),1),f("span",null,P(te(l.usageTypeName)),1),f("span",null,P(Gt(l.issueTime)),1),f("span",null,P(te(l.statusName)),1)],10,Ad))),128)),Et.value.length?Le("",!0):(I(),_("div",Ed,P(oi.value?"交易台账读取中":li.value||"暂无匹配记录"),1))]),f("div",$d,[f("div",Vd,[f("div",null,[f("span",null,P(te(ye.value.factoryCode||ye.value.certId)),1),f("em",null,P(Cn(ye.value)),1)]),f("strong",null,P(Gt(ye.value.issueTime)),1)]),f("div",zd,[f("span",Od,[r[56]||(r[56]=f("em",null,"货主",-1)),f("strong",null,P(te(ye.value.ownerName)),1)]),f("span",null,[r[57]||(r[57]=f("em",null,"联系方式",-1)),f("strong",null,P(Pn(ye.value.ownerPhone)),1)]),f("span",null,[r[58]||(r[58]=f("em",null,"证书类型",-1)),f("strong",null,P(Cn(ye.value)),1)]),f("span",null,[r[59]||(r[59]=f("em",null,"车牌号",-1)),f("strong",null,P(te(ye.value.transportNumber)),1)]),f("span",null,[r[60]||(r[60]=f("em",null,"牦牛数量",-1)),f("strong",null,P(K(ye.value.amount))+"头",1)]),f("span",null,[r[61]||(r[61]=f("em",null,"用途",-1)),f("strong",null,P(te(ye.value.usageTypeName)),1)]),f("span",null,[r[62]||(r[62]=f("em",null,"来源乡镇",-1)),f("strong",null,P(te(ye.value.startTown)),1)]),f("span",null,[r[63]||(r[63]=f("em",null,"目的省份",-1)),f("strong",null,P(te(ye.value.destProvince)),1)]),f("span",null,[r[64]||(r[64]=f("em",null,"检疫员",-1)),f("strong",null,P(te(ye.value.quarantineOfficerName)),1)]),f("span",Dd,[r[65]||(r[65]=f("em",null,"状态",-1)),f("strong",null,P(te(ye.value.statusName)),1)]),f("span",Wd,[r[66]||(r[66]=f("em",null,"来源地区",-1)),f("strong",null,P(te(ye.value.startRegionFullName)),1)]),f("span",Yd,[r[67]||(r[67]=f("em",null,"目的地",-1)),f("strong",null,P(te(ye.value.destRegionFullName)),1)])]),f("button",{type:"button",class:"trade-detail-locate",disabled:!ye.value.startTown,onClick:r[21]||(r[21]=l=>Do(ye.value))}," 查看乡镇位置 ",8,jd)])]),f("div",Hd,[f("span",null,"第 "+P($t.value)+" / "+P(ki.value)+" 页",1),f("button",{type:"button",disabled:$t.value<=1,onClick:r[22]||(r[22]=l=>_n($t.value-1))},"上一页",8,qd),f("button",{type:"button",disabled:$t.value>=ki.value,onClick:r[23]||(r[23]=l=>_n($t.value+1))},"下一页",8,Ud)])])])):Le("",!0),Ke.value?(I(),_("div",{key:4,class:"epidemic-image-preview-modal",onClick:Za(Vi,["self"])},[f("div",Kd,[f("div",Zd,[f("div",null,[r[68]||(r[68]=f("span",null,"防疫照片",-1)),f("strong",null,P(te(Ot.value.earTag)),1)]),f("button",{type:"button",onClick:Vi},"关闭")]),f("div",Xd,[f("div",Jd,[f("img",{src:at.value,alt:"防疫照片预览"},null,8,Qd)])])])])):Le("",!0)]))}};export{Th as default};