7 lines
79 KiB
JavaScript
7 lines
79 KiB
JavaScript
import{i as We,j as i,b0 as ju,T as P,B as ge,am as bt,ai as Zt,aX as St,ag as Me,av as De,aw as Le,ax as k,I as de,aL as wu,aM as Iu,aN as Tu,ab as Ru,br as Eu,ad as ku,d as In,a3 as M,b as _e,aU as Xe,ak as $,b2 as Pu,b3 as qe,al as Ou}from"./mui-vendor-CkIVaoQP.js";import{r as v,f as Tn,j as Rn}from"./react-vendor-CmFgShSM.js";import{r as He,L as G,j as V,X as _,h as Q,G as b,S as Ce,k as Fu,ez as Mu,p as je,eA as Je,eB as En,eC as kn,eD as Pn,eE as On,eF as Fn,eG as Mn,eH as Dn,eI as Se,eJ as Pt,eK as Ot,eL as Ft,eM as Mt,eN as Dt,eO as Lt,eP as zt,eQ as en,eR as Du,eS as Lu,eT as zu,eU as Nu,eV as Vu,eW as Ln,eX as Bu,eY as Wu,eZ as Hu,e_ as Yu,e$ as Ze,f0 as zn,f1 as Nn,f2 as Vn,A as vt,v as Ne,u as Uu,c as $u,c5 as Xu,M as Ae,b as mt,W as tt,m as qu,f3 as Gu,f4 as Qu,f5 as Ku,f6 as Ju,f7 as Zu,f8 as er,f9 as tr}from"./index-BHF9XhlR.js";import{h as tn}from"./html2canvas.esm-BfYXEYrK.js";import{a as ut,u as ye}from"./redux-vendor-B7uoacJt.js";import{L as Be,C as X,a as rt,b as ot,P as st,c as it,p as Bn,d as at,e as lt,i as we,f as Ie,E as xe,t as H,g as Nt,h as B,j as ct,k as D,l as nr,u as ur,m as ve,R as Wn,n as rr,o as or,D as sr,A as ir,v as Ve,q as Hn,r as Vt,Q as Pe,H as Ge,T as nn,s as Yn,w as ar,x as un,y as At,z as rn,B as lr,F as Un,G as $n,I as cr}from"./chart-vendor-sE2SUVPW.js";import{d as dr}from"./Close-Daz6UZes.js";import{d as on}from"./Download-Cvgxm3sz.js";import{a as hr,R as Xn}from"./index.esm-Bu7XMDZU.js";import{L as Qe}from"./LinkItem-B0NRrkKX.js";import{g as fr,h as gr,e as Cr,i as pr}from"./index.esm-CjWvmHks.js";import{N as Ke}from"./NavLink-D2GD_ItM.js";import{B as yr}from"./BackButton-C3p7AEJl.js";import{R as dt}from"./ResponsiveTable-cmj--TTX.js";import{N as xr}from"./NumberFormatCustom-DwWPj40N.js";import{d as br}from"./ArrowDownward-DDbaB3Ul.js";import{A as mr}from"./index-rXDbFGCK.js";import{A as he}from"./AdvancedChart-DkBzDZlA.js";import{g as Ar}from"./getSamasatProvinces-BvJGUILK.js";import{d as _r}from"./ToggleOffOutlined-BtQ-d6uH.js";import{d as Sr}from"./ToggleOn-9h7KsYVp.js";import"./iconBase-BEJYyZsk.js";import"./FilterAlt-C5yvLNoT.js";import"./styled-components.browser.esm-gS9mh05b.js";var Bt={},vr=We;Object.defineProperty(Bt,"__esModule",{value:!0});var qn=Bt.default=void 0,jr=vr(He()),wr=i;qn=Bt.default=(0,jr.default)((0,wr.jsx)("path",{d:"M22 5v2h-3v3h-2V7h-3V5h3V2h2v3zm-3 14H5V5h6V3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6h-2zm-4-6v4h2v-4zm-4 4h2V9h-2zm-2 0v-6H7v6z"}),"Addchart");var Wt={},Ir=We;Object.defineProperty(Wt,"__esModule",{value:!0});var Gn=Wt.default=void 0,Tr=Ir(He()),Rr=i;Gn=Wt.default=(0,Tr.default)((0,Rr.jsx)("path",{d:"M7 14H5v5h5v-2H7zm-2-4h2V7h3V5H5zm12 7h-3v2h5v-5h-2zM14 5v2h3v3h2V5z"}),"Fullscreen");var Ht={},Er=We;Object.defineProperty(Ht,"__esModule",{value:!0});var Qn=Ht.default=void 0,kr=Er(He()),Pr=i;Qn=Ht.default=(0,kr.default)((0,Pr.jsx)("path",{d:"M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"}),"FullscreenExit");const Or=ut("VISORS_GET_STATICS",async(t,{dispatch:e})=>{e(G());const{data:n,status:u}=await V.get("data_report_percentages",{params:{role:_(),type:t.type}});return e(Q()),{data:n,status:u}});var Yt={},Fr=We;Object.defineProperty(Yt,"__esModule",{value:!0});var Kn=Yt.default=void 0,Mr=Fr(He()),Dr=i;Kn=Yt.default=(0,Mr.default)((0,Dr.jsx)("path",{d:"M12 2c-4.2 0-8 3.22-8 8.2 0 3.32 2.67 7.25 8 11.8 5.33-4.55 8-8.48 8-11.8C20 5.22 16.2 2 12 2m1 13h-2v-2h2zm0-4h-2V6h2z"}),"FmdBad");X.register(rt,ot,st,it,Bn,at,lt);const Lr=()=>{const[t,e]=v.useState(!1),[n,u]=v.useState(null),[o,r]=v.useState(null),[s,a]=v.useState(["hasCodeData","quarantineQuantityData","assignmentStateArchiveData","acceptedAssignmentRealWeightData","hasntCodeData","differenceBarData","wareHouseConfirmationData","wareHouseAcceptedRealWeightData","weightYearData"]),[l,c]=v.useState({hasCodeData:!0,quarantineQuantityData:!0,assignmentStateArchiveData:!0,acceptedAssignmentRealWeightData:!0,hasntCodeData:!0,differenceBarData:!0,wareHouseConfirmationData:!0,wareHouseAcceptedRealWeightData:!0,weightYearData:!0}),g=ye(),[p,C]=v.useState(null),[d,x]=v.useState("threeMonths"),[A,S]=v.useState(""),y=I=>{x(I.target.value)},m=I=>{C(I.currentTarget)},h=()=>{C(null)},j=I=>{r(I)},f=()=>{r(null)},w=I=>{c({...l,[I]:!l[I]})};v.useEffect(()=>{t?g(Or({type:d})).then(I=>{u(I.payload.data)}):u(null)},[t,d]);const O=!!p,F=O?"simple-popover":void 0,E=I=>({labels:d!=="month"?I.map(T=>Mu(T.date)):I.map(T=>je(T.date)),datasets:[{label:"درصد",data:I.map(T=>T.percent),borderColor:"rgba(55, 41, 145, 0.6)",backgroundColor:"rgba(75, 192, 192, 0.2)"}]}),z={scales:{y:{beginAtZero:!0,min:0}}},Y=n?E(n.hasCode):null,J=n?E(n.quarantineQuantity):null,Z=n?E(n.differenceBar):null,ee=n?E(n.assignmentStateArchive):null,te=n?E(n.acceptedAssignmentRealWeight):null,ne=n?E(n.hasntCode):null,ue=n?E(n.wareHouseConfirmation):null,re=n?E(n.wareHouseAcceptedRealWeight):null,oe=n?E(n.weightYear):null,N={hasCodeData:{title:"درصد بارهای دارای کد قرنطینه",data:Y},quarantineQuantityData:{title:"درصد تعداد بارهای احراز شده از قرنطینه",data:J},assignmentStateArchiveData:{title:"درصد تعداد بارهای تکمیل شده کشتارگاه",data:ee},acceptedAssignmentRealWeightData:{title:"درصد وزن نهایی در کشتارگاه نسبت به وزن کل",data:te},hasntCodeData:{title:"درصد بارهای فاقد کد قرنطینه",data:ne},differenceBarData:{title:"درصد بارهای اختلاف دار در قرنطینه و رصدیار",data:Z},wareHouseConfirmationData:{title:"درصد تعداد بارهای ورودی به انبار",data:ue},wareHouseAcceptedRealWeightData:{title:"درصد وزن لاشه ها در انبار نسبت به وزن کل",data:re},weightYearData:{title:"درصد وزن لاشه در انبار نسبت به وزن نهایی در کشتارگاه",data:oe}},se=(I,T)=>{I.dataTransfer.setData("draggedIndex",T)},ie=(I,T)=>{const R=I.dataTransfer.getData("draggedIndex"),L=Array.from(s),[vu]=L.splice(R,1);L.splice(T,0,vu),a(L)},ae=I=>{I.preventDefault()},le=()=>{const I=document.getElementById("screenshot-container");tn(I).then(T=>{const R=document.createElement("a");R.href=T.toDataURL("image/png"),R.download="پایش آماری.png",R.click()})},ce=()=>{const I=document.getElementById("screenshot-single-container");tn(I).then(T=>{const R=document.createElement("a");R.href=T.toDataURL("image/png"),R.download="پایش آماری.png",R.click()})};return i.jsxs(b,{container:!0,xs:12,alignItems:"center",justifyContent:"center",mt:2,children:[i.jsxs(b,{container:!0,xs:12,alignItems:"center",justifyContent:"center",p:2,style:{borderStyle:"solid",borderWidth:"2px",borderColor:"pink",borderRadius:"10px"},children:[i.jsx(b,{container:!0,xs:4,children:i.jsx(ju,{id:F,open:O,anchorEl:p,onClose:h,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},children:i.jsxs(b,{container:!0,width:"300px",p:3,children:[i.jsxs(b,{container:!0,xs:12,justifyContent:"space-between",alignItems:"center",children:[i.jsx(P,{variant:"body1",color:"primary",children:"انتخاب نمودار"}),i.jsx(ge,{color:"error",onClick:()=>{h()},children:"بازگشت"})]}),i.jsx(bt,{style:{width:"100%"}}),i.jsxs(b,{container:!0,alignItems:"center",gap:1,xs:12,children:[i.jsx(Zt,{control:i.jsx(St,{size:"small",checked:t,onChange:()=>{h(),e(!t)}}),label:"اطلاعات مدیریت بار"}),i.jsx(bt,{style:{width:"100%"}})]})]})})}),i.jsxs(b,{container:!0,alignItems:"center",gap:Ce.SMALL,xs:12,justifyContent:"start",children:[i.jsx(b,{container:!0,gap:Ce.TINY,alignItems:"center",children:i.jsx(P,{children:"پایش آماری"})}),i.jsx(ge,{variant:"contained",onClick:m,"aria-describedby":F,endIcon:i.jsx(qn,{}),children:"انتخاب نمودار"}),i.jsx(b,{container:!0,gap:Ce.SMALL,children:i.jsxs(Me,{fullWidth:!0,style:{minWidth:"150px"},children:[i.jsx(De,{id:"demo-simple-select-label",children:"انتخاب بازه"}),i.jsxs(Le,{size:"small",labelId:"demo-simple-select-label",id:"demo-simple-select",value:d,label:"Age",onChange:y,children:[i.jsx(k,{value:"month",children:"یک ماهه"}),i.jsx(k,{value:"threeMonths",children:"سه ماهه"}),i.jsx(k,{value:"sixMonths",children:"شش ماهه"}),i.jsx(k,{value:"year",children:"سالیانه"})]})]})}),_()==="AdminX"&&i.jsx(b,{children:i.jsx("a",{href:"https://miran.storage.c2.liara.space/%D8%A2%D9%86%D8%A7%D9%84%DB%8C%D8%B2%20%D8%AC%D8%A7%D9%85%D8%B9%20%DA%A9%D8%B4%D8%AA%D8%A7%D8%B1%20%D8%A7%D8%B3%D8%AA%D8%A7%D9%86%20%D9%87%D9%85%D8%AF%D8%A7%D9%86%20%D8%B1%D8%B5%D8%AF%20%DB%8C%D8%A7%D8%B1.xlsx",rel:"noreferrer",children:i.jsx(ge,{color:"success",children:i.jsx(hr,{size:32})})})})]}),i.jsx(b,{container:!0,xs:12,children:t&&i.jsxs(b,{container:!0,alignItems:"center",onClick:()=>{e(!1),u(null)},style:{cursor:"pointer"},children:[i.jsx(de,{color:"error",children:i.jsx(dr,{})})," ",i.jsx(P,{color:"error",variant:"body2",children:"اطلاعات مدیریت بار"})]})}),i.jsx(bt,{style:{width:"100%",marginTop:"20px",marginBottom:"20px"}}),i.jsxs(b,{container:!0,xs:12,mb:2,justifyContent:"space-between",alignItems:"center",children:[i.jsxs(b,{container:!0,alignItems:"center",justifyContent:"start",children:[i.jsx(Kn,{color:"primary"}),i.jsxs(P,{variant:"body2",color:"primary",children:["با کشیدن و رها کردن نمودارها میتوانید ترتیب نمایش آنها را تغییر دهید."," "]})]}),i.jsx(b,{children:i.jsx(de,{onClick:le,color:"primary",disabled:!n,children:i.jsx(on,{})})})]}),n&&i.jsxs(wu,{children:[i.jsx(Iu,{expandIcon:i.jsx(Fu,{}),"aria-controls":"panel1-content",id:"panel1-header",children:i.jsx(P,{variant:"body1",style:{color:"gray"},children:"فیلتر نمودارها"})}),i.jsx(Tu,{children:i.jsx(b,{container:!0,xs:12,children:Object.keys(N).map(I=>i.jsx(b,{item:!0,xs:12,sm:6,style:{display:"flex",alignItems:"center"},children:i.jsx(Zt,{control:i.jsx(St,{size:"small",checked:l[I],onChange:()=>w(I)}),label:N[I].title})},I))})})]})]}),i.jsx(b,{container:!0,spacing:3,xs:12,mt:2,id:"screenshot-container",children:n&&i.jsx(i.Fragment,{children:s.map((I,T)=>{const R=N[I];return l[I]&&i.jsxs(b,{item:!0,xs:12,sm:6,style:{position:"relative"},draggable:!0,onDragStart:L=>se(L,T),onDrop:L=>ie(L,T),onDragOver:ae,onDoubleClick:()=>{S(R.title),j(R.data)},children:[i.jsx(P,{variant:"h6",style:{fontSize:"16px"},children:R.title}),i.jsx(de,{style:{position:"absolute",right:10,top:10,zIndex:1},onClick:()=>{S(R.title),j(R.data)},children:i.jsx(Gn,{})}),i.jsx(Be,{data:R.data,options:z})]},T)})})}),o&&i.jsxs(Ru,{open:!!o,onClose:f,maxWidth:"md",fullWidth:!0,children:[i.jsx(Eu,{children:i.jsxs(b,{container:!0,alignItems:"center",justifyContent:"space-between",xs:12,children:[i.jsx(de,{onClick:f,children:i.jsx(Qn,{})}),i.jsx(b,{children:i.jsx(de,{onClick:ce,disabled:!n,children:i.jsx(on,{})})})]})}),i.jsxs(ku,{id:"screenshot-single-container",children:[i.jsx(b,{container:!0,justifyContent:"center",xs:12,children:i.jsx(P,{variant:"h6",style:{fontSize:"16px"},children:A})}),i.jsx(Be,{data:o})]})]})]})},zr=()=>{const{pathname:t}=Tn();return i.jsx(b,{container:!0,gap:Ce.SMALL,p:Ce.SMALL,direction:{xs:"column",md:"row"},justifyContent:"center",style:{placeContent:"baseline"},children:i.jsx(b,{container:!0,direction:"column",style:{width:"100%"},children:i.jsxs(b,{container:!0,gap:Ce.SMALL,justifyContent:"center",children:[i.jsx(Ke,{to:_()==="AdminX"?Je:_()==="SuperAdmin"?En:_()==="CityOperator"?kn:_()==="ProvinceOperator"?Pn:_()==="VetSupervisor"?On:_()==="Commerce"?Fn:_()==="ProvinceSupervisor"?Mn:_()==="Observatory"?Dn:Je,active:t===Je?"true":null,children:i.jsx(Qe,{icon:i.jsx(fr,{size:30,color:"#244CCC"}),title:"پایش آمار کشتار",description:"پایش آمار کشتار"})}),i.jsx(Ke,{to:_()==="AdminX"?Se:_()==="SuperAdmin"?Pt:_()==="CityOperator"?Ot:_()==="ProvinceOperator"?Ft:_()==="VetSupervisor"?Mt:_()==="Commerce"?Dt:_()==="ProvinceSupervisor"?Lt:_()==="Observatory"?zt:Se,active:t===Se?"true":null,children:i.jsx(Qe,{icon:i.jsx(gr,{size:30,color:"#244CCC"}),title:"پیش بینی موجودی",description:"پیش بینی موجودی"})}),i.jsx(Ke,{to:_()==="AdminX"?en:_()==="SuperAdmin"?Du:_()==="Admin"?Lu:_()==="CityOperator"?zu:_()==="ProvinceOperator"?Nu:_()==="ProvinceFinancial"?Vu:_()==="VetSupervisor"?Ln:_()==="ProvinceInspector"?Bu:_()==="Jahad"?Wu:_()==="Commerce"?Hu:Yu,active:t===en?"true":null,children:i.jsx(Qe,{icon:i.jsx(Cr,{size:30,color:"#244CCC"}),title:"آمار و اطلاعات",description:"آمار و اطلاعات"})}),i.jsx(Ke,{to:_()==="AdminX"?Ze:_()==="SuperAdmin"?zn:_()==="Admin"?Nn:_()==="ProvinceOperator"?Vn:Ze,active:t===Ze?"true":null,children:i.jsx(Qe,{icon:i.jsx(pr,{size:30,color:"#244CCC"}),title:"پایش کشوری",description:"پایش کشوری"})})]})})})},Nr=ut("VISORS_GET_PREDICTION_STATICS_DASHBOARD",async(t,{dispatch:e})=>{e(G());const{data:n,status:u}=await V.get("poultry_hatching_prediction_dashboard",{params:{role:_()}});return e(Q()),{data:n,status:u}}),Vr=ut("VISORS_GET_PREDICTION_STATICS_CHART",async(t,{dispatch:e})=>{e(G());const{data:n,status:u}=await V.get("poultry_hatching_prediction_chart",{params:t});return e(Q()),{data:n,status:u}});/*!
|
||
* chartjs-plugin-annotation v3.1.0
|
||
* https://www.chartjs.org/chartjs-plugin-annotation/index
|
||
* (c) 2024 chartjs-plugin-annotation Contributors
|
||
* Released under the MIT License
|
||
*/const sn={modes:{point(t,e){return et(t,e,{intersect:!0})},nearest(t,e,n){return Hr(t,e,n)},x(t,e,n){return et(t,e,{intersect:n.intersect,axis:"x"})},y(t,e,n){return et(t,e,{intersect:n.intersect,axis:"y"})}}};function Ut(t,e,n){return(sn.modes[n.mode]||sn.modes.nearest)(t,e,n)}function Br(t,e,n){return n!=="x"&&n!=="y"?t.inRange(e.x,e.y,"x",!0)||t.inRange(e.x,e.y,"y",!0):t.inRange(e.x,e.y,n,!0)}function Wr(t,e,n){return n==="x"?{x:t.x,y:e.y}:n==="y"?{x:e.x,y:t.y}:e}function et(t,e,n){return t.filter(u=>n.intersect?u.inRange(e.x,e.y):Br(u,e,n.axis))}function Hr(t,e,n){let u=Number.POSITIVE_INFINITY;return et(t,e,n).reduce((o,r)=>{const s=r.getCenterPoint(),a=Wr(e,s,n.axis),l=Nt(e,a);return l<u?(o=[r],u=l):l===u&&o.push(r),o},[]).sort((o,r)=>o._index-r._index).slice(0,1)}function be(t,e,n){const u=Math.cos(n),o=Math.sin(n),r=e.x,s=e.y;return{x:r+u*(t.x-r)-o*(t.y-s),y:s+o*(t.x-r)+u*(t.y-s)}}const Yr=(t,e)=>e>t||t.length>e.length&&t.slice(0,e.length)===e,fe=.001,ht=(t,e,n)=>Math.min(n,Math.max(e,t)),Jn=(t,e)=>t.value>=t.start-e&&t.value<=t.end+e;function Ur(t,e,n){for(const u of Object.keys(t))t[u]=ht(t[u],e,n);return t}function $r(t,e,n,u){return!t||!e||n<=0?!1:Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<=Math.pow(n+u,2)}function Zn(t,{x:e,y:n,x2:u,y2:o},r,{borderWidth:s,hitTolerance:a}){const l=(s+a)/2,c=t.x>=e-l-fe&&t.x<=u+l+fe,g=t.y>=n-l-fe&&t.y<=o+l+fe;return r==="x"?c:(r==="y"||c)&&g}function eu(t,{rect:e,center:n},u,{rotation:o,borderWidth:r,hitTolerance:s}){const a=be(t,n,H(-o));return Zn(a,e,u,{borderWidth:r,hitTolerance:s})}function me(t,e){const{centerX:n,centerY:u}=t.getProps(["centerX","centerY"],e);return{x:n,y:u}}function Xr(t,e,n,u=!0){const o=n.split(".");let r=0;for(const s of e.split(".")){const a=o[r++];if(parseInt(s,10)<parseInt(a,10))break;if(Yr(a,s)){if(u)throw new Error(`${t} v${n} is not supported. v${e} or newer is required.`);return!1}}return!0}const tu=t=>typeof t=="string"&&t.endsWith("%"),nu=t=>parseFloat(t)/100,uu=t=>ht(nu(t),0,1),Oe=(t,e)=>({x:t,y:e,x2:t,y2:e,width:0,height:0}),qr={box:t=>Oe(t.centerX,t.centerY),doughnutLabel:t=>Oe(t.centerX,t.centerY),ellipse:t=>({centerX:t.centerX,centerY:t.centerX,radius:0,width:0,height:0}),label:t=>Oe(t.centerX,t.centerY),line:t=>Oe(t.x,t.y),point:t=>({centerX:t.centerX,centerY:t.centerY,radius:0,width:0,height:0}),polygon:t=>Oe(t.centerX,t.centerY)};function $t(t,e){return e==="start"?0:e==="end"?t:tu(e)?uu(e)*t:t/2}function K(t,e,n=!0){return typeof e=="number"?e:tu(e)?(n?uu(e):nu(e))*t:t}function Gr(t,e){const{x:n,width:u}=t,o=e.textAlign;return o==="center"?n+u/2:o==="end"||o==="right"?n+u:n}function ru(t,e,{borderWidth:n,position:u,xAdjust:o,yAdjust:r},s){const a=we(s),l=e.width+(a?s.width:0)+n,c=e.height+(a?s.height:0)+n,g=Xt(u),p=an(t.x,l,o,g.x),C=an(t.y,c,r,g.y);return{x:p,y:C,x2:p+l,y2:C+c,width:l,height:c,centerX:p+l/2,centerY:C+c/2}}function Xt(t,e="center"){return we(t)?{x:Ve(t.x,e),y:Ve(t.y,e)}:(t=Ve(t,e),{x:t,y:t})}const ou=(t,e)=>t&&t.autoFit&&e<1;function su(t,e){const n=t.font,u=Ie(n)?n:[n];return ou(t,e)?u.map(function(o){const r=At(o);return r.size=Math.floor(o.size*e),r.lineHeight=o.lineHeight,At(r)}):u.map(o=>At(o))}function iu(t){return t&&(B(t.xValue)||B(t.yValue))}function an(t,e,n=0,u){return t-$t(e,u)+n}function Re(t,e,n){const u=n.init;if(u){if(u===!0)return lu(e,n)}else return;return Qr(t,e,n)}function au(t,e,n){let u=!1;return e.forEach(o=>{ve(t[o])?(u=!0,n[o]=t[o]):B(n[o])&&delete n[o]}),u}function lu(t,e){const n=e.type||"line";return qr[n](t)}function Qr(t,e,n){const u=Vt(n.init,[{chart:t,properties:e,options:n}]);if(u===!0)return lu(e,n);if(we(u))return u}const _t=new Map,Kr=t=>isNaN(t)||t<=0,Jr=t=>t.reduce(function(e,n){return e+=n.string,e},"");function ft(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object HTMLImageElement]"||e==="[object HTMLCanvasElement]"}}function gt(t,{x:e,y:n},u){u&&(t.translate(e,n),t.rotate(H(u)),t.translate(-e,-n))}function W(t,e){if(e&&e.borderWidth)return t.lineCap=e.borderCapStyle||"butt",t.setLineDash(e.borderDash),t.lineDashOffset=e.borderDashOffset,t.lineJoin=e.borderJoinStyle||"miter",t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor,!0}function Ee(t,e){t.shadowColor=e.backgroundShadowColor,t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY}function Ct(t,e){const n=e.content;if(ft(n))return{width:K(n.width,e.width),height:K(n.height,e.height)};const u=su(e),o=e.textStrokeWidth,r=Ie(n)?n:[n],s=r.join()+Jr(u)+o+(t._measureText?"-spriting":"");return _t.has(s)||_t.set(s,no(t,r,u,o)),_t.get(s)}function cu(t,e,n){const{x:u,y:o,width:r,height:s}=e;t.save(),Ee(t,n);const a=W(t,n);t.fillStyle=n.backgroundColor,t.beginPath(),rr(t,{x:u,y:o,w:r,h:s,radius:Ur(or(n.borderRadius),0,Math.min(r,s)/2)}),t.closePath(),t.fill(),a&&(t.shadowColor=n.borderShadowColor,t.stroke()),t.restore()}function du(t,e,n,u){const o=n.content;if(ft(o)){t.save(),t.globalAlpha=oo(n.opacity,o.style.opacity),t.drawImage(o,e.x,e.y,e.width,e.height),t.restore();return}const r=Ie(o)?o:[o],s=su(n,u),a=n.color,l=Ie(a)?a:[a],c=Gr(e,n),g=e.y+n.textStrokeWidth/2;t.save(),t.textBaseline="middle",t.textAlign=n.textAlign,Zr(t,n)&&uo(t,{x:c,y:g},r,s),ro(t,{x:c,y:g},r,{fonts:s,colors:l}),t.restore()}function Zr(t,e){if(e.textStrokeWidth>0)return t.lineJoin="round",t.miterLimit=2,t.lineWidth=e.textStrokeWidth,t.strokeStyle=e.textStrokeColor,!0}function eo(t,e,n,u){const{radius:o,options:r}=e,s=r.pointStyle,a=r.rotation;let l=(a||0)*Wn;if(ft(s)){t.save(),t.translate(n,u),t.rotate(l),t.drawImage(s,-s.width/2,-s.height/2,s.width,s.height),t.restore();return}Kr(o)||to(t,{x:n,y:u,radius:o,rotation:a,style:s,rad:l})}function to(t,{x:e,y:n,radius:u,rotation:o,style:r,rad:s}){let a,l,c,g;switch(t.beginPath(),r){default:t.arc(e,n,u,0,Yn),t.closePath();break;case"triangle":t.moveTo(e+Math.sin(s)*u,n-Math.cos(s)*u),s+=nn,t.lineTo(e+Math.sin(s)*u,n-Math.cos(s)*u),s+=nn,t.lineTo(e+Math.sin(s)*u,n-Math.cos(s)*u),t.closePath();break;case"rectRounded":g=u*.516,c=u-g,a=Math.cos(s+Pe)*c,l=Math.sin(s+Pe)*c,t.arc(e-a,n-l,g,s-D,s-Ge),t.arc(e+l,n-a,g,s-Ge,s),t.arc(e+a,n+l,g,s,s+Ge),t.arc(e-l,n+a,g,s+Ge,s+D),t.closePath();break;case"rect":if(!o){c=Math.SQRT1_2*u,t.rect(e-c,n-c,2*c,2*c);break}s+=Pe;case"rectRot":a=Math.cos(s)*u,l=Math.sin(s)*u,t.moveTo(e-a,n-l),t.lineTo(e+l,n-a),t.lineTo(e+a,n+l),t.lineTo(e-l,n+a),t.closePath();break;case"crossRot":s+=Pe;case"cross":a=Math.cos(s)*u,l=Math.sin(s)*u,t.moveTo(e-a,n-l),t.lineTo(e+a,n+l),t.moveTo(e+l,n-a),t.lineTo(e-l,n+a);break;case"star":a=Math.cos(s)*u,l=Math.sin(s)*u,t.moveTo(e-a,n-l),t.lineTo(e+a,n+l),t.moveTo(e+l,n-a),t.lineTo(e-l,n+a),s+=Pe,a=Math.cos(s)*u,l=Math.sin(s)*u,t.moveTo(e-a,n-l),t.lineTo(e+a,n+l),t.moveTo(e+l,n-a),t.lineTo(e-l,n+a);break;case"line":a=Math.cos(s)*u,l=Math.sin(s)*u,t.moveTo(e-a,n-l),t.lineTo(e+a,n+l);break;case"dash":t.moveTo(e,n),t.lineTo(e+Math.cos(s)*u,n+Math.sin(s)*u);break}t.fill()}function no(t,e,n,u){t.save();const o=e.length;let r=0,s=u;for(let a=0;a<o;a++){const l=n[Math.min(a,n.length-1)];t.font=l.string;const c=e[a];r=Math.max(r,t.measureText(c).width+u),s+=l.lineHeight}return t.restore(),{width:r,height:s}}function uo(t,{x:e,y:n},u,o){t.beginPath();let r=0;u.forEach(function(s,a){const l=o[Math.min(a,o.length-1)],c=l.lineHeight;t.font=l.string,t.strokeText(s,e,n+c/2+r),r+=c}),t.stroke()}function ro(t,{x:e,y:n},u,{fonts:o,colors:r}){let s=0;u.forEach(function(a,l){const c=r[Math.min(l,r.length-1)],g=o[Math.min(l,o.length-1)],p=g.lineHeight;t.beginPath(),t.font=g.string,t.fillStyle=c,t.fillText(a,e,n+p/2+s),s+=p,t.fill()})}function oo(t,e){const n=un(t)?t:e;return un(n)?ht(n,0,1):1}const hu=["left","bottom","top","right"];function so(t,e){const{pointX:n,pointY:u,options:o}=e,r=o.callout,s=r&&r.display&&ho(e,r);if(!s||go(e,r,s))return;if(t.save(),t.beginPath(),!W(t,r))return t.restore();const{separatorStart:l,separatorEnd:c}=io(e,s),{sideStart:g,sideEnd:p}=lo(e,s,l);(r.margin>0||o.borderWidth===0)&&(t.moveTo(l.x,l.y),t.lineTo(c.x,c.y)),t.moveTo(g.x,g.y),t.lineTo(p.x,p.y);const C=be({x:n,y:u},e.getCenterPoint(),H(-e.rotation));t.lineTo(C.x,C.y),t.stroke(),t.restore()}function io(t,e){const{x:n,y:u,x2:o,y2:r}=t,s=ao(t,e);let a,l;return e==="left"||e==="right"?(a={x:n+s,y:u},l={x:a.x,y:r}):(a={x:n,y:u+s},l={x:o,y:a.y}),{separatorStart:a,separatorEnd:l}}function ao(t,e){const{width:n,height:u,options:o}=t,r=o.callout.margin+o.borderWidth/2;return e==="right"?n+r:e==="bottom"?u+r:-r}function lo(t,e,n){const{y:u,width:o,height:r,options:s}=t,a=s.callout.start,l=co(e,s.callout);let c,g;return e==="left"||e==="right"?(c={x:n.x,y:u+K(r,a)},g={x:c.x+l,y:c.y}):(c={x:n.x+K(o,a),y:n.y},g={x:c.x,y:c.y+l}),{sideStart:c,sideEnd:g}}function co(t,e){const n=e.side;return t==="left"||t==="top"?-n:n}function ho(t,e){const n=e.position;return hu.includes(n)?n:fo(t,e)}function fo(t,e){const{x:n,y:u,x2:o,y2:r,width:s,height:a,pointX:l,pointY:c,centerX:g,centerY:p,rotation:C}=t,d={x:g,y:p},x=e.start,A=K(s,x),S=K(a,x),y=[n,n+A,n+A,o],m=[u+S,r,u,r],h=[];for(let j=0;j<4;j++){const f=be({x:y[j],y:m[j]},d,H(C));h.push({position:hu[j],distance:Nt(f,{x:l,y:c})})}return h.sort((j,f)=>j.distance-f.distance)[0].position}function go(t,e,n){const{pointX:u,pointY:o}=t,r=e.margin;let s=u,a=o;return n==="left"?s+=r:n==="right"?s-=r:n==="top"?a+=r:n==="bottom"&&(a-=r),t.inRange(s,a)}const ln={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function Te(t,e,n){return e=typeof e=="number"?e:t.parse(e),Hn(e)?t.getPixelForValue(e):n}function pe(t,e,n){const u=e[n];if(u||n==="scaleID")return u;const o=n.charAt(0),r=Object.values(t).filter(s=>s.axis&&s.axis===o);return r.length?r[0].id:o}function fu(t,e){if(t){const n=t.options.reverse,u=Te(t,e.min,n?e.end:e.start),o=Te(t,e.max,n?e.start:e.end);return{start:u,end:o}}}function gu(t,e){const{chartArea:n,scales:u}=t,o=u[pe(u,e,"xScaleID")],r=u[pe(u,e,"yScaleID")];let s=n.width/2,a=n.height/2;return o&&(s=Te(o,e.xValue,o.left+o.width/2)),r&&(a=Te(r,e.yValue,r.top+r.height/2)),{x:s,y:a}}function qt(t,e){const n=t.scales,u=n[pe(n,e,"xScaleID")],o=n[pe(n,e,"yScaleID")];if(!u&&!o)return{};let{left:r,right:s}=u||t.chartArea,{top:a,bottom:l}=o||t.chartArea;const c=cn(u,{min:e.xMin,max:e.xMax,start:r,end:s});r=c.start,s=c.end;const g=cn(o,{min:e.yMin,max:e.yMax,start:l,end:a});return a=g.start,l=g.end,{x:r,y:a,x2:s,y2:l,width:s-r,height:l-a,centerX:r+(s-r)/2,centerY:a+(l-a)/2}}function Cu(t,e){if(!iu(e)){const n=qt(t,e);let u=e.radius;(!u||isNaN(u))&&(u=Math.min(n.width,n.height)/2,e.radius=u);const o=u*2,r=n.centerX+e.xAdjust,s=n.centerY+e.yAdjust;return{x:r-u,y:s-u,x2:r+u,y2:s+u,centerX:r,centerY:s,width:o,height:o,radius:u}}return po(t,e)}function Co(t,e){const{scales:n,chartArea:u}=t,o=n[e.scaleID],r={x:u.left,y:u.top,x2:u.right,y2:u.bottom};return o?yo(o,r,e):xo(n,r,e),r}function pu(t,e){const n=qt(t,e);return n.initProperties=Re(t,n,e),n.elements=[{type:"label",optionScope:"label",properties:Ao(t,n,e),initProperties:n.initProperties}],n}function po(t,e){const n=gu(t,e),u=e.radius*2;return{x:n.x-e.radius+e.xAdjust,y:n.y-e.radius+e.yAdjust,x2:n.x+e.radius+e.xAdjust,y2:n.y+e.radius+e.yAdjust,centerX:n.x+e.xAdjust,centerY:n.y+e.yAdjust,radius:e.radius,width:u,height:u}}function cn(t,e){const n=fu(t,e)||e;return{start:Math.min(n.start,n.end),end:Math.max(n.start,n.end)}}function yo(t,e,n){const u=Te(t,n.value,NaN),o=Te(t,n.endValue,u);t.isHorizontal()?(e.x=u,e.x2=o):(e.y=u,e.y2=o)}function xo(t,e,n){for(const u of Object.keys(ln)){const o=t[pe(t,n,u)];if(o){const{min:r,max:s,start:a,end:l,startProp:c,endProp:g}=ln[u],p=fu(o,{min:n[r],max:n[s],start:o[a],end:o[l]});e[c]=p.start,e[g]=p.end}}}function bo({properties:t,options:e},n,u,o){const{x:r,x2:s,width:a}=t;return yu({start:r,end:s,borderWidth:e.borderWidth},{position:u.x,padding:{start:o.left,end:o.right},adjust:e.label.xAdjust,size:n.width})}function mo({properties:t,options:e},n,u,o){const{y:r,y2:s,height:a}=t;return yu({start:r,end:s,borderWidth:e.borderWidth},{position:u.y,padding:{start:o.top,end:o.bottom},adjust:e.label.yAdjust,size:n.height})}function yu(t,e){const{start:n,end:u,borderWidth:o}=t,{position:r,padding:{start:s,end:a},adjust:l}=e,c=u-o-n-s-a-e.size;return n+o/2+l+$t(c,r)}function Ao(t,e,n){const u=n.label;u.backgroundColor="transparent",u.callout.display=!1;const o=Xt(u.position),r=ct(u.padding),s=Ct(t.ctx,u),a=bo({properties:e,options:n},s,o,r),l=mo({properties:e,options:n},s,o,r),c=s.width+r.width,g=s.height+r.height;return{x:a,y:l,x2:a+c,y2:l+g,width:c,height:g,centerX:a+c/2,centerY:l+g/2,rotation:u.rotation}}const jt=["enter","leave"],Gt=jt.concat("click");function _o(t,e,n){e.listened=au(n,Gt,e.listeners),e.moveListened=!1,jt.forEach(u=>{ve(n[u])&&(e.moveListened=!0)}),(!e.listened||!e.moveListened)&&e.annotations.forEach(u=>{!e.listened&&ve(u.click)&&(e.listened=!0),e.moveListened||jt.forEach(o=>{ve(u[o])&&(e.listened=!0,e.moveListened=!0)})})}function So(t,e,n){if(t.listened)switch(e.type){case"mousemove":case"mouseout":return vo(t,e,n);case"click":return jo(t,e,n)}}function vo(t,e,n){if(!t.moveListened)return;let u;e.type==="mousemove"?u=Ut(t.visibleElements,e,n.interaction):u=[];const o=t.hovered;t.hovered=u;const r={state:t,event:e};let s=dn(r,"leave",o,u);return dn(r,"enter",u,o)||s}function dn({state:t,event:e},n,u,o){let r;for(const s of u)o.indexOf(s)<0&&(r=xu(s.options[n]||t.listeners[n],s,e)||r);return r}function jo(t,e,n){const u=t.listeners,o=Ut(t.visibleElements,e,n.interaction);let r;for(const s of o)r=xu(s.options.click||u.click,s,e)||r;return r}function xu(t,e,n){return Vt(t,[e.$context,n])===!0}const nt=["afterDraw","beforeDraw"];function wo(t,e,n){const u=e.visibleElements;e.hooked=au(n,nt,e.hooks),e.hooked||u.forEach(o=>{e.hooked||nt.forEach(r=>{ve(o.options[r])&&(e.hooked=!0)})})}function hn(t,e,n){if(t.hooked){const u=e.options[n]||t.hooks[n];return Vt(u,[e.$context])}}function Io(t,e,n){const u=Po(t.scales,e,n);let o=fn(e,u,"min","suggestedMin");o=fn(e,u,"max","suggestedMax")||o,o&&ve(e.handleTickRangeOptions)&&e.handleTickRangeOptions()}function To(t,e){for(const n of t)Eo(n,e)}function fn(t,e,n,u){if(Hn(e[n])&&!Ro(t.options,n,u)){const o=t[n]!==e[n];return t[n]=e[n],o}}function Ro(t,e,n){return B(t[e])||B(t[n])}function Eo(t,e){for(const n of["scaleID","xScaleID","yScaleID"]){const u=pe(e,t,n);u&&!e[u]&&ko(t,n)&&console.warn(`No scale found with id '${u}' for annotation '${t.id}'`)}}function ko(t,e){if(e==="scaleID")return!0;const n=e.charAt(0);for(const u of["Min","Max","Value"])if(B(t[n+u]))return!0;return!1}function Po(t,e,n){const u=e.axis,o=e.id,r=u+"ScaleID",s={min:Ve(e.min,Number.NEGATIVE_INFINITY),max:Ve(e.max,Number.POSITIVE_INFINITY)};for(const a of n)a.scaleID===o?gn(a,e,["value","endValue"],s):pe(t,a,r)===o&&gn(a,e,[u+"Min",u+"Max",u+"Value"],s);return s}function gn(t,e,n,u){for(const o of n){const r=t[o];if(B(r)){const s=e.parse(r);u.min=Math.min(u.min,s),u.max=Math.max(u.max,s)}}}class ke extends xe{inRange(e,n,u,o){const{x:r,y:s}=be({x:e,y:n},this.getCenterPoint(o),H(-this.options.rotation));return Zn({x:r,y:s},this.getProps(["x","y","x2","y2"],o),u,this.options)}getCenterPoint(e){return me(this,e)}draw(e){e.save(),gt(e,this.getCenterPoint(),this.options.rotation),cu(e,this,this.options),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){return pu(e,n)}}ke.id="boxAnnotation";ke.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};ke.defaultRoutes={borderColor:"color",backgroundColor:"color"};ke.descriptors={label:{_fallback:!0}};class pt extends xe{inRange(e,n,u,o){return eu({x:e,y:n},{rect:this.getProps(["x","y","x2","y2"],o),center:this.getCenterPoint(o)},u,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(e){return me(this,e)}draw(e){const n=this.options;!n.display||!n.content||(zo(e,this),e.save(),gt(e,this.getCenterPoint(),this.rotation),du(e,this,n,this._fitRatio),e.restore())}resolveElementProperties(e,n){const u=Oo(e,n);if(!u)return{};const{controllerMeta:o,point:r,radius:s}=Mo(e,n,u);let a=Ct(e.ctx,n);const l=Do(a,s);ou(n,l)&&(a={width:a.width*l,height:a.height*l});const{position:c,xAdjust:g,yAdjust:p}=n,C=ru(r,a,{borderWidth:0,position:c,xAdjust:g,yAdjust:p});return{initProperties:Re(e,C,n),...C,...o,rotation:n.rotation,_fitRatio:l}}}pt.id="doughnutLabelAnnotation";pt.defaults={autoFit:!0,autoHide:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0};pt.defaultRoutes={};function Oo(t,e){return t.getSortedVisibleDatasetMetas().reduce(function(n,u){const o=u.controller;return o instanceof sr&&Fo(t,e,u.data)&&(!n||o.innerRadius<n.controller.innerRadius)&&o.options.circumference>=90?u:n},void 0)}function Fo(t,e,n){if(!e.autoHide)return!0;for(let u=0;u<n.length;u++)if(!n[u].hidden&&t.getDataVisibility(u))return!0}function Mo({chartArea:t},e,n){const{left:u,top:o,right:r,bottom:s}=t,{innerRadius:a,offsetX:l,offsetY:c}=n.controller,g=(u+r)/2+l,p=(o+s)/2+c,C={left:Math.max(g-a,u),right:Math.min(g+a,r),top:Math.max(p-a,o),bottom:Math.min(p+a,s)},d={x:(C.left+C.right)/2,y:(C.top+C.bottom)/2},x=e.spacing+e.borderWidth/2,A=a-x,S=d.y>p,y=S?o+x:s-x,m=Lo(y,g,p,A);return{controllerMeta:{_centerX:g,_centerY:p,_radius:A,_counterclockwise:S,...m},point:d,radius:Math.min(a,Math.min(C.right-C.left,C.bottom-C.top)/2)}}function Do({width:t,height:e},n){const u=Math.sqrt(Math.pow(t,2)+Math.pow(e,2));return n*2/u}function Lo(t,e,n,u){const o=Math.pow(n-t,2),r=Math.pow(u,2),s=e*-2,a=Math.pow(e,2)+o-r,l=Math.pow(s,2)-4*a;if(l<=0)return{_startAngle:0,_endAngle:Yn};const c=(-s-Math.sqrt(l))/2,g=(-s+Math.sqrt(l))/2;return{_startAngle:rn({x:e,y:n},{x:c,y:t}).angle,_endAngle:rn({x:e,y:n},{x:g,y:t}).angle}}function zo(t,e){const{_centerX:n,_centerY:u,_radius:o,_startAngle:r,_endAngle:s,_counterclockwise:a,options:l}=e;t.save();const c=W(t,l);t.fillStyle=l.backgroundColor,t.beginPath(),t.arc(n,u,o,r,s,a),t.closePath(),t.fill(),c&&t.stroke(),t.restore()}class Ye extends xe{inRange(e,n,u,o){return eu({x:e,y:n},{rect:this.getProps(["x","y","x2","y2"],o),center:this.getCenterPoint(o)},u,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(e){return me(this,e)}draw(e){const n=this.options,u=!B(this._visible)||this._visible;!n.display||!n.content||!u||(e.save(),gt(e,this.getCenterPoint(),this.rotation),so(e,this),cu(e,this,n),du(e,No(this),n),e.restore())}resolveElementProperties(e,n){let u;if(iu(n))u=gu(e,n);else{const{centerX:a,centerY:l}=qt(e,n);u={x:a,y:l}}const o=ct(n.padding),r=Ct(e.ctx,n),s=ru(u,r,n,o);return{initProperties:Re(e,s,n),pointX:u.x,pointY:u.y,...s,rotation:n.rotation}}}Ye.id="labelAnnotation";Ye.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};Ye.defaultRoutes={borderColor:"color"};function No({x:t,y:e,width:n,height:u,options:o}){const r=o.borderWidth/2,s=ct(o.padding);return{x:t+s.left+r,y:e+s.top+r,width:n-s.left-s.right-o.borderWidth,height:u-s.top-s.bottom-o.borderWidth}}const Qt=(t,e,n)=>({x:t.x+n*(e.x-t.x),y:t.y+n*(e.y-t.y)}),wt=(t,e,n)=>Qt(e,n,Math.abs((t-e.y)/(n.y-e.y))).x,Cn=(t,e,n)=>Qt(e,n,Math.abs((t-e.x)/(n.x-e.x))).y,ze=t=>t*t,Vo=(t,e,{x:n,y:u,x2:o,y2:r},s)=>s==="y"?{start:Math.min(u,r),end:Math.max(u,r),value:e}:{start:Math.min(n,o),end:Math.max(n,o),value:t},pn=(t,e,n,u)=>(1-u)*(1-u)*t+2*(1-u)*u*e+u*u*n,It=(t,e,n,u)=>({x:pn(t.x,e.x,n.x,u),y:pn(t.y,e.y,n.y,u)}),yn=(t,e,n,u)=>2*(1-u)*(e-t)+2*u*(n-e),xn=(t,e,n,u)=>-Math.atan2(yn(t.x,e.x,n.x,u),yn(t.y,e.y,n.y,u))+.5*D;class Ue extends xe{inRange(e,n,u,o){const r=(this.options.borderWidth+this.options.hitTolerance)/2;if(u!=="x"&&u!=="y"){const s={mouseX:e,mouseY:n},{path:a,ctx:l}=this;if(a){W(l,this.options),l.lineWidth+=this.options.hitTolerance;const{chart:g}=this.$context,p=e*g.currentDevicePixelRatio,C=n*g.currentDevicePixelRatio,d=l.isPointInStroke(a,p,C)||Tt(this,s,o);return l.restore(),d}const c=ze(r);return Yo(this,s,c,o)||Tt(this,s,o)}return Bo(this,{mouseX:e,mouseY:n},u,{hitSize:r,useFinalPosition:o})}getCenterPoint(e){return me(this,e)}draw(e){const{x:n,y:u,x2:o,y2:r,cp:s,options:a}=this;if(e.save(),!W(e,a))return e.restore();Ee(e,a);const l=Math.sqrt(Math.pow(o-n,2)+Math.pow(r-u,2));if(a.curve&&s)return Jo(e,this,s,l),e.restore();const{startOpts:c,endOpts:g,startAdjust:p,endAdjust:C}=bu(this),d=Math.atan2(r-u,o-n);e.translate(n,u),e.rotate(d),e.beginPath(),e.moveTo(0+p,0),e.lineTo(l-C,0),e.shadowColor=a.borderShadowColor,e.stroke(),Rt(e,0,p,c),Rt(e,l,-C,g),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){const u=Co(e,n),{x:o,y:r,x2:s,y2:a}=u,l=Wo(u,e.chartArea),c=l?Ho({x:o,y:r},{x:s,y:a},e.chartArea):{x:o,y:r,x2:s,y2:a,width:Math.abs(s-o),height:Math.abs(a-r)};if(c.centerX=(s+o)/2,c.centerY=(a+r)/2,c.initProperties=Re(e,c,n),n.curve){const p={x:c.x,y:c.y},C={x:c.x2,y:c.y2};c.cp=Ko(c,n,Nt(p,C))}const g=Uo(e,c,n.label);return g._visible=l,c.elements=[{type:"label",optionScope:"label",properties:g,initProperties:c.initProperties}],c}}Ue.id="lineAnnotation";const bn={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};Ue.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},bn),fill:!1,length:12,start:Object.assign({},bn),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Ye.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};Ue.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}};Ue.defaultRoutes={borderColor:"color"};function Bo(t,{mouseX:e,mouseY:n},u,{hitSize:o,useFinalPosition:r}){const s=Vo(e,n,t.getProps(["x","y","x2","y2"],r),u);return Jn(s,o)||Tt(t,{mouseX:e,mouseY:n},r,u)}function Wo({x:t,y:e,x2:n,y2:u},{top:o,right:r,bottom:s,left:a}){return!(t<a&&n<a||t>r&&n>r||e<o&&u<o||e>s&&u>s)}function mn({x:t,y:e},n,{top:u,right:o,bottom:r,left:s}){return t<s&&(e=Cn(s,{x:t,y:e},n),t=s),t>o&&(e=Cn(o,{x:t,y:e},n),t=o),e<u&&(t=wt(u,{x:t,y:e},n),e=u),e>r&&(t=wt(r,{x:t,y:e},n),e=r),{x:t,y:e}}function Ho(t,e,n){const{x:u,y:o}=mn(t,e,n),{x:r,y:s}=mn(e,t,n);return{x:u,y:o,x2:r,y2:s,width:Math.abs(r-u),height:Math.abs(s-o)}}function Yo(t,{mouseX:e,mouseY:n},u=fe,o){const{x:r,y:s,x2:a,y2:l}=t.getProps(["x","y","x2","y2"],o),c=a-r,g=l-s,p=ze(c)+ze(g),C=p===0?-1:((e-r)*c+(n-s)*g)/p;let d,x;return C<0?(d=r,x=s):C>1?(d=a,x=l):(d=r+C*c,x=s+C*g),ze(e-d)+ze(n-x)<=u}function Tt(t,{mouseX:e,mouseY:n},u,o){const r=t.label;return r.options.display&&r.inRange(e,n,o,u)}function Uo(t,e,n){const u=n.borderWidth,o=ct(n.padding),r=Ct(t.ctx,n),s=r.width+o.width+u,a=r.height+o.height+u;return Xo(e,n,{width:s,height:a,padding:o},t.chartArea)}function $o(t){const{x:e,y:n,x2:u,y2:o}=t,r=Math.atan2(o-n,u-e);return r>D/2?r-D:r<D/-2?r+D:r}function Xo(t,e,n,u){const{width:o,height:r,padding:s}=n,{xAdjust:a,yAdjust:l}=e,c={x:t.x,y:t.y},g={x:t.x2,y:t.y2},p=e.rotation==="auto"?$o(t):H(e.rotation),C=qo(o,r,p),d=Go(t,e,{labelSize:C,padding:s},u),x=t.cp?It(c,t.cp,g,d):Qt(c,g,d),A={size:C.w,min:u.left,max:u.right,padding:s.left},S={size:C.h,min:u.top,max:u.bottom,padding:s.top},y=_n(x.x,A)+a,m=_n(x.y,S)+l;return{x:y-o/2,y:m-r/2,x2:y+o/2,y2:m+r/2,centerX:y,centerY:m,pointX:x.x,pointY:x.y,width:o,height:r,rotation:ar(p)}}function qo(t,e,n){const u=Math.cos(n),o=Math.sin(n);return{w:Math.abs(t*u)+Math.abs(e*o),h:Math.abs(t*o)+Math.abs(e*u)}}function Go(t,e,n,u){let o;const r=Qo(t,u);return e.position==="start"?o=An({w:t.x2-t.x,h:t.y2-t.y},n,e,r):e.position==="end"?o=1-An({w:t.x-t.x2,h:t.y-t.y2},n,e,r):o=$t(1,e.position),o}function An(t,e,n,u){const{labelSize:o,padding:r}=e,s=t.w*u.dx,a=t.h*u.dy,l=s>0&&(o.w/2+r.left-u.x)/s,c=a>0&&(o.h/2+r.top-u.y)/a;return ht(Math.max(l,c),0,.25)}function Qo(t,e){const{x:n,x2:u,y:o,y2:r}=t,s=Math.min(o,r)-e.top,a=Math.min(n,u)-e.left,l=e.bottom-Math.max(o,r),c=e.right-Math.max(n,u);return{x:Math.min(a,c),y:Math.min(s,l),dx:a<=c?1:-1,dy:s<=l?1:-1}}function _n(t,e){const{size:n,min:u,max:o,padding:r}=e,s=n/2;return n>o-u?(o+u)/2:(u>=t-r-s&&(t=u+r+s),o<=t+r+s&&(t=o-r-s),t)}function bu(t){const e=t.options,n=e.arrowHeads&&e.arrowHeads.start,u=e.arrowHeads&&e.arrowHeads.end;return{startOpts:n,endOpts:u,startAdjust:Sn(t,n),endAdjust:Sn(t,u)}}function Sn(t,e){if(!e||!e.display)return 0;const{length:n,width:u}=e,o=t.options.borderWidth/2,r={x:n,y:u+o};return Math.abs(wt(0,r,{x:0,y:o}))}function Rt(t,e,n,u){if(!u||!u.display)return;const{length:o,width:r,fill:s,backgroundColor:a,borderColor:l}=u,c=Math.abs(e-o)+n;t.beginPath(),Ee(t,u),W(t,u),t.moveTo(c,-r),t.lineTo(e+n,0),t.lineTo(c,r),s===!0?(t.fillStyle=a||l,t.closePath(),t.fill(),t.shadowColor="transparent"):t.shadowColor=u.borderShadowColor,t.stroke()}function Ko(t,e,n){const{x:u,y:o,x2:r,y2:s,centerX:a,centerY:l}=t,c=Math.atan2(s-o,r-u),g=Xt(e.controlPoint,0),p={x:a+K(n,g.x,!1),y:l+K(n,g.y,!1)};return be(p,{x:a,y:l},c)}function vn(t,{x:e,y:n},{angle:u,adjust:o},r){!r||!r.display||(t.save(),t.translate(e,n),t.rotate(u),Rt(t,0,-o,r),t.restore())}function Jo(t,e,n,u){const{x:o,y:r,x2:s,y2:a,options:l}=e,{startOpts:c,endOpts:g,startAdjust:p,endAdjust:C}=bu(e),d={x:o,y:r},x={x:s,y:a},A=xn(d,n,x,0),S=xn(d,n,x,1)-D,y=It(d,n,x,p/u),m=It(d,n,x,1-C/u),h=new Path2D;t.beginPath(),h.moveTo(y.x,y.y),h.quadraticCurveTo(n.x,n.y,m.x,m.y),t.shadowColor=l.borderShadowColor,t.stroke(h),e.path=h,e.ctx=t,vn(t,y,{angle:A,adjust:p},c),vn(t,m,{angle:S,adjust:C},g)}class $e extends xe{inRange(e,n,u,o){const r=this.options.rotation,s=(this.options.borderWidth+this.options.hitTolerance)/2;if(u!=="x"&&u!=="y")return Zo({x:e,y:n},this.getProps(["width","height","centerX","centerY"],o),r,s);const{x:a,y:l,x2:c,y2:g}=this.getProps(["x","y","x2","y2"],o),p=u==="y"?{start:l,end:g}:{start:a,end:c},C=be({x:e,y:n},this.getCenterPoint(o),H(-r));return C[u]>=p.start-s-fe&&C[u]<=p.end+s+fe}getCenterPoint(e){return me(this,e)}draw(e){const{width:n,height:u,centerX:o,centerY:r,options:s}=this;e.save(),gt(e,this.getCenterPoint(),s.rotation),Ee(e,this.options),e.beginPath(),e.fillStyle=s.backgroundColor;const a=W(e,s);e.ellipse(o,r,u/2,n/2,D/2,0,2*D),e.fill(),a&&(e.shadowColor=s.borderShadowColor,e.stroke()),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){return pu(e,n)}}$e.id="ellipseAnnotation";$e.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},ke.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};$e.defaultRoutes={borderColor:"color",backgroundColor:"color"};$e.descriptors={label:{_fallback:!0}};function Zo(t,e,n,u){const{width:o,height:r,centerX:s,centerY:a}=e,l=o/2,c=r/2;if(l<=0||c<=0)return!1;const g=H(n||0),p=Math.cos(g),C=Math.sin(g),d=Math.pow(p*(t.x-s)+C*(t.y-a),2),x=Math.pow(C*(t.x-s)-p*(t.y-a),2);return d/Math.pow(l+u,2)+x/Math.pow(c+u,2)<=1.0001}class yt extends xe{inRange(e,n,u,o){const{x:r,y:s,x2:a,y2:l,width:c}=this.getProps(["x","y","x2","y2","width"],o),g=(this.options.borderWidth+this.options.hitTolerance)/2;return u!=="x"&&u!=="y"?$r({x:e,y:n},this.getCenterPoint(o),c/2,g):Jn(u==="y"?{start:s,end:l,value:n}:{start:r,end:a,value:e},g)}getCenterPoint(e){return me(this,e)}draw(e){const n=this.options,u=n.borderWidth;if(n.radius<.1)return;e.save(),e.fillStyle=n.backgroundColor,Ee(e,n);const o=W(e,n);eo(e,this,this.centerX,this.centerY),o&&!ft(n.pointStyle)&&(e.shadowColor=n.borderShadowColor,e.stroke()),e.restore(),n.borderWidth=u}resolveElementProperties(e,n){const u=Cu(e,n);return u.initProperties=Re(e,u,n),u}}yt.id="pointAnnotation";yt.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};yt.defaultRoutes={borderColor:"color",backgroundColor:"color"};class xt extends xe{inRange(e,n,u,o){if(u!=="x"&&u!=="y")return this.options.radius>=.1&&this.elements.length>1&&ts(this.elements,e,n,o);const r=be({x:e,y:n},this.getCenterPoint(o),H(-this.options.rotation)),s=this.elements.map(c=>u==="y"?c.bY:c.bX),a=Math.min(...s),l=Math.max(...s);return r[u]>=a&&r[u]<=l}getCenterPoint(e){return me(this,e)}draw(e){const{elements:n,options:u}=this;e.save(),e.beginPath(),e.fillStyle=u.backgroundColor,Ee(e,u);const o=W(e,u);let r=!0;for(const s of n)r?(e.moveTo(s.x,s.y),r=!1):e.lineTo(s.x,s.y);e.closePath(),e.fill(),o&&(e.shadowColor=u.borderShadowColor,e.stroke()),e.restore()}resolveElementProperties(e,n){const u=Cu(e,n),{sides:o,rotation:r}=n,s=[],a=2*D/o;let l=r*Wn;for(let c=0;c<o;c++,l+=a){const g=es(u,n,l);g.initProperties=Re(e,u,n),s.push(g)}return u.elements=s,u}}xt.id="polygonAnnotation";xt.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};xt.defaultRoutes={borderColor:"color",backgroundColor:"color"};function es({centerX:t,centerY:e},{radius:n,borderWidth:u,hitTolerance:o},r){const s=(u+o)/2,a=Math.sin(r),l=Math.cos(r),c={x:t+a*n,y:e-l*n};return{type:"point",optionScope:"point",properties:{x:c.x,y:c.y,centerX:c.x,centerY:c.y,bX:t+a*(n+s),bY:e-l*(n+s)}}}function ts(t,e,n,u){let o=!1,r=t[t.length-1].getProps(["bX","bY"],u);for(const s of t){const a=s.getProps(["bX","bY"],u);a.bY>n!=r.bY>n&&e<(r.bX-a.bX)*(n-a.bY)/(r.bY-a.bY)+a.bX&&(o=!o),r=a}return o}const q={box:ke,doughnutLabel:pt,ellipse:$e,label:Ye,line:Ue,point:yt,polygon:xt};Object.keys(q).forEach(t=>{lr.describe(`elements.${q[t].id}`,{_fallback:"plugins.annotation.common"})});const ns={update:Object.assign},us=Gt.concat(nt),jn=(t,e)=>we(e)?kt(t,e):t,Et=t=>t==="color"||t==="font";function Kt(t="line"){return q[t]?t:(console.warn(`Unknown annotation type: '${t}', defaulting to 'line'`),"line")}function rs(t,e,n,u){const o=ss(t,n.animations,u),r=e.annotations,s=ls(e.elements,r);for(let a=0;a<r.length;a++){const l=r[a],c=mu(s,a,l.type),g=l.setContext(as(t,c,s,l)),p=c.resolveElementProperties(t,g);p.skip=os(p),"elements"in p&&(is(c,p.elements,g,o),delete p.elements),B(c.x)||Object.assign(c,p),Object.assign(c,p.initProperties),p.options=Au(g),o.update(c,p)}}function os(t){return isNaN(t.x)||isNaN(t.y)}function ss(t,e,n){return n==="reset"||n==="none"||n==="resize"?ns:new ir(t,e)}function is(t,e,n,u){const o=t.elements||(t.elements=[]);o.length=e.length;for(let r=0;r<e.length;r++){const s=e[r],a=s.properties,l=mu(o,r,s.type,s.initProperties),c=n[s.optionScope].override(s);a.options=Au(c),u.update(l,a)}}function mu(t,e,n,u){const o=q[Kt(n)];let r=t[e];return(!r||!(r instanceof o))&&(r=t[e]=new o,Object.assign(r,u)),r}function Au(t){const e=q[Kt(t.type)],n={};n.id=t.id,n.type=t.type,n.drawTime=t.drawTime,Object.assign(n,kt(t,e.defaults),kt(t,e.defaultRoutes));for(const u of us)n[u]=t[u];return n}function kt(t,e){const n={};for(const u of Object.keys(e)){const o=e[u],r=t[u];Et(u)&&Ie(r)?n[u]=r.map(s=>jn(s,o)):n[u]=jn(r,o)}return n}function as(t,e,n,u){return e.$context||(e.$context=Object.assign(Object.create(t.getContext()),{element:e,get elements(){return n.filter(o=>o&&o.options)},id:u.id,type:"annotation"}))}function ls(t,e){const n=e.length,u=t.length;if(u<n){const o=n-u;t.splice(u,0,...new Array(o))}else u>n&&t.splice(n,u-n);return t}var cs="3.1.0";const U=new Map,wn=t=>t.type!=="doughnutLabel",ds=Gt.concat(nt);var hs={id:"annotation",version:cs,beforeRegister(){Xr("chart.js","4.0",X.version)},afterRegister(){X.register(q)},afterUnregister(){X.unregister(q)},beforeInit(t){U.set(t,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(t,e,n){const u=U.get(t),o=u.annotations=[];let r=n.annotations;we(r)?Object.keys(r).forEach(s=>{const a=r[s];we(a)&&(a.id=s,o.push(a))}):Ie(r)&&o.push(...r),To(o.filter(wn),t.scales)},afterDataLimits(t,e){const n=U.get(t);Io(t,e.scale,n.annotations.filter(wn).filter(u=>u.display&&u.adjustScaleRange))},afterUpdate(t,e,n){const u=U.get(t);_o(t,u,n),rs(t,u,n,e.mode),u.visibleElements=u.elements.filter(o=>!o.skip&&o.options.display),wo(t,u,n)},beforeDatasetsDraw(t,e,n){Fe(t,"beforeDatasetsDraw",n.clip)},afterDatasetsDraw(t,e,n){Fe(t,"afterDatasetsDraw",n.clip)},beforeDatasetDraw(t,e,n){Fe(t,e.index,n.clip)},beforeDraw(t,e,n){Fe(t,"beforeDraw",n.clip)},afterDraw(t,e,n){Fe(t,"afterDraw",n.clip)},beforeEvent(t,e,n){const u=U.get(t);So(u,e.event,n)&&(e.changed=!0)},afterDestroy(t){U.delete(t)},getAnnotations(t){const e=U.get(t);return e?e.elements:[]},_getAnnotationElementsAtEventForMode(t,e,n){return Ut(t,e,n)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:t=>!ds.includes(t)&&t!=="init",annotations:{_allKeys:!1,_fallback:(t,e)=>`elements.${q[Kt(e.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:Et,_fallback:!0},_indexable:Et}},additionalOptionScopes:[""]};function Fe(t,e,n){const{ctx:u,chartArea:o}=t,r=U.get(t);n&&nr(u,o);const s=fs(r.visibleElements,e).sort((a,l)=>a.element.options.z-l.element.options.z);for(const a of s)gs(u,o,r,a);n&&ur(u)}function fs(t,e){const n=[];for(const u of t)if(u.options.drawTime===e&&n.push({element:u,main:!0}),u.elements&&u.elements.length)for(const o of u.elements)o.options.display&&o.options.drawTime===e&&n.push({element:o});return n}function gs(t,e,n,u){const o=u.element;u.main?(hn(n,o,"beforeDraw"),o.draw(t,e),hn(n,o,"afterDraw")):o.draw(t,e)}X.register(hs);const Cs=()=>{const[,,t,e,n,u]=v.useContext(vt),o=ye(),[r,s]=v.useState([]),[a,l]=v.useState([]),[c,g]=v.useState(null),[p]=v.useContext(vt);v.useEffect(()=>{const y=Ne().format("YYYY-MM-DD");e(y),u(y)},[e,u]);const C=y=>(_()==="AdminX"?Se:_()==="SuperAdmin"?Pt:_()==="CityOperator"?Ot:_()==="ProvinceOperator"?Ft:_()==="VetSupervisor"?Mt:_()==="Commerce"?Dt:_()==="ProvinceSupervisor"?Lt:_()==="Observatory"?zt:Se)+(y==null?void 0:y.hatchings.join(",").toString())+"/"+(y==null?void 0:y.date),d=Uu({initialValues:{consumption_limit_type:"",killing_age_external_type:"",killing_age:"",time_frame_type:"all",consumption_limit:"",killing_age_internal_type:""},validationSchema:$u({consumption_limit_type:Ae().required("این گزینه الزامی است").typeError("لطفا فیلد را به درستی پر کنید!"),killing_age_external_type:Ae().required("این گزینه الزامی است").typeError("لطفا فیلد را به درستی پر کنید!"),consumption_limit:mt().required("این گزینه الزامی است").typeError("لطفا فیلد را به درستی پر کنید!"),killing_age:mt().when("killing_age_external_type",{is:"manual",then:mt().required("این گزینه الزامی است").typeError("لطفا فیلد را به درستی پر کنید!")}),ave_kill_age_select:Ae().when("ave_kill_age",{is:"behavior",then:Ae().required("این گزینه الزامی است").typeError("لطفا فیلد را به درستی پر کنید!")}),killing_age_internal_type:Ae().when("killing_age_external_type",{is:"poultry_ave_killing_age",then:Ae().required("این گزینه الزامی است").typeError("لطفا فیلد را به درستی پر کنید!")})}),onSubmit:y=>{let m={consumption_limit_type:y.consumption_limit_type,killing_age_external_type:y.killing_age_external_type,killing_age:y.killing_age_external_type==="manual"?y.killing_age:null,time_frame_type:y.time_frame_type,consumption_limit:y.consumption_limit,killing_age_internal_type:y.killing_age_external_type==="poultry_ave_killing_age"?y.killing_age_internal_type:null,date1:y.time_frame_type==="manual"?t:null,date2:y.time_frame_type==="manual"?n:null,role:_()};m=Object.fromEntries(Object.entries(m).filter(([h,j])=>j!==null)),o(Vr(m)).then(h=>{if(h.payload.error)p({vertical:"top",horizontal:"center",msg:h.payload.error,severity:"error"});else{g(S(h.payload.data,d.values.consumption_limit)),l(h.payload.data);const j=h.payload.data.map((f,w)=>{var O,F,E;return[w+1,je(f==null?void 0:f.date),(O=f==null?void 0:f.poultry)==null?void 0:O.toLocaleString(),(F=f==null?void 0:f.quantity)==null?void 0:F.toLocaleString(),(E=f==null?void 0:f.weight)==null?void 0:E.toLocaleString(),Array.isArray(f==null?void 0:f.age)?f.age.map((z,Y)=>z).join(" - "):f==null?void 0:f.age,i.jsx(In,{placement:"left",title:"جزئیات",children:i.jsx(de,{color:"primary",size:"small",onClick:()=>window.open(C(f),"_blank"),children:i.jsx(Xu,{})})},w)]});s(j)}})}}),x=()=>{let y={consumption_limit_type:d.values.consumption_limit_type,killing_age_external_type:d.values.killing_age_external_type,killing_age:d.values.killing_age_external_type==="manual"?d.values.killing_age:null,time_frame_type:d.values.time_frame_type,consumption_limit:d.values.consumption_limit,killing_age_internal_type:d.values.killing_age_external_type==="poultry_ave_killing_age"?d.values.killing_age_internal_type:null,date1:d.values.time_frame_type==="manual"?t:null,date2:d.values.time_frame_type==="manual"?n:null,role:_()};return y=Object.fromEntries(Object.entries(y).filter(([h,j])=>j!==null)),new URLSearchParams(y).toString()};v.useEffect(()=>{d.validateForm()},[]);const A={scales:{y:{beginAtZero:!0,min:0}},onClick:(y,m)=>{var h;if(m.length>0){const j=(h=m[0])==null?void 0:h.index;let f=C(a[j]);window.open(f,"_blank")}},plugins:{annotation:{annotations:{line1:{type:"line",yMin:d.values.consumption_limit,yMax:d.values.consumption_limit,borderColor:"red",borderWidth:2,borderDash:[5,5],label:{display:!0,content:"حد مصرف",position:"end",backgroundColor:"rgba(255, 99, 132, 0.8)",font:{size:14,weight:"bold"},padding:5}}}}}},S=(y,m)=>y!=null&&y.length?{labels:y==null?void 0:y.map(h=>je(h.date)),datasets:[{label:d.values.consumption_limit_type==="quantity"?"حجم موجودی (قطعه)":"وزن موجودی (کیلوگرم)",data:d.values.consumption_limit_type==="quantity"?y==null?void 0:y.map(h=>h.quantity):y==null?void 0:y.map(h=>h.weight),borderColor:"rgba(75, 192, 192, 1)",backgroundColor:"rgba(75, 192, 192, 0.2)",borderWidth:2,pointRadius:5,pointBackgroundColor:"yellow",pointHoverRadius:7,fill:!0,tension:.4}],annotations:{line1:{type:"line",yMin:m,yMax:m,borderColor:"rgba(255, 99, 132, 1)",borderWidth:3,borderDash:[5,5],label:{enabled:!0,content:"حد مصرف",position:"end",backgroundColor:"rgba(255, 99, 132, 0.8)",font:{size:14,weight:"bold"}}}}}:null;return i.jsxs(M,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",children:[i.jsxs(_e,{width:{xs:"100%",md:"80%"},sx:{p:3,borderRadius:2,boxShadow:2,bgcolor:"background.paper"},children:[i.jsx(P,{variant:"h6",color:"primary",sx:{mb:2,fontWeight:"bold"},children:"پیش بینی موجودی"}),i.jsxs(M,{container:!0,spacing:2,children:[i.jsx(M,{item:!0,xs:12,md:6,children:i.jsxs(Me,{fullWidth:!0,error:d.touched.consume_limit&&!!d.errors.consume_limit,children:[i.jsx(De,{children:"حد مصرف"}),i.jsxs(Le,{size:"small",name:"consumption_limit_type",value:d.values.consumption_limit_type,onChange:d.handleChange,onBlur:d.handleBlur,error:d.touched.consumption_limit_type&&!!d.errors.consumption_limit_type,children:[i.jsx(k,{value:"quantity",children:"قطعه"}),i.jsx(k,{value:"live_weight",children:"وزن زنده"}),i.jsx(k,{value:"carcassses_weight",children:"وزن لاشه"})]}),i.jsx(Xe,{children:d.touched.consumption_limit_type&&d.errors.consumption_limit_type})]})}),i.jsx(M,{item:!0,xs:12,md:6,children:d.values.consumption_limit_type&&i.jsx(xr,{size:"small",allowLeadingZeros:!0,thousandSeparator:",",id:"consumption_limit",name:"consumption_limit",label:d.values.consumption_limit_type==="quantity"?"تعداد (قطعه)":"وزن (کیلوگرم)",variant:"outlined",value:d.values.consumption_limit,onChange:d.handleChange,onBlur:d.handleBlur,error:d.touched.consumption_limit&&!!d.errors.consumption_limit,helperText:d.touched.consumption_limit&&d.errors.consumption_limit})}),i.jsx(M,{item:!0,xs:12,md:6,children:i.jsxs(Me,{fullWidth:!0,error:d.touched.killing_age_external_type&&!!d.errors.killing_age_external_type,children:[i.jsx(De,{children:"میانگین سن کشتار *"}),i.jsxs(Le,{size:"small",name:"killing_age_external_type",value:d.values.killing_age_external_type,onChange:d.handleChange,onBlur:d.handleBlur,children:[i.jsx(k,{value:"poultry_ave_killing_age",children:"رفتار سنی کشتار فارم ها"}),i.jsx(k,{value:"manual",children:"دستی"})]}),i.jsx(Xe,{children:d.touched.killing_age_external_type&&d.errors.killing_age_external_type})]})}),i.jsx(M,{item:!0,xs:12,md:6,children:d.values.killing_age_external_type&&i.jsx(i.Fragment,{children:d.values.killing_age_external_type==="poultry_ave_killing_age"?i.jsxs(Me,{fullWidth:!0,error:d.touched.killing_age_internal_type&&!!d.errors.killing_age_internal_type,children:[i.jsx(De,{children:"رفتار سنی کشتار"}),i.jsxs(Le,{size:"small",name:"killing_age_internal_type",value:d.values.killing_age_internal_type,onChange:d.handleChange,onBlur:d.handleBlur,children:[i.jsx(k,{value:"poultry",children:"بر اساس کشتار فارم ها"}),i.jsx(k,{value:"province",children:"بر اساس میانگین کشتار استانی"})]}),i.jsx(Xe,{children:d.touched.killing_age_internal_type&&d.errors.killing_age_internal_type})]}):i.jsx($,{size:"small",fullWidth:!0,id:"killing_age",label:"سن را وارد کنید",value:d.values.killing_age,onChange:d.handleChange,onBlur:d.handleBlur,error:d.touched.killing_age&&!!d.errors.killing_age,helperText:d.touched.killing_age&&d.errors.killing_age,variant:"outlined"})})}),i.jsx(M,{item:!0,xs:12,md:6,children:i.jsxs(Me,{fullWidth:!0,error:d.touched.time_frame_type&&!!d.errors.time_frame_type,children:[i.jsx(De,{children:"تاریخ پیش بینی *"}),i.jsxs(Le,{size:"small",name:"time_frame_type",value:d.values.time_frame_type,onChange:d.handleChange,onBlur:d.handleBlur,children:[i.jsx(k,{value:"all",children:"بدون بازه زمانی"}),i.jsx(k,{value:"manual",children:"انتخاب بازه زمانی"})]}),i.jsx(Xe,{children:d.touched.time_frame_type&&d.errors.time_frame_type})]})}),d.values.time_frame_type==="manual"&&i.jsxs(i.Fragment,{children:[i.jsx(M,{item:!0,xs:12,md:3,children:i.jsx(tt,{label:"از تاریخ",value:t,onChange:y=>e(Ne(y).format("YYYY-MM-DD")),renderInput:y=>i.jsx($,{size:"small",fullWidth:!0,...y})})}),i.jsx(M,{item:!0,xs:12,md:3,children:i.jsx(tt,{label:"تا تاریخ",value:n,onChange:y=>u(Ne(y).format("YYYY-MM-DD")),renderInput:y=>i.jsx($,{size:"small",fullWidth:!0,...y})})})]})]}),i.jsxs(_e,{sx:{mt:3,display:"flex",justifyContent:"center",gap:"10px"},children:[i.jsx(ge,{disabled:!d.isValid,variant:"contained",color:"primary",sx:{px:4,py:1.5,borderRadius:2},onClick:d.handleSubmit,children:"پیمایش"}),i.jsx(ge,{disabled:!d.isValid,variant:"contained",color:"success",sx:{px:4,py:1.5,borderRadius:2},onClick:()=>{p({vertical:"top",horizontal:"center",msg:"فایل اکسل در حال دانلود می باشد، این علمیات ممکن است زمان بر باشد لطفا صبر کنید.",severity:"success"});const y=x(),m=`${V.defaults.baseURL}poultry_hatching_prediction_chart_excel/?${y}`;window.location.href=m},children:"خروجی اکسل"})]})]}),i.jsx(M,{container:!0,xs:12,my:2,children:i.jsx(dt,{columns:["ردیف","تاریخ","تعداد مرغداران","حجم (قطعه)","وزن (کیلوگرم)","سن","عملیات"],data:r,title:"داده های تجمیعی",paginated:!0})}),c&&i.jsx(M,{container:!0,justifyContent:"center",xs:12,sx:{p:3,borderRadius:2,boxShadow:2,bgcolor:"background.paper",my:5},children:i.jsx(Be,{data:c,options:A})})]})},ps=()=>{const t=ye(),e=m=>{c(m.target.value)},[n,u]=v.useState([]),[o,r]=v.useState(0),[s,a]=v.useState(10),[l,c]=v.useState(""),[g,p]=v.useState(1),[C,d]=v.useState([]),x=async m=>{let h;t(G()),h=await V.get(`poultry_hatching_prediction/?search=filter&value=${l}&role=${_()}&page=${m}&page_size=${s}`),t(Q()),u(h.data.results),r(h.data.count)},A=m=>{x(m),p(m)},S=m=>{a(m),p(1)};v.useEffect(()=>{const m=n==null?void 0:n.map((h,j)=>{var f,w,O,F,E,z,Y,J,Z,ee,te,ne,ue,re,oe,N,se,ie,ae,le,ce,I,T;return[g===1?j+1:j+s*(g-1)+1,(f=h==null?void 0:h.poultry)==null?void 0:f.unitName,((w=h==null?void 0:h.poultry)==null?void 0:w.fullname)||"-",(F=(O=h==null?void 0:h.poultry)==null?void 0:O.killingAveAge)==null?void 0:F.toLocaleString(),(z=(E=h==null?void 0:h.poultry)==null?void 0:E.realKillingAveWeight)==null?void 0:z.toLocaleString(),(Y=h==null?void 0:h.period)==null?void 0:Y.toLocaleString(),je(h==null?void 0:h.date),(J=h==null?void 0:h.quantity)==null?void 0:J.toLocaleString(),(ee=(Z=h==null?void 0:h.generalInfo)==null?void 0:Z.age)==null?void 0:ee.toLocaleString(),(h==null?void 0:h.chickenBreed)||"-",(ne=(te=h==null?void 0:h.generalInfo)==null?void 0:te.totalQuantity)==null?void 0:ne.toLocaleString(),(re=(ue=h==null?void 0:h.generalInfo)==null?void 0:ue.totalWeight)==null?void 0:re.toLocaleString(),(N=(oe=h==null?void 0:h.generalInfo)==null?void 0:oe.provinceKillRequests)==null?void 0:N.toLocaleString(),(ie=(se=h==null?void 0:h.generalInfo)==null?void 0:se.provinceKillRequestsQuantity)==null?void 0:ie.toLocaleString(),(le=(ae=h==null?void 0:h.generalInfo)==null?void 0:ae.provinceKillRequestsWeight)==null?void 0:le.toLocaleString(),(ce=h==null?void 0:h.leftOver)==null?void 0:ce.toLocaleString(),Math.round(((I=h==null?void 0:h.poultry)==null?void 0:I.realKillingAveWeight)*(h==null?void 0:h.leftOver)).toLocaleString(),Math.round(((T=h==null?void 0:h.poultry)==null?void 0:T.realKillingAveWeight)*(h==null?void 0:h.leftOver)*.75).toLocaleString()]});d(m)},[n]),v.useEffect(()=>{x(1)},[t,s]);const y=async m=>{m.preventDefault(),t(G());try{const h=await V.get(`poultry_hatching_prediction/?role=${_()}&search=filter&value=${l}&page=1&page_size=${s}`);u(h.data.results),r(h.data.count),t(Q())}catch(h){console.error("Error fetching data:",h)}};return i.jsxs(b,{container:!0,xs:12,justifyContent:"center",alignItems:"center",gap:2,children:[i.jsx(b,{container:!0,xs:12,justifyContent:"start",alignItems:"center",gap:2,children:i.jsx(b,{children:i.jsxs("form",{onSubmit:y,children:[i.jsx($,{id:"outlined-basic",size:"small",label:"جستجو",variant:"outlined",style:{width:250},onChange:e}),i.jsx(ge,{type:"submit",onClick:y,endIcon:i.jsx(Xn,{}),children:"جستجو"})]})})}),i.jsx(dt,{data:C,columns:["ردیف","نام واحد","مالک","میانگین سن کشتار","میانگین وزن کشتار","دوره","تاریخ جوجه ریزی","حجم جوجه ریزی","سن","نژاد","حجم کشتار شده","وزن کشتار شده","تخصیص بدون بار","حجم تخصیص بدون بار","وزن تخصیص بدون بار","مانده سالن (حجم)","مانده سالن (وزن زنده)","مانده سالن (وزن لاشه)"],handlePageChange:A,totalRows:o,page:g,perPage:s,handlePerRowsChange:S,title:"جوجه ریزی های فعال"})]})};var Jt={},ys=We;Object.defineProperty(Jt,"__esModule",{value:!0});var _u=Jt.default=void 0,xs=ys(He()),bs=i;_u=Jt.default=(0,xs.default)((0,bs.jsx)("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"}),"ArrowUpward");const ms=()=>{var r,s,a,l,c,g,p,C,d,x,A,S,y,m;const t=ye(),[e,n]=v.useState([]),[u,o]=v.useState(!1);return v.useEffect(()=>{t(Nr()).then(h=>{n(h.payload.data)})},[t]),i.jsxs(b,{container:!0,xs:12,justifyContent:"center",alignItems:"center",children:[i.jsxs(b,{container:!0,mt:2,mb:4,isDashboard:!0,children:[i.jsx(dt,{noPagination:!0,isDashboard:!0,operation:i.jsx(In,{placement:"top",title:"نمایش جوجه ریزی های فعال",children:i.jsx(de,{color:"primary",onClick:()=>{o(!u)},children:u?i.jsx(_u,{}):i.jsx(br,{})})}),columns:["جوجه ریزی های فعال","حجم جوجه ریزی فعال","میانگین سنی","میانگین سن کشتار ","میانگین وزن کشتار ","حجم کشتار","وزن کشتار","تعداد بارها","حجم بارها","وزن بارها","تخصیص بدون بار","حجم تخصیص بدون بار","وزن تخصیص بدون بار","حجم مانده در سالن"],data:[[(r=e==null?void 0:e.hatchings)==null?void 0:r.toLocaleString(),(s=e==null?void 0:e.totalHatchingQuantity)==null?void 0:s.toLocaleString(),(a=e==null?void 0:e.aveNowAge)==null?void 0:a.toLocaleString(),(l=e==null?void 0:e.aveAge)==null?void 0:l.toLocaleString(),(c=e==null?void 0:e.aveWeight)==null?void 0:c.toLocaleString(),(g=e==null?void 0:e.totalQuantity)==null?void 0:g.toLocaleString(),(p=e==null?void 0:e.totalWeight)==null?void 0:p.toLocaleString(),(C=e==null?void 0:e.killHouseRequests)==null?void 0:C.toLocaleString(),(d=e==null?void 0:e.killHouseRequestsQuantity)==null?void 0:d.toLocaleString(),(x=e==null?void 0:e.provinceKillRequestsWeight)==null?void 0:x.toLocaleString(),(A=e==null?void 0:e.provinceKillRequests)==null?void 0:A.toLocaleString(),(S=e==null?void 0:e.provinceKillRequestsQuantity)==null?void 0:S.toLocaleString(),(y=e==null?void 0:e.provinceKillRequestsWeight)==null?void 0:y.toLocaleString(),(m=e==null?void 0:e.totalHatchingLeftOver)==null?void 0:m.toLocaleString()]],title:"خلاصه اطلاعات"}),i.jsx(mr,{children:u&&i.jsx(qu.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3},style:{width:"100%"},children:i.jsx(b,{container:!0,mt:2,justifyContent:"center",alignItems:"center",children:i.jsx(ps,{})})})})]}),i.jsx(Cs,{})]})},As=()=>{const{key:t,date:e}=Rn(),n=ye(),u=j=>{p(j.target.value)},[o,r]=v.useState([]),[s,a]=v.useState(0),[l,c]=v.useState(10),[g,p]=v.useState(""),[C,d]=v.useState(1),[x,A]=v.useState([]),S=async j=>{let f;n(G()),f=await V.get(`poultry_hatching_prediction/?search=filter&value=${g}&role=${_()}&page=${j}&page_size=${l}&hatching_list=${t}`),n(Q()),r(f.data.results),a(f.data.count)},y=j=>{S(j),d(j)},m=j=>{c(j),d(1)};v.useEffect(()=>{const j=o==null?void 0:o.map((f,w)=>{var O,F,E,z,Y,J,Z,ee,te,ne,ue,re,oe,N,se,ie,ae,le,ce,I,T,R,L;return[C===1?w+1:w+l*(C-1)+1,(O=f==null?void 0:f.poultry)==null?void 0:O.unitName,((F=f==null?void 0:f.poultry)==null?void 0:F.fullname)||"-",(z=(E=f==null?void 0:f.poultry)==null?void 0:E.killingAveAge)==null?void 0:z.toLocaleString(),(J=(Y=f==null?void 0:f.poultry)==null?void 0:Y.realKillingAveWeight)==null?void 0:J.toLocaleString(),(Z=f==null?void 0:f.period)==null?void 0:Z.toLocaleString(),je(f==null?void 0:f.date),(ee=f==null?void 0:f.quantity)==null?void 0:ee.toLocaleString(),(ne=(te=f==null?void 0:f.generalInfo)==null?void 0:te.age)==null?void 0:ne.toLocaleString(),(f==null?void 0:f.chickenBreed)||"-",(re=(ue=f==null?void 0:f.generalInfo)==null?void 0:ue.totalQuantity)==null?void 0:re.toLocaleString(),(N=(oe=f==null?void 0:f.generalInfo)==null?void 0:oe.totalWeight)==null?void 0:N.toLocaleString(),(ie=(se=f==null?void 0:f.generalInfo)==null?void 0:se.provinceKillRequests)==null?void 0:ie.toLocaleString(),(le=(ae=f==null?void 0:f.generalInfo)==null?void 0:ae.provinceKillRequestsQuantity)==null?void 0:le.toLocaleString(),(I=(ce=f==null?void 0:f.generalInfo)==null?void 0:ce.provinceKillRequestsWeight)==null?void 0:I.toLocaleString(),(T=f==null?void 0:f.leftOver)==null?void 0:T.toLocaleString(),Math.round(((R=f==null?void 0:f.poultry)==null?void 0:R.realKillingAveWeight)*(f==null?void 0:f.leftOver)).toLocaleString(),Math.round(((L=f==null?void 0:f.poultry)==null?void 0:L.realKillingAveWeight)*(f==null?void 0:f.leftOver)*.75).toLocaleString()]});A(j)},[o]),v.useEffect(()=>{S(1)},[n,l]);const h=async j=>{j.preventDefault(),n(G());try{const f=await V.get(`poultry_hatching_prediction/?role=${_()}&search=filter&value=${g}&page=1&page_size=${l}&hatching_list=${t}`);r(f.data.results),a(f.data.count),n(Q())}catch(f){console.error("Error fetching data:",f)}};return i.jsxs(b,{container:!0,xs:12,justifyContent:"center",alignItems:"center",gap:2,mt:2,children:[i.jsx(b,{container:!0,xs:12,justifyContent:"start",alignItems:"center",gap:2,children:i.jsx(b,{children:i.jsxs("form",{onSubmit:h,children:[i.jsx($,{id:"outlined-basic",size:"small",label:"جستجو",variant:"outlined",style:{width:250},onChange:u}),i.jsx(ge,{type:"submit",onClick:h,endIcon:i.jsx(Xn,{}),children:"جستجو"})]})})}),i.jsx(dt,{data:x,columns:["ردیف","نام واحد","مالک","میانگین سن کشتار","میانگین وزن کشتار","دوره","تاریخ جوجه ریزی","حجم جوجه ریزی","سن","نژاد","حجم کشتار شده","وزن کشتار شده","تخصیص بدون بار","حجم تخصیص بدون بار","وزن تخصیص بدون بار","مانده سالن (حجم)","مانده سالن (وزن زنده)","مانده سالن (وزن لاشه)"],handlePageChange:y,totalRows:s,page:C,perPage:l,handlePerRowsChange:m,title:`جزئیات پایش اطلاعات تاریخ ${je(e)}`})]})},Su=ut("VISORS_GET_NATIONAL_iNFO",async(t,{dispatch:e})=>{e(G());const{data:n,status:u}=await V.get("https://rsibackend.rasadyar.com/app/hatching-analysis-"+t.type,{params:{date1:t.withDate?t.selectedDate1:null,date2:t.withDate?t.selectedDate2:null,province:t.selectedProvince?t.selectedProvince:null}});return e(Q()),{data:n,status:u}});X.register(Un,at,lt,rt,ot,st,it,$n);const _s=({selectedProvince:t,selectedDate1:e,selectedDate2:n,withDate:u})=>{var l,c,g,p,C;const o=ye(),[r,s]=v.useState({});v.useEffect(()=>{o(Su({selectedProvince:t,selectedDate1:e,selectedDate2:n,withDate:u,type:"province"})).then(d=>{s(d.payload.data)})},[o,t,e,n,u]);const a=(d,x)=>{if(d){if(x==="sum-hatching")return[{name:"حجم جوجه ریزی",data:d==null?void 0:d.map(S=>(S==null?void 0:S.chickSum)||0)}];if(x==="average-age")return[{name:"میانگین سنی",data:d==null?void 0:d.map(S=>(S==null?void 0:S.averageAge)||0)}];if(x==="evacuation")return[{name:"درصد تلفات",data:d==null?void 0:d.map(S=>(S==null?void 0:S.evacuationHatching)||0)}];if(x==="leftover")return[{name:"باقیمانده",data:d==null?void 0:d.map(S=>(S==null?void 0:S.leftOver)||0)}];if(x==="sum-transport")return[{name:"حجم کشتار",data:d==null?void 0:d.map(S=>(S==null?void 0:S.goodAmount)||0)}]}else return null};return i.jsx(b,{xs:12,container:!0,justifyContent:"center",alignItems:"center",spacing:4,style:{width:"100%"},children:r&&i.jsxs(i.Fragment,{children:[i.jsx(b,{item:!0,xs:12,justifyContent:"center",alignItems:"center",height:"700px",children:i.jsx(he,{title:"حجم جوجه ریزی",type:"bar",group:!0,seperator:(l=r==null?void 0:r.provinceHatchingSum)==null?void 0:l.map(d=>d.ProvinceName),info:a(r==null?void 0:r.provinceHatchingSum,"sum-hatching")})}),i.jsx(b,{item:!0,xs:6,justifyContent:"center",alignItems:"center",height:"700px",children:i.jsx(he,{title:"میانگین سنی",type:"bar",group:!0,seperator:(c=r==null?void 0:r.provinceNameAverageAge)==null?void 0:c.map(d=>d.ProvinceName),info:a(r==null?void 0:r.provinceNameAverageAge,"average-age")})}),i.jsx(b,{item:!0,xs:6,justifyContent:"center",alignItems:"center",height:"700px",children:i.jsx(he,{title:"درصد تلفات هر استان",type:"bar",group:!0,seperator:(g=r==null?void 0:r.provinceEvacuationHatchingPercent)==null?void 0:g.map(d=>d.ProvinceName),info:a(r==null?void 0:r.provinceEvacuationHatchingPercent,"evacuation")})}),i.jsx(b,{item:!0,xs:12,justifyContent:"center",alignItems:"center",height:"700px",children:i.jsx(he,{title:"حجم باقیمانده",type:"bar",group:!0,seperator:(p=r==null?void 0:r.provinceNameLeftover)==null?void 0:p.map(d=>d.ProvinceName),info:a(r==null?void 0:r.provinceNameLeftover,"leftover")})}),i.jsx(b,{item:!0,xs:12,justifyContent:"center",alignItems:"center",height:"700px",children:i.jsx(he,{title:"مجموع حجم کشتار",type:"line",group:!0,seperator:(C=r==null?void 0:r.provinceSumTransporting)==null?void 0:C.map(d=>d.ProvinceName),info:a(r==null?void 0:r.provinceSumTransporting,"sum-transport")})})]})})};X.register(Un,at,lt,rt,ot,st,it,$n);const Ss=({selectedProvince:t,selectedDate1:e,selectedDate2:n,withDate:u})=>{var C,d;const o=ye(),[r,s]=v.useState({});v.useEffect(()=>{o(Su({selectedProvince:t,selectedDate1:e,selectedDate2:n,withDate:u,type:"pedigree"})).then(x=>{s(x.payload.data)})},[o,t,e,n,u]);const a=x=>{var S,y,m,h,j,f;let A;switch(x){case"average-age":A={labels:(S=r==null?void 0:r.pedigreeNameAverageAge)==null?void 0:S.map(w=>w==null?void 0:w.PedigreeName),chartList:(y=r==null?void 0:r.pedigreeNameAverageAge)==null?void 0:y.map(w=>w==null?void 0:w.averageAge)};break;case"hatching-sum":A={labels:(m=r==null?void 0:r.pedigreeNameHatchingSum)==null?void 0:m.map(w=>w==null?void 0:w.PedigreeName),chartList:(h=r==null?void 0:r.pedigreeNameHatchingSum)==null?void 0:h.map(w=>w==null?void 0:w.chickSum)};break;case"hatching-count":A={labels:(j=r==null?void 0:r.pedigreeNameHatchingCount)==null?void 0:j.map(w=>w==null?void 0:w.PedigreeName),chartList:(f=r==null?void 0:r.pedigreeNameHatchingCount)==null?void 0:f.map(w=>w==null?void 0:w.chickCount)};break}if(x==="hatching-sum"){const w=["rgba(255, 99, 132, 0.7)","rgba(54, 162, 235, 0.7)","rgba(255, 206, 86, 0.7)","rgba(75, 192, 192, 0.7)","rgba(153, 102, 255, 0.7)","rgba(255, 159, 64, 0.7)"];return{labels:A==null?void 0:A.labels,datasets:[{data:A==null?void 0:A.chartList,backgroundColor:w,borderColor:"#fff",borderWidth:2,hoverOffset:10}]}}return{labels:A==null?void 0:A.labels,datasets:[{label:x==="hatching-count"?"تعداد":"سن",data:A==null?void 0:A.chartList,borderColor:"#3A3A3A",backgroundColor:"rgba(16, 185, 129, 0.1)",borderWidth:2,tension:.3,pointRadius:0,pointHoverRadius:6,pointBackgroundColor:"#3A3A3A",pointHoverBackgroundColor:"#3A3A3A",fill:!0}]}},l={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1,rtl:!0,labels:{usePointStyle:!0,padding:20,font:{family:"iranyekan",size:14}}},tooltip:{mode:"index",intersect:!1,backgroundColor:"#1E293B",titleFont:{family:"iranyekan",size:14,weight:"bold"},bodyFont:{family:"iranyekan",size:12},padding:12,cornerRadius:8,displayColors:!0,rtl:!0}},scales:{x:{grid:{display:!1,drawBorder:!1},ticks:{color:"#64748B",font:{family:"iranyekan",size:12}}},y:{grid:{display:!1,drawBorder:!1},ticks:{color:"#64748B",font:{family:"iranyekan",size:11},padding:10}}},interaction:{mode:"nearest",axis:"x",intersect:!1}},c={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"right",rtl:!0,labels:{usePointStyle:!0,padding:20,font:{family:"iranyekan",size:14}}},tooltip:{backgroundColor:"#1E293B",titleFont:{family:"iranyekan",size:14,weight:"bold"},bodyFont:{family:"iranyekan",size:12},padding:12,cornerRadius:8,displayColors:!0,rtl:!0}},cutout:"70%"},g=x=>{if(x){const A=new Set;return x.forEach(m=>{m.breeds.forEach(h=>{A.add(h.pedigree)})}),Array.from(A).map(m=>{const h=x.map(j=>{const f=j.breeds.find(w=>w.pedigree===m);return f?f.hatchingSum:0});return{name:m,data:h}})}else return null},p=x=>x?[{name:"درصد تلفات نسبت به جوجه ریزی نژاد",data:x==null?void 0:x.map(A=>A.pedigree)},{name:"درصد تلفات نسبت به کل جوجه ریزی",data:x==null?void 0:x.map(A=>A.total)}]:null;return i.jsxs(b,{xs:12,container:!0,justifyContent:"center",alignItems:"center",spacing:4,style:{width:"100%"},children:[i.jsxs(b,{item:!0,xs:12,sm:6,justifyContent:"center",alignItems:"center",children:[i.jsx(P,{mt:2,mb:2,variant:"body2",children:"میانگین سنی کشتار"}),i.jsx(_e,{sx:{p:"24px",borderRadius:2,height:"300px",background:"linear-gradient(180deg,rgba(255, 255, 255, 1) 0%, rgba(230, 250, 245, 1) 50%, rgba(230, 241, 253, 1) 100%)"},children:i.jsx(Be,{data:a("average-age"),options:l})})]}),i.jsxs(b,{item:!0,xs:12,sm:6,justifyContent:"center",alignItems:"center",children:[i.jsx(P,{mt:2,mb:2,variant:"body2",children:"حجم جوجه ریزی"}),i.jsx(_e,{sx:{p:"24px",borderRadius:2,height:"300px",background:"linear-gradient(180deg,rgba(255, 255, 255, 1) 0%, rgba(230, 250, 245, 1) 50%, rgba(230, 241, 253, 1) 100%)"},children:i.jsx(cr,{data:a("hatching-sum"),options:c})})]}),r&&i.jsx(b,{item:!0,xs:12,justifyContent:"center",alignItems:"center",height:"700px",children:i.jsx(he,{title:"جوجه ریزی براساس نژاد",type:"bar",group:!0,seperator:(C=r==null?void 0:r.provinceResult)==null?void 0:C.map(x=>x.province),info:g(r==null?void 0:r.provinceResult)})}),i.jsxs(b,{item:!0,xs:6,justifyContent:"center",alignItems:"center",children:[i.jsx(P,{mt:2,mb:2,variant:"body2",children:"تعداد جوجه ریزی"}),i.jsx(_e,{sx:{p:"24px",borderRadius:2,height:"400px",background:"linear-gradient(180deg,rgba(255, 255, 255, 1) 0%, rgba(230, 250, 245, 1) 50%, rgba(230, 241, 253, 1) 100%)"},children:i.jsx(Be,{data:a("hatching-count"),options:l})})]}),i.jsx(b,{item:!0,xs:6,justifyContent:"center",alignItems:"center",children:i.jsx(b,{item:!0,xs:12,justifyContent:"center",alignItems:"center",height:"700px",children:i.jsx(he,{title:"میزان تلفات به ازای هر نژاد",type:"bar",group:!0,seperator:(d=r==null?void 0:r.pedigreeEvacuationHatchingPercent)==null?void 0:d.map(x=>x.pedigreeName),info:p(r==null?void 0:r.pedigreeEvacuationHatchingPercent)})})})]})};X.register(rt,ot,st,it,Bn,at,lt);const vs=()=>{const[,,t,e,n,u]=v.useContext(vt),[o,r]=v.useState("breed"),[s,a]=v.useState(!1),[l,c]=v.useState(""),g=(C,d)=>{r(d)},p=()=>[{name:"همه"},...Ar()];return i.jsxs(b,{container:!0,xs:12,justifyContent:"center",alignItems:"center",mb:4,children:[i.jsx(b,{container:!0,xs:12,justifyContent:"center",alignItems:"center",children:i.jsxs(Pu,{value:o,onChange:g,"aria-label":"simple tabs example",scrollButtons:"auto",variant:"scrollable",allowScrollButtonsMobile:!0,children:[i.jsx(qe,{value:"breed",label:"نژاد"}),i.jsx(qe,{value:"national",label:"کشور"}),i.jsx(qe,{disabled:!0,value:"killing",label:"کشتار"}),i.jsx(qe,{disabled:!0,value:"age",label:"سن"})]})}),i.jsx(b,{container:!0,xs:12,justifyContent:"start",alignItems:"center",gap:2,mt:2,children:i.jsxs(b,{container:!0,gap:1,style:{borderStyle:"solid",borderWidth:"1px",padding:"10px",borderRadius:"15px",borderColor:"#E6F1FD",justifyContent:"left"},alignItems:"center",children:[i.jsx(b,{minWidth:210,children:i.jsx(Ou,{size:"small",disablePortal:!0,id:"hatching",options:p().map(C=>({label:C.name})),onChange:(C,d)=>{d.label!=="همه"?c(d.label):c("")},renderInput:C=>i.jsx($,{...C,label:"انتخاب استان"})})}),i.jsx(b,{container:!0,justifyContent:"center",alignItems:"center",children:i.jsx(St,{icon:i.jsx(_r,{}),checkedIcon:i.jsx(Sr,{}),checked:s,onChange:()=>a(!s),color:"primary",size:"large"})}),i.jsx(b,{children:i.jsx(tt,{disabled:!s,label:"از تاریخ",id:"date",renderInput:C=>i.jsx($,{size:"small",style:{width:"160px"},...C}),value:t,onChange:C=>{e(Ne(C).format("YYYY-MM-DD"))}})}),i.jsx(b,{children:i.jsx(tt,{disabled:!s,label:"تا تاریخ",id:"date",renderInput:C=>i.jsx($,{size:"small",style:{width:"160px"},...C}),value:n,onChange:C=>{u(Ne(C).format("YYYY-MM-DD"))}})})]})}),!1,o==="breed"&&i.jsx(Ss,{selectedProvince:l,selectedDate1:t,selectedDate2:n,withDate:s}),o==="national"&&i.jsx(_s,{selectedProvince:l,selectedDate1:t,selectedDate2:n,withDate:s})]})},Gs=()=>{const{key:t}=Rn(),e=r=>{const s=[Je,kn,Pn,On,Fn,Mn,Dn,En],a=[Se,Ot,Ft,Mt,Dt,Lt,zt,Pt],l=[Ze,zn,Nn,Vn];return s.includes(r)?i.jsx(Lr,{}):l.includes(r)?i.jsx(vs,{}):a.some(c=>r.includes(c))?i.jsx(ms,{}):null},n=()=>i.jsx(b,{justifyContent:"center",my:Ce.MEDIUM,children:i.jsx(b,{children:i.jsx(P,{variant:"h6",children:"داشبورد پایش آماری"})})}),{pathname:u}=Tn(),o=[Gu,Qu,Ku,Ln,Ju,Zu,er,tr].includes(u);return i.jsx(_e,{display:"flex",justifyContent:"center",children:i.jsxs(b,{container:!0,direction:"column",justifyContent:"center",xs:12,sm:12,md:10,lg:10,children:[o&&!t?i.jsxs(i.Fragment,{children:[i.jsx(n,{}),i.jsx(zr,{})]}):!t&&i.jsx(yr,{}),!t&&e(u),t&&i.jsx(As,{})]})})};export{Gs as default};
|