import{i as e,t}from"./decimal-D3bp1pbs.js";import{i as n,r}from"./index-CAPJG_im.js";var i=(e,t)=>t===`cost`?e?.amount:e?.landArea;const a=(t,n)=>t==null&&n==null?!0:t==null||n==null?!1:e(t,6)===e(n,6),o=(e,t)=>String(e??``)===String(t??``),s=e=>e?.benchmarkBudgetBasicChecked===!1&&e?.benchmarkBudgetOptionalChecked===!1,c=(e,t)=>r(i(e,t),t),l=(n,r=`cost`)=>{let i=c(n,r);if(!i)return null;let a=n?.benchmarkBudgetBasicChecked===!1?0:i.basic,o=n?.benchmarkBudgetOptionalChecked===!1?0:i.optional;return{...i,basic:a,optional:o,total:s(n)?null:e(t(a,o),2)}},u=(e,t=`cost`)=>{if(s(e))return null;let r=l(e,t);return r?n({benchmarkBudgetBasic:r.basic,benchmarkBudgetOptional:r.optional,majorFactor:e?.majorFactor,consultCategoryFactor:e?.consultCategoryFactor,workStageFactor:e?.workStageFactor,workRatio:e?.workRatio}):null},d=(e,t=`cost`)=>u(e,t)?.total??null,f=(e,t)=>{let n=c(e,t),r=l(e,t),i=u(e,t);return{...e,benchmarkBudget:r?.total??null,benchmarkBudgetBasic:r?.basic??null,benchmarkBudgetOptional:r?.optional??null,basicFormula:e.benchmarkBudgetBasicChecked===!1?null:n?.basicFormula??``,optionalFormula:e.benchmarkBudgetOptionalChecked===!1?null:n?.optionalFormula??``,budgetFee:i?.total??null,budgetFeeBasic:i?.basic??null,budgetFeeOptional:i?.optional??null}},p=(e,t)=>{for(let n of e)Object.assign(n,f(n,t))},m=(e,t,n)=>(n===`cost`?a(e.amount,t.amount):a(e.landArea,t.landArea))&&a(e.benchmarkBudget,t.benchmarkBudget)&&a(e.benchmarkBudgetBasic,t.benchmarkBudgetBasic)&&a(e.benchmarkBudgetOptional,t.benchmarkBudgetOptional)&&o(e.basicFormula,t.basicFormula)&&o(e.optionalFormula,t.optionalFormula)&&a(e.budgetFee,t.budgetFee)&&a(e.budgetFeeBasic,t.budgetFeeBasic)&&a(e.budgetFeeOptional,t.budgetFeeOptional);export{f as a,m as i,u as n,p as o,a as r,d as t};