var y=Object.defineProperty,m=Object.defineProperties;var f=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;var R=(e,o,s)=>o in e?y(e,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[o]=s,i=(e,o)=>{for(var s in o||(o={}))g.call(o,s)&&R(e,s,o[s]);if(a)for(var s of a(o))d.call(o,s)&&R(e,s,o[s]);return e},n=(e,o)=>m(e,f(o));import{r as u,n as A}from"./index-25a05535-1786541781548.js";const l="/openApi";function c(e,o){return/^https?:\/\//.test(o)?o:`${e}${o.startsWith("/")?o:`/${o}`}`}function h(e){if((e==null?void 0:e.success)===!1||(e==null?void 0:e.code)!==void 0&&![0,200,"0","200"].includes(e.code)){const s=new Error((e==null?void 0:e.msg)||(e==null?void 0:e.message)||"接口请求失败");throw s.code=e==null?void 0:e.code,s}return A(e)}function p(){return u(c(l,"/screen2/industryChain/overview"),{timeout:18e3}).then(h).then(e=>e||{})}function G(){return u(c(l,"/screen2/industryChain/familyPasture"),{timeout:18e3}).then(h).then(e=>e||{})}function t(e){if(Array.isArray(e))return e;if(typeof e!="string"||!e.trim())return[];try{const o=JSON.parse(e);return Array.isArray(o)?o:[]}catch(o){return[]}}function J(){return u(c(l,"/screen2/industryChain/artificialGrassland"),{timeout:18e3}).then(h).then(e=>n(i({},e||{}),{projectRows:Array.isArray(e==null?void 0:e.projectRows)?e.projectRows.map(o=>n(i({},o),{towns:t(o.townsJson),locations:t(o.locationsJson),notes:t(o.notesJson)})):[]}))}function T(){return u(c(l,"/screen2/industryChain/breedingBases"),{timeout:18e3}).then(h).then(e=>n(i({},e||{}),{profileRows:Array.isArray(e==null?void 0:e.profileRows)?e.profileRows.map(o=>n(i({},o),{aliases:t(o.aliasesJson),facts:t(o.factsJson),highlights:t(o.highlightsJson)})):[]}))}const v=["storageTopRows","storageTownRows","storageGrassTypeRows","storageListRows","milkTopRows","milkTownRows","milkListRows","slaughterTopRows","slaughterTownRows","slaughterValueRows","slaughterAbilityRows","slaughterListRows","tradeTopRows","tradeTownRows","tradeOverviewRows","tradeListRows","tradeRecordRows","stageRows"];function B(){return u(c(l,"/screen2/industryChain/downstreamIndustry"),{timeout:18e3}).then(h).then(e=>{const o=i({},e||{});return v.forEach(s=>{var r;o[s]=Array.isArray(e==null?void 0:e[s])?e[s]:t((r=e==null?void 0:e[s])==null?void 0:r.value)}),o})}const C=["topRows","townshipRows","townshipGradeRows","villageGradeRows","authorizationRows","institutionRows","userRatingRows","creditOverviewRows","creditServiceContextRows","serviceCapabilityRows","financialRows","stageRows"],w=[{key:"A级",displayName:"A级",color:"#37f2bd",valueKey:"gradeA"},{key:"B级",displayName:"B级",color:"#30dcff",valueKey:"gradeB"},{key:"C级",displayName:"C级",color:"#f7d675",valueKey:"gradeC"},{key:"D级",displayName:"D级",color:"#ff9b88",valueKey:"gradeD"}];function k(){return u(c(l,"/screen2/industryChain/socialCredit"),{timeout:18e3}).then(h).then(e=>{const o=i({},e||{});return C.forEach(s=>{var r;o[s]=Array.isArray(e==null?void 0:e[s])?e[s]:t((r=e==null?void 0:e[s])==null?void 0:r.value)}),o.villageGradeRows=o.villageGradeRows.map(s=>n(i(i({},s),w.find(r=>r.key===s.key)||{}),{name:s.name||s.key,value:Number(s.value||0),percent:Number(s.percent||0)})),o.townshipGradeRows=o.townshipGradeRows.map(s=>n(i({},s),{total:Number(s.total||0),householdCount:Number(s.householdCount||0),authorizationRate:Number(s.authorizationRate||0),segments:w.map(r=>({key:r.key,displayName:r.displayName,color:r.color,name:r.key,value:Number(s[r.valueKey]||0)}))})),o})}function K(){return u(c(l,"/screen2/industryChain/creditHouseholds"),{timeout:3e4}).then(h).then(e=>{var o;return n(i({},e||{}),{householdRows:Array.isArray(e==null?void 0:e.householdRows)?e.householdRows:t((o=e==null?void 0:e.householdRows)==null?void 0:o.value)})})}export{G as a,J as b,T as c,B as d,k as e,K as f,p as g};