@arcgis/charts-components 5.2.0-next.7 → 5.2.0-next.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/cdn/{DPNTYHTH.js → 2B4S6PH2.js} +1 -1
  2. package/dist/cdn/{7HGVEE7A.js → 2GJX5OO6.js} +1 -1
  3. package/dist/cdn/{TJMTF45U.js → 3X5JIVJJ.js} +2 -2
  4. package/dist/cdn/{EP34TF4L.js → 44GWFKSR.js} +1 -1
  5. package/dist/cdn/{ADPDJISV.js → 4LLOMGO7.js} +1 -1
  6. package/dist/cdn/{JTTJ455Y.js → 4P7S3KIY.js} +1 -1
  7. package/dist/cdn/{WGYJBMRM.js → 55UVN4AF.js} +1 -1
  8. package/dist/cdn/{DAB5R2BN.js → 5F54SB3S.js} +1 -1
  9. package/dist/cdn/{RG3DO2OE.js → 667DYS3D.js} +1 -1
  10. package/dist/cdn/{GDQBQQUP.js → 73BVFUAA.js} +1 -1
  11. package/dist/cdn/{XG3WW5GG.js → 7DD3FFI5.js} +1 -1
  12. package/dist/cdn/{TDHHWIIC.js → 7LXWQH6J.js} +1 -1
  13. package/dist/cdn/{6CFIKYKR.js → 7TRRNFTL.js} +1 -1
  14. package/dist/cdn/{UZEMSOA2.js → 7XLZ42N6.js} +1 -1
  15. package/dist/cdn/{J6WQX4UD.js → BSP7U5YN.js} +20 -20
  16. package/dist/cdn/{IWX5L226.js → CAGJKKOW.js} +1 -1
  17. package/dist/cdn/{KO7HQLGV.js → CG6PLENK.js} +1 -1
  18. package/dist/cdn/{XCUXUZXY.js → CKRMYU2S.js} +1 -1
  19. package/dist/cdn/{L5AQ4I5T.js → CQTLTJ52.js} +1 -1
  20. package/dist/cdn/CY7GY33F.js +2 -0
  21. package/dist/cdn/{S32NLOJ5.js → D57ESYPO.js} +1 -1
  22. package/dist/cdn/{JS2KOBA2.js → DKXRIXFG.js} +1 -1
  23. package/dist/cdn/EDSF5KGV.js +233 -0
  24. package/dist/cdn/{SJGYHEMZ.js → EPUNY3VI.js} +1 -1
  25. package/dist/cdn/{Q5JDSPJA.js → FATECLIQ.js} +1 -1
  26. package/dist/cdn/{GQ5QBLRO.js → FGNRWY57.js} +1 -1
  27. package/dist/cdn/{JWO5WVTZ.js → FJ4UGRMY.js} +1 -1
  28. package/dist/cdn/{OHF3AEWY.js → G7YZE67F.js} +1 -1
  29. package/dist/cdn/{O5A25X5K.js → GGHRYV36.js} +1 -1
  30. package/dist/cdn/{CVU3UPPF.js → GOP2GNGE.js} +1 -1
  31. package/dist/cdn/{4LPXOEML.js → GQ3TDTO5.js} +1 -1
  32. package/dist/cdn/{TW5DX7YP.js → H2DP7HXE.js} +1 -1
  33. package/dist/cdn/{ICFKKJWQ.js → H42V247N.js} +1 -1
  34. package/dist/cdn/{KCMZSNBL.js → H7TZ42RW.js} +1 -1
  35. package/dist/cdn/{OGYY2Y22.js → I5B6REVT.js} +1 -1
  36. package/dist/cdn/{K4WI2SGM.js → IXKYQBM7.js} +1 -1
  37. package/dist/cdn/{PROSIXIF.js → J7XXIAQJ.js} +1 -1
  38. package/dist/cdn/{ML3A3MYV.js → JRN2TZSV.js} +1 -1
  39. package/dist/cdn/{EGISZTGB.js → JRUIUNQA.js} +1 -1
  40. package/dist/cdn/{3NUNWPAR.js → KI2YCXW6.js} +1 -1
  41. package/dist/cdn/{VZTLODMQ.js → KPPNRDOP.js} +1 -1
  42. package/dist/cdn/{RPNZL6AC.js → LB6EF2UN.js} +1 -1
  43. package/dist/cdn/{OAAJ6CIN.js → M7QVV7WC.js} +1 -1
  44. package/dist/cdn/MICVGPGC.js +2 -0
  45. package/dist/cdn/{BBUPTHPL.js → MZHOWTY3.js} +1 -1
  46. package/dist/cdn/{BO62KSB5.js → NALKWY43.js} +1 -1
  47. package/dist/cdn/{KLHZFPYK.js → OCE4FAJ4.js} +1 -1
  48. package/dist/cdn/{R75MHIRF.js → PQHVQQSI.js} +1 -1
  49. package/dist/cdn/{MVHQR4FJ.js → PRFJNHPS.js} +1 -1
  50. package/dist/cdn/{JNG6V7XC.js → QNUCPXBU.js} +1 -1
  51. package/dist/cdn/{RDA5NV6M.js → QW5KML7L.js} +1 -1
  52. package/dist/cdn/{QRLILSSI.js → QXUR76TF.js} +1 -1
  53. package/dist/cdn/{QFEZPP3R.js → RCK5VONL.js} +1 -1
  54. package/dist/cdn/{MGEW6X3Y.js → RJW2DOIR.js} +2 -2
  55. package/dist/cdn/{6GLTSMOR.js → RR63Q3C2.js} +1 -1
  56. package/dist/cdn/{43ZHPVBB.js → RRC5ESYH.js} +1 -1
  57. package/dist/cdn/{LC6CY2HW.js → SS42OW45.js} +1 -1
  58. package/dist/cdn/{PRGFNLY7.js → STM26XZG.js} +1 -1
  59. package/dist/cdn/{7OF2IANH.js → TX43YOVC.js} +1 -1
  60. package/dist/cdn/{SCAZDS2G.js → TYAN5HWQ.js} +1 -1
  61. package/dist/cdn/{DZ72EIRH.js → UAGGYOZB.js} +1 -1
  62. package/dist/cdn/{D73VV2AZ.js → UDKG7LGN.js} +1 -1
  63. package/dist/cdn/{S5UDCCRH.js → UHQGJR3U.js} +1 -1
  64. package/dist/cdn/{VBHQFV2H.js → UYOCWLLG.js} +1 -1
  65. package/dist/cdn/{6AF2OTL6.js → UYTPOUP7.js} +1 -1
  66. package/dist/cdn/{7VN3A7S2.js → VKYQGU2R.js} +1 -1
  67. package/dist/cdn/{7YWZG3ZS.js → VOSE67U2.js} +1 -1
  68. package/dist/cdn/{VFREVEVA.js → W3OA4MKU.js} +1 -1
  69. package/dist/cdn/{TCTQ4LMU.js → W6KE6F3T.js} +1 -1
  70. package/dist/cdn/{32FR66QO.js → WCJ5W5TE.js} +1 -1
  71. package/dist/cdn/{NTSTL3FK.js → WHYRYWPW.js} +1 -1
  72. package/dist/cdn/{MBVTB42G.js → WOJQ6BTB.js} +1 -1
  73. package/dist/cdn/{7EMCHGGV.js → XP6RGZ2N.js} +1 -1
  74. package/dist/cdn/{NSOZIR5F.js → XRUOXTHH.js} +1 -1
  75. package/dist/cdn/{B4KAJRUJ.js → XTNDUDWE.js} +1 -1
  76. package/dist/cdn/{HWJGWDU3.js → YAR2TF55.js} +1 -1
  77. package/dist/cdn/{TJMPLGQI.js → YRFSWIDQ.js} +1 -1
  78. package/dist/cdn/{JRHMUFED.js → ZAHVBXAQ.js} +1 -1
  79. package/dist/cdn/{QY53LXP2.js → ZG7SUAGR.js} +1 -1
  80. package/dist/cdn/{C2FOUUEM.js → ZTX2ULE6.js} +1 -1
  81. package/dist/cdn/{G72TNKCS.js → ZY44M3QZ.js} +1 -1
  82. package/dist/cdn/index.js +1 -1
  83. package/dist/cdn/model/shared/setup-utils.js +1 -1
  84. package/dist/chart-rendering/common/data/utils/summarize-data/interfaces.d.ts +5 -1
  85. package/dist/chart-rendering/common/interfaces.d.ts +8 -8
  86. package/dist/chunks/class-breaks.js +18 -18
  87. package/dist/chunks/index2.js +186 -186
  88. package/dist/chunks/index4.js +2 -2
  89. package/dist/chunks/model-setter.js +1 -1
  90. package/dist/chunks/rotated-state.js +1 -1
  91. package/dist/chunks/scatterplot-model.js +1 -1
  92. package/dist/chunks/serial-chart-data.js +353 -356
  93. package/dist/chunks/utils.js +5 -5
  94. package/dist/chunks/web-component-utils.js +1 -1
  95. package/dist/components/arcgis-chart/customElement.d.ts +37 -40
  96. package/dist/components/arcgis-chart/customElement.js +5199 -5329
  97. package/dist/components/arcgis-charts-config-bar-chart/customElement.js +1 -1
  98. package/dist/components/arcgis-charts-config-bar-chart-data/customElement.js +1 -1
  99. package/dist/components/arcgis-charts-config-bar-chart-popover/customElement.js +3 -3
  100. package/dist/components/arcgis-charts-config-box-plot-popover/customElement.js +1 -1
  101. package/dist/components/arcgis-charts-config-create-flow/customElement.js +5 -5
  102. package/dist/components/arcgis-charts-config-heat-chart-popover/customElement.js +4 -4
  103. package/dist/components/arcgis-charts-config-histogram/customElement.js +1 -1
  104. package/dist/components/arcgis-charts-config-histogram-popover/customElement.js +1 -1
  105. package/dist/components/arcgis-charts-config-line-chart/customElement.js +1 -1
  106. package/dist/components/arcgis-charts-config-line-chart-data/customElement.js +1 -1
  107. package/dist/components/arcgis-charts-config-line-chart-popover/customElement.js +1 -1
  108. package/dist/components/arcgis-charts-config-pie-chart-popover/customElement.js +1 -1
  109. package/dist/components/arcgis-charts-config-scatter-plot/customElement.js +1 -1
  110. package/dist/components/arcgis-charts-config-scatter-plot-data/customElement.js +75 -75
  111. package/dist/components/arcgis-charts-config-scatter-plot-popover/customElement.js +1 -1
  112. package/dist/docs/api.json +1 -1
  113. package/dist/docs/docs.json +1 -1
  114. package/dist/docs/vscode.html-custom-data.json +1 -1
  115. package/dist/docs/web-types.json +1 -1
  116. package/dist/index.d.ts +62 -67
  117. package/dist/index.js +210 -208
  118. package/dist/model/properties/rotated-state.d.ts +1 -1
  119. package/dist/spec/rest-js-object-literals.d.ts +2 -2
  120. package/dist/utils/chart-config/converter/index.js +1 -1
  121. package/dist/utils/chart-config/utils/index.d.ts +29 -0
  122. package/dist/utils/defaults/index.d.ts +0 -1
  123. package/dist/utils/layer/inline-conversion/index.d.ts +3 -0
  124. package/package.json +4 -4
  125. package/dist/cdn/24RLLXS6.js +0 -2
  126. package/dist/cdn/2N4MK6FQ.js +0 -2
  127. /package/dist/cdn/{YOT6DVSU.js → 2OHFSVV5.js} +0 -0
  128. /package/dist/cdn/{AM2TOTX6.js → 2XXW3WF3.js} +0 -0
  129. /package/dist/cdn/{A4GEWIPY.js → 3JYZJUOM.js} +0 -0
  130. /package/dist/cdn/{6XTKJ7DO.js → 3TZEMBXR.js} +0 -0
  131. /package/dist/cdn/{ZXOO3X5P.js → 4OH4NSIW.js} +0 -0
  132. /package/dist/cdn/{TF7TE7K5.js → 5SIAOUPO.js} +0 -0
  133. /package/dist/cdn/{7FZC3RZK.js → 7QXRWMUN.js} +0 -0
  134. /package/dist/cdn/{QOOBNATX.js → AASL4RKT.js} +0 -0
  135. /package/dist/cdn/{JBHGSSHS.js → ANN3O54W.js} +0 -0
  136. /package/dist/cdn/{KFONSKQF.js → BDGHBTPU.js} +0 -0
  137. /package/dist/cdn/{CJPEW4LJ.js → FFS73X36.js} +0 -0
  138. /package/dist/cdn/{E7OAEGSE.js → FOYOG3G7.js} +0 -0
  139. /package/dist/cdn/{IPM2XKST.js → FWAXKDYV.js} +0 -0
  140. /package/dist/cdn/{N6AOFBBX.js → H3EXGCE7.js} +0 -0
  141. /package/dist/cdn/{DKAHZ7IX.js → I6UPUSLQ.js} +0 -0
  142. /package/dist/cdn/{BJDRJUEJ.js → IYA7HQMS.js} +0 -0
  143. /package/dist/cdn/{LFQGH44F.js → L47EGLUH.js} +0 -0
  144. /package/dist/cdn/{JJIGLOJA.js → LROW4Y6O.js} +0 -0
  145. /package/dist/cdn/{A5AECJXP.js → MK5ZYSOD.js} +0 -0
  146. /package/dist/cdn/{AJWYIBGC.js → N4L5KE23.js} +0 -0
  147. /package/dist/cdn/{K3GNHGEW.js → N5ZUO6F3.js} +0 -0
  148. /package/dist/cdn/{XE3FKQFA.js → OFWEHJDH.js} +0 -0
  149. /package/dist/cdn/{XW4PBQNW.js → OXYJKZEP.js} +0 -0
  150. /package/dist/cdn/{QMSINFQX.js → QR2OOC4D.js} +0 -0
  151. /package/dist/cdn/{5MEQANMY.js → RSNZMJ6I.js} +0 -0
  152. /package/dist/cdn/{DEGBVJ76.js → S3ZSZXYG.js} +0 -0
  153. /package/dist/cdn/{ETKPMU7Z.js → SERX6V5M.js} +0 -0
  154. /package/dist/cdn/{DCZWZOPF.js → SSQ3VCZ2.js} +0 -0
  155. /package/dist/cdn/{AWF4R7WL.js → TFPQDMER.js} +0 -0
  156. /package/dist/cdn/{FF4DUQDZ.js → ULWJ57VT.js} +0 -0
  157. /package/dist/cdn/{ZFZ5AEUQ.js → UYXCGSXU.js} +0 -0
  158. /package/dist/cdn/{GV3TT7L5.js → VDKFC44J.js} +0 -0
  159. /package/dist/cdn/{5YJNENER.js → VRZ2SY6M.js} +0 -0
  160. /package/dist/cdn/{HVO4LIXR.js → WAINRCCJ.js} +0 -0
  161. /package/dist/cdn/{SBYD2EKR.js → X2LW7GTR.js} +0 -0
  162. /package/dist/cdn/{2HUAW34Q.js → XDMGH7YU.js} +0 -0
  163. /package/dist/cdn/{KUZR6CGB.js → XY4TRZCG.js} +0 -0
  164. /package/dist/cdn/{5XTQQOTT.js → XYKXBWIT.js} +0 -0
  165. /package/dist/cdn/{L4G6FO7A.js → Y6ZCTPJW.js} +0 -0
  166. /package/dist/cdn/{CLXVAIQX.js → YKDW7ZW3.js} +0 -0
  167. /package/dist/cdn/{KZ7LPNX3.js → ZBIVDGNH.js} +0 -0
@@ -1,3 +1,3 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as Ci,b as wi,c as Zn,e as oe,f as _n,g as Dt}from"./EZV7JSQJ.js";import{A as xi,c as v,d as b,g as bi,h as vi,j as Ir,k as Er,l as Fi,m as je,n as Ar,q as Wn,r as he,s as Lr,t as ar,y as jn}from"./ADGMA3ST.js";import{Ba as $n,Ca as Rn,b as St,d as kn,e as Ge,f as G,g as Vn,i as pi,o as Mr,p as ir,q as j,ua as bt,va as nr,y as Si}from"./PAIRUVLU.js";import{a as Q,c as pt,d as Br,e as me,f as rt}from"./KX7KGXKQ.js";import{a as Or,d as rr,g as tt,k as An,l as yt,n as Ln,r as yi}from"./SP2IPHWF.js";import{c as En,d as hi,f as qt,g as et}from"./NZR4L5AA.js";import{H as Lt}from"./CHQDKVVQ.js";import{a as Z}from"./XJFVSX2E.js";import{a as S,b as A,c as re,e as qn,f as qe,h as be,i as gi,k as $,l as Ce,n as we,o as ae,p as Dn,q as gt,s as Pn,v as Ue}from"./547RDEMV.js";export default $arcgis.t(([Ns,$u,Ts,pn,Ru,Wu,ju,Zu,_u,zu,Hu,Us,Uu,Sn,ti,Gs,Gu,er,Yu,{substitute:_e},bn,{sqlLiteral:Qu},{computeStatisticsHistograms:Ku,computeRasterAttributeTable:Ju,getCurrentRasterInfo:oi,fetchPixelFeatureSet:Xu},Ys,Qs,ec,tc,rc])=>{var Qe=class extends Error{},qi=class extends Qe{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Di=class extends Qe{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Pi=class extends Qe{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},at=class extends Qe{},Wr=class extends Qe{constructor(e){super(`Invalid unit ${e}`)}},le=class extends Qe{},Ze=class extends Qe{constructor(){super("Zone is an abstract class")}},L="numeric",ke="short",Oe="long",jr={year:L,month:L,day:L},Fa={year:L,month:ke,day:L},zo={year:L,month:ke,day:L,weekday:ke},xa={year:L,month:Oe,day:L},Ca={year:L,month:Oe,day:L,weekday:Oe},wa={hour:L,minute:L},Na={hour:L,minute:L,second:L},Ta={hour:L,minute:L,second:L,timeZoneName:ke},Oa={hour:L,minute:L,second:L,timeZoneName:Oe},Ba={hour:L,minute:L,hourCycle:"h23"},Ma={hour:L,minute:L,second:L,hourCycle:"h23"},Ia={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:ke},Ea={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:Oe},Aa={year:L,month:L,day:L,hour:L,minute:L},La={year:L,month:L,day:L,hour:L,minute:L,second:L},qa={year:L,month:ke,day:L,hour:L,minute:L},Da={year:L,month:ke,day:L,hour:L,minute:L,second:L},Ho={year:L,month:ke,day:L,weekday:ke,hour:L,minute:L},Pa={year:L,month:Oe,day:L,hour:L,minute:L,timeZoneName:ke},ka={year:L,month:Oe,day:L,hour:L,minute:L,second:L,timeZoneName:ke},Va={year:L,month:Oe,day:L,weekday:Oe,hour:L,minute:L,timeZoneName:Oe},$a={year:L,month:Oe,day:L,weekday:Oe,hour:L,minute:L,second:L,timeZoneName:Oe},Ct=class{get type(){throw new Ze}get name(){throw new Ze}get ianaName(){return this.name}get isUniversal(){throw new Ze}offsetName(e,r){throw new Ze}formatOffset(e,r){throw new Ze}offset(e){throw new Ze}equals(e){throw new Ze}get isValid(){throw new Ze}},Ni=null,Zr=class t extends Ct{static get instance(){return Ni===null&&(Ni=new t),Ni}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:i}){return Qa(e,r,i)}formatOffset(e,r){return cr(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},ki=new Map;function Uo(t){let e=ki.get(t);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),ki.set(t,e)),e}var Go={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Yo(t,e){let r=t.format(e).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,n,a,s,o,l,u,c]=i;return[s,n,a,o,l,u,c]}function Qo(t,e){let r=t.formatToParts(e),i=[];for(let n=0;n<r.length;n++){let{type:a,value:s}=r[n],o=Go[a];a==="era"?i[o]=s:V(o)||(i[o]=parseInt(s,10))}return i}var Ti=new Map,ot=class t extends Ct{static create(e){let r=Ti.get(e);return r===void 0&&Ti.set(e,r=new t(e)),r}static resetCache(){Ti.clear(),ki.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:i}){return Qa(e,r,i,this.name)}formatOffset(e,r){return cr(this.offset(e),r)}offset(e){if(!this.valid)return NaN;let r=new Date(e);if(isNaN(r))return NaN;let i=Uo(this.name),[n,a,s,o,l,u,c]=i.formatToParts?Qo(i,r):Yo(i,r);o==="BC"&&(n=-Math.abs(n)+1);let f=Yr({year:n,month:a,day:s,hour:l===24?0:l,minute:u,second:c,millisecond:0}),m=+r,h=m%1e3;return m-=h>=0?h:1e3+h,(f-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},zn={};function Ko(t,e={}){let r=JSON.stringify([t,e]),i=zn[r];return i||(i=new Intl.ListFormat(t,e),zn[r]=i),i}var Vi=new Map;function $i(t,e={}){let r=JSON.stringify([t,e]),i=Vi.get(r);return i===void 0&&(i=new Intl.DateTimeFormat(t,e),Vi.set(r,i)),i}var Ri=new Map;function Jo(t,e={}){let r=JSON.stringify([t,e]),i=Ri.get(r);return i===void 0&&(i=new Intl.NumberFormat(t,e),Ri.set(r,i)),i}var Wi=new Map;function Xo(t,e={}){let{base:r,...i}=e,n=JSON.stringify([t,i]),a=Wi.get(n);return a===void 0&&(a=new Intl.RelativeTimeFormat(t,e),Wi.set(n,a)),a}var or=null;function el(){return or||(or=new Intl.DateTimeFormat().resolvedOptions().locale,or)}var ji=new Map;function Ra(t){let e=ji.get(t);return e===void 0&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),ji.set(t,e)),e}var Zi=new Map;function tl(t){let e=Zi.get(t);if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,"minimalDays"in e||(e={...Wa,...e}),Zi.set(t,e)}return e}function rl(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let i,n;try{i=$i(t).resolvedOptions(),n=t}catch{let l=t.substring(0,r);i=$i(l).resolvedOptions(),n=l}let{numberingSystem:a,calendar:s}=i;return[n,a,s]}}function il(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function nl(t){let e=[];for(let r=1;r<=12;r++){let i=z.utc(2009,r,1);e.push(t(i))}return e}function al(t){let e=[];for(let r=1;r<=7;r++){let i=z.utc(2016,11,13+r);e.push(t(i))}return e}function qr(t,e,r,i){let n=t.listingMode();return n==="error"?null:n==="en"?r(e):i(e)}function sl(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||Ra(t.locale).numberingSystem==="latn"}var _i=class{constructor(e,r,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;let{padTo:n,floor:a,...s}=i;if(!r||Object.keys(s).length>0){let o={useGrouping:!1,...i};i.padTo>0&&(o.minimumIntegerDigits=i.padTo),this.inf=Jo(e,o)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):rn(e,3);return ne(r,this.padTo)}}},zi=class{constructor(e,r,i){this.opts=i,this.originalZone=void 0;let n;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),o=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&ot.create(o).valid?(n=o,this.dt=e):(n="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let a={...this.opts};a.timeZone=a.timeZone||n,this.dtf=$i(r,a)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(r=>{if(r.type==="timeZoneName"){let i=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:i}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},Hi=class{constructor(e,r,i){this.opts={style:"long",...i},!r&&Ga()&&(this.rtf=Xo(e,i))}format(e,r){return this.rtf?this.rtf.format(e,r):Ol(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},Wa={firstDay:1,minimalDays:4,weekend:[6,7]},X=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,i,n,a=!1){let s=e||te.defaultLocale,o=s||(a?"en-US":el()),l=r||te.defaultNumberingSystem,u=i||te.defaultOutputCalendar,c=Yi(n)||te.defaultWeekSettings;return new t(o,l,u,c,s)}static resetCache(){or=null,Vi.clear(),Ri.clear(),Wi.clear(),ji.clear(),Zi.clear()}static fromObject({locale:e,numberingSystem:r,outputCalendar:i,weekSettings:n}={}){return t.create(e,r,i,n)}constructor(e,r,i,n,a){let[s,o,l]=rl(e);this.locale=s,this.numberingSystem=r||o||null,this.outputCalendar=i||l||null,this.weekSettings=n,this.intl=il(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=a,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=sl(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Yi(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,r=!1){return qr(this,e,Xa,()=>{let i=this.intl==="ja"||this.intl.startsWith("ja-");r&=!i;let n=r?{month:e,day:"numeric"}:{month:e},a=r?"format":"standalone";if(!this.monthsCache[a][e]){let s=i?o=>this.dtFormatter(o,n).format():o=>this.extract(o,n,"month");this.monthsCache[a][e]=nl(s)}return this.monthsCache[a][e]})}weekdays(e,r=!1){return qr(this,e,rs,()=>{let i=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=r?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=al(a=>this.extract(a,i,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return qr(this,void 0,()=>is,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[z.utc(2016,11,13,9),z.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return qr(this,e,ns,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[z.utc(-40,1,1),z.utc(2017,1,1)].map(i=>this.extract(i,r,"era"))),this.eraCache[e]})}extract(e,r,i){let n=this.dtFormatter(e,r),a=n.formatToParts(),s=a.find(o=>o.type.toLowerCase()===i);return s?s.value:null}numberFormatter(e={}){return new _i(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new zi(e,this.intl,r)}relFormatter(e={}){return new Hi(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Ko(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||Ra(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ya()?tl(this.locale):Wa}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},Oi=null,Ae=class t extends Ct{static get utcInstance(){return Oi===null&&(Oi=new t(0)),Oi}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(Qr(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${cr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${cr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return cr(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},Ui=class extends Ct{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function nt(t,e){if(V(t)||t===null)return e;if(t instanceof Ct)return t;if(fl(t)){let r=t.toLowerCase();return r==="default"?e:r==="local"||r==="system"?Zr.instance:r==="utc"||r==="gmt"?Ae.utcInstance:Ae.parseSpecifier(r)||ot.create(t)}else return st(t)?Ae.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new Ui(t)}var Ji={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},Hn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},ol=Ji.hanidec.replace(/[\[|\]]/g,"").split("");function ll(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);if(t[r].search(Ji.hanidec)!==-1)e+=ol.indexOf(t[r]);else for(let n in Hn){let[a,s]=Hn[n];i>=a&&i<=s&&(e+=i-a)}}return parseInt(e,10)}else return e}var Gi=new Map;function ul(){Gi.clear()}function De({numberingSystem:t},e=""){let r=t||"latn",i=Gi.get(r);i===void 0&&(i=new Map,Gi.set(r,i));let n=i.get(e);return n===void 0&&(n=new RegExp(`${Ji[r]}${e}`),i.set(e,n)),n}var Un=()=>Date.now(),Gn="system",Yn=null,Qn=null,Kn=null,Jn=60,Xn,ea=null,te=class{static get now(){return Un}static set now(e){Un=e}static set defaultZone(e){Gn=e}static get defaultZone(){return nt(Gn,Zr.instance)}static get defaultLocale(){return Yn}static set defaultLocale(e){Yn=e}static get defaultNumberingSystem(){return Qn}static set defaultNumberingSystem(e){Qn=e}static get defaultOutputCalendar(){return Kn}static set defaultOutputCalendar(e){Kn=e}static get defaultWeekSettings(){return ea}static set defaultWeekSettings(e){ea=Yi(e)}static get twoDigitCutoffYear(){return Jn}static set twoDigitCutoffYear(e){Jn=e%100}static get throwOnInvalid(){return Xn}static set throwOnInvalid(e){Xn=e}static resetCaches(){X.resetCache(),ot.resetCache(),z.resetCache(),ul()}},Te=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},ja=[0,31,59,90,120,151,181,212,243,273,304,334],Za=[0,31,60,91,121,152,182,213,244,274,305,335];function Ie(t,e){return new Te("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Xi(t,e,r){let i=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&i.setUTCFullYear(i.getUTCFullYear()-1900);let n=i.getUTCDay();return n===0?7:n}function _a(t,e,r){return r+(fr(t)?Za:ja)[e-1]}function za(t,e){let r=fr(t)?Za:ja,i=r.findIndex(a=>a<e),n=e-r[i];return{month:i+1,day:n}}function en(t,e){return(t-e+7)%7+1}function _r(t,e=4,r=1){let{year:i,month:n,day:a}=t,s=_a(i,n,a),o=en(Xi(i,n,a),r),l=Math.floor((s-o+14-e)/7),u;return l<1?(u=i-1,l=dr(u,e,r)):l>dr(i,e,r)?(u=i+1,l=1):u=i,{weekYear:u,weekNumber:l,weekday:o,...Kr(t)}}function ta(t,e=4,r=1){let{weekYear:i,weekNumber:n,weekday:a}=t,s=en(Xi(i,1,e),r),o=Rt(i),l=n*7+a-s-7+e,u;l<1?(u=i-1,l+=Rt(u)):l>o?(u=i+1,l-=Rt(i)):u=i;let{month:c,day:d}=za(u,l);return{year:u,month:c,day:d,...Kr(t)}}function Bi(t){let{year:e,month:r,day:i}=t,n=_a(e,r,i);return{year:e,ordinal:n,...Kr(t)}}function ra(t){let{year:e,ordinal:r}=t,{month:i,day:n}=za(e,r);return{year:e,month:i,day:n,...Kr(t)}}function ia(t,e){if(!V(t.localWeekday)||!V(t.localWeekNumber)||!V(t.localWeekYear)){if(!V(t.weekday)||!V(t.weekNumber)||!V(t.weekYear))throw new at("Cannot mix locale-based week fields with ISO-based week fields");return V(t.localWeekday)||(t.weekday=t.localWeekday),V(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),V(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function cl(t,e=4,r=1){let i=Gr(t.weekYear),n=Ee(t.weekNumber,1,dr(t.weekYear,e,r)),a=Ee(t.weekday,1,7);return i?n?a?!1:Ie("weekday",t.weekday):Ie("week",t.weekNumber):Ie("weekYear",t.weekYear)}function dl(t){let e=Gr(t.year),r=Ee(t.ordinal,1,Rt(t.year));return e?r?!1:Ie("ordinal",t.ordinal):Ie("year",t.year)}function Ha(t){let e=Gr(t.year),r=Ee(t.month,1,12),i=Ee(t.day,1,zr(t.year,t.month));return e?r?i?!1:Ie("day",t.day):Ie("month",t.month):Ie("year",t.year)}function Ua(t){let{hour:e,minute:r,second:i,millisecond:n}=t,a=Ee(e,0,23)||e===24&&r===0&&i===0&&n===0,s=Ee(r,0,59),o=Ee(i,0,59),l=Ee(n,0,999);return a?s?o?l?!1:Ie("millisecond",n):Ie("second",i):Ie("minute",r):Ie("hour",e)}function V(t){return typeof t>"u"}function st(t){return typeof t=="number"}function Gr(t){return typeof t=="number"&&t%1===0}function fl(t){return typeof t=="string"}function ml(t){return Object.prototype.toString.call(t)==="[object Date]"}function Ga(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Ya(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function hl(t){return Array.isArray(t)?t:[t]}function na(t,e,r){if(t.length!==0)return t.reduce((i,n)=>{let a=[e(n),n];return i&&r(i[0],a[0])===i[0]?i:a},null)[1]}function yl(t,e){return e.reduce((r,i)=>(r[i]=t[i],r),{})}function Zt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Yi(t){if(t==null)return null;if(typeof t!="object")throw new le("Week settings must be an object");if(!Ee(t.firstDay,1,7)||!Ee(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Ee(e,1,7)))throw new le("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Ee(t,e,r){return Gr(t)&&t>=e&&t<=r}function gl(t,e){return t-e*Math.floor(t/e)}function ne(t,e=2){let r=t<0,i;return r?i="-"+(""+-t).padStart(e,"0"):i=(""+t).padStart(e,"0"),i}function it(t){if(!(V(t)||t===null||t===""))return parseInt(t,10)}function vt(t){if(!(V(t)||t===null||t===""))return parseFloat(t)}function tn(t){if(!(V(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function rn(t,e,r="round"){let i=10**e;switch(r){case"expand":return t>0?Math.ceil(t*i)/i:Math.floor(t*i)/i;case"trunc":return Math.trunc(t*i)/i;case"round":return Math.round(t*i)/i;case"floor":return Math.floor(t*i)/i;case"ceil":return Math.ceil(t*i)/i;default:throw new RangeError(`Value rounding ${r} is out of range`)}}function fr(t){return t%4===0&&(t%100!==0||t%400===0)}function Rt(t){return fr(t)?366:365}function zr(t,e){let r=gl(e-1,12)+1,i=t+(e-r)/12;return r===2?fr(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Yr(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function aa(t,e,r){return-en(Xi(t,1,e),r)+e-1}function dr(t,e=4,r=1){let i=aa(t,e,r),n=aa(t+1,e,r);return(Rt(t)-i+n)/7}function Qi(t){return t>99?t:t>te.twoDigitCutoffYear?1900+t:2e3+t}function Qa(t,e,r,i=null){let n=new Date(t),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};i&&(a.timeZone=i);let s={timeZoneName:e,...a},o=new Intl.DateTimeFormat(r,s).formatToParts(n).find(l=>l.type.toLowerCase()==="timezonename");return o?o.value:null}function Qr(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let i=parseInt(e,10)||0,n=r<0||Object.is(r,-0)?-i:i;return r*60+n}function Ka(t){let e=Number(t);if(typeof t=="boolean"||t===""||!Number.isFinite(e))throw new le(`Invalid unit value ${t}`);return e}function Hr(t,e){let r={};for(let i in t)if(Zt(t,i)){let n=t[i];if(n==null)continue;r[e(i)]=Ka(n)}return r}function cr(t,e){let r=Math.trunc(Math.abs(t/60)),i=Math.trunc(Math.abs(t%60)),n=t>=0?"+":"-";switch(e){case"short":return`${n}${ne(r,2)}:${ne(i,2)}`;case"narrow":return`${n}${r}${i>0?`:${i}`:""}`;case"techie":return`${n}${ne(r,2)}${ne(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Kr(t){return yl(t,["hour","minute","second","millisecond"])}var pl=["January","February","March","April","May","June","July","August","September","October","November","December"],Ja=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Sl=["J","F","M","A","M","J","J","A","S","O","N","D"];function Xa(t){switch(t){case"narrow":return[...Sl];case"short":return[...Ja];case"long":return[...pl];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var es=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ts=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],bl=["M","T","W","T","F","S","S"];function rs(t){switch(t){case"narrow":return[...bl];case"short":return[...ts];case"long":return[...es];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var is=["AM","PM"],vl=["Before Christ","Anno Domini"],Fl=["BC","AD"],xl=["B","A"];function ns(t){switch(t){case"narrow":return[...xl];case"short":return[...Fl];case"long":return[...vl];default:return null}}function Cl(t){return is[t.hour<12?0:1]}function wl(t,e){return rs(e)[t.weekday-1]}function Nl(t,e){return Xa(e)[t.month-1]}function Tl(t,e){return ns(e)[t.year<0?0:1]}function Ol(t,e,r="always",i=!1){let n={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&a){let d=t==="days";switch(e){case 1:return d?"tomorrow":`next ${n[t][0]}`;case-1:return d?"yesterday":`last ${n[t][0]}`;case 0:return d?"today":`this ${n[t][0]}`}}let s=Object.is(e,-0)||e<0,o=Math.abs(e),l=o===1,u=n[t],c=i?l?u[1]:u[2]||u[1]:l?n[t][0]:t;return s?`${o} ${c} ago`:`in ${o} ${c}`}function sa(t,e){let r="";for(let i of t)i.literal?r+=i.val:r+=e(i.val);return r}var Bl={D:jr,DD:Fa,DDD:xa,DDDD:Ca,t:wa,tt:Na,ttt:Ta,tttt:Oa,T:Ba,TT:Ma,TTT:Ia,TTTT:Ea,f:Aa,ff:qa,fff:Pa,ffff:Va,F:La,FF:Da,FFF:ka,FFFF:$a},Ne=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,i="",n=!1,a=[];for(let s=0;s<e.length;s++){let o=e.charAt(s);o==="'"?((i.length>0||n)&&a.push({literal:n||/^\s+$/.test(i),val:i===""?"'":i}),r=null,i="",n=!n):n||o===r?i+=o:(i.length>0&&a.push({literal:/^\s+$/.test(i),val:i}),i=o,r=o)}return i.length>0&&a.push({literal:n||/^\s+$/.test(i),val:i}),a}static macroTokenToFormatOpts(e){return Bl[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0,i=void 0){if(this.opts.forceSimple)return ne(e,r);let n={...this.opts};return r>0&&(n.padTo=r),i&&(n.signDisplay=i),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let i=this.loc.listingMode()==="en",n=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(m,h)=>this.loc.extract(e,m,h),s=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",o=()=>i?Cl(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(m,h)=>i?Nl(e,m):a(h?{month:m}:{month:m,day:"numeric"},"month"),u=(m,h)=>i?wl(e,m):a(h?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),c=m=>{let h=t.macroTokenToFormatOpts(m);return h?this.formatWithSystemDefault(e,h):m},d=m=>i?Tl(e,m):a({era:m},"era"),f=m=>{switch(m){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return n?a({day:"numeric"},"day"):this.num(e.day);case"dd":return n?a({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return n?a({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?a({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return n?a({month:"numeric"},"month"):this.num(e.month);case"MM":return n?a({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return n?a({year:"numeric"},"year"):this.num(e.year);case"yy":return n?a({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?a({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?a({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(m)}};return sa(t.parseFormat(r),f)}formatDurationFromString(e,r){let i=this.opts.signMode==="negativeLargestOnly"?-1:1,n=c=>{switch(c[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},a=(c,d)=>f=>{let m=n(f);if(m){let h=d.isNegativeDuration&&m!==d.largestUnit?i:1,g;return this.opts.signMode==="negativeLargestOnly"&&m!==d.largestUnit?g="never":this.opts.signMode==="all"?g="always":g="auto",this.num(c.get(m)*h,f.length,g)}else return f},s=t.parseFormat(r),o=s.reduce((c,{literal:d,val:f})=>d?c:c.concat(f),[]),l=e.shiftTo(...o.map(n).filter(c=>c)),u={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return sa(s,a(l,u))}},as=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function _t(...t){let e=t.reduce((r,i)=>r+i.source,"");return RegExp(`^${e}$`)}function zt(...t){return e=>t.reduce(([r,i,n],a)=>{let[s,o,l]=a(e,n);return[{...r,...s},o||i,l]},[{},null,1]).slice(0,2)}function Ht(t,...e){if(t==null)return[null,null];for(let[r,i]of e){let n=r.exec(t);if(n)return i(n)}return[null,null]}function ss(...t){return(e,r)=>{let i={},n;for(n=0;n<t.length;n++)i[t[n]]=it(e[r+n]);return[i,null,r+n]}}var os=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Ml=`(?:${os.source}?(?:\\[(${as.source})\\])?)?`,nn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ls=RegExp(`${nn.source}${Ml}`),an=RegExp(`(?:[Tt]${ls.source})?`),Il=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,El=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Al=/(\d{4})-?(\d{3})/,Ll=ss("weekYear","weekNumber","weekDay"),ql=ss("year","ordinal"),Dl=/(\d{4})-(\d\d)-(\d\d)/,us=RegExp(`${nn.source} ?(?:${os.source}|(${as.source}))?`),Pl=RegExp(`(?: ${us.source})?`);function Wt(t,e,r){let i=t[e];return V(i)?r:it(i)}function kl(t,e){return[{year:Wt(t,e),month:Wt(t,e+1,1),day:Wt(t,e+2,1)},null,e+3]}function Ut(t,e){return[{hours:Wt(t,e,0),minutes:Wt(t,e+1,0),seconds:Wt(t,e+2,0),milliseconds:tn(t[e+3])},null,e+4]}function mr(t,e){let r=!t[e]&&!t[e+1],i=Qr(t[e+1],t[e+2]),n=r?null:Ae.instance(i);return[{},n,e+3]}function hr(t,e){let r=t[e]?ot.create(t[e]):null;return[{},r,e+1]}var Vl=RegExp(`^T?${nn.source}$`),$l=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Rl(t){let[e,r,i,n,a,s,o,l,u]=t,c=e[0]==="-",d=l&&l[0]==="-",f=(m,h=!1)=>m!==void 0&&(h||m&&c)?-m:m;return[{years:f(vt(r)),months:f(vt(i)),weeks:f(vt(n)),days:f(vt(a)),hours:f(vt(s)),minutes:f(vt(o)),seconds:f(vt(l),l==="-0"),milliseconds:f(tn(u),d)}]}var Wl={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function sn(t,e,r,i,n,a,s){let o={year:e.length===2?Qi(it(e)):it(e),month:Ja.indexOf(r)+1,day:it(i),hour:it(n),minute:it(a)};return s&&(o.second=it(s)),t&&(o.weekday=t.length>3?es.indexOf(t)+1:ts.indexOf(t)+1),o}var jl=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Zl(t){let[,e,r,i,n,a,s,o,l,u,c,d]=t,f=sn(e,n,i,r,a,s,o),m;return l?m=Wl[l]:u?m=0:m=Qr(c,d),[f,new Ae(m)]}function _l(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var zl=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Hl=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ul=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function oa(t){let[,e,r,i,n,a,s,o]=t;return[sn(e,n,i,r,a,s,o),Ae.utcInstance]}function Gl(t){let[,e,r,i,n,a,s,o]=t;return[sn(e,o,r,i,n,a,s),Ae.utcInstance]}var Yl=_t(Il,an),Ql=_t(El,an),Kl=_t(Al,an),Jl=_t(ls),cs=zt(kl,Ut,mr,hr),Xl=zt(Ll,Ut,mr,hr),eu=zt(ql,Ut,mr,hr),tu=zt(Ut,mr,hr);function ru(t){return Ht(t,[Yl,cs],[Ql,Xl],[Kl,eu],[Jl,tu])}function iu(t){return Ht(_l(t),[jl,Zl])}function nu(t){return Ht(t,[zl,oa],[Hl,oa],[Ul,Gl])}function au(t){return Ht(t,[$l,Rl])}var su=zt(Ut);function ou(t){return Ht(t,[Vl,su])}var lu=_t(Dl,Pl),uu=_t(us),cu=zt(Ut,mr,hr);function du(t){return Ht(t,[lu,cs],[uu,cu])}var la="Invalid Duration",ds={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},fu={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ds},Me=146097/400,Pt=146097/4800,mu={years:{quarters:4,months:12,weeks:Me/7,days:Me,hours:Me*24,minutes:Me*24*60,seconds:Me*24*60*60,milliseconds:Me*24*60*60*1e3},quarters:{months:3,weeks:Me/28,days:Me/4,hours:Me*24/4,minutes:Me*24*60/4,seconds:Me*24*60*60/4,milliseconds:Me*24*60*60*1e3/4},months:{weeks:Pt/7,days:Pt,hours:Pt*24,minutes:Pt*24*60,seconds:Pt*24*60*60,milliseconds:Pt*24*60*60*1e3},...ds},xt=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],hu=xt.slice(0).reverse();function Ye(t,e,r=!1){let i={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new ue(i)}function fs(t,e){let r=e.milliseconds??0;for(let i of hu.slice(1))e[i]&&(r+=e[i]*t[i].milliseconds);return r}function ua(t,e){let r=fs(t,e)<0?-1:1;xt.reduceRight((i,n)=>{if(V(e[n]))return i;if(i){let a=e[i]*r,s=t[n][i],o=Math.floor(a/s);e[n]+=o*r,e[i]-=o*s*r}return n},null),xt.reduce((i,n)=>{if(V(e[n]))return i;if(i){let a=e[i]%1;e[i]-=a,e[n]+=a*t[i][n]}return n},null)}function ca(t){let e={};for(let[r,i]of Object.entries(t))i!==0&&(e[r]=i);return e}var ue=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,i=r?mu:fu;e.matrix&&(i=e.matrix),this.values=e.values,this.loc=e.loc||X.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=i,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new le(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:Hr(e,t.normalizeUnit),loc:X.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(st(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new le(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[i]=au(e);return i?t.fromObject(i,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[i]=ou(e);return i?t.fromObject(i,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new le("need to specify a reason the Duration is invalid");let i=e instanceof Te?e:new Te(e,r);if(te.throwOnInvalid)throw new Pi(i);return new t({invalid:i})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new Wr(e);return r}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,r={}){let i={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?Ne.create(this.loc,i).formatDurationFromString(this,e):la}toHuman(e={}){if(!this.isValid)return la;let r=e.showZeros!==!1,i=xt.map(n=>{let a=this.values[n];return V(a)||a===0&&!r?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(a)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(i)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=rn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},z.fromMillis(r,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?fs(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),i={};for(let n of xt)(Zt(r.values,n)||Zt(this.values,n))&&(i[n]=r.get(n)+this.get(n));return Ye(this,{values:i},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let i of Object.keys(this.values))r[i]=Ka(e(this.values[i],i));return Ye(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Hr(e,t.normalizeUnit)};return Ye(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:i,matrix:n}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:n,conversionAccuracy:i};return Ye(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return ua(this.matrix,e),Ye(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=ca(this.normalize().shiftToAll().toObject());return Ye(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>t.normalizeUnit(s));let r={},i={},n=this.toObject(),a;for(let s of xt)if(e.indexOf(s)>=0){a=s;let o=0;for(let u in i)o+=this.matrix[u][s]*i[u],i[u]=0;st(n[s])&&(o+=n[s]);let l=Math.trunc(o);r[s]=l,i[s]=(o*1e3-l*1e3)/1e3}else st(n[s])&&(i[s]=n[s]);for(let s in i)i[s]!==0&&(r[a]+=s===a?i[s]:i[s]/this.matrix[a][s]);return ua(this.matrix,r),Ye(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return Ye(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=ca(this.values);return Ye(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function r(i,n){return i===void 0||i===0?n===void 0||n===0:i===n}for(let i of xt)if(!r(this.values[i],e.values[i]))return!1;return!0}},kt="Invalid Interval";function yu(t,e){return!t||!t.isValid?jt.invalid("missing or invalid start"):!e||!e.isValid?jt.invalid("missing or invalid end"):e<t?jt.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var jt=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new le("need to specify a reason the Interval is invalid");let i=e instanceof Te?e:new Te(e,r);if(te.throwOnInvalid)throw new Di(i);return new t({invalid:i})}static fromDateTimes(e,r){let i=sr(e),n=sr(r),a=yu(i,n);return a??new t({start:i,end:n})}static after(e,r){let i=ue.fromDurationLike(r),n=sr(e);return t.fromDateTimes(n,n.plus(i))}static before(e,r){let i=ue.fromDurationLike(r),n=sr(e);return t.fromDateTimes(n.minus(i),n)}static fromISO(e,r){let[i,n]=(e||"").split("/",2);if(i&&n){let a,s;try{a=z.fromISO(i,r),s=a.isValid}catch{s=!1}let o,l;try{o=z.fromISO(n,r),l=o.isValid}catch{l=!1}if(s&&l)return t.fromDateTimes(a,o);if(s){let u=ue.fromISO(n,r);if(u.isValid)return t.after(a,u)}else if(l){let u=ue.fromISO(i,r);if(u.isValid)return t.before(o,u)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",r){if(!this.isValid)return NaN;let i=this.start.startOf(e,r),n;return r?.useLocaleWeeks?n=this.end.reconfigure({locale:i.locale}):n=this.end,n=n.startOf(e,r),Math.floor(n.diff(i,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(sr).filter(s=>this.contains(s)).sort((s,o)=>s.toMillis()-o.toMillis()),i=[],{s:n}=this,a=0;for(;n<this.e;){let s=r[a]||this.e,o=+s>+this.e?this.e:s;i.push(t.fromDateTimes(n,o)),n=o,a+=1}return i}splitBy(e){let r=ue.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:i}=this,n=1,a,s=[];for(;i<this.e;){let o=this.start.plus(r.mapUnits(l=>l*n));a=+o>+this.e?this.e:o,s.push(t.fromDateTimes(i,a)),i=a,n+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,i=this.e<e.e?this.e:e.e;return r>=i?null:t.fromDateTimes(r,i)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,i=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,i)}static merge(e){let[r,i]=e.sort((n,a)=>n.s-a.s).reduce(([n,a],s)=>a?a.overlaps(s)||a.abutsStart(s)?[n,a.union(s)]:[n.concat([a]),s]:[n,s],[[],null]);return i&&r.push(i),r}static xor(e){let r=null,i=0,n=[],a=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),s=Array.prototype.concat(...a),o=s.sort((l,u)=>l.time-u.time);for(let l of o)i+=l.type==="s"?1:-1,i===1?r=l.time:(r&&+r!=+l.time&&n.push(t.fromDateTimes(r,l.time)),r=null);return t.merge(n)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:kt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=jr,r={}){return this.isValid?Ne.create(this.s.loc.clone(r),e).formatInterval(this):kt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:kt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:kt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:kt}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:kt}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):ue.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}},$t=class{static hasDST(e=te.defaultZone){let r=z.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return ot.isValidZone(e)}static normalizeZone(e){return nt(e,te.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||X.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||X.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||X.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:i=null,locObj:n=null,outputCalendar:a="gregory"}={}){return(n||X.create(r,i,a)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:i=null,locObj:n=null,outputCalendar:a="gregory"}={}){return(n||X.create(r,i,a)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:i=null,locObj:n=null}={}){return(n||X.create(r,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:i=null,locObj:n=null}={}){return(n||X.create(r,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return X.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return X.create(r,null,"gregory").eras(e)}static features(){return{relative:Ga(),localeWeek:Ya()}}};function da(t,e){let r=n=>n.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=r(e)-r(t);return Math.floor(ue.fromMillis(i).as("days"))}function gu(t,e,r){let i=[["years",(l,u)=>u.year-l.year],["quarters",(l,u)=>u.quarter-l.quarter+(u.year-l.year)*4],["months",(l,u)=>u.month-l.month+(u.year-l.year)*12],["weeks",(l,u)=>{let c=da(l,u);return(c-c%7)/7}],["days",da]],n={},a=t,s,o;for(let[l,u]of i)r.indexOf(l)>=0&&(s=l,n[l]=u(t,e),o=a.plus(n),o>e?(n[l]--,t=a.plus(n),t>e&&(o=t,n[l]--,t=a.plus(n))):t=o);return[t,n,o,s]}function pu(t,e,r,i){let[n,a,s,o]=gu(t,e,r),l=e-n,u=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);u.length===0&&(s<e&&(s=n.plus({[o]:1})),s!==n&&(a[o]=(a[o]||0)+l/(s-n)));let c=ue.fromObject(a,i);return u.length>0?ue.fromMillis(l,i).shiftTo(...u).plus(c):c}var Su="missing Intl.DateTimeFormat.formatToParts support";function K(t,e=r=>r){return{regex:t,deser:([r])=>e(ll(r))}}var bu="\xA0",ms=`[ ${bu}]`,hs=new RegExp(ms,"g");function vu(t){return t.replace(/\./g,"\\.?").replace(hs,ms)}function fa(t){return t.replace(/\./g,"").replace(hs," ").toLowerCase()}function Pe(t,e){return t===null?null:{regex:RegExp(t.map(vu).join("|")),deser:([r])=>t.findIndex(i=>fa(r)===fa(i))+e}}function ma(t,e){return{regex:t,deser:([,r,i])=>Qr(r,i),groups:e}}function Dr(t){return{regex:t,deser:([e])=>e}}function Fu(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function xu(t,e){let r=De(e),i=De(e,"{2}"),n=De(e,"{3}"),a=De(e,"{4}"),s=De(e,"{6}"),o=De(e,"{1,2}"),l=De(e,"{1,3}"),u=De(e,"{1,6}"),c=De(e,"{1,9}"),d=De(e,"{2,4}"),f=De(e,"{4,6}"),m=y=>({regex:RegExp(Fu(y.val)),deser:([p])=>p,literal:!0}),g=(y=>{if(t.literal)return m(y);switch(y.val){case"G":return Pe(e.eras("short"),0);case"GG":return Pe(e.eras("long"),0);case"y":return K(u);case"yy":return K(d,Qi);case"yyyy":return K(a);case"yyyyy":return K(f);case"yyyyyy":return K(s);case"M":return K(o);case"MM":return K(i);case"MMM":return Pe(e.months("short",!0),1);case"MMMM":return Pe(e.months("long",!0),1);case"L":return K(o);case"LL":return K(i);case"LLL":return Pe(e.months("short",!1),1);case"LLLL":return Pe(e.months("long",!1),1);case"d":return K(o);case"dd":return K(i);case"o":return K(l);case"ooo":return K(n);case"HH":return K(i);case"H":return K(o);case"hh":return K(i);case"h":return K(o);case"mm":return K(i);case"m":return K(o);case"q":return K(o);case"qq":return K(i);case"s":return K(o);case"ss":return K(i);case"S":return K(l);case"SSS":return K(n);case"u":return Dr(c);case"uu":return Dr(o);case"uuu":return K(r);case"a":return Pe(e.meridiems(),0);case"kkkk":return K(a);case"kk":return K(d,Qi);case"W":return K(o);case"WW":return K(i);case"E":case"c":return K(r);case"EEE":return Pe(e.weekdays("short",!1),1);case"EEEE":return Pe(e.weekdays("long",!1),1);case"ccc":return Pe(e.weekdays("short",!0),1);case"cccc":return Pe(e.weekdays("long",!0),1);case"Z":case"ZZ":return ma(new RegExp(`([+-]${o.source})(?::(${i.source}))?`),2);case"ZZZ":return ma(new RegExp(`([+-]${o.source})(${i.source})?`),2);case"z":return Dr(/[a-z_+-/]{1,256}?/i);case" ":return Dr(/[^\S\n\r]/);default:return m(y)}})(t)||{invalidReason:Su};return g.token=t,g}var Cu={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function wu(t,e,r){let{type:i,value:n}=t;if(i==="literal"){let l=/^\s+$/.test(n);return{literal:!l,val:l?" ":n}}let a=e[i],s=i;i==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=r.hour12?"hour12":"hour24");let o=Cu[s];if(typeof o=="object"&&(o=o[a]),o)return{literal:!1,val:o}}function Nu(t){return[`^${t.map(r=>r.regex).reduce((r,i)=>`${r}(${i.source})`,"")}$`,t]}function Tu(t,e,r){let i=t.match(e);if(i){let n={},a=1;for(let s in r)if(Zt(r,s)){let o=r[s],l=o.groups?o.groups+1:1;!o.literal&&o.token&&(n[o.token.val[0]]=o.deser(i.slice(a,a+l))),a+=l}return[i,n]}else return[i,{}]}function Ou(t){let e=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,i;return V(t.z)||(r=ot.create(t.z)),V(t.Z)||(r||(r=new Ae(t.Z)),i=t.Z),V(t.q)||(t.M=(t.q-1)*3+1),V(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),V(t.u)||(t.S=tn(t.u)),[Object.keys(t).reduce((a,s)=>{let o=e(s);return o&&(a[o]=t[s]),a},{}),r,i]}var Mi=null;function Bu(){return Mi||(Mi=z.fromMillis(1555555555555)),Mi}function Mu(t,e){if(t.literal)return t;let r=Ne.macroTokenToFormatOpts(t.val),i=ps(r,e);return i==null||i.includes(void 0)?t:i}function ys(t,e){return Array.prototype.concat(...t.map(r=>Mu(r,e)))}var Ur=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=ys(Ne.parseFormat(r),e),this.units=this.tokens.map(i=>xu(i,e)),this.disqualifyingUnit=this.units.find(i=>i.invalidReason),!this.disqualifyingUnit){let[i,n]=Nu(this.units);this.regex=RegExp(i,"i"),this.handlers=n}}explainFromTokens(e){if(this.isValid){let[r,i]=Tu(e,this.regex,this.handlers),[n,a,s]=i?Ou(i):[null,null,void 0];if(Zt(i,"a")&&Zt(i,"H"))throw new at("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:r,matches:i,result:n,zone:a,specificOffset:s}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function gs(t,e,r){return new Ur(t,r).explainFromTokens(e)}function Iu(t,e,r){let{result:i,zone:n,specificOffset:a,invalidReason:s}=gs(t,e,r);return[i,n,a,s]}function ps(t,e){if(!t)return null;let i=Ne.create(e,t).dtFormatter(Bu()),n=i.formatToParts(),a=i.resolvedOptions();return n.map(s=>wu(s,t,a))}var Ii="Invalid DateTime",ha=864e13;function lr(t){return new Te("unsupported zone",`the zone "${t.name}" is not supported`)}function Ei(t){return t.weekData===null&&(t.weekData=_r(t.c)),t.weekData}function Ai(t){return t.localWeekData===null&&(t.localWeekData=_r(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Ft(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new z({...r,...e,old:r})}function Ss(t,e,r){let i=t-e*60*1e3,n=r.offset(i);if(e===n)return[i,e];i-=(n-e)*60*1e3;let a=r.offset(i);return n===a?[i,n]:[t-Math.min(n,a)*60*1e3,Math.max(n,a)]}function Pr(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function Vr(t,e,r){return Ss(Yr(t),e,r)}function ya(t,e){let r=t.o,i=t.c.year+Math.trunc(e.years),n=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,a={...t.c,year:i,month:n,day:Math.min(t.c.day,zr(i,n))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=ue.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Yr(a),[l,u]=Ss(o,r,t.zone);return s!==0&&(l+=s,u=t.zone.offset(l)),{ts:l,o:u}}function Vt(t,e,r,i,n,a){let{setZone:s,zone:o}=r;if(t&&Object.keys(t).length!==0||e){let l=e||o,u=z.fromObject(t,{...r,zone:l,specificOffset:a});return s?u:u.setZone(o)}else return z.invalid(new Te("unparsable",`the input "${n}" can't be parsed as ${i}`))}function kr(t,e,r=!0){return t.isValid?Ne.create(X.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Li(t,e,r){let i=t.c.year>9999||t.c.year<0,n="";if(i&&t.c.year>=0&&(n+="+"),n+=ne(t.c.year,i?6:4),r==="year")return n;if(e){if(n+="-",n+=ne(t.c.month),r==="month")return n;n+="-"}else if(n+=ne(t.c.month),r==="month")return n;return n+=ne(t.c.day),n}function ga(t,e,r,i,n,a,s){let o=!r||t.c.millisecond!==0||t.c.second!==0,l="";switch(s){case"day":case"month":case"year":break;default:if(l+=ne(t.c.hour),s==="hour")break;if(e){if(l+=":",l+=ne(t.c.minute),s==="minute")break;o&&(l+=":",l+=ne(t.c.second))}else{if(l+=ne(t.c.minute),s==="minute")break;o&&(l+=ne(t.c.second))}if(s==="second")break;o&&(!i||t.c.millisecond!==0)&&(l+=".",l+=ne(t.c.millisecond,3))}return n&&(t.isOffsetFixed&&t.offset===0&&!a?l+="Z":t.o<0?(l+="-",l+=ne(Math.trunc(-t.o/60)),l+=":",l+=ne(Math.trunc(-t.o%60))):(l+="+",l+=ne(Math.trunc(t.o/60)),l+=":",l+=ne(Math.trunc(t.o%60)))),a&&(l+="["+t.zone.ianaName+"]"),l}var bs={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Eu={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Au={ordinal:1,hour:0,minute:0,second:0,millisecond:0},$r=["year","month","day","hour","minute","second","millisecond"],Lu=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],qu=["year","ordinal","hour","minute","second","millisecond"];function Rr(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new Wr(t);return e}function pa(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Rr(t)}}function Du(t){if(ur===void 0&&(ur=te.now()),t.type!=="iana")return t.offset(ur);let e=t.name,r=Ki.get(e);return r===void 0&&(r=t.offset(ur),Ki.set(e,r)),r}function Sa(t,e){let r=nt(e.zone,te.defaultZone);if(!r.isValid)return z.invalid(lr(r));let i=X.fromObject(e),n,a;if(V(t.year))n=te.now();else{for(let l of $r)V(t[l])&&(t[l]=bs[l]);let s=Ha(t)||Ua(t);if(s)return z.invalid(s);let o=Du(r);[n,a]=Vr(t,o,r)}return new z({ts:n,zone:r,loc:i,o:a})}function ba(t,e,r){let i=V(r.round)?!0:r.round,n=V(r.rounding)?"trunc":r.rounding,a=(o,l)=>(o=rn(o,i||r.calendary?0:2,r.calendary?"round":n),e.loc.clone(r).relFormatter(r).format(o,l)),s=o=>r.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(r.unit)return a(s(r.unit),r.unit);for(let o of r.units){let l=s(o);if(Math.abs(l)>=1)return a(l,o)}return a(t>e?-0:0,r.units[r.units.length-1])}function va(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var ur,Ki=new Map,z=class t{constructor(e){let r=e.zone||te.defaultZone,i=e.invalid||(Number.isNaN(e.ts)?new Te("invalid input"):null)||(r.isValid?null:lr(r));this.ts=V(e.ts)?te.now():e.ts;let n=null,a=null;if(!i)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[n,a]=[e.old.c,e.old.o];else{let o=st(e.o)&&!e.old?e.o:r.offset(this.ts);n=Pr(this.ts,o),i=Number.isNaN(n.year)?new Te("invalid input"):null,n=i?null:n,a=i?null:o}this._zone=r,this.loc=e.loc||X.create(),this.invalid=i,this.weekData=null,this.localWeekData=null,this.c=n,this.o=a,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=va(arguments),[i,n,a,s,o,l,u]=r;return Sa({year:i,month:n,day:a,hour:s,minute:o,second:l,millisecond:u},e)}static utc(){let[e,r]=va(arguments),[i,n,a,s,o,l,u]=r;return e.zone=Ae.utcInstance,Sa({year:i,month:n,day:a,hour:s,minute:o,second:l,millisecond:u},e)}static fromJSDate(e,r={}){let i=ml(e)?e.valueOf():NaN;if(Number.isNaN(i))return t.invalid("invalid input");let n=nt(r.zone,te.defaultZone);return n.isValid?new t({ts:i,zone:n,loc:X.fromObject(r)}):t.invalid(lr(n))}static fromMillis(e,r={}){if(st(e))return e<-ha||e>ha?t.invalid("Timestamp out of range"):new t({ts:e,zone:nt(r.zone,te.defaultZone),loc:X.fromObject(r)});throw new le(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(st(e))return new t({ts:e*1e3,zone:nt(r.zone,te.defaultZone),loc:X.fromObject(r)});throw new le("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let i=nt(r.zone,te.defaultZone);if(!i.isValid)return t.invalid(lr(i));let n=X.fromObject(r),a=Hr(e,pa),{minDaysInFirstWeek:s,startOfWeek:o}=ia(a,n),l=te.now(),u=V(r.specificOffset)?i.offset(l):r.specificOffset,c=!V(a.ordinal),d=!V(a.year),f=!V(a.month)||!V(a.day),m=d||f,h=a.weekYear||a.weekNumber;if((m||c)&&h)throw new at("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new at("Can't mix ordinal dates with month/day");let g=h||a.weekday&&!m,y,p,F=Pr(l,u);g?(y=Lu,p=Eu,F=_r(F,s,o)):c?(y=qu,p=Au,F=Bi(F)):(y=$r,p=bs);let C=!1;for(let M of y){let q=a[M];V(q)?C?a[M]=p[M]:a[M]=F[M]:C=!0}let x=g?cl(a,s,o):c?dl(a):Ha(a),w=x||Ua(a);if(w)return t.invalid(w);let N=g?ta(a,s,o):c?ra(a):a,[O,T]=Vr(N,u,i),B=new t({ts:O,zone:i,o:T,loc:n});return a.weekday&&m&&e.weekday!==B.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${B.toISO()}`):B.isValid?B:t.invalid(B.invalid)}static fromISO(e,r={}){let[i,n]=ru(e);return Vt(i,n,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[i,n]=iu(e);return Vt(i,n,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[i,n]=nu(e);return Vt(i,n,r,"HTTP",r)}static fromFormat(e,r,i={}){if(V(e)||V(r))throw new le("fromFormat requires an input string and a format");let{locale:n=null,numberingSystem:a=null}=i,s=X.fromOpts({locale:n,numberingSystem:a,defaultToEN:!0}),[o,l,u,c]=Iu(s,e,r);return c?t.invalid(c):Vt(o,l,i,`format ${r}`,e,u)}static fromString(e,r,i={}){return t.fromFormat(e,r,i)}static fromSQL(e,r={}){let[i,n]=du(e);return Vt(i,n,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new le("need to specify a reason the DateTime is invalid");let i=e instanceof Te?e:new Te(e,r);if(te.throwOnInvalid)throw new qi(i);return new t({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let i=ps(e,X.fromObject(r));return i?i.map(n=>n?n.val:null).join(""):null}static expandFormat(e,r={}){return ys(Ne.parseFormat(e),X.fromObject(r)).map(n=>n.val).join("")}static resetCache(){ur=void 0,Ki.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Ei(this).weekYear:NaN}get weekNumber(){return this.isValid?Ei(this).weekNumber:NaN}get weekday(){return this.isValid?Ei(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Ai(this).weekday:NaN}get localWeekNumber(){return this.isValid?Ai(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Ai(this).weekYear:NaN}get ordinal(){return this.isValid?Bi(this.c).ordinal:NaN}get monthShort(){return this.isValid?$t.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?$t.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?$t.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?$t.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,r=6e4,i=Yr(this.c),n=this.zone.offset(i-e),a=this.zone.offset(i+e),s=this.zone.offset(i-n*r),o=this.zone.offset(i-a*r);if(s===o)return[this];let l=i-s*r,u=i-o*r,c=Pr(l,s),d=Pr(u,o);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[Ft(this,{ts:l}),Ft(this,{ts:u})]:[this]}get isInLeapYear(){return fr(this.year)}get daysInMonth(){return zr(this.year,this.month)}get daysInYear(){return this.isValid?Rt(this.year):NaN}get weeksInWeekYear(){return this.isValid?dr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?dr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:i,calendar:n}=Ne.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:i,outputCalendar:n}}toUTC(e=0,r={}){return this.setZone(Ae.instance(e),r)}toLocal(){return this.setZone(te.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:i=!1}={}){if(e=nt(e,te.defaultZone),e.equals(this.zone))return this;if(e.isValid){let n=this.ts;if(r||i){let a=e.offset(this.ts),s=this.toObject();[n]=Vr(s,a,e)}return Ft(this,{ts:n,zone:e})}else return t.invalid(lr(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:i}={}){let n=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:i});return Ft(this,{loc:n})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Hr(e,pa),{minDaysInFirstWeek:i,startOfWeek:n}=ia(r,this.loc),a=!V(r.weekYear)||!V(r.weekNumber)||!V(r.weekday),s=!V(r.ordinal),o=!V(r.year),l=!V(r.month)||!V(r.day),u=o||l,c=r.weekYear||r.weekNumber;if((u||s)&&c)throw new at("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&s)throw new at("Can't mix ordinal dates with month/day");let d;a?d=ta({..._r(this.c,i,n),...r},i,n):V(r.ordinal)?(d={...this.toObject(),...r},V(r.day)&&(d.day=Math.min(zr(d.year,d.month),d.day))):d=ra({...Bi(this.c),...r});let[f,m]=Vr(d,this.o,this.zone);return Ft(this,{ts:f,o:m})}plus(e){if(!this.isValid)return this;let r=ue.fromDurationLike(e);return Ft(this,ya(this,r))}minus(e){if(!this.isValid)return this;let r=ue.fromDurationLike(e).negate();return Ft(this,ya(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let i={},n=ue.normalizeUnit(e);switch(n){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(n==="weeks")if(r){let a=this.loc.getStartOfWeek(),{weekday:s}=this;s<a&&(i.weekNumber=this.weekNumber-1),i.weekday=a}else i.weekday=1;if(n==="quarters"){let a=Math.ceil(this.month/3);i.month=(a-1)*3+1}return this.set(i)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?Ne.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):Ii}toLocaleString(e=jr,r={}){return this.isValid?Ne.create(this.loc.clone(r),e).formatDateTime(this):Ii}toLocaleParts(e={}){return this.isValid?Ne.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:i=!1,includeOffset:n=!0,extendedZone:a=!1,precision:s="milliseconds"}={}){if(!this.isValid)return null;s=Rr(s);let o=e==="extended",l=Li(this,o,s);return $r.indexOf(s)>=3&&(l+="T"),l+=ga(this,o,r,i,n,a,s),l}toISODate({format:e="extended",precision:r="day"}={}){return this.isValid?Li(this,e==="extended",Rr(r)):null}toISOWeekDate(){return kr(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:i=!0,includePrefix:n=!1,extendedZone:a=!1,format:s="extended",precision:o="milliseconds"}={}){return this.isValid?(o=Rr(o),(n&&$r.indexOf(o)>=3?"T":"")+ga(this,s==="extended",r,e,i,a,o)):null}toRFC2822(){return kr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return kr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Li(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:i=!0}={}){let n="HH:mm:ss.SSS";return(r||e)&&(i&&(n+=" "),r?n+="z":e&&(n+="ZZ")),kr(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Ii}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",i={}){if(!this.isValid||!e.isValid)return ue.invalid("created by diffing an invalid DateTime");let n={locale:this.locale,numberingSystem:this.numberingSystem,...i},a=hl(r).map(ue.normalizeUnit),s=e.valueOf()>this.valueOf(),o=s?this:e,l=s?e:this,u=pu(o,l,a,n);return s?u.negate():u}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?jt.fromDateTimes(this,e):this}hasSame(e,r,i){if(!this.isValid)return!1;let n=e.valueOf(),a=this.setZone(e.zone,{keepLocalTime:!0});return a.startOf(r,i)<=n&&n<=a.endOf(r,i)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||t.fromObject({},{zone:this.zone}),i=e.padding?this<r?-e.padding:e.padding:0,n=["years","months","days","hours","minutes","seconds"],a=e.unit;return Array.isArray(e.unit)&&(n=e.unit,a=void 0),ba(r,this.plus(i),{...e,numeric:"always",units:n,unit:a})}toRelativeCalendar(e={}){return this.isValid?ba(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new le("min requires all arguments be DateTimes");return na(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new le("max requires all arguments be DateTimes");return na(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,i={}){let{locale:n=null,numberingSystem:a=null}=i,s=X.fromOpts({locale:n,numberingSystem:a,defaultToEN:!0});return gs(s,e,r)}static fromStringExplain(e,r,i={}){return t.fromFormatExplain(e,r,i)}static buildFormatParser(e,r={}){let{locale:i=null,numberingSystem:n=null}=r,a=X.fromOpts({locale:i,numberingSystem:n,defaultToEN:!0});return new Ur(a,e)}static fromFormatParser(e,r,i={}){if(V(e)||V(r))throw new le("fromFormatParser requires an input string and a format parser");let{locale:n=null,numberingSystem:a=null}=i,s=X.fromOpts({locale:n,numberingSystem:a,defaultToEN:!0});if(!s.equals(r.locale))throw new le(`fromFormatParser called with a locale of ${s}, but the format parser was created for ${r.locale}`);let{result:o,zone:l,specificOffset:u,invalidReason:c}=r.explainFromTokens(e);return c?t.invalid(c):Vt(o,l,i,`format ${r.format}`,e,u)}static get DATE_SHORT(){return jr}static get DATE_MED(){return Fa}static get DATE_MED_WITH_WEEKDAY(){return zo}static get DATE_FULL(){return xa}static get DATE_HUGE(){return Ca}static get TIME_SIMPLE(){return wa}static get TIME_WITH_SECONDS(){return Na}static get TIME_WITH_SHORT_OFFSET(){return Ta}static get TIME_WITH_LONG_OFFSET(){return Oa}static get TIME_24_SIMPLE(){return Ba}static get TIME_24_WITH_SECONDS(){return Ma}static get TIME_24_WITH_SHORT_OFFSET(){return Ia}static get TIME_24_WITH_LONG_OFFSET(){return Ea}static get DATETIME_SHORT(){return Aa}static get DATETIME_SHORT_WITH_SECONDS(){return La}static get DATETIME_MED(){return qa}static get DATETIME_MED_WITH_SECONDS(){return Da}static get DATETIME_MED_WITH_WEEKDAY(){return Ho}static get DATETIME_FULL(){return Pa}static get DATETIME_FULL_WITH_SECONDS(){return ka}static get DATETIME_HUGE(){return Va}static get DATETIME_HUGE_WITH_SECONDS(){return $a}};function sr(t){if(z.isDateTime(t))return t;if(t&&t.valueOf&&st(t.valueOf()))return z.fromJSDate(t);if(t&&typeof t=="object")return z.fromObject(t);throw new le(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function vs(t){var e,r,i=t.length;if(i===1)e=0,r=t[0][1];else{for(var n=0,a=0,s=0,o=0,l,u,c,d=0;d<i;d++)l=t[d],u=l[0],c=l[1],n+=u,a+=c,s+=u*u,o+=u*c;e=(i*o-n*a)/(i*s-n*n),r=a/i-e*n/i}return{m:e,b:r}}function Fs(t){return function(e){return t.b+t.m*e}}function xs(t,e){if(t.length<2)return 1;for(var r=0,i=0;i<t.length;i++)r+=t[i][1];for(var n=r/t.length,a=0,s=0;s<t.length;s++)a+=Math.pow(n-t[s][1],2);for(var o=0,l=0;l<t.length;l++)o+=Math.pow(t[l][1]-e(t[l][0]),2);return 1-o/a}var Cs=function(){this.totalCount=0,this.data={}};Cs.prototype.train=function(e,r){this.data[r]||(this.data[r]={});for(var i in e){var n=e[i];this.data[r][i]===void 0&&(this.data[r][i]={}),this.data[r][i][n]===void 0&&(this.data[r][i][n]=0),this.data[r][i][n]++}this.totalCount++};Cs.prototype.score=function(e){var r={},i;for(var n in e){var a=e[n];for(i in this.data)r[i]={},this.data[i][n]?r[i][n+"_"+a]=(this.data[i][n][a]||0)/this.totalCount:r[i][n+"_"+a]=0}var s={};for(i in r){s[i]=0;for(var o in r[i])s[i]+=r[i][o]}return s};var ws=function(){this.weights=[],this.bias=0};ws.prototype.predict=function(e){if(e.length!==this.weights.length)return null;for(var r=0,i=0;i<this.weights.length;i++)r+=this.weights[i]*e[i];return r+=this.bias,r>0?1:0};ws.prototype.train=function(e,r){if(r!==0&&r!==1)return null;e.length!==this.weights.length&&(this.weights=e,this.bias=1);var i=this.predict(e);if(typeof i=="number"&&i!==r){for(var n=r-i,a=0;a<this.weights.length;a++)this.weights[a]+=n*e[a];this.bias+=n}return this};var Wh=607/128,jh=Math.log(Math.sqrt(2*Math.PI));var Zh=Math.sqrt(2*Math.PI);var Pu=Math.sqrt(2*Math.PI);function ku(t){for(var e=t,r=t,i=1;i<15;i++)r*=t*t/(2*i+1),e+=r;return Math.round((.5+e/Pu*Math.exp(-t*t/2))*1e4)/1e4}var Vu=[];for(Jr=0;Jr<=3.09;Jr+=.01)Vu.push(ku(Jr));var Jr;var ce=class extends Error{constructor(e,r,i){super(r),this.name=e,this.details=i}};function ic(t,e){let r=e.errors[t];throw new ce(e.modalHeaders.error,r??e.errors.simpleError)}function $e(t){return t.axes?.[0]?.valueFormat?.type}function Oy(t){return t.intlOptions}function ye(t){return t?.type===S.NumberAxisFormat}function By(t){return ye(t)&&t.intlOptions?.style==="percent"}function Ke(t){return t?.type===S.CategoryAxisFormat}function Nt(t){return t?.type===S.DateAxisFormat}function My(t){let{oldConfig:e,newConfig:r,rotationChanged:i}=t;return i?[!0,!0]:[e.horizontalAxisLabelsBehavior!==r.horizontalAxisLabelsBehavior,e.verticalAxisLabelsBehavior!==r.verticalAxisLabelsBehavior]}function nc(t){return ye(t?.[1]?.valueFormat)&&(t?.[2]?.valueFormat===void 0||ye(t[2].valueFormat))}function ac(t){return ye(t?.[1]?.valueFormat)&&(t?.[2]?.valueFormat===void 0||ye(t[2].valueFormat))}function sc(t){return(Ke(t?.[0]?.valueFormat)||Nt(t?.[0]?.valueFormat))&&ye(t?.[1]?.valueFormat)&&(t?.[2]?.valueFormat===void 0||ye(t[2].valueFormat))}function oc(t){return Ke(t?.[0]?.valueFormat)&&Ke(t?.[1]?.valueFormat)||Nt(t?.[0]?.valueFormat)&&Ke(t?.[1]?.valueFormat)||Nt(t?.[0]?.valueFormat)&&Nt(t?.[1]?.valueFormat)}function lc(t){return(Ke(t?.[0]?.valueFormat)||Nt(t?.[0]?.valueFormat))&&ye(t?.[1]?.valueFormat)}function uc(t){return ye(t?.[0]?.valueFormat)&&ye(t?.[1]?.valueFormat)}function cc(t){return ye(t?.[0]?.valueFormat)&&ye(t?.[1]?.valueFormat)}function dc(t){return ye(t?.[0]?.valueFormat)}function Iy(t){let{chartType:e,axesConfig:r,errorStrings:i}=t,n,a;switch(e){case S.GaugeSeries:n=dc,a="invalidValueFormatForGauge";break;case S.ScatterSeries:n=uc,a="invalidValueFormatForScatterplot";break;case S.HistogramSeries:n=cc,a="invalidValueFormatForHistogram";break;case S.LineSeries:n=nc,a="invalidValueFormatForLineChart";break;case S.BarSeries:n=ac,a="invalidValueFormatForBarChart";break;case S.ComboLineAndBarSeries:n=lc,a="invalidValueFormatForComboBarLineChart";break;case S.BoxPlotSeries:n=sc,a="invalidValueFormatForBoxPlot";break;case S.HeatSeries:n=oc,a="invalidValueFormatForHeatChart";break}n!==void 0&&a!==void 0&&(n(r)||ic(a,i))}function fc(t){let{isXAxis:e,chartType:r,valueFormat:i,isAxisForHistogramOverlaySeries:n}=t;return e&&(Ke(i)||r===S.HistogramSeries&&!n||r===S.BarSeries&&ye(i))}function Tt(t){return Z(t?.series)===S.HeatSeries}function Fe(t){return Z(t?.series)===S.BoxPlotSeries}function mc(t){return t!==void 0&&t!==Br.Solid&&t!==Br.Null}function Ey(t,e){let r="",i=(e??0)/2,n=0-i,a=0+i,s=0-i,o=0+i;switch(t){case pt.Circle:r=`M ${n},0 a ${i},${i} 0 1,0 ${i*2},0 a ${i},${i} 0 1,0 ${-i*2},0`;break;case pt.Cross:r=`M ${n},0 L ${a},0 M 0,${s} L 0,${o} E`;break;case pt.Diamond:r=`M ${n},0 L 0,${s} L ${a},0 L 0,${o} L ${n},0 Z`;break;case pt.Square:r=`M ${n},${o} L ${n},${s} L ${a},${s} L ${a},${o} L ${n},${o} Z`;break;case pt.Triangle:r=`M ${n},${o} L 0,${s} L ${a},${o} L ${n},${o} Z`;break;case pt.X:r=`M ${n},${o} L ${a},${s} M ${n},${s} L ${a},${o} E`;break}return r}var ve="arcgis_charts_pie_from_fields_name",ze="arcgis_charts_pie_from_fields_value",Ay="arcgis_charts_bar_line_from_fields_name",Ly="arcgis_charts_bar_line_from_fields_value",yr={...v,titleAndSubtitlePaddingBottom:5,chartPadding:5,footerContainer:{...v.footerContainer,paddingTop:0,paddingBottom:0},headerContainer:{...v.headerContainer,paddingBottom:18},chartContainer:{...v.chartContainer},dataLabel:{...v.dataLabel,verticalCenter:"bottom"},scrollbarPadding:12,zIndexes:{guide:100,scatterplotTrendLine:2,lineSeries:1,axisLineLayer:30},verticalSurfaceGuideLabels:{wrap:!0},verticalLineGuideLabels:{wrap:!0,rotation:90},horizontalSurfaceGuideLabels:{wrap:!0},horizontalLineGuideLabels:{wrap:!0},overlayId:{scatterplotTrendLine:"arcgis_charts_scatter_plot_trendline",histogramMean:"arcgis_charts_histogram_mean",histogramMedian:"arcgis_charts_histogram_median",histogramStdDev:"arcgis_charts_histogram_std_dev",histogramNormalDistribution:"arcgis_charts_histogram_normal_distribution"},axisLabelSpacing:{verticalAxisLabelSidePadding:8,horizontalAxisLabelPaddingTop:6},legendPadding:20,heatChart:{gradientHeatRules:{minColor:[255,255,200,255],maxColor:[255,0,0,255],outsideRangeLowerColor:[250,250,250,255],outsideRangeUpperColor:[0,0,255,255]},legend:{position:qn.Bottom,chartPadding:40,legendPadding:20,width:70,bottomHeight:20,topHeight:50,titleHeight:10,titlePadding:10,minMaxLabelPadding:3},emptyCells:{symbol:{type:rt.SFS,style:Br.Solid,color:v.grayColor},text:"null"},includeLeapDay:!1},heatChartLabelPadding:{paddingTop:2},pieChartDataLabel:{minWidth:30},focusableThreshold:500,lineJoin:"round"},Mt={LegendItemVisibilityChange:"arcgisChartsJSLegendItemVisibilityChange",RenderingComplete:"arcgisChartsJSRenderingComplete",SeriesColorsChange:"arcgisChartsJSSeriesColorChange",AxesMinMaxChange:"arcgisChartsJSAxesMinMaxChange",SelectionComplete:"arcgisChartsJSSelectionComplete",TooManySelectedElements:"arcgisChartsJSTooManySelectedElements",SeriesOrder:"arcgisChartsJSSeriesOrder"};function It(t){return{detail:t,composed:!0,cancelable:!0,bubbles:!0}}function qy(t,e){e&&e.dispatchEvent(new window.CustomEvent(Mt.LegendItemVisibilityChange,It(t)))}function Dy(t){t&&t.dispatchEvent(new window.CustomEvent(Mt.RenderingComplete,It()))}function Py(t){let{data:e,htmlContainer:r}=t;r&&r.dispatchEvent(new window.CustomEvent(Mt.SelectionComplete,It(e)))}function ky(t){t&&t.dispatchEvent(new window.CustomEvent(Mt.TooManySelectedElements,It()))}function Vy(t){let{data:e,htmlContainer:r,chartId:i,colorMatchApplied:n}=t;r&&r.dispatchEvent(new window.CustomEvent(Mt.SeriesColorsChange,It({chartId:i,data:e,colorMatchApplied:n})))}function $y(t,e){e&&e.dispatchEvent(new window.CustomEvent(Mt.AxesMinMaxChange,It(t)))}function hc(t){let{data:e,htmlContainer:r}=t;r&&e&&r.dispatchEvent(new window.CustomEvent(Mt.SeriesOrder,It(e)))}var P={Min:"min",FirstQuartile:"first_quartile",Median:"median",ThirdQuartile:"third_quartile",Max:"max",IQR:"iqr",Average:"avg",StandardDeviation:"stddev",Outlier:"outlier"};function Ry(t){return t!==void 0&&(!("url"in t)||!t.url)}function ct(t){return t!==void 0&&"view"in t&&"layer"in t&&t.layer.type==="feature"}function Ks(t){return t!==void 0&&"type"in t&&t.type==="feature"}function Js(t){return t!==void 0&&"type"in t&&t.type==="subtype-sublayer"}function yc(t){return Ks(t)||Js(t)}function Be(t){return Js(t)?t.parent??void 0:t}function Xs(t){return t?.capabilities?.query?.supportsDistance||Be(t)?.sourceJSON?.advancedQueryCapabilities?.supportsQueryWithDistance===!0}function gc(t){return t?.capabilities?.queryAttributeBins?.supportsFixedInterval===!0&&t?.capabilities?.queryAttributeBins?.supportsStackBy}function Wy(t){let{chartConfig:e,queryObject:r,options:i}=t,n=Z(e?.series),a=de(e?.series[0]?.query?.where);return!(n===S.HeatSeries||e&&Xe({xAxisValueFormatType:$e(e),setTimeBinningInfoWhenNotProvided:i?.setTimeBinningInfoWhenNotProvided,seriesConfig:e.series[0],queryObject:r})&&Qt(a,r))}function Qt(t,e){return e!==void 0&&(ct(e)||!oe(e)&&"capabilities"in e&&e.capabilities?.queryAttributeBins?.supportsDate===!0&&(he(t)||e.capabilities?.queryAttributeBins?.supportsStackBy))}function pc(t){let e=!1,r=Be(U(t))?.sourceJSON;if(r){let i=r.queryBinsCapabilities?.supportsFixedIntervalBin,n=r.queryBinsCapabilities?.supportedStatisticTypes,a=[A.Maximum,A.Count].every(s=>n?.includes(s.toUpperCase())||n?.includes(s.toLowerCase()));e=i&&a}return e}function jy(t){let e;return ct(t)?e=t.layer:e=t,e}function U(t){let e;return ct(t)?e=t.layer:e=t,e}function Sc(t){let e=!1,r=Be(t)?.sourceJSON?.advancedQueryCapabilities?.supportedSpatialAggregationStatistics??[],i=t?.capabilities?.query.supportedSpatialAggregationStatistics??{};return e=r.includes("EnvelopeAggregate")||"envelope"in i&&i.envelope===!0,e}function Zy(t){let{chartConfig:e,queryObject:r}=t,i;if(r){let n=U(r);Ci(n)?i={id:n.id,layerType:"ArcGISImageServiceLayer"}:wi(n)?i={id:n.id,layerType:"ArcGISTiledImageServiceLayer"}:i={id:n.id,layerType:"ArcGISFeatureLayer"},n.url&&(i.url=n.url)}return{...e,iLayer:i}}var wt=["1.0.0","1.0.1","2.0.0","3.0.0","3.1.0","3.2.0","3.3.0","3.4.0","3.5.0","3.6.0","3.7.0","3.8.0","3.9.0","3.9.1","3.9.2","3.10.0","3.11.0","4.0.0","4.0.1","5.0.0","6.0.0","6.1.0","6.2.0","6.2.1","6.3.0","6.4.0","7.0.0","7.1.0","7.1.1","7.2.0","7.2.1","7.3.1","7.4.0","7.4.1","7.5.0","7.5.1","7.6.0","8.0.0","8.0.1","9.0.0","9.1.0","9.2.0","9.3.0","9.4.0","9.5.0","9.6.0","9.6.1","9.7.0","10.0.0","11.0.0","12.0.0","13.0.0","14.0.0","14.0.1","15.0.0","16.0.0","16.1.0","16.1.1","17.0.0","17.1.0","17.2.0","17.2.1","18.0.0","18.1.0","18.1.1","18.1.2","18.1.3","19.0.0","20.0.0","20.1.0","20.2.0","21.0.0","21.1.0","22.0.0","23.0.0","23.1.0","23.2.0","23.3.0","24.0.0","24.1.0","24.2.0","24.3.0","24.4.0","24.5.0","24.6.0","24.7.0","24.8.0","25.0.0","25.1.0"],bc="1.0.0",vc="unrecognized.version",Fc=[S.LineSeries,S.BarSeries,S.ComboLineAndBarSeries,S.RadarSeries];function on(t,e){let r=0;if(t!==e){let i=t.split("."),n=e.split(".");for(let a=0;a<i.length;a+=1){let s=Number.parseInt(i[a],10),o=Number.parseInt(n[a],10);if(s>o||Number.isNaN(o)){r=1;break}if(s<o){r=-1;break}}}return r}function xc(t){return t!==void 0?/^([1-9]\d*|0)(\.(([1-9]\d*)|0)){2}$/u.test(t):!1}function _y(t){let e=gt.Same,r=[];if(xc(t)&&t!==void 0){wt.sort(on);let i=on(t,wt[wt.length-1]);if(i===1?e=gt.Newer:i===-1&&(e=gt.Older),e===gt.Newer||e===gt.Same)r.push(t);else{for(let n=wt.length-2;n>=0;n-=1)if(on(t,wt[n])>=0){r=wt.slice(n,wt.length);break}r.length===0&&r.push(bc)}}else e=gt.Unrecognized,r.push(vc);return{versionStatus:e,versions:r}}function mt(t){let{series:e}=t,r=("showMean"in t?t.showMean:!1)===!0?e.find(i=>i.type===S.LineSeries):e[0];return r??=e[0],r}function zy(t,e){let r=t!==null?t.toString():null,i=e!=null?e.toString():null;return i!==null&&i!==r?rt.SFS:rt.SLS}function de(t,e){let r="";return t?.includes("=")&&(r=e!==!1?Fi({value:t.split("=")[0],escape:!1}):t.split("=")[0].trim()),r}function xe(t){let{where:e,normalize:r,keepSurroundingQuotes:i,escape:n=!1}=t,a="";return e?.includes("=")&&(a=e.split("=").slice(1).join("=").trim(),a==="null"?a=null:a.trim()!==""&&!Number.isNaN(Number(a))?a=Number(a):r===!1?n&&(a=Er(a)):a=Fi({value:a,keepSurroundingQuotes:i,escape:n})),a}function ut(t){let e=!1;if(t===void 0||t==="")e=!0;else if(t.includes("=")){let r=de(t,!1),i=xe({where:t,normalize:!1});e=r===`${i}`}return e}function Je(t){let{where:e,normalize:r,escape:i}=t,n=r===void 0?!0:r,a=de(e),s=xe({where:e,normalize:n,keepSurroundingQuotes:!0,escape:i}),o=e;return a!==""&&s!==""&&(o=`${a}=${s}`),o}function Cc(t){let e=b.PieFromCategory;return t[0].query?.outStatistics===void 0?e=b.PieNoAggregation:t[0].query?.groupByFieldsForStatistics===void 0&&(e=b.PieFromFields),e}function wc(t){let e=b.BarAndLineMonoField,r=t[0].query?.where;return t[0].query?.groupByFieldsForStatistics===void 0&&(t[0].query?.outStatistics??[]).length>0?e=b.BarAndLineFromFields:r===void 0&&t[0].query?.outStatistics===void 0?e=b.BarAndLineNoAggregation:ut(r)?t.length>1&&(e=b.BarAndLineMultiFields):e=t[0].query?.outStatistics===void 0?b.BarAndLineSplitByNoAggregation:b.BarAndLineSplitBy,e}function Nc(t){let e=b.BoxPlotMonoField,r=t.length===1,i=t.find(o=>o.type===S.LineSeries)??t[0],{x:n}=i,a="y"in i?i.y:"",s=i.query?.where;return n===ir?typeof a=="object"&&a.length>1?ut(s)?r&&(e=b.BoxPlotMultiFields):e=b.BoxPlotMultiFieldsAndSplitBy:r?e=b.BoxPlotMonoField:ut(s)||(e=b.BoxPlotMonoFieldAndSplitBy):r?e=b.BoxPlotMonoFieldAndCategory:ut(s)?e=b.BoxPlotMultiFieldsAndCategory:e=b.BoxPlotMonoFieldAndCategoryAndSplitBy,e}function W(t){let e=b.NonSpecific;if(t?.[0]!==void 0)switch(Z(t)){case S.PieSeries:e=Cc(t);break;case S.RadarSeries:case S.BarSeries:case S.LineSeries:case S.ComboLineAndBarSeries:e=wc(t);break;case S.BoxPlotSeries:e=Nc(t);break}return e}function Xe(t){let{seriesConfig:e,xAxisValueFormatType:r,setTimeBinningInfoWhenNotProvided:i,queryObject:n}=t,a=!1;if(!oe(n)&&U(n)?.fields?.find(s=>s.name===e.x)?.type!=="time-only"&&Ve(e)&&e.binTemporalData!==!1&&r===S.DateAxisFormat){let s=W([e]);if(e.temporalBinning&&s!==b.BarAndLineNoAggregation&&s!==b.BarAndLineSplitByNoAggregation){let{unit:o,size:l}=e.temporalBinning;a=i===!0||l!==void 0&&l>0&&o!==void 0}}return a}function Ve(t){return Fc.includes(t?.type)}function Tc(t){let{previousConfig:e,newConfig:r,behaviorAfterLimit:i}=t,n=e.series,a=r.series,s=!1,o=!1;(i===St.RenderUpToTheLimit||e.orderOptions?.data===void 0||r.orderOptions?.data===void 0)&&(o=!yt(e.orderOptions?.orderByFields,r.orderOptions?.orderByFields));let l=f=>{let m=f.query;return m?.outStatistics?.forEach(h=>{Fn(h)&&!("statisticParameters"in h)&&(h.statisticParameters={value:G.defaultStatParameterValue})}),m},u=["where","outStatistics[0].outStatisticFieldName","outStatistics[0].onStatisticField"],c=yi(n.map(l),u),d=yi(a.map(l),u);return s=!yt(c,d),s||o}function Oc(t,e){return JSON.stringify(t.dataFilters)!==JSON.stringify(e.dataFilters)}function Bc(t,e){let r=!1;if(e.length&&t.length)if(e[0].x!==t[0].x)r=!0;else{let i=Z(t);if(i!==S.HistogramSeries&&i!==S.GaugeSeries){let n=Se(t).sort(),a=Se(e).sort();r=JSON.stringify(n)!==JSON.stringify(a)}}return r}function Mc(t,e){return(t??!1)!==(e??!1)}function Ic(t,e){return Ve(t.series[0])&&Ve(e.series[0])&&(t.series[0].binTemporalData??v.binTemporalData)!==(e.series[0].binTemporalData??v.binTemporalData)}function Ec(t,e){let r=t.axes?.[0].valueFormat.type,i=e.axes?.[0].valueFormat.type,n=W(e.series),a=n===b.BarAndLineNoAggregation||n===b.BarAndLineSplitByNoAggregation,s=r===S.DateAxisFormat&&i===S.NumberAxisFormat,o=r===S.NumberAxisFormat&&i===S.DateAxisFormat;return r!==i&&(a||s||o)}function Ac(t){let{previousSeries:e,newConfig:r,setTimeBinningInfoWhenNotProvided:i,queryObject:n}=t,a=r.series?.[0],s=!1,o=!1;if(a&&Ve(a)&&Xe({seriesConfig:a,xAxisValueFormatType:$e(r),setTimeBinningInfoWhenNotProvided:i,queryObject:n})){let l=e[0];s=JSON.stringify(l.temporalBinning)!==JSON.stringify(a.temporalBinning),o=i===!0&&(a.temporalBinning?.size??0)<=0}return{timeBinningChanged:s,newTimeBinningWillBeCalculated:o}}function Os(t,e){return e.length!==t.length}function Lc(t,e){return Jt(t)!==Jt(e)}function qc(t,e){return JSON.stringify(t.series[0]?.valueConversion)!==JSON.stringify(e.series[0]?.valueConversion)}function Dc(t,e){return JSON.stringify(t.series[0]?.xTemporalBinning)!==JSON.stringify(e.series[0]?.xTemporalBinning)||JSON.stringify(t.series[0]?.yTemporalBinning)!==JSON.stringify(e.series[0]?.yTemporalBinning)||(t.firstDayOfWeek??7)!==(e.firstDayOfWeek??7)||t.outTimeZone!==e.outTimeZone||(t.nullPolicy??we.Null)!==(e.nullPolicy??we.Null)}function Pc(t,e){return(t.hideEmptyRowsAndColumns??!1)!==(e.hideEmptyRowsAndColumns??!1)}function kc(t,e){return(t.includeLeapDay??yr.heatChart.includeLeapDay)!==(e.includeLeapDay??yr.heatChart.includeLeapDay)}function Vc(t){let{previousConfig:e,newConfig:r,fieldList:i}=t,n=e.series[0],a=r.series[0],s=!1;if(n.type===S.ScatterSeries&&a.type===S.ScatterSeries&&i&&i.length>0){let o=new Set(n.additionalTooltipFields||[]),l=new Set(a.additionalTooltipFields||[]);if(!yt(o,l)){let u=Array.from(l).filter(c=>!o.has(c));u.length>0&&(s=i?.some(c=>u.includes(c.name)&&!Sr(c)))}}return s}function Hy(t,e){return(t?.colorMatch??!1)!==(e.colorMatch??!1)}function Uy(t,e){return(t.stackedType??qe.Side)!==(e.stackedType??qe.Side)}function ri(t){let e={...t};return e.position===void 0&&(e.position=yr.heatChart.legend.position),e}function Gy(t,e){let r=t.legend??{type:S.Legend},i=e.legend??{type:S.Legend},n=ri(r),a=ri(i);return!yt(n,a)}function Yy(t,e){let r=t.legend??{type:S.Legend},i=e.legend??{type:S.Legend},n=ri(r),a=ri(i);return n.position!==a.position}function Qy(t,e){return JSON.stringify(t.series[0]?.gradientRules)!==JSON.stringify(e.series[0]?.gradientRules)}function Ky(t,e){return t.series[0].heatRulesType!==e.series[0].heatRulesType}function Jy(t){let{oldConfig:e,newConfig:r}=t,i=!1,n=e?.series[0],a=r.series[0],s=Z(e?.series),o=Z(r.series);if(s===S.PieSeries&&o===S.PieSeries){let{slices:l,sliceGrouping:u}=n,{slices:c,sliceGrouping:d}=a,f=l?.map(y=>({sliceId:y.sliceId,label:y.label})),m=c?.map(y=>({sliceId:y.sliceId,label:y.label})),h=u?.label,g=d?.label;i=JSON.stringify(f)!==JSON.stringify(m)||JSON.stringify(h)!==JSON.stringify(g)}return i}function $c(t){let{previousSelectionOIDs:e,selectionData:r,filterBySelection:i}=t,n=!1;return i===!0&&(n=e?.length!==r?.selectionOIDs?.length||!yt(e,r?.selectionOIDs)),n}function Xy(t,e){return t?.length!==e?.length||t?.some((r,i)=>{let n=xe({where:r?.query?.where}),a=xe({where:e?.[i]?.query?.where});return n!==a})}function eg(t,e){let r=Se(t),i=Se(e);return JSON.stringify(r)!==JSON.stringify(i)}function tg(t,e){let r,i,n,a;return Ve(t.series[0])&&(r=t.series[0].temporalBinning?.unit,n=t.series[0].temporalBinning?.size),Ve(e.series[0])&&(i=e.series[0].temporalBinning?.unit,a=e.series[0].temporalBinning?.size),cn(r,n)&&!cn(i,a)}function rg(t,e){return t.axes?.length===3&&e.axes?.length===2||t.axes?.length===2&&e.axes?.length===3}function ig(t,e){return JSON.stringify(t.series.map(r=>r.assignToSecondValueAxis??!1))!==JSON.stringify(e.series.map(r=>r.assignToSecondValueAxis??!1))}function ng(t,e){let r=t.axes?.map(n=>n?.guides?.map(a=>a?.above===!0)),i=e.axes?.map(n=>n?.guides?.map(a=>a?.above===!0));return JSON.stringify(r)!==JSON.stringify(i)}function ag(t,e){return vi(t)!==vi(e)}function sg(t,e){return(t.showOutliers??v.boxPlot.boxPlotOutliersVisibility)!==(e.showOutliers??v.boxPlot.boxPlotOutliersVisibility)}function og(t,e){return(t.standardizeValues??v.boxPlot.boxPlotStandardizeValuesVisibility)!==(e.standardizeValues??v.boxPlot.boxPlotStandardizeValuesVisibility)}function lg(t,e){return JSON.stringify(t?.chartRenderer)!==JSON.stringify(e?.chartRenderer)}function ug(t,e){let r=t.axes?.[0].valueFormat.type===S.DateAxisFormat?t.axes[0].valueFormat.intlOptions.timeZone:void 0,i=e.axes?.[0].valueFormat.type===S.DateAxisFormat?e.axes[0].valueFormat.intlOptions.timeZone:void 0;return r!==i}function cg(t,e){let r=!1,i=t.series[0],n=e.series[0];if(i.type===S.ScatterSeries&&n.type===S.ScatterSeries){let{sizePolicy:a}=i,{sizePolicy:s}=n;r=JSON.stringify(a)!==JSON.stringify(s)}return r}function dg(t,e){let r=!1,i=t.series[0],n=e.series[0];if(i.type===S.ScatterSeries&&n.type===S.ScatterSeries){let{sizePolicy:a}=i,{sizePolicy:s}=n;r=a===void 0&&s!==void 0||a!==void 0&&s===void 0||a?.field!==s?.field}return r}function fg(t){let{previousConfig:e,newConfig:r,previousFilterBySelection:i,previousSelectionOIDs:n,fieldList:a,queryObject:s,filterBySelection:o,selectionData:l,setTimeBinningInfoWhenNotProvided:u,chartLimits:c}=t,{series:d}=r,{series:f}=e,m=Z(d),h=!1,g=!1,y=!1,p={common:{layerChanged:!1,queryChanged:!1,xOrYChanged:!1,numberOfSeriesChanged:!1,configFiltersChanged:!1,filterBySelectionChanged:!1,dataForFilterBySelectionChanged:!1,binTemporalDataChanged:!1,timeBinningChanged:!1,newTimeBinningWillBeCalculated:!1,valueFormatChangeRequiresNewData:!1},histogram:{dataPropsChanged:!1},gauge:{valueConversionChanged:!1},boxPlot:{showMeanChanged:!1},heatChart:{binningChanged:!1,hideEmptyRowsAndColumnsChanged:!1,includeLeapDay:!1},scatterPlot:{tooltipFieldsChanged:!1}};switch(p.common.queryChanged=Tc({previousConfig:e,newConfig:r,behaviorAfterLimit:c?.behaviorAfterLimit}),p.common.configFiltersChanged=Oc(e,r),p.common.xOrYChanged=Bc(f,d),p.common.filterBySelectionChanged=Mc(i,o),p.common.dataForFilterBySelectionChanged=$c({previousSelectionOIDs:n,selectionData:l,filterBySelection:o}),p.common.binTemporalDataChanged=Ic(e,r),p.common.valueFormatChangeRequiresNewData=Ec(e,r),p.common={...p.common,...Ac({previousSeries:f,newConfig:r,setTimeBinningInfoWhenNotProvided:u,queryObject:s})},m){case S.HistogramSeries:p.histogram.dataPropsChanged=md(f,d)||fd(f,d);break;case S.LineSeries:case S.BarSeries:case S.ComboLineAndBarSeries:p.common.numberOfSeriesChanged=Os(f,d);break;case S.BoxPlotSeries:Fe(e)&&Fe(r)&&(p.common.numberOfSeriesChanged=Os(f,d),p.boxPlot.showMeanChanged=Lc(e,r));break;case S.GaugeSeries:p.gauge.valueConversionChanged=qc(e,r);break;case S.HeatSeries:Tt(e)&&Tt(r)&&(p.heatChart.binningChanged=Dc(e,r),p.heatChart.hideEmptyRowsAndColumnsChanged=Pc(e,r),p.heatChart.includeLeapDay=kc(e,r));break;case S.ScatterSeries:p.scatterPlot.tooltipFieldsChanged=Vc({previousConfig:e,newConfig:r,fieldList:a});break}return g=Object.values(p.common).some(F=>F),(p.gauge.valueConversionChanged||p.histogram.dataPropsChanged||p.boxPlot.showMeanChanged||p.heatChart.binningChanged||p.heatChart.hideEmptyRowsAndColumnsChanged||p.heatChart.includeLeapDay||p.scatterPlot.tooltipFieldsChanged)&&(y=!0),h=g||y,{dataUpdateNeeded:h,dataUpdateDetails:p}}function mg(t,e){let r=tt(t);if(r&&r.series.length>1){let{preferLabel:i,orderBy:n}=r.orderOptions?.series??{};if(n!==void 0){let a;if(i===!1){let s=W(r.series);a=xi(s)?"splitByValue":"name"}else a="name";r.series.sort((s,o)=>{let l,u;a==="splitByValue"?(l=xe({where:s.query?.where})??"",u=xe({where:o.query?.where})??""):(l=s.name,u=o.name);let[c,d]=n.toUpperCase()===be.Descending?[u,l]:[l,u];return typeof c=="string"&&typeof d=="string"?c.localeCompare(d):Number(c)-Number(d)})}}return hc({data:r?.series.map(i=>i.id),htmlContainer:e}),r}function eo(t){let e,r=t?.orderOptions?.data;return t.series?.length>0&&r?.orderType===Ue.MultiAxes&&(e=[],e.push({sortingField:j.xField,orderBy:r.orderByX??be.Ascending}),e.push({sortingField:r.orderByY!==void 0?j.yField:"",orderBy:r.orderByY})),e}function Rc(t){let{chartConfig:e,field:r}=t,i,n=eo(e);return n?.length===2&&(i=r===j.xField?n[0]?.orderBy:n[1]?.orderBy),i}function Wc(t){let e=W(t.series),r;if(t.orderOptions?.data!==void 0){let i=t.orderOptions?.data?.orderType??Ue.Category,n=t.orderOptions?.data&&"orderBy"in t.orderOptions.data?t.orderOptions.data.orderBy:void 0;if(i===Ue.Category)i=t.series[0].x;else{i===Ue.Mean?i=P.Average:i===Ue.Median&&(i=P.Median);let a=e===b.BoxPlotMultiFieldsAndCategory&&typeof t.series[0].y=="string"?t.series[0].y:void 0,s=de(t.series[0].query?.where),o=xe({where:t.series[0].query?.where});i=se({key:i,y:a,chartSubType:e,splitBy:s,splitByValue:o}),Array.isArray(n)&&(n=be.Ascending)}r={sortingField:i,orderBy:n??be.Ascending,preferLabel:t.orderOptions.data&&"preferLabel"in t.orderOptions.data?t.orderOptions.data.preferLabel??!0:!0}}return r}function jc(t){let e=t.series[0],{x:r,y:i}=e,n=W(t.series)===b.PieFromFields,a=W(t.series)===b.BarAndLineFromFields,s,o="",l;if(t.orderOptions?.data!==void 0){let u=t.orderOptions.data&&"preferLabel"in t.orderOptions.data?t.orderOptions.data.preferLabel:!0;if(o=t.orderOptions?.data?.orderType??Ue.Category,l=t.orderOptions?.data&&"orderBy"in t.orderOptions.data?t.orderOptions.data.orderBy:void 0,o===Ue.Category?n?o=ve:o=u?r:yr.originalCategoryValue:o=n?ze:[i].flat()[0],o!==void 0&&o!==""){let c=Ir(t);if(Z(t.series)!==S.PieSeries&&o!==r&&t.series?.length>1)switch(c){case qe.Stacked:o=v.technicalSortingFieldBySum;break;case qe.Stacked100:o=v.technicalSortingFieldByPercent;break;case qe.Side:typeof i=="string"&&(o=i);break}s={sortingField:o,orderBy:l??be.Ascending,preferLabel:u}}}else(a||n)&&t.series[0].query?.outStatistics&&(l=t.series[0].query.outStatistics.map(u=>u.onStatisticField),l?.length>1&&(s={sortingField:yr.originalCategoryValue,orderBy:l,preferLabel:!1}));return s}function ii(t){let e,r=Z(t?.series);if(t?.series&&t.series.length>0){let i;switch(r){case S.HeatSeries:Tt(t)&&(e=eo(t));break;case S.BoxPlotSeries:Fe(t)&&(i=Wc(t));break;case S.LineSeries:case S.BarSeries:case S.RadarSeries:case S.PieSeries:i=jc(t);break}!e&&i&&(e=[],e.push(i))}return e}function hg(t){let{oldConfig:e,newConfig:r,dataWasUpdated:i}=t,n=Z(r.series),a=W(r.series),s=!1,o=!1;if(a!==b.BoxPlotMonoField&&a!==b.BoxPlotMonoFieldAndSplitBy&&r.orderOptions?.data!==void 0){let l=ii(e),u=ii(r);if(n===S.HeatSeries){let c=l?l[0]:void 0,d=u?u[0]:void 0,f=l?l[1]:void 0,m=u?u[1]:void 0;o=e?.orderOptions?.data?.orderType!==r.orderOptions?.data?.orderType||c?.sortingField!==d?.sortingField||c?.orderBy!==d?.orderBy||f?.sortingField!==m?.sortingField||f?.orderBy!==m?.orderBy,s=o||i}else{let c=l?l[0]:void 0,d=u?u[0]:void 0;o=e?.orderOptions?.data?.orderType!==r.orderOptions?.data?.orderType||c?.sortingField!==d?.sortingField||c?.orderBy!==d?.orderBy||(c?.preferLabel??!0)!==(d?.preferLabel??!0),s=o||i}}return s}function Zc(t){let e;return t?.[0]!==void 0&&(e=t.reduce((r,i)=>({...r,xmin:Math.min(r.xmin,i.xmin),xmax:Math.max(r.xmax,i.xmax),ymin:Math.min(r.ymin,i.ymin),ymax:Math.max(r.ymax,i.ymax)}),t[0])),e}function Bs(t){let{value:e,dataContext:r,specificField:i,keepNullValues:n=!1,useRendererLabel:a=!1,config:s}=t,o=e,{originalCategoryValue:l,originalDateValue:u}=v;if(r!==void 0){let c=a?id(r):void 0;i!==void 0&&r[i]!==void 0?o=r[i]:c!==void 0?o=c:r[v.xAxisDisplayField]!==void 0?o=r[v.xAxisDisplayField]:r[v.xAxisField]!==void 0?o=r[v.xAxisField]:r[v.boxPlot.boxPlotCategory]!==void 0?o=r[v.boxPlot.boxPlotCategory]:r[u]!==void 0?o=r[u]:r[l]!==void 0?o=r[l]:r[ve]!==void 0&&(o=r[ve]),!n&&(o===null||o===v.nullValue)&&(s?.series?.[0].type===S.BarSeries||s?.series?.[0].type===S.LineSeries?o=s.series?.[0]?.nullCategory?.text??v.nullCategory?.text??"null":o="null")}return o}function vn(t){let{value:e,dataContext:r}=t,i=e,{originalCategoryValue:n,originalDateValue:a}=v;return r?.[a]!==void 0?i=r[a]:r?.[n]!==void 0?i=r[n]:r?.[ve]!==void 0&&(i=r[ve]),i}function _c(t){return t?.[v.originalCategoryValue]}function gr(t){let{arrayToSort:e,orderBy:r,sortingField:i,forceAscendingOrder:n,isNonAggregated:a,sortByCategory:s,preferLabel:o,isPieOrByFieldsChart:l}=t;if(e!==void 0&&e.length>1){let u=r===be.Descending&&n!==!0;e.sort((c,d)=>{let f=0,m=c[i];s===!0&&!l&&(m=Bs({value:`${c[i]?.toString()}`,dataContext:c,specificField:o?v.xAxisField:void 0}));let h=d[i];return s===!0&&!l&&(h=Bs({value:`${d[i]?.toString()}`,dataContext:d,specificField:o?v.xAxisField:void 0})),a===!0&&u&&s===!0&&(m=Number.isNaN(Number.parseFloat(`${m?.toString()}`))?m:Number.parseFloat(m),h=Number.isNaN(Number.parseFloat(`${h?.toString()}`))?h:Number.parseFloat(h)),s===!0&&(c[v.originalCategoryValue]===null||m===null)||c[Mr.defaultGroupOfSlicesId]===!0?f=1:s===!0&&(d[v.originalCategoryValue]===null||h===null)||d[Mr.defaultGroupOfSlicesId]===!0?f=-1:typeof m=="string"&&typeof h=="string"?(f=m.localeCompare(h,void 0,{numeric:!0}),u&&(f*=-1)):m===void 0?f=u?-1:1:h===void 0?f=u?1:-1:m!==null&&h!==null&&(m>h?f=u?-1:1:m<h&&(f=u?1:-1)),f})}}function zc(t){let{arrayToSort:e,orderBy:r,sortingField:i,fieldList:n,isByFieldsChart:a,preferLabel:s}=t;e!==void 0&&e.length>1&&!he(i)&&r!==void 0&&r.length>0&&e.sort((o,l)=>{let u=o[i];s&&a&&typeof u=="string"&&(u=Ar(n,u));let c=r.indexOf(u?.toString()??"");c===-1&&(c=r.length);let d=l[i];s&&a&&typeof d=="string"&&(d=Ar(n,d));let f=r.indexOf(d?.toString()??"");return f===-1&&(f=r.length),c-f})}function to(t){let{statsMap:e,dataContext:r,chartLimits:i}=t,n=!1;if(e!==void 0){let{maxScatterPointsBeforeAggregation:a}=bt(i),{queryNumberOfFeatures:s}=v.scatterplotAggregationFields;n=(e.get(s)??Number.NaN)>=a}else r!==void 0&&(n=v.scatterplotAggregationFields.dataContextXMinField in r);return n}function Hc(t){let e=!0,r=Z(t.series);if(r===S.BarSeries||r===S.LineSeries||r===S.ComboLineAndBarSeries){let i=W(t.series);e=i!==b.BarAndLineNoAggregation&&i!==b.BarAndLineSplitByNoAggregation}return e}function Uc(t){return W(t.series)!==b.PieNoAggregation}function Gc(t){let{dataContext:e,chartConfig:r,chartLimits:i}=t,n=!0;if(r!==void 0)switch(Z(r.series)){case S.BarSeries:case S.LineSeries:case S.ComboLineAndBarSeries:n=Hc(r);break;case S.ScatterSeries:n=to({dataContext:e,chartLimits:i});break;case S.PieSeries:n=Uc(r);break}return n}function Yc(t,e){let r=t;switch(e){case re.Log:r=`log(${t})`;break;case re.Sqrt:r=`power(CAST(${t} AS FLOAT),0.5)`;break}return r}function Kt(t){let e=new Date(t).valueOf();return Number.isNaN(e)||(e=new Intl.DateTimeFormat("en-US",v.dateFormatUTC).format(t).replace(",","")),e}function ni(t){let{dataToConvert:e,x:r,y:i,fieldList:n}=t,a=[];if(e){let s=e[Ge];Object.entries(e).forEach(([o])=>{if(o!==""&&o!==Ge&&o in e){let l={[r]:Ar(n,o),[i]:e[o],[v.xAxisField]:o,[v.originalCategoryValue]:o};s!==void 0&&(l[Ge]=s),e[`${v.rendererSymbolField}_${o}`]!==void 0&&(l[v.rendererSymbolField]=e[`${v.rendererSymbolField}_${o}`]),a.push(l)}})}return a}function Qc(t,e){let r=!0;if(t!==void 0&&t.length>1&&!he(e)){let i=0,n=0,a=0;t.forEach(s=>{let o=s[e];!jn(o)||o===0?a+=1:o>0?i+=1:n+=1}),r=a===t.length||i>=0&&n===0||i===0&&n>=0}return r}function Xr(t){let{countTotal:e,countPerSeries:r,numberOfSeries:i}=t,n,a=[];return typeof e=="number"&&Number.isFinite(e)&&a.push(e),typeof r=="number"&&Number.isFinite(r)&&a.push(r*i),a.length>0&&(n=Math.min(...a)),n}function ro(t,e){let r,{maxBarChartSeriesCount:i,maxBarUniqueSeriesCountTotal:n,maxBarTwoSeriesCountPerSeries:a,maxBarTwoSeriesCountTotal:s,maxBarThreePlusSeriesCountPerSeries:o,maxBarThreePlusSeriesCountTotal:l,maxLineChartSeriesCount:u,maxLineUniqueSeriesCountTotal:c,maxLineTwoSeriesCountPerSeries:d,maxLineTwoSeriesCountTotal:f,maxLineThreePlusSeriesCountPerSeries:m,maxLineThreePlusSeriesCountTotal:h,maxPieChartSliceCountTotal:g,maxGaugeByFeaturesLimit:y}=bt(e),p=Z(t.series),F=t.series.length===0?1:t.series.length,C=W(t.series);switch(p){case S.ComboLineAndBarSeries:case S.BarSeries:F<=i&&(F===1?r=n:F===2?r=Xr({countTotal:s,countPerSeries:a,numberOfSeries:F}):F>2&&(r=Xr({countTotal:l,countPerSeries:o,numberOfSeries:F})));break;case S.LineSeries:F<=u&&(F===1?r=c:F===2?r=Xr({countTotal:f,countPerSeries:d,numberOfSeries:F}):F>2&&(r=Xr({countTotal:h,countPerSeries:m,numberOfSeries:F})));break;case S.PieSeries:r=g;break;case S.GaugeSeries:r=y;break;case S.ScatterSeries:case S.HistogramSeries:case S.BoxPlotSeries:}return(C===b.BarAndLineNoAggregation||C===b.BarAndLineMultiFields)&&r!==void 0&&(r=Math.ceil(r/F)),r}function Ms(t,e){let r=t;if(Number.isFinite(t)){let{factor:i,offset:n}=e??{};Number.isFinite(i)&&(r*=i),Number.isFinite(n)&&(r+=n)}return r}function Kc(t){let e=!1;if(t!==void 0){let r=t.replace(" ",""),i=/^%(0*100{1,1}\.?((?:\.)0*)?$)|(^%0*\d{0,2}\.?((?:\.)\d*)?)$/u,n=/^(0*100{1,1}\.?((?:\.)0*)?%$)|(^0*\d{0,2}\.?((?:\.)\d*)?%)$/u;e=i.test(r)||n.test(r)}return e}function yg(t){let e;if(Kc(t)){let r=/%(\d{1,3}(.\d+)?)$/u,i=/(\d{1,3}(.\d+)?)%$/u,n=t.replace(" ",""),a=r.exec(n)?.[1]??i.exec(n)?.[1];a!==void 0&&(e=Number(a))}return e}function io(t){let{stringToTruncate:e,characterLimit:r,ellipsis:i=v.chartEllipsis}=t,n=e;return typeof r=="number"&&Number.isFinite(r)&&r>0&&r<e.length&&(n=e.slice(0,r),n=`${n}${i}`),n}function gg(t){let{input:e,charsPerLine:r}=t,i=e;if(r>0&&e.length>r){let n=e.lastIndexOf(" ",r),a=e.lastIndexOf("-",r),s=Math.max(n,a),o=s===a&&a>0,l=s>0?s+(o?1:0):r,u=Math.min(r,l),c=e.slice(0,u).trimEnd(),d=e.slice(u).trimStart();d.length>r&&(d=io({stringToTruncate:d,characterLimit:Math.max(1,r-1)})),i=`${c}
3
- ${d}`}return i}function pg(t,e=":"){return t?`\u200F${e}`:`\u200E${e}`}function Sg(t){return e=>{let r=typeof e!="string"?e?.toString()??"":e;return!he(r)&&r!==v.htmlEmptyContent&&(r=io({stringToTruncate:r,characterLimit:t})),r}}function Jc(t){let e=/[[]/gu,r=/[\]]/gu,i=/[{]/gu,n=/[}]/gu,a=/[']/gu;return t=t.replace(e,"[["),t=t.replace(r,"]]"),t=t.replace(i,"{{"),t=t.replace(n,"}}"),t=t.replace(a,"''"),t}function Xc(t,e){let r="";return t!==void 0&&(r=`${e==="amChartsV5"?"fontStyle":"font-style"}:${t};`),r}function ed(t,e){let r="";return t===!0&&(r=`${e==="amChartsV5"?"letterSpacing":"letter-spacing"}:1px;`),r}function bg(t){let{textSymbol:e,placeholderString:r,format:i,axisLabelsBehavior:n,defaults:a}=t,s=Xc(e?.font?.style,i),o=ed(e?.kerning,i),l=r??e?.text??"";if(i==="html"){let{wrap:u,maxWidth:c}=a??{};n===Dn.Wrap&&(u=!0,c=c??v.xAxisLabelMaxWidth);let d=u===!0&&Number.isFinite(c)?`max-width: ${c}px; word-break: break-word;`:"";l=`<p style="margin:0;${s}${o}${d}">${l}</p>`}else l=Jc(l),(s!==""||o!=="")&&(l=`[${s}${o}]${l}[/]`);return l}function td(t){return t?t.replace(/[A-Z]/gu,e=>`-${e.toLowerCase()}`):void 0}var vg=[S.BarSeries,S.BoxPlotSeries,S.LineSeries,S.PieSeries,S.HistogramSeries,S.ScatterSeries],Fg=1,xg={PNG:"png"},Gt={ChartRenderer:1,LayerRenderer:2};function Cg(t){let{chartConfig:e,queryObject:r}=t,i=!1;if(e.chartRenderer)i=!0;else{let{series:n}=e,a=Z(n),s=W(n),o=mt(e),l=Xe({seriesConfig:o,queryObject:r}),u=U(r)?.renderer;switch(u?.type){case me.Simple:i=a===S.HistogramSeries||a===S.ScatterSeries||s===b.BarAndLineMonoField||s===b.BoxPlotMonoField||s===b.BoxPlotMultiFields||s===b.BoxPlotMonoFieldAndCategory||s===b.BarAndLineNoAggregation&&n.length===1&&!l;break;case me.UniqueValue:{let c=u?.field,d=de(o.query?.where),{x:f}=o;i=(s===b.BoxPlotMonoFieldAndSplitBy||s===b.BoxPlotMultiFieldsAndSplitBy||s===b.BoxPlotMonoFieldAndCategoryAndSplitBy||s===b.BarAndLineSplitByNoAggregation||s===b.BarAndLineSplitBy)&&c===d||(s===b.BoxPlotMonoFieldAndCategory||s===b.PieFromCategory||s===b.BarAndLineMonoField)&&c===f||s===b.BarAndLineNoAggregation||s===b.PieNoAggregation||a===S.ScatterSeries}break;case me.PieChart:i=s===b.PieFromFields||s===b.BarAndLineFromFields||s===b.BarAndLineMultiFields||s===b.BarAndLineMonoField||s===b.BoxPlotMonoField||s===b.BoxPlotMultiFields||s===b.BoxPlotMonoFieldAndCategory||s===b.BoxPlotMultiFieldsAndCategory;break;case me.ClassBreaks:i=a===S.HeatSeries||a===S.ScatterSeries||s===b.BarAndLineNoAggregation||s===b.PieNoAggregation;break;case me.Dictionary:case me.DotDensity:case me.Heatmap:break}}return i}function rd(t,e){return td(t?.type)??e?.type}function id(t){let e=v.rendererSymbolField,r=e in t?e:void 0;if(!r){let i=t[v.originalCategoryValue];r=Object.keys(t).find(n=>{let a=t[n];return n.includes(e)&&a?.label&&a?.uniqueValue===i}),r||(r=Object.keys(t).find(n=>n.includes(e))??"")}return t[r]?.label}function nd(t){return t?.type!==void 0&&(t.color!==void 0||t.label!==void 0||t.style!==void 0||t.outline!==void 0)}function no(t){let{symbolField:e,dataItem:r,rendererSymbol:i,rendererOrigin:n}=t,a=!1;if(!nd(i))delete r[e];else{let s={...i};s.color!==void 0&&n===Gt.LayerRenderer&&(s.color[3]=pi*255),n===Gt.LayerRenderer&&(delete s.style,delete s.outline,delete s.label),r[e]=s,a=!0}return a}function ad(t){let{renderer:e,seriesConfig:r,chartSubType:i,dataItem:n,rendererOrigin:a}=t,s,o=!1,l=Z(r),{outline:u,attributes:c}=e;return c.forEach(d=>{let{field:f}=d,{color:m,label:h}=d,g;Array.isArray(m)&&m?.length===4?g=m:m&&"toRgba"in m&&(g=m.toRgba());let y=!1,p=!0;switch(l){case S.BarSeries:case S.LineSeries:case S.ComboLineAndBarSeries:case S.RadarSeries:if(i!==b.BarAndLineFromFields){let F=r.find(C=>C.query?.outStatistics?.[0]?.onStatisticField===f);F!==void 0&&"y"in F?f=[F.y].flat()[0]:f=""}y=i!==b.BarAndLineFromFields||f===n[v.originalCategoryValue];break;case S.PieSeries:y=i===b.PieFromFields&&f===n[v.originalCategoryValue];break;case S.BoxPlotSeries:i===b.BoxPlotMonoField||i===b.BoxPlotMonoFieldAndCategory?y=f===r[0].y:f&&(i===b.BoxPlotMultiFields||i===b.BoxPlotMultiFieldsAndCategory)&&(y=r.map(F=>F.y).flat().includes(f)),p=!1;break}y&&g&&(s={type:rt.SMS,color:g,label:p&&h?h:void 0},u!=null&&(s.outline=u),no({dataItem:n,symbolField:i===b.BarAndLineFromFields||i===b.PieFromFields?v.rendererSymbolField:`${v.rendererSymbolField}_${f}`,rendererSymbol:s,rendererOrigin:a})&&(o=!0))}),{rendererSymbol:s,colorMatchApplied:o}}function sd(t){let{seriesConfig:e,chartSubType:r,rendererType:i}=t,n=v.rendererSymbolField;if(i===me.UniqueValue){if(xi(r)){let a=xe({where:e.query?.where,keepSurroundingQuotes:!1,escape:!1});a===null?n=v.nullValue:r===b.BarAndLineSplitBy&&typeof e.y=="string"?n=e.y:r===b.BarAndLineSplitByNoAggregation&&typeof e.y=="string"?n=`${e.y}_${a}`:n=`${a}`}}else if(i===me.PieChart)switch(r){case b.BoxPlotMultiFields:n=Array.isArray(e.y)?e.y.flat():e.y;break;case b.BarAndLineMonoField:case b.BarAndLineMultiFields:case b.BoxPlotMonoField:case b.BoxPlotMonoFieldAndCategory:case b.BoxPlotMultiFieldsAndCategory:n=e.y;break}return n}function ao(t){let{seriesConfig:e,chartSubType:r,rendererType:i,dataItem:n}=t,a=sd({seriesConfig:e,chartSubType:r,rendererType:i});return a instanceof Array&&e.type===S.BoxPlotSeries&&i===me.PieChart&&n!==void 0&&(a=a.find(s=>s===n[ir])??a[0]),a=a!==v.rendererSymbolField?`${v.rendererSymbolField}_${a.toString()}`:a,a}function od(t){let{chartRenderer:e,queryObject:r}=t,i=e!==void 0?{...U(r),renderer:Sn.fromJSON(e)}:U(r);return new Gu({layer:i})}async function ld(t){let{seriesConfig:e,dataItem:r,renderer:i,rendererType:n,rendererOrigin:a,chartSubType:s,splitByField:o,graphicTemplate:l,rendererFieldNames:u,mapAttributesToSymbol:c}=t,d,f=!1;if(n===me.PieChart){let m=ad({renderer:i,seriesConfig:e,chartSubType:s,dataItem:r,rendererOrigin:a});d=m.rendererSymbol,f=m.colorMatchApplied}else if(r?.[Mr.defaultGroupOfSlicesId]!==!0){let{x:m}=e[0],h=new Map;o&&o.trim()!==""?e.forEach(g=>{if(g.type===S.BarSeries||g.type===S.LineSeries||g.type===S.BoxPlotSeries||g.type===S.RadarSeries){let y=ao({seriesConfig:g,chartSubType:s,rendererType:n,dataItem:r}),p=xe({where:g.query?.where,normalize:!0,keepSurroundingQuotes:!1,escape:!1});h.set(y,{...r,[o]:p})}}):e[0].type===S.HeatSeries&&n===me.ClassBreaks?h.set(v.rendererSymbolField,{[j.valueField]:r[j.valueField]}):h.set(Z(e)===S.HistogramSeries?v.rendererSymbolFieldForHistogram:v.rendererSymbolField,{...r,[m]:_c(r)});try{let g=Array.from(h.entries()),y=l.clone();y.layer=l.layer;let p=i?.uniqueValueInfos;for(let F=0;F<g.length;F+=1){let[C,x]=g[F];if(Is({mode:"encode",x:m,splitByField:o,attributes:x}),u&&u.length>0&&Object.keys(x).forEach(w=>{u.includes(w)||delete x[w]}),y.attributes=x,c?.has(JSON.stringify(x)))d=c.get(JSON.stringify(x));else{if(d=(await er.getDisplayedSymbol(y))?.toJSON(),d!=null){if(d.color===void 0){let N=(await er.getDisplayedColor(y))?.toJSON();N&&(d.color=N.length===4?N:[...N,255])}let w=await er.getLegendLabel(y);w!=null&&w!==""&&(d.label=w,d.uniqueValue=p?.find(N=>N.label===w)?.value??void 0)}c?.set(JSON.stringify(x),d)}Is({mode:"revert",x:m,splitByField:o,attributes:r}),no({dataItem:r,symbolField:C,rendererSymbol:d,rendererOrigin:a})&&(f=!0)}}catch{}}return{rendererSymbol:d,colorMatchApplied:f}}function Is(t){let{splitByField:e,attributes:r,x:i,mode:n}=t;[i,e??""].forEach(a=>{r[a]===(n==="encode"?null:v.nullValue)&&(r[a]=n==="encode"?v.nullValue:null)})}function ud(t){let{dataItem:e,seriesConfig:r,chartSubType:i,colorMatch:n,rendererType:a}=t,s;if(n&&e!==void 0){let o=ao({seriesConfig:r,chartSubType:i,rendererType:a,dataItem:e});s=e[o]}return s}function wg(t){let{seriesSymbol:e,rendererSymbol:r,colorIndex:i}=t,n=r?.color??e.color;n=n??Si({colorIndex:i,opacity:pi});let a={...e,color:n},s=a.type===rt.SFS&&mc(a.style);return r?.type===e.type&&r.style!==void 0&&!s&&(a.style=r.style),a.type!==rt.SLS&&(a.outline={type:rt.SLS,style:r?.outline?.style??a.outline?.style,width:r?.outline?.width??a.outline?.width,color:r?.outline?.color??a.outline?.color??r?.color}),a}function cd(t){let e=[];return t&&(e=t.series.flatMap(r=>r.query?.outStatistics?.map(i=>i.onStatisticField)).filter(r=>r!==void 0),e.length===0&&(e=Se(t.series))),e}function Ng(t,e){let r=!1;if(t&&e&&e.length>0&&bi(t)){let i=hd(t),n=mt(t);i?r=cd(t).some(a=>e.includes(a)):r=e.includes(n.x)}return r}function dd(t){let e=[];if(t&&"type"in t&&typeof t.type=="string")switch(t.type){case"uniqueValue":case"unique-value":"field1"in t&&typeof t.field1=="string"&&(e=[t.field1]);break;case"classBreaks":case"class-breaks":"field"in t&&typeof t.field=="string"&&(e=[t.field]);break;case"pieChart":case"pie-chart":"attributes"in t&&Array.isArray(t.attributes)&&(e=t.attributes.map(r=>r.field));break}return e}function fd(t,e){return t[0].dataTransformationType!==e[0].dataTransformationType}function md(t,e){return t[0].binCount!==e[0].binCount}function Tg(t,e){let r=!0,i=Z(t?.series),n=Z(e?.series);return i&&i!==n&&(r=i===S.ComboLineAndBarSeries&&(n===S.BarSeries||n===S.LineSeries)||n===S.ComboLineAndBarSeries&&(i===S.BarSeries||i===S.LineSeries)||i===S.BarSeries&&n===S.LineSeries||i===S.LineSeries&&n===S.BarSeries),r}function cn(t,e){return t!==void 0&&e!==void 0&&e>0}function Og(t){let{chartConfig:e,queryObject:r,chartData:i}=t,n=[],a=W(e.series),s=bi(e),o=U(r),l=e.chartRenderer??o?.renderer?.toJSON();return n=e.series.map((u,c)=>{let d=Z([u]),f;return(d===S.BarSeries||d===S.LineSeries||d===S.RadarSeries)&&(u.type===S.BarSeries?f=u.fillSymbol?.color:(u.type===S.RadarSeries||u.type===S.LineSeries)&&(f=u.lineSymbol?.color),s?f=ud({dataItem:i[0],seriesConfig:u,chartSubType:a,colorMatch:s,rendererType:l?.type})?.color:f===void 0&&(f=Si({colorIndex:c}))),f}).filter(u=>u!==void 0),n}function dn(t){return t!==b.PieNoAggregation&&t!==b.BarAndLineNoAggregation&&t!==b.BarAndLineSplitByNoAggregation}function hd(t){let e=W(t.series);return e===b.BarAndLineFromFields||e===b.PieFromFields||e===b.BoxPlotMonoField||e===b.BoxPlotMultiFields||e===b.BoxPlotMonoFieldAndSplitBy||e===b.BoxPlotMultiFieldsAndSplitBy}function Jt(t){return Fe(t)?t?.showMean??!1:!1}function yd(t){return Fe(t)?t?.showOutliers:void 0}function Bg(){return`{name} {${v.originalCategoryValue}} {dateY} {valueX} {dateX} {valueY}`}function gd(t,e){let r=z.now().offset/60,i=z.now().setZone(t)??r,n=i.offset/60,a=e?i.setZone(e).offset/60:0;return n-a}function so(t){let{outTimeZone:e=Intl.DateTimeFormat().resolvedOptions().timeZone,dataTimeZone:r="UTC",runsOnClientQueryEngine:i}=t,n="",a=gd(e,r);if(a!==0)if(i)n=`${a>0?"+":"-"}1*INTERVAL '${Math.abs(a)}' HOUR `;else{let s=Math.abs(a%1),o=Math.round(s*60);a=Math.floor(a),n=a>0?`+INTERVAL '${Math.abs(a)}:${o!==0?o:"00"}:01' HOUR TO SECOND`:`-INTERVAL '${Math.abs(a)-(o!==0?0:1)}:${o!==0?String(o-1):"59"}:59' HOUR TO SECOND`}return n}function pd(t){let{dateFieldName:e,unit:r,runsOnClientQueryEngine:i,outTimeZone:n}=t,a=so({runsOnClientQueryEngine:i,outTimeZone:n}),s=`EXTRACT(YEAR FROM ${e} ${a})`,o=`EXTRACT(MONTH FROM ${e} ${a})`,l=`EXTRACT(DAY FROM ${e} ${a})`,u=`EXTRACT(HOUR FROM ${e} ${a})`,c=`EXTRACT(MINUTE FROM ${e} ${a})`,d=`EXTRACT(SECOND FROM ${e} ${a})`,f=[];switch(r){case $.Second:f=[s,o,l,u,c,d];break;case $.Minute:f=[s,o,l,u,c];break;case $.Hour:f=[s,o,l,u];break;case $.Day:case $.Week:case $.Month:case $.Year:f=[s,o,l];break}return f}function Sd(t){let{whereValue:e,outStatistics:r,y:i}=t,n=G.outStatistics.outStatisticFieldName??"";return r?.outStatisticFieldName!==void 0?n=r.outStatisticFieldName:r?.onStatisticField!==void 0&&r.statisticType!==void 0?n=`${r.statisticType}_${r.onStatisticField}_${e}`:i!==void 0&&(n=[i].flat()[0]),n}function bd(t){let e=new Map;for(let r=0;r<t.length;r+=1){let i=t[r],n=i.query?.where;if(n!==void 0&&"y"in i){let a=xe({where:n,normalize:!0,escape:!1});if(a!==""){let s=Sd({whereValue:a,outStatistics:i.query?.outStatistics?.[0],y:i.y});i.y=s,e.set(a,s)}}}return e}function vd(t){let{uniqueQuery:e,splitByField:r,x:i}=t,n=[...e.groupByFieldsForStatistics??[],i,r].filter(a=>a!==void 0&&a.trim()!==""&&a!==ir);e.groupByFieldsForStatistics=Array.from(new Set(n))}function Fn(t){return t.statisticType===A.ContinuousPercentile||t.statisticType===A.DiscretePercentile}function Fd(t){let{uniqueQuery:e,y:r,useGenericOutStatFieldName:i,queryObject:n,chartSubType:a,isTimeBinningSeries:s,returnFeaturesExtent:o,splitByField:l}=t,u=G.outStatistics;if(e.outStatistics?.[0]!==void 0){a!==b.PieFromFields&&a!==b.BarAndLineFromFields&&(e.outStatistics[0].outStatisticFieldName=i?u.outStatisticFieldName:[r].flat()[0]);let{outStatistics:c}=e;for(let d=0;d<c.length;d+=1){let f=c[d];f!==void 0&&Fn(f)&&(s&&!Qt(l,n)?(c[d].statisticType=A.Count,delete c[d].statisticParameters):c[d]={...c[d],statisticParameters:c[d].statisticParameters??{value:G.defaultStatParameterValue}})}}else{let c=U(n),{idField:d,isTraditionalTypeOID:f}=We(c),m=f?d:"*";e.outStatistics=[{statisticType:u.statisticType,onStatisticField:m,outStatisticFieldName:i?u.outStatisticFieldName:[r].flat()[0]}]}o===!0&&(!s||he(l))&&e.outStatistics?.push({statisticType:A.EnvelopeAggregate,onStatisticField:"1"})}function xd(t){let{chartConfig:e,fetchFullBoxPlotData:r}=t,{series:i}=e,n=Jt(e),a=[{statisticType:A.Average,suffix:P.Average}];r===!0&&(a=[...a,{statisticType:A.Minimum,suffix:P.Min},{statisticType:A.ContinuousPercentile,statisticParameters:{value:.25},suffix:P.FirstQuartile},{statisticType:A.ContinuousPercentile,statisticParameters:{value:.5},suffix:P.Median},{statisticType:A.ContinuousPercentile,statisticParameters:{value:.75},suffix:P.ThirdQuartile},{statisticType:A.Maximum,suffix:P.Max},{statisticType:A.StandardDeviation,suffix:P.StandardDeviation}]);let s=new Set;return n&&"y"in i[0]?[i[0].y].flat().forEach(o=>s.add(o)):i.forEach(o=>{"y"in o&&[o.y].flat().forEach(l=>s.add(l))}),[...s].flatMap(o=>a.map(l=>{let u={onStatisticField:o,statisticType:l.statisticType,outStatisticFieldName:`${o}_${l.suffix}`};return l.statisticType===A.ContinuousPercentile&&(u.statisticParameters=l.statisticParameters),u}))}function Cd(t,e){for(let r=1;r<e.length;r+=1){let i={...e[r].query?.outStatistics?.[0]};i!==void 0&&t.outStatistics!==void 0&&t.outStatistics.push(i)}}function wd(t){let{uniqueQuery:e,x:r,splitByField:i,unit:n,chartSubType:a,objectIdFields:s,runsOnClientQueryEngine:o}=t;if(n!==void 0){let l=pd({dateFieldName:r,unit:n,runsOnClientQueryEngine:o});e.orderByFields=l,e.groupByFieldsForStatistics=l,a===b.BarAndLineSplitBy&&!he(i)?e.groupByFieldsForStatistics.push(i):a===b.BarAndLineNoAggregation&&(e.groupByFieldsForStatistics=s,e.outStatistics=[{onStatisticField:s.length>1?"*":s[0],outStatisticFieldName:`COUNT_${s[0]}`,statisticType:A.Count}])}}function oo(t){let{chartConfig:e,uniqueQuery:r,chartLimits:i}=t;if(i?.behaviorAfterLimit===St.RenderUpToTheLimit){let n=ro(e,i);if(n!==void 0){let a=W(e.series);if(a===b.PieFromFields||a===b.BarAndLineFromFields){if(r.outStatistics?.[0]!==void 0){let s=(u,c)=>u.statisticType===A.EnvelopeAggregate===c,o=r.outStatistics.filter(u=>s(u,!0)),l=r.outStatistics.filter(u=>s(u,!1));l.splice(n),r.outStatistics=[...l,...o]}}else r.num=n}}}function xn(t){let{chartConfig:e,queryConfig:r,queryObject:i,timeIntervalInfo:n,setTimeBinningInfoWhenNotProvided:a,fetchFullBoxPlotData:s,returnFeaturesExtent:o,chartLimits:l}=t,u=e.series,c=W(u),d=mt(e),{query:f,x:m}=d,h="y"in d?d.y:void 0,g=Xe({xAxisValueFormatType:$e(e),setTimeBinningInfoWhenNotProvided:a,seriesConfig:d,queryObject:i}),y=new Map,p=!1,F=!1,C=!1,x=!1,w=!1,N={};if(f!==void 0){N=tt(f);let E=de(f.where),D="";switch(r.fetchNullValues!==!0&&(m!==v.boxPlot.boxPlotCategory&&(D=`${m} IS NOT NULL`),E.trim()!==""&&E!==m&&!ut(f.where)&&(D=ee([D,`${E} IS NOT NULL`]))),c){case b.BarAndLineSplitBy:{y=bd(u),x=!0,p=!0,F=!0;break}case b.BarAndLineMultiFields:Cd(N,u),F=!0;break;case b.PieFromFields:case b.BarAndLineFromFields:D="",C=!0,F=!0;break;case b.BarAndLineMonoField:case b.PieFromCategory:F=!0;break;case b.BoxPlotMonoField:case b.BoxPlotMultiFields:C=!0,w=!0;break;case b.BoxPlotMonoFieldAndCategory:case b.BoxPlotMultiFieldsAndCategory:case b.BoxPlotMonoFieldAndSplitBy:case b.BoxPlotMonoFieldAndCategoryAndSplitBy:case b.BoxPlotMultiFieldsAndSplitBy:{w=!0,x=!0,C=!0;break}case b.PieNoAggregation:case b.BarAndLineNoAggregation:case b.BarAndLineSplitByNoAggregation:}if(F&&Fd({uniqueQuery:N,y:h,useGenericOutStatFieldName:p,queryObject:i,chartSubType:c,isTimeBinningSeries:g,returnFeaturesExtent:o,splitByField:E}),x&&vd({uniqueQuery:N,splitByField:E,x:m}),Fe(e)&&w&&(N.outStatistics=xd({chartConfig:e,fetchFullBoxPlotData:s})),C?delete N.orderByFields:r.orderByFields!==void 0&&(N.orderByFields=r.orderByFields.filter(Y=>{let J=Y.split(" ");return!he(J[0])})),g&&Ve(u[0])){let Y=U(i),{idFields:J}=li(Y);Re(i).find(R=>R.name===m)?.type!==Q.DateOnly&&J&&wd({uniqueQuery:N,x:m,splitByField:de(f.where),unit:n?.unit??u[0].temporalBinning?.unit,chartSubType:c,objectIdFields:J,runsOnClientQueryEngine:ct(i)})}N.where=D}oo({chartConfig:e,uniqueQuery:N,chartLimits:l});let{gdbVersion:O,geometry:T,distance:B,units:M,timeExtent:q,where:I,objectIds:k,spatialRelationship:_}=r;return O!==void 0&&(N.gdbVersion=O),T!==void 0&&(N.geometry=T),B!==void 0&&(N.distance=B),M!==void 0&&(N.units=M),q!==void 0&&(N.timeExtent=q),k!==void 0&&(N.objectIds=k),_!==void 0&&(N.spatialRelationship=_),I!==void 0&&(N.where=ee([N.where,I])),{uniqueQuery:N,mapToStatField:y}}var pe={Default:"defaultError",LayerLoadFailure:"layerLoadFailure",QueryFeaturesError:"queryFeaturesError",ChartDisposed:"ChartDisposeError",LayerFieldsNotFound:"layerFieldsNotFound",LayerNotSupported:"layerNotSupported"},Ot=new Map,Mg={NonNumericAggregation:"nonNumericAggregation",DuplicateSeriesID:"duplicateSeriesId"},Ig={Required:"required",MinLength:"minLength",MinItems:"minItems",MaxItems:"maxItems",Pattern:"pattern",AdditionalProperties:"additionalProperties",Enum:"enum",AnyOf:"anyOf"},H={BadData:"badData",EmptyDataSet:"emptyDataSet",InvalidConfig:"invalidConfig",HistogramEmptyField:"histogramEmptyField",BarElementExceedsLimit:"barElementExceedsLimit",LineChartExceedsLimit:"lineChartExceedsLimit",BoxPlotExceedsLimit:"boxPlotExceedsLimit",BoxPlotOutliersExceedsLimit:"boxPlotOutliersExceedsLimit",HeatChartExceedsLimit:"heatChartExceedsLimit",PieChartExceedsLimit:"pieChartExceedsLimit",GaugeExceedsLimit:"gaugeExceedsLimit",PieChartMixOfNegativePositiveSlices:"PieChartMixOfNegativePositiveSlices",NegativeValueInSqrtCalculation:"negativeValueInSqrtCalculation",NegativeValueInLogCalculation:"negativeValueInLogCalculation",NegativeValueInXAxisLogScale:"negativeValueInXAxisLogScale",NegativeValueInYAxisLogScale:"negativeValueInYAxisLogScale"},Nd=2048;function Td(t){let e;switch(t){case re.Log:e="log";break;case re.Sqrt:e="sqrt";break;case re.None:default:e=void 0;break}return e}async function Od(t){let{queryConfig:e,chartConfig:r,queryObject:i,abortKey:n,abortSignal:a,view:s}=t,o=r.series[0],{x:l,dataTransformationType:u,binCount:c}=o,d=U(i);if(!oe(d))throw new ce(pe.LayerNotSupported);d.loaded||await d.load({signal:a});let f=await Fr(d,a);if(!f)throw new Error("Raster info is not available for the layer.");let m=tr(e.geometry)??d.fullExtent,h=f.bandCount===1?0:f.bandInfos.findIndex(p=>p.name===l),g,y;if(s===void 0&&(u===void 0||u===re.None)&&c&&Array.isArray(f.histograms)&&f.histograms.length>h&&f.histograms[h].size%c===0&&Array.isArray(f.statistics)&&f?.statistics?.length>h)g=f.histograms[h],y=f.statistics[h];else{let p,F,C;if(s)p=s.resolution,F=s.resolution,C=s.spatialReference;else{let O=Nd,T=2,B=f.width,M=f.height,q=Math.max(0,Math.ceil(Math.log(Math.max(B,M)/O)/Math.log(T))),I=T**q;p=f.pixelSize.x*I,F=f.pixelSize.y*I,C=d.spatialReference}let x=new Qs({x:p,y:F,spatialReference:C}),w=Td(u),N=await Ku(d,{bandIds:[h],geometry:m,histogramSize:c??void 0,pixelSize:x,transformType:w},{signal:a??(n!==void 0?Ot.get(n)?.signal:void 0)});y=N.statistics[0],g=N.histograms[0]}return{histogram:g,statistics:y}}function Bd(t,e){let r=[],i=(t.max-t.min)/t.size;for(let n=0;n<t.size;n++){let a=t.min+n*i;r.push({minValue:a,maxValue:a+i,count:t.counts[n]})}if(e&&t.size!==e&&t.size%e===0){let n=t.size/e,a=[];for(let s=0;s<e;s++){let o=r[s*n].minValue,l=r[(s+1)*n-1].maxValue,u=0;for(let c=0;c<n;c++)u+=r[s*n+c].count;a.push({minValue:o,maxValue:l,count:u})}return a}return r}async function Md(t){let{chartConfig:e,queryConfig:r,queryObject:i,abortKey:n,abortSignal:a,view:s}=t;if(i===void 0)throw new Error("QueryObject is undefined!");let o,{statistics:l,histogram:u}=await Od({queryObject:i,chartConfig:e,queryConfig:r,view:s,abortKey:n,abortSignal:a});if(l&&u){let c=e.series[0].binCount??void 0,d=Bd(u,c);d.length>0?o={valid:!0,count:d.length,data:{bins:d,min:l.min,max:l.max,mean:l.avg,median:l.median,stddev:l.stddev,sum:l.sum??l.avg*l.count,count:l.count}}:o={valid:!1,invalidType:H.EmptyDataSet}}else o={valid:!1,invalidType:H.BadData};return o}var Id=t=>t.series[0].x;function Ed(t){let{chartConfig:e,layer:r,selectionDataItems:i}=t,n=fn(r,Id(e)),a=i.map(l=>[l.minValue,l.maxValue]).reduce((l,u,c)=>{if(c===0)l.push([...u]);else{let d=l[l.length-1];d[1]===u[0]?d[1]=u[1]:l.push([...u])}return l},[]),s=e.series[0],{dataTransformationType:o}=s;switch(o){case re.Log:a.forEach(l=>{l[0]=Math.exp(l[0]),l[1]=Math.exp(l[1])});break;case re.Sqrt:a.forEach(l=>{l[0]=l[0]*l[0],l[1]=l[1]*l[1]});break;case re.None:}return a.length>0?{bandId:n,pixelRanges:a}:void 0}function pr(t,e){let r,i,n=e??(a=>a);for(let a of t){let s=n(a);s==null||Number.isNaN(s)||((r===void 0||s<r)&&(r=s),(i===void 0||s>i)&&(i=s))}return{min:r,max:i}}function Ad(t,e){let r=0,i=0,n=e??(a=>a);for(let a of t){let s=n(a);s==null||Number.isNaN(s)||(r++,i+=s)}return r>0?i/r:void 0}function Ld(t,e){let r=0,i=e??(n=>n);for(let n of t){let a=i(n);a==null||Number.isNaN(a)||(r+=a)}return r}function Eg(t,e,r=1){let i=Math.max(0,Math.ceil((e-t)/r)),n=new Array(i);for(let a=0;a<i;a++)n[a]=t+a*r;return n}var qd={dataFormat:"json",outputFormat:"json",typeKey:"analyticType",typeValue:"LinRegR2",fieldValue:"onAnalyticField",slopePropertyList:["Slope","SLOPE","slope"],interceptPropertyList:["Intercept","INTERCEPT","intercept"],r2PropertyList:["R2","r2"]};function Dd(t){let e;switch(t){case"feet":e="esriSRUnit_Foot";break;case"miles":e="esriSRUnit_StatuteMile";break;case"nautical-miles":e="esriSRUnit_NauticalMile";break;case"us-nautical-miles":e="esriSRUnit_USNauticalMile";break;case"meters":e="esriSRUnit_Meter";break;case"kilometers":e="esriSRUnit_Kilometer";break}return e}async function Pd(t){let{queryObject:e,queryConfig:r,outputFormat:i,dataFormat:n,outAnalytics:a,errorStrings:s,abortSignal:o}=t,{where:l,geometry:u,distance:c,units:d,timeExtent:f}=r,m,h=U(e),g=Be(h);if(g){let y={where:ee([l,g.definitionExpression])},p={query:y,signal:o},F=tr(u)?.extent?.toJSON();if(F!==void 0){let x=Dd(d),{xmin:w,ymin:N,xmax:O,ymax:T}=F;y.geometryType="esriGeometryEnvelope",y.geometry=`${w},${N},${O},${T}`,c!==void 0&&(y.distance=c.toString()),x!==void 0&&(y.units=x,u?.spatialReference?.wkid!=null&&(y.inSR=u.spatialReference.wkid.toString()))}f&&(y.time=`${f[0]},${f[1]}`);let C=`${g.url}/${g.layerId}/queryAnalytic?f=${i}&dataFormat=${n}&outAnalytics=${a}`;try{m=(await ti(C,p)).data?.features?.[0]?.attributes}catch(x){let w=s??(await qt(et(document.documentElement).t9nLocale,Lt("./assets/common/t9n"),"messages.")).errorStrings;throw new ce(pe.QueryFeaturesError,w.errors.queryError,x)}}return m}function lo(t,e){return{lowerBoundaryAlias:`charts_lower_boundary_${t}`,upperBoundaryAlias:`charts_upper_boundary_${t}`,stackAlias:`charts_stack_alias_${e}`}}async function kd(t){let{chartConfig:e,queryObject:r,queryConfig:i,view:n,syncViewTimeZone:a,errorStrings:s,abortSignal:o}=t,l,u=U(r),c=gc(u);if(c&&r&&"queryAttributeBins"in r){let{x:d,y:f,xTemporalBinning:m,yTemporalBinning:h}=e.series[0],{outTimeZone:g,firstDayOfWeek:y,includeLeapDay:p}=e,F=Af({queryObject:r,queryConfig:i,x:d,y:f,xTemporalBinning:m,yTemporalBinning:h,configTimeZone:g,firstDayOfWeek:y,includeLeapDay:p,view:n,syncViewTimeZone:a});try{l=await r.queryAttributeBins(F,{signal:o})}catch(C){throw new ce(pe.QueryFeaturesError,s.errors.queryError,C)}}if(!c)throw new ce(pe.QueryFeaturesError,s.errors.queryBinsNotSupported,s.errors.queryBinsNotSupported);return l}async function Vd(t){let{chartConfig:e,queryObject:r,queryConfig:i,returnFeaturesExtent:n,errorStrings:a,abortKey:s,abortSignal:o}=t,l=e.series[0],u,{x:c,y:d}=l;i.groupByFieldsForStatistics=[c],c!==d&&i.groupByFieldsForStatistics.push(d),i&&n===!0&&!i.outStatistics?.some(f=>f.statisticType===A.EnvelopeAggregate)&&i.outStatistics?.push({statisticType:A.EnvelopeAggregate,onStatisticField:"1"});try{u=await Le({queryObject:r,queryConfig:i,errorStrings:a,abortKey:s,abortSignal:o})}catch(f){throw new ce(pe.QueryFeaturesError,a.errors.queryError,f)}return u}async function $d(t){let{queryObject:e,queryConfig:r,xStep:i,xMin:n,xMax:a,x:s,y:o,yStep:l,errorStrings:u,abortSignal:c}=t,d;if(e&&"queryAttributeBins"in e&&Number.isFinite(i)&&Number.isFinite(l)&&Number.isFinite(n)&&Number.isFinite(a)&&i>0&&l>0){let f=Lf({queryObject:e,queryConfig:r,xStep:i,xMin:n,xMax:a,x:s,y:o,yStep:l});try{d=await e.queryAttributeBins(f,{signal:c})}catch(m){throw new ce(pe.QueryFeaturesError,u.errors.queryError,m)}}return d}async function Rd(t){let{queryConfig:e,x:r,queryObject:i,chartSubType:n,isGaugeByFeature:a,abortSignal:s}=t,o,l=U(i),{idField:u,isTraditionalTypeOID:c}=We(l),d=wn({queryObject:i,queryConfig:e});d.outFields=a||n===b.PieNoAggregation||n===b.BarAndLineNoAggregation||n===b.BarAndLineSplitByNoAggregation?[c?u:"*"]:[r],d.outFields?.[0]===r&&(d.returnDistinctValues=!0);try{o=await i.queryFeatureCount(d,{signal:s})}catch{o=Number.NaN}return o}async function vr(t){let{queryObject:e,queryConfig:r,abortKey:i,errorStrings:n,abortSignal:a}=t,{outStatistics:s}=r,o=new Map;if(s!==void 0&&s.length>0){let l=s.map(f=>{let{statisticType:m,onStatisticField:h,outStatisticFieldName:g}=f;return{statisticType:m,onStatisticField:h,outStatisticFieldName:g?.toUpperCase()}});r.outStatistics=l,delete r.num,delete r.orderByFields;let u=wn({queryObject:e,queryConfig:r}),c;try{c=await e.queryFeatures(u,{signal:a??(i!==void 0?Ot.get(i)?.signal:void 0)})}catch(f){if(!bn.isAbortError(f)){let m=n??(await qt(et(document.documentElement).t9nLocale,Lt("./assets/common/t9n"),"messages.")).errorStrings;throw new ce(pe.QueryFeaturesError,m.errors.queryError,f)}}let d=c?.features?.[0]?.attributes;d!==void 0&&s.forEach(f=>{let{outStatisticFieldName:m}=f;if(m!==void 0){let h=d[m.toLowerCase()]??d[m.toUpperCase()]??d[m];h!==void 0&&o.set(m,h)}})}return o}async function uo(t){let{queryObject:e,queryConfig:r,returnUniqueIdsOnly:i,abortKey:n,errorStrings:a,abortSignal:s}=t,o=[],l=U(e),u=s||(n!==void 0?Ot.get(n)?.signal:void 0),c=qf(l),d=wn({queryObject:e,queryConfig:r,maxRecordCountFactor:c});try{if(i===!0)if("queryObjectIds"in e)o=await e.queryObjectIds(d,{signal:u});else{let{idField:f,isTraditionalTypeOID:m}=We(l),h=m?f:"*";d.outFields=[h],o=(await e.queryFeatures(d,{signal:u})).features.map(g=>g.getObjectId())}else o=(await e.queryFeatures(d,{signal:u})).features}catch(f){if(!bn.isAbortError(f)){let m=a??(await qt(et(document.documentElement).t9nLocale,Lt("./assets/common/t9n"),"messages.")).errorStrings;throw new ce(pe.QueryFeaturesError,m.errors.queryError,f)}}return o}async function Wd(t){let e=[],{featureCount:r,maxRecords:i,queryConfig:n,abortSignal:a}=t,s=[],o=0,l=n?.start??0;for(;o<G.maxParallelRequests&&l<r;){let u={...t};u.queryConfig={...n,start:l,num:Math.min(i,r-l)},e.push(uo({...u,abortSignal:a})),l+=i,o+=1}return s=(await Promise.all(e)).flat(),s}async function Le(t){let{queryObject:e,queryConfig:r,returnUniqueIdsOnly:i,featureCount:n,noBatch:a,errorStrings:s,abortKey:o,abortSignal:l}=t,u=[],c=U(e),d=n??1,f=Fo(c);if(a!==!0&&d>f&&c?.capabilities?.query.supportsPagination){let m=0,h=0,g=Math.ceil(d/f),y=Math.ceil(g/G.maxParallelRequests),p=[];for(;h<y;){m=h*G.maxParallelRequests*f;let F=Wd({queryConfig:{...r,start:m},queryObject:e,maxRecords:f,featureCount:d,returnUniqueIdsOnly:i,errorStrings:s,abortKey:o,abortSignal:l});p.push(F),h+=1}u=(await Promise.all(p)).flat()}else(Number.isNaN(d)||d>=0)&&(u=await uo({queryObject:e,queryConfig:r,returnUniqueIdsOnly:i,errorStrings:s,abortKey:o,abortSignal:l}));return u}async function Ag(t){let{queryObject:e,queryConfig:r,uniqueFeature:i,errorStrings:n,abortKey:a}=t,s={...r,returnDistinctValues:!0};return await Le({queryObject:e,abortKey:a,queryConfig:s,returnUniqueIdsOnly:!0,featureCount:i===!0?1:void 0,errorStrings:n})}function jd(t){if(t!==void 0){let e=Ot.get(t);e!==void 0&&e.abort(),Ot.set(t,new AbortController)}}function co(t){return{lowerBoundaryAlias:`charts_lower_boundary_${t}`,upperBoundaryAlias:`charts_upper_boundary_${t}`}}async function Zd(t){let{queryObject:e,dateField:r,splitByField:i,queryConfig:n,temporalBinning:a,axisTimeZone:s,errorStrings:o,view:l,syncViewTimeZone:u,abortSignal:c}=t,d=[],f;if(a){let{unit:m}=a;try{if(m&&(f=Qt(i,e),f&&e&&"queryAttributeBins"in e)){let h=If({queryObject:e,queryConfig:n,temporalBinning:a,dateField:r,axisTimeZone:s,splitByField:i,view:l,syncViewTimeZone:u});d=(await e.queryAttributeBins(h,{signal:c})).features}}catch(h){let g=o??(await qt(et(document.documentElement).t9nLocale,Lt("./assets/common/t9n"),"messages.")).errorStrings;throw new ce(pe.QueryFeaturesError,g.errors.queryError,h)}}if(f===!1){let m=o??(await qt(et(document.documentElement).t9nLocale,Lt("./assets/common/t9n"),"messages.")).errorStrings;throw new ce(pe.QueryFeaturesError,m.errors.queryBinsNotSupported,m.errors.queryBinsNotSupported)}return d}async function _d(t){let{queryObject:e,abortSignal:r}=t,i=!1;if(!oe(e)){let n=yc(e),a=U(e),s=Be(a);if(n&&s?.url!==void 0&&s.url!==null){let o=`${s.url}/${s.layerId}?f=json`;try{let l=(await ti(o,{signal:r})).data,u=l?.advancedQueryCapabilities?.supportsQueryAnalytic===!0,c=l?.sqlParserVersion===void 0||s.version!=null&&s.version>=10.91;i=u&&c}catch{}}}return i}function zd(t){let{x:e,y:r,trendlineXToY:i,data:n}=t,{min:a,max:s}=n?pr(n,o=>o[e]):{min:Number.NaN,max:Number.NaN};return[{[e]:a??Number.NaN,[r]:i(a??Number.NaN)},{[e]:s??Number.NaN,[r]:i(s??Number.NaN)}]}function Hd(t){let{data:e,x:r,y:i}=t,n=[];return e!==void 0&&(n=e.filter(a=>Number.isFinite(a[r])&&Number.isFinite(a[i])).map(a=>[a[r],a[i]])),n}async function Ud(t){let{statsMap:e,queryObject:r,chartConfig:i,queryConfig:n,errorStrings:a,abortSignal:s}=t,o=i.series[0],{x:l,y:u}=o;Dt(r);let c=Number.NaN,d=[{[l]:Number.NaN,[u]:Number.NaN},{[l]:Number.NaN,[u]:Number.NaN}],{dataFormat:f,outputFormat:m,typeKey:h,typeValue:g,fieldValue:y,slopePropertyList:p,interceptPropertyList:F,r2PropertyList:C}=qd,x=`[{"${h}": "${g}", "${y}":"${l},${u}"}]`,w=await Pd({queryObject:r,queryConfig:n,outputFormat:m,dataFormat:f,outAnalytics:x,errorStrings:a,abortSignal:s});if(w!==void 0){let N=Number.NaN,O=Number.NaN,{expr:T}=Lr(w,p),{expr:B}=Lr(w,F),{expr:M}=Lr(w,C);T!==void 0&&Number.isFinite(w[T])&&(N=w[T]),B!==void 0&&Number.isFinite(w[B])&&(O=w[B]),M!==void 0&&Number.isFinite(w[M])&&(c=w[M]);let{dataContextXMinField:q,dataContextXMaxField:I,dataContextYMinField:k,dataContextYMaxField:_}=v.scatterplotAggregationFields,E=e.get(q)??Number.NaN,D=e.get(I)??Number.NaN,Y=e.get(k)??Number.NaN,J=e.get(_)??Number.NaN,R=(D-E)/100,ie=E-R,fe=Number.NaN;for(;!(fe>=Y&&fe<=J)&&ie<=D;)ie+=R,fe=N*ie+O;let ge=D+R,He=Number.NaN;for(;!(He>=Y&&He<=J)&&ge>=E;)ge-=R,He=N*ge+O;d=[{[l]:ie,[u]:fe},{[l]:ge,[u]:He}]}return{r2:c,trendLinePoints:d}}function fo(t){let{data:e,chartConfig:r}=t,i=r.series[0],{x:n,y:a}=i,{r2:s,trendLinePoints:o}=v.scatterplotSeries,l=Hd({data:e,x:n,y:a});if(l!==void 0){let u=vs(l),c=Fs(u);s=u.m===0?0:xs(l,c),o=zd({x:n,y:a,trendlineXToY:c,data:e})}return{r2:s,trendLinePoints:o}}async function mo(t){let e=await _d(t),{chartConfig:r}=t,i=r.series[0],{x:n,y:a}=i,{r2:s}=v.scatterplotSeries,o=[{[n]:Number.NaN,[a]:Number.NaN},{[n]:Number.NaN,[a]:Number.NaN}],l={r2:s,trendLinePoints:o},u=!1;if(e)try{l=await Ud(t)}catch{u=!0}return(!e||u)&&(l=fo(t)),l}var Gd=50,Yd=4194304;async function Qd(t){let{layer:e,chartConfig:r,rawData:i}=t,n,a=r.series[0],{x:s,y:o}=a,{idField:l}=We(e),u=await Fr(e);if(u){let c=u.bandInfos,d=c.length===1,f=d?c?.[0].name:"";n=i.map(m=>({...d&&{[s]:m.attributes?.[f],[o]:m.attributes?.[f]},...m.attributes,[G.uniqueIdsName]:m.attributes?.[l]}))}return n??[]}async function Kd(t){let{queryObject:e,queryConfig:r,abortKey:i}=t;if(!e||!oe(e))throw new ce(pe.LayerNotSupported);return await yf({queryObject:e,queryConfig:r,imagerySkipFactor:Gd,imageryMaxPixelCount:Yd,abortKey:i})}async function Jd(t){let{chartConfig:e,queryConfig:r,queryObject:i,sortData:n,calculateTrendLine:a,errorStrings:s,abortKey:o}=t;if(!i)throw new Error("QueryObject is undefined!");let l=await Kd({queryObject:i,queryConfig:r,abortKey:o}),u=await Qd({layer:i,chartConfig:e,rawData:l});n!==!1&&gr({arrayToSort:u,sortingField:e.series[0].x,orderBy:be.Ascending});let c=new Map,{r2:d,trendLinePoints:f}=a!==!1?await mo({data:u,statsMap:c,queryConfig:r,queryObject:i,chartConfig:e,errorStrings:s}):v.scatterplotSeries;return{dataItems:u,r2:d,trendLinePoints:f}}var Xd=t=>({x:t.series[0].x,y:t.series[0].y});function ef(t){let{chartConfig:e,layer:r,selectionDataItems:i}=t,n;if(i.length>0){let{x:a,y:s}=Xd(e),o=fn(r,a),l=fn(r,s);if(o!==void 0&&l!==void 0&&o!==l){let u=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER,d=Number.MAX_SAFE_INTEGER,f=Number.MIN_SAFE_INTEGER;i.forEach(m=>{let h=m[a],g=m[s];typeof h=="number"&&(h<u&&(u=h),h>c&&(c=h)),typeof g=="number"&&(g<d&&(d=g),g>f&&(f=g))}),u!==Number.MAX_SAFE_INTEGER&&c!==Number.MIN_SAFE_INTEGER&&d!==Number.MAX_SAFE_INTEGER&&f!==Number.MIN_SAFE_INTEGER&&(n={xBandId:o,yBandId:l,pixelRanges:new Ys({xmin:u,xmax:c,ymin:d,ymax:f})})}else if(o!==void 0&&o===l){let u=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER;i.forEach(d=>{let f=d[a];typeof f=="number"&&(f<u&&(u=f),f>c&&(c=f))}),u!==Number.MAX_SAFE_INTEGER&&c!==Number.MIN_SAFE_INTEGER&&(n={bandId:o,pixelRanges:[[u,c]]})}}return n}function tf(t,e){let r=!0;if(e?.trim()){let i={};Object.entries(t).forEach(([s,o])=>{i[s.toUpperCase()]=o});let n=e.trim(),a=n.match(/^(\w+)\s+IS\s+(NOT\s+)?NULL$/iu);if(a){let[s,o,l]=a,u=i[o.toUpperCase()],c=u==null;r=l?!c:c}else{let s=n.match(/^(\w+)\s*(=|!=|<>|>|<|>=|<=)\s*(.+)$/iu);if(s){let[o,l,u,c]=s,d=l.toUpperCase();if(!(d in i))r=!1;else{let f=i[d],m=c.trim().replace(/^['"]|['"]$/gu,"");switch(typeof f=="number"?m=Number(m):typeof f=="boolean"&&(m=m.toLowerCase()==="true"),u){case"=":r=f===m;break;case"!=":case"<>":r=f!==m;break;case">":r=f>m;break;case"<":r=f<m;break;case">=":r=f>=m;break;case"<=":r=f<=m;break;default:r=!0}}}}}return r}function rf(t){let{features:e,aggregationType:r,onField:i}=t,n;if(!i)r==="count"&&(n=e.length);else switch(r){case"count":{i==="*"?n=e.length:n=e.filter(a=>a[i]!==null&&a[i]!==void 0).length;break}case"sum":{n=e.reduce((a,s)=>{let o=s[i];return a+(typeof o=="number"?o:0)},0);break}case"avg":{let a=0,s=0;e.forEach(o=>{let l=o[i];typeof l=="number"&&(a+=l,s++)}),n=s>0?a/s:0;break}case"min":{let a=e.map(s=>s[i]).filter(s=>typeof s=="number"&&s!==null&&s!==void 0);n=a.length>0?Math.min(...a):void 0;break}case"max":{let a=e.map(s=>s[i]).filter(s=>typeof s=="number"&&s!==null&&s!==void 0);n=a.length>0?Math.max(...a):void 0;break}case"percentile-continuous":{let a=[...e.map(o=>o[i]).filter(o=>typeof o=="number"&&o!==null&&o!==void 0)].sort((o,l)=>o-l),s=Math.floor(a.length/2);n=a.length%2!==0?a[s]:(a[s-1]+a[s])/2;break}}return n}function Es(t,e){let r;return t==null&&e?r={groupKey:v.nullValue,display:v.nullValue,original:null}:r={groupKey:t,display:t,original:t},r}async function nf(t){let{layer:e,geometry:r,view:i,abortKey:n,abortSignal:a}=t;e.loaded||await e.load({signal:a});let s=await Fr(e,a),o=tr(r)??e.fullExtent,l=s?.attributeTable;if(!(o instanceof Ys&&o.equals(e.fullExtent))){let u=i?new Qs({x:i.resolution,y:i.resolution,spatialReference:i.spatialReference}):void 0;l=await Ju(e,{geometry:o,pixelSize:u},{signal:a??(n!==void 0?Ot.get(n)?.signal:void 0)})}return l}async function af(t){let{chartConfig:e,queryConfig:r,queryObject:i,view:n,abortKey:a,abortSignal:s}=t,o;if(i===void 0)throw new Error("QueryObject is undefined!");let l=U(i);if(!oe(l))throw new ce(pe.LayerNotSupported);let u=await nf({layer:l,geometry:r.geometry,view:n,abortKey:a,abortSignal:s}),c=u?.features;if(!u||!c)o={valid:!1,invalidType:H.BadData};else{let d=e.series;if(!d||d.length===0||c.length===0)o={valid:!0};else{let f=r.groupByFieldsForStatistics?.[0]??"",m=d.some(y=>y.query?.fetchNullValues),h=new Map;for(let y of c){let{groupKey:p}=Es(y.attributes[f],m);p===v.nullValue&&!m||(h.has(p)||h.set(p,[]),h.get(p).push(y.attributes))}let g=[];h.forEach(y=>{let p={},F=y[0][f],{display:C,original:x}=Es(F,m);p[f]=C,p[v.xAxisField]=C,p[v.originalCategoryValue]=x,d.forEach(w=>{let N=w.query?.outStatistics?.[0];if(!N){let{name:I}=w;p[I]=y[0][I];return}let O=y,T=w.query?.where;T&&(O=y.filter(I=>tf(I,T)));let B=N.statisticType,M=N.onStatisticField,q=N.outStatisticFieldName;p[q]=rf({features:O,aggregationType:B,onField:M})}),g.push(p)}),o={valid:!0,data:{dataItems:g}}}}return o}async function Lg(t){let{layer:e,category:r,splitByField:i}=t,n=(await Fr(e))?.attributeTable?.features,a=i!==void 0;return Array.from(new Set(n?.map(s=>s.attributes[a?i:r]))).sort((s,o)=>typeof s=="string"&&typeof o=="string"?s.localeCompare(o):Number(s)-Number(o))}function sf(t,e){let r=new Map;return e.forEach((i,n)=>{r.set(i,n)}),t.reduce((i,n)=>{let a=i[i.length-1];if(!a)return i.push([n,n]),i;if(n===a[1])return i;let s=r.get(n),o=r.get(a[1]);return s!==void 0&&o!==void 0&&s===o+1?(a[1]=n,i):(i.push([n,n]),i)},[])}function of(t,e){return t?.map(({attributes:r})=>r[e]).filter(r=>r!=null).sort((r,i)=>r-i)}function lf(t){let{chartConfig:e,layer:r,selectionDataItems:i}=t,n,a=r.serviceRasterInfo?.attributeTable,s=e.series?.[0]?.x,o=a?.features,l=a?.fields?.find(({name:u})=>u.toLowerCase()==="value")?.name;if(i.length>0&&s&&o&&o.length>0&&l){let u=new Set(i.map(c=>c[s]).filter(c=>c!==void 0));if(u.size>0){let c=new Set;o.forEach(f=>{let m=f.attributes,h=m[s];u.has(h)&&c.add(m[l])});let d=Array.from(c).sort((f,m)=>f-m);if(d.length>0){let f=of(o,l);n={bandId:0,pixelRanges:sf(d,f)}}}}return n}var ho="PixelID",uf="Pixel ID",cf=[S.BarSeries,S.HistogramSeries,S.ScatterSeries];async function qg(t){let e=!1,{config:r,layer:i,abortSignal:n}=t;if(Wn(cf,r))switch(Z(r?.series)){case S.BarSeries:i.loaded||await i.load({signal:n}),e=!!(await Fr(i,n))?.attributeTable;break;case S.HistogramSeries:case S.ScatterSeries:e=!0;break}return e}async function df(t){let{layer:e,chartConfig:r}=t,i;return oe(e)?i=e:r?.iLayer?.layerType==="ArcGISImageServiceLayer"?i=await go(r.iLayer):r?.iLayer?.layerType==="ArcGISTiledImageServiceLayer"&&(i=await po(r.iLayer)),i}function ff(t){let e;switch(t){case"f32":e=Q.Single;break;case"f64":e=Q.Double;break;default:e=Q.Integer;break}return e}function yo(t){if(!t.loaded)throw new Error("Raster layer must be loaded to get its ID field name");let e=oi(t)?.attributeTable?.fields.find(r=>r.type==="oid");return e?e.name:ho}function mf(t){let{layer:e,rasterInfo:r,popupTemplateFieldInfosEnabled:i}=t;if(!e.loaded)throw new Error("Raster layer must be loaded to get its fields info");let n=r??oi(e);if(!n)throw new Error("Raster info must be provided or generated beforehand to get raster layer fields info");let a;try{if(n.attributeTable)a=n.attributeTable.fields.map(s=>s.toJSON());else{let s=ff(n.pixelType),o=n.bandInfos.map(l=>({name:l.name,alias:l.name,type:s}));i&&e?.popupTemplate?.fieldInfos!==void 0&&o.map(l=>{let u=e.popupTemplate?.fieldInfos?.find(c=>c.fieldName?.toLowerCase()===l.name.toLowerCase())?.label;return u&&u!==l.name&&(l.alias=u),l}),a=[{name:ho,alias:uf,type:Q.OID},...o]}}catch{a=[]}return a}async function Fr(t,e){return t.loaded||await t.load({signal:e}),Zn(t)?oi(t)??void 0:await t.generateRasterInfo(t.rasterFunction,{signal:e})}var go=rr(async(t,e)=>{let r={},i=t.layerDefinition;r.definitionExpression=i?.definitionExpression,r.id=t.id,t.url!==void 0&&(r.url=t.url),t.itemId!==void 0&&t.layerDefinition?.id!==void 0&&(r.portalItem={id:t.itemId});let n=new ec(r);return await ui(n,e),n},t=>JSON.stringify(t,Object.keys(t).sort())),po=rr(async(t,e)=>{let r={};r.id=t.id,t.url!==void 0&&(r.url=t.url),t.itemId!==void 0&&(r.portalItem={id:t.itemId});let i=new tc(r);return await ui(i,e),i},t=>JSON.stringify(t,Object.keys(t).sort())),hf=rr(async(t,e)=>{let r={};r.id=t.id,t.url!==void 0&&(r.url=t.url),t.itemId!==void 0&&(r.portalItem={id:t.itemId});let i=new rc(r);return await ui(i,e),i},t=>JSON.stringify(t,Object.keys(t).sort())),fn=(t,e)=>{let r=-1;if(!t.loaded)throw new Error("Raster layer must be loaded to get its band ID by name");let i=oi(t)?.bandInfos;if(i?.length===1)r=0;else if(e&&i?.length){let n=e.toLowerCase(),a=i.findIndex(s=>s.name.toLowerCase()===n);a>-1&&(r=a)}return r},Dg=t=>{let{chartConfig:e,layer:r,selectionDataItems:i}=t,n=Z(e.series),a;switch(n){case S.BarSeries:a=lf({chartConfig:e,layer:r,selectionDataItems:i});break;case S.HistogramSeries:a=Ed({chartConfig:e,layer:r,selectionDataItems:i});break;case S.ScatterSeries:a=ef({chartConfig:e,layer:r,selectionDataItems:i});break;default:a=void 0;break}return a};async function yf(t){let{queryObject:e,queryConfig:r,imagerySkipFactor:i,imageryMaxPixelCount:n,abortKey:a}=t,s=[];if(e!==void 0)try{let o=a&&Ot.get(a)?.signal||void 0,l=U(e);l.loaded||await ui(l,o);let u={geometry:tr(r.geometry)??l.fullExtent,autoResample:!0,maxPixelCount:n,skipFactor:i},c=await Xu(l,u,{signal:o});s=Gs.fromJSON(c.featureSet).features}catch{s=[]}return s}function gf(t){let{queryObject:e,defaultGeometry:r,ignoreViewExtent:i,viewExtent:n}=t,a=r;if(!i&&n){let{xmin:s,xmax:o,ymin:l,ymax:u,zmin:c,zmax:d}=n;a={xmin:s,ymin:l,zmin:c,xmax:o,ymax:u,zmax:d,spatialReference:n.spatialReference.toJSON()}}else if(!a&&e.fullExtent){let{xmin:s,xmax:o,ymin:l,ymax:u,zmin:c,zmax:d}=e.fullExtent;a={xmin:s,ymin:l,zmin:c,xmax:o,ymax:u,zmax:d,spatialReference:e.fullExtent.spatialReference.toJSON()}}return a}function pf(t){let e,r,i;return t!==void 0&&(e=t.type,(e===me.UniqueValue||e===me.ClassBreaks)&&(r=t.field??void 0,e===me.ClassBreaks&&(i=t.normalizationField??void 0))),{rendererType:e,rendererField:r,rendererNormalizationField:i}}var So=rr(async(t,e)=>{let r=t.featureCollection,i,n;if(r?.layers?.[0]!==void 0){let o=r.layers[0];i=o.featureSet,n=o.layerDefinition}else n=t.layerDefinition;let a={};if(i!==void 0){if(a.source=Gs.fromJSON(i).features,n?.fields!==void 0&&(a.fields=n.fields.map(o=>Hu.fromJSON(o))),n?.objectIdField!==void 0&&(a.objectIdField=n.objectIdField),n?.geometryType!==void 0){let o=pn.fromJSON({geometryType:n.geometryType});o?.type!==void 0&&o?.type!=="extent"&&(a.geometryType=o.type)}n?.spatialReference!==void 0&&(a.spatialReference=n.spatialReference)}else a.id=t.id,n?.id!==void 0&&(a.layerId=n.id),t.url!==void 0&&(a.url=t.url),t.itemId!==void 0&&n?.id!==void 0&&(a.portalItem={id:t.itemId});if(n!==void 0){let o=n.drawingInfo;o?.renderer!==void 0&&(a.renderer=Sn.fromJSON(o.renderer))}let s=new _u(a);return await s.load({signal:e}),s},t=>JSON.stringify(t));async function Pg(t,e){let r;switch(t?.layerType??""){case"ArcGISFeatureLayer":r=await So(t,e);break;case"ArcGISImageServiceLayer":r=await go(t,e);break;case"ArcGISTiledImageServiceLayer":r=await po(t,e);break;case"WCS":r=await hf(t,e);break;default:throw new ce(pe.LayerNotSupported)}return r}async function kg(t){let{layer:e,view:r,chartConfig:i,filterByViewExtent:n,abortSignal:a}=t,s=oe(e)||_n(i),o;if(s)o=await df(t);else{let l=U(e),u=Be(l);u!==void 0?n&&r!==void 0&&!u.isTable?(u.outFields=["*"],o=await r.whenLayerView(u)):o=e:i?.iLayer&&i.iLayer?.layerType==="ArcGISFeatureLayer"&&(o=await So(i.iLayer,a))}return o}function Re(t,e){let r=U(t),i=[];if(r!==void 0){let n=e===!0&&r?.popupTemplate?.fieldInfos!==void 0;oe(r)?i=mf({layer:r,popupTemplateFieldInfosEnabled:e}):i=r.fields.map(a=>{let s=a.toJSON();if(n){let o=r.popupTemplate?.fieldInfos?.find(l=>l.fieldName?.toLowerCase()===a.name.toLowerCase())?.label;o!==void 0&&o!==a.name&&(s.alias=o)}return s})}return i}function Vg(t,e=[]){return e.find(r=>r.name===t)}function li(t){let e,r=!1;if(oe(t))e=[yo(t)];else{let i=Be(t);i&&("uniqueIdFields"in i&&i.uniqueIdFields&&i.uniqueIdFields.length>0?e=i.uniqueIdFields:(e=[i.objectIdField],r=!0))}return{idFields:e,isTraditionalTypeOID:r}}function We(t){let e="",r=!1;if(oe(t))e=yo(t);else if(t){let i=li(t);r=i.isTraditionalTypeOID,i.idFields&&(e=i.idFields[0])}return{idField:e,isTraditionalTypeOID:r}}function Sr(t){let e=[Q.Single,Q.Double,Q.SmallInteger,Q.Integer,Q.BigInteger];return t!==void 0&&e.includes(t.type)}function Sf(t){return t?.type===Q.Date||t?.type===Q.DateOnly||t?.type===Q.TimestampOffset}function $g(t){return t?.type===Q.String}function Rg(t){return t?.type===Q.TimeOnly}function Wg(t){let e=[Q.SmallInteger,Q.Integer,Q.BigInteger];return t!==void 0&&e.includes(t.type)}function bf(t){return t.filter(e=>Sf(e)).map(e=>e.name)}function jg(t){return t.filter(e=>Sr(e)).map(e=>e.name)}function mn(t,e){let r;if(e){let i=U(t).getFieldDomain(e);i instanceof zu&&(r=i)}return r}function hn(t,e){let r=e?.getName(t?.toString())??e?.getName(t)??e?.getName(Number(t));return r===null&&(r=void 0),r}function As(t){let{queryObject:e,fieldName:r,fieldValue:i}=t;return oe(e)?void 0:hn(i,mn(e,r))}async function bo(t){let e=[];return t&&!Be(t)?.isTable&&t.fieldsIndex&&(e=await Us.getRendererFields(t.renderer,t.fieldsIndex)),e}function vf(t){let e="/rest/services",r=t.toLowerCase(),i=r.indexOf(e);return r=i>-1?t.substring(0,i):t,`${r}/rest/info`}async function Ff(t,e){let r=!0,i=".arcgis.com/",n=t?.url,a=n?.includes(i);if(n&&a&&Be(t)?.sourceJSON?.serviceItemId!==void 0){let s=vf(n);try{let o=(await ti(s,{query:{f:"json"},signal:e})).data;if(o.owningTenant!==void 0&&o.owningSystemUrl!==void 0){let l=`${o.owningSystemUrl}/sharing/rest/portals/${o.owningTenant}`,u=(await ti(l,{authMode:"auto",query:{f:"json"},signal:e})).data,c=new Uu({sourceJSON:u});await c.load({signal:e}),r=c?.sourceJSON?.subscriptionInfo?.dataStoreLevel===void 0}}catch{}}return r}function xf(t){let{queryObject:e,fieldToMatch:r,returnUndefinedIfNotFound:i}=t,n=Re(e),a=Cf(n,r),s=i?"":r;return a?.name??s}function Cf(t,e){let r=t.find(i=>e===i.name);return r||(r=t.find(i=>e.toUpperCase()===i.name.toUpperCase())),r}function Zg(t){let{fieldsList:e,queryObject:r,returnUndefinedIfNotFound:i}=t,n=e;return n!==void 0&&(n=n.map(a=>xf({queryObject:r,fieldToMatch:a,returnUndefinedIfNotFound:i}))),n}function vo(t){let{queryObject:e,chartConfig:r,runtimeDataFilters:i,ignoreViewExtent:n,viewExtent:a}=t,{series:s,dataFilters:o}=r,{where:l,gdbVersion:u,timeExtent:c,geometry:d,distance:f,units:m,objectIds:h,spatialRelationship:g}=o??{},{where:y,gdbVersion:p,timeExtent:F,geometry:C,distance:x,units:w,objectIds:N,spatialRelationship:O}=i??{},T=s[0],{query:B}=T,{where:M}=B??{},q=W(s),I={...B};return I.where=ee([l,y]),q!==b.BarAndLineSplitBy&&q!==b.BoxPlotMonoFieldAndSplitBy&&q!==b.BoxPlotMonoFieldAndCategoryAndSplitBy&&q!==b.BoxPlotMultiFieldsAndSplitBy&&q!==b.BarAndLineSplitByNoAggregation&&(I.where=ee([I.where,M])),r.orderOptions?.orderByFields!==void 0&&(I.orderByFields=r.orderOptions.orderByFields),I.gdbVersion=p??u,I.timeExtent=Tf(e,F??c),I.geometry=oe(e)?gf({queryObject:e,defaultGeometry:C??d,ignoreViewExtent:n,viewExtent:a}):Of({queryObject:e,defaultGeometry:C??d,ignoreViewExtent:n}),I.distance=x??f,I.units=w??m,I.objectIds=N??h,I.spatialRelationship=O??g,B?.outStatistics?.[0]?.statisticType===A.Count&&(I.returnDistinctValues=B?.returnDistinctValues??!1),I?.outStatistics?.forEach(k=>{Fn(k)&&!("statisticParameters"in k)&&(k.statisticParameters={value:G.defaultStatParameterValue})}),I}var wf=t=>{let e;if("portalItem"in t){let r=t.portalItem?.id;typeof r=="string"&&(e=r)}return e};function _g(t){let{view:e,portalItemId:r}=t,i;if(e&&r){let n=Array.from(e.map?.allLayers??[]).find(a=>wf(a)===r);n&&(i=n)}return i}async function ui(t,e){await t.load({signal:e}),(Ci(t)||wi(t))&&await t.generateRasterInfo(t.rasterFunction,{signal:e})}function Nf(t){let e=!t.geometry||t.geometry.type==="extent",r=(t.where??"").toUpperCase(),i=!r.includes("CURRENT_TIMESTAMP")&&!r.includes("CURRENT_DATE")&&!r.includes("CURRENT_TIME");return e&&i}function Fo(t){let e=G.maxRecords;if(t&&"sourceJSON"in t&&t.sourceJSON?.maxRecordCount){let{sourceJSON:r}=t;e=r.maxRecordCount,r.advancedQueryCapabilities?.supportsMaxRecordCountFactor===!0&&(e*=G.maxRecordCountFactor)}return e}function ee(t,e){let r,i=Array.from(new Set(t)).filter(n=>n!=null&&n!==""&&!ut(n));return i.sort((n,a)=>a.length-n.length),i.length===1?[r]=i:i?.forEach(n=>{n!==void 0&&(he(r)?r=`(${n})`:r?.includes(`(${n})`)||(r=`${r} ${e??"AND"} (${n})`))}),r??"1=1"}function Tf(t,e){let r=e;if(t!==void 0){let i=U(t),n=Be(i)?.timeExtent;n?.start!=null&&n?.end!=null&&(r=[n.start.valueOf(),n.end.valueOf()])}return r}function Of(t){let{queryObject:e,defaultGeometry:r,ignoreViewExtent:i}=t,n=r;if(!i&&ct(e)){let a=e.view.extent,{xmin:s,xmax:o,ymin:l,ymax:u,zmin:c,zmax:d}=a;n={xmin:s,ymin:l,zmin:c,xmax:o,ymax:u,zmax:d,spatialReference:a.spatialReference.toJSON()}}return n}function tr(t){let e;return t!==void 0&&(e=pn.fromJSON(t)),e}function Bf(t){return t===void 0?["*"]:Array.from(new Set(t))}function ci(t){let{queryType:e,queryObject:r,queryConfig:i,view:n,configTimeZone:a,dateField:s,useViewTimeZone:o}=t,{where:l,outStatistics:u,geometry:c,distance:d,units:f,timeExtent:m,returnDistinctValues:h}=i??{},g=U(r),y=Be(g)?.createQuery()??new Wu,p,F=li(g).idFields;if(e==="AttributeBinsQuery"&&i?.objectIds?.[0]!==void 0&&F&&(p=`${F} IN (${i.objectIds.join(",")})`),e==="AttributeBinsQuery"&&(y=new Ru(y.toJSON()),Re(r).find(x=>x.name===s)?.type!==Q.DateOnly)){let x=Intl.DateTimeFormat().resolvedOptions().timeZone,w=o&&n&&"timeZone"in n?n.timeZone:void 0,N=a??w??x;N==="unknown"?N="Etc/UTC":N==="system"&&(N=x),y.outTimeZone=N}if(y.where=ee([y.where,l,p]),"returnDistinctValues"in y&&(y.returnDistinctValues=h??!1),u!==void 0){let x=Sc(g);y.outStatistics=u.filter(w=>w.statisticType!==A.EnvelopeAggregate||x).map(w=>ju.fromJSON(w))}let C=tr(c);return C!==void 0&&(y.geometry=C,i?.spatialRelationship&&(y.spatialRelationship=i.spatialRelationship),Xs(g)&&(d!==void 0&&(y.distance=d),f!==void 0&&(y.units=f))),m&&(y.timeExtent=new Zu({start:m?.[0],end:m?.[1]})),Nf(y)&&(y.cacheHint=!0),y}function Mf(t){let e;switch(t){case ae.Start:e="first";break;case ae.End:e="last";break}return e}function If(t){let{queryObject:e,queryConfig:r,temporalBinning:i,dateField:n,splitByField:a,axisTimeZone:s,view:o,syncViewTimeZone:l}=t,{unit:u,size:c,timeAggregationType:d,start:f,end:m,offset:h,outTimeZone:g}=i,y=U(e),p=ci({queryType:"AttributeBinsQuery",queryObject:e,queryConfig:r,configTimeZone:g??s,view:o,dateField:n,useViewTimeZone:l??!1}),F=co(n);if(p.lowerBoundaryAlias=F.lowerBoundaryAlias,p.upperBoundaryAlias=F.upperBoundaryAlias,p.binParameters={type:"date",field:n,interval:{unit:u,value:c},start:f,end:m,offset:h?{unit:h.unit,value:h.size}:null},p.binParameters.type==="date"&&(y?.capabilities?.queryAttributeBins?.supportsSnapToData&&(p.binParameters.snapToData=Mf(d)),y?.capabilities?.queryAttributeBins?.supportsReturnFullIntervalBin&&(p.binParameters.returnFullIntervalBin=!0)),!he(a)){let C=Be(y)?.fields.find(x=>x.name===a)?.type;(!C||C==="string"||C==="integer"||C==="small-integer"||C==="big-integer"||C==="double")&&(p.binParameters.stackBy={type:"field",value:a,valueType:C==="string"?"string":"integer"})}return p}function Cn(t){let{field:e,fieldType:r,unit:i,outTimeZone:n,dataTimeZone:a,runsOnClientQueryEngine:s,addIntervalStatement:o,addLeapDayExpression:l}=t,u,c,d=1,f=1;switch(i){case Ce.MinuteOfDay:r!==Q.DateOnly&&(c="MINUTE",d=0,f=59);break;case Ce.HourOfDay:r!==Q.DateOnly&&(c="HOUR",d=0,f=23);break;case Ce.DayOfWeek:c="DOW",f=7;break;case Ce.DayOfMonth:c="DAY",f=31;break;case Ce.DayOfYear:c="DOY",f=366;break;case Ce.WeekOfYear:c="WEEK",f=53;break;case Ce.MonthOfYear:c="MONTH",f=12;break;case Ce.QuarterOfYear:c="QUARTER",f=4;break}if(c){let m=o?` ${so({dataTimeZone:a,runsOnClientQueryEngine:s,outTimeZone:n})}`:"";u=Ef({addLeapDayExpression:l,temporalKey:c,field:e,intervalStatement:m})}return{expression:u,start:d,end:f}}function Ef(t){let{addLeapDayExpression:e=!1,temporalKey:r,field:i,intervalStatement:n}=t,a;return e&&i.length&&r==="DAY"?a=`CASE WHEN (EXTRACT(MONTH FROM ${i})=2 AND EXTRACT(DAY FROM ${i})=29) THEN 0 ELSE EXTRACT (${r} FROM ${i}${n}) END`:a=`EXTRACT (${r} FROM ${i}${n})`,a}function Ls(t){let{temporalBinning:e,xOrY:r,xOrYFieldType:i,addIntervalStatement:n,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o,includeLeapDay:l}=t,{unit:u}=e??{},c,d,f,m;return i===Q.Date||i===Q.DateOnly||i===Q.TimestampOffset?{expression:d,start:f,end:m}=Cn({field:r,fieldType:i,unit:u,addIntervalStatement:n,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o,addLeapDayExpression:!l}):c=r,{field:c,expression:d,start:f,end:m}}function Af(t){let{queryObject:e,queryConfig:r,x:i,y:n,xTemporalBinning:a,yTemporalBinning:s,firstDayOfWeek:o,includeLeapDay:l,configTimeZone:u,view:c,syncViewTimeZone:d}=t,f=Re(e),m=f.find(N=>N.name===i)?.type,h=f.find(N=>N.name===n)?.type,g=ci({queryType:"AttributeBinsQuery",queryObject:e,queryConfig:r,configTimeZone:u,view:c,dateField:i,useViewTimeZone:d??!1});g.binParameters={type:"fixed-interval",interval:1},g.lowerBoundaryAlias=G.heatChartLowerBoundaryAlias,g.upperBoundaryAlias=G.heatChartUpperBoundaryAlias,o!==void 0&&(g.binParameters.firstDayOfWeek=o);let y=Ls({temporalBinning:a,xOrY:i,xOrYFieldType:m,addIntervalStatement:!1,includeLeapDay:l}),{field:p,expression:F,start:C,end:x}=y;p?g.binParameters.field=p:F&&(g.binParameters.expression=F,g.binParameters.expressionValueType="integer",g.binParameters.type==="fixed-interval"&&(C!==void 0&&(g.binParameters.start=C),x!==void 0&&(g.binParameters.end=x)));let w=Ls({temporalBinning:s,xOrY:n,xOrYFieldType:h,addIntervalStatement:!1,includeLeapDay:l});return w.field?g.binParameters.stackBy={type:"field",value:w.field}:w.expression&&(g.binParameters.stackBy={type:"expression",value:w.expression,valueType:"integer",alias:n}),g}function Lf(t){let{queryObject:e,queryConfig:r,xStep:i,xMin:n,xMax:a,x:s,y:o,yStep:l}=t,u=ci({queryType:"AttributeBinsQuery",queryObject:e,queryConfig:r,useViewTimeZone:!1}),c=lo(s,o);return u.lowerBoundaryAlias=c.lowerBoundaryAlias,u.upperBoundaryAlias=c.upperBoundaryAlias,u.binParameters={type:"fixed-interval",field:s,interval:i,start:n,end:a,stackBy:{value:`FLOOR(${o} / ${l})`,type:"expression",alias:c.stackAlias,valueType:"integer"}},u}function wn(t){let{queryObject:e,queryConfig:r,maxRecordCountFactor:i}=t,{groupByFieldsForStatistics:n,orderByFields:a,gdbVersion:s,start:o,num:l,outFields:u}=r??{},c=ci({queryType:"Query",queryObject:e,queryConfig:r,useViewTimeZone:!1});c.returnGeometry=!1;let d=U(e);return c.outFields=Bf(u),c.groupByFieldsForStatistics=n??c.groupByFieldsForStatistics,c.orderByFields=a??[],c.objectIds=r?.objectIds,i!==void 0&&(c.maxRecordCountFactor=i),s!==void 0&&s!==""&&(c.gdbVersion=s),l!==void 0&&(c.num=l),o!==void 0&&(c.start=o,c.num=c.num??Fo(d)),c}function qf(t){return t&&"sourceJSON"in t&&t.sourceJSON?.advancedQueryCapabilities?.supportsMaxRecordCountFactor===!0?G.maxRecordCountFactor:void 0}function Df(t=re.None,e){return t===re.None||t===re.Log&&e>0||t===re.Sqrt&&e>=0}function xo(t,e){let r={valid:!1};return e===!0?r.invalidType=H.HistogramEmptyField:t===re.Log?r.invalidType=H.NegativeValueInLogCalculation:t===re.Sqrt&&(r.invalidType=H.NegativeValueInSqrtCalculation),r}function Pf(t,e){let r=t;switch(e){case re.Log:r=Math.log(t);break;case re.Sqrt:r=Math.sqrt(t);break}return r}function kf(t){let e=t;if(t){let r=t.toString().split(".");if(r[1]!==void 0){let i=10**-r[1].length;e=t-i}}return e}function Co(t){let e="field";switch(t){case re.Log:e="natural-log";break;case re.Sqrt:e="square-root";break;case re.None:}return e}async function Vf(t){let{queryObject:e,fieldName:r,queryConfig:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o=U(e),{idField:l,isTraditionalTypeOID:u}=We(o),c=u?l:"*",d=`${A.Count}_${l}`,f=`${A.Count}_${r}`,m=`${A.Minimum}_${r}`,h=`${A.Maximum}_${r}`,g={...i,outStatistics:[{statisticType:A.Count,onStatisticField:c,outStatisticFieldName:d},{statisticType:A.Count,onStatisticField:r,outStatisticFieldName:f},{statisticType:A.Minimum,onStatisticField:r,outStatisticFieldName:m},{statisticType:A.Maximum,onStatisticField:r,outStatisticFieldName:h}]},y=await vr({queryObject:e,queryConfig:g,errorStrings:n,abortKey:a,abortSignal:s}),p=y.get(d)??Number.NaN,F=y.get(f)??Number.NaN,C=y.get(m)??Number.NaN,x=y.get(h)??Number.NaN;return{countExcludingNulls:F,countIncludingNulls:p,min:C,max:x}}async function $f(t){let{queryConfig:e,chartConfig:r,queryObject:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o=r.series[0],{x:l,dataTransformationType:u}=o,c=[],{countIncludingNulls:d,countExcludingNulls:f,min:m,max:h}=await Vf({queryObject:i,queryConfig:e,fieldName:l,errorStrings:n,abortKey:a,abortSignal:s}),g=Df(u,m),y=f<2||m===h,p={...e};return p.where=ee([p.where,`${l} is not null`]),{rawData:c,dataCompatibleWithTransformation:g,dataCountIncompatible:y,countExcludingNulls:f,countIncludingNulls:d}}function Rf(t){let e={...t};return e.avg=e.avg??Number.NaN,e.count=e.count??Number.NaN,e.max=e.max??Number.NaN,e.min=e.min??Number.NaN,e.stddev=e.stddev??Number.NaN,e.sum=e.sum??Number.NaN,e.variance=e.variance??Number.NaN,e.median=e.median??Number.NaN,e}function Wf(t){let{seriesConfig:e,layer:r,useFeaturesInView:i,view:n,queryConfig:a,abortSignal:s}=t,{x:o,dataTransformationType:l}=e,u={layer:r,view:n,field:o,sqlWhere:ut(a.where)?void 0:a.where,useFeaturesInView:i,signal:s};return l!==re.None&&(u={...u,normalizationType:Co(l)}),u}function jf(t){let{seriesConfig:e,layer:r,useFeaturesInView:i,view:n,minValue:a,maxValue:s,queryConfig:o,abortSignal:l}=t,{x:u,binCount:c,dataTransformationType:d}=e,f={layer:r,view:n,field:u,minValue:a,maxValue:s,numBins:c??kn,classificationMethod:"equal-interval",sqlWhere:ut(o.where)?void 0:o.where,useFeaturesInView:i,signal:l};return d!==re.None&&(f={...f,normalizationType:Co(d)}),f}function Zf(t,e){let r=Number.NaN;return t!==void 0&&e!==void 0&&(r=t-e),r}async function _f(t){let{chartConfig:e,queryConfig:r,queryObject:i,countExcludingNulls:n,countIncludingNulls:a,view:s,errorStrings:o,abortSignal:l}=t,u=e.series[0],{dataTransformationType:c}=u,d={valid:!0},f=U(i),m=tr(r?.geometry)?.extent?.toJSON()!==void 0,h=s,g=Wf({seriesConfig:u,layer:f,view:h,useFeaturesInView:m,queryConfig:r,abortSignal:l}),y;if(h!==void 0&&(y=new Ns({geometry:h.extent}),h.extent!==void 0&&Xs(f))){let{distance:B,units:M}=r;B!==void 0&&(y.distance=B),M!==void 0&&(y.units=M)}if(r.timeExtent){let B={start:r.timeExtent[0],end:r.timeExtent[1]};y===void 0?y=new Ns({timeExtent:B}):y.timeExtent=B}g.filter=y;let p;g.outStatisticTypes={exclude:["median"]};try{p=await Ts(g)}catch(B){throw new ce(pe.QueryFeaturesError,o.errors.queryError,B)}g.outStatisticTypes={include:["median"]};try{let B=await Ts(g);B?.median&&(p.median=B.median)}catch{}p=Rf(p);let{avg:F,count:C,stddev:x,min:w,max:N,sum:O,median:T}=p;if(C===0)d={...xo(c)};else{let B=jf({seriesConfig:u,layer:f,view:h,useFeaturesInView:m,minValue:kf(w),maxValue:N,valueExpression:g.valueExpression,queryConfig:r,abortSignal:l});B.filter=y;let M;try{M=await $u(B)}catch(I){throw new ce(pe.QueryFeaturesError,o.errors.queryError,I)}let q=Zf(a,n);d.data={mean:F,stddev:x,min:w,max:N,median:Number(T),bins:M?.bins,count:n,nulls:q,sum:O??void 0},d.data.bins.length>0&&(d.data.bins[d.data.bins.length-1].isLastBin=!0)}return d}async function wo(t){let{chartConfig:e,queryConfig:r,queryObject:i,abortKey:n,abortSignal:a,errorStrings:s,view:o}=t,{series:l}=e,u=l[0],c;if(oe(i))c=await Md(t);else{let{rawData:d,dataCompatibleWithTransformation:f,dataCountIncompatible:m,countIncludingNulls:h,countExcludingNulls:g}=await $f({queryObject:i,chartConfig:e,queryConfig:r,errorStrings:s,abortKey:n,abortSignal:a});c={valid:!0},!f||m?c=xo(u.dataTransformationType,m):c=await _f({chartConfig:e,queryObject:i,queryConfig:r,countIncludingNulls:h,countExcludingNulls:g,view:o,abortSignal:a,errorStrings:s})}return c}async function zf(t){let{queryObject:e,queryConfig:r,chartConfig:i,x:n,errorStrings:a}=t,{series:s}=i,{dataTransformationType:o}=s[0],l={...r,orderByFields:[n],outFields:[n]};return{valid:!0,data:{dataItems:(await Le({queryObject:e,queryConfig:l,errorStrings:a})).map(u=>({[n]:Pf(u.attributes[n],o)}))}}}var qs={Count:"count",Start:"minValue",End:"maxValue"},Bt={groupByCaseBegin:"CASE",groupByOutKeyword:"OUT",groupByCaseEnd:"ELSE 'OUT' END"};function zg(t){return Z(t.series)!==S.BoxPlotSeries?v.xAxisField:t.series[0].x}function Hg(t){let e=Ir(t);return e===qe.Stacked||e===qe.Stacked100}function Ug(t,e){let r=[],i=new Map,n=new Map;return t.forEach((a,s)=>n.set(a.id,s)),e.forEach((a,s)=>{let o=n.get(a.id);if(o!==void 0){let l=new Set;for(;i.has(o)&&!l.has(o);)l.add(o),o=i.get(o)??o;o!==s&&(r.push([o,s]),i.set(s,o))}}),r}function Hf(t){let e={...t};return t.showMean===!0&&(e.series=[e.series[0]],e.series[0].query?.where!==void 0&&delete e.series[0].query.where),e}function Uf(t){return Tt(t)&&Ke(t?.axes?.[0]?.valueFormat)&&Ke(t?.axes?.[1]?.valueFormat)}var Gf=[...hi,"ar-u-nu-latn","en-AU","en-GB","es-ES","es-MX","de-CH","de-DE","de-AT","fr-CA","it-CH","it-IT"];function Gg(t){let{t9nLocale:e}=et(t??document.documentElement),r=No(t??document.documentElement),i=En(t??document.documentElement)==="rtl";return{locale:e,formatLocale:r,rtl:i}}function Yg(t){let e;return t==="unknown"?e="UTC":t!==void 0&&t!=="system"&&(e=t),e}function Qg(t,e){let r={year:"numeric",month:"2-digit",day:"2-digit",timeZone:e};return new Intl.DateTimeFormat("en-CA",r).format(t)}function Kg(t,e){let r={hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:e};return new Intl.DateTimeFormat("en-US",r).format(t)}function Jg(t,e){let[,r,,,,i]=1111.1.toLocaleString(e),n=t.replace(r,"").replace(i,".");return Number.parseFloat(n)}function Yf(t){let e=Array.from(hi);return Gf.includes(t)&&!e.includes(t)}function No(t){let{lang:e,t9nLocale:r}=et(t);return Yf(e)?e:r}function ai(t){let{dataInfo:e,chartType:r,subError:i}=t;switch(e.valid=!1,r){case S.BarSeries:case S.ComboLineAndBarSeries:e.invalidType=H.BarElementExceedsLimit;break;case S.LineSeries:e.invalidType=H.LineChartExceedsLimit;break;case S.PieSeries:e.invalidType=H.PieChartExceedsLimit;break;case S.GaugeSeries:e.invalidType=H.GaugeExceedsLimit;break;case S.BoxPlotSeries:i?.outlierLimit===!0?e.invalidType=H.BoxPlotOutliersExceedsLimit:e.invalidType=H.BoxPlotExceedsLimit;break;case S.HeatSeries:e.invalidType=H.HeatChartExceedsLimit;break}}function Qf(t,e){t.valid=!1,t.invalidType=e}function Xg(t){let{invalidType:e,chartLimits:r,elementCount:i,seriesCount:n,queryObject:a,filterBySelection:s,formatLocale:o=No(document.documentElement),isTemporalChart:l,isGaugeChartByFeature:u,errorStrings:c}=t,d=c.errors.defaultInvalidChart,f,m=new Intl.NumberFormat(o),h=bt(r),{maxCategoryCount:g}=h,y=c.modalHeaders.invalidChart;switch(e){case H.BarElementExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=Number.NaN,F=Number.NaN,C="";n!==void 0&&(n<=h.maxBarChartSeriesCount?n===1?(C=c.errors.uniqueSeriesBarCountCannotExceedLimit,p=h.maxBarUniqueSeriesCountTotal):n===2?(C=c.errors.twoSeriesBarCountCannotExceedLimit,p=h.maxBarTwoSeriesCountTotal,F=h.maxBarTwoSeriesCountPerSeries):n>2&&(C=c.errors.threePlusSeriesBarCountCannotExceedLimit,p=h.maxBarThreePlusSeriesCountTotal,F=h.maxBarThreePlusSeriesCountPerSeries):(C=c.errors.barSeriesCountCannotExceedLimit,F=h.maxBarChartSeriesCount));let x=m.format(p),w=m.format(F),N=i!==void 0?m.format(i):"";d=_e(C,{totalLimit:x,seriesLimit:w,elementCount:N}),f={actualCount:i??Number.NaN,totalLimit:p,seriesLimit:F};break}case H.LineChartExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=Number.NaN,F=Number.NaN,C="";n!==void 0&&(n<=h.maxLineChartSeriesCount?n===1?(C=l?c.errors.uniqueTemporalSeriesLineCountCannotExceedLimit:c.errors.uniqueSeriesLineCountCannotExceedLimit,p=h.maxLineUniqueSeriesCountTotal):n===2?(C=l?c.errors.twoTemporalSeriesLineCountCannotExceedLimit:c.errors.twoSeriesLineCountCannotExceedLimit,p=h.maxLineTwoSeriesCountTotal,F=h.maxLineTwoSeriesCountPerSeries):n>2&&(C=l?c.errors.threePlusTemporalSeriesLineCountCannotExceedLimit:c.errors.threePlusSeriesLineCountCannotExceedLimit,p=h.maxLineThreePlusSeriesCountTotal,F=h.maxLineThreePlusSeriesCountPerSeries):(C=c.errors.lineSeriesCountCannotExceedLimit,F=h.maxLineChartSeriesCount));let x=m.format(p),w=m.format(F),N=i!==void 0?m.format(i):"";d=_e(C,{elementCount:N,seriesLimit:w,totalLimit:x}),f={actualCount:i??Number.NaN,totalLimit:p,seriesLimit:F}}break;case H.BoxPlotExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=Number.NaN,F=Number.NaN,C="";n!==void 0&&(n<=h.maxBoxPlotSeriesCount?n===1?(C=c.errors.uniqueSeriesBoxCountCannotExceedLimit,p=h.maxBoxUniqueSeriesCountTotal):n===2?(C=c.errors.twoSeriesBoxCountCannotExceedLimit,p=h.maxBoxTwoSeriesCountTotal,F=h.maxBoxTwoSeriesCountPerSeries):n>2&&(C=c.errors.threePlusBoxLineCountCannotExceedLimit,p=h.maxBoxThreePlusSeriesCountTotal,F=h.maxBoxThreePlusSeriesCountPerSeries):(C=c.errors.boxSeriesCountCannotExceedLimit,F=h.maxBoxPlotSeriesCount));let x=m.format(p),w=m.format(F),N=i!==void 0?m.format(i):"";d=_e(C,{elementCount:N,seriesLimit:w,totalLimit:x}),f={actualCount:i??Number.NaN,totalLimit:p,seriesLimit:F}}break;case H.BoxPlotOutliersExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=c.errors.boxSeriesOutlierCannotExceedLimit,F=h.maxBoxPlotOutlierLimit,C=m.format(F);d=_e(p,{totalLimit:C}),f={actualCount:i??Number.NaN,totalLimit:F}}break;case H.HeatChartExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=c.errors.heatChartCannotExceedLimit,F=h.maxHeatChartCellLimit,C=m.format(F),x=i!==void 0?m.format(i):"";d=_e(p,{featureCount:x,totalLimit:C}),f={actualCount:i??Number.NaN,totalLimit:F}}break;case H.PieChartExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=c.errors.pieChartSlicesCannotExceedLimit,F=h.maxPieChartSliceCountTotal,C=m.format(F),x=i!==void 0?m.format(i):"";d=_e(p,{sliceCount:x,totalLimit:C}),f={actualCount:i??Number.NaN,totalLimit:F}}break;case H.GaugeExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=c.errors.gaugeCannotExceedLimit,F=h.maxGaugeByFeaturesLimit,C=m.format(F),x=i!==void 0?m.format(i):"";d=_e(p,{featureCount:x,totalLimit:C}),f={actualCount:i??Number.NaN,totalLimit:F}}break;case H.PieChartMixOfNegativePositiveSlices:y=c.modalHeaders.cannotCombineNegativeAndPositiveSlices,d=c.errors.pieChartCannotHaveMixtureOfPositiveAndNegativeSlices;break;case H.NegativeValueInSqrtCalculation:y=c.modalHeaders.invalidData,d=c.errors.negativeValueInDataForSqrtTransformation;break;case H.NegativeValueInLogCalculation:y=c.modalHeaders.invalidData,d=c.errors.negativeValueInDataForLogTransformation;break;case H.HistogramEmptyField:s===!0?(y=c.modalHeaders.noDataAvailable,d=c.errors.noDataFBSMessage):ct(a)?(y=c.modalHeaders.noDataAvailable,d=c.errors.noDataFBEMessage):(y=c.modalHeaders.invalidChart,d=c.errors.histogramEmptyField);break;case H.EmptyDataSet:u&&i?(y=void 0,d=c.errors.noValue):(y=c.modalHeaders.noDataAvailable,s===!0?d=c.errors.noDataFBSMessage:ct(a)?d=c.errors.noDataFBEMessage:d=c.errors.noDataMessage);break;case H.NegativeValueInXAxisLogScale:d=c.errors.logarithmicXAxisNotPossible;break;case H.NegativeValueInYAxisLogScale:d=c.errors.logarithmicYAxisNotPossible;break;case H.BadData:}if(d===c.errors.defaultInvalidChart&&(e===H.BarElementExceedsLimit||e===H.LineChartExceedsLimit||e===H.HeatChartExceedsLimit||e===H.PieChartExceedsLimit||e===H.GaugeExceedsLimit||e===H.BoxPlotExceedsLimit)&&typeof i=="number"&&typeof n=="number"&&i/n>g){let p=i/n;d=_e(c.errors.categoryCountCannotExceedLimit,{categoryCount:m.format(p),maxCategoryCount:m.format(g)})}return{keyword:e??H.BadData,header:y,message:d,params:f}}function Xt(t,e){return`${e}_${t}`}function yn(t){let{value:e,mean:r,stdDev:i}=t;return(e-r)/i}function Nn(t){let{dataItem:e,chartSubType:r,y:i,splitByValue:n,meanPerField:a,stdDevPerField:s}=t,o=e,l={chartSubType:r,y:i,splitByValue:n},u=se({...l,key:P.Average}),c=se({...l,key:P.StandardDeviation}),d=a??Number(e[u]),f=s??Number(e[c]);return Number.isFinite(d)&&Number.isFinite(f)&&Object.values(P).forEach(m=>{let h=se({key:m,y:i,chartSubType:r,splitByValue:n}),g=e[h];if(g!=null){let y=Number(g);if(Number.isFinite(y)){l={...l,key:m,showOutliers:!1,standardizeValues:!0};let p=se(l);if(o[p]=yn({mean:d,stdDev:f,value:y}),m===P.Min||m===P.Max){l={...l,key:m,showOutliers:!0,standardizeValues:!0},p=se(l),l={...l,standardizeValues:!1,splitByValue:n};let F=se(l);y=Number(e[F]),Number.isFinite(y)&&(o[p]=yn({mean:d,stdDev:f,value:y}))}}}}),o}function Kf(t){let{data:e,yList:r,calculateZScore:i=!1}=t,n=e[0],a=new Map;return r.forEach(s=>{let o={};Object.keys(n).forEach(l=>{l.startsWith(s)?o[l.replace(`${s}_`,"")]=n[l]:l.includes(v.rendererSymbolField)&&(o[l]=n[l]),o[v.boxPlot.boxPlotCategory]=s,i&&(o=Nn({dataItem:o,chartSubType:b.BoxPlotMultiFields}))}),a.set(s,o)}),Array.from(a.values())}function Jf(t){let{data:e,splitByField:r,y:i}=t,n={[v.boxPlot.boxPlotCategory]:i};return e.forEach(a=>{let s=a[r];s!==void 0&&Object.keys(a).forEach(o=>{o===v.rendererSymbolField?n[`${o}_${s?.toString()}`]=a[o]:o===v.boxPlot.boxPlotMeanLineMarkerId?n[o]=a[o]:n[`${s?.toString()}_${o}`]=a[o]})}),[n]}function Xf(t){let{splitByField:e,data:r,yList:i,calculateZScore:n=!1,meanAndStdDevPerField:a}=t,s=new Map;return r.forEach(o=>{let l=o[e];i.forEach(u=>{let c={[v.boxPlot.boxPlotCategory]:u};Object.entries(o).forEach(([d,f])=>{d.startsWith(`${u}_`)?c[`${l}_${d.replace(`${u}_`,"")}`]=f:d.includes(v.rendererSymbolField)?c[`${d}_${l}`]=f:d===v.boxPlot.boxPlotMeanLineMarkerId&&(c[d]=o[d])}),n&&(c=Nn({dataItem:c,chartSubType:b.BoxPlotMultiFieldsAndSplitBy,splitByValue:l,meanPerField:a?.[Xt(u,A.Average)],stdDevPerField:a?.[Xt(u,A.StandardDeviation)]})),s.set(u,{...s.get(u)??{},...c})})}),Array.from(s.values())}function em(t){let{data:e,yList:r,calculateZScore:i=!1,meanAndStdDevPerField:n}=t,a=e;return i&&a.forEach(s=>{r.forEach(o=>{Nn({dataItem:s,chartSubType:b.BoxPlotMultiFieldsAndCategory,y:o,meanPerField:n?.[Xt(o,A.Average)],stdDevPerField:n?.[Xt(o,A.StandardDeviation)]})})}),a}function tm(t){let{splitByField:e,x:r,data:i}=t,n=new Map;return i.forEach(a=>{let s=a[r],o={[r]:s},l=a[e];Object.entries(a).forEach(([u,c])=>{if(u.includes(v.rendererSymbolField))o[`${v.rendererSymbolField}_${l?.toString()}`]=c;else if(u===v.boxPlot.boxPlotMeanLineMarkerId)o[u]=a[u];else if(u!==e&&u!==r){let d=u!==v.xAxisField&&u!==v.originalCategoryValue?`${l?.toString()}_${u}`:u;o[d]=c}}),n.set(s,{...n.get(s)??{},...o})}),Array.from(n.values())}function rm(t,e){let{series:r}=t,i=r[0],{y:n}=i,a=W(t.series),s={y:a===b.BoxPlotMultiFieldsAndCategory?n:void 0,chartSubType:a},o=t.series.map(l=>{let u=xe({where:l.query?.where,normalize:!1,escape:!0});return u!==null&&`${u}`.startsWith("'")&&`${u}`.endsWith("'")&&(u=u.substring(1,u.length-1)),u});o.length===0&&o.push(" "),e.forEach(l=>{o.forEach(u=>{s.splitByValue=u;let c=se({...s,key:P.Min,showOutliers:!0}),d=se({...s,key:P.Min,showOutliers:!1}),f=se({...s,key:P.Max,showOutliers:!0}),m=se({...s,key:P.Max,showOutliers:!1});l[f]===void 0&&l[m]!==void 0&&(l[f]=l[m]),l[c]===void 0&&l[d]!==void 0&&(l[c]=l[d])})})}function im(t,e){let r,i,n=t[e[P.IQR]],a=t[e[P.FirstQuartile]],s=t[e[P.ThirdQuartile]];return Number.isFinite(n)&&Number.isFinite(a)&&Number.isFinite(s)&&(r=a-n*1.5,i=s+n*1.5),{outlierMinThreshold:r,outlierMaxThreshold:i}}function Ds(t){let{yField:e,xField:r,xValue:i,splitByField:n,splitByValue:a,outlierMaxThreshold:s,outlierMinThreshold:o,target:l}=t,u;if(r!==void 0&&i!==void 0){let f=typeof i!="string"?i:`'${Er(i)}'`;u=`${r}=${f.toString()}`}let c;if(n!==void 0&&a!==void 0){let f=typeof a!="string"?a:`'${Er(a)}'`;c=`${n}=${f.toString()}`}let d;return l==="outliers"&&o!==s?d=`(${e}<${o} OR ${e}>${s})`:l==="alternativeData"&&(o===s?d=`(${e}=${o})`:d=`(${e}>=${o} AND ${e}<=${s})`),[u,c,d].filter(f=>f!==void 0).join(" AND ")}function To(t){let{data:e,yField:r,x:i,chartSubType:n,splitByField:a}=t,s=n===b.BoxPlotMonoField||n===b.BoxPlotMonoFieldAndCategory||n===b.BoxPlotMonoFieldAndSplitBy||n===b.BoxPlotMonoFieldAndCategoryAndSplitBy?void 0:r,o=Yt(s),l=[],u=[],{maxOperandsPerWhereClause:c}=nr(),d=[],f=[],m=1;return e.forEach((h,g)=>{let{outlierMinThreshold:y,outlierMaxThreshold:p}=im(h,o);if(typeof y=="number"&&typeof p=="number"){let F={yField:r,outlierMinThreshold:y,outlierMaxThreshold:p};(n===b.BoxPlotMonoFieldAndCategory||n===b.BoxPlotMultiFieldsAndCategory||n===b.BoxPlotMonoFieldAndCategoryAndSplitBy)&&i!==void 0&&i in h&&(F.xField=i,F.xValue=vn({value:h[i],dataContext:h})),(n===b.BoxPlotMonoFieldAndSplitBy||n===b.BoxPlotMultiFieldsAndSplitBy||n===b.BoxPlotMonoFieldAndCategoryAndSplitBy)&&a!==void 0&&a in h&&(F.splitByField=a,F.splitByValue=h[a]),d.push(Ds({...F,target:"outliers"})),f.push(Ds({...F,target:"alternativeData"})),(m%c===0||g===e.length-1)&&(l.push(ee(d,"OR")),u.push(ee(f,"OR")),d=[],f=[])}m+=1}),{outliersFilterBatches:l,dataWithoutOutliersFilterBatches:u}}function nm(t){let{data:e,outlierDataItem:r,chartSubType:i,x:n,y:a,meanAndStdDevPerField:s,splitByField:o}=t,l=s?.[Xt(a,A.Average)],u=s?.[Xt(a,A.StandardDeviation)];if(l===void 0&&u===void 0)switch(i){case b.BoxPlotMultiFields:{let c=Yt(a),d=e[0];l=Number(d[c[P.Average]]),u=Number(d[c[P.StandardDeviation]]);break}case b.BoxPlotMultiFieldsAndCategory:{let c=e.find(d=>d[n]===r[n]);if(c!==void 0){let d=Yt(a);l=Number(c[d[P.Average]]),u=Number(c[d[P.StandardDeviation]])}break}case b.BoxPlotMultiFieldsAndSplitBy:{let c=e.find(d=>d[o]===r[o]);if(c!==void 0){let d=Yt(a);l=Number(c[d[P.Average]]),u=Number(c[d[P.StandardDeviation]])}break}}return{mean:l,stdDev:u}}async function am(t){let{seriesConfig:e,data:r,uniqueQuery:i,queryObject:n,meanAndStdDevPerField:a,errorStrings:s,abortKey:o,abortSignal:l}=t,u=W(e),c=e[0],{x:d}=c,f=de(c.query?.where),m=U(n),h=We(m).idField,g=Se(e),y=[];for(let C=0;C<g.length;C+=1){let x=g[C],{outliersFilterBatches:w}=To({data:r,yField:x,x:d,chartSubType:u,splitByField:f});for(let N=0;N<w.length;N+=1){let O=w[N];if(O!==""){let T=[];d!==v.boxPlot.boxPlotCategory&&T.push(d),T.push(x),f!==""&&T.push(f),T.push(h);let B={...i,where:ee([i.where,O]),groupByFieldsForStatistics:void 0,outStatistics:void 0,orderByFields:void 0,num:void 0,outFields:T};y.push(Le({queryObject:n,queryConfig:B,featureCount:1,errorStrings:s,abortKey:o,abortSignal:l}))}}}let p=await Promise.all(y),F=new Map;for(let C=0;C<p.length;C+=1){let x=p[C],w=g[C];x.forEach(N=>{let O={...N.attributes};if(O[w]!==void 0){d===v.boxPlot.boxPlotCategory&&(O[v.boxPlot.boxPlotCategory]=w);let T={key:P.Outlier,chartSubType:u};switch(u){case b.BoxPlotMonoFieldAndSplitBy:case b.BoxPlotMultiFieldsAndSplitBy:case b.BoxPlotMonoFieldAndCategoryAndSplitBy:T={...T,splitByValue:O[f]};break;case b.BoxPlotMultiFieldsAndCategory:T={...T,y:w};break}let B=se(T),M=O[w];O[B]=M;let q=`${O[d]}-${O[f]}-${M}`,I=F.get(q);if(O[G.uniqueIdsName]=[...I?.[G.uniqueIdsName]??[],O[h]],delete O[h],jo(u)){let k=se({...T,standardizeValues:!0}),{mean:_,stdDev:E}=nm({data:r,outlierDataItem:O,chartSubType:u,x:d,y:w,splitByField:f,meanAndStdDevPerField:a});_!==void 0&&E!==void 0&&(O[k]=yn({value:M,mean:_,stdDev:E}))}delete O[w],O[v.boxPlot.boxPlotOutlierId]=!0,F.set(q,O)}})}return Array.from(F.values())}async function sm(t){let{data:e,queryObject:r,uniqueQuery:i,elementCount:n,chartConfig:a,chartLimits:s,errorStrings:o,abortKey:l,abortSignal:u}=t,c=[],{series:d,showMean:f}=a,m=In({showMean:f,seriesConfig:d}),h=W(d),g=mt(a),{x:y}=g,p=de(g.query?.where),F=[];for(let x=0;x<m.length;x+=1){let w=m[x],{dataWithoutOutliersFilterBatches:N}=To({data:e,yField:w,x:y,chartSubType:h,splitByField:p});for(let O=0;O<N.length;O+=1){let T=N[O],B={...i,where:ee([i.where,T])};B.outStatistics!==void 0&&(B.outStatistics=B.outStatistics?.filter(M=>(M.statisticType===A.Minimum||M.statisticType===A.Maximum)&&M.onStatisticField===w).map(M=>({...M,outStatisticFieldName:`${M.outStatisticFieldName}${v.boxPlot.boxPlotOutliersSuffix}`}))),F.push(di({queryObject:r,uniqueQuery:B,chartConfig:a,elementCount:n,isTimeBinningSeries:!1,showMean:f,chartLimits:s,errorStrings:o,abortKey:l,abortSignal:u}))}}let C=await Promise.all(F);for(let x=0;x<C.length;x+=1)c.push(...C[x]);return h!==b.BoxPlotMonoFieldAndCategoryAndSplitBy&&h!==b.BoxPlotMonoField&&(c=br({data:c,x:p!==void 0&&p!==""?p:y})),c}async function om(t){let{queryObject:e,uniqueQuery:r,chartConfig:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o,{series:l,showMean:u}=i,c=W(l);if(c===b.BoxPlotMultiFieldsAndCategory||c===b.BoxPlotMultiFieldsAndSplitBy){let d=In({showMean:u,seriesConfig:l}),f={...r};delete f.outStatistics,delete f.groupByFieldsForStatistics,delete f.orderByFields;let m=[];for(let g=0;g<d.length;g+=1){let y=d[g];m.push({statisticType:A.Average,onStatisticField:y,outStatisticFieldName:`${A.Average}_${y}`},{statisticType:A.StandardDeviation,onStatisticField:y,outStatisticFieldName:`${A.StandardDeviation}_${y}`})}f.outStatistics=m;let h=await Le({queryObject:e,queryConfig:f,featureCount:1,errorStrings:n,abortKey:a,abortSignal:s});h.length>0&&(o=h[0].attributes)}return o}function lm(t){let{data:e,additionalData:r,chartConfig:i}=t,n=i.series[0],{x:a}=n,s=de(n.query?.where);return e.map(o=>{let l=o,u=r.find(c=>c[a]===o[a]&&(s===""?!0:c[s]===o[s]));return u!==void 0&&(l={...o,...u}),l})}function Oo(t){let{chartConfig:e,data:r,calculateZScore:i=!1,meanAndStdDevPerField:n}=t,{series:a,showMean:s}=e,o=mt(e),l=W(e.series),{x:u}=o,c=In({showMean:s,seriesConfig:a}),d=r;if(r?.[0]!==void 0){let f=de(o.query?.where);switch(l){case b.BoxPlotMonoField:d[0][v.boxPlot.boxPlotCategory]=c[0];break;case b.BoxPlotMultiFields:d=Kf({data:r,yList:c,calculateZScore:i});break;case b.BoxPlotMonoFieldAndSplitBy:d=Jf({data:r,splitByField:f,y:c[0]});break;case b.BoxPlotMultiFieldsAndSplitBy:d=Xf({splitByField:f,data:r,yList:c,meanAndStdDevPerField:n,calculateZScore:i});break;case b.BoxPlotMultiFieldsAndCategory:d=em({data:r,yList:c,meanAndStdDevPerField:n,calculateZScore:i});break;case b.BoxPlotMonoFieldAndCategoryAndSplitBy:d=tm({splitByField:f,x:u,data:r});break;case b.BoxPlotMonoFieldAndCategory:}}return rm(e,d),d}async function um(t){let{data:e,queryObject:r,uniqueQuery:i,fetchFullBoxPlotData:n,chartConfig:a,elementCount:s,chartLimits:o,errorStrings:l,abortKey:u,abortSignal:c}=t,d=e,f=[];if(d!==void 0){let{series:m}=a,h=await om({queryObject:r,uniqueQuery:i,chartConfig:a,errorStrings:l,abortKey:u,abortSignal:c});if(n!==!1){f=await am({queryObject:r,uniqueQuery:i,seriesConfig:m,data:d,errorStrings:l,abortKey:u,abortSignal:c});let g=await sm({queryObject:r,uniqueQuery:i,elementCount:s,data:e,chartConfig:a,chartLimits:o,errorStrings:l,abortKey:u,abortSignal:c});d=lm({data:d,additionalData:g,chartConfig:a})}d=Oo({chartConfig:a,data:d,meanAndStdDevPerField:h,calculateZScore:!0})}return{dataItems:d,outliers:f}}function cm(t,e,r){let i=0;if(Array.isArray(r)){let n=t?.toString()??"",a=e?.toString()??"",s=r.indexOf(n),o=r.indexOf(a);s===-1&&(s=r.length),o===-1&&(o=r.length),i=s-o}else r===be.Descending?typeof t=="string"&&typeof e=="string"?i=e.localeCompare(t,void 0,{numeric:!0}):i=(Number(e)||0)-(Number(t)||0):r===be.Ascending&&(typeof t=="string"&&typeof e=="string"?i=t.localeCompare(e,void 0,{numeric:!0}):i=(Number(t)||0)-(Number(e)||0));return i}function Ps(t){let{chartConfig:e,field:r,chartData:i}=t,n=Rc({chartConfig:e,field:r}),a=Array.from(new Set(i.map(s=>r in s?s[r]:void 0)));return n&&a.length>1&&a.sort((s,o)=>cm(s,o,n)),a.map(s=>({[r]:s}))}function Bo(t){let{chartConfig:e,chartData:r}=t;return{xAxisData:Ps({chartConfig:e,field:j.xField,chartData:r}),yAxisData:Ps({chartConfig:e,field:j.yField,chartData:r})}}function ks(t){let{orderBy:e,axisFormatOptions:r}=t;return e!==void 0&&r!==void 0&&(!Array.isArray(e)||r?.type===S.CategoryAxisFormat)}function Vs(t,e,r){let i=0;if(Array.isArray(r)){let n=t?.toString()??"",a=e?.toString()??"",s=r.indexOf(n),o=r.indexOf(a);s===-1&&(s=r.length),o===-1&&(o=r.length),i=s-o}else r===be.Descending?typeof t=="string"&&typeof e=="string"?i=e.localeCompare(t,void 0,{numeric:!0}):i=(Number(e)||0)-(Number(t)||0):r===be.Ascending&&(typeof t=="string"&&typeof e=="string"?i=t.localeCompare(e,void 0,{numeric:!0}):i=(Number(t)||0)-(Number(e)||0));return i}function dm(t){let{arrayToSort:e,chartConfig:r,dataOrderParameters:i}=t,n=i??ii(r),a,s,o=!1,l=!1,u=!1;n&&e.length>1&&([a,s]=n,o=a&&a.sortingField.length>0&&ks({orderBy:a.orderBy,axisFormatOptions:r.axes?.[0]?.valueFormat}),l=s&&s.sortingField.length>0&&ks({orderBy:s.orderBy,axisFormatOptions:r.axes?.[1]?.valueFormat}),u=o||l),u&&e.sort((c,d)=>{let f=0;if(o&&a?.sortingField){let m=a.orderBy;f=Vs(c[a.sortingField],d[a.sortingField],m)}if(f===0&&l&&s?.sortingField){let m=s.orderBy;f=Vs(c[s.sortingField],d[s.sortingField],m)}return f})}function fm(t){let{chartConfig:e,chartData:r}=t;r.heatChartAxesData=Bo({chartConfig:e,chartData:r.dataItems})}function si(t){let{arrayToSort:e,chartConfig:r,fieldList:i,isTimeBinningSeries:n}=t;if(n!==!0&&e[0]!==void 0){let{series:a}=r,s=W(a),o=Z(a),l=$e(r),u=ii(r);if(Tt(r)&&e!==void 0)dm({arrayToSort:e,chartConfig:r,dataOrderParameters:u});else if(u?.[0]!==void 0&&e!==void 0&&e.length>1){let{orderBy:c}=u[0],{sortingField:d}=u[0],f=r.orderOptions?.data?.orderType===Ue.Category,m=u[0].preferLabel!==!1,h=s===b.BarAndLineFromFields||s===b.PieFromFields||s===b.BoxPlotMultiFields||s===b.BoxPlotMultiFieldsAndSplitBy,g=h||o===S.PieSeries,y=s===b.PieNoAggregation||s===b.BarAndLineNoAggregation||s===b.BarAndLineSplitByNoAggregation;if(f&&g&&(!m||(o===S.LineSeries||o===S.RadarSeries)&&l===S.NumberAxisFormat)&&(d=v.originalCategoryValue),Array.isArray(c))zc({arrayToSort:e,orderBy:c,sortingField:d,fieldList:i,isByFieldsChart:h,preferLabel:m});else{let p=l===S.DateAxisFormat&&f;gr({arrayToSort:e,orderBy:c,sortingField:d,forceAscendingOrder:p,isNonAggregated:y,sortByCategory:f,preferLabel:m,isPieOrByFieldsChart:g})}}}}function e0(t){let{alteredConfig:e,dataInfo:r,fieldList:i,options:n,queryObject:a}=t,s=Mn(r.data);if(s&&si({arrayToSort:s,chartConfig:e,fieldList:i,isTimeBinningSeries:Xe({seriesConfig:mt(e),xAxisValueFormatType:$e(e),setTimeBinningInfoWhenNotProvided:n?.setTimeBinningInfoWhenNotProvided,queryObject:a})}),Fe(e)){let o=r?.data&&"meanLines"in r.data?r.data.meanLines:void 0;o&&si({arrayToSort:o,chartConfig:e})}Tt(e)&&r.data&&fm({chartConfig:e,chartData:r.data})}function mm(t){return t?.type==="uniqueValue"&&(t.uniqueValueInfos=t.uniqueValueInfos.map(e=>{let r=e.value===null?v.nullValue:e.value;return{...e,value:r}})),t}async function t0(t){let{data:e,queryObject:r,chartConfig:i,allowColorMatch:n}=t,a=!1,s=[];if(n&&!oe(r)){let{series:o,chartRenderer:l}=i,u=mm(l),c=u?Gt.ChartRenderer:Gt.LayerRenderer,d=r?U(r):void 0,f=u??d?.renderer,m;d&&c===Gt.LayerRenderer?s=await bo(d):c===Gt.ChartRenderer&&(s=dd(f));let h=rd(u,d?.renderer),g=od({chartRenderer:l,queryObject:r}),y=Z(o),p=W(o),F=mt(i),C=de(F.query?.where);m=new Map;for(let x=0;x<(y===S.HistogramSeries&&e.length>0?1:e.length);x+=1){let w=e[x],N=await ld({seriesConfig:i.series,dataItem:w,renderer:f,rendererType:h,rendererOrigin:c,chartSubType:p,splitByField:C,graphicTemplate:g,mapAttributesToSymbol:m,rendererFieldNames:s});a=a||N.colorMatchApplied}}return{dataItems:e,colorMatchApplied:a,rendererFieldNames:s}}async function hm(t){let{queryObject:e,queryConfig:r,chartConfig:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o=i.series[0],{x:l,valueConversion:u}=o,c=Wo(i),d=await Le({queryObject:e,queryConfig:r,featureCount:r.num??1,errorStrings:n,abortKey:a,abortSignal:s}),f=[{[l]:null}];if(c)f=d.map(m=>{On(m.attributes,l);let h=Ms(m.attributes[l],u);return{...m.attributes,[l]:h}});else if(d.length>0){let m=d[0].attributes[l]??d[0].attributes[l.toUpperCase()]??d[0].attributes[l.toLowerCase()];m=Ms(m,u),f=[{[l]:m}]}return f}async function ym(t){let{queryObject:e,chartConfig:r,queryConfig:i,chartLimits:n,errorStrings:a,abortKey:s,abortSignal:o}=t,l={valid:!0},{behaviorAfterLimit:u,maxGaugeByFeaturesLimit:c}=n??{},d=Wo(r),f=!0,m;if(d&&(m=(await Vo({chartConfig:r,queryObject:e,queryConfig:i,behaviorAfterLimit:u,numberMaxOfFeaturesToFetch:c,isGaugeByFeature:d,abortSignal:o})).elementCount,n?.behaviorAfterLimit!==St.RenderUpToTheLimit&&(f=je({count:m??0,seriesCount:r.series.length,chartType:S.GaugeSeries,chartLimits:n})),n&&(Number.isFinite(c)||Number.isFinite(m)))){let h=Math.min(c??Number.NaN,m??Number.NaN),g=n;Number.isFinite(h)&&(g={...n,maxGaugeByFeaturesLimit:h}),oo({chartConfig:r,chartLimits:g,uniqueQuery:i})}if(Number.isNaN(f)||f){let h=await hm({queryObject:e,chartConfig:r,queryConfig:i,errorStrings:a,abortKey:s,abortSignal:o});l.data={dataItems:h},l.count=h.length}else l.count=m,ai({dataInfo:l,chartType:S.GaugeSeries});return l}async function r0(t){let{queryObject:e,chartConfig:r,queryConfig:i,errorStrings:n}=t,{minimumFromField:a,maximumFromField:s}=r.axes[0],o=[],l="",u="";a!==void 0&&(typeof a=="string"?(l=`${A.Minimum}_${a}`,o.push({statisticType:A.Minimum,onStatisticField:a,outStatisticFieldName:l})):(l=`${a.statisticType}_${a.onStatisticField}`,o.push({...a,outStatisticFieldName:l}))),s!==void 0&&(typeof s=="string"?(u=`${A.Maximum}_${s}`,o.push({statisticType:A.Maximum,onStatisticField:s,outStatisticFieldName:u})):(u=`${s.statisticType}_${s.onStatisticField}`,o.push({...s,outStatisticFieldName:u})));let c={...i,outStatistics:o,orderByFields:void 0,groupByFieldsForStatistics:void 0,returnDistinctValues:void 0,fetchNullValues:void 0,num:void 0};Dt(e);let d=await vr({queryObject:e,queryConfig:c,errorStrings:n}),f=d.get(l),m=d.get(u);return{minimumFromData:f,maximumFromData:m}}function gm(t){let{itemsA:e,itemsB:r,isPieFromFields:i,x:n,y:a,outStatisticFieldName:s}=t,o=tt(e),l=tt(r),u=!1;if(o===void 0&&l!==void 0||o!==void 0&&l===void 0)u=!0;else if(!i){let c=[v.originalCategoryValue,v.originalYCategoryValue,v.originalDateValue,v.xAxisField,v.technicalSortingFieldBySum,v.technicalSortingFieldByPercent,v.pieChart.technicalFieldSlicePercent,v.pieChart.technicalFieldGroupedSlices,v.pieChart.technicalFieldSliceId,v.originalServerBinningRange,v.lastTemporalBin,v.technicalFieldSplitByField,G.uniqueIdsName,j.valueField,...Vn],d=(g,y)=>{let p=y[v.originalCategoryValue];p!==void 0&&n&&(y[n]=p);let F=y[v.originalYCategoryValue];F!==void 0&&a&&(y[a]=F),n&&y[j.xField]!==void 0&&(y[n]=y[v.originalCategoryValue]!==void 0?y[v.originalCategoryValue]:y[j.xField],delete y[j.xField]),a&&y[j.yField]!==void 0&&(y[a]=y[v.originalYCategoryValue]!==void 0?y[v.originalYCategoryValue]:y[j.yField],delete y[j.yField]),s&&y[j.valueField]!==void 0&&(y[s]=y[j.valueField],delete y[j.valueField]);let C={};return Object.keys(y).forEach(x=>{!c.includes(x)&&!x.includes(v.rendererSymbolField)&&(C[x]=y[x])}),g.push(C),g},f=(g,y)=>JSON.stringify(g).localeCompare(JSON.stringify(y)),m=o?.reduce(d,[])?.sort(f),h=l?.reduce(d,[])?.sort(f);m&&h&&n&&m.length!==h.length&&(m=br({data:m,x:n}),h=br({data:h,x:n})),u=m?.length!==h?.length||!yt(m,h)}return u}function pm(t){let{chartConfig:e,currentSelectionDataItems:r,selectionData:i}=t,n=[];if(e!==void 0){let a=e.series,s=W(a),{selectionItems:o}=i??{};if(o!==void 0&&gm({itemsA:o,itemsB:r,isPieFromFields:W(e.series)===b.PieFromFields,x:e.series[0].x,y:"y"in e.series[0]?e.series[0].y.toString():void 0,outStatisticFieldName:e.series[0].query?.outStatistics?.[0]?.outStatisticFieldName})?n=o:n=r??[],a.length>1&&s!==b.BarAndLineNoAggregation&&s!==b.BarAndLineSplitByNoAggregation){let l=de(a[0].query?.where);n=br({data:n,x:a[0].x,splitByField:l})}si({arrayToSort:n,chartConfig:e})}return n??[]}function dt(t,e){let r="";if(t.trim()!==""&&e!==void 0)if(e===null)r=`${t} IS NULL`;else{let i=typeof e!="number"?"'":"";r=`${t}=${i}${e.toString()}${i}`}return r}function Sm(t){let{dataContext:e,xAxisField:r,yAxisField:i,options:n}=t,a="",{dataContextXMinField:s,dataContextXMaxField:o,dataContextYMinField:l,dataContextYMaxField:u}=v.scatterplotAggregationFields;if(to({dataContext:e,chartLimits:n?.chartLimits})){let{[s]:c,[o]:d}=e,f=r!==i?e[l]:c,m=r!==i?e[u]:d;if(!Number.isNaN(c)&&!Number.isNaN(d)&&!Number.isNaN(f)&&!Number.isNaN(m)){let h=[];c===d?h.push(`${r}=${c?.toString()}`):(h.push(`${r}>=${c?.toString()}`),h.push(`${r}<=${d?.toString()}`)),f===m?h.push(`${i}=${f?.toString()}`):(h.push(`${i}>=${f?.toString()}`),h.push(`${i}<=${m?.toString()}`)),a=ee(h)}}else a=ee([Je({where:dt(r,e[r])}),i!==void 0?Je({where:dt(i,e[i])}):""]);return a}function $s(t){let{fieldsIndex:e,fieldName:r,inputDate:i}=t,n=e.get(r),a=e.getTimeZone(r);return Qu(new Date(i),{type:"date"},{type:n,timeZone:a})}function Mo(t){let{xAxisField:e,dataContext:r,queryObject:i}=t,n="",a=r[v.originalServerBinningRange]??r[v.dateBinningRange];if(Or(a)&&a.length===2){let[s,o]=a,l=!0,u=ct(i);if(u){let c=U(i),{fieldsIndex:d}=c;s=$s({fieldsIndex:d,fieldName:e,inputDate:s}),o=$s({fieldsIndex:d,fieldName:e,inputDate:o})}else typeof s=="number"&&typeof o=="number"?Number.isFinite(s)&&Number.isFinite(o)?(s=Kt(s),o=Kt(o)):l=!1:typeof s=="string"&&typeof o=="string"&&(s=new Date(s).toISOString(),o=new Date(o).toISOString());if(l){let c=u?"":"'",d=r[v.lastTemporalBin]===!0?"<=":"<";n=`${e}>=${c}${s}${c} AND ${e}${d}${c}${o}${c}`}}return n}function Io(t,e){let r="";if(Number.isFinite(t)){let i=1/10**v.queryMaxFloatPrecision;r=`${e}>=${t-i} AND ${e}<=${t+i}`}return r}function Eo(t){let{xAxisField:e,yAxisField:r,splitBy:i,dataContext:n,xAxisFieldType:a,chartConfig:s}=t,o="";if(e!==void 0&&e!==v.boxPlot.boxPlotCategory){let c=vn({value:n[e],dataContext:n});a===Q.Double?o=Io(c,e):(Nt(s.axes?.[0].valueFormat)&&(c=Kt(c)),o=Je({where:dt(e,c),normalize:!1,escape:!0}))}let l=Je({where:i??"",normalize:!1,escape:!0}),u="";if(yd(s)){let c=W(s.series)===b.BoxPlotMultiFieldsAndCategory?r:void 0,d=se({key:P.Min,showOutliers:!0,splitBy:i,y:c}),f=se({key:P.Max,showOutliers:!0,splitBy:i,y:c}),m=e===v.boxPlot.boxPlotCategory?n[e]:r;if(!he(m)){let h=n[d],g=n[f];Number.isFinite(h)&&Number.isFinite(g)&&(u=`${m?.toString()}>=${h?.toString()} AND ${m?.toString()}<=${g?.toString()}`)}}return ee([o,l,u])}function bm(t){let{xAxisField:e,splitBy:r,dataContext:i,xAxisFieldType:n,chartConfig:a,queryObject:s}=t,o="";if(v.dateBinningRange in i)o=Mo({xAxisField:e,dataContext:i,queryObject:s});else if(W(a.series)!==b.BarAndLineFromFields){let u=vn({value:i[e],dataContext:i});n===Q.Double?o=Io(u,e):(Nt(a.axes?.[0].valueFormat)&&n!==Q.TimeOnly&&(u=Kt(u)),o=Je({where:dt(e,u),normalize:!1,escape:!0}))}let l=Je({where:r??"",normalize:!1,escape:!0});return ee([o,l])}function vm(t){let{xAxisField:e,dataContext:r,chartConfig:i}=t,n=r[v.originalCategoryValue];return n===void 0&&(n=r[e]),W(i.series)===b.PieFromFields?"":Je({where:dt(e,n),normalize:!1,escape:!0})}function Rs(t){let{field:e,fieldType:r,fieldValue:i,unit:n,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o}=t,l,{expression:u}=Cn({field:e,fieldType:r,unit:n,addIntervalStatement:!0,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o});return u&&(l=`${u}=${i}`),l}function Fm(t){let{xAxisFieldType:e,yAxisFieldType:r,dataContext:i,chartConfig:n,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o}=t,l=n.series[0],u="";if(l.type===S.HeatSeries){let c,d,f=i[j.xField],m=i[v.originalCategoryValue],h=i[j.yField],g=i[v.originalYCategoryValue],y=n.axes?.[0]?.valueFormat?.type,p=n.axes?.[1]?.valueFormat?.type;y===S.CategoryAxisFormat?c=Je({where:dt(l.x,m??f),normalize:!1,escape:!0}):c=Rs({field:l.x,fieldType:e,fieldValue:f,unit:l.xTemporalBinning?.unit,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o}),p===S.CategoryAxisFormat?d=Je({where:dt(l.y,g??h),normalize:!1,escape:!0}):d=Rs({field:l.y,fieldType:r,fieldValue:h,unit:l.yTemporalBinning?.unit,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o}),c&&(u=c),d&&(u=ee([u,d]))}return u}function xm(t){let{xAxisField:e,dataContext:r,chartConfig:i}=t,n="",a=i.series[0],{minValue:s,maxValue:o}=r;if(Number.isFinite(s)&&Number.isFinite(o)&&a.type===S.HistogramSeries){let l=Yc(e,a.dataTransformationType),u=r.isLastBin?"<=":"<";n=ee([`${l}>=${s?.toString()}`,`${l}${u}${o?.toString()}`])}return n}function i0(t){let{chartConfig:e}=t,r=Z(e.series),i="";switch(r){case S.ScatterSeries:i=Sm(t);break;case S.HeatSeries:i=Fm(t);break;case S.RadarSeries:case S.BarSeries:case S.LineSeries:case S.ComboLineAndBarSeries:i=bm(t);break;case S.BoxPlotSeries:i=Eo(t);break;case S.HistogramSeries:i=xm(t);break;case S.PieSeries:i=vm(t);break}return i}async function Cm(t){let{queryObject:e,queryConfig:r,chartConfig:i,currentSelectionDataItems:n,setTimeBinningInfoWhenNotProvided:a,returnFeaturesExtent:s,chartLimits:o,popupTemplateFieldInfosEnabled:l,hideZeroCountCategories:u,replaceNoValueCategoryWithZero:c,view:d,errorStrings:f,abortKey:m,abortSignal:h}=t,g=W(i.series),y={valid:!0,data:{dataItems:[]}};if(n!==void 0&&n.length>0){let p=mt(i),{x:F}=p,C="y"in p?p.y:"",x=Re(e).find(M=>M.name===F)?.type,w=[],N=n.reduce((M,q)=>{let I=[];if(G.uniqueIdsName in q)w.push(q[G.uniqueIdsName]);else{switch(g){case b.BoxPlotMonoFieldAndSplitBy:case b.BoxPlotMultiFieldsAndSplitBy:case b.BoxPlotMonoFieldAndCategoryAndSplitBy:{let E=de(p.query?.where??""),D=`_${P.Average}`;Object.keys(q).forEach(Y=>{if(Y.includes(D)){let J=Y.replace(D,"");J.trim()!==""&&I.push(dt(E,J))}});break}}let k=[C].flat(),_=k.length===1?k[0]:"";if(g===b.BoxPlotMultiFieldsAndCategory){let E=`_${P.FirstQuartile}`,D=Object.keys(q).find(Y=>Y.includes(E));D!==void 0&&(_=D.replace(E,""))}I.length===0&&I.push(""),I.forEach(E=>{let D=Eo({chartConfig:i,xAxisField:F,yAxisField:_,splitBy:E,dataContext:q,xAxisFieldType:x});M.push(D)})}return M},[]),O=U(e);if(O!==void 0&&w.length>0){let M=We(O).idField;N.push(`${M} IN (${w.join(",")})`)}let T=N.join(" OR "),B={...r};B.where=ee([B.where,T]),y=await Tn({queryObject:e,chartConfig:i,queryConfig:B,setTimeBinningInfoWhenNotProvided:a,returnFeaturesExtent:s,chartLimits:o,popupTemplateFieldInfosEnabled:l,hideZeroCountCategories:u,replaceNoValueCategoryWithZero:c,view:d,errorStrings:f,abortKey:m,abortSignal:h})}return y}async function wm(t){let{queryObject:e,queryConfig:r,chartConfig:i,currentSelectionDataItems:n,dataForFilterBySelectionChanged:a,selectionData:s,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,hideZeroCountCategories:d,replaceNoValueCategoryWithZero:f,view:m,errorStrings:h,abortKey:g,abortSignal:y}=t;Dt(e);let{series:p}=i,F=Z(p),C=$e(i),x={valid:!0},w=s?.selectionItems??[];a||(w=pm({chartConfig:i,currentSelectionDataItems:n,selectionData:s}));let N=!1;switch(F){case S.HeatSeries:x.data={dataItems:w};break;case S.PieSeries:if(W(i.series)===b.PieFromFields){let{x:O,y:T}=i.series[0],B=tt(w);B.forEach(M=>{O in M&&(M[ve]=M[O],delete M[O]),T in M&&(M[ze]=M[T],delete M[T])}),x.data={dataItems:B}}else x.data={dataItems:w};x.count=w.length,N=!0;break;case S.BoxPlotSeries:Fe(i)&&(x=await Cm({queryObject:e,queryConfig:r,chartConfig:i,currentSelectionDataItems:n,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,hideZeroCountCategories:d,replaceNoValueCategoryWithZero:f,view:m,errorStrings:h,abortKey:g,abortSignal:y}));break;case S.BarSeries:case S.ComboLineAndBarSeries:case S.RadarSeries:case S.LineSeries:if(w.length===0||!Xe({xAxisValueFormatType:C,setTimeBinningInfoWhenNotProvided:o,seriesConfig:p[0],queryObject:e}))x.data={dataItems:w},x.count=w.length*p.length,N=!0;else{let O={...r};if(n!==void 0&&n.length>0){let T=n.map(M=>Mo({xAxisField:p[0].x,dataContext:M,queryObject:e})),B=ee(T,"OR");O.where=ee([O.where,B])}x=await Bn({queryObject:e,queryConfig:O,chartConfig:i,errorStrings:h,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,view:m,abortSignal:y})}break;case S.HistogramSeries:{if(w.length===0)x.data={mean:Number.NaN,median:Number.NaN,stddev:Number.NaN,max:Number.NaN,min:Number.NaN,bins:[]},x.count=0;else{let{x:O}=p[0],T=w.map((q,I)=>{let{minValue:k,maxValue:_}=q,E=I===w.length-1?"<=":"<";return`${O} >= ${k} AND ${O} ${E} ${_}`}),B=ee(T,"OR"),M={...r};M.where=ee([M.where,B]),x=await wo({queryObject:e,chartConfig:i,queryConfig:M,view:m,errorStrings:h,abortKey:g,abortSignal:y})}break}case S.ScatterSeries:{if(w.length===0){let{r2:O,trendLinePoints:T}=v.scatterplotSeries;x.data={dataItems:[],r2:O,trendLinePoints:T,count:0},x.count=0}else{let{r2:O,trendLinePoints:T}=fo({data:w,chartConfig:i});x.data={dataItems:w,r2:O,trendLinePoints:T},x.count=w.length}break}}return N&&x.data!==void 0&&si({arrayToSort:"dataItems"in x.data?x.data.dataItems:x.data,chartConfig:i}),x}async function Tn(t){let{queryObject:e,chartConfig:r,queryConfig:i,errorStrings:n,abortKey:a,abortSignal:s,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,hideZeroCountCategories:d,replaceNoValueCategoryWithZero:f,view:m}=t,h={valid:!0},g=Jt(r),y=await gn({queryObject:e,queryConfig:i,fetchFullBoxPlotData:!g,chartConfig:r,errorStrings:n,abortKey:a,abortSignal:s,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,hideZeroCountCategories:d,replaceNoValueCategoryWithZero:f,view:m});if(!g)h=y;else{let p={dataItems:[]};p.meanLines=y.data.dataItems;let F=Hf(r),C=(await gn({queryObject:e,queryConfig:i,fetchFullBoxPlotData:!0,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,hideZeroCountCategories:d,replaceNoValueCategoryWithZero:f,view:m,errorStrings:n,chartConfig:F,abortKey:a,abortSignal:s})).data;p.dataItems=C.dataItems,p.outliers=C.outliers,h.data=p}return h}async function Nm(t){let{queryObject:e,chartConfig:r,queryConfig:i,filterBySelection:n,selectionData:a,setTimeBinningInfoWhenNotProvided:s,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,hideZeroCountCategories:c,replaceNoValueCategoryWithZero:d,view:f,syncViewTimeZone:m,errorStrings:h,abortKey:g,abortSignal:y,fieldList:p,currentSelectionDataItems:F,dataForFilterBySelectionChanged:C,preFetchedQueryResponse:x}=t,{series:w}=r,N=Z(w),O={valid:!0};if(n)O=await wm({queryObject:e,queryConfig:i,chartConfig:r,currentSelectionDataItems:F,dataForFilterBySelectionChanged:C,selectionData:a,setTimeBinningInfoWhenNotProvided:s,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,hideZeroCountCategories:c,replaceNoValueCategoryWithZero:d,view:f,errorStrings:h,abortKey:g,abortSignal:y});else switch(N){case S.HeatSeries:Dt(e),O=await $o({chartConfig:r,queryConfig:i,queryObject:e,errorStrings:h,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,view:f,syncViewTimeZone:m,abortKey:g,abortSignal:y});break;case S.BoxPlotSeries:Fe(r)&&(O=await Tn({queryObject:e,chartConfig:r,queryConfig:i,setTimeBinningInfoWhenNotProvided:s,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,hideZeroCountCategories:c,replaceNoValueCategoryWithZero:d,view:f,errorStrings:h,abortKey:g,abortSignal:y}));break;case S.BarSeries:case S.ComboLineAndBarSeries:case S.PieSeries:case S.RadarSeries:case S.LineSeries:{let T={queryObject:e,queryConfig:i,chartConfig:r,errorStrings:h,setTimeBinningInfoWhenNotProvided:s,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,hideZeroCountCategories:c,replaceNoValueCategoryWithZero:d,view:f,abortKey:g,abortSignal:y,fieldList:p,preFetchedQueryResponse:x};Xe({xAxisValueFormatType:$e(r),setTimeBinningInfoWhenNotProvided:s,seriesConfig:w[0],queryObject:e})?O=await Bn(T):O=await gn(T);break}case S.ScatterSeries:O.data=await Ro({queryObject:e,queryConfig:i,setTimeBinningInfoWhenNotProvided:s,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,hideZeroCountCategories:c,replaceNoValueCategoryWithZero:d,view:f,chartConfig:r,errorStrings:h,abortKey:g,abortSignal:y});break;case S.HistogramSeries:O=await wo({queryObject:e,queryConfig:i,chartConfig:r,view:f,abortKey:g,abortSignal:y,errorStrings:h});break;case S.GaugeSeries:Dt(e),O=await ym({queryObject:e,chartConfig:r,queryConfig:i,chartLimits:l,errorStrings:h,abortKey:g,abortSignal:y});break}return O}async function n0(t){let{queryObject:e,chartConfig:r,abortKey:i,abortSignal:n,currentSelectionDataItems:a,dataForFilterBySelectionChanged:s,runtimeDataFilters:o,ignoreViewExtent:l,filterBySelection:u,selectionData:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,chartLimits:m,popupTemplateFieldInfosEnabled:h,hideZeroCountCategories:g,replaceNoValueCategoryWithZero:y,view:p,syncViewTimeZone:F,errorStrings:C,fieldList:x,preFetchedQueryResponse:w}=t,N={valid:!0},O=vo({queryObject:e,chartConfig:r,runtimeDataFilters:o,ignoreViewExtent:l,viewExtent:p?.extent});return jd(i),N=await Nm({chartConfig:r,queryObject:e,queryConfig:O,currentSelectionDataItems:a,dataForFilterBySelectionChanged:s,filterBySelection:u,selectionData:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,chartLimits:m,popupTemplateFieldInfosEnabled:h,hideZeroCountCategories:g,replaceNoValueCategoryWithZero:y,view:p,syncViewTimeZone:F,abortKey:i,abortSignal:n,errorStrings:C,fieldList:x,preFetchedQueryResponse:w}),N.queryConfig=O,N}function Tm(t,e,r){let i=new Map;for(let n=0;n<t.length;n+=1){let a={[r]:t[n]};v.xAxisField in a||(a[v.xAxisField]=t[n]),i.set(t[n],a)}for(let n=0;n<e.length;n+=1){let a=e[n][r];(typeof a=="string"||typeof a=="number")&&i.set(a,e[n])}return[...i.values()]}async function Om(t){let{seriesData:e,chartConfig:r,queryConfig:i,queryObject:n,categoryOrDateCount:a,behaviorAfterLimit:s,errorStrings:o,abortKey:l,abortSignal:u}=t,{series:c}=r,d=e,f=W(c),m=$e(r);if(s!==St.RenderUpToTheLimit&&a!==void 0&&a>e.length&&f!==b.BarAndLineFromFields&&f!==b.BarAndLineNoAggregation&&f!==b.PieNoAggregation&&m===S.CategoryAxisFormat){let{x:h}=c[0],g={...i,returnDistinctValues:!0,outFields:[h]};delete g.outStatistics,delete g.orderByFields,delete g.groupByFieldsForStatistics;let y=(await Le({queryObject:n,queryConfig:g,featureCount:a,errorStrings:o,abortKey:l,abortSignal:u})).map(p=>p.attributes[h]).filter(p=>p!=null);y.length>e.length&&(d=Tm(y,e,h))}return d}function Bm(t,e){let r=t,{series:i}=e;if($e(e)===S.CategoryAxisFormat&&i[0].query?.outStatistics?.[0].statisticType===A.Count){let n=i.reduce((a,s)=>{let o=s.query?.outStatistics?.[0].outStatisticFieldName??[s.y].flat()[0];return a[o]=0,a},{});for(let a=0;a<t.length;a+=1)t[a]={...n,...t[a]}}return r}var Ao=[b.BarAndLineMonoField,b.BarAndLineMultiFields,b.PieNoAggregation,b.PieFromCategory,b.BoxPlotMonoFieldAndCategory,b.BoxPlotMultiFieldsAndCategory,b.BoxPlotMonoFieldAndCategoryAndSplitBy],Mm=8e3,Ws=[{unit:$.Second,threshold:6e4,unitMs:1e3,preferredIntervalSize:[1,2,3,5,6,10,12,15,20,30,60]},{unit:$.Minute,threshold:36e5,unitMs:1e3*60,preferredIntervalSize:[1,2,3,5,6,10,12,15,20,30,60]},{unit:$.Hour,threshold:864e5,unitMs:1e3*60*60,preferredIntervalSize:[1,2,3,4,6,8,12,24]},{unit:$.Day,threshold:6048e5,unitMs:1e3*60*60*24,preferredIntervalSize:[1,2,3,4,5,6,7]},{unit:$.Week,threshold:24192e5,unitMs:1e3*60*60*24*7,preferredIntervalSize:[1,2,3,4]},{unit:$.Month,threshold:290304e5,unitMs:1e3*60*60*24*7*4,preferredIntervalSize:[1,2,3,4,6,12]},{unit:$.Year,threshold:Number.MAX_SAFE_INTEGER,unitMs:1e3*60*60*24*7*4*12,preferredIntervalSize:[1,2,4,5,10,25,50,100]}],Im="{ groupByFieldsForStatistics } WHEN { dateField }>='{ startDate }' AND { dateField }{ endDateOperand }'{ endDate }' THEN '{ y }|{ binIndex}'";function Lo(t,e){let r=t;return e===$.Week?r/=7:e===$.Month?r/=30:e===$.Year&&(r/=365),r=Math.ceil(r),r}function ft(t){let{date:e,unit:r,nextOrPrevious:i,size:n}=t;if(n!==void 0&&Number.isFinite(n)){let a=i==="next"?n:-n;switch(r){case $.Second:return z.fromMillis(e).plus({seconds:a}).valueOf();case $.Minute:return z.fromMillis(e).plus({minutes:a}).valueOf();case $.Hour:return z.fromMillis(e).plus({hours:a}).valueOf();case $.Week:case $.Day:return z.fromMillis(e).plus({days:a}).valueOf();case $.Month:return z.fromMillis(e).plus({months:a}).valueOf();case $.Year:return z.fromMillis(e).plus({years:a}).valueOf()}}return e}function Em(t){let{binFirstOrLastIndex:e,data:r,x:i,timeIntervalInfo:n}=t,{unit:a,size:s}=n,o=a===$.Week?(s??1)*7:s,l=r[e][i],u=e,c=ft({date:l,unit:a,size:o,nextOrPrevious:"next"}),d=r[u][i];for(;u+1<r.length&&d<c;)u+=1,d=r[u]?.[i];let f=u+1>=r.length,m=u;f&&r[m]!==void 0&&(m+=1);let h=f?ft({date:l,unit:a,size:o,nextOrPrevious:"next"}):r[u][i];return{binStartDate:l,binEndDate:h,last:f,nextBinFirstOrLastIndex:u,sliceStartIndex:e,sliceEndIndex:m}}function Am(t){let{binFirstOrLastIndex:e,data:r,x:i,timeIntervalInfo:n}=t,{unit:a,size:s}=n,o=a===$.Week?(s??1)*7:s,l=r[e][i],u=e,c=ft({date:l,unit:a,size:o,nextOrPrevious:"previous"}),d=r[u][i];for(;u-1>=0&&d>c;)u-=1,d=r[u]?.[i];let f=u-1<=0,m=e;return f&&r[m]!==void 0&&(m-=1),f&&(u=0),{binStartDate:f?ft({date:l,unit:a,size:o,nextOrPrevious:"previous"}):r[u][i],binEndDate:l,nextBinFirstOrLastIndex:u,sliceStartIndex:u,sliceEndIndex:m,last:f}}function Lm(t){let{binsToRegroup:e,statisticType:r,y:i,nullPolicy:n}=t,a;n!==we.Interpolate&&(a=n===we.Zero?0:null);let s=e.filter(o=>Number.isFinite(o[i]));if(s.length>0)switch(r){case A.Count:case A.Sum:a=Ld(s,o=>o[i]);break;case A.Minimum:a=pr(s,o=>o[i]).min;break;case A.Maximum:a=pr(s,o=>o[i]).max;break;case A.Average:a=Ad(s,o=>o[i]);break;case A.ContinuousPercentile:}return a}function qm(t){let{data:e,seriesConfig:r,timeIntervalInfo:i,dateMinTimestamp:n,dateMaxTimestamp:a}=t,s=[],{unit:o}=i,l=i.size??1,u=r[0],{x:c}=u,d,f;if(Ve(u)&&(f=u.temporalBinning?.nullPolicy,d=u.temporalBinning?.timeAggregationType),l>1||o===$.Week||o===$.Month||o===$.Year){let{query:m}=r[0],h=Se(r),{statisticType:g}=m?.outStatistics?.[0]??gi,y=!1,p=d===ae.End?e.length-1:0,F={binFirstOrLastIndex:p,data:e,x:c,timeIntervalInfo:i};for(;!y;){let C={},{binStartDate:x,binEndDate:w,last:N,nextBinFirstOrLastIndex:O,sliceStartIndex:T,sliceEndIndex:B}=d===ae.End?Am(F):Em(F);if(y=N,C=d===ae.End?C=e[B-1]:C=e[p],w>a&&x<a||x<n&&w>n||x>=n&&w<=a){let M=e.slice(T,B).filter(k=>!(v.dateBinModel in k));h.forEach(k=>{C[k]=Lm({binsToRegroup:M,statisticType:g,y:k,nullPolicy:f})});let q=M.map(k=>k[Ge]).filter(k=>k!==void 0),I=Zc(q);I!==void 0&&(C[Ge]=I),C[c]=x,C[v.xAxisField]=x,C[v.dateBinningRange]=[x,w],delete C[v.dateBinModel],s.push(C)}else N&&d!==ae.End&&s.length>0&&(s[s.length-1][v.dateBinningRange][1]=s[s.length-1][v.dateBinningRange][1]+1);p=O,F.binFirstOrLastIndex=O}d===ae.End&&(s=s.reverse())}else l===1?s=e.map((m,h)=>{let g=m[c],y=e[h+1]?.[c];return y=typeof y=="number"?y-1:ft({date:g,unit:o,size:l,nextOrPrevious:"next"}),{...m,[v.dateBinningRange]:[g,y]}}):s=e;return s}function qo(t){let{dateMinTimestamp:e,dateMaxTimestamp:r,timeIntervalInfo:i}=t,{size:n,unit:a}=i,s=0,o=0;if(n!==void 0&&Number.isFinite(n)&&Number.isFinite(e)&&Number.isFinite(r)){let l=-1,u=z.fromMillis(e),c=z.fromMillis(r);switch(a){case $.Second:l=c.diff(u,"seconds").get("seconds");break;case $.Minute:l=c.diff(u,"minutes").get("minutes");break;case $.Hour:l=c.diff(u,"hours").get("hours");break;case $.Day:case $.Month:case $.Year:l=c.diff(u,"days").get("days");break;case $.Week:l=c.diff(u,"weeks").get("weeks");break}Number.isFinite(l)&&(o=Math.ceil(l)+1,s=n===1?o:Math.ceil(o/n))}return{numberOfFinalBinsWithinDataRange:s,numberOfSingleBinsWithinDataRange:o}}function Do(t){let e=t[0].temporalBinning?.nullPolicy;return t.reduce((r,i)=>{r[v.dateBinModel]=void 0;let n=i.query?.outStatistics?.[0].outStatisticFieldName??[i.y].flat()[0];return e!==we.Interpolate&&(r[n]=e===we.Zero?0:null),r},{})}function Dm(t){let{dateMaxTimestamp:e,numberOfFinalBinsWithinDataRange:r,numberOfSingleBinsWithinDataRange:i,data:n,seriesConfig:a,timeIntervalInfo:s}=t,{size:o,unit:l}=s,{x:u}=a[0],c=a[0].temporalBinning?.timeAggregationType,d=n[0][u],f=e;if(o!==void 0&&Number.isFinite(o)&&i/r!==o){let m=Math.ceil(i/r)*r-i;l===$.Week&&(m*=7);let h=Do(a);if(c===ae.End){let g=n[0][u];for(let y=0;y<m;y+=1)g=ft({date:g,unit:l,size:1,nextOrPrevious:"previous"}),n.push({...h,[u]:g,[v.xAxisField]:g});m>0&&(d=n[n.length-1][u])}else{let g=n[n.length-1][u];for(let y=0;y<m;y+=1)g=ft({date:g,unit:l,size:1,nextOrPrevious:"next"}),n.push({...h,[u]:g,[v.xAxisField]:g});f=n[n.length-1][u]}}return{newDateMin:d,newDateMax:f}}function Pm(t){let{numberOfSingleBinsWithinDataRange:e,dataLength:r,unit:i}=t;return Lo(r,i)>=e}async function km(t){let{queryObject:e,queryConfig:r,x:i,errorStrings:n,abortSignal:a}=t,s=`MIN_${i}`,o=`MAX_${i}`,l=`COUNT_${i}`,u={...r,outStatistics:[{statisticType:A.Minimum,onStatisticField:i,outStatisticFieldName:s},{statisticType:A.Maximum,onStatisticField:i,outStatisticFieldName:o},{statisticType:A.Count,onStatisticField:i,outStatisticFieldName:l}]};delete u.groupByFieldsForStatistics,delete u.orderByFields;let c=await vr({queryObject:e,queryConfig:u,errorStrings:n,abortSignal:a}),d=c.get(s),f=c.get(o),m=c.get(l);return typeof d=="string"&&(d=new Date(d).valueOf()),typeof f=="string"&&(f=new Date(f).valueOf()),{dateRange:{dateMinTimestamp:d,dateMaxTimestamp:f},numberOfFeatures:m}}function Vm(t){let{newDateMin:e,newDateMax:r,seriesConfig:i,data:n,numberOfSingleBinsWithinDataRange:a,initialNumberOfBins:s,timeIntervalInfo:o}=t,{unit:l}=o,u=n;if(!Pm({numberOfSingleBinsWithinDataRange:a,dataLength:s,unit:l})){let{x:c}=i[0],d=i[0].temporalBinning?.timeAggregationType,f=Do(i),m=d===ae.End?r:e,h=d===ae.End?n.length-1:0;for(;h<n.length&&(d===ae.End&&m>e||d!==ae.End&&m<r);)m!==n[h][c]?u.push({...f,[c]:m,[v.xAxisField]:m}):h=d===ae.End?h-1:h+1,m=ft({date:m,unit:l===$.Month||l===$.Year?$.Day:l,size:1,nextOrPrevious:d===ae.End?"previous":"next"})}return u}function $m(t){let{data:e,seriesConfig:r,dateMinTimestamp:i,dateMaxTimestamp:n}=t,a=e;if(r[0].temporalBinning?.trimIncompleteTimeInterval!==!1){let{timeAggregationType:s}=r[0].temporalBinning??{},o=e[0]?.[v.dateBinningRange]?.[0],l=e[e.length-1]?.[v.dateBinningRange]?.[1];if(s===ae.End?o<i:l>n)if(s===ae.End){let u=o;for(;u<i&&e.length>0;)e.shift(),e.length>0&&(u=e[0][v.dateBinningRange]?.[0])}else{let u=l;for(;u>n&&e.length>0;)e.pop(),e.length>0&&(u=e[e.length-1][v.dateBinningRange]?.[1])}}return a}function Rm(t){let{groupByFieldsForStatistics:e,dateField:r,queryStartDate:i,queryEndDate:n,y:a,binIndex:s,lastBin:o}=t,l=e===""?Bt.groupByCaseBegin:e;return l=_e(Im,{groupByFieldsForStatistics:l,dateField:r,startDate:`${i}`,endDate:`${n}`,y:[a].flat()[0],binIndex:`${s}`,endDateOperand:o?"<=":"<"}),l}function*Wm(t){let{queryObject:e,seriesConfig:r,queryConfig:i,completeData:n,errorStrings:a,abortSignal:s}=t;for(let o=0;o<r.length;o+=1){let l=r[o],{query:u,x:c,y:d}=l,f=[{onStatisticField:u?.outStatistics?.[0]?.onStatisticField??"",outStatisticFieldName:A.ContinuousPercentile,statisticType:A.ContinuousPercentile,statisticParameters:{value:.5}}],m=Bt.groupByCaseBegin;for(let g=0;g<n.length;g+=1){let y=n[g],[p,F]=y[v.dateBinningRange],C=Kt(p),x=Kt(F);m=Rm({groupByFieldsForStatistics:m,queryStartDate:C,queryEndDate:x,dateField:c,y:[d].flat()[0],binIndex:g,lastBin:g===n.length-1})}m=`${m} ${Bt.groupByCaseEnd}`;let h={...i,groupByFieldsForStatistics:[m],outStatistics:f,orderByFields:void 0};yield Le({queryObject:e,queryConfig:h,noBatch:!0,errorStrings:a,abortSignal:s})}}async function jm(t){let{queryObject:e,data:r,seriesConfig:i,queryConfig:n,errorStrings:a,abortSignal:s}=t,o=r,{statisticType:l}=i[0].query?.outStatistics?.[0]??gi;if(l===A.ContinuousPercentile&&o.length>0){let u=Wm({queryObject:e,completeData:o,seriesConfig:i,queryConfig:n,errorStrings:a,abortSignal:s}),c=(await Promise.all(u)).flat();if(c.length>0){let{isInItem:d,expr:f}=ar(c[0].attributes);d&&c.forEach(m=>{let h=m.attributes[`${f}`];if(h!==void 0){let[g,y]=h.split("|");if(y!==void 0){let p=m.attributes[A.ContinuousPercentile];o[y][`${g}`]=p}}})}}return o}function js(t){let{dataItem:e,nullPolicy:r,statField:i}=t;if(i&&e[i]==null)switch(!0){case r===we.Zero:e[i]=0;break;case r===we.Null:e[i]=null;break;case r===we.Interpolate:delete e[i];break}}function Zm(t){let{chartConfig:e,queryResults:r,mapToStatField:i,splitByField:n,x:a,y:s,nullPolicy:o,queryObject:l}=t,u=co(a),c=Re(l).find(g=>g.name===a)?.type,d=[],f=e.series[0],m="temporalBinning"in f?f.temporalBinning?.trimIncompleteTimeInterval:!1,h="temporalBinning"in f?f.temporalBinning?.timeAggregationType:!1;return r.forEach((g,y)=>{if(!(m&&(y===0&&h===ae.End||y===r.length-1&&h===ae.Start))){let{attributes:p,stackedAttributes:F}=g,C=p[u.lowerBoundaryAlias],x=p[u.upperBoundaryAlias],w=C,N=x,O=(T,B)=>{let M=T;if(B===Q.DateOnly&&(typeof T=="string"&&T.length===10||typeof T=="number"))if(typeof T=="string"){let q=T.split("-");q.length===3&&(M=z.local(Number(q[0]),Number(q[1]),Number(q[2])).valueOf())}else M=new Date(T),M=new Date(M.valueOf()+M.getTimezoneOffset()*6e4),M=z.local(M.getFullYear(),M.getMonth()+1,M.getDate()).valueOf();else typeof T=="string"&&["+","-"].forEach(q=>{q&&T.lastIndexOf(q)===T.length-6&&(M=new Date(T.slice(0,T.lastIndexOf(q))).valueOf())});return M};if(C=O(C,c),x=O(x,c),typeof C=="number"&&typeof x=="number"){let T={...p};T[v.originalServerBinningRange]=[w,N],T[a]=C,T[v.xAxisField]=C,T[v.dateBinningRange]=[C,x],delete T[u.lowerBoundaryAlias],delete T[u.upperBoundaryAlias],F&&n&&!he(n)&&i?F.forEach(q=>{let I=q[n];if(I===null||typeof I=="string"||typeof I=="number"){let k=i?.get(I);k!==void 0&&(T[k]=q[G.outStatistics?.outStatisticFieldName??""],js({dataItem:T,statField:k,nullPolicy:o}))}}):typeof s=="string"&&js({dataItem:T,statField:s,nullPolicy:o});let{featureExtent:B,featureExtentKey:M}=Po({feature:g,splitByField:n});B&&(T[M]=B),d.push(T)}}}),d}async function _m(t){let{queryObject:e,queryResults:r,x:i,queryConfig:n,seriesConfig:a,dateRange:s,timeIntervalInfo:o,errorStrings:l,abortSignal:u}=t,c=r,{dateMinTimestamp:d,dateMaxTimestamp:f}=s;if(d&&f){let m=r.length;if(gr({arrayToSort:c,sortingField:i}),m>1){let{numberOfFinalBinsWithinDataRange:h,numberOfSingleBinsWithinDataRange:g}=qo({dateMinTimestamp:d,dateMaxTimestamp:f,timeIntervalInfo:o}),{newDateMin:y,newDateMax:p}=Dm({dateMaxTimestamp:f,data:c,numberOfFinalBinsWithinDataRange:h,numberOfSingleBinsWithinDataRange:g,seriesConfig:a,timeIntervalInfo:o});c=Vm({newDateMin:y,newDateMax:p,seriesConfig:a,data:c,initialNumberOfBins:m,numberOfSingleBinsWithinDataRange:g,timeIntervalInfo:o}),gr({arrayToSort:c,sortingField:i}),c=qm({data:c,seriesConfig:a,dateMinTimestamp:d,dateMaxTimestamp:f,timeIntervalInfo:o}),c=$m({data:c,seriesConfig:a,dateMinTimestamp:d,dateMaxTimestamp:f}),e&&(c=await jm({queryObject:e,data:c,seriesConfig:a,queryConfig:n,errorStrings:l,abortSignal:u}))}}return c}function zm(t){return Math.floor(Math.min(Math.max(8,Math.sqrt(t??8)),128)+.5)}function Hm(t){let{dateRange:e,numberOfFeatures:r}=t,i,n,{dateMinTimestamp:a,dateMaxTimestamp:s}=e;if(a&&s){typeof a=="string"&&(a=new Date(a).valueOf()),typeof s=="string"&&(s=new Date(s).valueOf());let o=zm(r),l=(s-a)/o,u=Ws.findIndex(p=>p.threshold>l),c=Ws[u],{unitMs:d,preferredIntervalSize:f}=c;({unit:i}=c);let m=l/d,h=f.findIndex(p=>p>=m),g=f[h],y=h===0?f[0]:f[h-1];n=g-m<m-y?g:y}return{size:n,unit:i}}function Um(t){let{series:e,isTimeBinningSeries:r,setTimeBinningInfoWhenNotProvided:i}=t,n=!1;if(Ve(e)&&r){let{unit:a,size:s}=e.temporalBinning??{};n=!cn(a,s)&&i===!0}return n}function Gm(t){let e=[];for(let r=1;r<=6;r+=1){let i=t[`EXPR_${r}`]??t[`Expr${r}`]??t[`expr${r}`]??t[`EXPR${r}`];i!==null&&e.push(i)}return z.local(Number(e[0]??1969),Number(e[1]??1),Number(e[2]??1),Number(e[3]??0),Number(e[4]??0),Number(e[5]??0)).valueOf()}async function ln(t){let{queryObject:e,queryConfig:r,category:i,splitByField:n,chartLimits:a,errorStrings:s,abortKey:o,abortSignal:l}=t,u=n!==void 0,c=i!==ir?[i]:[];u&&c.push(n);let d=U(e),{idField:f,isTraditionalTypeOID:m}=We(d),h=m?f:"*",g={...r,groupByFieldsForStatistics:Array.from(new Set(c)),outStatistics:[{statisticType:A.Count,onStatisticField:h,outStatisticFieldName:`${A.Count}_OBJECTID`}],orderByFields:void 0,num:a?.maxBarThreePlusSeriesCountTotal},y=await Le({queryObject:e,featureCount:1,queryConfig:g,errorStrings:s,abortKey:o,abortSignal:l});return Array.from(new Set(y.map(p=>p.attributes[u?n:i]))).sort((p,F)=>typeof p=="string"&&typeof F=="string"?p.localeCompare(F):Number(p)-Number(F))}function Po(t){let{feature:e,splitByField:r,chartSubType:i}=t,n;if(e.aggregateGeometries&&"Extent"in e.aggregateGeometries)n=e.aggregateGeometries.Extent;else{let o=e.aggregateGeometries??e.geometry;o?.extent&&(n=o.extent)}let a=n?.toJSON(),s=Ge;return a!==void 0&&r!==void 0&&i!==void 0&&i===b.BarAndLineSplitBy&&(s=e.attributes[r]!==void 0?`${Ge}_${e.attributes[r]}`:Ge),{featureExtent:a,featureExtentKey:s}}function Ym(t){let{input:e,x:r,splitByField:i}=t;return e.reduce((n,a)=>(i!==void 0&&i!==r&&!(v.technicalFieldSplitByField in a)&&delete a[i],Object.assign(n,a)),{})}function br(t){let{data:e,x:r,splitByField:i}=t,n=e;if(e!==void 0&&e.length>0){let a=new Map;for(let s of e){let o=s[r],l=a.get(o)??[];l.push(s),a.set(o,l)}a.size>0&&(n=Array.from(a.values(),s=>Ym({input:s,x:r,splitByField:i})))}return n}function Qm(t,e){let r=t,i=Z(e);if(i!==S.PieSeries&&i!==S.BoxPlotSeries){let n=Se(e),a=e[0].y;t.forEach(s=>{let o=0;if(n.forEach(l=>{let u=s[l];Number.isFinite(u)&&(o+=u)}),s[v.technicalSortingFieldBySum]=o,Number.isFinite(o)&&o>0){let l=s[a];if(Number.isFinite(l)){let u=l/o;s[v.technicalSortingFieldByPercent]=u}}})}return r}function Km(t,e){let r=e,i=Se(t),n=i.length===1;return i.forEach(a=>{let s=Yt(n?void 0:a),o=r[s[P.FirstQuartile]],l=r[s[P.ThirdQuartile]];Number.isFinite(o)&&Number.isFinite(l)&&l>=o&&(r[s[P.IQR]]=l-o)}),r}function Jm(t,e){let r=e.series[0],i=t;if(r.type===S.HeatSeries){let{x:n,y:a}=r;i[j.xField]=i[n]?.toString(),delete i[n],i[j.yField]=i[a]?.toString(),delete i[a];let s=r.query?.outStatistics?.[0]?.outStatisticFieldName;s&&(i[j.valueField]=i[s],delete i[s])}return i}function On(t,e){[e].flat().forEach(r=>{r&&(t[r]===void 0&&(t[r]=t[r.toUpperCase()]!==void 0?t[r.toUpperCase()]:t[r.toLowerCase()]),t[r]!==void 0?(r!==r.toUpperCase()&&delete t[r.toUpperCase()],r!==r.toLowerCase()&&delete t[r.toLowerCase()]):delete t[r])})}function Xm(t,e){let r=[];G.outStatistics.outStatisticFieldName&&Object.keys(t).includes(G.outStatistics.outStatisticFieldName)?r=[G.outStatistics.outStatisticFieldName]:r=Array.from(new Set(e.flatMap(i=>i.query?.outStatistics?.map(n=>n.outStatisticFieldName)))),On(t,r)}function eh(t,e){let r={...t};return t!==void 0&&e[0]!==void 0&&(r=Object.keys(t).reduce((i,n)=>{let a=e.find(s=>s.outStatisticFieldName?.toLowerCase()===n.toLowerCase())?.onStatisticField;return a!==void 0&&t[n]!==void 0&&a!==n?i[a]=t[n]:i[n]=t[n],i},{})),r}function th(t){let{dataItem:e,splitByField:r,y:i,fieldOID:n}=t;if(e!==void 0&&!he(r)&&!he(i)){let a=e[r],s=`${i}_${a?.toString()}`;e[s]=e[i],n&&i!==n&&delete e[i]}}function rh(t,e){Object.keys(t).forEach(r=>{if(r.startsWith(`${e}_`)){let i=r.slice(e.length+1);t[i]=t[r],delete t[r]}})}function ih(t,e){let r=1;switch(t){case b.BarAndLineFromFields:case b.PieFromFields:r=e.series[0].query?.outStatistics?.length??1;break;case b.BoxPlotMultiFields:case b.BoxPlotMultiFieldsAndSplitBy:r=e.series[0].y.length;break;case b.BarAndLineNoAggregation:case b.BoxPlotMonoField:case b.BoxPlotMonoFieldAndCategory:case b.BoxPlotMultiFieldsAndCategory:case b.BoxPlotMonoFieldAndSplitBy:case b.BoxPlotMonoFieldAndCategoryAndSplitBy:case b.PieFromCategory:case b.BarAndLineSplitByNoAggregation:case b.PieNoAggregation:case b.BarAndLineSplitBy:case b.BarAndLineMonoField:case b.BarAndLineMultiFields:case b.NonSpecific:}return r}function nh(t){let{attributes:e,showMean:r,chartSubType:i}=t;r&&(i===b.BoxPlotMonoFieldAndSplitBy||i===b.BoxPlotMultiFieldsAndSplitBy||i===b.BoxPlotMonoFieldAndCategoryAndSplitBy)&&(e[v.boxPlot.boxPlotMeanLineMarkerId]=!0)}function ah(t){let{queryResponse:e,chartConfig:r,maxCategoryCount:i}=t,n=W(r.series);return i&&Number.isFinite(i)&&i<e.length&&Ao.includes(n)?e.slice(0,i):e}function sh(t){let{attributes:e,uniqueCategoryList:r,maxCategoryCount:i,x:n,chartSubType:a}=t,s=!1;if(n&&i&&Number.isFinite(i)&&!Ao.includes(a))if((a===b.BarAndLineFromFields||a===b.PieFromFields)&&Object.keys(e).length>i)Object.keys(e).filter(o=>o!==A.EnvelopeAggregate).forEach((o,l)=>{l>=i&&delete e[o]});else{let o=e[n];o!==void 0&&(r.size===i&&!r.has(o)?s=!0:r.add(o))}return s}function oh(t){let{attributes:e,xValue:r,yValue:i,x:n,y:a,xFieldDomain:s,yFieldDomain:o,chartType:l,chartSubType:u,xAxisValueFormat:c,yAxisValueFormat:d}=t,f,m;u!==b.PieFromFields&&(s&&(typeof r=="string"||typeof r=="number")&&(f=hn(r,s)),o&&l===S.HeatSeries&&typeof a=="string"&&(typeof i=="string"||typeof i=="number")&&(m=hn(i,o)),f!==void 0&&f!==r&&(typeof f!="string"||!ye(c))&&(e[v.originalCategoryValue]=e[n],e[n]=f,e[v.xAxisDisplayField]=f),typeof a=="string"&&!ye(d)&&m!==void 0&&m!==i&&(e[v.originalYCategoryValue]=e[a],e[a]=m))}function lh(t){let e,[r,i,n]=t.split(":");return Number.isFinite(Number(r))&&Number.isFinite(Number(i))&&Number.isFinite(Number(n))&&(e=new Date(2e3,0,1,Number(r),Number(i),Number(n)).valueOf()),e}function ko(t){let{queryObject:e,queryResponse:r,chartConfig:i,mapToStatField:n,splitByField:a,isTimeBinningSeries:s,resultLimit:o,showMean:l,chartLimits:u,fieldList:c}=t,{series:d}=i,f=W(d),m=Z(d),{x:h}=d[0],g="y"in d[0]?d[0].y:void 0,y=d[0].query?.outStatistics??[],p=Ke(i?.axes?.[0]?.valueFormat),{originalYCategoryValue:F,originalCategoryValue:C,originalDateValue:x}=v,w=mn(e,h),N=typeof g=="string"?mn(e,g):void 0,O=bf(c??[]).includes(h),T=[],B=0,M=new Set,{maxCategoryCount:q}=bt(u),I=ah({queryResponse:r,chartConfig:i,maxCategoryCount:q});for(let k=0;I[k]&&k<I.length&&!(o!==void 0&&B>=o);k+=1){B+=ih(f,i);let _=I[k],E={..._.attributes};if(sh({attributes:E,uniqueCategoryList:M,maxCategoryCount:q,x:h,chartSubType:f}))continue;if(Xm(E,d),f===b.PieFromFields||f===b.BarAndLineFromFields)E=eh(E,y);else if(typeof g=="string"&&f===b.BarAndLineSplitByNoAggregation){let fe=U(e),{idField:ge,isTraditionalTypeOID:He}=We(fe);th({dataItem:E,splitByField:a,y:g,fieldOID:He?ge:void 0})}else g&&(f===b.BoxPlotMonoField||f===b.BoxPlotMonoFieldAndCategory||f===b.BoxPlotMonoFieldAndSplitBy||f===b.BoxPlotMonoFieldAndCategoryAndSplitBy)&&rh(E,typeof g=="string"?g:g[0]);nh({attributes:E,showMean:l,chartSubType:f});let D=E[h],Y=typeof g=="string"?E[g]:void 0;D===null&&d[0]?.query?.fetchNullValues===!0&&f!==b.PieFromFields&&(E[C]=null,D=v.nullValue),p||(O&&typeof D=="string"?D=new Date(D).valueOf():s&&(D=Gm(E))),typeof D=="string"&&c?.find(fe=>fe.name===h)?.type===Q.TimeOnly&&(E[C]=D,D=lh(D));let{outStatisticFieldName:J}=G.outStatistics??{},{featureExtent:R,featureExtentKey:ie}=Po({feature:_,splitByField:a,chartSubType:f});if(R&&(E[ie]=R),f===b.BarAndLineSplitBy&&J!==void 0){let fe=E[a],ge=n?.get(fe);ge!==void 0&&(fe===a&&(E[v.technicalFieldSplitByField]=E[ge]),E[ge]=E[J]),delete E[J]}else(f===b.PieNoAggregation||f===b.BarAndLineNoAggregation||f===b.BarAndLineSplitByNoAggregation)&&(O?E[x]=D:D!==v.nullValue&&(E[C]=D),fc({isXAxis:!0,chartType:m,valueFormat:i.axes?.[0]?.valueFormat})&&(E[v.xAxisField]=`${D}-${k}`,E[v.xAxisDisplayField]=D),E[G.uniqueIdsName]=_.getObjectId());m===S.BoxPlotSeries&&(E=Km(d,E)),m===S.PieSeries&&typeof D=="number"&&(E[C]===void 0&&(E[C]=E[h]),D=`${D}`),D!==void 0&&(E[C]===void 0&&(E[C]=E[h]),E[h]===null?E[h]=m===S.HeatSeries?"null":v.nullValue:E[h]=D,oh({attributes:E,xValue:D,yValue:Y,x:h,y:g,xFieldDomain:w,yFieldDomain:N,chartType:m,chartSubType:f,xAxisValueFormat:i.axes?.[0].valueFormat,yAxisValueFormat:i.axes?.[1]?.valueFormat}),m===S.HeatSeries&&typeof g=="string"&&E[g]===null&&(E[g]="null",E[F]=null),E[v.xAxisField]===void 0&&(E[v.xAxisField]=E[h])),E=Jm(E,i),T.push(E)}return T}async function di(t){let{queryObject:e,uniqueQuery:r,chartConfig:i,mapToStatField:n,abortKey:a,abortSignal:s,elementCount:o,isTimeBinningSeries:l,showMean:u,chartLimits:c,popupTemplateFieldInfosEnabled:d,preFetchedQueryResponse:f,errorStrings:m}=t,{series:h}=i,g=W(h),y=[],p=g===b.BarAndLineSplitBy||g===b.BarAndLineSplitByNoAggregation?de(h[0].query?.where):"",F=f??await Le({queryObject:e,queryConfig:r,featureCount:o,abortKey:a,errorStrings:m,abortSignal:s}),C=Re(e,d),{x}=h[0];return y=ko({queryObject:e,queryResponse:F,chartConfig:i,mapToStatField:n,splitByField:p,isTimeBinningSeries:l,fieldList:C,resultLimit:r.num,showMean:u,chartLimits:c}),g!==b.BarAndLineSplitByNoAggregation&&g!==b.BarAndLineFromFields&&(p!==""&&(y=br({data:y,x,splitByField:p})),y=Qm(y,h)),y}async function Vo(t){let{chartConfig:e,queryObject:r,queryConfig:i,numberMaxOfFeaturesToFetch:n,behaviorAfterLimit:a,isGaugeByFeature:s,abortSignal:o}=t,{series:l}=e,u=W(l),{x:c}=l[0],d=l.length,f,m;if(u===b.BoxPlotMonoField||u===b.BoxPlotMonoFieldAndSplitBy?(m=d,f=m):u===b.BoxPlotMultiFields||u===b.BoxPlotMultiFieldsAndSplitBy?(m=e.series[0].y.length,f=m):u===b.PieFromFields||u===b.BarAndLineFromFields?(m=l[0].query?.outStatistics?.filter(h=>h.statisticType!==A.EnvelopeAggregate).length??0,f=m):f=await Rd({queryObject:r,x:c,chartSubType:u,queryConfig:i,isGaugeByFeature:s,abortSignal:o}),f!==void 0){let h=u===b.BoxPlotMonoField||u===b.BoxPlotMonoFieldAndCategory||u===b.BoxPlotMonoFieldAndSplitBy;m=dn(u)&&!h?f*d:f}return a===St.RenderUpToTheLimit&&m!==void 0&&n!==void 0&&n<m&&(m=n,f=Math.ceil(m/d)),{categoryOrDateCount:f,elementCount:m}}async function gn(t){let{chartConfig:e,queryConfig:r,fetchFullBoxPlotData:i,queryObject:n,abortKey:a,fieldList:s,preFetchedQueryResponse:o,errorStrings:l,abortSignal:u,setTimeBinningInfoWhenNotProvided:c,returnFeaturesExtent:d,chartLimits:f,popupTemplateFieldInfosEnabled:m,hideZeroCountCategories:h}=t,g=Jt(e),y=t.replaceNoValueCategoryWithZero??v.options.replaceNoValueCategoryWithZero,p=!(h??!y),{behaviorAfterLimit:F}=f??{},C,x={valid:!0},w,N=!1,O=e.series,T=O[0],B=W(e.series);if(oe(n))C=Z(O)===S.BarSeries?await af(t):x;else{if(T!==void 0){let M=Z(O),{uniqueQuery:q,mapToStatField:I}=xn({chartConfig:e,queryObject:n,queryConfig:r,fetchFullBoxPlotData:i,setTimeBinningInfoWhenNotProvided:c,returnFeaturesExtent:d,chartLimits:f}),{categoryOrDateCount:k,elementCount:_}=await Vo({chartConfig:e,queryObject:n,queryConfig:r,behaviorAfterLimit:F,numberMaxOfFeaturesToFetch:q.num,abortSignal:u}),E=!Number.isFinite(_),D=E||je({count:_??0,seriesCount:O.length,chartType:M,chartLimits:f});if(D&&(w=await di({queryObject:n,uniqueQuery:q,chartConfig:e,preFetchedQueryResponse:o,mapToStatField:I,elementCount:_,isTimeBinningSeries:!1,showMean:g,chartLimits:f,popupTemplateFieldInfosEnabled:m,errorStrings:l,abortKey:a,abortSignal:u}),Fe(e)&&w!==void 0&&(x.data=await um({data:w,queryObject:n,fetchFullBoxPlotData:i,uniqueQuery:q,chartConfig:e,elementCount:_,chartLimits:f,errorStrings:l,abortKey:a,abortSignal:u}),f?.maxBoxPlotOutlierLimit!==void 0&&(D=(x.data.outliers??[]).length<=f.maxBoxPlotOutlierLimit,N=!D)),E&&(k=w.length,_=dn(B)?k*O.length:k,D=je({count:_,seriesCount:O.length,chartType:M,chartLimits:f})),D)){if(M===S.PieSeries){B===b.PieFromFields&&(w=ni({dataToConvert:w[0],x:ve,y:ze,fieldList:s}));let Y="";B===b.PieFromFields?Y=ze:"y"in T&&typeof T.y=="string"&&(Y=T.y),Qc(w,Y)?x.data={dataItems:w}:Qf(x,H.PieChartMixOfNegativePositiveSlices)}else if((M===S.RadarSeries||M===S.BarSeries||M===S.LineSeries||M===S.ComboLineAndBarSeries)&&(B===b.BarAndLineFromFields&&"y"in T&&typeof T.y=="string"?w=ni({dataToConvert:w[0],x:T.x,y:T.y,fieldList:s}):w=await Om({queryObject:n,seriesData:w,chartConfig:e,queryConfig:r,categoryOrDateCount:k,behaviorAfterLimit:F,errorStrings:l,abortKey:a,abortSignal:u}),_=dn(B)?w.length*O.length:w.length,D=je({count:_,seriesCount:O.length,chartType:M,chartLimits:f}),D)){p&&(w=Bm(w,e));let Y={};if(Ve(T)){let{size:J,unit:R}=T.temporalBinning??{};J!==void 0&&R!==void 0&&(Y={size:J,unit:R})}x.data={dataItems:w,timeIntervalInfo:Y}}}D||ai({dataInfo:x,chartType:M,subError:{outlierLimit:N}}),x.count=_}C=x}return C}function uh(t){let e,{start:r,end:i}=Cn({field:"",unit:t,addIntervalStatement:!1});return i&&(e=Array.from({length:i+(r===0?1:0)},(n,a)=>(a+(r??1)).toString())),e}function ch(t){return t.hideEmptyRowsAndColumns===!0&&(t.nullPolicy!==we.Zero||t.series[0].query?.outStatistics?.[0].statisticType===A.Count)}function dh(t){let{dataItems:e,valueField:r,filterOutZero:i}=t,n=[null];i&&n.push(0);let a=new Set(e.filter(o=>!n.includes(o[r])).map(o=>o[j.xField])),s=new Set(e.filter(o=>!n.includes(o[r])).map(o=>o[j.yField]));return e.filter(o=>a.has(o[j.xField])&&s.has(o[j.yField]))}function fh(t){let{dataItems:e,xUniqueValues:r,yUniqueValues:i,valueField:n,emptyCellValue:a,x:s,y:o,queryObject:l}=t,u=[],c=new Set;for(let d of e){let f=d[v.originalCategoryValue]!==void 0?d[v.originalCategoryValue]:d[j.xField],m=d[v.originalYCategoryValue]!==void 0?d[v.originalYCategoryValue]:d[j.yField];c.add(`${f}|${m}`)}for(let d of r){let f=String(d);for(let m of i){let h=String(m);if(!c.has(`${f}|${h}`)){let g=l?As({queryObject:l,fieldName:s,fieldValue:f})??d:d,y=l?As({queryObject:l,fieldName:o,fieldValue:h})??m:m;u.push({[v.originalCategoryValue]:d===null?null:d,[v.originalYCategoryValue]:m===null?null:m,[j.xField]:d===null?"null":g,[j.yField]:m===null?"null":y,[n]:a})}}}return u}function Zs(t){let{day:e,month:r,includeLeapDay:i}=t;return r===2&&e>(i?29:28)||[4,6,9,11].includes(r)&&e>30}async function $o(t){let{chartConfig:e,queryConfig:r,queryObject:i,completeHeatChartDataset:n=!0,errorStrings:a,returnFeaturesExtent:s,chartLimits:o,popupTemplateFieldInfosEnabled:l,view:u,syncViewTimeZone:c,abortKey:d,abortSignal:f}=t,m={valid:!0},h;if(Tt(e)){let{nullPolicy:g}=e,y=e.series[0],{x:p,y:F,query:C,xTemporalBinning:x,yTemporalBinning:w}=y,N=C?.outStatistics?.[0]?.outStatisticFieldName??"",O=C?.outStatistics?.[0]?.statisticType??A.Count,T=ch(e),B=j.valueField,M=g===we.Zero?0:null;if(Uf(e)){let q=await Vd({chartConfig:e,queryObject:i,queryConfig:r,returnFeaturesExtent:s,errorStrings:a,abortKey:d,abortSignal:f});if(!je({count:q?.length??0,seriesCount:1,chartType:S.HeatSeries,chartLimits:o}))ai({dataInfo:m,chartType:S.HeatSeries});else if(typeof q?.[0]=="object"){let I=Re(i,l);h=ko({queryObject:i,queryResponse:q,chartConfig:e,splitByField:"",isTimeBinningSeries:!1,chartLimits:o,resultLimit:r.num,fieldList:I});let k=await ln({queryObject:i,queryConfig:r,category:p,errorStrings:a,abortKey:d,abortSignal:f}),_=await ln({queryObject:i,queryConfig:r,category:F,errorStrings:a,abortKey:d,abortSignal:f});h.length!==k?.length*_?.length&&(h=[...h,...fh({dataItems:h,xUniqueValues:k,yUniqueValues:_,valueField:B,emptyCellValue:M,x:p,y:F,queryObject:i})],T&&(h=dh({dataItems:h,valueField:B,filterOutZero:O===A.Count})))}}else{let q=await kd({chartConfig:e,queryObject:i,queryConfig:r,view:u,syncViewTimeZone:c,errorStrings:a,abortSignal:f}),I=w?uh(w.unit):await ln({queryObject:i,queryConfig:r,category:F,errorStrings:a,abortKey:d,abortSignal:f}),k=0;h=q?.features.flatMap(_=>{let E=[],{attributes:D,stackedAttributes:Y}=_,J=[];if(Y?.forEach(R=>{let ie=`${R[F]}`;J.push(ie),E.push({[j.xField]:`${D[G.heatChartLowerBoundaryAlias]}`,[j.yField]:ie,[B]:R[N]})}),n&&I&&J.length!==I?.length){let R=I.filter(ie=>!J.includes(ie.toString()));T&&(R.length!==I.length||J.length===0)||R.forEach(ie=>{Number.isFinite(Number(D[G.heatChartLowerBoundaryAlias]))&&Number.isFinite(Number(ie))&&(x?.unit===Ce.DayOfMonth&&w?.unit===Ce.MonthOfYear&&Zs({day:Number(D[G.heatChartLowerBoundaryAlias]),month:Number(ie),includeLeapDay:e.includeLeapDay})||w?.unit===Ce.DayOfMonth&&x?.unit===Ce.MonthOfYear&&Zs({day:Number(ie),month:Number(D[G.heatChartLowerBoundaryAlias]),includeLeapDay:e.includeLeapDay}))||E.push({[j.xField]:`${D[G.heatChartLowerBoundaryAlias]}`,[j.yField]:ie,[B]:g===we.Zero?0:null})})}return k+=E.length,E}),je({count:k,seriesCount:1,chartType:S.HeatSeries,chartLimits:o})||ai({dataInfo:m,chartType:S.HeatSeries})}h&&(m.data={dataItems:h,heatChartAxesData:Bo({chartConfig:e,chartData:h})})}return m}function mh(t){let{chartConfig:e,data:r,chartLimits:i}=t,n=e.series,a=r,s=ro(e,i);if(s!==void 0){let o=Se(n);if(o.length===1)a=r.filter(l=>Number.isFinite(l[o[0]])).slice(0,s);else if(r.length*o.length>s){let l=[],u=0,c=0;for(;u<=s&&c<r.length;){let d=r[c];if(l.push(d),u+=o.filter(f=>Number.isFinite(d[f])).length,u>s){let f=u-s,m=o.length-1;for(;f!==0&&m>=0;){let h=o[m];Number.isFinite(d[h])&&(delete d[h],f-=1),m-=1}}c+=1}a=l}}return a}async function Bn(t){let{chartConfig:e,queryConfig:r,queryObject:i,abortKey:n,abortSignal:a,preFetchedQueryResponse:s,errorStrings:o,setTimeBinningInfoWhenNotProvided:l,returnFeaturesExtent:u,chartLimits:c,popupTemplateFieldInfosEnabled:d,view:f,syncViewTimeZone:m}=t,{behaviorAfterLimit:h}=c??{},g=e.series,y=g[0],{x:p}=y,F=de(y.query?.where),C={valid:!0},x;if(Ve(y)){let{temporalBinning:w}=y;if(i&&w){let{unit:N,size:O}=w,T=1,B={unit:N,size:O},M=!1,q=Um({series:y,isTimeBinningSeries:!0,setTimeBinningInfoWhenNotProvided:l}),I=!Qt(F,i)||q?await km({queryObject:i,queryConfig:r,x:p,errorStrings:o,abortSignal:a}):void 0;q&&I&&I.numberOfFeatures>0&&I.dateRange.dateMaxTimestamp!==void 0&&I.dateRange.dateMinTimestamp!==void 0&&(B=Hm(I),Re(i).find(D=>D.name===p)?.type===Q.DateOnly&&B.unit!==void 0&&[$.Hour,$.Minute,$.Second].includes(B.unit)&&(B.unit=$.Day,B.size=1),w.size=B.size,w.unit=B.unit);let{uniqueQuery:k,mapToStatField:_}=xn({chartConfig:e,queryConfig:r,queryObject:i,timeIntervalInfo:B,setTimeBinningInfoWhenNotProvided:l,returnFeaturesExtent:u,chartLimits:c}),E=je({count:T??0,seriesCount:g.length,chartType:S.LineSeries,chartLimits:c});if(E){if(Qt(F,i)){let D=e.axes?.[0].valueFormat.type===S.DateAxisFormat?e.axes[0].valueFormat.intlOptions.timeZone:void 0,Y=s?.[0]instanceof Yu?s:await Zd({queryObject:i,dateField:p,splitByField:F,queryConfig:k,axisTimeZone:D,temporalBinning:w,errorStrings:o,view:f,syncViewTimeZone:m,abortSignal:a}),J="y"in y&&typeof y.y=="string"?y.y:void 0;if(x=Zm({chartConfig:e,queryResults:Y,mapToStatField:_,splitByField:F,x:p,y:J,nullPolicy:w.nullPolicy,queryObject:i}),!je({count:x.length,seriesCount:g.length,chartType:S.LineSeries,chartLimits:c})){let R=Se(g),ie=x.filter(fe=>R.some(ge=>ge in fe&&Number.isFinite(fe[ge]))).length;je({count:ie,seriesCount:g.length,chartType:S.LineSeries,chartLimits:c})||(E=!1)}}else if(I?.dateRange.dateMinTimestamp&&I.dateRange.dateMaxTimestamp){let{numberOfFinalBinsWithinDataRange:D}=qo({dateMinTimestamp:I.dateRange.dateMinTimestamp,dateMaxTimestamp:I.dateRange.dateMaxTimestamp,timeIntervalInfo:B});T=D*g.length,T=Lo(T,B.unit),x=await di({queryObject:i,uniqueQuery:k,chartConfig:e,mapToStatField:_,elementCount:T,chartLimits:c,isTimeBinningSeries:!0,popupTemplateFieldInfosEnabled:d,errorStrings:o,abortKey:n,abortSignal:a}),x=await _m({queryObject:i,queryConfig:r,queryResults:x,x:p,seriesConfig:g,dateRange:I.dateRange,timeIntervalInfo:B,errorStrings:o,abortSignal:a})}Ks(i)&&x&&x?.length===Mm&&(M=!0),h===St.RenderUpToTheLimit&&x&&(x=mh({chartConfig:e,chartLimits:c,data:x}))}E||(C.valid=!1,C.invalidType=H.LineChartExceedsLimit),x&&x.length>0&&(x[x.length-1][v.lastTemporalBin]=!0),C.data={dataItems:x,timeIntervalInfo:B,serverLimitReached:M},C.count=T}}return C}async function hh(t){let{chartConfig:e,queryConfig:r,queryObject:i,abortKey:n,setTimeBinningInfoWhenNotProvided:a,returnFeaturesExtent:s,chartLimits:o,popupTemplateFieldInfosEnabled:l,errorStrings:u}=t,c=Jt(e),d={valid:!0},f=e.series,m=Xe({seriesConfig:f[0],xAxisValueFormatType:$e(e),setTimeBinningInfoWhenNotProvided:a,queryObject:i}),{uniqueQuery:h,mapToStatField:g}=xn({chartConfig:e,queryObject:i,queryConfig:r,setTimeBinningInfoWhenNotProvided:a,fetchFullBoxPlotData:!c,returnFeaturesExtent:s,chartLimits:o}),y=await di({queryObject:i,uniqueQuery:h,elementCount:1,chartConfig:e,mapToStatField:g,isTimeBinningSeries:m,showMean:c,chartLimits:o,popupTemplateFieldInfosEnabled:l,errorStrings:u,abortKey:n});return Fe(e)&&(y=Oo({chartConfig:e,data:y,calculateZScore:!1})),d.data={dataItems:y},d}async function yh(t){let{chartConfig:e,queryConfig:r,queryObject:i,setTimeBinningInfoWhenNotProvided:n,returnFeaturesExtent:a,chartLimits:s,popupTemplateFieldInfosEnabled:o,hideZeroCountCategories:l,replaceNoValueCategoryWithZero:u,view:c,abortKey:d,errorStrings:f}=t,m={valid:!0};if(Fe(e)){let h=Fe(e)?e.showMean:!1;m=await Tn({queryObject:i,chartConfig:e,queryConfig:r,setTimeBinningInfoWhenNotProvided:n,returnFeaturesExtent:a,chartLimits:s,popupTemplateFieldInfosEnabled:o,hideZeroCountCategories:l,replaceNoValueCategoryWithZero:u,view:c,errorStrings:f,abortKey:d}),h&&m.data&&"dataItems"in m.data&&"meanLines"in m.data&&m.data.meanLines&&(m.data.dataItems=[...m.data.dataItems,...m.data.meanLines])}return m}var gh="{ groupByFieldsForStatistics } WHEN ({ y } { yMinOperand } { yValue } AND { y } { yMaxOperand } { yValuePlusStep } AND { x } { xMinOperand } { xValue } AND { x } { xMaxOperand } { xValuePlusStep }) THEN '{ xValue }|{ xValuePlusStep}|{ yValue }|{ yValuePlusStep }'";async function ph(t){let{chartConfig:e,queryObject:r,queryConfig:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o=e.series[0],{x:l,y:u}=o,{dataContextCountDistinctX:c,dataContextCountDistinctY:d}=v.scatterplotAggregationFields,f={...i,outStatistics:[{statisticType:A.Count,outStatisticFieldName:c,onStatisticField:l},{statisticType:A.Count,outStatisticFieldName:d,onStatisticField:u}],returnDistinctValues:!0};return await vr({queryObject:r,queryConfig:f,errorStrings:n,abortKey:a,abortSignal:s})}async function Sh(t){let{statsMap:e,chartConfig:r,queryObject:i,chartLimits:n,queryConfig:a,errorStrings:s,abortKey:o,abortSignal:l}=t,{dataContextXMinField:u,dataContextXMaxField:c,dataContextYMinField:d,dataContextYMaxField:f,dataContextCountDistinctX:m,dataContextCountDistinctY:h}=v.scatterplotAggregationFields,g,y,p,F,C,x=e.get(u),w=e.get(c),N=e.get(d),O=e.get(f);if(x!=null&&N!==void 0&&N!==null&&w!==void 0&&w!==null&&O!==void 0&&O!==null&&!Number.isNaN(x+w+N+O)){let{maxScatterPointsAfterAggregation:T}=bt(n),B=Math.floor(Math.sqrt(T)),M=await ph({queryObject:i,chartConfig:r,queryConfig:a,errorStrings:s,abortKey:o,abortSignal:l});p=Math.min(M.get(h)??Number.NaN,B),F=Math.min(M.get(m)??Number.NaN,B),C=F*p,g=w===x?0:(w-x)/(F-1),y=O===N?0:(O-N)/(p-1),e.set(v.scatterplotAggregationFields.xStep,g),e.set(v.scatterplotAggregationFields.yStep,y),e.set(v.scatterplotAggregationFields.rowCount,p),e.set(v.scatterplotAggregationFields.columnCount,F),e.set(v.scatterplotAggregationFields.realGridSize,C)}}function bh(t){let{groupByFieldsForStatistics:e,x:r,y:i,xValue:n,yValue:a,xStep:s,yStep:o,endOfRow:l,endOfColumn:u}=t,c=e===""?Bt.groupByCaseBegin:e;return c=_e(gh,{groupByFieldsForStatistics:c,x:r,y:i,xValue:`${n}`,yValue:`${a}`,xValuePlusStep:`${n+(u?0:s)}`,yValuePlusStep:`${a+(l?0:o)}`,xMinOperand:u?"=":">=",yMinOperand:l?"=":">=",xMaxOperand:u?"=":"<",yMaxOperand:l?"=":"<"}),c}async function vh(t){let{chartConfig:e,queryConfig:r,queryObject:i,xMin:n,xMax:a,yMin:s,yMax:o,errorStrings:l,abortKey:u,abortSignal:c}=t,d=e.series[0],{x:f,y:m}=d,h={...r};return h.where=ee([h.where,`${f}>=${n}`,`${f}<=${a}`]),f!==m&&(h.where=ee([h.where,`${m}>=${s}`,`${m}<=${o}`])),await Le({queryObject:i,queryConfig:h,noBatch:!0,featureCount:1,errorStrings:l,abortKey:u,abortSignal:c})}async function Fh(t){let{statsMap:e,chartConfig:r,queryObject:i,queryConfig:n,useQueryAttributeBins:a,errorStrings:s,abortKey:o,abortSignal:l}=t,u=r.series[0],{x:c,y:d}=u,{dataContextXMinField:f,dataContextXMaxField:m,dataContextYMinField:h,dataContextYMaxField:g,queryNumberOfFeatures:y,queryNumberOfAggregatedFeatures:p}=v.scatterplotAggregationFields,F,C=e?.get(f)??Number.NaN,x=e?.get(m)??Number.NaN,w=e?.get(y)??Number.NaN,N=e?.get(h)??C,O=e?.get(g)??x;if(C!=null&&N!==void 0&&N!==null&&x!==void 0&&x!==null&&O!==void 0&&O!==null&&!Number.isNaN(C+x+N+O)){let T=U(i),{idField:B,isTraditionalTypeOID:M}=We(T),q=M?B:"*",I=e?.get(v.scatterplotAggregationFields.xStep),k=e?.get(v.scatterplotAggregationFields.yStep),_=e?.get(v.scatterplotAggregationFields.realGridSize),E=e?.get(v.scatterplotAggregationFields.rowCount),D=e?.get(v.scatterplotAggregationFields.columnCount),Y=new Map,J=Re(i);if(J?.forEach(R=>{Sr(R)&&Y.set(R.name,{onStatisticField:R.name,outStatisticFieldName:R.name,statisticType:A.Maximum})}),(J.filter(R=>u?.additionalTooltipFields?.includes(R.name))??[])?.forEach(R=>{Sr(R)||Y.set(R.name,{onStatisticField:R.name,outStatisticFieldName:R.name,statisticType:A.Maximum})}),(await bo(T)).forEach(R=>{Y.set(R,{onStatisticField:R,outStatisticFieldName:R,statisticType:A.Maximum})}),B!==""&&Y.set(B,{onStatisticField:q,outStatisticFieldName:p,statisticType:A.Count}),Y.set(c,{onStatisticField:c,outStatisticFieldName:c,statisticType:A.Maximum}).set(d,{onStatisticField:d,outStatisticFieldName:d,statisticType:A.Maximum}),I!==void 0&&k!==void 0){if(a){let R={...n,outStatistics:[...Y.values()]};F=await $d({queryObject:i,queryConfig:R,xStep:I,xMin:C,xMax:x,x:c,y:d,yStep:k,errorStrings:s,abortSignal:l})}else if(E!==void 0&&D!==void 0){let R=0,{maxScatterCellsPerQuery:ie,maxScatterCellsPerQueryForStandard:fe}=nr(),ge=await Ff(T,l)?fe:ie,He=[],fi=!0,Et=C,ht=N,At="",xr=1,mi=1,Cr=Number.MAX_SAFE_INTEGER,wr=Number.MIN_SAFE_INTEGER,Nr=Number.MAX_SAFE_INTEGER,Tr=Number.MIN_SAFE_INTEGER;for(;mi<=D&&fi;){for(ht=N,xr=1;xr<=E&&fi;){if(At=bh({groupByFieldsForStatistics:At,x:c,y:d,xValue:Et,yValue:ht,xStep:I,yStep:k,endOfRow:xr===E,endOfColumn:mi===D}),Et<Cr&&(Cr=Et),Et+I>wr&&(wr=Et+I),ht<Nr&&(Nr=ht),ht+I>Tr&&(Tr=ht+k),R+=1,R%ge===0||R===_||R===w){At=`${At} ${Bt.groupByCaseEnd}`;let _o={...n,groupByFieldsForStatistics:[At],outStatistics:[...Y.values()]};He.push(vh({chartConfig:r,queryConfig:_o,queryObject:i,xMin:Cr,xMax:wr,yMin:Nr,yMax:Tr,errorStrings:s,abortKey:o,abortSignal:l})),Cr=Number.MAX_SAFE_INTEGER,wr=Number.MIN_SAFE_INTEGER,Nr=Number.MAX_SAFE_INTEGER,Tr=Number.MIN_SAFE_INTEGER,At="",R===_&&(fi=!1)}ht+=k,xr+=1}Et+=I,mi+=1}F=(await Promise.all(He)).flat()}}}return F}async function xh(t){let{chartConfig:e,queryConfig:r,queryObject:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o=e.series[0],{x:l,y:u}=o,c=new Map,{dataContextXMinField:d,dataContextXMaxField:f,dataContextYMinField:m,dataContextYMaxField:h,queryNumberOfFeatures:g}=v.scatterplotAggregationFields,{idField:y,isTraditionalTypeOID:p}=We(U(i)),F=p?y:"*",C=[{statisticType:A.Count,onStatisticField:F,outStatisticFieldName:g},{statisticType:A.Minimum,outStatisticFieldName:d,onStatisticField:l},{statisticType:A.Maximum,outStatisticFieldName:f,onStatisticField:l}];l!==u&&C.push({statisticType:A.Minimum,outStatisticFieldName:m,onStatisticField:u},{statisticType:A.Maximum,outStatisticFieldName:h,onStatisticField:u});let x={...r};return x.outStatistics=C,c=await vr({queryObject:i,queryConfig:x,errorStrings:n,abortKey:a,abortSignal:s}),l===u&&(c.set(m,c.get(d)??Number.NaN),c.set(h,c.get(f)??Number.NaN)),c}function ei(t){let{value:e,valueMin:r,valueMax:i}=t;return e===r||e===i?e:Math.random()*(i-r)+r}function Ch(t){let{useQueryAttributeBins:e,graphic:r,x:i,y:n,yStep:a}=t,{groupByOutKeyword:s}=Bt,{dataContextXMinField:o,dataContextXMaxField:l,dataContextYMinField:u,dataContextYMaxField:c}=v.scatterplotAggregationFields,d=[];if(e&&"stackedAttributes"in r&&r.stackedAttributes){let f=lo(i,n),m=r.attributes[f.lowerBoundaryAlias],h=r.attributes[f.upperBoundaryAlias];r.stackedAttributes.forEach(g=>{let y=g[f.stackAlias],p;typeof y=="number"&&typeof a=="number"&&(y*=a),typeof y=="number"&&typeof a=="number"&&(p=y+a);let F=g[i],C=g[n];typeof y=="number"&&typeof p=="number"&&typeof F=="number"&&typeof C=="number"&&d.push({...g,[i]:ei({value:F,valueMin:m,valueMax:h}),[n]:ei({value:C,valueMin:y,valueMax:p}),[o]:Math.min(m,h),[l]:Math.max(m,h),[u]:y,[c]:p})})}else{let{expr:f,isInItem:m}=ar(r.attributes);if(m&&f&&r.attributes[f]!==s){let[h,g,y,p]=r.attributes[f].split("|");h=Math.min(h,g),g=Math.max(h,g),y=Math.min(y,p),p=Math.max(y,p);let F={...r.attributes,[o]:h,[l]:g,[u]:y,[c]:p};F[i]=ei({value:F[i],valueMin:h,valueMax:g}),F[n]=ei({value:F[n],valueMin:y,valueMax:p}),d=[F]}}return d}function wh(t){let{chartConfig:e,rawData:r,isAggregationMode:i,yStep:n,useQueryAttributeBins:a}=t,s=e.series[0],{x:o,y:l}=s,u=(Array.isArray(r)?r:r?.features)?.flatMap(c=>{let d=[{...c.attributes}];return On(d[0],[o,l]),i?d=Ch({useQueryAttributeBins:a,graphic:c,x:o,y:l,yStep:n}):d[0][G.uniqueIdsName]=c.getObjectId(),d});return u=u?.filter(c=>{let{expr:d}=ar(c);return Number.isFinite(c[o])&&Number.isFinite(c[l])&&(d===void 0||c[d]!==Bt.groupByOutKeyword)}),u??[]}async function Nh(t){let{queryObject:e,queryConfig:r,chartConfig:i,featureCount:n,errorStrings:a,abortKey:s,abortSignal:o}=t,l=i.series[0],{x:u,y:c}=l,d=U(e),f=[],m=Re(e),h=li(d).idFields,g=(m?.filter(x=>Sr(x)&&x.name!==u&&x.name!==c)??[]).map(x=>x.name)??[],y=l?.additionalTooltipFields??[],p=Array.from(new Set([u,c,...h??[],...g,...y])),F=Be(d);if(F&&!F.isTable){let{rendererField:x,rendererNormalizationField:w}=pf(d?.renderer??void 0);he(x)||p.push(x),he(w)||p.push(w)}let C={...r,orderByFields:[`${u} ${be.Ascending}`],outFields:p};return f=await Le({queryObject:e,queryConfig:C,featureCount:n,errorStrings:a,abortKey:s,abortSignal:o}),f}async function Th(t){let e,{chartConfig:r,queryConfig:i,queryObject:n,statsMap:a,numberOfFeatures:s,isAggregationMode:o,useQueryAttributeBins:l,errorStrings:u,abortKey:c,abortSignal:d}=t,f=r.series[0],{x:m,y:h}=f;if(!Number.isNaN(s)&&s>0){let g={...i};g.where=ee([g.where,`${m} IS NOT NULL`,`${h} IS NOT NULL`]),o?e=await Fh({chartConfig:r,queryObject:n,queryConfig:g,statsMap:a,useQueryAttributeBins:l,errorStrings:u,abortKey:c,abortSignal:d}):e=await Nh({queryObject:n,chartConfig:r,queryConfig:g,featureCount:s,errorStrings:u,abortKey:c,abortSignal:d})}return e}async function Ro(t){let{chartConfig:e,queryConfig:r,queryObject:i,sortData:n,calculateTrendLine:a,chartLimits:s,errorStrings:o,abortKey:l,abortSignal:u}=t,c;if(oe(i))c=await Jd(t);else{let d=await xh({chartConfig:e,queryConfig:r,queryObject:i,errorStrings:o,abortKey:l,abortSignal:u}),{queryNumberOfFeatures:f,yStep:m}=v.scatterplotAggregationFields,{maxScatterPointsBeforeAggregation:h}=bt(s),g=d?.get(f)??Number.NaN,y=g>=h,p=pc(i);y&&await Sh({statsMap:d,chartConfig:e,queryObject:i,chartLimits:s,queryConfig:r,errorStrings:o,abortKey:l,abortSignal:u});let F=await Th({...t,queryObject:i,statsMap:d,numberOfFeatures:g,isAggregationMode:y,useQueryAttributeBins:p}),C=wh({chartConfig:e,rawData:F,isAggregationMode:y,yStep:d.get(m),useQueryAttributeBins:p});n!==!1&&gr({arrayToSort:C,sortingField:e.series[0].x,orderBy:be.Ascending});let{r2:x,trendLinePoints:w}=a!==!1?await mo({data:C,statsMap:d,queryConfig:r,queryObject:i,chartConfig:e,errorStrings:o,abortSignal:u}):v.scatterplotSeries;c={dataItems:C,r2:x,trendLinePoints:w,aggregated:y}}return c}function Yt(t){let e=t===void 0||t==="";return{[P.Average]:`${e?"":`${t}_`}${P.Average}`,[P.Min]:`${e?"":`${t}_`}${P.Min}`,[P.Max]:`${e?"":`${t}_`}${P.Max}`,[P.FirstQuartile]:`${e?"":`${t}_`}${P.FirstQuartile}`,[P.Median]:`${e?"":`${t}_`}${P.Median}`,[P.ThirdQuartile]:`${e?"":`${t}_`}${P.ThirdQuartile}`,[P.IQR]:`${e?"":`${t}_`}${P.IQR}`,[P.Outlier]:`${e?"":`${t}_`}${P.Outlier}`,[P.StandardDeviation]:`${e?"":`${t}_`}${P.StandardDeviation}`}}function Wo(t){return"subType"in t&&t.subType===Pn.FeatureGauge}function Mn(t){let e;return t!==void 0&&("bins"in t?e=t.bins:"dataItems"in t&&(e=t.dataItems)),e}function jo(t){return t===b.BoxPlotMultiFields||t===b.BoxPlotMultiFieldsAndCategory||t===b.BoxPlotMultiFieldsAndSplitBy}function se(t){let{key:e,y:r,chartSubType:i,splitBy:n,splitByValue:a,showOutliers:s,standardizeValues:o}=t,l=a,u=Yt(r)[e];return s===!0&&(e===P.Min||e===P.Max)&&(u=`${u}${$n}`),o===!0&&(jo(i)||e===P.Outlier)&&(u=`${u}${Rn}`),(a===void 0||`${a}`.trim()==="")&&(l=xe({where:n,normalize:!0,escape:!1})),l!==void 0&&`${l}`.trim()!==""&&(u=`${l}${u!==""?`_${u}`:""}`),u}function un(t){let{dataItem:e,y:r,splitBy:i,showOutliers:n}=t,a=se({key:P.FirstQuartile,y:r,splitBy:i,showOutliers:n}),s=se({key:P.ThirdQuartile,y:r,splitBy:i,showOutliers:n});return Number.isFinite(e[a])||Number.isFinite(e[s])}function Oh(t){let{configSeries:e,boxPlotDataItem:r,yList:i,showOutliers:n}=t,a=W(e),s=!1;switch(a){case b.BoxPlotMonoField:case b.BoxPlotMultiFields:case b.BoxPlotMonoFieldAndCategory:s=un({dataItem:r,showOutliers:n});break;case b.BoxPlotMultiFieldsAndCategory:s=i.some(o=>un({dataItem:r,y:o,showOutliers:n}));break;case b.BoxPlotMonoFieldAndSplitBy:case b.BoxPlotMultiFieldsAndSplitBy:case b.BoxPlotMonoFieldAndCategoryAndSplitBy:s=e.some(o=>un({dataItem:r,splitBy:o.query?.where,showOutliers:n}));break;default:s=!1;break}return s}function Zo(t){return t.map(e=>e.id).filter(e=>e!==void 0)}function Se(t,e){let r=[],i=e??Zo(t),n=W(t);return r=t.filter(a=>i.includes(a.id)).map(a=>{let s="y"in a?a.y:void 0;return s!==void 0&&n===b.BarAndLineSplitByNoAggregation&&(s=`${s.toString()}_${xe({where:a.query?.where,keepSurroundingQuotes:!1,escape:!1})}`),s}).filter(a=>a!==void 0),Array.from(new Set(r.flat()))}function In(t){let{seriesConfig:e,filteredSeriesIds:r,showMean:i}=t,n=[];if(i===!0){let a=e.find(s=>s.type===S.BoxPlotSeries);a!==void 0&&"y"in a&&(n=[a.y].flat())}else n=Se(e,r);return n}function lt(t,e){return t===null&&e===!0||Number.isFinite(t)}function Bh(t){let{dataItem:e,x:r,y:i,nullAsValid:n=!1,aggregationType:a=A.Count}=t,s=e[r],o=e[i];return s!==void 0&&(typeof s!="number"||Number.isFinite(s))&&lt(o,n)&&(a!==A.Count||o!==0)}function a0(t){let{chartConfig:e,nullAsValid:r=!1,dataSet:i}=t,n=!0;if(e!==void 0){let a=Z(e.series);if(i===void 0||i.length===0)n=!0;else{let s=Se(e.series);n=!i.some(o=>{let l=!1;switch(a){case S.HistogramSeries:{let u=o;l=lt(u.minValue,r)&&lt(u.maxValue,r)}break;case S.ScatterSeries:{let u=o,{x:c,y:d}=e.series[0];l=lt(u[c],r)&&lt(u[d],r)}break;case S.ComboLineAndBarSeries:case S.RadarSeries:case S.LineSeries:case S.BarSeries:{let u=o,{x:c}=e.series[0];l=s.some(d=>Bh({dataItem:u,x:c,y:d,nullAsValid:r,aggregationType:e.series[0].query?.outStatistics?.[0]?.statisticType}));break}case S.BoxPlotSeries:{if(Fe(e)){let u=e.series;l=Oh({configSeries:u,boxPlotDataItem:o,yList:s,showOutliers:e.showOutliers})}break}case S.PieSeries:{let u=o,{x:c,y:d}=e.series[0];W(e.series)===b.PieFromFields&&(c=ve,d=ze);let f=u[d];l=u[c]!==void 0&&u[c]!==null&&!Ln(f)&&lt(Number(f),r)}break;case S.GaugeSeries:{let{x:u}=e.series[0];l=lt(o[u],r)}break;case S.HeatSeries:l=i.some(u=>lt(u[j.valueField],r));break}return l})}}return n}function Mh(t,e){let r=new Map,i=e??Zo(t);return t.forEach(n=>{if(i.includes(n.id)&&"y"in n){let a=r.get(n.type)??[];a.push(n.y),r.set(n.type,a)}}),r}function Ih(t){let{seriesConfig:e,filteredSeriesIds:r,filteredData:i}=t,n=Mh(e,r),a=e.find(u=>u.type===S.LineSeries||u.type===S.RadarSeries)?.stackNegativeValuesToBaseline??!0,s=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER,l=!1;return i.forEach(u=>{n.forEach(c=>{if(a){let d=0,f=0,m=!1,h=!1;for(let g=0;g<c.length;g+=1){let y=u[c[g]];Number.isFinite(y)&&(y<0?(f+=y,h=!0,l=!0):(d+=y,m=!0))}s=m?Math.max(s,d):s,o=h?Math.min(o,f):o,m&&!h&&(o=Math.min(o,d)),!m&&h&&(s=Math.max(s,f)),m&&d<=0&&(l=!0)}else{let d=0;for(let f=0;f<c.length;f+=1){let m=u[c[f]];d+=m,s=Math.max(s,d),o=Math.min(o,d)}(s<=0||o<=0)&&(l=!0)}})}),{stackedMinY:o,stackedMaxY:s,dataHasNegativeValues:l}}function Eh(t){let{dataItem:e,...r}=t,i=se({key:P.Min,...r}),n=se({key:P.Max,...r}),a=e[i],s=e[n];return{min:a,max:s}}function _s(t){let e=Number.NaN,r=Number.NaN,i,n,{chartConfig:a,chartData:s,filteredSeriesIds:o}=t,{series:l}=a;if(l?.length>0){let{x:u}=l[0],c=Z(a.series);if(c===S.HistogramSeries&&s.length>0){let d=s[0]?.[qs.Start],f=s[s.length-1]?.[qs.End];i=typeof d=="number"?d:i,n=typeof f=="number"?f:n}else{let d=s.filter(f=>f[u]!==null);if({min:i,max:n}=pr(d,f=>f[u]),a.axes?.[0]?.valueFormat.type===S.DateAxisFormat&&i!==void 0&&n!==void 0&&([i,n]=[new Date(i).valueOf(),new Date(n).valueOf()]),c===S.BoxPlotSeries){e=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;let f=Se(l,o),m=W(l),h="standardizeValues"in a?a.standardizeValues===!0:void 0,g=a.series.map(y=>y.visible!==!1?xe({where:y.query?.where}):"");g.length===0&&g.push(" "),d.forEach(y=>{f.forEach(p=>{let F=m===b.BoxPlotMultiFieldsAndCategory?p:void 0;g.forEach(C=>{let{min:x,max:w}=Eh({y:F,splitByValue:C,chartSubType:m,showOutliers:!1,standardizeValues:h,dataItem:y});x!=null&&x<e&&(e=x),w!=null&&w>r&&(r=w)})})})}else switch(Ir(a)){case qe.Stacked100:case qe.Stacked:{let{stackedMinY:f,stackedMaxY:m}=Ih({seriesConfig:l,filteredData:d,filteredSeriesIds:o});e=f,r=m;break}case qe.Side:default:{e=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER,Se(l,o).forEach(f=>{let{min:m,max:h}=pr(d,g=>g[f]);m!==void 0&&m<e&&(e=m),h!==void 0&&h>r&&(r=h)});break}}}}return{minY:e,maxY:r,minX:i,maxX:n}}function Ah(t){let{chartConfig:e,isSecondValueAxis:r,seriesIds:i}=t,n=i;return e.axes?.length===3&&(n=e.series.map(a=>{let s="";return(i===void 0||i.includes(a.id))&&(r===!0&&"assignToSecondValueAxis"in a&&a.assignToSecondValueAxis===!0||r!==!0&&(!("assignToSecondValueAxis"in a)||a.assignToSecondValueAxis!==!0))&&({id:s}=a),s}).filter(a=>a!=="")),n}function Lh(t){let e=!1;if(t){let r=t.axes?.[0],i=r?.isLogarithmic===!0,n=r?.valueFormat?.type;e=(n===S.NumberAxisFormat||n===S.DateAxisFormat)&&i}return e}function zs(t,e){let r=!1;return Number.isFinite(t)&&t!==Number.MAX_SAFE_INTEGER&&Number.isFinite(e)&&e!==Number.MIN_SAFE_INTEGER&&(r=t<=0||e<=0),r}function qh(t){let{chartConfig:e,chartData:r,axisConfigIndex:i}=t,n=!1;if(i===0){if(Lh(e)){let{minX:a,maxX:s}=_s({chartConfig:e,chartData:r});n=zs(a,s)}}else{let a=Ah({chartConfig:e,isSecondValueAxis:i===2}),{minY:s,maxY:o}=_s({chartConfig:e,chartData:r,filteredSeriesIds:a});n=zs(s,o)}return n}function s0(t){let{chartConfig:e,axisConfigIndex:r,chartData:i}=t,n=!0,a=e?.axes?.[r];return e&&i&&a?.isLogarithmic===!0&&(n=!qh({chartConfig:e,chartData:i,axisConfigIndex:r})),n}function Dh(t,e){let r=t;if(e?.[0]!==void 0&&W(e)===b.PieFromFields){let{x:i,y:n}=e[0];(Or(t)?r:r.dataItems).forEach(a=>(ve in a&&i!==ve&&(a[i]=a[i]!==void 0?a[i]:a[ve],delete a[ve]),ze in a&&n!==ze&&(a[n]=a[n]!==void 0?a[n]:a[ze],delete a[ze]),a))}return r}function Ph(t,e){let r=Z(e),i=t,n=e?.[0];if((r===S.PieSeries||r===S.BoxPlotSeries||r===S.LineSeries||r===S.RadarSeries||r===S.BarSeries||r===S.HeatSeries||r===S.ComboLineAndBarSeries)&&n!==void 0){let a=Or(t),s=a?t:t.dataItems;if(t!==void 0){let{originalCategoryValue:o,originalYCategoryValue:l,originalDateValue:u,xAxisField:c}=v,d=r===S.HeatSeries?j.xField:n.x,f=r===S.HeatSeries?j.yField:void 0;s=s.map(m=>{let h=m[d];m[u]!==void 0?h=m[u]:m[o]!==void 0&&(h=m[o]);let g={...m,[d]:h};if(delete g[u],delete g[o],delete g[c],f){let y=m[f];m[l]!==void 0&&(y=m[l]),g={...g,[f]:y},delete g[l]}return g}),a?i=s:"dataItems"in i&&(i.dataItems=s)}}return i}function Hs(t){let e={...t};delete e[v.technicalSortingFieldBySum],delete e[v.technicalSortingFieldByPercent],delete e[v.pieChart.technicalFieldSlicePercent],delete e[v.pieChart.technicalFieldGroupedSlices],delete e[v.lastTemporalBin],delete e[v.originalServerBinningRange],delete e[v.technicalFieldSplitByField],delete e[G.uniqueIdsName],Object.keys(e).filter(i=>i.includes(v.rendererSymbolField)).forEach(i=>delete e[i]);let r=ar(e);return r.isInItem&&delete e[r.expr??""],e}function kh(t,e){let r=t,i=Z(e),n=Mn(r);if(n!==void 0)switch(i){case S.ComboLineAndBarSeries:case S.BarSeries:case S.LineSeries:case S.RadarSeries:case S.PieSeries:{n=n.map(Hs),r={dataItems:n};let{timeIntervalInfo:a,serverLimitReached:s}=t??{};An(a)||(r.timeIntervalInfo=a),s!==void 0&&(r.serverLimitReached=s)}break;case S.ScatterSeries:r={...r,dataItems:n.map(Hs)};break}return r}var o0=(t,e)=>{let r=10**e;return Math.round(t*r)/r};function l0(t){let{data:e,seriesConfig:r}=t,i=tt(e);return i!==void 0&&(i=Ph(i,r),i=kh(i,r),i=Dh(i,r)),i}function Vh(t){let{dataFetchingResults:e,numberOfQueries:r,series:i}=t,n=Z(i),a=W(i),s=[],o=new Map;for(let l=0;l<r;l+=1){let u=e[l];if(u!==void 0){let c;if(n===S.ScatterSeries)c=u.dataItems;else if("data"in u&&u.data){let d=u.data;"dataItems"in d&&(c=d.dataItems),"outliers"in d&&d.outliers&&s.push(...d.outliers),"meanLines"in d&&d.meanLines&&s.push(...d.meanLines)}if(c)if(i[0].type===S.HeatSeries)r>0&&c.forEach(d=>{o.set(`${d[j.xField]}-${d[j.yField]}`,d)});else if(i[0].type===S.ScatterSeries){let{x:d,y:f}=i[0];s.push(...c.map(m=>({[d]:m[d],[f]:m[f]})))}else u.valid&&(a===b.PieFromFields?s=ni({dataToConvert:c[0],x:ve,y:ze}):a===b.BarAndLineFromFields?s=ni({dataToConvert:c[0],x:i[0].x,y:i[0].y}):s.push(...c))}}return o.size>0&&(s=Array.from(o.values())),s}async function $h(t){let{numberOfQueries:e,selectionOIDs:r,chartConfig:i,queryConfig:n,errorStrings:a,queryObject:s,splitByField:o,replaceNoValueCategoryWithZero:l,hideZeroCountCategories:u,chartLimits:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,view:h}=t,{series:g}=i,y=Z(g),p=[],{maxOIDsPerSelectionQuery:F}=nr();for(let C=0;C<e;C+=1){let x=C*F,w=(C+1)*F-1,N=r.slice(x===0?0:x-1,w),O={...n};switch(O.objectIds=N,y){case S.HeatSeries:p.push($o({completeHeatChartDataset:!1,chartConfig:i,queryConfig:O,queryObject:s,errorStrings:a,chartLimits:c,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,view:h}));break;case S.PieSeries:case S.BarSeries:case S.LineSeries:case S.RadarSeries:case S.ComboLineAndBarSeries:if(Xe({xAxisValueFormatType:$e(i),setTimeBinningInfoWhenNotProvided:d,seriesConfig:g[0],queryObject:s})){let T=tt(i);"temporalBinning"in T.series[0]&&T.series[0].temporalBinning&&(T.series[0].temporalBinning.trimIncompleteTimeInterval=!1,Qt(o,s)&&(delete T.series[0].temporalBinning.start,delete T.series[0].temporalBinning.end)),p.push(Bn({chartConfig:T,queryConfig:O,queryObject:s,chartLimits:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,view:h,errorStrings:a}))}else p.push(hh({queryObject:s,chartConfig:i,chartLimits:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,errorStrings:a,queryConfig:O}));break;case S.BoxPlotSeries:p.push(yh({queryObject:s,chartConfig:i,replaceNoValueCategoryWithZero:l,hideZeroCountCategories:u,chartLimits:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,view:h,errorStrings:a,queryConfig:O}));break;case S.ScatterSeries:p.push(Ro({queryObject:s,chartConfig:i,queryConfig:O,replaceNoValueCategoryWithZero:l,hideZeroCountCategories:u,chartLimits:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,view:h,errorStrings:a,sortData:!1,calculateTrendLine:!1}));break;case S.HistogramSeries:p.push(zf({queryObject:s,queryConfig:O,chartConfig:i,x:g[0].x,errorStrings:a}));break}}return await Promise.all(p)}async function u0(t){let{chartConfig:e,chartData:r,dataWasUpdated:i,replaceNoValueCategoryWithZero:n,hideZeroCountCategories:a,queryObject:s,errorStrings:o,selectionIDsChanged:l,chartLimits:u,setTimeBinningInfoWhenNotProvided:c,returnFeaturesExtent:d,popupTemplateFieldInfosEnabled:f,view:m,viewExtentUpdated:h,runtimeDataFilters:g,ignoreViewExtent:y,returnSelectionOIDs:p,selectionData:F}=t,{series:C}=e,{selectionItems:x,selectionOIDs:w}=F??{},N,O=Z(C),T=O!==S.HistogramSeries&&O!==S.HeatSeries&&x!==void 0&&x.length>0&&!(C[0].x in x[0])&&!(ve in x[0])&&!(v.boxPlot.boxPlotCategory in x[0]);if(h!==!0&&p!==!1&&w!==void 0&&w.length>0&&(i===!0||T||l)){let B=Mn(r),M=vo({queryObject:s,chartConfig:e,runtimeDataFilters:g,ignoreViewExtent:y,viewExtent:m?.extent});if(B!==void 0&&!Gc({dataContext:B[0],chartConfig:e,chartLimits:u}))N=B.filter(q=>{let I=q[G.uniqueIdsName];return typeof I=="number"||typeof I=="string"?w?.includes(I):!1});else if(w?.[0]!==void 0&&M!==void 0){let{maxOIDsPerSelectionQuery:q}=nr(),I=Math.ceil(w.length/q),k=de(e.series[0]?.query?.where),_=await $h({numberOfQueries:I,selectionOIDs:w,queryConfig:M,queryObject:s,replaceNoValueCategoryWithZero:n,hideZeroCountCategories:a,chartLimits:u,setTimeBinningInfoWhenNotProvided:c,returnFeaturesExtent:d,popupTemplateFieldInfosEnabled:f,view:m,splitByField:k,errorStrings:o,chartConfig:e});N=Vh({dataFetchingResults:_,numberOfQueries:I,series:C})}}return N}return{a:z,b:ce,c:ic,d:$e,e:Oy,f:ye,g:By,h:Ke,i:Nt,j:My,k:Iy,l:fc,m:Tt,n:Fe,o:mc,p:Ey,q:ve,r:ze,s:Ay,t:Ly,u:yr,v:qy,w:Dy,x:Py,y:ky,z:Vy,A:$y,B:P,C:Ry,D:ct,E:yc,F:Be,G:Wy,H:Qt,I:jy,J:U,K:Zy,L:bc,M:vc,N:_y,O:mt,P:zy,Q:de,R:xe,S:ut,T:W,U:Xe,V:Ve,W:Oc,X:Os,Y:Pc,Z:Hy,_:Uy,$:Gy,aa:Yy,ba:Qy,ca:Ky,da:Jy,ea:Xy,fa:eg,ga:tg,ha:rg,ia:ig,ja:ng,ka:ag,la:sg,ma:og,na:lg,oa:ug,pa:cg,qa:dg,ra:fg,sa:mg,ta:hg,ua:Bs,va:_c,wa:to,xa:Gc,ya:Ms,za:yg,Aa:io,Ba:gg,Ca:pg,Da:Sg,Ea:Jc,Fa:bg,Ga:vg,Ha:Fg,Ia:xg,Ja:Cg,Ka:rd,La:ud,Ma:wg,Na:Ng,Oa:Tg,Pa:Og,Qa:dn,Ra:Jt,Sa:yd,Ta:Bg,Ua:xn,Va:pe,Wa:Ot,Xa:Mg,Ya:Ig,Za:H,_a:Eg,$a:Le,ab:Ag,bb:jd,cb:Zd,db:Lg,eb:cf,fb:qg,gb:yo,hb:Fr,ib:Dg,jb:So,kb:Pg,lb:kg,mb:Re,nb:Vg,ob:We,pb:Sr,qb:Sf,rb:$g,sb:Rg,tb:Wg,ub:bf,vb:jg,wb:As,xb:xf,yb:Cf,zb:Zg,Ab:vo,Bb:_g,Cb:ui,Db:ee,Eb:qs,Fb:zg,Gb:Hg,Hb:Ug,Ib:Hf,Jb:Uf,Kb:Gg,Lb:Yg,Mb:Qg,Nb:Kg,Ob:Jg,Pb:No,Qb:Xg,Rb:si,Sb:e0,Tb:t0,Ub:r0,Vb:gm,Wb:i0,Xb:n0,Yb:ln,Zb:br,_b:Vo,$b:Wo,ac:Mn,bc:jo,cc:se,dc:un,ec:Se,fc:In,gc:Bh,hc:a0,ic:Ih,jc:_s,kc:Ah,lc:s0,mc:Dh,nc:Ph,oc:Hs,pc:o0,qc:l0,rc:u0}},"layers/support/FeatureFilter","smartMapping/statistics/histogram","smartMapping/statistics/summaryStatistics","geometry/support/jsonUtils","rest/support/AttributeBinsQuery","rest/support/Query","rest/support/StatisticDefinition","time/TimeExtent","layers/FeatureLayer","layers/support/CodedValueDomain","layers/support/Field","layers/support/fieldUtils","portal/Portal","renderers/support/jsonUtils","request","rest/support/FeatureSet","Graphic","symbols/support/symbolUtils","AttributeBinsGraphic","intl","core/promiseUtils","core/sql","applications/Components/imageryUtils","geometry/Extent","geometry/Point","layers/ImageryLayer","layers/ImageryTileLayer","layers/WCSLayer")
2
+ import{a as Ci,b as wi,c as Zn,e as oe,f as _n,g as Dt}from"./EZV7JSQJ.js";import{A as xi,c as v,d as b,g as bi,h as vi,j as Ir,k as Er,l as Fi,m as je,n as Ar,q as Wn,r as he,s as Lr,t as ar,y as jn}from"./ADGMA3ST.js";import{Ba as $n,Ca as Rn,b as St,d as kn,e as Ge,f as G,g as Vn,i as pi,o as Mr,p as ir,q as j,ua as bt,va as nr,y as Si}from"./PAIRUVLU.js";import{a as Q,c as pt,d as Br,e as me,f as rt}from"./KX7KGXKQ.js";import{a as Or,d as rr,g as tt,k as An,l as yt,n as Ln,r as yi}from"./SP2IPHWF.js";import{c as En,d as hi,f as qt,g as et}from"./NZR4L5AA.js";import{H as Lt}from"./CHQDKVVQ.js";import{a as Z}from"./XJFVSX2E.js";import{a as S,b as A,c as re,e as qn,f as qe,h as be,i as gi,k as $,l as Ce,n as we,o as ae,p as Dn,q as gt,s as Pn,v as Ue}from"./547RDEMV.js";export default $arcgis.t(([Ns,$u,Ts,pn,Ru,Wu,ju,Zu,_u,zu,Hu,Us,Uu,Sn,ti,Gs,Gu,er,Yu,{substitute:_e},bn,{sqlLiteral:Qu},{computeStatisticsHistograms:Ku,computeRasterAttributeTable:Ju,getCurrentRasterInfo:oi,fetchPixelFeatureSet:Xu},Ys,Qs,ec,tc,rc])=>{var Qe=class extends Error{},qi=class extends Qe{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Di=class extends Qe{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Pi=class extends Qe{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},at=class extends Qe{},Wr=class extends Qe{constructor(e){super(`Invalid unit ${e}`)}},le=class extends Qe{},Ze=class extends Qe{constructor(){super("Zone is an abstract class")}},L="numeric",ke="short",Oe="long",jr={year:L,month:L,day:L},Fa={year:L,month:ke,day:L},zo={year:L,month:ke,day:L,weekday:ke},xa={year:L,month:Oe,day:L},Ca={year:L,month:Oe,day:L,weekday:Oe},wa={hour:L,minute:L},Na={hour:L,minute:L,second:L},Ta={hour:L,minute:L,second:L,timeZoneName:ke},Oa={hour:L,minute:L,second:L,timeZoneName:Oe},Ba={hour:L,minute:L,hourCycle:"h23"},Ma={hour:L,minute:L,second:L,hourCycle:"h23"},Ia={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:ke},Ea={hour:L,minute:L,second:L,hourCycle:"h23",timeZoneName:Oe},Aa={year:L,month:L,day:L,hour:L,minute:L},La={year:L,month:L,day:L,hour:L,minute:L,second:L},qa={year:L,month:ke,day:L,hour:L,minute:L},Da={year:L,month:ke,day:L,hour:L,minute:L,second:L},Ho={year:L,month:ke,day:L,weekday:ke,hour:L,minute:L},Pa={year:L,month:Oe,day:L,hour:L,minute:L,timeZoneName:ke},ka={year:L,month:Oe,day:L,hour:L,minute:L,second:L,timeZoneName:ke},Va={year:L,month:Oe,day:L,weekday:Oe,hour:L,minute:L,timeZoneName:Oe},$a={year:L,month:Oe,day:L,weekday:Oe,hour:L,minute:L,second:L,timeZoneName:Oe},Ct=class{get type(){throw new Ze}get name(){throw new Ze}get ianaName(){return this.name}get isUniversal(){throw new Ze}offsetName(e,r){throw new Ze}formatOffset(e,r){throw new Ze}offset(e){throw new Ze}equals(e){throw new Ze}get isValid(){throw new Ze}},Ni=null,Zr=class t extends Ct{static get instance(){return Ni===null&&(Ni=new t),Ni}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:i}){return Qa(e,r,i)}formatOffset(e,r){return cr(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},ki=new Map;function Uo(t){let e=ki.get(t);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),ki.set(t,e)),e}var Go={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Yo(t,e){let r=t.format(e).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,n,a,s,o,l,u,c]=i;return[s,n,a,o,l,u,c]}function Qo(t,e){let r=t.formatToParts(e),i=[];for(let n=0;n<r.length;n++){let{type:a,value:s}=r[n],o=Go[a];a==="era"?i[o]=s:V(o)||(i[o]=parseInt(s,10))}return i}var Ti=new Map,ot=class t extends Ct{static create(e){let r=Ti.get(e);return r===void 0&&Ti.set(e,r=new t(e)),r}static resetCache(){Ti.clear(),ki.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:i}){return Qa(e,r,i,this.name)}formatOffset(e,r){return cr(this.offset(e),r)}offset(e){if(!this.valid)return NaN;let r=new Date(e);if(isNaN(r))return NaN;let i=Uo(this.name),[n,a,s,o,l,u,c]=i.formatToParts?Qo(i,r):Yo(i,r);o==="BC"&&(n=-Math.abs(n)+1);let f=Yr({year:n,month:a,day:s,hour:l===24?0:l,minute:u,second:c,millisecond:0}),m=+r,h=m%1e3;return m-=h>=0?h:1e3+h,(f-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},zn={};function Ko(t,e={}){let r=JSON.stringify([t,e]),i=zn[r];return i||(i=new Intl.ListFormat(t,e),zn[r]=i),i}var Vi=new Map;function $i(t,e={}){let r=JSON.stringify([t,e]),i=Vi.get(r);return i===void 0&&(i=new Intl.DateTimeFormat(t,e),Vi.set(r,i)),i}var Ri=new Map;function Jo(t,e={}){let r=JSON.stringify([t,e]),i=Ri.get(r);return i===void 0&&(i=new Intl.NumberFormat(t,e),Ri.set(r,i)),i}var Wi=new Map;function Xo(t,e={}){let{base:r,...i}=e,n=JSON.stringify([t,i]),a=Wi.get(n);return a===void 0&&(a=new Intl.RelativeTimeFormat(t,e),Wi.set(n,a)),a}var or=null;function el(){return or||(or=new Intl.DateTimeFormat().resolvedOptions().locale,or)}var ji=new Map;function Ra(t){let e=ji.get(t);return e===void 0&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),ji.set(t,e)),e}var Zi=new Map;function tl(t){let e=Zi.get(t);if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,"minimalDays"in e||(e={...Wa,...e}),Zi.set(t,e)}return e}function rl(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let i,n;try{i=$i(t).resolvedOptions(),n=t}catch{let l=t.substring(0,r);i=$i(l).resolvedOptions(),n=l}let{numberingSystem:a,calendar:s}=i;return[n,a,s]}}function il(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function nl(t){let e=[];for(let r=1;r<=12;r++){let i=z.utc(2009,r,1);e.push(t(i))}return e}function al(t){let e=[];for(let r=1;r<=7;r++){let i=z.utc(2016,11,13+r);e.push(t(i))}return e}function qr(t,e,r,i){let n=t.listingMode();return n==="error"?null:n==="en"?r(e):i(e)}function sl(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||Ra(t.locale).numberingSystem==="latn"}var _i=class{constructor(e,r,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;let{padTo:n,floor:a,...s}=i;if(!r||Object.keys(s).length>0){let o={useGrouping:!1,...i};i.padTo>0&&(o.minimumIntegerDigits=i.padTo),this.inf=Jo(e,o)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):rn(e,3);return ne(r,this.padTo)}}},zi=class{constructor(e,r,i){this.opts=i,this.originalZone=void 0;let n;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),o=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&ot.create(o).valid?(n=o,this.dt=e):(n="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let a={...this.opts};a.timeZone=a.timeZone||n,this.dtf=$i(r,a)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(r=>{if(r.type==="timeZoneName"){let i=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:i}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},Hi=class{constructor(e,r,i){this.opts={style:"long",...i},!r&&Ga()&&(this.rtf=Xo(e,i))}format(e,r){return this.rtf?this.rtf.format(e,r):Ol(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},Wa={firstDay:1,minimalDays:4,weekend:[6,7]},X=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,i,n,a=!1){let s=e||te.defaultLocale,o=s||(a?"en-US":el()),l=r||te.defaultNumberingSystem,u=i||te.defaultOutputCalendar,c=Yi(n)||te.defaultWeekSettings;return new t(o,l,u,c,s)}static resetCache(){or=null,Vi.clear(),Ri.clear(),Wi.clear(),ji.clear(),Zi.clear()}static fromObject({locale:e,numberingSystem:r,outputCalendar:i,weekSettings:n}={}){return t.create(e,r,i,n)}constructor(e,r,i,n,a){let[s,o,l]=rl(e);this.locale=s,this.numberingSystem=r||o||null,this.outputCalendar=i||l||null,this.weekSettings=n,this.intl=il(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=a,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=sl(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Yi(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,r=!1){return qr(this,e,Xa,()=>{let i=this.intl==="ja"||this.intl.startsWith("ja-");r&=!i;let n=r?{month:e,day:"numeric"}:{month:e},a=r?"format":"standalone";if(!this.monthsCache[a][e]){let s=i?o=>this.dtFormatter(o,n).format():o=>this.extract(o,n,"month");this.monthsCache[a][e]=nl(s)}return this.monthsCache[a][e]})}weekdays(e,r=!1){return qr(this,e,rs,()=>{let i=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=r?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=al(a=>this.extract(a,i,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return qr(this,void 0,()=>is,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[z.utc(2016,11,13,9),z.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return qr(this,e,ns,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[z.utc(-40,1,1),z.utc(2017,1,1)].map(i=>this.extract(i,r,"era"))),this.eraCache[e]})}extract(e,r,i){let n=this.dtFormatter(e,r),a=n.formatToParts(),s=a.find(o=>o.type.toLowerCase()===i);return s?s.value:null}numberFormatter(e={}){return new _i(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new zi(e,this.intl,r)}relFormatter(e={}){return new Hi(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Ko(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||Ra(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ya()?tl(this.locale):Wa}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},Oi=null,Ae=class t extends Ct{static get utcInstance(){return Oi===null&&(Oi=new t(0)),Oi}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(Qr(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${cr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${cr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return cr(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},Ui=class extends Ct{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function nt(t,e){if(V(t)||t===null)return e;if(t instanceof Ct)return t;if(fl(t)){let r=t.toLowerCase();return r==="default"?e:r==="local"||r==="system"?Zr.instance:r==="utc"||r==="gmt"?Ae.utcInstance:Ae.parseSpecifier(r)||ot.create(t)}else return st(t)?Ae.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new Ui(t)}var Ji={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},Hn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},ol=Ji.hanidec.replace(/[\[|\]]/g,"").split("");function ll(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);if(t[r].search(Ji.hanidec)!==-1)e+=ol.indexOf(t[r]);else for(let n in Hn){let[a,s]=Hn[n];i>=a&&i<=s&&(e+=i-a)}}return parseInt(e,10)}else return e}var Gi=new Map;function ul(){Gi.clear()}function De({numberingSystem:t},e=""){let r=t||"latn",i=Gi.get(r);i===void 0&&(i=new Map,Gi.set(r,i));let n=i.get(e);return n===void 0&&(n=new RegExp(`${Ji[r]}${e}`),i.set(e,n)),n}var Un=()=>Date.now(),Gn="system",Yn=null,Qn=null,Kn=null,Jn=60,Xn,ea=null,te=class{static get now(){return Un}static set now(e){Un=e}static set defaultZone(e){Gn=e}static get defaultZone(){return nt(Gn,Zr.instance)}static get defaultLocale(){return Yn}static set defaultLocale(e){Yn=e}static get defaultNumberingSystem(){return Qn}static set defaultNumberingSystem(e){Qn=e}static get defaultOutputCalendar(){return Kn}static set defaultOutputCalendar(e){Kn=e}static get defaultWeekSettings(){return ea}static set defaultWeekSettings(e){ea=Yi(e)}static get twoDigitCutoffYear(){return Jn}static set twoDigitCutoffYear(e){Jn=e%100}static get throwOnInvalid(){return Xn}static set throwOnInvalid(e){Xn=e}static resetCaches(){X.resetCache(),ot.resetCache(),z.resetCache(),ul()}},Te=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},ja=[0,31,59,90,120,151,181,212,243,273,304,334],Za=[0,31,60,91,121,152,182,213,244,274,305,335];function Ie(t,e){return new Te("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Xi(t,e,r){let i=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&i.setUTCFullYear(i.getUTCFullYear()-1900);let n=i.getUTCDay();return n===0?7:n}function _a(t,e,r){return r+(fr(t)?Za:ja)[e-1]}function za(t,e){let r=fr(t)?Za:ja,i=r.findIndex(a=>a<e),n=e-r[i];return{month:i+1,day:n}}function en(t,e){return(t-e+7)%7+1}function _r(t,e=4,r=1){let{year:i,month:n,day:a}=t,s=_a(i,n,a),o=en(Xi(i,n,a),r),l=Math.floor((s-o+14-e)/7),u;return l<1?(u=i-1,l=dr(u,e,r)):l>dr(i,e,r)?(u=i+1,l=1):u=i,{weekYear:u,weekNumber:l,weekday:o,...Kr(t)}}function ta(t,e=4,r=1){let{weekYear:i,weekNumber:n,weekday:a}=t,s=en(Xi(i,1,e),r),o=Rt(i),l=n*7+a-s-7+e,u;l<1?(u=i-1,l+=Rt(u)):l>o?(u=i+1,l-=Rt(i)):u=i;let{month:c,day:d}=za(u,l);return{year:u,month:c,day:d,...Kr(t)}}function Bi(t){let{year:e,month:r,day:i}=t,n=_a(e,r,i);return{year:e,ordinal:n,...Kr(t)}}function ra(t){let{year:e,ordinal:r}=t,{month:i,day:n}=za(e,r);return{year:e,month:i,day:n,...Kr(t)}}function ia(t,e){if(!V(t.localWeekday)||!V(t.localWeekNumber)||!V(t.localWeekYear)){if(!V(t.weekday)||!V(t.weekNumber)||!V(t.weekYear))throw new at("Cannot mix locale-based week fields with ISO-based week fields");return V(t.localWeekday)||(t.weekday=t.localWeekday),V(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),V(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function cl(t,e=4,r=1){let i=Gr(t.weekYear),n=Ee(t.weekNumber,1,dr(t.weekYear,e,r)),a=Ee(t.weekday,1,7);return i?n?a?!1:Ie("weekday",t.weekday):Ie("week",t.weekNumber):Ie("weekYear",t.weekYear)}function dl(t){let e=Gr(t.year),r=Ee(t.ordinal,1,Rt(t.year));return e?r?!1:Ie("ordinal",t.ordinal):Ie("year",t.year)}function Ha(t){let e=Gr(t.year),r=Ee(t.month,1,12),i=Ee(t.day,1,zr(t.year,t.month));return e?r?i?!1:Ie("day",t.day):Ie("month",t.month):Ie("year",t.year)}function Ua(t){let{hour:e,minute:r,second:i,millisecond:n}=t,a=Ee(e,0,23)||e===24&&r===0&&i===0&&n===0,s=Ee(r,0,59),o=Ee(i,0,59),l=Ee(n,0,999);return a?s?o?l?!1:Ie("millisecond",n):Ie("second",i):Ie("minute",r):Ie("hour",e)}function V(t){return typeof t>"u"}function st(t){return typeof t=="number"}function Gr(t){return typeof t=="number"&&t%1===0}function fl(t){return typeof t=="string"}function ml(t){return Object.prototype.toString.call(t)==="[object Date]"}function Ga(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Ya(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function hl(t){return Array.isArray(t)?t:[t]}function na(t,e,r){if(t.length!==0)return t.reduce((i,n)=>{let a=[e(n),n];return i&&r(i[0],a[0])===i[0]?i:a},null)[1]}function yl(t,e){return e.reduce((r,i)=>(r[i]=t[i],r),{})}function Zt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Yi(t){if(t==null)return null;if(typeof t!="object")throw new le("Week settings must be an object");if(!Ee(t.firstDay,1,7)||!Ee(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Ee(e,1,7)))throw new le("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Ee(t,e,r){return Gr(t)&&t>=e&&t<=r}function gl(t,e){return t-e*Math.floor(t/e)}function ne(t,e=2){let r=t<0,i;return r?i="-"+(""+-t).padStart(e,"0"):i=(""+t).padStart(e,"0"),i}function it(t){if(!(V(t)||t===null||t===""))return parseInt(t,10)}function vt(t){if(!(V(t)||t===null||t===""))return parseFloat(t)}function tn(t){if(!(V(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function rn(t,e,r="round"){let i=10**e;switch(r){case"expand":return t>0?Math.ceil(t*i)/i:Math.floor(t*i)/i;case"trunc":return Math.trunc(t*i)/i;case"round":return Math.round(t*i)/i;case"floor":return Math.floor(t*i)/i;case"ceil":return Math.ceil(t*i)/i;default:throw new RangeError(`Value rounding ${r} is out of range`)}}function fr(t){return t%4===0&&(t%100!==0||t%400===0)}function Rt(t){return fr(t)?366:365}function zr(t,e){let r=gl(e-1,12)+1,i=t+(e-r)/12;return r===2?fr(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Yr(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function aa(t,e,r){return-en(Xi(t,1,e),r)+e-1}function dr(t,e=4,r=1){let i=aa(t,e,r),n=aa(t+1,e,r);return(Rt(t)-i+n)/7}function Qi(t){return t>99?t:t>te.twoDigitCutoffYear?1900+t:2e3+t}function Qa(t,e,r,i=null){let n=new Date(t),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};i&&(a.timeZone=i);let s={timeZoneName:e,...a},o=new Intl.DateTimeFormat(r,s).formatToParts(n).find(l=>l.type.toLowerCase()==="timezonename");return o?o.value:null}function Qr(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let i=parseInt(e,10)||0,n=r<0||Object.is(r,-0)?-i:i;return r*60+n}function Ka(t){let e=Number(t);if(typeof t=="boolean"||t===""||!Number.isFinite(e))throw new le(`Invalid unit value ${t}`);return e}function Hr(t,e){let r={};for(let i in t)if(Zt(t,i)){let n=t[i];if(n==null)continue;r[e(i)]=Ka(n)}return r}function cr(t,e){let r=Math.trunc(Math.abs(t/60)),i=Math.trunc(Math.abs(t%60)),n=t>=0?"+":"-";switch(e){case"short":return`${n}${ne(r,2)}:${ne(i,2)}`;case"narrow":return`${n}${r}${i>0?`:${i}`:""}`;case"techie":return`${n}${ne(r,2)}${ne(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Kr(t){return yl(t,["hour","minute","second","millisecond"])}var pl=["January","February","March","April","May","June","July","August","September","October","November","December"],Ja=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Sl=["J","F","M","A","M","J","J","A","S","O","N","D"];function Xa(t){switch(t){case"narrow":return[...Sl];case"short":return[...Ja];case"long":return[...pl];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var es=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ts=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],bl=["M","T","W","T","F","S","S"];function rs(t){switch(t){case"narrow":return[...bl];case"short":return[...ts];case"long":return[...es];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var is=["AM","PM"],vl=["Before Christ","Anno Domini"],Fl=["BC","AD"],xl=["B","A"];function ns(t){switch(t){case"narrow":return[...xl];case"short":return[...Fl];case"long":return[...vl];default:return null}}function Cl(t){return is[t.hour<12?0:1]}function wl(t,e){return rs(e)[t.weekday-1]}function Nl(t,e){return Xa(e)[t.month-1]}function Tl(t,e){return ns(e)[t.year<0?0:1]}function Ol(t,e,r="always",i=!1){let n={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&a){let d=t==="days";switch(e){case 1:return d?"tomorrow":`next ${n[t][0]}`;case-1:return d?"yesterday":`last ${n[t][0]}`;case 0:return d?"today":`this ${n[t][0]}`}}let s=Object.is(e,-0)||e<0,o=Math.abs(e),l=o===1,u=n[t],c=i?l?u[1]:u[2]||u[1]:l?n[t][0]:t;return s?`${o} ${c} ago`:`in ${o} ${c}`}function sa(t,e){let r="";for(let i of t)i.literal?r+=i.val:r+=e(i.val);return r}var Bl={D:jr,DD:Fa,DDD:xa,DDDD:Ca,t:wa,tt:Na,ttt:Ta,tttt:Oa,T:Ba,TT:Ma,TTT:Ia,TTTT:Ea,f:Aa,ff:qa,fff:Pa,ffff:Va,F:La,FF:Da,FFF:ka,FFFF:$a},Ne=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,i="",n=!1,a=[];for(let s=0;s<e.length;s++){let o=e.charAt(s);o==="'"?((i.length>0||n)&&a.push({literal:n||/^\s+$/.test(i),val:i===""?"'":i}),r=null,i="",n=!n):n||o===r?i+=o:(i.length>0&&a.push({literal:/^\s+$/.test(i),val:i}),i=o,r=o)}return i.length>0&&a.push({literal:n||/^\s+$/.test(i),val:i}),a}static macroTokenToFormatOpts(e){return Bl[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0,i=void 0){if(this.opts.forceSimple)return ne(e,r);let n={...this.opts};return r>0&&(n.padTo=r),i&&(n.signDisplay=i),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let i=this.loc.listingMode()==="en",n=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(m,h)=>this.loc.extract(e,m,h),s=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",o=()=>i?Cl(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(m,h)=>i?Nl(e,m):a(h?{month:m}:{month:m,day:"numeric"},"month"),u=(m,h)=>i?wl(e,m):a(h?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),c=m=>{let h=t.macroTokenToFormatOpts(m);return h?this.formatWithSystemDefault(e,h):m},d=m=>i?Tl(e,m):a({era:m},"era"),f=m=>{switch(m){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return n?a({day:"numeric"},"day"):this.num(e.day);case"dd":return n?a({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return n?a({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?a({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return n?a({month:"numeric"},"month"):this.num(e.month);case"MM":return n?a({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return n?a({year:"numeric"},"year"):this.num(e.year);case"yy":return n?a({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?a({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?a({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(m)}};return sa(t.parseFormat(r),f)}formatDurationFromString(e,r){let i=this.opts.signMode==="negativeLargestOnly"?-1:1,n=c=>{switch(c[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},a=(c,d)=>f=>{let m=n(f);if(m){let h=d.isNegativeDuration&&m!==d.largestUnit?i:1,g;return this.opts.signMode==="negativeLargestOnly"&&m!==d.largestUnit?g="never":this.opts.signMode==="all"?g="always":g="auto",this.num(c.get(m)*h,f.length,g)}else return f},s=t.parseFormat(r),o=s.reduce((c,{literal:d,val:f})=>d?c:c.concat(f),[]),l=e.shiftTo(...o.map(n).filter(c=>c)),u={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return sa(s,a(l,u))}},as=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function _t(...t){let e=t.reduce((r,i)=>r+i.source,"");return RegExp(`^${e}$`)}function zt(...t){return e=>t.reduce(([r,i,n],a)=>{let[s,o,l]=a(e,n);return[{...r,...s},o||i,l]},[{},null,1]).slice(0,2)}function Ht(t,...e){if(t==null)return[null,null];for(let[r,i]of e){let n=r.exec(t);if(n)return i(n)}return[null,null]}function ss(...t){return(e,r)=>{let i={},n;for(n=0;n<t.length;n++)i[t[n]]=it(e[r+n]);return[i,null,r+n]}}var os=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Ml=`(?:${os.source}?(?:\\[(${as.source})\\])?)?`,nn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ls=RegExp(`${nn.source}${Ml}`),an=RegExp(`(?:[Tt]${ls.source})?`),Il=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,El=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Al=/(\d{4})-?(\d{3})/,Ll=ss("weekYear","weekNumber","weekDay"),ql=ss("year","ordinal"),Dl=/(\d{4})-(\d\d)-(\d\d)/,us=RegExp(`${nn.source} ?(?:${os.source}|(${as.source}))?`),Pl=RegExp(`(?: ${us.source})?`);function Wt(t,e,r){let i=t[e];return V(i)?r:it(i)}function kl(t,e){return[{year:Wt(t,e),month:Wt(t,e+1,1),day:Wt(t,e+2,1)},null,e+3]}function Ut(t,e){return[{hours:Wt(t,e,0),minutes:Wt(t,e+1,0),seconds:Wt(t,e+2,0),milliseconds:tn(t[e+3])},null,e+4]}function mr(t,e){let r=!t[e]&&!t[e+1],i=Qr(t[e+1],t[e+2]),n=r?null:Ae.instance(i);return[{},n,e+3]}function hr(t,e){let r=t[e]?ot.create(t[e]):null;return[{},r,e+1]}var Vl=RegExp(`^T?${nn.source}$`),$l=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Rl(t){let[e,r,i,n,a,s,o,l,u]=t,c=e[0]==="-",d=l&&l[0]==="-",f=(m,h=!1)=>m!==void 0&&(h||m&&c)?-m:m;return[{years:f(vt(r)),months:f(vt(i)),weeks:f(vt(n)),days:f(vt(a)),hours:f(vt(s)),minutes:f(vt(o)),seconds:f(vt(l),l==="-0"),milliseconds:f(tn(u),d)}]}var Wl={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function sn(t,e,r,i,n,a,s){let o={year:e.length===2?Qi(it(e)):it(e),month:Ja.indexOf(r)+1,day:it(i),hour:it(n),minute:it(a)};return s&&(o.second=it(s)),t&&(o.weekday=t.length>3?es.indexOf(t)+1:ts.indexOf(t)+1),o}var jl=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Zl(t){let[,e,r,i,n,a,s,o,l,u,c,d]=t,f=sn(e,n,i,r,a,s,o),m;return l?m=Wl[l]:u?m=0:m=Qr(c,d),[f,new Ae(m)]}function _l(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var zl=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Hl=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ul=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function oa(t){let[,e,r,i,n,a,s,o]=t;return[sn(e,n,i,r,a,s,o),Ae.utcInstance]}function Gl(t){let[,e,r,i,n,a,s,o]=t;return[sn(e,o,r,i,n,a,s),Ae.utcInstance]}var Yl=_t(Il,an),Ql=_t(El,an),Kl=_t(Al,an),Jl=_t(ls),cs=zt(kl,Ut,mr,hr),Xl=zt(Ll,Ut,mr,hr),eu=zt(ql,Ut,mr,hr),tu=zt(Ut,mr,hr);function ru(t){return Ht(t,[Yl,cs],[Ql,Xl],[Kl,eu],[Jl,tu])}function iu(t){return Ht(_l(t),[jl,Zl])}function nu(t){return Ht(t,[zl,oa],[Hl,oa],[Ul,Gl])}function au(t){return Ht(t,[$l,Rl])}var su=zt(Ut);function ou(t){return Ht(t,[Vl,su])}var lu=_t(Dl,Pl),uu=_t(us),cu=zt(Ut,mr,hr);function du(t){return Ht(t,[lu,cs],[uu,cu])}var la="Invalid Duration",ds={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},fu={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ds},Me=146097/400,Pt=146097/4800,mu={years:{quarters:4,months:12,weeks:Me/7,days:Me,hours:Me*24,minutes:Me*24*60,seconds:Me*24*60*60,milliseconds:Me*24*60*60*1e3},quarters:{months:3,weeks:Me/28,days:Me/4,hours:Me*24/4,minutes:Me*24*60/4,seconds:Me*24*60*60/4,milliseconds:Me*24*60*60*1e3/4},months:{weeks:Pt/7,days:Pt,hours:Pt*24,minutes:Pt*24*60,seconds:Pt*24*60*60,milliseconds:Pt*24*60*60*1e3},...ds},xt=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],hu=xt.slice(0).reverse();function Ye(t,e,r=!1){let i={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new ue(i)}function fs(t,e){let r=e.milliseconds??0;for(let i of hu.slice(1))e[i]&&(r+=e[i]*t[i].milliseconds);return r}function ua(t,e){let r=fs(t,e)<0?-1:1;xt.reduceRight((i,n)=>{if(V(e[n]))return i;if(i){let a=e[i]*r,s=t[n][i],o=Math.floor(a/s);e[n]+=o*r,e[i]-=o*s*r}return n},null),xt.reduce((i,n)=>{if(V(e[n]))return i;if(i){let a=e[i]%1;e[i]-=a,e[n]+=a*t[i][n]}return n},null)}function ca(t){let e={};for(let[r,i]of Object.entries(t))i!==0&&(e[r]=i);return e}var ue=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,i=r?mu:fu;e.matrix&&(i=e.matrix),this.values=e.values,this.loc=e.loc||X.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=i,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new le(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:Hr(e,t.normalizeUnit),loc:X.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(st(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new le(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[i]=au(e);return i?t.fromObject(i,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[i]=ou(e);return i?t.fromObject(i,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new le("need to specify a reason the Duration is invalid");let i=e instanceof Te?e:new Te(e,r);if(te.throwOnInvalid)throw new Pi(i);return new t({invalid:i})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new Wr(e);return r}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,r={}){let i={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?Ne.create(this.loc,i).formatDurationFromString(this,e):la}toHuman(e={}){if(!this.isValid)return la;let r=e.showZeros!==!1,i=xt.map(n=>{let a=this.values[n];return V(a)||a===0&&!r?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(a)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(i)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=rn(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},z.fromMillis(r,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?fs(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),i={};for(let n of xt)(Zt(r.values,n)||Zt(this.values,n))&&(i[n]=r.get(n)+this.get(n));return Ye(this,{values:i},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let i of Object.keys(this.values))r[i]=Ka(e(this.values[i],i));return Ye(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Hr(e,t.normalizeUnit)};return Ye(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:i,matrix:n}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:n,conversionAccuracy:i};return Ye(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return ua(this.matrix,e),Ye(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=ca(this.normalize().shiftToAll().toObject());return Ye(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>t.normalizeUnit(s));let r={},i={},n=this.toObject(),a;for(let s of xt)if(e.indexOf(s)>=0){a=s;let o=0;for(let u in i)o+=this.matrix[u][s]*i[u],i[u]=0;st(n[s])&&(o+=n[s]);let l=Math.trunc(o);r[s]=l,i[s]=(o*1e3-l*1e3)/1e3}else st(n[s])&&(i[s]=n[s]);for(let s in i)i[s]!==0&&(r[a]+=s===a?i[s]:i[s]/this.matrix[a][s]);return ua(this.matrix,r),Ye(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return Ye(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=ca(this.values);return Ye(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function r(i,n){return i===void 0||i===0?n===void 0||n===0:i===n}for(let i of xt)if(!r(this.values[i],e.values[i]))return!1;return!0}},kt="Invalid Interval";function yu(t,e){return!t||!t.isValid?jt.invalid("missing or invalid start"):!e||!e.isValid?jt.invalid("missing or invalid end"):e<t?jt.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var jt=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new le("need to specify a reason the Interval is invalid");let i=e instanceof Te?e:new Te(e,r);if(te.throwOnInvalid)throw new Di(i);return new t({invalid:i})}static fromDateTimes(e,r){let i=sr(e),n=sr(r),a=yu(i,n);return a??new t({start:i,end:n})}static after(e,r){let i=ue.fromDurationLike(r),n=sr(e);return t.fromDateTimes(n,n.plus(i))}static before(e,r){let i=ue.fromDurationLike(r),n=sr(e);return t.fromDateTimes(n.minus(i),n)}static fromISO(e,r){let[i,n]=(e||"").split("/",2);if(i&&n){let a,s;try{a=z.fromISO(i,r),s=a.isValid}catch{s=!1}let o,l;try{o=z.fromISO(n,r),l=o.isValid}catch{l=!1}if(s&&l)return t.fromDateTimes(a,o);if(s){let u=ue.fromISO(n,r);if(u.isValid)return t.after(a,u)}else if(l){let u=ue.fromISO(i,r);if(u.isValid)return t.before(o,u)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",r){if(!this.isValid)return NaN;let i=this.start.startOf(e,r),n;return r?.useLocaleWeeks?n=this.end.reconfigure({locale:i.locale}):n=this.end,n=n.startOf(e,r),Math.floor(n.diff(i,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(sr).filter(s=>this.contains(s)).sort((s,o)=>s.toMillis()-o.toMillis()),i=[],{s:n}=this,a=0;for(;n<this.e;){let s=r[a]||this.e,o=+s>+this.e?this.e:s;i.push(t.fromDateTimes(n,o)),n=o,a+=1}return i}splitBy(e){let r=ue.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:i}=this,n=1,a,s=[];for(;i<this.e;){let o=this.start.plus(r.mapUnits(l=>l*n));a=+o>+this.e?this.e:o,s.push(t.fromDateTimes(i,a)),i=a,n+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,i=this.e<e.e?this.e:e.e;return r>=i?null:t.fromDateTimes(r,i)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,i=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,i)}static merge(e){let[r,i]=e.sort((n,a)=>n.s-a.s).reduce(([n,a],s)=>a?a.overlaps(s)||a.abutsStart(s)?[n,a.union(s)]:[n.concat([a]),s]:[n,s],[[],null]);return i&&r.push(i),r}static xor(e){let r=null,i=0,n=[],a=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),s=Array.prototype.concat(...a),o=s.sort((l,u)=>l.time-u.time);for(let l of o)i+=l.type==="s"?1:-1,i===1?r=l.time:(r&&+r!=+l.time&&n.push(t.fromDateTimes(r,l.time)),r=null);return t.merge(n)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:kt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=jr,r={}){return this.isValid?Ne.create(this.s.loc.clone(r),e).formatInterval(this):kt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:kt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:kt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:kt}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:kt}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):ue.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}},$t=class{static hasDST(e=te.defaultZone){let r=z.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return ot.isValidZone(e)}static normalizeZone(e){return nt(e,te.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||X.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||X.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||X.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:i=null,locObj:n=null,outputCalendar:a="gregory"}={}){return(n||X.create(r,i,a)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:i=null,locObj:n=null,outputCalendar:a="gregory"}={}){return(n||X.create(r,i,a)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:i=null,locObj:n=null}={}){return(n||X.create(r,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:i=null,locObj:n=null}={}){return(n||X.create(r,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return X.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return X.create(r,null,"gregory").eras(e)}static features(){return{relative:Ga(),localeWeek:Ya()}}};function da(t,e){let r=n=>n.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=r(e)-r(t);return Math.floor(ue.fromMillis(i).as("days"))}function gu(t,e,r){let i=[["years",(l,u)=>u.year-l.year],["quarters",(l,u)=>u.quarter-l.quarter+(u.year-l.year)*4],["months",(l,u)=>u.month-l.month+(u.year-l.year)*12],["weeks",(l,u)=>{let c=da(l,u);return(c-c%7)/7}],["days",da]],n={},a=t,s,o;for(let[l,u]of i)r.indexOf(l)>=0&&(s=l,n[l]=u(t,e),o=a.plus(n),o>e?(n[l]--,t=a.plus(n),t>e&&(o=t,n[l]--,t=a.plus(n))):t=o);return[t,n,o,s]}function pu(t,e,r,i){let[n,a,s,o]=gu(t,e,r),l=e-n,u=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);u.length===0&&(s<e&&(s=n.plus({[o]:1})),s!==n&&(a[o]=(a[o]||0)+l/(s-n)));let c=ue.fromObject(a,i);return u.length>0?ue.fromMillis(l,i).shiftTo(...u).plus(c):c}var Su="missing Intl.DateTimeFormat.formatToParts support";function K(t,e=r=>r){return{regex:t,deser:([r])=>e(ll(r))}}var bu="\xA0",ms=`[ ${bu}]`,hs=new RegExp(ms,"g");function vu(t){return t.replace(/\./g,"\\.?").replace(hs,ms)}function fa(t){return t.replace(/\./g,"").replace(hs," ").toLowerCase()}function Pe(t,e){return t===null?null:{regex:RegExp(t.map(vu).join("|")),deser:([r])=>t.findIndex(i=>fa(r)===fa(i))+e}}function ma(t,e){return{regex:t,deser:([,r,i])=>Qr(r,i),groups:e}}function Dr(t){return{regex:t,deser:([e])=>e}}function Fu(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function xu(t,e){let r=De(e),i=De(e,"{2}"),n=De(e,"{3}"),a=De(e,"{4}"),s=De(e,"{6}"),o=De(e,"{1,2}"),l=De(e,"{1,3}"),u=De(e,"{1,6}"),c=De(e,"{1,9}"),d=De(e,"{2,4}"),f=De(e,"{4,6}"),m=y=>({regex:RegExp(Fu(y.val)),deser:([p])=>p,literal:!0}),g=(y=>{if(t.literal)return m(y);switch(y.val){case"G":return Pe(e.eras("short"),0);case"GG":return Pe(e.eras("long"),0);case"y":return K(u);case"yy":return K(d,Qi);case"yyyy":return K(a);case"yyyyy":return K(f);case"yyyyyy":return K(s);case"M":return K(o);case"MM":return K(i);case"MMM":return Pe(e.months("short",!0),1);case"MMMM":return Pe(e.months("long",!0),1);case"L":return K(o);case"LL":return K(i);case"LLL":return Pe(e.months("short",!1),1);case"LLLL":return Pe(e.months("long",!1),1);case"d":return K(o);case"dd":return K(i);case"o":return K(l);case"ooo":return K(n);case"HH":return K(i);case"H":return K(o);case"hh":return K(i);case"h":return K(o);case"mm":return K(i);case"m":return K(o);case"q":return K(o);case"qq":return K(i);case"s":return K(o);case"ss":return K(i);case"S":return K(l);case"SSS":return K(n);case"u":return Dr(c);case"uu":return Dr(o);case"uuu":return K(r);case"a":return Pe(e.meridiems(),0);case"kkkk":return K(a);case"kk":return K(d,Qi);case"W":return K(o);case"WW":return K(i);case"E":case"c":return K(r);case"EEE":return Pe(e.weekdays("short",!1),1);case"EEEE":return Pe(e.weekdays("long",!1),1);case"ccc":return Pe(e.weekdays("short",!0),1);case"cccc":return Pe(e.weekdays("long",!0),1);case"Z":case"ZZ":return ma(new RegExp(`([+-]${o.source})(?::(${i.source}))?`),2);case"ZZZ":return ma(new RegExp(`([+-]${o.source})(${i.source})?`),2);case"z":return Dr(/[a-z_+-/]{1,256}?/i);case" ":return Dr(/[^\S\n\r]/);default:return m(y)}})(t)||{invalidReason:Su};return g.token=t,g}var Cu={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function wu(t,e,r){let{type:i,value:n}=t;if(i==="literal"){let l=/^\s+$/.test(n);return{literal:!l,val:l?" ":n}}let a=e[i],s=i;i==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=r.hour12?"hour12":"hour24");let o=Cu[s];if(typeof o=="object"&&(o=o[a]),o)return{literal:!1,val:o}}function Nu(t){return[`^${t.map(r=>r.regex).reduce((r,i)=>`${r}(${i.source})`,"")}$`,t]}function Tu(t,e,r){let i=t.match(e);if(i){let n={},a=1;for(let s in r)if(Zt(r,s)){let o=r[s],l=o.groups?o.groups+1:1;!o.literal&&o.token&&(n[o.token.val[0]]=o.deser(i.slice(a,a+l))),a+=l}return[i,n]}else return[i,{}]}function Ou(t){let e=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,i;return V(t.z)||(r=ot.create(t.z)),V(t.Z)||(r||(r=new Ae(t.Z)),i=t.Z),V(t.q)||(t.M=(t.q-1)*3+1),V(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),V(t.u)||(t.S=tn(t.u)),[Object.keys(t).reduce((a,s)=>{let o=e(s);return o&&(a[o]=t[s]),a},{}),r,i]}var Mi=null;function Bu(){return Mi||(Mi=z.fromMillis(1555555555555)),Mi}function Mu(t,e){if(t.literal)return t;let r=Ne.macroTokenToFormatOpts(t.val),i=ps(r,e);return i==null||i.includes(void 0)?t:i}function ys(t,e){return Array.prototype.concat(...t.map(r=>Mu(r,e)))}var Ur=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=ys(Ne.parseFormat(r),e),this.units=this.tokens.map(i=>xu(i,e)),this.disqualifyingUnit=this.units.find(i=>i.invalidReason),!this.disqualifyingUnit){let[i,n]=Nu(this.units);this.regex=RegExp(i,"i"),this.handlers=n}}explainFromTokens(e){if(this.isValid){let[r,i]=Tu(e,this.regex,this.handlers),[n,a,s]=i?Ou(i):[null,null,void 0];if(Zt(i,"a")&&Zt(i,"H"))throw new at("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:r,matches:i,result:n,zone:a,specificOffset:s}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function gs(t,e,r){return new Ur(t,r).explainFromTokens(e)}function Iu(t,e,r){let{result:i,zone:n,specificOffset:a,invalidReason:s}=gs(t,e,r);return[i,n,a,s]}function ps(t,e){if(!t)return null;let i=Ne.create(e,t).dtFormatter(Bu()),n=i.formatToParts(),a=i.resolvedOptions();return n.map(s=>wu(s,t,a))}var Ii="Invalid DateTime",ha=864e13;function lr(t){return new Te("unsupported zone",`the zone "${t.name}" is not supported`)}function Ei(t){return t.weekData===null&&(t.weekData=_r(t.c)),t.weekData}function Ai(t){return t.localWeekData===null&&(t.localWeekData=_r(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Ft(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new z({...r,...e,old:r})}function Ss(t,e,r){let i=t-e*60*1e3,n=r.offset(i);if(e===n)return[i,e];i-=(n-e)*60*1e3;let a=r.offset(i);return n===a?[i,n]:[t-Math.min(n,a)*60*1e3,Math.max(n,a)]}function Pr(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function Vr(t,e,r){return Ss(Yr(t),e,r)}function ya(t,e){let r=t.o,i=t.c.year+Math.trunc(e.years),n=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,a={...t.c,year:i,month:n,day:Math.min(t.c.day,zr(i,n))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=ue.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Yr(a),[l,u]=Ss(o,r,t.zone);return s!==0&&(l+=s,u=t.zone.offset(l)),{ts:l,o:u}}function Vt(t,e,r,i,n,a){let{setZone:s,zone:o}=r;if(t&&Object.keys(t).length!==0||e){let l=e||o,u=z.fromObject(t,{...r,zone:l,specificOffset:a});return s?u:u.setZone(o)}else return z.invalid(new Te("unparsable",`the input "${n}" can't be parsed as ${i}`))}function kr(t,e,r=!0){return t.isValid?Ne.create(X.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Li(t,e,r){let i=t.c.year>9999||t.c.year<0,n="";if(i&&t.c.year>=0&&(n+="+"),n+=ne(t.c.year,i?6:4),r==="year")return n;if(e){if(n+="-",n+=ne(t.c.month),r==="month")return n;n+="-"}else if(n+=ne(t.c.month),r==="month")return n;return n+=ne(t.c.day),n}function ga(t,e,r,i,n,a,s){let o=!r||t.c.millisecond!==0||t.c.second!==0,l="";switch(s){case"day":case"month":case"year":break;default:if(l+=ne(t.c.hour),s==="hour")break;if(e){if(l+=":",l+=ne(t.c.minute),s==="minute")break;o&&(l+=":",l+=ne(t.c.second))}else{if(l+=ne(t.c.minute),s==="minute")break;o&&(l+=ne(t.c.second))}if(s==="second")break;o&&(!i||t.c.millisecond!==0)&&(l+=".",l+=ne(t.c.millisecond,3))}return n&&(t.isOffsetFixed&&t.offset===0&&!a?l+="Z":t.o<0?(l+="-",l+=ne(Math.trunc(-t.o/60)),l+=":",l+=ne(Math.trunc(-t.o%60))):(l+="+",l+=ne(Math.trunc(t.o/60)),l+=":",l+=ne(Math.trunc(t.o%60)))),a&&(l+="["+t.zone.ianaName+"]"),l}var bs={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Eu={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Au={ordinal:1,hour:0,minute:0,second:0,millisecond:0},$r=["year","month","day","hour","minute","second","millisecond"],Lu=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],qu=["year","ordinal","hour","minute","second","millisecond"];function Rr(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new Wr(t);return e}function pa(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Rr(t)}}function Du(t){if(ur===void 0&&(ur=te.now()),t.type!=="iana")return t.offset(ur);let e=t.name,r=Ki.get(e);return r===void 0&&(r=t.offset(ur),Ki.set(e,r)),r}function Sa(t,e){let r=nt(e.zone,te.defaultZone);if(!r.isValid)return z.invalid(lr(r));let i=X.fromObject(e),n,a;if(V(t.year))n=te.now();else{for(let l of $r)V(t[l])&&(t[l]=bs[l]);let s=Ha(t)||Ua(t);if(s)return z.invalid(s);let o=Du(r);[n,a]=Vr(t,o,r)}return new z({ts:n,zone:r,loc:i,o:a})}function ba(t,e,r){let i=V(r.round)?!0:r.round,n=V(r.rounding)?"trunc":r.rounding,a=(o,l)=>(o=rn(o,i||r.calendary?0:2,r.calendary?"round":n),e.loc.clone(r).relFormatter(r).format(o,l)),s=o=>r.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(r.unit)return a(s(r.unit),r.unit);for(let o of r.units){let l=s(o);if(Math.abs(l)>=1)return a(l,o)}return a(t>e?-0:0,r.units[r.units.length-1])}function va(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var ur,Ki=new Map,z=class t{constructor(e){let r=e.zone||te.defaultZone,i=e.invalid||(Number.isNaN(e.ts)?new Te("invalid input"):null)||(r.isValid?null:lr(r));this.ts=V(e.ts)?te.now():e.ts;let n=null,a=null;if(!i)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[n,a]=[e.old.c,e.old.o];else{let o=st(e.o)&&!e.old?e.o:r.offset(this.ts);n=Pr(this.ts,o),i=Number.isNaN(n.year)?new Te("invalid input"):null,n=i?null:n,a=i?null:o}this._zone=r,this.loc=e.loc||X.create(),this.invalid=i,this.weekData=null,this.localWeekData=null,this.c=n,this.o=a,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=va(arguments),[i,n,a,s,o,l,u]=r;return Sa({year:i,month:n,day:a,hour:s,minute:o,second:l,millisecond:u},e)}static utc(){let[e,r]=va(arguments),[i,n,a,s,o,l,u]=r;return e.zone=Ae.utcInstance,Sa({year:i,month:n,day:a,hour:s,minute:o,second:l,millisecond:u},e)}static fromJSDate(e,r={}){let i=ml(e)?e.valueOf():NaN;if(Number.isNaN(i))return t.invalid("invalid input");let n=nt(r.zone,te.defaultZone);return n.isValid?new t({ts:i,zone:n,loc:X.fromObject(r)}):t.invalid(lr(n))}static fromMillis(e,r={}){if(st(e))return e<-ha||e>ha?t.invalid("Timestamp out of range"):new t({ts:e,zone:nt(r.zone,te.defaultZone),loc:X.fromObject(r)});throw new le(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(st(e))return new t({ts:e*1e3,zone:nt(r.zone,te.defaultZone),loc:X.fromObject(r)});throw new le("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let i=nt(r.zone,te.defaultZone);if(!i.isValid)return t.invalid(lr(i));let n=X.fromObject(r),a=Hr(e,pa),{minDaysInFirstWeek:s,startOfWeek:o}=ia(a,n),l=te.now(),u=V(r.specificOffset)?i.offset(l):r.specificOffset,c=!V(a.ordinal),d=!V(a.year),f=!V(a.month)||!V(a.day),m=d||f,h=a.weekYear||a.weekNumber;if((m||c)&&h)throw new at("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new at("Can't mix ordinal dates with month/day");let g=h||a.weekday&&!m,y,p,F=Pr(l,u);g?(y=Lu,p=Eu,F=_r(F,s,o)):c?(y=qu,p=Au,F=Bi(F)):(y=$r,p=bs);let C=!1;for(let M of y){let q=a[M];V(q)?C?a[M]=p[M]:a[M]=F[M]:C=!0}let x=g?cl(a,s,o):c?dl(a):Ha(a),w=x||Ua(a);if(w)return t.invalid(w);let N=g?ta(a,s,o):c?ra(a):a,[O,T]=Vr(N,u,i),B=new t({ts:O,zone:i,o:T,loc:n});return a.weekday&&m&&e.weekday!==B.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${B.toISO()}`):B.isValid?B:t.invalid(B.invalid)}static fromISO(e,r={}){let[i,n]=ru(e);return Vt(i,n,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[i,n]=iu(e);return Vt(i,n,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[i,n]=nu(e);return Vt(i,n,r,"HTTP",r)}static fromFormat(e,r,i={}){if(V(e)||V(r))throw new le("fromFormat requires an input string and a format");let{locale:n=null,numberingSystem:a=null}=i,s=X.fromOpts({locale:n,numberingSystem:a,defaultToEN:!0}),[o,l,u,c]=Iu(s,e,r);return c?t.invalid(c):Vt(o,l,i,`format ${r}`,e,u)}static fromString(e,r,i={}){return t.fromFormat(e,r,i)}static fromSQL(e,r={}){let[i,n]=du(e);return Vt(i,n,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new le("need to specify a reason the DateTime is invalid");let i=e instanceof Te?e:new Te(e,r);if(te.throwOnInvalid)throw new qi(i);return new t({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let i=ps(e,X.fromObject(r));return i?i.map(n=>n?n.val:null).join(""):null}static expandFormat(e,r={}){return ys(Ne.parseFormat(e),X.fromObject(r)).map(n=>n.val).join("")}static resetCache(){ur=void 0,Ki.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Ei(this).weekYear:NaN}get weekNumber(){return this.isValid?Ei(this).weekNumber:NaN}get weekday(){return this.isValid?Ei(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Ai(this).weekday:NaN}get localWeekNumber(){return this.isValid?Ai(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Ai(this).weekYear:NaN}get ordinal(){return this.isValid?Bi(this.c).ordinal:NaN}get monthShort(){return this.isValid?$t.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?$t.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?$t.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?$t.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,r=6e4,i=Yr(this.c),n=this.zone.offset(i-e),a=this.zone.offset(i+e),s=this.zone.offset(i-n*r),o=this.zone.offset(i-a*r);if(s===o)return[this];let l=i-s*r,u=i-o*r,c=Pr(l,s),d=Pr(u,o);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[Ft(this,{ts:l}),Ft(this,{ts:u})]:[this]}get isInLeapYear(){return fr(this.year)}get daysInMonth(){return zr(this.year,this.month)}get daysInYear(){return this.isValid?Rt(this.year):NaN}get weeksInWeekYear(){return this.isValid?dr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?dr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:i,calendar:n}=Ne.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:i,outputCalendar:n}}toUTC(e=0,r={}){return this.setZone(Ae.instance(e),r)}toLocal(){return this.setZone(te.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:i=!1}={}){if(e=nt(e,te.defaultZone),e.equals(this.zone))return this;if(e.isValid){let n=this.ts;if(r||i){let a=e.offset(this.ts),s=this.toObject();[n]=Vr(s,a,e)}return Ft(this,{ts:n,zone:e})}else return t.invalid(lr(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:i}={}){let n=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:i});return Ft(this,{loc:n})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Hr(e,pa),{minDaysInFirstWeek:i,startOfWeek:n}=ia(r,this.loc),a=!V(r.weekYear)||!V(r.weekNumber)||!V(r.weekday),s=!V(r.ordinal),o=!V(r.year),l=!V(r.month)||!V(r.day),u=o||l,c=r.weekYear||r.weekNumber;if((u||s)&&c)throw new at("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&s)throw new at("Can't mix ordinal dates with month/day");let d;a?d=ta({..._r(this.c,i,n),...r},i,n):V(r.ordinal)?(d={...this.toObject(),...r},V(r.day)&&(d.day=Math.min(zr(d.year,d.month),d.day))):d=ra({...Bi(this.c),...r});let[f,m]=Vr(d,this.o,this.zone);return Ft(this,{ts:f,o:m})}plus(e){if(!this.isValid)return this;let r=ue.fromDurationLike(e);return Ft(this,ya(this,r))}minus(e){if(!this.isValid)return this;let r=ue.fromDurationLike(e).negate();return Ft(this,ya(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let i={},n=ue.normalizeUnit(e);switch(n){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(n==="weeks")if(r){let a=this.loc.getStartOfWeek(),{weekday:s}=this;s<a&&(i.weekNumber=this.weekNumber-1),i.weekday=a}else i.weekday=1;if(n==="quarters"){let a=Math.ceil(this.month/3);i.month=(a-1)*3+1}return this.set(i)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?Ne.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):Ii}toLocaleString(e=jr,r={}){return this.isValid?Ne.create(this.loc.clone(r),e).formatDateTime(this):Ii}toLocaleParts(e={}){return this.isValid?Ne.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:i=!1,includeOffset:n=!0,extendedZone:a=!1,precision:s="milliseconds"}={}){if(!this.isValid)return null;s=Rr(s);let o=e==="extended",l=Li(this,o,s);return $r.indexOf(s)>=3&&(l+="T"),l+=ga(this,o,r,i,n,a,s),l}toISODate({format:e="extended",precision:r="day"}={}){return this.isValid?Li(this,e==="extended",Rr(r)):null}toISOWeekDate(){return kr(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:i=!0,includePrefix:n=!1,extendedZone:a=!1,format:s="extended",precision:o="milliseconds"}={}){return this.isValid?(o=Rr(o),(n&&$r.indexOf(o)>=3?"T":"")+ga(this,s==="extended",r,e,i,a,o)):null}toRFC2822(){return kr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return kr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Li(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:i=!0}={}){let n="HH:mm:ss.SSS";return(r||e)&&(i&&(n+=" "),r?n+="z":e&&(n+="ZZ")),kr(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Ii}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",i={}){if(!this.isValid||!e.isValid)return ue.invalid("created by diffing an invalid DateTime");let n={locale:this.locale,numberingSystem:this.numberingSystem,...i},a=hl(r).map(ue.normalizeUnit),s=e.valueOf()>this.valueOf(),o=s?this:e,l=s?e:this,u=pu(o,l,a,n);return s?u.negate():u}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?jt.fromDateTimes(this,e):this}hasSame(e,r,i){if(!this.isValid)return!1;let n=e.valueOf(),a=this.setZone(e.zone,{keepLocalTime:!0});return a.startOf(r,i)<=n&&n<=a.endOf(r,i)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||t.fromObject({},{zone:this.zone}),i=e.padding?this<r?-e.padding:e.padding:0,n=["years","months","days","hours","minutes","seconds"],a=e.unit;return Array.isArray(e.unit)&&(n=e.unit,a=void 0),ba(r,this.plus(i),{...e,numeric:"always",units:n,unit:a})}toRelativeCalendar(e={}){return this.isValid?ba(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new le("min requires all arguments be DateTimes");return na(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new le("max requires all arguments be DateTimes");return na(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,i={}){let{locale:n=null,numberingSystem:a=null}=i,s=X.fromOpts({locale:n,numberingSystem:a,defaultToEN:!0});return gs(s,e,r)}static fromStringExplain(e,r,i={}){return t.fromFormatExplain(e,r,i)}static buildFormatParser(e,r={}){let{locale:i=null,numberingSystem:n=null}=r,a=X.fromOpts({locale:i,numberingSystem:n,defaultToEN:!0});return new Ur(a,e)}static fromFormatParser(e,r,i={}){if(V(e)||V(r))throw new le("fromFormatParser requires an input string and a format parser");let{locale:n=null,numberingSystem:a=null}=i,s=X.fromOpts({locale:n,numberingSystem:a,defaultToEN:!0});if(!s.equals(r.locale))throw new le(`fromFormatParser called with a locale of ${s}, but the format parser was created for ${r.locale}`);let{result:o,zone:l,specificOffset:u,invalidReason:c}=r.explainFromTokens(e);return c?t.invalid(c):Vt(o,l,i,`format ${r.format}`,e,u)}static get DATE_SHORT(){return jr}static get DATE_MED(){return Fa}static get DATE_MED_WITH_WEEKDAY(){return zo}static get DATE_FULL(){return xa}static get DATE_HUGE(){return Ca}static get TIME_SIMPLE(){return wa}static get TIME_WITH_SECONDS(){return Na}static get TIME_WITH_SHORT_OFFSET(){return Ta}static get TIME_WITH_LONG_OFFSET(){return Oa}static get TIME_24_SIMPLE(){return Ba}static get TIME_24_WITH_SECONDS(){return Ma}static get TIME_24_WITH_SHORT_OFFSET(){return Ia}static get TIME_24_WITH_LONG_OFFSET(){return Ea}static get DATETIME_SHORT(){return Aa}static get DATETIME_SHORT_WITH_SECONDS(){return La}static get DATETIME_MED(){return qa}static get DATETIME_MED_WITH_SECONDS(){return Da}static get DATETIME_MED_WITH_WEEKDAY(){return Ho}static get DATETIME_FULL(){return Pa}static get DATETIME_FULL_WITH_SECONDS(){return ka}static get DATETIME_HUGE(){return Va}static get DATETIME_HUGE_WITH_SECONDS(){return $a}};function sr(t){if(z.isDateTime(t))return t;if(t&&t.valueOf&&st(t.valueOf()))return z.fromJSDate(t);if(t&&typeof t=="object")return z.fromObject(t);throw new le(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function vs(t){var e,r,i=t.length;if(i===1)e=0,r=t[0][1];else{for(var n=0,a=0,s=0,o=0,l,u,c,d=0;d<i;d++)l=t[d],u=l[0],c=l[1],n+=u,a+=c,s+=u*u,o+=u*c;e=(i*o-n*a)/(i*s-n*n),r=a/i-e*n/i}return{m:e,b:r}}function Fs(t){return function(e){return t.b+t.m*e}}function xs(t,e){if(t.length<2)return 1;for(var r=0,i=0;i<t.length;i++)r+=t[i][1];for(var n=r/t.length,a=0,s=0;s<t.length;s++)a+=Math.pow(n-t[s][1],2);for(var o=0,l=0;l<t.length;l++)o+=Math.pow(t[l][1]-e(t[l][0]),2);return 1-o/a}var Cs=function(){this.totalCount=0,this.data={}};Cs.prototype.train=function(e,r){this.data[r]||(this.data[r]={});for(var i in e){var n=e[i];this.data[r][i]===void 0&&(this.data[r][i]={}),this.data[r][i][n]===void 0&&(this.data[r][i][n]=0),this.data[r][i][n]++}this.totalCount++};Cs.prototype.score=function(e){var r={},i;for(var n in e){var a=e[n];for(i in this.data)r[i]={},this.data[i][n]?r[i][n+"_"+a]=(this.data[i][n][a]||0)/this.totalCount:r[i][n+"_"+a]=0}var s={};for(i in r){s[i]=0;for(var o in r[i])s[i]+=r[i][o]}return s};var ws=function(){this.weights=[],this.bias=0};ws.prototype.predict=function(e){if(e.length!==this.weights.length)return null;for(var r=0,i=0;i<this.weights.length;i++)r+=this.weights[i]*e[i];return r+=this.bias,r>0?1:0};ws.prototype.train=function(e,r){if(r!==0&&r!==1)return null;e.length!==this.weights.length&&(this.weights=e,this.bias=1);var i=this.predict(e);if(typeof i=="number"&&i!==r){for(var n=r-i,a=0;a<this.weights.length;a++)this.weights[a]+=n*e[a];this.bias+=n}return this};var Wh=607/128,jh=Math.log(Math.sqrt(2*Math.PI));var Zh=Math.sqrt(2*Math.PI);var Pu=Math.sqrt(2*Math.PI);function ku(t){for(var e=t,r=t,i=1;i<15;i++)r*=t*t/(2*i+1),e+=r;return Math.round((.5+e/Pu*Math.exp(-t*t/2))*1e4)/1e4}var Vu=[];for(Jr=0;Jr<=3.09;Jr+=.01)Vu.push(ku(Jr));var Jr;var ce=class extends Error{constructor(e,r,i){super(r),this.name=e,this.details=i}};function ic(t,e){let r=e.errors[t];throw new ce(e.modalHeaders.error,r??e.errors.simpleError)}function $e(t){return t.axes?.[0]?.valueFormat?.type}function Oy(t){return t.intlOptions}function ye(t){return t?.type===S.NumberAxisFormat}function By(t){return ye(t)&&t.intlOptions?.style==="percent"}function Ke(t){return t?.type===S.CategoryAxisFormat}function Nt(t){return t?.type===S.DateAxisFormat}function My(t){let{oldConfig:e,newConfig:r,rotationChanged:i}=t;return i?[!0,!0]:[e.horizontalAxisLabelsBehavior!==r.horizontalAxisLabelsBehavior,e.verticalAxisLabelsBehavior!==r.verticalAxisLabelsBehavior]}function nc(t){return ye(t?.[1]?.valueFormat)&&(t?.[2]?.valueFormat===void 0||ye(t[2].valueFormat))}function ac(t){return ye(t?.[1]?.valueFormat)&&(t?.[2]?.valueFormat===void 0||ye(t[2].valueFormat))}function sc(t){return(Ke(t?.[0]?.valueFormat)||Nt(t?.[0]?.valueFormat))&&ye(t?.[1]?.valueFormat)&&(t?.[2]?.valueFormat===void 0||ye(t[2].valueFormat))}function oc(t){return Ke(t?.[0]?.valueFormat)&&Ke(t?.[1]?.valueFormat)||Nt(t?.[0]?.valueFormat)&&Ke(t?.[1]?.valueFormat)||Nt(t?.[0]?.valueFormat)&&Nt(t?.[1]?.valueFormat)}function lc(t){return(Ke(t?.[0]?.valueFormat)||Nt(t?.[0]?.valueFormat))&&ye(t?.[1]?.valueFormat)}function uc(t){return ye(t?.[0]?.valueFormat)&&ye(t?.[1]?.valueFormat)}function cc(t){return ye(t?.[0]?.valueFormat)&&ye(t?.[1]?.valueFormat)}function dc(t){return ye(t?.[0]?.valueFormat)}function Iy(t){let{chartType:e,axesConfig:r,errorStrings:i}=t,n,a;switch(e){case S.GaugeSeries:n=dc,a="invalidValueFormatForGauge";break;case S.ScatterSeries:n=uc,a="invalidValueFormatForScatterplot";break;case S.HistogramSeries:n=cc,a="invalidValueFormatForHistogram";break;case S.LineSeries:n=nc,a="invalidValueFormatForLineChart";break;case S.BarSeries:n=ac,a="invalidValueFormatForBarChart";break;case S.ComboLineAndBarSeries:n=lc,a="invalidValueFormatForComboBarLineChart";break;case S.BoxPlotSeries:n=sc,a="invalidValueFormatForBoxPlot";break;case S.HeatSeries:n=oc,a="invalidValueFormatForHeatChart";break}n!==void 0&&a!==void 0&&(n(r)||ic(a,i))}function fc(t){let{isXAxis:e,chartType:r,valueFormat:i,isAxisForHistogramOverlaySeries:n}=t;return e&&(Ke(i)||r===S.HistogramSeries&&!n||r===S.BarSeries&&ye(i))}function Tt(t){return Z(t?.series)===S.HeatSeries}function Fe(t){return Z(t?.series)===S.BoxPlotSeries}function mc(t){return t!==void 0&&t!==Br.Solid&&t!==Br.Null}function Ey(t,e){let r="",i=(e??0)/2,n=0-i,a=0+i,s=0-i,o=0+i;switch(t){case pt.Circle:r=`M ${n},0 a ${i},${i} 0 1,0 ${i*2},0 a ${i},${i} 0 1,0 ${-i*2},0`;break;case pt.Cross:r=`M ${n},0 L ${a},0 M 0,${s} L 0,${o} E`;break;case pt.Diamond:r=`M ${n},0 L 0,${s} L ${a},0 L 0,${o} L ${n},0 Z`;break;case pt.Square:r=`M ${n},${o} L ${n},${s} L ${a},${s} L ${a},${o} L ${n},${o} Z`;break;case pt.Triangle:r=`M ${n},${o} L 0,${s} L ${a},${o} L ${n},${o} Z`;break;case pt.X:r=`M ${n},${o} L ${a},${s} M ${n},${s} L ${a},${o} E`;break}return r}var ve="arcgis_charts_pie_from_fields_name",ze="arcgis_charts_pie_from_fields_value",Ay="arcgis_charts_bar_line_from_fields_name",Ly="arcgis_charts_bar_line_from_fields_value",yr={...v,titleAndSubtitlePaddingBottom:5,chartPadding:5,footerContainer:{...v.footerContainer,paddingTop:0,paddingBottom:0},headerContainer:{...v.headerContainer,paddingBottom:18},chartContainer:{...v.chartContainer},dataLabel:{...v.dataLabel,verticalCenter:"bottom"},scrollbarPadding:12,zIndexes:{guide:100,scatterplotTrendLine:2,lineSeries:1,axisLineLayer:30},verticalSurfaceGuideLabels:{wrap:!0},verticalLineGuideLabels:{wrap:!0,rotation:90},horizontalSurfaceGuideLabels:{wrap:!0},horizontalLineGuideLabels:{wrap:!0},overlayId:{scatterplotTrendLine:"arcgis_charts_scatter_plot_trendline",histogramMean:"arcgis_charts_histogram_mean",histogramMedian:"arcgis_charts_histogram_median",histogramStdDev:"arcgis_charts_histogram_std_dev",histogramNormalDistribution:"arcgis_charts_histogram_normal_distribution"},axisLabelSpacing:{verticalAxisLabelSidePadding:8,horizontalAxisLabelPaddingTop:6},legendPadding:20,heatChart:{gradientHeatRules:{minColor:[255,255,200,255],maxColor:[255,0,0,255],outsideRangeLowerColor:[250,250,250,255],outsideRangeUpperColor:[0,0,255,255]},legend:{position:qn.Bottom,chartPadding:40,legendPadding:20,width:70,bottomHeight:20,topHeight:50,titleHeight:10,titlePadding:10,minMaxLabelPadding:3},emptyCells:{symbol:{type:rt.SFS,style:Br.Solid,color:v.grayColor},text:"null"},includeLeapDay:!1},heatChartLabelPadding:{paddingTop:2},pieChartDataLabel:{minWidth:30},focusableThreshold:500,lineJoin:"round"},Mt={LegendItemVisibilityChange:"arcgisChartsJSLegendItemVisibilityChange",RenderingComplete:"arcgisChartsJSRenderingComplete",SeriesColorsChange:"arcgisChartsJSSeriesColorChange",AxesMinMaxChange:"arcgisChartsJSAxesMinMaxChange",SelectionComplete:"arcgisChartsJSSelectionComplete",TooManySelectedElements:"arcgisChartsJSTooManySelectedElements",SeriesOrder:"arcgisChartsJSSeriesOrder"};function It(t){return{detail:t,composed:!0,cancelable:!0,bubbles:!0}}function qy(t,e){e&&e.dispatchEvent(new window.CustomEvent(Mt.LegendItemVisibilityChange,It(t)))}function Dy(t){t&&t.dispatchEvent(new window.CustomEvent(Mt.RenderingComplete,It()))}function Py(t){let{data:e,htmlContainer:r}=t;r&&r.dispatchEvent(new window.CustomEvent(Mt.SelectionComplete,It(e)))}function ky(t){t&&t.dispatchEvent(new window.CustomEvent(Mt.TooManySelectedElements,It()))}function Vy(t){let{data:e,htmlContainer:r,chartId:i,colorMatchApplied:n}=t;r&&r.dispatchEvent(new window.CustomEvent(Mt.SeriesColorsChange,It({chartId:i,data:e,colorMatchApplied:n})))}function $y(t,e){e&&e.dispatchEvent(new window.CustomEvent(Mt.AxesMinMaxChange,It(t)))}function hc(t){let{data:e,htmlContainer:r}=t;r&&e&&r.dispatchEvent(new window.CustomEvent(Mt.SeriesOrder,It(e)))}var P={Min:"min",FirstQuartile:"first_quartile",Median:"median",ThirdQuartile:"third_quartile",Max:"max",IQR:"iqr",Average:"avg",StandardDeviation:"stddev",Outlier:"outlier"};function Ry(t){return t!==void 0&&(!("url"in t)||!t.url)}function ct(t){return t!==void 0&&"view"in t&&"layer"in t&&t.layer.type==="feature"}function Ks(t){return t!==void 0&&"type"in t&&t.type==="feature"}function Js(t){return t!==void 0&&"type"in t&&t.type==="subtype-sublayer"}function yc(t){return Ks(t)||Js(t)}function Be(t){return Js(t)?t.parent??void 0:t}function Xs(t){return t?.capabilities?.query?.supportsDistance||Be(t)?.sourceJSON?.advancedQueryCapabilities?.supportsQueryWithDistance===!0}function gc(t){return t?.capabilities?.queryAttributeBins?.supportsFixedInterval===!0&&t?.capabilities?.queryAttributeBins?.supportsStackBy}function Wy(t){let{chartConfig:e,queryObject:r,options:i}=t,n=Z(e?.series),a=de(e?.series[0]?.query?.where);return!(n===S.HeatSeries||e&&Xe({xAxisValueFormatType:$e(e),setTimeBinningInfoWhenNotProvided:i?.setTimeBinningInfoWhenNotProvided,seriesConfig:e.series[0],queryObject:r})&&Qt(a,r))}function Qt(t,e){return e!==void 0&&(ct(e)||!oe(e)&&"capabilities"in e&&e.capabilities?.queryAttributeBins?.supportsDate===!0&&(he(t)||e.capabilities?.queryAttributeBins?.supportsStackBy))}function pc(t){let e=!1,r=Be(U(t))?.sourceJSON;if(r){let i=r.queryBinsCapabilities?.supportsFixedIntervalBin,n=r.queryBinsCapabilities?.supportedStatisticTypes,a=[A.Maximum,A.Count].every(s=>n?.includes(s.toUpperCase())||n?.includes(s.toLowerCase()));e=i&&a}return e}function jy(t){let e;return ct(t)?e=t.layer:e=t,e}function U(t){let e;return ct(t)?e=t.layer:e=t,e}function Sc(t){let e=!1,r=Be(t)?.sourceJSON?.advancedQueryCapabilities?.supportedSpatialAggregationStatistics??[],i=t?.capabilities?.query.supportedSpatialAggregationStatistics??{};return e=r.includes("EnvelopeAggregate")||"envelope"in i&&i.envelope===!0,e}function Zy(t){let{chartConfig:e,queryObject:r}=t,i;if(r){let n=U(r);Ci(n)?i={id:n.id,layerType:"ArcGISImageServiceLayer"}:wi(n)?i={id:n.id,layerType:"ArcGISTiledImageServiceLayer"}:i={id:n.id,layerType:"ArcGISFeatureLayer"},n.url&&(i.url=n.url)}return{...e,iLayer:i}}var wt=["1.0.0","1.0.1","2.0.0","3.0.0","3.1.0","3.2.0","3.3.0","3.4.0","3.5.0","3.6.0","3.7.0","3.8.0","3.9.0","3.9.1","3.9.2","3.10.0","3.11.0","4.0.0","4.0.1","5.0.0","6.0.0","6.1.0","6.2.0","6.2.1","6.3.0","6.4.0","7.0.0","7.1.0","7.1.1","7.2.0","7.2.1","7.3.1","7.4.0","7.4.1","7.5.0","7.5.1","7.6.0","8.0.0","8.0.1","9.0.0","9.1.0","9.2.0","9.3.0","9.4.0","9.5.0","9.6.0","9.6.1","9.7.0","10.0.0","11.0.0","12.0.0","13.0.0","14.0.0","14.0.1","15.0.0","16.0.0","16.1.0","16.1.1","17.0.0","17.1.0","17.2.0","17.2.1","18.0.0","18.1.0","18.1.1","18.1.2","18.1.3","19.0.0","20.0.0","20.1.0","20.2.0","21.0.0","21.1.0","22.0.0","23.0.0","23.1.0","23.2.0","23.3.0","24.0.0","24.1.0","24.2.0","24.3.0","24.4.0","24.5.0","24.6.0","24.7.0","24.8.0","25.0.0","25.1.0"],bc="1.0.0",vc="unrecognized.version",Fc=[S.LineSeries,S.BarSeries,S.ComboLineAndBarSeries,S.RadarSeries];function on(t,e){let r=0;if(t!==e){let i=t.split("."),n=e.split(".");for(let a=0;a<i.length;a+=1){let s=Number.parseInt(i[a],10),o=Number.parseInt(n[a],10);if(s>o||Number.isNaN(o)){r=1;break}if(s<o){r=-1;break}}}return r}function xc(t){return t!==void 0?/^([1-9]\d*|0)(\.(([1-9]\d*)|0)){2}$/u.test(t):!1}function _y(t){let e=gt.Same,r=[];if(xc(t)&&t!==void 0){wt.sort(on);let i=on(t,wt[wt.length-1]);if(i===1?e=gt.Newer:i===-1&&(e=gt.Older),e===gt.Newer||e===gt.Same)r.push(t);else{for(let n=wt.length-2;n>=0;n-=1)if(on(t,wt[n])>=0){r=wt.slice(n,wt.length);break}r.length===0&&r.push(bc)}}else e=gt.Unrecognized,r.push(vc);return{versionStatus:e,versions:r}}function mt(t){let{series:e}=t,r=("showMean"in t?t.showMean:!1)===!0?e.find(i=>i.type===S.LineSeries):e[0];return r??=e[0],r}function zy(t,e){let r=t!==null?t.toString():null,i=e!=null?e.toString():null;return i!==null&&i!==r?rt.SFS:rt.SLS}function de(t,e){let r="";return t?.includes("=")&&(r=e!==!1?Fi({value:t.split("=")[0],escape:!1}):t.split("=")[0].trim()),r}function xe(t){let{where:e,normalize:r,keepSurroundingQuotes:i,escape:n=!1}=t,a="";return e?.includes("=")&&(a=e.split("=").slice(1).join("=").trim(),a==="null"?a=null:a.trim()!==""&&!Number.isNaN(Number(a))?a=Number(a):r===!1?n&&(a=Er(a)):a=Fi({value:a,keepSurroundingQuotes:i,escape:n})),a}function ut(t){let e=!1;if(t===void 0||t==="")e=!0;else if(t.includes("=")){let r=de(t,!1),i=xe({where:t,normalize:!1});e=r===`${i}`}return e}function Je(t){let{where:e,normalize:r,escape:i}=t,n=r===void 0?!0:r,a=de(e),s=xe({where:e,normalize:n,keepSurroundingQuotes:!0,escape:i}),o=e;return a!==""&&s!==""&&(o=`${a}=${s}`),o}function Cc(t){let e=b.PieFromCategory;return t[0].query?.outStatistics===void 0?e=b.PieNoAggregation:t[0].query?.groupByFieldsForStatistics===void 0&&(e=b.PieFromFields),e}function wc(t){let e=b.BarAndLineMonoField,r=t[0].query?.where;return t[0].query?.groupByFieldsForStatistics===void 0&&(t[0].query?.outStatistics??[]).length>0?e=b.BarAndLineFromFields:r===void 0&&t[0].query?.outStatistics===void 0?e=b.BarAndLineNoAggregation:ut(r)?t.length>1&&(e=b.BarAndLineMultiFields):e=t[0].query?.outStatistics===void 0?b.BarAndLineSplitByNoAggregation:b.BarAndLineSplitBy,e}function Nc(t){let e=b.BoxPlotMonoField,r=t.length===1,i=t.find(o=>o.type===S.LineSeries)??t[0],{x:n}=i,a="y"in i?i.y:"",s=i.query?.where;return n===ir?typeof a=="object"&&a.length>1?ut(s)?r&&(e=b.BoxPlotMultiFields):e=b.BoxPlotMultiFieldsAndSplitBy:r?e=b.BoxPlotMonoField:ut(s)||(e=b.BoxPlotMonoFieldAndSplitBy):r?e=b.BoxPlotMonoFieldAndCategory:ut(s)?e=b.BoxPlotMultiFieldsAndCategory:e=b.BoxPlotMonoFieldAndCategoryAndSplitBy,e}function W(t){let e=b.NonSpecific;if(t?.[0]!==void 0)switch(Z(t)){case S.PieSeries:e=Cc(t);break;case S.RadarSeries:case S.BarSeries:case S.LineSeries:case S.ComboLineAndBarSeries:e=wc(t);break;case S.BoxPlotSeries:e=Nc(t);break}return e}function Tc(t){return W(t.series)!==b.PieNoAggregation}function Oc(t){let e=!0,r=Z(t.series);if(r===S.BarSeries||r===S.LineSeries||r===S.ComboLineAndBarSeries){let i=W(t.series);e=i!==b.BarAndLineNoAggregation&&i!==b.BarAndLineSplitByNoAggregation}return e}function eo(t){let{statsMap:e,dataContext:r,chartLimits:i}=t,n=!1;if(e!==void 0){let{maxScatterPointsBeforeAggregation:a}=bt(i),{queryNumberOfFeatures:s}=v.scatterplotAggregationFields;n=(e.get(s)??Number.NaN)>=a}else r!==void 0&&(n=v.scatterplotAggregationFields.dataContextXMinField in r);return n}function Bc(t){let{dataContext:e,chartConfig:r,chartLimits:i}=t,n=!0;if(r!==void 0)switch(Z(r.series)){case S.BarSeries:case S.LineSeries:case S.ComboLineAndBarSeries:n=Oc(r);break;case S.ScatterSeries:n=eo({dataContext:e,chartLimits:i});break;case S.PieSeries:n=Tc(r);break}return n}function Xe(t){let{seriesConfig:e,xAxisValueFormatType:r,setTimeBinningInfoWhenNotProvided:i,queryObject:n}=t,a=!1;if(!oe(n)&&U(n)?.fields?.find(s=>s.name===e.x)?.type!=="time-only"&&Ve(e)&&e.binTemporalData!==!1&&r===S.DateAxisFormat){let s=W([e]);if(e.temporalBinning&&s!==b.BarAndLineNoAggregation&&s!==b.BarAndLineSplitByNoAggregation){let{unit:o,size:l}=e.temporalBinning;a=i===!0||l!==void 0&&l>0&&o!==void 0}}return a}function Ve(t){return Fc.includes(t?.type)}function Mc(t){let{previousConfig:e,newConfig:r,behaviorAfterLimit:i}=t,n=e.series,a=r.series,s=!1,o=!1;(i===St.RenderUpToTheLimit||e.orderOptions?.data===void 0||r.orderOptions?.data===void 0)&&(o=!yt(e.orderOptions?.orderByFields,r.orderOptions?.orderByFields));let l=f=>{let m=f.query;return m?.outStatistics?.forEach(h=>{Fn(h)&&!("statisticParameters"in h)&&(h.statisticParameters={value:G.defaultStatParameterValue})}),m},u=["where","outStatistics[0].outStatisticFieldName","outStatistics[0].onStatisticField"],c=yi(n.map(l),u),d=yi(a.map(l),u);return s=!yt(c,d),s||o}function Ic(t,e){return JSON.stringify(t.dataFilters)!==JSON.stringify(e.dataFilters)}function Ec(t,e){let r=!1;if(e.length&&t.length)if(e[0].x!==t[0].x)r=!0;else{let i=Z(t);if(i!==S.HistogramSeries&&i!==S.GaugeSeries){let n=Se(t).sort(),a=Se(e).sort();r=JSON.stringify(n)!==JSON.stringify(a)}}return r}function Ac(t,e){return(t??!1)!==(e??!1)}function Lc(t,e){return Ve(t.series[0])&&Ve(e.series[0])&&(t.series[0].binTemporalData??v.binTemporalData)!==(e.series[0].binTemporalData??v.binTemporalData)}function qc(t,e){let r=t.axes?.[0].valueFormat.type,i=e.axes?.[0].valueFormat.type,n=W(e.series),a=n===b.BarAndLineNoAggregation||n===b.BarAndLineSplitByNoAggregation,s=r===S.DateAxisFormat&&i===S.NumberAxisFormat,o=r===S.NumberAxisFormat&&i===S.DateAxisFormat;return r!==i&&(a||s||o)}function Dc(t){let{previousSeries:e,newConfig:r,setTimeBinningInfoWhenNotProvided:i,queryObject:n}=t,a=r.series?.[0],s=!1,o=!1;if(a&&Ve(a)&&Xe({seriesConfig:a,xAxisValueFormatType:$e(r),setTimeBinningInfoWhenNotProvided:i,queryObject:n})){let l=e[0];s=JSON.stringify(l.temporalBinning)!==JSON.stringify(a.temporalBinning),o=i===!0&&(a.temporalBinning?.size??0)<=0}return{timeBinningChanged:s,newTimeBinningWillBeCalculated:o}}function Os(t,e){return e.length!==t.length}function Pc(t,e){return Jt(t)!==Jt(e)}function kc(t,e){return JSON.stringify(t.series[0]?.valueConversion)!==JSON.stringify(e.series[0]?.valueConversion)}function Vc(t,e){return JSON.stringify(t.series[0]?.xTemporalBinning)!==JSON.stringify(e.series[0]?.xTemporalBinning)||JSON.stringify(t.series[0]?.yTemporalBinning)!==JSON.stringify(e.series[0]?.yTemporalBinning)||(t.firstDayOfWeek??7)!==(e.firstDayOfWeek??7)||t.outTimeZone!==e.outTimeZone||(t.nullPolicy??we.Null)!==(e.nullPolicy??we.Null)}function $c(t,e){return(t.hideEmptyRowsAndColumns??!1)!==(e.hideEmptyRowsAndColumns??!1)}function Rc(t,e){return(t.includeLeapDay??yr.heatChart.includeLeapDay)!==(e.includeLeapDay??yr.heatChart.includeLeapDay)}function Wc(t){let{previousConfig:e,newConfig:r,fieldList:i}=t,n=e.series[0],a=r.series[0],s=!1;if(n.type===S.ScatterSeries&&a.type===S.ScatterSeries&&i&&i.length>0){let o=new Set(n.additionalTooltipFields||[]),l=new Set(a.additionalTooltipFields||[]);if(!yt(o,l)){let u=Array.from(l).filter(c=>!o.has(c));u.length>0&&(s=i?.some(c=>u.includes(c.name)&&!Sr(c)))}}return s}function Hy(t,e){return(t?.colorMatch??!1)!==(e.colorMatch??!1)}function Uy(t,e){return(t.stackedType??qe.Side)!==(e.stackedType??qe.Side)}function ri(t){let e={...t};return e.position===void 0&&(e.position=yr.heatChart.legend.position),e}function Gy(t,e){let r=t.legend??{type:S.Legend},i=e.legend??{type:S.Legend},n=ri(r),a=ri(i);return!yt(n,a)}function Yy(t,e){let r=t.legend??{type:S.Legend},i=e.legend??{type:S.Legend},n=ri(r),a=ri(i);return n.position!==a.position}function Qy(t,e){return JSON.stringify(t.series[0]?.gradientRules)!==JSON.stringify(e.series[0]?.gradientRules)}function Ky(t,e){return t.series[0].heatRulesType!==e.series[0].heatRulesType}function Jy(t){let{oldConfig:e,newConfig:r}=t,i=!1,n=e?.series[0],a=r.series[0],s=Z(e?.series),o=Z(r.series);if(s===S.PieSeries&&o===S.PieSeries){let{slices:l,sliceGrouping:u}=n,{slices:c,sliceGrouping:d}=a,f=l?.map(y=>({sliceId:y.sliceId,label:y.label})),m=c?.map(y=>({sliceId:y.sliceId,label:y.label})),h=u?.label,g=d?.label;i=JSON.stringify(f)!==JSON.stringify(m)||JSON.stringify(h)!==JSON.stringify(g)}return i}function jc(t){let{previousSelectionOIDs:e,selectionData:r,filterBySelection:i}=t,n=!1;return i===!0&&(n=e?.length!==r?.selectionOIDs?.length||!yt(e,r?.selectionOIDs)),n}function Xy(t,e){return t?.length!==e?.length||t?.some((r,i)=>{let n=xe({where:r?.query?.where}),a=xe({where:e?.[i]?.query?.where});return n!==a})}function eg(t,e){let r=Se(t),i=Se(e);return JSON.stringify(r)!==JSON.stringify(i)}function tg(t,e){let r,i,n,a;return Ve(t.series[0])&&(r=t.series[0].temporalBinning?.unit,n=t.series[0].temporalBinning?.size),Ve(e.series[0])&&(i=e.series[0].temporalBinning?.unit,a=e.series[0].temporalBinning?.size),cn(r,n)&&!cn(i,a)}function rg(t,e){return t.axes?.length===3&&e.axes?.length===2||t.axes?.length===2&&e.axes?.length===3}function ig(t,e){return JSON.stringify(t.series.map(r=>r.assignToSecondValueAxis??!1))!==JSON.stringify(e.series.map(r=>r.assignToSecondValueAxis??!1))}function ng(t,e){let r=t.axes?.map(n=>n?.guides?.map(a=>a?.above===!0)),i=e.axes?.map(n=>n?.guides?.map(a=>a?.above===!0));return JSON.stringify(r)!==JSON.stringify(i)}function ag(t,e){return vi(t)!==vi(e)}function sg(t,e){return(t.showOutliers??v.boxPlot.boxPlotOutliersVisibility)!==(e.showOutliers??v.boxPlot.boxPlotOutliersVisibility)}function og(t,e){return(t.standardizeValues??v.boxPlot.boxPlotStandardizeValuesVisibility)!==(e.standardizeValues??v.boxPlot.boxPlotStandardizeValuesVisibility)}function lg(t,e){return JSON.stringify(t?.chartRenderer)!==JSON.stringify(e?.chartRenderer)}function ug(t,e){let r=t.axes?.[0].valueFormat.type===S.DateAxisFormat?t.axes[0].valueFormat.intlOptions.timeZone:void 0,i=e.axes?.[0].valueFormat.type===S.DateAxisFormat?e.axes[0].valueFormat.intlOptions.timeZone:void 0;return r!==i}function cg(t,e){let r=!1,i=t.series[0],n=e.series[0];if(i.type===S.ScatterSeries&&n.type===S.ScatterSeries){let{sizePolicy:a}=i,{sizePolicy:s}=n;r=JSON.stringify(a)!==JSON.stringify(s)}return r}function dg(t,e){let r=!1,i=t.series[0],n=e.series[0];if(i.type===S.ScatterSeries&&n.type===S.ScatterSeries){let{sizePolicy:a}=i,{sizePolicy:s}=n;r=a===void 0&&s!==void 0||a!==void 0&&s===void 0||a?.field!==s?.field}return r}function fg(t){let{previousConfig:e,newConfig:r,previousFilterBySelection:i,previousSelectionOIDs:n,fieldList:a,queryObject:s,filterBySelection:o,selectionData:l,setTimeBinningInfoWhenNotProvided:u,chartLimits:c}=t,{series:d}=r,{series:f}=e,m=Z(d),h=!1,g=!1,y=!1,p={common:{layerChanged:!1,queryChanged:!1,xOrYChanged:!1,numberOfSeriesChanged:!1,configFiltersChanged:!1,filterBySelectionChanged:!1,dataForFilterBySelectionChanged:!1,binTemporalDataChanged:!1,timeBinningChanged:!1,newTimeBinningWillBeCalculated:!1,valueFormatChangeRequiresNewData:!1},histogram:{dataPropsChanged:!1},gauge:{valueConversionChanged:!1},boxPlot:{showMeanChanged:!1},heatChart:{binningChanged:!1,hideEmptyRowsAndColumnsChanged:!1,includeLeapDay:!1},scatterPlot:{tooltipFieldsChanged:!1}};switch(p.common.queryChanged=Mc({previousConfig:e,newConfig:r,behaviorAfterLimit:c?.behaviorAfterLimit}),p.common.configFiltersChanged=Ic(e,r),p.common.xOrYChanged=Ec(f,d),p.common.filterBySelectionChanged=Ac(i,o),p.common.dataForFilterBySelectionChanged=jc({previousSelectionOIDs:n,selectionData:l,filterBySelection:o}),p.common.binTemporalDataChanged=Lc(e,r),p.common.valueFormatChangeRequiresNewData=qc(e,r),p.common={...p.common,...Dc({previousSeries:f,newConfig:r,setTimeBinningInfoWhenNotProvided:u,queryObject:s})},m){case S.HistogramSeries:p.histogram.dataPropsChanged=md(f,d)||fd(f,d);break;case S.LineSeries:case S.BarSeries:case S.ComboLineAndBarSeries:p.common.numberOfSeriesChanged=Os(f,d);break;case S.BoxPlotSeries:Fe(e)&&Fe(r)&&(p.common.numberOfSeriesChanged=Os(f,d),p.boxPlot.showMeanChanged=Pc(e,r));break;case S.GaugeSeries:p.gauge.valueConversionChanged=kc(e,r);break;case S.HeatSeries:Tt(e)&&Tt(r)&&(p.heatChart.binningChanged=Vc(e,r),p.heatChart.hideEmptyRowsAndColumnsChanged=$c(e,r),p.heatChart.includeLeapDay=Rc(e,r));break;case S.ScatterSeries:p.scatterPlot.tooltipFieldsChanged=Wc({previousConfig:e,newConfig:r,fieldList:a});break}return g=Object.values(p.common).some(F=>F),(p.gauge.valueConversionChanged||p.histogram.dataPropsChanged||p.boxPlot.showMeanChanged||p.heatChart.binningChanged||p.heatChart.hideEmptyRowsAndColumnsChanged||p.heatChart.includeLeapDay||p.scatterPlot.tooltipFieldsChanged)&&(y=!0),h=g||y,{dataUpdateNeeded:h,dataUpdateDetails:p}}function mg(t,e){let r=tt(t);if(r&&r.series.length>1){let{preferLabel:i,orderBy:n}=r.orderOptions?.series??{};if(n!==void 0){let a;if(i===!1){let s=W(r.series);a=xi(s)?"splitByValue":"name"}else a="name";r.series.sort((s,o)=>{let l,u;a==="splitByValue"?(l=xe({where:s.query?.where})??"",u=xe({where:o.query?.where})??""):(l=s.name,u=o.name);let[c,d]=n.toUpperCase()===be.Descending?[u,l]:[l,u];return typeof c=="string"&&typeof d=="string"?c.localeCompare(d):Number(c)-Number(d)})}}return hc({data:r?.series.map(i=>i.id),htmlContainer:e}),r}function to(t){let e,r=t?.orderOptions?.data;return t.series?.length>0&&r?.orderType===Ue.MultiAxes&&(e=[],e.push({sortingField:j.xField,orderBy:r.orderByX??be.Ascending}),e.push({sortingField:r.orderByY!==void 0?j.yField:"",orderBy:r.orderByY})),e}function Zc(t){let{chartConfig:e,field:r}=t,i,n=to(e);return n?.length===2&&(i=r===j.xField?n[0]?.orderBy:n[1]?.orderBy),i}function _c(t){let e=W(t.series),r;if(t.orderOptions?.data!==void 0){let i=t.orderOptions?.data?.orderType??Ue.Category,n=t.orderOptions?.data&&"orderBy"in t.orderOptions.data?t.orderOptions.data.orderBy:void 0;if(i===Ue.Category)i=t.series[0].x;else{i===Ue.Mean?i=P.Average:i===Ue.Median&&(i=P.Median);let a=e===b.BoxPlotMultiFieldsAndCategory&&typeof t.series[0].y=="string"?t.series[0].y:void 0,s=de(t.series[0].query?.where),o=xe({where:t.series[0].query?.where});i=se({key:i,y:a,chartSubType:e,splitBy:s,splitByValue:o}),Array.isArray(n)&&(n=be.Ascending)}r={sortingField:i,orderBy:n??be.Ascending,preferLabel:t.orderOptions.data&&"preferLabel"in t.orderOptions.data?t.orderOptions.data.preferLabel??!0:!0}}return r}function zc(t){let e=t.series[0],{x:r,y:i}=e,n=W(t.series)===b.PieFromFields,a=W(t.series)===b.BarAndLineFromFields,s,o="",l;if(t.orderOptions?.data!==void 0){let u=t.orderOptions.data&&"preferLabel"in t.orderOptions.data?t.orderOptions.data.preferLabel:!0;if(o=t.orderOptions?.data?.orderType??Ue.Category,l=t.orderOptions?.data&&"orderBy"in t.orderOptions.data?t.orderOptions.data.orderBy:void 0,o===Ue.Category?n?o=ve:o=u?r:yr.originalCategoryValue:o=n?ze:[i].flat()[0],o!==void 0&&o!==""){let c=Ir(t);if(Z(t.series)!==S.PieSeries&&o!==r&&t.series?.length>1)switch(c){case qe.Stacked:o=v.technicalSortingFieldBySum;break;case qe.Stacked100:o=v.technicalSortingFieldByPercent;break;case qe.Side:typeof i=="string"&&(o=i);break}s={sortingField:o,orderBy:l??be.Ascending,preferLabel:u}}}else(a||n)&&t.series[0].query?.outStatistics&&(l=t.series[0].query.outStatistics.map(u=>u.onStatisticField),l?.length>1&&(s={sortingField:yr.originalCategoryValue,orderBy:l,preferLabel:!1}));return s}function ii(t){let e,r=Z(t?.series);if(t?.series&&t.series.length>0){let i;switch(r){case S.HeatSeries:Tt(t)&&(e=to(t));break;case S.BoxPlotSeries:Fe(t)&&(i=_c(t));break;case S.LineSeries:case S.BarSeries:case S.RadarSeries:case S.PieSeries:i=zc(t);break}!e&&i&&(e=[],e.push(i))}return e}function hg(t){let{oldConfig:e,newConfig:r,dataWasUpdated:i}=t,n=Z(r.series),a=W(r.series),s=!1,o=!1;if(a!==b.BoxPlotMonoField&&a!==b.BoxPlotMonoFieldAndSplitBy&&r.orderOptions?.data!==void 0){let l=ii(e),u=ii(r);if(n===S.HeatSeries){let c=l?l[0]:void 0,d=u?u[0]:void 0,f=l?l[1]:void 0,m=u?u[1]:void 0;o=e?.orderOptions?.data?.orderType!==r.orderOptions?.data?.orderType||c?.sortingField!==d?.sortingField||c?.orderBy!==d?.orderBy||f?.sortingField!==m?.sortingField||f?.orderBy!==m?.orderBy,s=o||i}else{let c=l?l[0]:void 0,d=u?u[0]:void 0;o=e?.orderOptions?.data?.orderType!==r.orderOptions?.data?.orderType||c?.sortingField!==d?.sortingField||c?.orderBy!==d?.orderBy||(c?.preferLabel??!0)!==(d?.preferLabel??!0),s=o||i}}return s}function Hc(t){let e;return t?.[0]!==void 0&&(e=t.reduce((r,i)=>({...r,xmin:Math.min(r.xmin,i.xmin),xmax:Math.max(r.xmax,i.xmax),ymin:Math.min(r.ymin,i.ymin),ymax:Math.max(r.ymax,i.ymax)}),t[0])),e}function Bs(t){let{value:e,dataContext:r,specificField:i,keepNullValues:n=!1,useRendererLabel:a=!1,config:s}=t,o=e,{originalCategoryValue:l,originalDateValue:u}=v;if(r!==void 0){let c=a?id(r):void 0;i!==void 0&&r[i]!==void 0?o=r[i]:c!==void 0?o=c:r[v.xAxisDisplayField]!==void 0?o=r[v.xAxisDisplayField]:r[v.xAxisField]!==void 0?o=r[v.xAxisField]:r[v.boxPlot.boxPlotCategory]!==void 0?o=r[v.boxPlot.boxPlotCategory]:r[u]!==void 0?o=r[u]:r[l]!==void 0?o=r[l]:r[ve]!==void 0&&(o=r[ve]),!n&&(o===null||o===v.nullValue)&&(s?.series?.[0].type===S.BarSeries||s?.series?.[0].type===S.LineSeries?o=s.series?.[0]?.nullCategory?.text??v.nullCategory?.text??"null":o="null")}return o}function vn(t){let{value:e,dataContext:r}=t,i=e,{originalCategoryValue:n,originalDateValue:a}=v;return r?.[a]!==void 0?i=r[a]:r?.[n]!==void 0?i=r[n]:r?.[ve]!==void 0&&(i=r[ve]),i}function Uc(t){return t?.[v.originalCategoryValue]}function gr(t){let{arrayToSort:e,orderBy:r,sortingField:i,forceAscendingOrder:n,isNonAggregated:a,sortByCategory:s,preferLabel:o,isPieOrByFieldsChart:l}=t;if(e!==void 0&&e.length>1){let u=r===be.Descending&&n!==!0;e.sort((c,d)=>{let f=0,m=c[i];s===!0&&!l&&(m=Bs({value:`${c[i]?.toString()}`,dataContext:c,specificField:o?v.xAxisField:void 0}));let h=d[i];return s===!0&&!l&&(h=Bs({value:`${d[i]?.toString()}`,dataContext:d,specificField:o?v.xAxisField:void 0})),a===!0&&u&&s===!0&&(m=Number.isNaN(Number.parseFloat(`${m?.toString()}`))?m:Number.parseFloat(m),h=Number.isNaN(Number.parseFloat(`${h?.toString()}`))?h:Number.parseFloat(h)),s===!0&&(c[v.originalCategoryValue]===null||m===null)||c[Mr.defaultGroupOfSlicesId]===!0?f=1:s===!0&&(d[v.originalCategoryValue]===null||h===null)||d[Mr.defaultGroupOfSlicesId]===!0?f=-1:typeof m=="string"&&typeof h=="string"?(f=m.localeCompare(h,void 0,{numeric:!0}),u&&(f*=-1)):m===void 0?f=u?-1:1:h===void 0?f=u?1:-1:m!==null&&h!==null&&(m>h?f=u?-1:1:m<h&&(f=u?1:-1)),f})}}function Gc(t){let{arrayToSort:e,orderBy:r,sortingField:i,fieldList:n,isByFieldsChart:a,preferLabel:s}=t;e!==void 0&&e.length>1&&!he(i)&&r!==void 0&&r.length>0&&e.sort((o,l)=>{let u=o[i];s&&a&&typeof u=="string"&&(u=Ar(n,u));let c=r.indexOf(u?.toString()??"");c===-1&&(c=r.length);let d=l[i];s&&a&&typeof d=="string"&&(d=Ar(n,d));let f=r.indexOf(d?.toString()??"");return f===-1&&(f=r.length),c-f})}function Yc(t,e){let r=t;switch(e){case re.Log:r=`log(${t})`;break;case re.Sqrt:r=`power(CAST(${t} AS FLOAT),0.5)`;break}return r}function Kt(t){let e=new Date(t).valueOf();return Number.isNaN(e)||(e=new Intl.DateTimeFormat("en-US",v.dateFormatUTC).format(t).replace(",","")),e}function ni(t){let{dataToConvert:e,x:r,y:i,fieldList:n}=t,a=[];if(e){let s=e[Ge];Object.entries(e).forEach(([o])=>{if(o!==""&&o!==Ge&&o in e){let l={[r]:Ar(n,o),[i]:e[o],[v.xAxisField]:o,[v.originalCategoryValue]:o};s!==void 0&&(l[Ge]=s),e[`${v.rendererSymbolField}_${o}`]!==void 0&&(l[v.rendererSymbolField]=e[`${v.rendererSymbolField}_${o}`]),a.push(l)}})}return a}function Qc(t,e){let r=!0;if(t!==void 0&&t.length>1&&!he(e)){let i=0,n=0,a=0;t.forEach(s=>{let o=s[e];!jn(o)||o===0?a+=1:o>0?i+=1:n+=1}),r=a===t.length||i>=0&&n===0||i===0&&n>=0}return r}function Xr(t){let{countTotal:e,countPerSeries:r,numberOfSeries:i}=t,n,a=[];return typeof e=="number"&&Number.isFinite(e)&&a.push(e),typeof r=="number"&&Number.isFinite(r)&&a.push(r*i),a.length>0&&(n=Math.min(...a)),n}function ro(t,e){let r,{maxBarChartSeriesCount:i,maxBarUniqueSeriesCountTotal:n,maxBarTwoSeriesCountPerSeries:a,maxBarTwoSeriesCountTotal:s,maxBarThreePlusSeriesCountPerSeries:o,maxBarThreePlusSeriesCountTotal:l,maxLineChartSeriesCount:u,maxLineUniqueSeriesCountTotal:c,maxLineTwoSeriesCountPerSeries:d,maxLineTwoSeriesCountTotal:f,maxLineThreePlusSeriesCountPerSeries:m,maxLineThreePlusSeriesCountTotal:h,maxPieChartSliceCountTotal:g,maxGaugeByFeaturesLimit:y}=bt(e),p=Z(t.series),F=t.series.length===0?1:t.series.length,C=W(t.series);switch(p){case S.ComboLineAndBarSeries:case S.BarSeries:F<=i&&(F===1?r=n:F===2?r=Xr({countTotal:s,countPerSeries:a,numberOfSeries:F}):F>2&&(r=Xr({countTotal:l,countPerSeries:o,numberOfSeries:F})));break;case S.LineSeries:F<=u&&(F===1?r=c:F===2?r=Xr({countTotal:f,countPerSeries:d,numberOfSeries:F}):F>2&&(r=Xr({countTotal:h,countPerSeries:m,numberOfSeries:F})));break;case S.PieSeries:r=g;break;case S.GaugeSeries:r=y;break;case S.ScatterSeries:case S.HistogramSeries:case S.BoxPlotSeries:}return(C===b.BarAndLineNoAggregation||C===b.BarAndLineMultiFields)&&r!==void 0&&(r=Math.ceil(r/F)),r}function Ms(t,e){let r=t;if(Number.isFinite(t)){let{factor:i,offset:n}=e??{};Number.isFinite(i)&&(r*=i),Number.isFinite(n)&&(r+=n)}return r}function Kc(t){let e=!1;if(t!==void 0){let r=t.replace(" ",""),i=/^%(0*100{1,1}\.?((?:\.)0*)?$)|(^%0*\d{0,2}\.?((?:\.)\d*)?)$/u,n=/^(0*100{1,1}\.?((?:\.)0*)?%$)|(^0*\d{0,2}\.?((?:\.)\d*)?%)$/u;e=i.test(r)||n.test(r)}return e}function yg(t){let e;if(Kc(t)){let r=/%(\d{1,3}(.\d+)?)$/u,i=/(\d{1,3}(.\d+)?)%$/u,n=t.replace(" ",""),a=r.exec(n)?.[1]??i.exec(n)?.[1];a!==void 0&&(e=Number(a))}return e}function io(t){let{stringToTruncate:e,characterLimit:r,ellipsis:i=v.chartEllipsis}=t,n=e;return typeof r=="number"&&Number.isFinite(r)&&r>0&&r<e.length&&(n=e.slice(0,r),n=`${n}${i}`),n}function gg(t){let{input:e,charsPerLine:r}=t,i=e;if(r>0&&e.length>r){let n=e.lastIndexOf(" ",r),a=e.lastIndexOf("-",r),s=Math.max(n,a),o=s===a&&a>0,l=s>0?s+(o?1:0):r,u=Math.min(r,l),c=e.slice(0,u).trimEnd(),d=e.slice(u).trimStart();d.length>r&&(d=io({stringToTruncate:d,characterLimit:Math.max(1,r-1)})),i=`${c}
3
+ ${d}`}return i}function pg(t,e=":"){return t?`\u200F${e}`:`\u200E${e}`}function Sg(t){return e=>{let r=typeof e!="string"?e?.toString()??"":e;return!he(r)&&r!==v.htmlEmptyContent&&(r=io({stringToTruncate:r,characterLimit:t})),r}}function Jc(t){let e=/[[]/gu,r=/[\]]/gu,i=/[{]/gu,n=/[}]/gu,a=/[']/gu;return t=t.replace(e,"[["),t=t.replace(r,"]]"),t=t.replace(i,"{{"),t=t.replace(n,"}}"),t=t.replace(a,"''"),t}function Xc(t,e){let r="";return t!==void 0&&(r=`${e==="amChartsV5"?"fontStyle":"font-style"}:${t};`),r}function ed(t,e){let r="";return t===!0&&(r=`${e==="amChartsV5"?"letterSpacing":"letter-spacing"}:1px;`),r}function bg(t){let{textSymbol:e,placeholderString:r,format:i,axisLabelsBehavior:n,defaults:a}=t,s=Xc(e?.font?.style,i),o=ed(e?.kerning,i),l=r??e?.text??"";if(i==="html"){let{wrap:u,maxWidth:c}=a??{};n===Dn.Wrap&&(u=!0,c=c??v.xAxisLabelMaxWidth);let d=u===!0&&Number.isFinite(c)?`max-width: ${c}px; word-break: break-word;`:"";l=`<p style="margin:0;${s}${o}${d}">${l}</p>`}else l=Jc(l),(s!==""||o!=="")&&(l=`[${s}${o}]${l}[/]`);return l}function td(t){return t?t.replace(/[A-Z]/gu,e=>`-${e.toLowerCase()}`):void 0}var vg=[S.BarSeries,S.BoxPlotSeries,S.LineSeries,S.PieSeries,S.HistogramSeries,S.ScatterSeries],Fg=1,xg={PNG:"png"},Gt={ChartRenderer:1,LayerRenderer:2};function Cg(t){let{chartConfig:e,queryObject:r}=t,i=!1;if(e.chartRenderer)i=!0;else{let{series:n}=e,a=Z(n),s=W(n),o=mt(e),l=Xe({seriesConfig:o,queryObject:r}),u=U(r)?.renderer;switch(u?.type){case me.Simple:i=a===S.HistogramSeries||a===S.ScatterSeries||s===b.BarAndLineMonoField||s===b.BoxPlotMonoField||s===b.BoxPlotMultiFields||s===b.BoxPlotMonoFieldAndCategory||s===b.BarAndLineNoAggregation&&n.length===1&&!l;break;case me.UniqueValue:{let c=u?.field,d=de(o.query?.where),{x:f}=o;i=(s===b.BoxPlotMonoFieldAndSplitBy||s===b.BoxPlotMultiFieldsAndSplitBy||s===b.BoxPlotMonoFieldAndCategoryAndSplitBy||s===b.BarAndLineSplitByNoAggregation||s===b.BarAndLineSplitBy)&&c===d||(s===b.BoxPlotMonoFieldAndCategory||s===b.PieFromCategory||s===b.BarAndLineMonoField)&&c===f||s===b.BarAndLineNoAggregation||s===b.PieNoAggregation||a===S.ScatterSeries}break;case me.PieChart:i=s===b.PieFromFields||s===b.BarAndLineFromFields||s===b.BarAndLineMultiFields||s===b.BarAndLineMonoField||s===b.BoxPlotMonoField||s===b.BoxPlotMultiFields||s===b.BoxPlotMonoFieldAndCategory||s===b.BoxPlotMultiFieldsAndCategory;break;case me.ClassBreaks:i=a===S.HeatSeries||a===S.ScatterSeries||s===b.BarAndLineNoAggregation||s===b.PieNoAggregation;break;case me.Dictionary:case me.DotDensity:case me.Heatmap:break}}return i}function rd(t,e){return td(t?.type)??e?.type}function id(t){let e=v.rendererSymbolField,r=e in t?e:void 0;if(!r){let i=t[v.originalCategoryValue];r=Object.keys(t).find(n=>{let a=t[n];return n.includes(e)&&a?.label&&a?.uniqueValue===i}),r||(r=Object.keys(t).find(n=>n.includes(e))??"")}return t[r]?.label}function nd(t){return t?.type!==void 0&&(t.color!==void 0||t.label!==void 0||t.style!==void 0||t.outline!==void 0)}function no(t){let{symbolField:e,dataItem:r,rendererSymbol:i,rendererOrigin:n}=t,a=!1;if(!nd(i))delete r[e];else{let s={...i};s.color!==void 0&&n===Gt.LayerRenderer&&(s.color[3]=pi*255),n===Gt.LayerRenderer&&(delete s.style,delete s.outline,delete s.label),r[e]=s,a=!0}return a}function ad(t){let{renderer:e,seriesConfig:r,chartSubType:i,dataItem:n,rendererOrigin:a}=t,s,o=!1,l=Z(r),{outline:u,attributes:c}=e;return c.forEach(d=>{let{field:f}=d,{color:m,label:h}=d,g;Array.isArray(m)&&m?.length===4?g=m:m&&"toRgba"in m&&(g=m.toRgba());let y=!1,p=!0;switch(l){case S.BarSeries:case S.LineSeries:case S.ComboLineAndBarSeries:case S.RadarSeries:if(i!==b.BarAndLineFromFields){let F=r.find(C=>C.query?.outStatistics?.[0]?.onStatisticField===f);F!==void 0&&"y"in F?f=[F.y].flat()[0]:f=""}y=i!==b.BarAndLineFromFields||f===n[v.originalCategoryValue];break;case S.PieSeries:y=i===b.PieFromFields&&f===n[v.originalCategoryValue];break;case S.BoxPlotSeries:i===b.BoxPlotMonoField||i===b.BoxPlotMonoFieldAndCategory?y=f===r[0].y:f&&(i===b.BoxPlotMultiFields||i===b.BoxPlotMultiFieldsAndCategory)&&(y=r.map(F=>F.y).flat().includes(f)),p=!1;break}y&&g&&(s={type:rt.SMS,color:g,label:p&&h?h:void 0},u!=null&&(s.outline=u),no({dataItem:n,symbolField:i===b.BarAndLineFromFields||i===b.PieFromFields?v.rendererSymbolField:`${v.rendererSymbolField}_${f}`,rendererSymbol:s,rendererOrigin:a})&&(o=!0))}),{rendererSymbol:s,colorMatchApplied:o}}function sd(t){let{seriesConfig:e,chartSubType:r,rendererType:i}=t,n=v.rendererSymbolField;if(i===me.UniqueValue){if(xi(r)){let a=xe({where:e.query?.where,keepSurroundingQuotes:!1,escape:!1});a===null?n=v.nullValue:r===b.BarAndLineSplitBy&&typeof e.y=="string"?n=e.y:r===b.BarAndLineSplitByNoAggregation&&typeof e.y=="string"?n=`${e.y}_${a}`:n=`${a}`}}else if(i===me.PieChart)switch(r){case b.BoxPlotMultiFields:n=Array.isArray(e.y)?e.y.flat():e.y;break;case b.BarAndLineMonoField:case b.BarAndLineMultiFields:case b.BoxPlotMonoField:case b.BoxPlotMonoFieldAndCategory:case b.BoxPlotMultiFieldsAndCategory:n=e.y;break}return n}function ao(t){let{seriesConfig:e,chartSubType:r,rendererType:i,dataItem:n}=t,a=sd({seriesConfig:e,chartSubType:r,rendererType:i});return a instanceof Array&&e.type===S.BoxPlotSeries&&i===me.PieChart&&n!==void 0&&(a=a.find(s=>s===n[ir])??a[0]),a=a!==v.rendererSymbolField?`${v.rendererSymbolField}_${a.toString()}`:a,a}function od(t){let{chartRenderer:e,queryObject:r}=t,i=e!==void 0?{...U(r),renderer:Sn.fromJSON(e)}:U(r);return new Gu({layer:i})}async function ld(t){let{seriesConfig:e,dataItem:r,renderer:i,rendererType:n,rendererOrigin:a,chartSubType:s,splitByField:o,graphicTemplate:l,rendererFieldNames:u,mapAttributesToSymbol:c}=t,d,f=!1;if(n===me.PieChart){let m=ad({renderer:i,seriesConfig:e,chartSubType:s,dataItem:r,rendererOrigin:a});d=m.rendererSymbol,f=m.colorMatchApplied}else if(r?.[Mr.defaultGroupOfSlicesId]!==!0){let{x:m}=e[0],h=new Map;o&&o.trim()!==""?e.forEach(g=>{if(g.type===S.BarSeries||g.type===S.LineSeries||g.type===S.BoxPlotSeries||g.type===S.RadarSeries){let y=ao({seriesConfig:g,chartSubType:s,rendererType:n,dataItem:r}),p=xe({where:g.query?.where,normalize:!0,keepSurroundingQuotes:!1,escape:!1});h.set(y,{...r,[o]:p})}}):e[0].type===S.HeatSeries&&n===me.ClassBreaks?h.set(v.rendererSymbolField,{[j.valueField]:r[j.valueField]}):h.set(Z(e)===S.HistogramSeries?v.rendererSymbolFieldForHistogram:v.rendererSymbolField,{...r,[m]:Uc(r)});try{let g=Array.from(h.entries()),y=l.clone();y.layer=l.layer;let p=i?.uniqueValueInfos;for(let F=0;F<g.length;F+=1){let[C,x]=g[F];if(Is({mode:"encode",x:m,splitByField:o,attributes:x}),u&&u.length>0&&Object.keys(x).forEach(w=>{u.includes(w)||delete x[w]}),y.attributes=x,c?.has(JSON.stringify(x)))d=c.get(JSON.stringify(x));else{if(d=(await er.getDisplayedSymbol(y))?.toJSON(),d!=null){if(d.color===void 0){let N=(await er.getDisplayedColor(y))?.toJSON();N&&(d.color=N.length===4?N:[...N,255])}let w=await er.getLegendLabel(y);w!=null&&w!==""&&(d.label=w,d.uniqueValue=p?.find(N=>N.label===w)?.value??void 0)}c?.set(JSON.stringify(x),d)}Is({mode:"revert",x:m,splitByField:o,attributes:r}),no({dataItem:r,symbolField:C,rendererSymbol:d,rendererOrigin:a})&&(f=!0)}}catch{}}return{rendererSymbol:d,colorMatchApplied:f}}function Is(t){let{splitByField:e,attributes:r,x:i,mode:n}=t;[i,e??""].forEach(a=>{r[a]===(n==="encode"?null:v.nullValue)&&(r[a]=n==="encode"?v.nullValue:null)})}function ud(t){let{dataItem:e,seriesConfig:r,chartSubType:i,colorMatch:n,rendererType:a}=t,s;if(n&&e!==void 0){let o=ao({seriesConfig:r,chartSubType:i,rendererType:a,dataItem:e});s=e[o]}return s}function wg(t){let{seriesSymbol:e,rendererSymbol:r,colorIndex:i}=t,n=r?.color??e.color;n=n??Si({colorIndex:i,opacity:pi});let a={...e,color:n},s=a.type===rt.SFS&&mc(a.style);return r?.type===e.type&&r.style!==void 0&&!s&&(a.style=r.style),a.type!==rt.SLS&&(a.outline={type:rt.SLS,style:r?.outline?.style??a.outline?.style,width:r?.outline?.width??a.outline?.width,color:r?.outline?.color??a.outline?.color??r?.color}),a}function cd(t){let e=[];return t&&(e=t.series.flatMap(r=>r.query?.outStatistics?.map(i=>i.onStatisticField)).filter(r=>r!==void 0),e.length===0&&(e=Se(t.series))),e}function Ng(t,e){let r=!1;if(t&&e&&e.length>0&&bi(t)){let i=hd(t),n=mt(t);i?r=cd(t).some(a=>e.includes(a)):r=e.includes(n.x)}return r}function dd(t){let e=[];if(t&&"type"in t&&typeof t.type=="string")switch(t.type){case"uniqueValue":case"unique-value":"field1"in t&&typeof t.field1=="string"&&(e=[t.field1]);break;case"classBreaks":case"class-breaks":"field"in t&&typeof t.field=="string"&&(e=[t.field]);break;case"pieChart":case"pie-chart":"attributes"in t&&Array.isArray(t.attributes)&&(e=t.attributes.map(r=>r.field));break}return e}function fd(t,e){return t[0].dataTransformationType!==e[0].dataTransformationType}function md(t,e){return t[0].binCount!==e[0].binCount}function Tg(t,e){let r=!0,i=Z(t?.series),n=Z(e?.series);return i&&i!==n&&(r=i===S.ComboLineAndBarSeries&&(n===S.BarSeries||n===S.LineSeries)||n===S.ComboLineAndBarSeries&&(i===S.BarSeries||i===S.LineSeries)||i===S.BarSeries&&n===S.LineSeries||i===S.LineSeries&&n===S.BarSeries),r}function cn(t,e){return t!==void 0&&e!==void 0&&e>0}function Og(t){let{chartConfig:e,queryObject:r,chartData:i}=t,n=[],a=W(e.series),s=bi(e),o=U(r),l=e.chartRenderer??o?.renderer?.toJSON();return n=e.series.map((u,c)=>{let d=Z([u]),f;return(d===S.BarSeries||d===S.LineSeries||d===S.RadarSeries)&&(u.type===S.BarSeries?f=u.fillSymbol?.color:(u.type===S.RadarSeries||u.type===S.LineSeries)&&(f=u.lineSymbol?.color),s?f=ud({dataItem:i[0],seriesConfig:u,chartSubType:a,colorMatch:s,rendererType:l?.type})?.color:f===void 0&&(f=Si({colorIndex:c}))),f}).filter(u=>u!==void 0),n}function dn(t){return t!==b.PieNoAggregation&&t!==b.BarAndLineNoAggregation&&t!==b.BarAndLineSplitByNoAggregation}function hd(t){let e=W(t.series);return e===b.BarAndLineFromFields||e===b.PieFromFields||e===b.BoxPlotMonoField||e===b.BoxPlotMultiFields||e===b.BoxPlotMonoFieldAndSplitBy||e===b.BoxPlotMultiFieldsAndSplitBy}function Jt(t){return Fe(t)?t?.showMean??!1:!1}function yd(t){return Fe(t)?t?.showOutliers:void 0}function Bg(){return`{name} {${v.originalCategoryValue}} {dateY} {valueX} {dateX} {valueY}`}function gd(t,e){let r=z.now().offset/60,i=z.now().setZone(t)??r,n=i.offset/60,a=e?i.setZone(e).offset/60:0;return n-a}function so(t){let{outTimeZone:e=Intl.DateTimeFormat().resolvedOptions().timeZone,dataTimeZone:r="UTC",runsOnClientQueryEngine:i}=t,n="",a=gd(e,r);if(a!==0)if(i)n=`${a>0?"+":"-"}1*INTERVAL '${Math.abs(a)}' HOUR `;else{let s=Math.abs(a%1),o=Math.round(s*60);a=Math.floor(a),n=a>0?`+INTERVAL '${Math.abs(a)}:${o!==0?o:"00"}:01' HOUR TO SECOND`:`-INTERVAL '${Math.abs(a)-(o!==0?0:1)}:${o!==0?String(o-1):"59"}:59' HOUR TO SECOND`}return n}function pd(t){let{dateFieldName:e,unit:r,runsOnClientQueryEngine:i,outTimeZone:n}=t,a=so({runsOnClientQueryEngine:i,outTimeZone:n}),s=`EXTRACT(YEAR FROM ${e} ${a})`,o=`EXTRACT(MONTH FROM ${e} ${a})`,l=`EXTRACT(DAY FROM ${e} ${a})`,u=`EXTRACT(HOUR FROM ${e} ${a})`,c=`EXTRACT(MINUTE FROM ${e} ${a})`,d=`EXTRACT(SECOND FROM ${e} ${a})`,f=[];switch(r){case $.Second:f=[s,o,l,u,c,d];break;case $.Minute:f=[s,o,l,u,c];break;case $.Hour:f=[s,o,l,u];break;case $.Day:case $.Week:case $.Month:case $.Year:f=[s,o,l];break}return f}function Sd(t){let{whereValue:e,outStatistics:r,y:i}=t,n=G.outStatistics.outStatisticFieldName??"";return r?.outStatisticFieldName!==void 0?n=r.outStatisticFieldName:r?.onStatisticField!==void 0&&r.statisticType!==void 0?n=`${r.statisticType}_${r.onStatisticField}_${e}`:i!==void 0&&(n=[i].flat()[0]),n}function bd(t){let e=new Map;for(let r=0;r<t.length;r+=1){let i=t[r],n=i.query?.where;if(n!==void 0&&"y"in i){let a=xe({where:n,normalize:!0,escape:!1});if(a!==""){let s=Sd({whereValue:a,outStatistics:i.query?.outStatistics?.[0],y:i.y});i.y=s,e.set(a,s)}}}return e}function vd(t){let{uniqueQuery:e,splitByField:r,x:i}=t,n=[...e.groupByFieldsForStatistics??[],i,r].filter(a=>a!==void 0&&a.trim()!==""&&a!==ir);e.groupByFieldsForStatistics=Array.from(new Set(n))}function Fn(t){return t.statisticType===A.ContinuousPercentile||t.statisticType===A.DiscretePercentile}function Fd(t){let{uniqueQuery:e,y:r,useGenericOutStatFieldName:i,queryObject:n,chartSubType:a,isTimeBinningSeries:s,returnFeaturesExtent:o,splitByField:l}=t,u=G.outStatistics;if(e.outStatistics?.[0]!==void 0){a!==b.PieFromFields&&a!==b.BarAndLineFromFields&&(e.outStatistics[0].outStatisticFieldName=i?u.outStatisticFieldName:[r].flat()[0]);let{outStatistics:c}=e;for(let d=0;d<c.length;d+=1){let f=c[d];f!==void 0&&Fn(f)&&(s&&!Qt(l,n)?(c[d].statisticType=A.Count,delete c[d].statisticParameters):c[d]={...c[d],statisticParameters:c[d].statisticParameters??{value:G.defaultStatParameterValue}})}}else{let c=U(n),{idField:d,isTraditionalTypeOID:f}=We(c),m=f?d:"*";e.outStatistics=[{statisticType:u.statisticType,onStatisticField:m,outStatisticFieldName:i?u.outStatisticFieldName:[r].flat()[0]}]}o===!0&&(!s||he(l))&&e.outStatistics?.push({statisticType:A.EnvelopeAggregate,onStatisticField:"1"})}function xd(t){let{chartConfig:e,fetchFullBoxPlotData:r}=t,{series:i}=e,n=Jt(e),a=[{statisticType:A.Average,suffix:P.Average}];r===!0&&(a=[...a,{statisticType:A.Minimum,suffix:P.Min},{statisticType:A.ContinuousPercentile,statisticParameters:{value:.25},suffix:P.FirstQuartile},{statisticType:A.ContinuousPercentile,statisticParameters:{value:.5},suffix:P.Median},{statisticType:A.ContinuousPercentile,statisticParameters:{value:.75},suffix:P.ThirdQuartile},{statisticType:A.Maximum,suffix:P.Max},{statisticType:A.StandardDeviation,suffix:P.StandardDeviation}]);let s=new Set;return n&&"y"in i[0]?[i[0].y].flat().forEach(o=>s.add(o)):i.forEach(o=>{"y"in o&&[o.y].flat().forEach(l=>s.add(l))}),[...s].flatMap(o=>a.map(l=>{let u={onStatisticField:o,statisticType:l.statisticType,outStatisticFieldName:`${o}_${l.suffix}`};return l.statisticType===A.ContinuousPercentile&&(u.statisticParameters=l.statisticParameters),u}))}function Cd(t,e){for(let r=1;r<e.length;r+=1){let i={...e[r].query?.outStatistics?.[0]};i!==void 0&&t.outStatistics!==void 0&&t.outStatistics.push(i)}}function wd(t){let{uniqueQuery:e,x:r,splitByField:i,unit:n,chartSubType:a,objectIdFields:s,runsOnClientQueryEngine:o}=t;if(n!==void 0){let l=pd({dateFieldName:r,unit:n,runsOnClientQueryEngine:o});e.orderByFields=l,e.groupByFieldsForStatistics=l,a===b.BarAndLineSplitBy&&!he(i)?e.groupByFieldsForStatistics.push(i):a===b.BarAndLineNoAggregation&&(e.groupByFieldsForStatistics=s,e.outStatistics=[{onStatisticField:s.length>1?"*":s[0],outStatisticFieldName:`COUNT_${s[0]}`,statisticType:A.Count}])}}function oo(t){let{chartConfig:e,uniqueQuery:r,chartLimits:i}=t;if(i?.behaviorAfterLimit===St.RenderUpToTheLimit){let n=ro(e,i);if(n!==void 0){let a=W(e.series);if(a===b.PieFromFields||a===b.BarAndLineFromFields){if(r.outStatistics?.[0]!==void 0){let s=(u,c)=>u.statisticType===A.EnvelopeAggregate===c,o=r.outStatistics.filter(u=>s(u,!0)),l=r.outStatistics.filter(u=>s(u,!1));l.splice(n),r.outStatistics=[...l,...o]}}else r.num=n}}}function xn(t){let{chartConfig:e,queryConfig:r,queryObject:i,timeIntervalInfo:n,setTimeBinningInfoWhenNotProvided:a,fetchFullBoxPlotData:s,returnFeaturesExtent:o,chartLimits:l}=t,u=e.series,c=W(u),d=mt(e),{query:f,x:m}=d,h="y"in d?d.y:void 0,g=Xe({xAxisValueFormatType:$e(e),setTimeBinningInfoWhenNotProvided:a,seriesConfig:d,queryObject:i}),y=new Map,p=!1,F=!1,C=!1,x=!1,w=!1,N={};if(f!==void 0){N=tt(f);let E=de(f.where),D="";switch(r.fetchNullValues!==!0&&(m!==v.boxPlot.boxPlotCategory&&(D=`${m} IS NOT NULL`),E.trim()!==""&&E!==m&&!ut(f.where)&&(D=ee([D,`${E} IS NOT NULL`]))),c){case b.BarAndLineSplitBy:{y=bd(u),x=!0,p=!0,F=!0;break}case b.BarAndLineMultiFields:Cd(N,u),F=!0;break;case b.PieFromFields:case b.BarAndLineFromFields:D="",C=!0,F=!0;break;case b.BarAndLineMonoField:case b.PieFromCategory:F=!0;break;case b.BoxPlotMonoField:case b.BoxPlotMultiFields:C=!0,w=!0;break;case b.BoxPlotMonoFieldAndCategory:case b.BoxPlotMultiFieldsAndCategory:case b.BoxPlotMonoFieldAndSplitBy:case b.BoxPlotMonoFieldAndCategoryAndSplitBy:case b.BoxPlotMultiFieldsAndSplitBy:{w=!0,x=!0,C=!0;break}case b.PieNoAggregation:case b.BarAndLineNoAggregation:case b.BarAndLineSplitByNoAggregation:}if(F&&Fd({uniqueQuery:N,y:h,useGenericOutStatFieldName:p,queryObject:i,chartSubType:c,isTimeBinningSeries:g,returnFeaturesExtent:o,splitByField:E}),x&&vd({uniqueQuery:N,splitByField:E,x:m}),Fe(e)&&w&&(N.outStatistics=xd({chartConfig:e,fetchFullBoxPlotData:s})),C?delete N.orderByFields:r.orderByFields!==void 0&&(N.orderByFields=r.orderByFields.filter(Y=>{let J=Y.split(" ");return!he(J[0])})),g&&Ve(u[0])){let Y=U(i),{idFields:J}=li(Y);Re(i).find(R=>R.name===m)?.type!==Q.DateOnly&&J&&wd({uniqueQuery:N,x:m,splitByField:de(f.where),unit:n?.unit??u[0].temporalBinning?.unit,chartSubType:c,objectIdFields:J,runsOnClientQueryEngine:ct(i)})}N.where=D}oo({chartConfig:e,uniqueQuery:N,chartLimits:l});let{gdbVersion:O,geometry:T,distance:B,units:M,timeExtent:q,where:I,objectIds:k,spatialRelationship:_}=r;return O!==void 0&&(N.gdbVersion=O),T!==void 0&&(N.geometry=T),B!==void 0&&(N.distance=B),M!==void 0&&(N.units=M),q!==void 0&&(N.timeExtent=q),k!==void 0&&(N.objectIds=k),_!==void 0&&(N.spatialRelationship=_),I!==void 0&&(N.where=ee([N.where,I])),{uniqueQuery:N,mapToStatField:y}}var pe={Default:"defaultError",LayerLoadFailure:"layerLoadFailure",QueryFeaturesError:"queryFeaturesError",ChartDisposed:"ChartDisposeError",LayerFieldsNotFound:"layerFieldsNotFound",LayerNotSupported:"layerNotSupported"},Ot=new Map,Mg={NonNumericAggregation:"nonNumericAggregation",DuplicateSeriesID:"duplicateSeriesId"},Ig={Required:"required",MinLength:"minLength",MinItems:"minItems",MaxItems:"maxItems",Pattern:"pattern",AdditionalProperties:"additionalProperties",Enum:"enum",AnyOf:"anyOf"},H={BadData:"badData",EmptyDataSet:"emptyDataSet",InvalidConfig:"invalidConfig",HistogramEmptyField:"histogramEmptyField",BarElementExceedsLimit:"barElementExceedsLimit",LineChartExceedsLimit:"lineChartExceedsLimit",BoxPlotExceedsLimit:"boxPlotExceedsLimit",BoxPlotOutliersExceedsLimit:"boxPlotOutliersExceedsLimit",HeatChartExceedsLimit:"heatChartExceedsLimit",PieChartExceedsLimit:"pieChartExceedsLimit",GaugeExceedsLimit:"gaugeExceedsLimit",PieChartMixOfNegativePositiveSlices:"PieChartMixOfNegativePositiveSlices",NegativeValueInSqrtCalculation:"negativeValueInSqrtCalculation",NegativeValueInLogCalculation:"negativeValueInLogCalculation",NegativeValueInXAxisLogScale:"negativeValueInXAxisLogScale",NegativeValueInYAxisLogScale:"negativeValueInYAxisLogScale"},Nd=2048;function Td(t){let e;switch(t){case re.Log:e="log";break;case re.Sqrt:e="sqrt";break;case re.None:default:e=void 0;break}return e}async function Od(t){let{queryConfig:e,chartConfig:r,queryObject:i,abortKey:n,abortSignal:a,view:s}=t,o=r.series[0],{x:l,dataTransformationType:u,binCount:c}=o,d=U(i);if(!oe(d))throw new ce(pe.LayerNotSupported);d.loaded||await d.load({signal:a});let f=await Fr(d,a);if(!f)throw new Error("Raster info is not available for the layer.");let m=tr(e.geometry)??d.fullExtent,h=f.bandCount===1?0:f.bandInfos.findIndex(p=>p.name===l),g,y;if(s===void 0&&(u===void 0||u===re.None)&&c&&Array.isArray(f.histograms)&&f.histograms.length>h&&f.histograms[h].size%c===0&&Array.isArray(f.statistics)&&f?.statistics?.length>h)g=f.histograms[h],y=f.statistics[h];else{let p,F,C;if(s)p=s.resolution,F=s.resolution,C=s.spatialReference;else{let O=Nd,T=2,B=f.width,M=f.height,q=Math.max(0,Math.ceil(Math.log(Math.max(B,M)/O)/Math.log(T))),I=T**q;p=f.pixelSize.x*I,F=f.pixelSize.y*I,C=d.spatialReference}let x=new Qs({x:p,y:F,spatialReference:C}),w=Td(u),N=await Ku(d,{bandIds:[h],geometry:m,histogramSize:c??void 0,pixelSize:x,transformType:w},{signal:a??(n!==void 0?Ot.get(n)?.signal:void 0)});y=N.statistics[0],g=N.histograms[0]}return{histogram:g,statistics:y}}function Bd(t,e){let r=[],i=(t.max-t.min)/t.size;for(let n=0;n<t.size;n++){let a=t.min+n*i;r.push({minValue:a,maxValue:a+i,count:t.counts[n]})}if(e&&t.size!==e&&t.size%e===0){let n=t.size/e,a=[];for(let s=0;s<e;s++){let o=r[s*n].minValue,l=r[(s+1)*n-1].maxValue,u=0;for(let c=0;c<n;c++)u+=r[s*n+c].count;a.push({minValue:o,maxValue:l,count:u})}return a}return r}async function Md(t){let{chartConfig:e,queryConfig:r,queryObject:i,abortKey:n,abortSignal:a,view:s}=t;if(i===void 0)throw new Error("QueryObject is undefined!");let o,{statistics:l,histogram:u}=await Od({queryObject:i,chartConfig:e,queryConfig:r,view:s,abortKey:n,abortSignal:a});if(l&&u){let c=e.series[0].binCount??void 0,d=Bd(u,c);d.length>0?o={valid:!0,count:d.length,data:{bins:d,min:l.min,max:l.max,mean:l.avg,median:l.median,stddev:l.stddev,sum:l.sum??l.avg*l.count,count:l.count}}:o={valid:!1,invalidType:H.EmptyDataSet}}else o={valid:!1,invalidType:H.BadData};return o}var Id=t=>t.series[0].x;function Ed(t){let{chartConfig:e,layer:r,selectionDataItems:i}=t,n=fn(r,Id(e)),a=i.map(l=>[l.minValue,l.maxValue]).reduce((l,u,c)=>{if(c===0)l.push([...u]);else{let d=l[l.length-1];d[1]===u[0]?d[1]=u[1]:l.push([...u])}return l},[]),s=e.series[0],{dataTransformationType:o}=s;switch(o){case re.Log:a.forEach(l=>{l[0]=Math.exp(l[0]),l[1]=Math.exp(l[1])});break;case re.Sqrt:a.forEach(l=>{l[0]=l[0]*l[0],l[1]=l[1]*l[1]});break;case re.None:}return a.length>0?{bandId:n,pixelRanges:a}:void 0}function pr(t,e){let r,i,n=e??(a=>a);for(let a of t){let s=n(a);s==null||Number.isNaN(s)||((r===void 0||s<r)&&(r=s),(i===void 0||s>i)&&(i=s))}return{min:r,max:i}}function Ad(t,e){let r=0,i=0,n=e??(a=>a);for(let a of t){let s=n(a);s==null||Number.isNaN(s)||(r++,i+=s)}return r>0?i/r:void 0}function Ld(t,e){let r=0,i=e??(n=>n);for(let n of t){let a=i(n);a==null||Number.isNaN(a)||(r+=a)}return r}function Eg(t,e,r=1){let i=Math.max(0,Math.ceil((e-t)/r)),n=new Array(i);for(let a=0;a<i;a++)n[a]=t+a*r;return n}var qd={dataFormat:"json",outputFormat:"json",typeKey:"analyticType",typeValue:"LinRegR2",fieldValue:"onAnalyticField",slopePropertyList:["Slope","SLOPE","slope"],interceptPropertyList:["Intercept","INTERCEPT","intercept"],r2PropertyList:["R2","r2"]};function Dd(t){let e;switch(t){case"feet":e="esriSRUnit_Foot";break;case"miles":e="esriSRUnit_StatuteMile";break;case"nautical-miles":e="esriSRUnit_NauticalMile";break;case"us-nautical-miles":e="esriSRUnit_USNauticalMile";break;case"meters":e="esriSRUnit_Meter";break;case"kilometers":e="esriSRUnit_Kilometer";break}return e}async function Pd(t){let{queryObject:e,queryConfig:r,outputFormat:i,dataFormat:n,outAnalytics:a,errorStrings:s,abortSignal:o}=t,{where:l,geometry:u,distance:c,units:d,timeExtent:f}=r,m,h=U(e),g=Be(h);if(g){let y={where:ee([l,g.definitionExpression])},p={query:y,signal:o},F=tr(u)?.extent?.toJSON();if(F!==void 0){let x=Dd(d),{xmin:w,ymin:N,xmax:O,ymax:T}=F;y.geometryType="esriGeometryEnvelope",y.geometry=`${w},${N},${O},${T}`,c!==void 0&&(y.distance=c.toString()),x!==void 0&&(y.units=x,u?.spatialReference?.wkid!=null&&(y.inSR=u.spatialReference.wkid.toString()))}f&&(y.time=`${f[0]},${f[1]}`);let C=`${g.url}/${g.layerId}/queryAnalytic?f=${i}&dataFormat=${n}&outAnalytics=${a}`;try{m=(await ti(C,p)).data?.features?.[0]?.attributes}catch(x){let w=s??(await qt(et(document.documentElement).t9nLocale,Lt("./assets/common/t9n"),"messages.")).errorStrings;throw new ce(pe.QueryFeaturesError,w.errors.queryError,x)}}return m}function lo(t,e){return{lowerBoundaryAlias:`charts_lower_boundary_${t}`,upperBoundaryAlias:`charts_upper_boundary_${t}`,stackAlias:`charts_stack_alias_${e}`}}async function kd(t){let{chartConfig:e,queryObject:r,queryConfig:i,view:n,syncViewTimeZone:a,errorStrings:s,abortSignal:o}=t,l,u=U(r),c=gc(u);if(c&&r&&"queryAttributeBins"in r){let{x:d,y:f,xTemporalBinning:m,yTemporalBinning:h}=e.series[0],{outTimeZone:g,firstDayOfWeek:y,includeLeapDay:p}=e,F=Af({queryObject:r,queryConfig:i,x:d,y:f,xTemporalBinning:m,yTemporalBinning:h,configTimeZone:g,firstDayOfWeek:y,includeLeapDay:p,view:n,syncViewTimeZone:a});try{l=await r.queryAttributeBins(F,{signal:o})}catch(C){throw new ce(pe.QueryFeaturesError,s.errors.queryError,C)}}if(!c)throw new ce(pe.QueryFeaturesError,s.errors.queryBinsNotSupported,s.errors.queryBinsNotSupported);return l}async function Vd(t){let{chartConfig:e,queryObject:r,queryConfig:i,returnFeaturesExtent:n,errorStrings:a,abortKey:s,abortSignal:o}=t,l=e.series[0],u,{x:c,y:d}=l;i.groupByFieldsForStatistics=[c],c!==d&&i.groupByFieldsForStatistics.push(d),i&&n===!0&&!i.outStatistics?.some(f=>f.statisticType===A.EnvelopeAggregate)&&i.outStatistics?.push({statisticType:A.EnvelopeAggregate,onStatisticField:"1"});try{u=await Le({queryObject:r,queryConfig:i,errorStrings:a,abortKey:s,abortSignal:o})}catch(f){throw new ce(pe.QueryFeaturesError,a.errors.queryError,f)}return u}async function $d(t){let{queryObject:e,queryConfig:r,xStep:i,xMin:n,xMax:a,x:s,y:o,yStep:l,errorStrings:u,abortSignal:c}=t,d;if(e&&"queryAttributeBins"in e&&Number.isFinite(i)&&Number.isFinite(l)&&Number.isFinite(n)&&Number.isFinite(a)&&i>0&&l>0){let f=Lf({queryObject:e,queryConfig:r,xStep:i,xMin:n,xMax:a,x:s,y:o,yStep:l});try{d=await e.queryAttributeBins(f,{signal:c})}catch(m){throw new ce(pe.QueryFeaturesError,u.errors.queryError,m)}}return d}async function Rd(t){let{queryConfig:e,x:r,queryObject:i,chartSubType:n,isGaugeByFeature:a,abortSignal:s}=t,o,l=U(i),{idField:u,isTraditionalTypeOID:c}=We(l),d=wn({queryObject:i,queryConfig:e});d.outFields=a||n===b.PieNoAggregation||n===b.BarAndLineNoAggregation||n===b.BarAndLineSplitByNoAggregation?[c?u:"*"]:[r],d.outFields?.[0]===r&&(d.returnDistinctValues=!0);try{o=await i.queryFeatureCount(d,{signal:s})}catch{o=Number.NaN}return o}async function vr(t){let{queryObject:e,queryConfig:r,abortKey:i,errorStrings:n,abortSignal:a}=t,{outStatistics:s}=r,o=new Map;if(s!==void 0&&s.length>0){let l=s.map(f=>{let{statisticType:m,onStatisticField:h,outStatisticFieldName:g}=f;return{statisticType:m,onStatisticField:h,outStatisticFieldName:g?.toUpperCase()}});r.outStatistics=l,delete r.num,delete r.orderByFields;let u=wn({queryObject:e,queryConfig:r}),c;try{c=await e.queryFeatures(u,{signal:a??(i!==void 0?Ot.get(i)?.signal:void 0)})}catch(f){if(!bn.isAbortError(f)){let m=n??(await qt(et(document.documentElement).t9nLocale,Lt("./assets/common/t9n"),"messages.")).errorStrings;throw new ce(pe.QueryFeaturesError,m.errors.queryError,f)}}let d=c?.features?.[0]?.attributes;d!==void 0&&s.forEach(f=>{let{outStatisticFieldName:m}=f;if(m!==void 0){let h=d[m.toLowerCase()]??d[m.toUpperCase()]??d[m];h!==void 0&&o.set(m,h)}})}return o}async function uo(t){let{queryObject:e,queryConfig:r,returnUniqueIdsOnly:i,abortKey:n,errorStrings:a,abortSignal:s}=t,o=[],l=U(e),u=s||(n!==void 0?Ot.get(n)?.signal:void 0),c=qf(l),d=wn({queryObject:e,queryConfig:r,maxRecordCountFactor:c});try{if(i===!0)if("queryObjectIds"in e)o=await e.queryObjectIds(d,{signal:u});else{let{idField:f,isTraditionalTypeOID:m}=We(l),h=m?f:"*";d.outFields=[h],o=(await e.queryFeatures(d,{signal:u})).features.map(g=>g.getObjectId())}else o=(await e.queryFeatures(d,{signal:u})).features}catch(f){if(!bn.isAbortError(f)){let m=a??(await qt(et(document.documentElement).t9nLocale,Lt("./assets/common/t9n"),"messages.")).errorStrings;throw new ce(pe.QueryFeaturesError,m.errors.queryError,f)}}return o}async function Wd(t){let e=[],{featureCount:r,maxRecords:i,queryConfig:n,abortSignal:a}=t,s=[],o=0,l=n?.start??0;for(;o<G.maxParallelRequests&&l<r;){let u={...t};u.queryConfig={...n,start:l,num:Math.min(i,r-l)},e.push(uo({...u,abortSignal:a})),l+=i,o+=1}return s=(await Promise.all(e)).flat(),s}async function Le(t){let{queryObject:e,queryConfig:r,returnUniqueIdsOnly:i,featureCount:n,noBatch:a,errorStrings:s,abortKey:o,abortSignal:l}=t,u=[],c=U(e),d=n??1,f=Fo(c);if(a!==!0&&d>f&&c?.capabilities?.query.supportsPagination){let m=0,h=0,g=Math.ceil(d/f),y=Math.ceil(g/G.maxParallelRequests),p=[];for(;h<y;){m=h*G.maxParallelRequests*f;let F=Wd({queryConfig:{...r,start:m},queryObject:e,maxRecords:f,featureCount:d,returnUniqueIdsOnly:i,errorStrings:s,abortKey:o,abortSignal:l});p.push(F),h+=1}u=(await Promise.all(p)).flat()}else(Number.isNaN(d)||d>=0)&&(u=await uo({queryObject:e,queryConfig:r,returnUniqueIdsOnly:i,errorStrings:s,abortKey:o,abortSignal:l}));return u}async function Ag(t){let{queryObject:e,queryConfig:r,uniqueFeature:i,errorStrings:n,abortKey:a}=t,s={...r,returnDistinctValues:!0};return await Le({queryObject:e,abortKey:a,queryConfig:s,returnUniqueIdsOnly:!0,featureCount:i===!0?1:void 0,errorStrings:n})}function jd(t){if(t!==void 0){let e=Ot.get(t);e!==void 0&&e.abort(),Ot.set(t,new AbortController)}}function co(t){return{lowerBoundaryAlias:`charts_lower_boundary_${t}`,upperBoundaryAlias:`charts_upper_boundary_${t}`}}async function Zd(t){let{queryObject:e,dateField:r,splitByField:i,queryConfig:n,temporalBinning:a,axisTimeZone:s,errorStrings:o,view:l,syncViewTimeZone:u,abortSignal:c}=t,d=[],f;if(a){let{unit:m}=a;try{if(m&&(f=Qt(i,e),f&&e&&"queryAttributeBins"in e)){let h=If({queryObject:e,queryConfig:n,temporalBinning:a,dateField:r,axisTimeZone:s,splitByField:i,view:l,syncViewTimeZone:u});d=(await e.queryAttributeBins(h,{signal:c})).features}}catch(h){let g=o??(await qt(et(document.documentElement).t9nLocale,Lt("./assets/common/t9n"),"messages.")).errorStrings;throw new ce(pe.QueryFeaturesError,g.errors.queryError,h)}}if(f===!1){let m=o??(await qt(et(document.documentElement).t9nLocale,Lt("./assets/common/t9n"),"messages.")).errorStrings;throw new ce(pe.QueryFeaturesError,m.errors.queryBinsNotSupported,m.errors.queryBinsNotSupported)}return d}async function _d(t){let{queryObject:e,abortSignal:r}=t,i=!1;if(!oe(e)){let n=yc(e),a=U(e),s=Be(a);if(n&&s?.url!==void 0&&s.url!==null){let o=`${s.url}/${s.layerId}?f=json`;try{let l=(await ti(o,{signal:r})).data,u=l?.advancedQueryCapabilities?.supportsQueryAnalytic===!0,c=l?.sqlParserVersion===void 0||s.version!=null&&s.version>=10.91;i=u&&c}catch{}}}return i}function zd(t){let{x:e,y:r,trendlineXToY:i,data:n}=t,{min:a,max:s}=n?pr(n,o=>o[e]):{min:Number.NaN,max:Number.NaN};return[{[e]:a??Number.NaN,[r]:i(a??Number.NaN)},{[e]:s??Number.NaN,[r]:i(s??Number.NaN)}]}function Hd(t){let{data:e,x:r,y:i}=t,n=[];return e!==void 0&&(n=e.filter(a=>Number.isFinite(a[r])&&Number.isFinite(a[i])).map(a=>[a[r],a[i]])),n}async function Ud(t){let{statsMap:e,queryObject:r,chartConfig:i,queryConfig:n,errorStrings:a,abortSignal:s}=t,o=i.series[0],{x:l,y:u}=o;Dt(r);let c=Number.NaN,d=[{[l]:Number.NaN,[u]:Number.NaN},{[l]:Number.NaN,[u]:Number.NaN}],{dataFormat:f,outputFormat:m,typeKey:h,typeValue:g,fieldValue:y,slopePropertyList:p,interceptPropertyList:F,r2PropertyList:C}=qd,x=`[{"${h}": "${g}", "${y}":"${l},${u}"}]`,w=await Pd({queryObject:r,queryConfig:n,outputFormat:m,dataFormat:f,outAnalytics:x,errorStrings:a,abortSignal:s});if(w!==void 0){let N=Number.NaN,O=Number.NaN,{expr:T}=Lr(w,p),{expr:B}=Lr(w,F),{expr:M}=Lr(w,C);T!==void 0&&Number.isFinite(w[T])&&(N=w[T]),B!==void 0&&Number.isFinite(w[B])&&(O=w[B]),M!==void 0&&Number.isFinite(w[M])&&(c=w[M]);let{dataContextXMinField:q,dataContextXMaxField:I,dataContextYMinField:k,dataContextYMaxField:_}=v.scatterplotAggregationFields,E=e.get(q)??Number.NaN,D=e.get(I)??Number.NaN,Y=e.get(k)??Number.NaN,J=e.get(_)??Number.NaN,R=(D-E)/100,ie=E-R,fe=Number.NaN;for(;!(fe>=Y&&fe<=J)&&ie<=D;)ie+=R,fe=N*ie+O;let ge=D+R,He=Number.NaN;for(;!(He>=Y&&He<=J)&&ge>=E;)ge-=R,He=N*ge+O;d=[{[l]:ie,[u]:fe},{[l]:ge,[u]:He}]}return{r2:c,trendLinePoints:d}}function fo(t){let{data:e,chartConfig:r}=t,i=r.series[0],{x:n,y:a}=i,{r2:s,trendLinePoints:o}=v.scatterplotSeries,l=Hd({data:e,x:n,y:a});if(l!==void 0){let u=vs(l),c=Fs(u);s=u.m===0?0:xs(l,c),o=zd({x:n,y:a,trendlineXToY:c,data:e})}return{r2:s,trendLinePoints:o}}async function mo(t){let e=await _d(t),{chartConfig:r}=t,i=r.series[0],{x:n,y:a}=i,{r2:s}=v.scatterplotSeries,o=[{[n]:Number.NaN,[a]:Number.NaN},{[n]:Number.NaN,[a]:Number.NaN}],l={r2:s,trendLinePoints:o},u=!1;if(e)try{l=await Ud(t)}catch{u=!0}return(!e||u)&&(l=fo(t)),l}var Gd=50,Yd=4194304;async function Qd(t){let{layer:e,chartConfig:r,rawData:i}=t,n,a=r.series[0],{x:s,y:o}=a,{idField:l}=We(e),u=await Fr(e);if(u){let c=u.bandInfos,d=c.length===1,f=d?c?.[0].name:"";n=i.map(m=>({...d&&{[s]:m.attributes?.[f],[o]:m.attributes?.[f]},...m.attributes,[G.uniqueIdsName]:m.attributes?.[l]}))}return n??[]}async function Kd(t){let{queryObject:e,queryConfig:r,abortKey:i}=t;if(!e||!oe(e))throw new ce(pe.LayerNotSupported);return await yf({queryObject:e,queryConfig:r,imagerySkipFactor:Gd,imageryMaxPixelCount:Yd,abortKey:i})}async function Jd(t){let{chartConfig:e,queryConfig:r,queryObject:i,sortData:n,calculateTrendLine:a,errorStrings:s,abortKey:o}=t;if(!i)throw new Error("QueryObject is undefined!");let l=await Kd({queryObject:i,queryConfig:r,abortKey:o}),u=await Qd({layer:i,chartConfig:e,rawData:l});n!==!1&&gr({arrayToSort:u,sortingField:e.series[0].x,orderBy:be.Ascending});let c=new Map,{r2:d,trendLinePoints:f}=a!==!1?await mo({data:u,statsMap:c,queryConfig:r,queryObject:i,chartConfig:e,errorStrings:s}):v.scatterplotSeries;return{dataItems:u,r2:d,trendLinePoints:f}}var Xd=t=>({x:t.series[0].x,y:t.series[0].y});function ef(t){let{chartConfig:e,layer:r,selectionDataItems:i}=t,n;if(i.length>0){let{x:a,y:s}=Xd(e),o=fn(r,a),l=fn(r,s);if(o!==void 0&&l!==void 0&&o!==l){let u=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER,d=Number.MAX_SAFE_INTEGER,f=Number.MIN_SAFE_INTEGER;i.forEach(m=>{let h=m[a],g=m[s];typeof h=="number"&&(h<u&&(u=h),h>c&&(c=h)),typeof g=="number"&&(g<d&&(d=g),g>f&&(f=g))}),u!==Number.MAX_SAFE_INTEGER&&c!==Number.MIN_SAFE_INTEGER&&d!==Number.MAX_SAFE_INTEGER&&f!==Number.MIN_SAFE_INTEGER&&(n={xBandId:o,yBandId:l,pixelRanges:new Ys({xmin:u,xmax:c,ymin:d,ymax:f})})}else if(o!==void 0&&o===l){let u=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER;i.forEach(d=>{let f=d[a];typeof f=="number"&&(f<u&&(u=f),f>c&&(c=f))}),u!==Number.MAX_SAFE_INTEGER&&c!==Number.MIN_SAFE_INTEGER&&(n={bandId:o,pixelRanges:[[u,c]]})}}return n}function tf(t,e){let r=!0;if(e?.trim()){let i={};Object.entries(t).forEach(([s,o])=>{i[s.toUpperCase()]=o});let n=e.trim(),a=n.match(/^(\w+)\s+IS\s+(NOT\s+)?NULL$/iu);if(a){let[s,o,l]=a,u=i[o.toUpperCase()],c=u==null;r=l?!c:c}else{let s=n.match(/^(\w+)\s*(=|!=|<>|>|<|>=|<=)\s*(.+)$/iu);if(s){let[o,l,u,c]=s,d=l.toUpperCase();if(!(d in i))r=!1;else{let f=i[d],m=c.trim().replace(/^['"]|['"]$/gu,"");switch(typeof f=="number"?m=Number(m):typeof f=="boolean"&&(m=m.toLowerCase()==="true"),u){case"=":r=f===m;break;case"!=":case"<>":r=f!==m;break;case">":r=f>m;break;case"<":r=f<m;break;case">=":r=f>=m;break;case"<=":r=f<=m;break;default:r=!0}}}}}return r}function rf(t){let{features:e,aggregationType:r,onField:i}=t,n;if(!i)r==="count"&&(n=e.length);else switch(r){case"count":{i==="*"?n=e.length:n=e.filter(a=>a[i]!==null&&a[i]!==void 0).length;break}case"sum":{n=e.reduce((a,s)=>{let o=s[i];return a+(typeof o=="number"?o:0)},0);break}case"avg":{let a=0,s=0;e.forEach(o=>{let l=o[i];typeof l=="number"&&(a+=l,s++)}),n=s>0?a/s:0;break}case"min":{let a=e.map(s=>s[i]).filter(s=>typeof s=="number"&&s!==null&&s!==void 0);n=a.length>0?Math.min(...a):void 0;break}case"max":{let a=e.map(s=>s[i]).filter(s=>typeof s=="number"&&s!==null&&s!==void 0);n=a.length>0?Math.max(...a):void 0;break}case"percentile-continuous":{let a=[...e.map(o=>o[i]).filter(o=>typeof o=="number"&&o!==null&&o!==void 0)].sort((o,l)=>o-l),s=Math.floor(a.length/2);n=a.length%2!==0?a[s]:(a[s-1]+a[s])/2;break}}return n}function Es(t,e){let r;return t==null&&e?r={groupKey:v.nullValue,display:v.nullValue,original:null}:r={groupKey:t,display:t,original:t},r}async function nf(t){let{layer:e,geometry:r,view:i,abortKey:n,abortSignal:a}=t;e.loaded||await e.load({signal:a});let s=await Fr(e,a),o=tr(r)??e.fullExtent,l=s?.attributeTable;if(!(o instanceof Ys&&o.equals(e.fullExtent))){let u=i?new Qs({x:i.resolution,y:i.resolution,spatialReference:i.spatialReference}):void 0;l=await Ju(e,{geometry:o,pixelSize:u},{signal:a??(n!==void 0?Ot.get(n)?.signal:void 0)})}return l}async function af(t){let{chartConfig:e,queryConfig:r,queryObject:i,view:n,abortKey:a,abortSignal:s}=t,o;if(i===void 0)throw new Error("QueryObject is undefined!");let l=U(i);if(!oe(l))throw new ce(pe.LayerNotSupported);let u=await nf({layer:l,geometry:r.geometry,view:n,abortKey:a,abortSignal:s}),c=u?.features;if(!u||!c)o={valid:!1,invalidType:H.BadData};else{let d=e.series;if(!d||d.length===0||c.length===0)o={valid:!0};else{let f=r.groupByFieldsForStatistics?.[0]??"",m=d.some(y=>y.query?.fetchNullValues),h=new Map;for(let y of c){let{groupKey:p}=Es(y.attributes[f],m);p===v.nullValue&&!m||(h.has(p)||h.set(p,[]),h.get(p).push(y.attributes))}let g=[];h.forEach(y=>{let p={},F=y[0][f],{display:C,original:x}=Es(F,m);p[f]=C,p[v.xAxisField]=C,p[v.originalCategoryValue]=x,d.forEach(w=>{let N=w.query?.outStatistics?.[0];if(!N){let{name:I}=w;p[I]=y[0][I];return}let O=y,T=w.query?.where;T&&(O=y.filter(I=>tf(I,T)));let B=N.statisticType,M=N.onStatisticField,q=N.outStatisticFieldName;p[q]=rf({features:O,aggregationType:B,onField:M})}),g.push(p)}),o={valid:!0,data:{dataItems:g}}}}return o}async function Lg(t){let{layer:e,category:r,splitByField:i}=t,n=(await Fr(e))?.attributeTable?.features,a=i!==void 0;return Array.from(new Set(n?.map(s=>s.attributes[a?i:r]))).sort((s,o)=>typeof s=="string"&&typeof o=="string"?s.localeCompare(o):Number(s)-Number(o))}function sf(t,e){let r=new Map;return e.forEach((i,n)=>{r.set(i,n)}),t.reduce((i,n)=>{let a=i[i.length-1];if(!a)return i.push([n,n]),i;if(n===a[1])return i;let s=r.get(n),o=r.get(a[1]);return s!==void 0&&o!==void 0&&s===o+1?(a[1]=n,i):(i.push([n,n]),i)},[])}function of(t,e){return t?.map(({attributes:r})=>r[e]).filter(r=>r!=null).sort((r,i)=>r-i)}function lf(t){let{chartConfig:e,layer:r,selectionDataItems:i}=t,n,a=r.serviceRasterInfo?.attributeTable,s=e.series?.[0]?.x,o=a?.features,l=a?.fields?.find(({name:u})=>u.toLowerCase()==="value")?.name;if(i.length>0&&s&&o&&o.length>0&&l){let u=new Set(i.map(c=>c[s]).filter(c=>c!==void 0));if(u.size>0){let c=new Set;o.forEach(f=>{let m=f.attributes,h=m[s];u.has(h)&&c.add(m[l])});let d=Array.from(c).sort((f,m)=>f-m);if(d.length>0){let f=of(o,l);n={bandId:0,pixelRanges:sf(d,f)}}}}return n}var ho="PixelID",uf="Pixel ID",cf=[S.BarSeries,S.HistogramSeries,S.ScatterSeries];async function qg(t){let e=!1,{config:r,layer:i,abortSignal:n}=t;if(Wn(cf,r))switch(Z(r?.series)){case S.BarSeries:i.loaded||await i.load({signal:n}),e=!!(await Fr(i,n))?.attributeTable;break;case S.HistogramSeries:case S.ScatterSeries:e=!0;break}return e}async function df(t){let{layer:e,chartConfig:r}=t,i;return oe(e)?i=e:r?.iLayer?.layerType==="ArcGISImageServiceLayer"?i=await go(r.iLayer):r?.iLayer?.layerType==="ArcGISTiledImageServiceLayer"&&(i=await po(r.iLayer)),i}function ff(t){let e;switch(t){case"f32":e=Q.Single;break;case"f64":e=Q.Double;break;default:e=Q.Integer;break}return e}function yo(t){if(!t.loaded)throw new Error("Raster layer must be loaded to get its ID field name");let e=oi(t)?.attributeTable?.fields.find(r=>r.type==="oid");return e?e.name:ho}function mf(t){let{layer:e,rasterInfo:r,popupTemplateFieldInfosEnabled:i}=t;if(!e.loaded)throw new Error("Raster layer must be loaded to get its fields info");let n=r??oi(e);if(!n)throw new Error("Raster info must be provided or generated beforehand to get raster layer fields info");let a;try{if(n.attributeTable)a=n.attributeTable.fields.map(s=>s.toJSON());else{let s=ff(n.pixelType),o=n.bandInfos.map(l=>({name:l.name,alias:l.name,type:s}));i&&e?.popupTemplate?.fieldInfos!==void 0&&o.map(l=>{let u=e.popupTemplate?.fieldInfos?.find(c=>c.fieldName?.toLowerCase()===l.name.toLowerCase())?.label;return u&&u!==l.name&&(l.alias=u),l}),a=[{name:ho,alias:uf,type:Q.OID},...o]}}catch{a=[]}return a}async function Fr(t,e){return t.loaded||await t.load({signal:e}),Zn(t)?oi(t)??void 0:await t.generateRasterInfo(t.rasterFunction,{signal:e})}var go=rr(async(t,e)=>{let r={},i=t.layerDefinition;r.definitionExpression=i?.definitionExpression,r.id=t.id,t.url!==void 0&&(r.url=t.url),t.itemId!==void 0&&t.layerDefinition?.id!==void 0&&(r.portalItem={id:t.itemId});let n=new ec(r);return await ui(n,e),n},t=>JSON.stringify(t,Object.keys(t).sort())),po=rr(async(t,e)=>{let r={};r.id=t.id,t.url!==void 0&&(r.url=t.url),t.itemId!==void 0&&(r.portalItem={id:t.itemId});let i=new tc(r);return await ui(i,e),i},t=>JSON.stringify(t,Object.keys(t).sort())),hf=rr(async(t,e)=>{let r={};r.id=t.id,t.url!==void 0&&(r.url=t.url),t.itemId!==void 0&&(r.portalItem={id:t.itemId});let i=new rc(r);return await ui(i,e),i},t=>JSON.stringify(t,Object.keys(t).sort())),fn=(t,e)=>{let r=-1;if(!t.loaded)throw new Error("Raster layer must be loaded to get its band ID by name");let i=oi(t)?.bandInfos;if(i?.length===1)r=0;else if(e&&i?.length){let n=e.toLowerCase(),a=i.findIndex(s=>s.name.toLowerCase()===n);a>-1&&(r=a)}return r},Dg=t=>{let{chartConfig:e,layer:r,selectionDataItems:i}=t,n=Z(e.series),a;switch(n){case S.BarSeries:a=lf({chartConfig:e,layer:r,selectionDataItems:i});break;case S.HistogramSeries:a=Ed({chartConfig:e,layer:r,selectionDataItems:i});break;case S.ScatterSeries:a=ef({chartConfig:e,layer:r,selectionDataItems:i});break;default:a=void 0;break}return a};async function yf(t){let{queryObject:e,queryConfig:r,imagerySkipFactor:i,imageryMaxPixelCount:n,abortKey:a}=t,s=[];if(e!==void 0)try{let o=a&&Ot.get(a)?.signal||void 0,l=U(e);l.loaded||await ui(l,o);let u={geometry:tr(r.geometry)??l.fullExtent,autoResample:!0,maxPixelCount:n,skipFactor:i},c=await Xu(l,u,{signal:o});s=Gs.fromJSON(c.featureSet).features}catch{s=[]}return s}function gf(t){let{queryObject:e,defaultGeometry:r,ignoreViewExtent:i,viewExtent:n}=t,a=r;if(!i&&n){let{xmin:s,xmax:o,ymin:l,ymax:u,zmin:c,zmax:d}=n;a={xmin:s,ymin:l,zmin:c,xmax:o,ymax:u,zmax:d,spatialReference:n.spatialReference.toJSON()}}else if(!a&&e.fullExtent){let{xmin:s,xmax:o,ymin:l,ymax:u,zmin:c,zmax:d}=e.fullExtent;a={xmin:s,ymin:l,zmin:c,xmax:o,ymax:u,zmax:d,spatialReference:e.fullExtent.spatialReference.toJSON()}}return a}function pf(t){let e,r,i;return t!==void 0&&(e=t.type,(e===me.UniqueValue||e===me.ClassBreaks)&&(r=t.field??void 0,e===me.ClassBreaks&&(i=t.normalizationField??void 0))),{rendererType:e,rendererField:r,rendererNormalizationField:i}}var So=rr(async(t,e)=>{let r=t.featureCollection,i,n;if(r?.layers?.[0]!==void 0){let o=r.layers[0];i=o.featureSet,n=o.layerDefinition}else n=t.layerDefinition;let a={};if(i!==void 0){if(a.source=Gs.fromJSON(i).features,n?.fields!==void 0&&(a.fields=n.fields.map(o=>Hu.fromJSON(o))),n?.objectIdField!==void 0&&(a.objectIdField=n.objectIdField),n?.geometryType!==void 0){let o=pn.fromJSON({geometryType:n.geometryType});o?.type!==void 0&&o?.type!=="extent"&&(a.geometryType=o.type)}n?.spatialReference!==void 0&&(a.spatialReference=n.spatialReference)}else a.id=t.id,n?.id!==void 0&&(a.layerId=n.id),t.url!==void 0&&(a.url=t.url),t.itemId!==void 0&&n?.id!==void 0&&(a.portalItem={id:t.itemId});if(n!==void 0){let o=n.drawingInfo;o?.renderer!==void 0&&(a.renderer=Sn.fromJSON(o.renderer))}let s=new _u(a);return await s.load({signal:e}),s},t=>JSON.stringify(t));async function Pg(t,e){let r;switch(t?.layerType??""){case"ArcGISFeatureLayer":r=await So(t,e);break;case"ArcGISImageServiceLayer":r=await go(t,e);break;case"ArcGISTiledImageServiceLayer":r=await po(t,e);break;case"WCS":r=await hf(t,e);break;default:throw new ce(pe.LayerNotSupported)}return r}async function kg(t){let{layer:e,view:r,chartConfig:i,filterByViewExtent:n,abortSignal:a}=t,s=oe(e)||_n(i),o;if(s)o=await df(t);else{let l=U(e),u=Be(l);u!==void 0?n&&r!==void 0&&!u.isTable?(u.outFields=["*"],o=await r.whenLayerView(u)):o=e:i?.iLayer&&i.iLayer?.layerType==="ArcGISFeatureLayer"&&(o=await So(i.iLayer,a))}return o}function Re(t,e){let r=U(t),i=[];if(r!==void 0){let n=e===!0&&r?.popupTemplate?.fieldInfos!==void 0;oe(r)?i=mf({layer:r,popupTemplateFieldInfosEnabled:e}):i=r.fields.map(a=>{let s=a.toJSON();if(n){let o=r.popupTemplate?.fieldInfos?.find(l=>l.fieldName?.toLowerCase()===a.name.toLowerCase())?.label;o!==void 0&&o!==a.name&&(s.alias=o)}return s})}return i}function Vg(t,e=[]){return e.find(r=>r.name===t)}function li(t){let e,r=!1;if(oe(t))e=[yo(t)];else{let i=Be(t);i&&("uniqueIdFields"in i&&i.uniqueIdFields&&i.uniqueIdFields.length>0?e=i.uniqueIdFields:(e=[i.objectIdField],r=!0))}return{idFields:e,isTraditionalTypeOID:r}}function We(t){let e="",r=!1;if(oe(t))e=yo(t);else if(t){let i=li(t);r=i.isTraditionalTypeOID,i.idFields&&(e=i.idFields[0])}return{idField:e,isTraditionalTypeOID:r}}function Sr(t){let e=[Q.Single,Q.Double,Q.SmallInteger,Q.Integer,Q.BigInteger];return t!==void 0&&e.includes(t.type)}function Sf(t){return t?.type===Q.Date||t?.type===Q.DateOnly||t?.type===Q.TimestampOffset}function $g(t){return t?.type===Q.String}function Rg(t){return t?.type===Q.TimeOnly}function Wg(t){let e=[Q.SmallInteger,Q.Integer,Q.BigInteger];return t!==void 0&&e.includes(t.type)}function bf(t){return t.filter(e=>Sf(e)).map(e=>e.name)}function jg(t){return t.filter(e=>Sr(e)).map(e=>e.name)}function mn(t,e){let r;if(e){let i=U(t).getFieldDomain(e);i instanceof zu&&(r=i)}return r}function hn(t,e){let r=e?.getName(t?.toString())??e?.getName(t)??e?.getName(Number(t));return r===null&&(r=void 0),r}function As(t){let{queryObject:e,fieldName:r,fieldValue:i}=t;return oe(e)?void 0:hn(i,mn(e,r))}async function bo(t){let e=[];return t&&!Be(t)?.isTable&&t.fieldsIndex&&(e=await Us.getRendererFields(t.renderer,t.fieldsIndex)),e}function vf(t){let e="/rest/services",r=t.toLowerCase(),i=r.indexOf(e);return r=i>-1?t.substring(0,i):t,`${r}/rest/info`}async function Ff(t,e){let r=!0,i=".arcgis.com/",n=t?.url,a=n?.includes(i);if(n&&a&&Be(t)?.sourceJSON?.serviceItemId!==void 0){let s=vf(n);try{let o=(await ti(s,{query:{f:"json"},signal:e})).data;if(o.owningTenant!==void 0&&o.owningSystemUrl!==void 0){let l=`${o.owningSystemUrl}/sharing/rest/portals/${o.owningTenant}`,u=(await ti(l,{authMode:"auto",query:{f:"json"},signal:e})).data,c=new Uu({sourceJSON:u});await c.load({signal:e}),r=c?.sourceJSON?.subscriptionInfo?.dataStoreLevel===void 0}}catch{}}return r}function xf(t){let{queryObject:e,fieldToMatch:r,returnUndefinedIfNotFound:i}=t,n=Re(e),a=Cf(n,r),s=i?"":r;return a?.name??s}function Cf(t,e){let r=t.find(i=>e===i.name);return r||(r=t.find(i=>e.toUpperCase()===i.name.toUpperCase())),r}function Zg(t){let{fieldsList:e,queryObject:r,returnUndefinedIfNotFound:i}=t,n=e;return n!==void 0&&(n=n.map(a=>xf({queryObject:r,fieldToMatch:a,returnUndefinedIfNotFound:i}))),n}function vo(t){let{queryObject:e,chartConfig:r,runtimeDataFilters:i,ignoreViewExtent:n,viewExtent:a}=t,{series:s,dataFilters:o}=r,{where:l,gdbVersion:u,timeExtent:c,geometry:d,distance:f,units:m,objectIds:h,spatialRelationship:g}=o??{},{where:y,gdbVersion:p,timeExtent:F,geometry:C,distance:x,units:w,objectIds:N,spatialRelationship:O}=i??{},T=s[0],{query:B}=T,{where:M}=B??{},q=W(s),I={...B};return I.where=ee([l,y]),q!==b.BarAndLineSplitBy&&q!==b.BoxPlotMonoFieldAndSplitBy&&q!==b.BoxPlotMonoFieldAndCategoryAndSplitBy&&q!==b.BoxPlotMultiFieldsAndSplitBy&&q!==b.BarAndLineSplitByNoAggregation&&(I.where=ee([I.where,M])),r.orderOptions?.orderByFields!==void 0&&(I.orderByFields=r.orderOptions.orderByFields),I.gdbVersion=p??u,I.timeExtent=Tf(e,F??c),I.geometry=oe(e)?gf({queryObject:e,defaultGeometry:C??d,ignoreViewExtent:n,viewExtent:a}):Of({queryObject:e,defaultGeometry:C??d,ignoreViewExtent:n}),I.distance=x??f,I.units=w??m,I.objectIds=N??h,I.spatialRelationship=O??g,B?.outStatistics?.[0]?.statisticType===A.Count&&(I.returnDistinctValues=B?.returnDistinctValues??!1),I?.outStatistics?.forEach(k=>{Fn(k)&&!("statisticParameters"in k)&&(k.statisticParameters={value:G.defaultStatParameterValue})}),I}var wf=t=>{let e;if("portalItem"in t){let r=t.portalItem?.id;typeof r=="string"&&(e=r)}return e};function _g(t){let{view:e,portalItemId:r}=t,i;if(e&&r){let n=Array.from(e.map?.allLayers??[]).find(a=>wf(a)===r);n&&(i=n)}return i}async function ui(t,e){await t.load({signal:e}),(Ci(t)||wi(t))&&await t.generateRasterInfo(t.rasterFunction,{signal:e})}function Nf(t){let e=!t.geometry||t.geometry.type==="extent",r=(t.where??"").toUpperCase(),i=!r.includes("CURRENT_TIMESTAMP")&&!r.includes("CURRENT_DATE")&&!r.includes("CURRENT_TIME");return e&&i}function Fo(t){let e=G.maxRecords;if(t&&"sourceJSON"in t&&t.sourceJSON?.maxRecordCount){let{sourceJSON:r}=t;e=r.maxRecordCount,r.advancedQueryCapabilities?.supportsMaxRecordCountFactor===!0&&(e*=G.maxRecordCountFactor)}return e}function ee(t,e){let r,i=Array.from(new Set(t)).filter(n=>n!=null&&n!==""&&!ut(n));return i.sort((n,a)=>a.length-n.length),i.length===1?[r]=i:i?.forEach(n=>{n!==void 0&&(he(r)?r=`(${n})`:r?.includes(`(${n})`)||(r=`${r} ${e??"AND"} (${n})`))}),r??"1=1"}function Tf(t,e){let r=e;if(t!==void 0){let i=U(t),n=Be(i)?.timeExtent;n?.start!=null&&n?.end!=null&&(r=[n.start.valueOf(),n.end.valueOf()])}return r}function Of(t){let{queryObject:e,defaultGeometry:r,ignoreViewExtent:i}=t,n=r;if(!i&&ct(e)){let a=e.view.extent,{xmin:s,xmax:o,ymin:l,ymax:u,zmin:c,zmax:d}=a;n={xmin:s,ymin:l,zmin:c,xmax:o,ymax:u,zmax:d,spatialReference:a.spatialReference.toJSON()}}return n}function tr(t){let e;return t!==void 0&&(e=pn.fromJSON(t)),e}function Bf(t){return t===void 0?["*"]:Array.from(new Set(t))}function ci(t){let{queryType:e,queryObject:r,queryConfig:i,view:n,configTimeZone:a,dateField:s,useViewTimeZone:o}=t,{where:l,outStatistics:u,geometry:c,distance:d,units:f,timeExtent:m,returnDistinctValues:h}=i??{},g=U(r),y=Be(g)?.createQuery()??new Wu,p,F=li(g).idFields;if(e==="AttributeBinsQuery"&&i?.objectIds?.[0]!==void 0&&F&&(p=`${F} IN (${i.objectIds.join(",")})`),e==="AttributeBinsQuery"&&(y=new Ru(y.toJSON()),Re(r).find(x=>x.name===s)?.type!==Q.DateOnly)){let x=Intl.DateTimeFormat().resolvedOptions().timeZone,w=o&&n&&"timeZone"in n?n.timeZone:void 0,N=a??w??x;N==="unknown"?N="Etc/UTC":N==="system"&&(N=x),y.outTimeZone=N}if(y.where=ee([y.where,l,p]),"returnDistinctValues"in y&&(y.returnDistinctValues=h??!1),u!==void 0){let x=Sc(g);y.outStatistics=u.filter(w=>w.statisticType!==A.EnvelopeAggregate||x).map(w=>ju.fromJSON(w))}let C=tr(c);return C!==void 0&&(y.geometry=C,i?.spatialRelationship&&(y.spatialRelationship=i.spatialRelationship),Xs(g)&&(d!==void 0&&(y.distance=d),f!==void 0&&(y.units=f))),m&&(y.timeExtent=new Zu({start:m?.[0],end:m?.[1]})),Nf(y)&&(y.cacheHint=!0),y}function Mf(t){let e;switch(t){case ae.Start:e="first";break;case ae.End:e="last";break}return e}function If(t){let{queryObject:e,queryConfig:r,temporalBinning:i,dateField:n,splitByField:a,axisTimeZone:s,view:o,syncViewTimeZone:l}=t,{unit:u,size:c,timeAggregationType:d,start:f,end:m,offset:h,outTimeZone:g}=i,y=U(e),p=ci({queryType:"AttributeBinsQuery",queryObject:e,queryConfig:r,configTimeZone:g??s,view:o,dateField:n,useViewTimeZone:l??!1}),F=co(n);if(p.lowerBoundaryAlias=F.lowerBoundaryAlias,p.upperBoundaryAlias=F.upperBoundaryAlias,p.binParameters={type:"date",field:n,interval:{unit:u,value:c},start:f,end:m,offset:h?{unit:h.unit,value:h.size}:null},p.binParameters.type==="date"&&(y?.capabilities?.queryAttributeBins?.supportsSnapToData&&(p.binParameters.snapToData=Mf(d)),y?.capabilities?.queryAttributeBins?.supportsReturnFullIntervalBin&&(p.binParameters.returnFullIntervalBin=!0)),!he(a)){let C=Be(y)?.fields.find(x=>x.name===a)?.type;(!C||C==="string"||C==="integer"||C==="small-integer"||C==="big-integer"||C==="double")&&(p.binParameters.stackBy={type:"field",value:a,valueType:C==="string"?"string":"integer"})}return p}function Cn(t){let{field:e,fieldType:r,unit:i,outTimeZone:n,dataTimeZone:a,runsOnClientQueryEngine:s,addIntervalStatement:o,addLeapDayExpression:l}=t,u,c,d=1,f=1;switch(i){case Ce.MinuteOfDay:r!==Q.DateOnly&&(c="MINUTE",d=0,f=59);break;case Ce.HourOfDay:r!==Q.DateOnly&&(c="HOUR",d=0,f=23);break;case Ce.DayOfWeek:c="DOW",f=7;break;case Ce.DayOfMonth:c="DAY",f=31;break;case Ce.DayOfYear:c="DOY",f=366;break;case Ce.WeekOfYear:c="WEEK",f=53;break;case Ce.MonthOfYear:c="MONTH",f=12;break;case Ce.QuarterOfYear:c="QUARTER",f=4;break}if(c){let m=o?` ${so({dataTimeZone:a,runsOnClientQueryEngine:s,outTimeZone:n})}`:"";u=Ef({addLeapDayExpression:l,temporalKey:c,field:e,intervalStatement:m})}return{expression:u,start:d,end:f}}function Ef(t){let{addLeapDayExpression:e=!1,temporalKey:r,field:i,intervalStatement:n}=t,a;return e&&i.length&&r==="DAY"?a=`CASE WHEN (EXTRACT(MONTH FROM ${i})=2 AND EXTRACT(DAY FROM ${i})=29) THEN 0 ELSE EXTRACT (${r} FROM ${i}${n}) END`:a=`EXTRACT (${r} FROM ${i}${n})`,a}function Ls(t){let{temporalBinning:e,xOrY:r,xOrYFieldType:i,addIntervalStatement:n,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o,includeLeapDay:l}=t,{unit:u}=e??{},c,d,f,m;return i===Q.Date||i===Q.DateOnly||i===Q.TimestampOffset?{expression:d,start:f,end:m}=Cn({field:r,fieldType:i,unit:u,addIntervalStatement:n,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o,addLeapDayExpression:!l}):c=r,{field:c,expression:d,start:f,end:m}}function Af(t){let{queryObject:e,queryConfig:r,x:i,y:n,xTemporalBinning:a,yTemporalBinning:s,firstDayOfWeek:o,includeLeapDay:l,configTimeZone:u,view:c,syncViewTimeZone:d}=t,f=Re(e),m=f.find(N=>N.name===i)?.type,h=f.find(N=>N.name===n)?.type,g=ci({queryType:"AttributeBinsQuery",queryObject:e,queryConfig:r,configTimeZone:u,view:c,dateField:i,useViewTimeZone:d??!1});g.binParameters={type:"fixed-interval",interval:1},g.lowerBoundaryAlias=G.heatChartLowerBoundaryAlias,g.upperBoundaryAlias=G.heatChartUpperBoundaryAlias,o!==void 0&&(g.binParameters.firstDayOfWeek=o);let y=Ls({temporalBinning:a,xOrY:i,xOrYFieldType:m,addIntervalStatement:!1,includeLeapDay:l}),{field:p,expression:F,start:C,end:x}=y;p?g.binParameters.field=p:F&&(g.binParameters.expression=F,g.binParameters.expressionValueType="integer",g.binParameters.type==="fixed-interval"&&(C!==void 0&&(g.binParameters.start=C),x!==void 0&&(g.binParameters.end=x)));let w=Ls({temporalBinning:s,xOrY:n,xOrYFieldType:h,addIntervalStatement:!1,includeLeapDay:l});return w.field?g.binParameters.stackBy={type:"field",value:w.field}:w.expression&&(g.binParameters.stackBy={type:"expression",value:w.expression,valueType:"integer",alias:n}),g}function Lf(t){let{queryObject:e,queryConfig:r,xStep:i,xMin:n,xMax:a,x:s,y:o,yStep:l}=t,u=ci({queryType:"AttributeBinsQuery",queryObject:e,queryConfig:r,useViewTimeZone:!1}),c=lo(s,o);return u.lowerBoundaryAlias=c.lowerBoundaryAlias,u.upperBoundaryAlias=c.upperBoundaryAlias,u.binParameters={type:"fixed-interval",field:s,interval:i,start:n,end:a,stackBy:{value:`FLOOR(${o} / ${l})`,type:"expression",alias:c.stackAlias,valueType:"integer"}},u}function wn(t){let{queryObject:e,queryConfig:r,maxRecordCountFactor:i}=t,{groupByFieldsForStatistics:n,orderByFields:a,gdbVersion:s,start:o,num:l,outFields:u}=r??{},c=ci({queryType:"Query",queryObject:e,queryConfig:r,useViewTimeZone:!1});c.returnGeometry=!1;let d=U(e);return c.outFields=Bf(u),c.groupByFieldsForStatistics=n??c.groupByFieldsForStatistics,c.orderByFields=a??[],c.objectIds=r?.objectIds,i!==void 0&&(c.maxRecordCountFactor=i),s!==void 0&&s!==""&&(c.gdbVersion=s),l!==void 0&&(c.num=l),o!==void 0&&(c.start=o,c.num=c.num??Fo(d)),c}function qf(t){return t&&"sourceJSON"in t&&t.sourceJSON?.advancedQueryCapabilities?.supportsMaxRecordCountFactor===!0?G.maxRecordCountFactor:void 0}function Df(t=re.None,e){return t===re.None||t===re.Log&&e>0||t===re.Sqrt&&e>=0}function xo(t,e){let r={valid:!1};return e===!0?r.invalidType=H.HistogramEmptyField:t===re.Log?r.invalidType=H.NegativeValueInLogCalculation:t===re.Sqrt&&(r.invalidType=H.NegativeValueInSqrtCalculation),r}function Pf(t,e){let r=t;switch(e){case re.Log:r=Math.log(t);break;case re.Sqrt:r=Math.sqrt(t);break}return r}function kf(t){let e=t;if(t){let r=t.toString().split(".");if(r[1]!==void 0){let i=10**-r[1].length;e=t-i}}return e}function Co(t){let e="field";switch(t){case re.Log:e="natural-log";break;case re.Sqrt:e="square-root";break;case re.None:}return e}async function Vf(t){let{queryObject:e,fieldName:r,queryConfig:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o=U(e),{idField:l,isTraditionalTypeOID:u}=We(o),c=u?l:"*",d=`${A.Count}_${l}`,f=`${A.Count}_${r}`,m=`${A.Minimum}_${r}`,h=`${A.Maximum}_${r}`,g={...i,outStatistics:[{statisticType:A.Count,onStatisticField:c,outStatisticFieldName:d},{statisticType:A.Count,onStatisticField:r,outStatisticFieldName:f},{statisticType:A.Minimum,onStatisticField:r,outStatisticFieldName:m},{statisticType:A.Maximum,onStatisticField:r,outStatisticFieldName:h}]},y=await vr({queryObject:e,queryConfig:g,errorStrings:n,abortKey:a,abortSignal:s}),p=y.get(d)??Number.NaN,F=y.get(f)??Number.NaN,C=y.get(m)??Number.NaN,x=y.get(h)??Number.NaN;return{countExcludingNulls:F,countIncludingNulls:p,min:C,max:x}}async function $f(t){let{queryConfig:e,chartConfig:r,queryObject:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o=r.series[0],{x:l,dataTransformationType:u}=o,c=[],{countIncludingNulls:d,countExcludingNulls:f,min:m,max:h}=await Vf({queryObject:i,queryConfig:e,fieldName:l,errorStrings:n,abortKey:a,abortSignal:s}),g=Df(u,m),y=f<2||m===h,p={...e};return p.where=ee([p.where,`${l} is not null`]),{rawData:c,dataCompatibleWithTransformation:g,dataCountIncompatible:y,countExcludingNulls:f,countIncludingNulls:d}}function Rf(t){let e={...t};return e.avg=e.avg??Number.NaN,e.count=e.count??Number.NaN,e.max=e.max??Number.NaN,e.min=e.min??Number.NaN,e.stddev=e.stddev??Number.NaN,e.sum=e.sum??Number.NaN,e.variance=e.variance??Number.NaN,e.median=e.median??Number.NaN,e}function Wf(t){let{seriesConfig:e,layer:r,useFeaturesInView:i,view:n,queryConfig:a,abortSignal:s}=t,{x:o,dataTransformationType:l}=e,u={layer:r,view:n,field:o,sqlWhere:ut(a.where)?void 0:a.where,useFeaturesInView:i,signal:s};return l!==re.None&&(u={...u,normalizationType:Co(l)}),u}function jf(t){let{seriesConfig:e,layer:r,useFeaturesInView:i,view:n,minValue:a,maxValue:s,queryConfig:o,abortSignal:l}=t,{x:u,binCount:c,dataTransformationType:d}=e,f={layer:r,view:n,field:u,minValue:a,maxValue:s,numBins:c??kn,classificationMethod:"equal-interval",sqlWhere:ut(o.where)?void 0:o.where,useFeaturesInView:i,signal:l};return d!==re.None&&(f={...f,normalizationType:Co(d)}),f}function Zf(t,e){let r=Number.NaN;return t!==void 0&&e!==void 0&&(r=t-e),r}async function _f(t){let{chartConfig:e,queryConfig:r,queryObject:i,countExcludingNulls:n,countIncludingNulls:a,view:s,errorStrings:o,abortSignal:l}=t,u=e.series[0],{dataTransformationType:c}=u,d={valid:!0},f=U(i),m=tr(r?.geometry)?.extent?.toJSON()!==void 0,h=s,g=Wf({seriesConfig:u,layer:f,view:h,useFeaturesInView:m,queryConfig:r,abortSignal:l}),y;if(h!==void 0&&(y=new Ns({geometry:h.extent}),h.extent!==void 0&&Xs(f))){let{distance:B,units:M}=r;B!==void 0&&(y.distance=B),M!==void 0&&(y.units=M)}if(r.timeExtent){let B={start:r.timeExtent[0],end:r.timeExtent[1]};y===void 0?y=new Ns({timeExtent:B}):y.timeExtent=B}g.filter=y;let p;g.outStatisticTypes={exclude:["median"]};try{p=await Ts(g)}catch(B){throw new ce(pe.QueryFeaturesError,o.errors.queryError,B)}g.outStatisticTypes={include:["median"]};try{let B=await Ts(g);B?.median&&(p.median=B.median)}catch{}p=Rf(p);let{avg:F,count:C,stddev:x,min:w,max:N,sum:O,median:T}=p;if(C===0)d={...xo(c)};else{let B=jf({seriesConfig:u,layer:f,view:h,useFeaturesInView:m,minValue:kf(w),maxValue:N,valueExpression:g.valueExpression,queryConfig:r,abortSignal:l});B.filter=y;let M;try{M=await $u(B)}catch(I){throw new ce(pe.QueryFeaturesError,o.errors.queryError,I)}let q=Zf(a,n);d.data={mean:F,stddev:x,min:w,max:N,median:Number(T),bins:M?.bins,count:n,nulls:q,sum:O??void 0},d.data.bins.length>0&&(d.data.bins[d.data.bins.length-1].isLastBin=!0)}return d}async function wo(t){let{chartConfig:e,queryConfig:r,queryObject:i,abortKey:n,abortSignal:a,errorStrings:s,view:o}=t,{series:l}=e,u=l[0],c;if(oe(i))c=await Md(t);else{let{rawData:d,dataCompatibleWithTransformation:f,dataCountIncompatible:m,countIncludingNulls:h,countExcludingNulls:g}=await $f({queryObject:i,chartConfig:e,queryConfig:r,errorStrings:s,abortKey:n,abortSignal:a});c={valid:!0},!f||m?c=xo(u.dataTransformationType,m):c=await _f({chartConfig:e,queryObject:i,queryConfig:r,countIncludingNulls:h,countExcludingNulls:g,view:o,abortSignal:a,errorStrings:s})}return c}async function zf(t){let{queryObject:e,queryConfig:r,chartConfig:i,x:n,errorStrings:a}=t,{series:s}=i,{dataTransformationType:o}=s[0],l={...r,orderByFields:[n],outFields:[n]};return{valid:!0,data:{dataItems:(await Le({queryObject:e,queryConfig:l,errorStrings:a})).map(u=>({[n]:Pf(u.attributes[n],o)}))}}}var qs={Count:"count",Start:"minValue",End:"maxValue"},Bt={groupByCaseBegin:"CASE",groupByOutKeyword:"OUT",groupByCaseEnd:"ELSE 'OUT' END"};function zg(t){return Z(t.series)!==S.BoxPlotSeries?v.xAxisField:t.series[0].x}function Hg(t){let e=Ir(t);return e===qe.Stacked||e===qe.Stacked100}function Ug(t,e){let r=[],i=new Map,n=new Map;return t.forEach((a,s)=>n.set(a.id,s)),e.forEach((a,s)=>{let o=n.get(a.id);if(o!==void 0){let l=new Set;for(;i.has(o)&&!l.has(o);)l.add(o),o=i.get(o)??o;o!==s&&(r.push([o,s]),i.set(s,o))}}),r}function Hf(t){let e={...t};return t.showMean===!0&&(e.series=[e.series[0]],e.series[0].query?.where!==void 0&&delete e.series[0].query.where),e}function Uf(t){return Tt(t)&&Ke(t?.axes?.[0]?.valueFormat)&&Ke(t?.axes?.[1]?.valueFormat)}var Gf=[...hi,"ar-u-nu-latn","en-AU","en-GB","es-ES","es-MX","de-CH","de-DE","de-AT","fr-CA","it-CH","it-IT"];function Gg(t){let{t9nLocale:e}=et(t??document.documentElement),r=No(t??document.documentElement),i=En(t??document.documentElement)==="rtl";return{locale:e,formatLocale:r,rtl:i}}function Yg(t){let e;return t==="unknown"?e="UTC":t!==void 0&&t!=="system"&&(e=t),e}function Qg(t,e){let r={year:"numeric",month:"2-digit",day:"2-digit",timeZone:e};return new Intl.DateTimeFormat("en-CA",r).format(t)}function Kg(t,e){let r={hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:e};return new Intl.DateTimeFormat("en-US",r).format(t)}function Jg(t,e){let[,r,,,,i]=1111.1.toLocaleString(e),n=t.replace(r,"").replace(i,".");return Number.parseFloat(n)}function Yf(t){let e=Array.from(hi);return Gf.includes(t)&&!e.includes(t)}function No(t){let{lang:e,t9nLocale:r}=et(t);return Yf(e)?e:r}function ai(t){let{dataInfo:e,chartType:r,subError:i}=t;switch(e.valid=!1,r){case S.BarSeries:case S.ComboLineAndBarSeries:e.invalidType=H.BarElementExceedsLimit;break;case S.LineSeries:e.invalidType=H.LineChartExceedsLimit;break;case S.PieSeries:e.invalidType=H.PieChartExceedsLimit;break;case S.GaugeSeries:e.invalidType=H.GaugeExceedsLimit;break;case S.BoxPlotSeries:i?.outlierLimit===!0?e.invalidType=H.BoxPlotOutliersExceedsLimit:e.invalidType=H.BoxPlotExceedsLimit;break;case S.HeatSeries:e.invalidType=H.HeatChartExceedsLimit;break}}function Qf(t,e){t.valid=!1,t.invalidType=e}function Xg(t){let{invalidType:e,chartLimits:r,elementCount:i,seriesCount:n,queryObject:a,filterBySelection:s,formatLocale:o=No(document.documentElement),isTemporalChart:l,isGaugeChartByFeature:u,errorStrings:c}=t,d=c.errors.defaultInvalidChart,f,m=new Intl.NumberFormat(o),h=bt(r),{maxCategoryCount:g}=h,y=c.modalHeaders.invalidChart;switch(e){case H.BarElementExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=Number.NaN,F=Number.NaN,C="";n!==void 0&&(n<=h.maxBarChartSeriesCount?n===1?(C=c.errors.uniqueSeriesBarCountCannotExceedLimit,p=h.maxBarUniqueSeriesCountTotal):n===2?(C=c.errors.twoSeriesBarCountCannotExceedLimit,p=h.maxBarTwoSeriesCountTotal,F=h.maxBarTwoSeriesCountPerSeries):n>2&&(C=c.errors.threePlusSeriesBarCountCannotExceedLimit,p=h.maxBarThreePlusSeriesCountTotal,F=h.maxBarThreePlusSeriesCountPerSeries):(C=c.errors.barSeriesCountCannotExceedLimit,F=h.maxBarChartSeriesCount));let x=m.format(p),w=m.format(F),N=i!==void 0?m.format(i):"";d=_e(C,{totalLimit:x,seriesLimit:w,elementCount:N}),f={actualCount:i??Number.NaN,totalLimit:p,seriesLimit:F};break}case H.LineChartExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=Number.NaN,F=Number.NaN,C="";n!==void 0&&(n<=h.maxLineChartSeriesCount?n===1?(C=l?c.errors.uniqueTemporalSeriesLineCountCannotExceedLimit:c.errors.uniqueSeriesLineCountCannotExceedLimit,p=h.maxLineUniqueSeriesCountTotal):n===2?(C=l?c.errors.twoTemporalSeriesLineCountCannotExceedLimit:c.errors.twoSeriesLineCountCannotExceedLimit,p=h.maxLineTwoSeriesCountTotal,F=h.maxLineTwoSeriesCountPerSeries):n>2&&(C=l?c.errors.threePlusTemporalSeriesLineCountCannotExceedLimit:c.errors.threePlusSeriesLineCountCannotExceedLimit,p=h.maxLineThreePlusSeriesCountTotal,F=h.maxLineThreePlusSeriesCountPerSeries):(C=c.errors.lineSeriesCountCannotExceedLimit,F=h.maxLineChartSeriesCount));let x=m.format(p),w=m.format(F),N=i!==void 0?m.format(i):"";d=_e(C,{elementCount:N,seriesLimit:w,totalLimit:x}),f={actualCount:i??Number.NaN,totalLimit:p,seriesLimit:F}}break;case H.BoxPlotExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=Number.NaN,F=Number.NaN,C="";n!==void 0&&(n<=h.maxBoxPlotSeriesCount?n===1?(C=c.errors.uniqueSeriesBoxCountCannotExceedLimit,p=h.maxBoxUniqueSeriesCountTotal):n===2?(C=c.errors.twoSeriesBoxCountCannotExceedLimit,p=h.maxBoxTwoSeriesCountTotal,F=h.maxBoxTwoSeriesCountPerSeries):n>2&&(C=c.errors.threePlusBoxLineCountCannotExceedLimit,p=h.maxBoxThreePlusSeriesCountTotal,F=h.maxBoxThreePlusSeriesCountPerSeries):(C=c.errors.boxSeriesCountCannotExceedLimit,F=h.maxBoxPlotSeriesCount));let x=m.format(p),w=m.format(F),N=i!==void 0?m.format(i):"";d=_e(C,{elementCount:N,seriesLimit:w,totalLimit:x}),f={actualCount:i??Number.NaN,totalLimit:p,seriesLimit:F}}break;case H.BoxPlotOutliersExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=c.errors.boxSeriesOutlierCannotExceedLimit,F=h.maxBoxPlotOutlierLimit,C=m.format(F);d=_e(p,{totalLimit:C}),f={actualCount:i??Number.NaN,totalLimit:F}}break;case H.HeatChartExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=c.errors.heatChartCannotExceedLimit,F=h.maxHeatChartCellLimit,C=m.format(F),x=i!==void 0?m.format(i):"";d=_e(p,{featureCount:x,totalLimit:C}),f={actualCount:i??Number.NaN,totalLimit:F}}break;case H.PieChartExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=c.errors.pieChartSlicesCannotExceedLimit,F=h.maxPieChartSliceCountTotal,C=m.format(F),x=i!==void 0?m.format(i):"";d=_e(p,{sliceCount:x,totalLimit:C}),f={actualCount:i??Number.NaN,totalLimit:F}}break;case H.GaugeExceedsLimit:{y=c.modalHeaders.tooManyFeatures;let p=c.errors.gaugeCannotExceedLimit,F=h.maxGaugeByFeaturesLimit,C=m.format(F),x=i!==void 0?m.format(i):"";d=_e(p,{featureCount:x,totalLimit:C}),f={actualCount:i??Number.NaN,totalLimit:F}}break;case H.PieChartMixOfNegativePositiveSlices:y=c.modalHeaders.cannotCombineNegativeAndPositiveSlices,d=c.errors.pieChartCannotHaveMixtureOfPositiveAndNegativeSlices;break;case H.NegativeValueInSqrtCalculation:y=c.modalHeaders.invalidData,d=c.errors.negativeValueInDataForSqrtTransformation;break;case H.NegativeValueInLogCalculation:y=c.modalHeaders.invalidData,d=c.errors.negativeValueInDataForLogTransformation;break;case H.HistogramEmptyField:s===!0?(y=c.modalHeaders.noDataAvailable,d=c.errors.noDataFBSMessage):ct(a)?(y=c.modalHeaders.noDataAvailable,d=c.errors.noDataFBEMessage):(y=c.modalHeaders.invalidChart,d=c.errors.histogramEmptyField);break;case H.EmptyDataSet:u&&i?(y=void 0,d=c.errors.noValue):(y=c.modalHeaders.noDataAvailable,s===!0?d=c.errors.noDataFBSMessage:ct(a)?d=c.errors.noDataFBEMessage:d=c.errors.noDataMessage);break;case H.NegativeValueInXAxisLogScale:d=c.errors.logarithmicXAxisNotPossible;break;case H.NegativeValueInYAxisLogScale:d=c.errors.logarithmicYAxisNotPossible;break;case H.BadData:}if(d===c.errors.defaultInvalidChart&&(e===H.BarElementExceedsLimit||e===H.LineChartExceedsLimit||e===H.HeatChartExceedsLimit||e===H.PieChartExceedsLimit||e===H.GaugeExceedsLimit||e===H.BoxPlotExceedsLimit)&&typeof i=="number"&&typeof n=="number"&&i/n>g){let p=i/n;d=_e(c.errors.categoryCountCannotExceedLimit,{categoryCount:m.format(p),maxCategoryCount:m.format(g)})}return{keyword:e??H.BadData,header:y,message:d,params:f}}function Xt(t,e){return`${e}_${t}`}function yn(t){let{value:e,mean:r,stdDev:i}=t;return(e-r)/i}function Nn(t){let{dataItem:e,chartSubType:r,y:i,splitByValue:n,meanPerField:a,stdDevPerField:s}=t,o=e,l={chartSubType:r,y:i,splitByValue:n},u=se({...l,key:P.Average}),c=se({...l,key:P.StandardDeviation}),d=a??Number(e[u]),f=s??Number(e[c]);return Number.isFinite(d)&&Number.isFinite(f)&&Object.values(P).forEach(m=>{let h=se({key:m,y:i,chartSubType:r,splitByValue:n}),g=e[h];if(g!=null){let y=Number(g);if(Number.isFinite(y)){l={...l,key:m,showOutliers:!1,standardizeValues:!0};let p=se(l);if(o[p]=yn({mean:d,stdDev:f,value:y}),m===P.Min||m===P.Max){l={...l,key:m,showOutliers:!0,standardizeValues:!0},p=se(l),l={...l,standardizeValues:!1,splitByValue:n};let F=se(l);y=Number(e[F]),Number.isFinite(y)&&(o[p]=yn({mean:d,stdDev:f,value:y}))}}}}),o}function Kf(t){let{data:e,yList:r,calculateZScore:i=!1}=t,n=e[0],a=new Map;return r.forEach(s=>{let o={};Object.keys(n).forEach(l=>{l.startsWith(s)?o[l.replace(`${s}_`,"")]=n[l]:l.includes(v.rendererSymbolField)&&(o[l]=n[l]),o[v.boxPlot.boxPlotCategory]=s,i&&(o=Nn({dataItem:o,chartSubType:b.BoxPlotMultiFields}))}),a.set(s,o)}),Array.from(a.values())}function Jf(t){let{data:e,splitByField:r,y:i}=t,n={[v.boxPlot.boxPlotCategory]:i};return e.forEach(a=>{let s=a[r];s!==void 0&&Object.keys(a).forEach(o=>{o===v.rendererSymbolField?n[`${o}_${s?.toString()}`]=a[o]:o===v.boxPlot.boxPlotMeanLineMarkerId?n[o]=a[o]:n[`${s?.toString()}_${o}`]=a[o]})}),[n]}function Xf(t){let{splitByField:e,data:r,yList:i,calculateZScore:n=!1,meanAndStdDevPerField:a}=t,s=new Map;return r.forEach(o=>{let l=o[e];i.forEach(u=>{let c={[v.boxPlot.boxPlotCategory]:u};Object.entries(o).forEach(([d,f])=>{d.startsWith(`${u}_`)?c[`${l}_${d.replace(`${u}_`,"")}`]=f:d.includes(v.rendererSymbolField)?c[`${d}_${l}`]=f:d===v.boxPlot.boxPlotMeanLineMarkerId&&(c[d]=o[d])}),n&&(c=Nn({dataItem:c,chartSubType:b.BoxPlotMultiFieldsAndSplitBy,splitByValue:l,meanPerField:a?.[Xt(u,A.Average)],stdDevPerField:a?.[Xt(u,A.StandardDeviation)]})),s.set(u,{...s.get(u)??{},...c})})}),Array.from(s.values())}function em(t){let{data:e,yList:r,calculateZScore:i=!1,meanAndStdDevPerField:n}=t,a=e;return i&&a.forEach(s=>{r.forEach(o=>{Nn({dataItem:s,chartSubType:b.BoxPlotMultiFieldsAndCategory,y:o,meanPerField:n?.[Xt(o,A.Average)],stdDevPerField:n?.[Xt(o,A.StandardDeviation)]})})}),a}function tm(t){let{splitByField:e,x:r,data:i}=t,n=new Map;return i.forEach(a=>{let s=a[r],o={[r]:s},l=a[e];Object.entries(a).forEach(([u,c])=>{if(u.includes(v.rendererSymbolField))o[`${v.rendererSymbolField}_${l?.toString()}`]=c;else if(u===v.boxPlot.boxPlotMeanLineMarkerId)o[u]=a[u];else if(u!==e&&u!==r){let d=u!==v.xAxisField&&u!==v.originalCategoryValue?`${l?.toString()}_${u}`:u;o[d]=c}}),n.set(s,{...n.get(s)??{},...o})}),Array.from(n.values())}function rm(t,e){let{series:r}=t,i=r[0],{y:n}=i,a=W(t.series),s={y:a===b.BoxPlotMultiFieldsAndCategory?n:void 0,chartSubType:a},o=t.series.map(l=>{let u=xe({where:l.query?.where,normalize:!1,escape:!0});return u!==null&&`${u}`.startsWith("'")&&`${u}`.endsWith("'")&&(u=u.substring(1,u.length-1)),u});o.length===0&&o.push(" "),e.forEach(l=>{o.forEach(u=>{s.splitByValue=u;let c=se({...s,key:P.Min,showOutliers:!0}),d=se({...s,key:P.Min,showOutliers:!1}),f=se({...s,key:P.Max,showOutliers:!0}),m=se({...s,key:P.Max,showOutliers:!1});l[f]===void 0&&l[m]!==void 0&&(l[f]=l[m]),l[c]===void 0&&l[d]!==void 0&&(l[c]=l[d])})})}function im(t,e){let r,i,n=t[e[P.IQR]],a=t[e[P.FirstQuartile]],s=t[e[P.ThirdQuartile]];return Number.isFinite(n)&&Number.isFinite(a)&&Number.isFinite(s)&&(r=a-n*1.5,i=s+n*1.5),{outlierMinThreshold:r,outlierMaxThreshold:i}}function Ds(t){let{yField:e,xField:r,xValue:i,splitByField:n,splitByValue:a,outlierMaxThreshold:s,outlierMinThreshold:o,target:l}=t,u;if(r!==void 0&&i!==void 0){let f=typeof i!="string"?i:`'${Er(i)}'`;u=`${r}=${f.toString()}`}let c;if(n!==void 0&&a!==void 0){let f=typeof a!="string"?a:`'${Er(a)}'`;c=`${n}=${f.toString()}`}let d;return l==="outliers"&&o!==s?d=`(${e}<${o} OR ${e}>${s})`:l==="alternativeData"&&(o===s?d=`(${e}=${o})`:d=`(${e}>=${o} AND ${e}<=${s})`),[u,c,d].filter(f=>f!==void 0).join(" AND ")}function To(t){let{data:e,yField:r,x:i,chartSubType:n,splitByField:a}=t,s=n===b.BoxPlotMonoField||n===b.BoxPlotMonoFieldAndCategory||n===b.BoxPlotMonoFieldAndSplitBy||n===b.BoxPlotMonoFieldAndCategoryAndSplitBy?void 0:r,o=Yt(s),l=[],u=[],{maxOperandsPerWhereClause:c}=nr(),d=[],f=[],m=1;return e.forEach((h,g)=>{let{outlierMinThreshold:y,outlierMaxThreshold:p}=im(h,o);if(typeof y=="number"&&typeof p=="number"){let F={yField:r,outlierMinThreshold:y,outlierMaxThreshold:p};(n===b.BoxPlotMonoFieldAndCategory||n===b.BoxPlotMultiFieldsAndCategory||n===b.BoxPlotMonoFieldAndCategoryAndSplitBy)&&i!==void 0&&i in h&&(F.xField=i,F.xValue=vn({value:h[i],dataContext:h})),(n===b.BoxPlotMonoFieldAndSplitBy||n===b.BoxPlotMultiFieldsAndSplitBy||n===b.BoxPlotMonoFieldAndCategoryAndSplitBy)&&a!==void 0&&a in h&&(F.splitByField=a,F.splitByValue=h[a]),d.push(Ds({...F,target:"outliers"})),f.push(Ds({...F,target:"alternativeData"})),(m%c===0||g===e.length-1)&&(l.push(ee(d,"OR")),u.push(ee(f,"OR")),d=[],f=[])}m+=1}),{outliersFilterBatches:l,dataWithoutOutliersFilterBatches:u}}function nm(t){let{data:e,outlierDataItem:r,chartSubType:i,x:n,y:a,meanAndStdDevPerField:s,splitByField:o}=t,l=s?.[Xt(a,A.Average)],u=s?.[Xt(a,A.StandardDeviation)];if(l===void 0&&u===void 0)switch(i){case b.BoxPlotMultiFields:{let c=Yt(a),d=e[0];l=Number(d[c[P.Average]]),u=Number(d[c[P.StandardDeviation]]);break}case b.BoxPlotMultiFieldsAndCategory:{let c=e.find(d=>d[n]===r[n]);if(c!==void 0){let d=Yt(a);l=Number(c[d[P.Average]]),u=Number(c[d[P.StandardDeviation]])}break}case b.BoxPlotMultiFieldsAndSplitBy:{let c=e.find(d=>d[o]===r[o]);if(c!==void 0){let d=Yt(a);l=Number(c[d[P.Average]]),u=Number(c[d[P.StandardDeviation]])}break}}return{mean:l,stdDev:u}}async function am(t){let{seriesConfig:e,data:r,uniqueQuery:i,queryObject:n,meanAndStdDevPerField:a,errorStrings:s,abortKey:o,abortSignal:l}=t,u=W(e),c=e[0],{x:d}=c,f=de(c.query?.where),m=U(n),h=We(m).idField,g=Se(e),y=[];for(let C=0;C<g.length;C+=1){let x=g[C],{outliersFilterBatches:w}=To({data:r,yField:x,x:d,chartSubType:u,splitByField:f});for(let N=0;N<w.length;N+=1){let O=w[N];if(O!==""){let T=[];d!==v.boxPlot.boxPlotCategory&&T.push(d),T.push(x),f!==""&&T.push(f),T.push(h);let B={...i,where:ee([i.where,O]),groupByFieldsForStatistics:void 0,outStatistics:void 0,orderByFields:void 0,num:void 0,outFields:T};y.push(Le({queryObject:n,queryConfig:B,featureCount:1,errorStrings:s,abortKey:o,abortSignal:l}))}}}let p=await Promise.all(y),F=new Map;for(let C=0;C<p.length;C+=1){let x=p[C],w=g[C];x.forEach(N=>{let O={...N.attributes};if(O[w]!==void 0){d===v.boxPlot.boxPlotCategory&&(O[v.boxPlot.boxPlotCategory]=w);let T={key:P.Outlier,chartSubType:u};switch(u){case b.BoxPlotMonoFieldAndSplitBy:case b.BoxPlotMultiFieldsAndSplitBy:case b.BoxPlotMonoFieldAndCategoryAndSplitBy:T={...T,splitByValue:O[f]};break;case b.BoxPlotMultiFieldsAndCategory:T={...T,y:w};break}let B=se(T),M=O[w];O[B]=M;let q=`${O[d]}-${O[f]}-${M}`,I=F.get(q);if(O[G.uniqueIdsName]=[...I?.[G.uniqueIdsName]??[],O[h]],delete O[h],jo(u)){let k=se({...T,standardizeValues:!0}),{mean:_,stdDev:E}=nm({data:r,outlierDataItem:O,chartSubType:u,x:d,y:w,splitByField:f,meanAndStdDevPerField:a});_!==void 0&&E!==void 0&&(O[k]=yn({value:M,mean:_,stdDev:E}))}delete O[w],O[v.boxPlot.boxPlotOutlierId]=!0,F.set(q,O)}})}return Array.from(F.values())}async function sm(t){let{data:e,queryObject:r,uniqueQuery:i,elementCount:n,chartConfig:a,chartLimits:s,errorStrings:o,abortKey:l,abortSignal:u}=t,c=[],{series:d,showMean:f}=a,m=In({showMean:f,seriesConfig:d}),h=W(d),g=mt(a),{x:y}=g,p=de(g.query?.where),F=[];for(let x=0;x<m.length;x+=1){let w=m[x],{dataWithoutOutliersFilterBatches:N}=To({data:e,yField:w,x:y,chartSubType:h,splitByField:p});for(let O=0;O<N.length;O+=1){let T=N[O],B={...i,where:ee([i.where,T])};B.outStatistics!==void 0&&(B.outStatistics=B.outStatistics?.filter(M=>(M.statisticType===A.Minimum||M.statisticType===A.Maximum)&&M.onStatisticField===w).map(M=>({...M,outStatisticFieldName:`${M.outStatisticFieldName}${v.boxPlot.boxPlotOutliersSuffix}`}))),F.push(di({queryObject:r,uniqueQuery:B,chartConfig:a,elementCount:n,isTimeBinningSeries:!1,showMean:f,chartLimits:s,errorStrings:o,abortKey:l,abortSignal:u}))}}let C=await Promise.all(F);for(let x=0;x<C.length;x+=1)c.push(...C[x]);return h!==b.BoxPlotMonoFieldAndCategoryAndSplitBy&&h!==b.BoxPlotMonoField&&(c=br({data:c,x:p!==void 0&&p!==""?p:y})),c}async function om(t){let{queryObject:e,uniqueQuery:r,chartConfig:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o,{series:l,showMean:u}=i,c=W(l);if(c===b.BoxPlotMultiFieldsAndCategory||c===b.BoxPlotMultiFieldsAndSplitBy){let d=In({showMean:u,seriesConfig:l}),f={...r};delete f.outStatistics,delete f.groupByFieldsForStatistics,delete f.orderByFields;let m=[];for(let g=0;g<d.length;g+=1){let y=d[g];m.push({statisticType:A.Average,onStatisticField:y,outStatisticFieldName:`${A.Average}_${y}`},{statisticType:A.StandardDeviation,onStatisticField:y,outStatisticFieldName:`${A.StandardDeviation}_${y}`})}f.outStatistics=m;let h=await Le({queryObject:e,queryConfig:f,featureCount:1,errorStrings:n,abortKey:a,abortSignal:s});h.length>0&&(o=h[0].attributes)}return o}function lm(t){let{data:e,additionalData:r,chartConfig:i}=t,n=i.series[0],{x:a}=n,s=de(n.query?.where);return e.map(o=>{let l=o,u=r.find(c=>c[a]===o[a]&&(s===""?!0:c[s]===o[s]));return u!==void 0&&(l={...o,...u}),l})}function Oo(t){let{chartConfig:e,data:r,calculateZScore:i=!1,meanAndStdDevPerField:n}=t,{series:a,showMean:s}=e,o=mt(e),l=W(e.series),{x:u}=o,c=In({showMean:s,seriesConfig:a}),d=r;if(r?.[0]!==void 0){let f=de(o.query?.where);switch(l){case b.BoxPlotMonoField:d[0][v.boxPlot.boxPlotCategory]=c[0];break;case b.BoxPlotMultiFields:d=Kf({data:r,yList:c,calculateZScore:i});break;case b.BoxPlotMonoFieldAndSplitBy:d=Jf({data:r,splitByField:f,y:c[0]});break;case b.BoxPlotMultiFieldsAndSplitBy:d=Xf({splitByField:f,data:r,yList:c,meanAndStdDevPerField:n,calculateZScore:i});break;case b.BoxPlotMultiFieldsAndCategory:d=em({data:r,yList:c,meanAndStdDevPerField:n,calculateZScore:i});break;case b.BoxPlotMonoFieldAndCategoryAndSplitBy:d=tm({splitByField:f,x:u,data:r});break;case b.BoxPlotMonoFieldAndCategory:}}return rm(e,d),d}async function um(t){let{data:e,queryObject:r,uniqueQuery:i,fetchFullBoxPlotData:n,chartConfig:a,elementCount:s,chartLimits:o,errorStrings:l,abortKey:u,abortSignal:c}=t,d=e,f=[];if(d!==void 0){let{series:m}=a,h=await om({queryObject:r,uniqueQuery:i,chartConfig:a,errorStrings:l,abortKey:u,abortSignal:c});if(n!==!1){f=await am({queryObject:r,uniqueQuery:i,seriesConfig:m,data:d,errorStrings:l,abortKey:u,abortSignal:c});let g=await sm({queryObject:r,uniqueQuery:i,elementCount:s,data:e,chartConfig:a,chartLimits:o,errorStrings:l,abortKey:u,abortSignal:c});d=lm({data:d,additionalData:g,chartConfig:a})}d=Oo({chartConfig:a,data:d,meanAndStdDevPerField:h,calculateZScore:!0})}return{dataItems:d,outliers:f}}function cm(t,e,r){let i=0;if(Array.isArray(r)){let n=t?.toString()??"",a=e?.toString()??"",s=r.indexOf(n),o=r.indexOf(a);s===-1&&(s=r.length),o===-1&&(o=r.length),i=s-o}else r===be.Descending?typeof t=="string"&&typeof e=="string"?i=e.localeCompare(t,void 0,{numeric:!0}):i=(Number(e)||0)-(Number(t)||0):r===be.Ascending&&(typeof t=="string"&&typeof e=="string"?i=t.localeCompare(e,void 0,{numeric:!0}):i=(Number(t)||0)-(Number(e)||0));return i}function Ps(t){let{chartConfig:e,field:r,chartData:i}=t,n=Zc({chartConfig:e,field:r}),a=Array.from(new Set(i.map(s=>r in s?s[r]:void 0)));return n&&a.length>1&&a.sort((s,o)=>cm(s,o,n)),a.map(s=>({[r]:s}))}function Bo(t){let{chartConfig:e,chartData:r}=t;return{xAxisData:Ps({chartConfig:e,field:j.xField,chartData:r}),yAxisData:Ps({chartConfig:e,field:j.yField,chartData:r})}}function ks(t){let{orderBy:e,axisFormatOptions:r}=t;return e!==void 0&&r!==void 0&&(!Array.isArray(e)||r?.type===S.CategoryAxisFormat)}function Vs(t,e,r){let i=0;if(Array.isArray(r)){let n=t?.toString()??"",a=e?.toString()??"",s=r.indexOf(n),o=r.indexOf(a);s===-1&&(s=r.length),o===-1&&(o=r.length),i=s-o}else r===be.Descending?typeof t=="string"&&typeof e=="string"?i=e.localeCompare(t,void 0,{numeric:!0}):i=(Number(e)||0)-(Number(t)||0):r===be.Ascending&&(typeof t=="string"&&typeof e=="string"?i=t.localeCompare(e,void 0,{numeric:!0}):i=(Number(t)||0)-(Number(e)||0));return i}function dm(t){let{arrayToSort:e,chartConfig:r,dataOrderParameters:i}=t,n=i??ii(r),a,s,o=!1,l=!1,u=!1;n&&e.length>1&&([a,s]=n,o=a&&a.sortingField.length>0&&ks({orderBy:a.orderBy,axisFormatOptions:r.axes?.[0]?.valueFormat}),l=s&&s.sortingField.length>0&&ks({orderBy:s.orderBy,axisFormatOptions:r.axes?.[1]?.valueFormat}),u=o||l),u&&e.sort((c,d)=>{let f=0;if(o&&a?.sortingField){let m=a.orderBy;f=Vs(c[a.sortingField],d[a.sortingField],m)}if(f===0&&l&&s?.sortingField){let m=s.orderBy;f=Vs(c[s.sortingField],d[s.sortingField],m)}return f})}function fm(t){let{chartConfig:e,chartData:r}=t;r.heatChartAxesData=Bo({chartConfig:e,chartData:r.dataItems})}function si(t){let{arrayToSort:e,chartConfig:r,fieldList:i,isTimeBinningSeries:n}=t;if(n!==!0&&e[0]!==void 0){let{series:a}=r,s=W(a),o=Z(a),l=$e(r),u=ii(r);if(Tt(r)&&e!==void 0)dm({arrayToSort:e,chartConfig:r,dataOrderParameters:u});else if(u?.[0]!==void 0&&e!==void 0&&e.length>1){let{orderBy:c}=u[0],{sortingField:d}=u[0],f=r.orderOptions?.data?.orderType===Ue.Category,m=u[0].preferLabel!==!1,h=s===b.BarAndLineFromFields||s===b.PieFromFields||s===b.BoxPlotMultiFields||s===b.BoxPlotMultiFieldsAndSplitBy,g=h||o===S.PieSeries,y=s===b.PieNoAggregation||s===b.BarAndLineNoAggregation||s===b.BarAndLineSplitByNoAggregation;if(f&&g&&(!m||(o===S.LineSeries||o===S.RadarSeries)&&l===S.NumberAxisFormat)&&(d=v.originalCategoryValue),Array.isArray(c))Gc({arrayToSort:e,orderBy:c,sortingField:d,fieldList:i,isByFieldsChart:h,preferLabel:m});else{let p=l===S.DateAxisFormat&&f;gr({arrayToSort:e,orderBy:c,sortingField:d,forceAscendingOrder:p,isNonAggregated:y,sortByCategory:f,preferLabel:m,isPieOrByFieldsChart:g})}}}}function e0(t){let{alteredConfig:e,dataInfo:r,fieldList:i,options:n,queryObject:a}=t,s=Mn(r.data);if(s&&si({arrayToSort:s,chartConfig:e,fieldList:i,isTimeBinningSeries:Xe({seriesConfig:mt(e),xAxisValueFormatType:$e(e),setTimeBinningInfoWhenNotProvided:n?.setTimeBinningInfoWhenNotProvided,queryObject:a})}),Fe(e)){let o=r?.data&&"meanLines"in r.data?r.data.meanLines:void 0;o&&si({arrayToSort:o,chartConfig:e})}Tt(e)&&r.data&&fm({chartConfig:e,chartData:r.data})}function mm(t){return t?.type==="uniqueValue"&&(t.uniqueValueInfos=t.uniqueValueInfos.map(e=>{let r=e.value===null?v.nullValue:e.value;return{...e,value:r}})),t}async function t0(t){let{data:e,queryObject:r,chartConfig:i,allowColorMatch:n}=t,a=!1,s=[];if(n&&!oe(r)){let{series:o,chartRenderer:l}=i,u=mm(l),c=u?Gt.ChartRenderer:Gt.LayerRenderer,d=r?U(r):void 0,f=u??d?.renderer,m;d&&c===Gt.LayerRenderer?s=await bo(d):c===Gt.ChartRenderer&&(s=dd(f));let h=rd(u,d?.renderer),g=od({chartRenderer:l,queryObject:r}),y=Z(o),p=W(o),F=mt(i),C=de(F.query?.where);m=new Map;for(let x=0;x<(y===S.HistogramSeries&&e.length>0?1:e.length);x+=1){let w=e[x],N=await ld({seriesConfig:i.series,dataItem:w,renderer:f,rendererType:h,rendererOrigin:c,chartSubType:p,splitByField:C,graphicTemplate:g,mapAttributesToSymbol:m,rendererFieldNames:s});a=a||N.colorMatchApplied}}return{dataItems:e,colorMatchApplied:a,rendererFieldNames:s}}async function hm(t){let{queryObject:e,queryConfig:r,chartConfig:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o=i.series[0],{x:l,valueConversion:u}=o,c=Wo(i),d=await Le({queryObject:e,queryConfig:r,featureCount:r.num??1,errorStrings:n,abortKey:a,abortSignal:s}),f=[{[l]:null}];if(c)f=d.map(m=>{On(m.attributes,l);let h=Ms(m.attributes[l],u);return{...m.attributes,[l]:h}});else if(d.length>0){let m=d[0].attributes[l]??d[0].attributes[l.toUpperCase()]??d[0].attributes[l.toLowerCase()];m=Ms(m,u),f=[{[l]:m}]}return f}async function ym(t){let{queryObject:e,chartConfig:r,queryConfig:i,chartLimits:n,errorStrings:a,abortKey:s,abortSignal:o}=t,l={valid:!0},{behaviorAfterLimit:u,maxGaugeByFeaturesLimit:c}=n??{},d=Wo(r),f=!0,m;if(d&&(m=(await Vo({chartConfig:r,queryObject:e,queryConfig:i,behaviorAfterLimit:u,numberMaxOfFeaturesToFetch:c,isGaugeByFeature:d,abortSignal:o})).elementCount,n?.behaviorAfterLimit!==St.RenderUpToTheLimit&&(f=je({count:m??0,seriesCount:r.series.length,chartType:S.GaugeSeries,chartLimits:n})),n&&(Number.isFinite(c)||Number.isFinite(m)))){let h=Math.min(c??Number.NaN,m??Number.NaN),g=n;Number.isFinite(h)&&(g={...n,maxGaugeByFeaturesLimit:h}),oo({chartConfig:r,chartLimits:g,uniqueQuery:i})}if(Number.isNaN(f)||f){let h=await hm({queryObject:e,chartConfig:r,queryConfig:i,errorStrings:a,abortKey:s,abortSignal:o});l.data={dataItems:h},l.count=h.length}else l.count=m,ai({dataInfo:l,chartType:S.GaugeSeries});return l}async function r0(t){let{queryObject:e,chartConfig:r,queryConfig:i,errorStrings:n}=t,{minimumFromField:a,maximumFromField:s}=r.axes[0],o=[],l="",u="";a!==void 0&&(typeof a=="string"?(l=`${A.Minimum}_${a}`,o.push({statisticType:A.Minimum,onStatisticField:a,outStatisticFieldName:l})):(l=`${a.statisticType}_${a.onStatisticField}`,o.push({...a,outStatisticFieldName:l}))),s!==void 0&&(typeof s=="string"?(u=`${A.Maximum}_${s}`,o.push({statisticType:A.Maximum,onStatisticField:s,outStatisticFieldName:u})):(u=`${s.statisticType}_${s.onStatisticField}`,o.push({...s,outStatisticFieldName:u})));let c={...i,outStatistics:o,orderByFields:void 0,groupByFieldsForStatistics:void 0,returnDistinctValues:void 0,fetchNullValues:void 0,num:void 0};Dt(e);let d=await vr({queryObject:e,queryConfig:c,errorStrings:n}),f=d.get(l),m=d.get(u);return{minimumFromData:f,maximumFromData:m}}function gm(t){let{itemsA:e,itemsB:r,isPieFromFields:i,x:n,y:a,outStatisticFieldName:s}=t,o=tt(e),l=tt(r),u=!1;if(o===void 0&&l!==void 0||o!==void 0&&l===void 0)u=!0;else if(!i){let c=[v.originalCategoryValue,v.originalYCategoryValue,v.originalDateValue,v.xAxisField,v.technicalSortingFieldBySum,v.technicalSortingFieldByPercent,v.pieChart.technicalFieldSlicePercent,v.pieChart.technicalFieldGroupedSlices,v.pieChart.technicalFieldSliceId,v.originalServerBinningRange,v.lastTemporalBin,v.technicalFieldSplitByField,G.uniqueIdsName,j.valueField,...Vn],d=(g,y)=>{let p=y[v.originalCategoryValue];p!==void 0&&n&&(y[n]=p);let F=y[v.originalYCategoryValue];F!==void 0&&a&&(y[a]=F),n&&y[j.xField]!==void 0&&(y[n]=y[v.originalCategoryValue]!==void 0?y[v.originalCategoryValue]:y[j.xField],delete y[j.xField]),a&&y[j.yField]!==void 0&&(y[a]=y[v.originalYCategoryValue]!==void 0?y[v.originalYCategoryValue]:y[j.yField],delete y[j.yField]),s&&y[j.valueField]!==void 0&&(y[s]=y[j.valueField],delete y[j.valueField]);let C={};return Object.keys(y).forEach(x=>{!c.includes(x)&&!x.includes(v.rendererSymbolField)&&(C[x]=y[x])}),g.push(C),g},f=(g,y)=>JSON.stringify(g).localeCompare(JSON.stringify(y)),m=o?.reduce(d,[])?.sort(f),h=l?.reduce(d,[])?.sort(f);m&&h&&n&&m.length!==h.length&&(m=br({data:m,x:n}),h=br({data:h,x:n})),u=m?.length!==h?.length||!yt(m,h)}return u}function pm(t){let{chartConfig:e,currentSelectionDataItems:r,selectionData:i}=t,n=[];if(e!==void 0){let a=e.series,s=W(a),{selectionItems:o}=i??{};if(o!==void 0&&gm({itemsA:o,itemsB:r,isPieFromFields:W(e.series)===b.PieFromFields,x:e.series[0].x,y:"y"in e.series[0]?e.series[0].y.toString():void 0,outStatisticFieldName:e.series[0].query?.outStatistics?.[0]?.outStatisticFieldName})?n=o:n=r??[],a.length>1&&s!==b.BarAndLineNoAggregation&&s!==b.BarAndLineSplitByNoAggregation){let l=de(a[0].query?.where);n=br({data:n,x:a[0].x,splitByField:l})}si({arrayToSort:n,chartConfig:e})}return n??[]}function dt(t,e){let r="";if(t.trim()!==""&&e!==void 0)if(e===null)r=`${t} IS NULL`;else{let i=typeof e!="number"?"'":"";r=`${t}=${i}${e.toString()}${i}`}return r}function Sm(t){let{dataContext:e,xAxisField:r,yAxisField:i,options:n}=t,a="",{dataContextXMinField:s,dataContextXMaxField:o,dataContextYMinField:l,dataContextYMaxField:u}=v.scatterplotAggregationFields;if(eo({dataContext:e,chartLimits:n?.chartLimits})){let{[s]:c,[o]:d}=e,f=r!==i?e[l]:c,m=r!==i?e[u]:d;if(!Number.isNaN(c)&&!Number.isNaN(d)&&!Number.isNaN(f)&&!Number.isNaN(m)){let h=[];c===d?h.push(`${r}=${c?.toString()}`):(h.push(`${r}>=${c?.toString()}`),h.push(`${r}<=${d?.toString()}`)),f===m?h.push(`${i}=${f?.toString()}`):(h.push(`${i}>=${f?.toString()}`),h.push(`${i}<=${m?.toString()}`)),a=ee(h)}}else a=ee([Je({where:dt(r,e[r])}),i!==void 0?Je({where:dt(i,e[i])}):""]);return a}function $s(t){let{fieldsIndex:e,fieldName:r,inputDate:i}=t,n=e.get(r),a=e.getTimeZone(r);return Qu(new Date(i),{type:"date"},{type:n,timeZone:a})}function Mo(t){let{xAxisField:e,dataContext:r,queryObject:i}=t,n="",a=r[v.originalServerBinningRange]??r[v.dateBinningRange];if(Or(a)&&a.length===2){let[s,o]=a,l=!0,u=ct(i);if(u){let c=U(i),{fieldsIndex:d}=c;s=$s({fieldsIndex:d,fieldName:e,inputDate:s}),o=$s({fieldsIndex:d,fieldName:e,inputDate:o})}else typeof s=="number"&&typeof o=="number"?Number.isFinite(s)&&Number.isFinite(o)?(s=Kt(s),o=Kt(o)):l=!1:typeof s=="string"&&typeof o=="string"&&(s=new Date(s).toISOString(),o=new Date(o).toISOString());if(l){let c=u?"":"'",d=r[v.lastTemporalBin]===!0?"<=":"<";n=`${e}>=${c}${s}${c} AND ${e}${d}${c}${o}${c}`}}return n}function Io(t,e){let r="";if(Number.isFinite(t)){let i=1/10**v.queryMaxFloatPrecision;r=`${e}>=${t-i} AND ${e}<=${t+i}`}return r}function Eo(t){let{xAxisField:e,yAxisField:r,splitBy:i,dataContext:n,xAxisFieldType:a,chartConfig:s}=t,o="";if(e!==void 0&&e!==v.boxPlot.boxPlotCategory){let c=vn({value:n[e],dataContext:n});a===Q.Double?o=Io(c,e):(Nt(s.axes?.[0].valueFormat)&&(c=Kt(c)),o=Je({where:dt(e,c),normalize:!1,escape:!0}))}let l=Je({where:i??"",normalize:!1,escape:!0}),u="";if(yd(s)){let c=W(s.series)===b.BoxPlotMultiFieldsAndCategory?r:void 0,d=se({key:P.Min,showOutliers:!0,splitBy:i,y:c}),f=se({key:P.Max,showOutliers:!0,splitBy:i,y:c}),m=e===v.boxPlot.boxPlotCategory?n[e]:r;if(!he(m)){let h=n[d],g=n[f];Number.isFinite(h)&&Number.isFinite(g)&&(u=`${m?.toString()}>=${h?.toString()} AND ${m?.toString()}<=${g?.toString()}`)}}return ee([o,l,u])}function bm(t){let{xAxisField:e,splitBy:r,dataContext:i,xAxisFieldType:n,chartConfig:a,queryObject:s}=t,o="";if(v.dateBinningRange in i)o=Mo({xAxisField:e,dataContext:i,queryObject:s});else if(W(a.series)!==b.BarAndLineFromFields){let u=vn({value:i[e],dataContext:i});n===Q.Double?o=Io(u,e):(Nt(a.axes?.[0].valueFormat)&&n!==Q.TimeOnly&&(u=Kt(u)),o=Je({where:dt(e,u),normalize:!1,escape:!0}))}let l=Je({where:r??"",normalize:!1,escape:!0});return ee([o,l])}function vm(t){let{xAxisField:e,dataContext:r,chartConfig:i}=t,n=r[v.originalCategoryValue];return n===void 0&&(n=r[e]),W(i.series)===b.PieFromFields?"":Je({where:dt(e,n),normalize:!1,escape:!0})}function Rs(t){let{field:e,fieldType:r,fieldValue:i,unit:n,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o}=t,l,{expression:u}=Cn({field:e,fieldType:r,unit:n,addIntervalStatement:!0,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o});return u&&(l=`${u}=${i}`),l}function Fm(t){let{xAxisFieldType:e,yAxisFieldType:r,dataContext:i,chartConfig:n,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o}=t,l=n.series[0],u="";if(l.type===S.HeatSeries){let c,d,f=i[j.xField],m=i[v.originalCategoryValue],h=i[j.yField],g=i[v.originalYCategoryValue],y=n.axes?.[0]?.valueFormat?.type,p=n.axes?.[1]?.valueFormat?.type;y===S.CategoryAxisFormat?c=Je({where:dt(l.x,m??f),normalize:!1,escape:!0}):c=Rs({field:l.x,fieldType:e,fieldValue:f,unit:l.xTemporalBinning?.unit,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o}),p===S.CategoryAxisFormat?d=Je({where:dt(l.y,g??h),normalize:!1,escape:!0}):d=Rs({field:l.y,fieldType:r,fieldValue:h,unit:l.yTemporalBinning?.unit,outTimeZone:a,dataTimeZone:s,runsOnClientQueryEngine:o}),c&&(u=c),d&&(u=ee([u,d]))}return u}function xm(t){let{xAxisField:e,dataContext:r,chartConfig:i}=t,n="",a=i.series[0],{minValue:s,maxValue:o}=r;if(Number.isFinite(s)&&Number.isFinite(o)&&a.type===S.HistogramSeries){let l=Yc(e,a.dataTransformationType),u=r.isLastBin?"<=":"<";n=ee([`${l}>=${s?.toString()}`,`${l}${u}${o?.toString()}`])}return n}function i0(t){let{chartConfig:e}=t,r=Z(e.series),i="";switch(r){case S.ScatterSeries:i=Sm(t);break;case S.HeatSeries:i=Fm(t);break;case S.RadarSeries:case S.BarSeries:case S.LineSeries:case S.ComboLineAndBarSeries:i=bm(t);break;case S.BoxPlotSeries:i=Eo(t);break;case S.HistogramSeries:i=xm(t);break;case S.PieSeries:i=vm(t);break}return i}async function Cm(t){let{queryObject:e,queryConfig:r,chartConfig:i,currentSelectionDataItems:n,setTimeBinningInfoWhenNotProvided:a,returnFeaturesExtent:s,chartLimits:o,popupTemplateFieldInfosEnabled:l,hideZeroCountCategories:u,replaceNoValueCategoryWithZero:c,view:d,errorStrings:f,abortKey:m,abortSignal:h}=t,g=W(i.series),y={valid:!0,data:{dataItems:[]}};if(n!==void 0&&n.length>0){let p=mt(i),{x:F}=p,C="y"in p?p.y:"",x=Re(e).find(M=>M.name===F)?.type,w=[],N=n.reduce((M,q)=>{let I=[];if(G.uniqueIdsName in q)w.push(q[G.uniqueIdsName]);else{switch(g){case b.BoxPlotMonoFieldAndSplitBy:case b.BoxPlotMultiFieldsAndSplitBy:case b.BoxPlotMonoFieldAndCategoryAndSplitBy:{let E=de(p.query?.where??""),D=`_${P.Average}`;Object.keys(q).forEach(Y=>{if(Y.includes(D)){let J=Y.replace(D,"");J.trim()!==""&&I.push(dt(E,J))}});break}}let k=[C].flat(),_=k.length===1?k[0]:"";if(g===b.BoxPlotMultiFieldsAndCategory){let E=`_${P.FirstQuartile}`,D=Object.keys(q).find(Y=>Y.includes(E));D!==void 0&&(_=D.replace(E,""))}I.length===0&&I.push(""),I.forEach(E=>{let D=Eo({chartConfig:i,xAxisField:F,yAxisField:_,splitBy:E,dataContext:q,xAxisFieldType:x});M.push(D)})}return M},[]),O=U(e);if(O!==void 0&&w.length>0){let M=We(O).idField;N.push(`${M} IN (${w.join(",")})`)}let T=N.join(" OR "),B={...r};B.where=ee([B.where,T]),y=await Tn({queryObject:e,chartConfig:i,queryConfig:B,setTimeBinningInfoWhenNotProvided:a,returnFeaturesExtent:s,chartLimits:o,popupTemplateFieldInfosEnabled:l,hideZeroCountCategories:u,replaceNoValueCategoryWithZero:c,view:d,errorStrings:f,abortKey:m,abortSignal:h})}return y}async function wm(t){let{queryObject:e,queryConfig:r,chartConfig:i,currentSelectionDataItems:n,dataForFilterBySelectionChanged:a,selectionData:s,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,hideZeroCountCategories:d,replaceNoValueCategoryWithZero:f,view:m,errorStrings:h,abortKey:g,abortSignal:y}=t;Dt(e);let{series:p}=i,F=Z(p),C=$e(i),x={valid:!0},w=s?.selectionItems??[];a||(w=pm({chartConfig:i,currentSelectionDataItems:n,selectionData:s}));let N=!1;switch(F){case S.HeatSeries:x.data={dataItems:w};break;case S.PieSeries:if(W(i.series)===b.PieFromFields){let{x:O,y:T}=i.series[0],B=tt(w);B.forEach(M=>{O in M&&(M[ve]=M[O],delete M[O]),T in M&&(M[ze]=M[T],delete M[T])}),x.data={dataItems:B}}else x.data={dataItems:w};x.count=w.length,N=!0;break;case S.BoxPlotSeries:Fe(i)&&(x=await Cm({queryObject:e,queryConfig:r,chartConfig:i,currentSelectionDataItems:n,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,hideZeroCountCategories:d,replaceNoValueCategoryWithZero:f,view:m,errorStrings:h,abortKey:g,abortSignal:y}));break;case S.BarSeries:case S.ComboLineAndBarSeries:case S.RadarSeries:case S.LineSeries:if(w.length===0||!Xe({xAxisValueFormatType:C,setTimeBinningInfoWhenNotProvided:o,seriesConfig:p[0],queryObject:e}))x.data={dataItems:w},x.count=w.length*p.length,N=!0;else{let O={...r};if(n!==void 0&&n.length>0){let T=n.map(M=>Mo({xAxisField:p[0].x,dataContext:M,queryObject:e})),B=ee(T,"OR");O.where=ee([O.where,B])}x=await Bn({queryObject:e,queryConfig:O,chartConfig:i,errorStrings:h,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,view:m,abortSignal:y})}break;case S.HistogramSeries:{if(w.length===0)x.data={mean:Number.NaN,median:Number.NaN,stddev:Number.NaN,max:Number.NaN,min:Number.NaN,bins:[]},x.count=0;else{let{x:O}=p[0],T=w.map((q,I)=>{let{minValue:k,maxValue:_}=q,E=I===w.length-1?"<=":"<";return`${O} >= ${k} AND ${O} ${E} ${_}`}),B=ee(T,"OR"),M={...r};M.where=ee([M.where,B]),x=await wo({queryObject:e,chartConfig:i,queryConfig:M,view:m,errorStrings:h,abortKey:g,abortSignal:y})}break}case S.ScatterSeries:{if(w.length===0){let{r2:O,trendLinePoints:T}=v.scatterplotSeries;x.data={dataItems:[],r2:O,trendLinePoints:T,count:0},x.count=0}else{let{r2:O,trendLinePoints:T}=fo({data:w,chartConfig:i});x.data={dataItems:w,r2:O,trendLinePoints:T},x.count=w.length}break}}return N&&x.data!==void 0&&si({arrayToSort:"dataItems"in x.data?x.data.dataItems:x.data,chartConfig:i}),x}async function Tn(t){let{queryObject:e,chartConfig:r,queryConfig:i,errorStrings:n,abortKey:a,abortSignal:s,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,hideZeroCountCategories:d,replaceNoValueCategoryWithZero:f,view:m}=t,h={valid:!0},g=Jt(r),y=await gn({queryObject:e,queryConfig:i,fetchFullBoxPlotData:!g,chartConfig:r,errorStrings:n,abortKey:a,abortSignal:s,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,hideZeroCountCategories:d,replaceNoValueCategoryWithZero:f,view:m});if(!g)h=y;else{let p={dataItems:[]};p.meanLines=y.data.dataItems;let F=Hf(r),C=(await gn({queryObject:e,queryConfig:i,fetchFullBoxPlotData:!0,setTimeBinningInfoWhenNotProvided:o,returnFeaturesExtent:l,chartLimits:u,popupTemplateFieldInfosEnabled:c,hideZeroCountCategories:d,replaceNoValueCategoryWithZero:f,view:m,errorStrings:n,chartConfig:F,abortKey:a,abortSignal:s})).data;p.dataItems=C.dataItems,p.outliers=C.outliers,h.data=p}return h}async function Nm(t){let{queryObject:e,chartConfig:r,queryConfig:i,filterBySelection:n,selectionData:a,setTimeBinningInfoWhenNotProvided:s,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,hideZeroCountCategories:c,replaceNoValueCategoryWithZero:d,view:f,syncViewTimeZone:m,errorStrings:h,abortKey:g,abortSignal:y,fieldList:p,currentSelectionDataItems:F,dataForFilterBySelectionChanged:C,preFetchedQueryResponse:x}=t,{series:w}=r,N=Z(w),O={valid:!0};if(n)O=await wm({queryObject:e,queryConfig:i,chartConfig:r,currentSelectionDataItems:F,dataForFilterBySelectionChanged:C,selectionData:a,setTimeBinningInfoWhenNotProvided:s,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,hideZeroCountCategories:c,replaceNoValueCategoryWithZero:d,view:f,errorStrings:h,abortKey:g,abortSignal:y});else switch(N){case S.HeatSeries:Dt(e),O=await $o({chartConfig:r,queryConfig:i,queryObject:e,errorStrings:h,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,view:f,syncViewTimeZone:m,abortKey:g,abortSignal:y});break;case S.BoxPlotSeries:Fe(r)&&(O=await Tn({queryObject:e,chartConfig:r,queryConfig:i,setTimeBinningInfoWhenNotProvided:s,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,hideZeroCountCategories:c,replaceNoValueCategoryWithZero:d,view:f,errorStrings:h,abortKey:g,abortSignal:y}));break;case S.BarSeries:case S.ComboLineAndBarSeries:case S.PieSeries:case S.RadarSeries:case S.LineSeries:{let T={queryObject:e,queryConfig:i,chartConfig:r,errorStrings:h,setTimeBinningInfoWhenNotProvided:s,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,hideZeroCountCategories:c,replaceNoValueCategoryWithZero:d,view:f,abortKey:g,abortSignal:y,fieldList:p,preFetchedQueryResponse:x};Xe({xAxisValueFormatType:$e(r),setTimeBinningInfoWhenNotProvided:s,seriesConfig:w[0],queryObject:e})?O=await Bn(T):O=await gn(T);break}case S.ScatterSeries:O.data=await Ro({queryObject:e,queryConfig:i,setTimeBinningInfoWhenNotProvided:s,returnFeaturesExtent:o,chartLimits:l,popupTemplateFieldInfosEnabled:u,hideZeroCountCategories:c,replaceNoValueCategoryWithZero:d,view:f,chartConfig:r,errorStrings:h,abortKey:g,abortSignal:y});break;case S.HistogramSeries:O=await wo({queryObject:e,queryConfig:i,chartConfig:r,view:f,abortKey:g,abortSignal:y,errorStrings:h});break;case S.GaugeSeries:Dt(e),O=await ym({queryObject:e,chartConfig:r,queryConfig:i,chartLimits:l,errorStrings:h,abortKey:g,abortSignal:y});break}return O}async function n0(t){let{queryObject:e,chartConfig:r,abortKey:i,abortSignal:n,currentSelectionDataItems:a,dataForFilterBySelectionChanged:s,runtimeDataFilters:o,ignoreViewExtent:l,filterBySelection:u,selectionData:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,chartLimits:m,popupTemplateFieldInfosEnabled:h,hideZeroCountCategories:g,replaceNoValueCategoryWithZero:y,view:p,syncViewTimeZone:F,errorStrings:C,fieldList:x,preFetchedQueryResponse:w}=t,N={valid:!0},O=vo({queryObject:e,chartConfig:r,runtimeDataFilters:o,ignoreViewExtent:l,viewExtent:p?.extent});return jd(i),N=await Nm({chartConfig:r,queryObject:e,queryConfig:O,currentSelectionDataItems:a,dataForFilterBySelectionChanged:s,filterBySelection:u,selectionData:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,chartLimits:m,popupTemplateFieldInfosEnabled:h,hideZeroCountCategories:g,replaceNoValueCategoryWithZero:y,view:p,syncViewTimeZone:F,abortKey:i,abortSignal:n,errorStrings:C,fieldList:x,preFetchedQueryResponse:w}),N.queryConfig=O,N}function Tm(t,e,r){let i=new Map;for(let n=0;n<t.length;n+=1){let a={[r]:t[n]};v.xAxisField in a||(a[v.xAxisField]=t[n]),i.set(t[n],a)}for(let n=0;n<e.length;n+=1){let a=e[n][r];(typeof a=="string"||typeof a=="number")&&i.set(a,e[n])}return[...i.values()]}async function Om(t){let{seriesData:e,chartConfig:r,queryConfig:i,queryObject:n,categoryOrDateCount:a,behaviorAfterLimit:s,errorStrings:o,abortKey:l,abortSignal:u}=t,{series:c}=r,d=e,f=W(c),m=$e(r);if(s!==St.RenderUpToTheLimit&&a!==void 0&&a>e.length&&f!==b.BarAndLineFromFields&&f!==b.BarAndLineNoAggregation&&f!==b.PieNoAggregation&&m===S.CategoryAxisFormat){let{x:h}=c[0],g={...i,returnDistinctValues:!0,outFields:[h]};delete g.outStatistics,delete g.orderByFields,delete g.groupByFieldsForStatistics;let y=(await Le({queryObject:n,queryConfig:g,featureCount:a,errorStrings:o,abortKey:l,abortSignal:u})).map(p=>p.attributes[h]).filter(p=>p!=null);y.length>e.length&&(d=Tm(y,e,h))}return d}function Bm(t,e){let r=t,{series:i}=e;if($e(e)===S.CategoryAxisFormat&&i[0].query?.outStatistics?.[0].statisticType===A.Count){let n=i.reduce((a,s)=>{let o=s.query?.outStatistics?.[0].outStatisticFieldName??[s.y].flat()[0];return a[o]=0,a},{});for(let a=0;a<t.length;a+=1)t[a]={...n,...t[a]}}return r}var Ao=[b.BarAndLineMonoField,b.BarAndLineMultiFields,b.PieNoAggregation,b.PieFromCategory,b.BoxPlotMonoFieldAndCategory,b.BoxPlotMultiFieldsAndCategory,b.BoxPlotMonoFieldAndCategoryAndSplitBy],Mm=8e3,Ws=[{unit:$.Second,threshold:6e4,unitMs:1e3,preferredIntervalSize:[1,2,3,5,6,10,12,15,20,30,60]},{unit:$.Minute,threshold:36e5,unitMs:1e3*60,preferredIntervalSize:[1,2,3,5,6,10,12,15,20,30,60]},{unit:$.Hour,threshold:864e5,unitMs:1e3*60*60,preferredIntervalSize:[1,2,3,4,6,8,12,24]},{unit:$.Day,threshold:6048e5,unitMs:1e3*60*60*24,preferredIntervalSize:[1,2,3,4,5,6,7]},{unit:$.Week,threshold:24192e5,unitMs:1e3*60*60*24*7,preferredIntervalSize:[1,2,3,4]},{unit:$.Month,threshold:290304e5,unitMs:1e3*60*60*24*7*4,preferredIntervalSize:[1,2,3,4,6,12]},{unit:$.Year,threshold:Number.MAX_SAFE_INTEGER,unitMs:1e3*60*60*24*7*4*12,preferredIntervalSize:[1,2,4,5,10,25,50,100]}],Im="{ groupByFieldsForStatistics } WHEN { dateField }>='{ startDate }' AND { dateField }{ endDateOperand }'{ endDate }' THEN '{ y }|{ binIndex}'";function Lo(t,e){let r=t;return e===$.Week?r/=7:e===$.Month?r/=30:e===$.Year&&(r/=365),r=Math.ceil(r),r}function ft(t){let{date:e,unit:r,nextOrPrevious:i,size:n}=t;if(n!==void 0&&Number.isFinite(n)){let a=i==="next"?n:-n;switch(r){case $.Second:return z.fromMillis(e).plus({seconds:a}).valueOf();case $.Minute:return z.fromMillis(e).plus({minutes:a}).valueOf();case $.Hour:return z.fromMillis(e).plus({hours:a}).valueOf();case $.Week:case $.Day:return z.fromMillis(e).plus({days:a}).valueOf();case $.Month:return z.fromMillis(e).plus({months:a}).valueOf();case $.Year:return z.fromMillis(e).plus({years:a}).valueOf()}}return e}function Em(t){let{binFirstOrLastIndex:e,data:r,x:i,timeIntervalInfo:n}=t,{unit:a,size:s}=n,o=a===$.Week?(s??1)*7:s,l=r[e][i],u=e,c=ft({date:l,unit:a,size:o,nextOrPrevious:"next"}),d=r[u][i];for(;u+1<r.length&&d<c;)u+=1,d=r[u]?.[i];let f=u+1>=r.length,m=u;f&&r[m]!==void 0&&(m+=1);let h=f?ft({date:l,unit:a,size:o,nextOrPrevious:"next"}):r[u][i];return{binStartDate:l,binEndDate:h,last:f,nextBinFirstOrLastIndex:u,sliceStartIndex:e,sliceEndIndex:m}}function Am(t){let{binFirstOrLastIndex:e,data:r,x:i,timeIntervalInfo:n}=t,{unit:a,size:s}=n,o=a===$.Week?(s??1)*7:s,l=r[e][i],u=e,c=ft({date:l,unit:a,size:o,nextOrPrevious:"previous"}),d=r[u][i];for(;u-1>=0&&d>c;)u-=1,d=r[u]?.[i];let f=u-1<=0,m=e;return f&&r[m]!==void 0&&(m-=1),f&&(u=0),{binStartDate:f?ft({date:l,unit:a,size:o,nextOrPrevious:"previous"}):r[u][i],binEndDate:l,nextBinFirstOrLastIndex:u,sliceStartIndex:u,sliceEndIndex:m,last:f}}function Lm(t){let{binsToRegroup:e,statisticType:r,y:i,nullPolicy:n}=t,a;n!==we.Interpolate&&(a=n===we.Zero?0:null);let s=e.filter(o=>Number.isFinite(o[i]));if(s.length>0)switch(r){case A.Count:case A.Sum:a=Ld(s,o=>o[i]);break;case A.Minimum:a=pr(s,o=>o[i]).min;break;case A.Maximum:a=pr(s,o=>o[i]).max;break;case A.Average:a=Ad(s,o=>o[i]);break;case A.ContinuousPercentile:}return a}function qm(t){let{data:e,seriesConfig:r,timeIntervalInfo:i,dateMinTimestamp:n,dateMaxTimestamp:a}=t,s=[],{unit:o}=i,l=i.size??1,u=r[0],{x:c}=u,d,f;if(Ve(u)&&(f=u.temporalBinning?.nullPolicy,d=u.temporalBinning?.timeAggregationType),l>1||o===$.Week||o===$.Month||o===$.Year){let{query:m}=r[0],h=Se(r),{statisticType:g}=m?.outStatistics?.[0]??gi,y=!1,p=d===ae.End?e.length-1:0,F={binFirstOrLastIndex:p,data:e,x:c,timeIntervalInfo:i};for(;!y;){let C={},{binStartDate:x,binEndDate:w,last:N,nextBinFirstOrLastIndex:O,sliceStartIndex:T,sliceEndIndex:B}=d===ae.End?Am(F):Em(F);if(y=N,C=d===ae.End?C=e[B-1]:C=e[p],w>a&&x<a||x<n&&w>n||x>=n&&w<=a){let M=e.slice(T,B).filter(k=>!(v.dateBinModel in k));h.forEach(k=>{C[k]=Lm({binsToRegroup:M,statisticType:g,y:k,nullPolicy:f})});let q=M.map(k=>k[Ge]).filter(k=>k!==void 0),I=Hc(q);I!==void 0&&(C[Ge]=I),C[c]=x,C[v.xAxisField]=x,C[v.dateBinningRange]=[x,w],delete C[v.dateBinModel],s.push(C)}else N&&d!==ae.End&&s.length>0&&(s[s.length-1][v.dateBinningRange][1]=s[s.length-1][v.dateBinningRange][1]+1);p=O,F.binFirstOrLastIndex=O}d===ae.End&&(s=s.reverse())}else l===1?s=e.map((m,h)=>{let g=m[c],y=e[h+1]?.[c];return y=typeof y=="number"?y-1:ft({date:g,unit:o,size:l,nextOrPrevious:"next"}),{...m,[v.dateBinningRange]:[g,y]}}):s=e;return s}function qo(t){let{dateMinTimestamp:e,dateMaxTimestamp:r,timeIntervalInfo:i}=t,{size:n,unit:a}=i,s=0,o=0;if(n!==void 0&&Number.isFinite(n)&&Number.isFinite(e)&&Number.isFinite(r)){let l=-1,u=z.fromMillis(e),c=z.fromMillis(r);switch(a){case $.Second:l=c.diff(u,"seconds").get("seconds");break;case $.Minute:l=c.diff(u,"minutes").get("minutes");break;case $.Hour:l=c.diff(u,"hours").get("hours");break;case $.Day:case $.Month:case $.Year:l=c.diff(u,"days").get("days");break;case $.Week:l=c.diff(u,"weeks").get("weeks");break}Number.isFinite(l)&&(o=Math.ceil(l)+1,s=n===1?o:Math.ceil(o/n))}return{numberOfFinalBinsWithinDataRange:s,numberOfSingleBinsWithinDataRange:o}}function Do(t){let e=t[0].temporalBinning?.nullPolicy;return t.reduce((r,i)=>{r[v.dateBinModel]=void 0;let n=i.query?.outStatistics?.[0].outStatisticFieldName??[i.y].flat()[0];return e!==we.Interpolate&&(r[n]=e===we.Zero?0:null),r},{})}function Dm(t){let{dateMaxTimestamp:e,numberOfFinalBinsWithinDataRange:r,numberOfSingleBinsWithinDataRange:i,data:n,seriesConfig:a,timeIntervalInfo:s}=t,{size:o,unit:l}=s,{x:u}=a[0],c=a[0].temporalBinning?.timeAggregationType,d=n[0][u],f=e;if(o!==void 0&&Number.isFinite(o)&&i/r!==o){let m=Math.ceil(i/r)*r-i;l===$.Week&&(m*=7);let h=Do(a);if(c===ae.End){let g=n[0][u];for(let y=0;y<m;y+=1)g=ft({date:g,unit:l,size:1,nextOrPrevious:"previous"}),n.push({...h,[u]:g,[v.xAxisField]:g});m>0&&(d=n[n.length-1][u])}else{let g=n[n.length-1][u];for(let y=0;y<m;y+=1)g=ft({date:g,unit:l,size:1,nextOrPrevious:"next"}),n.push({...h,[u]:g,[v.xAxisField]:g});f=n[n.length-1][u]}}return{newDateMin:d,newDateMax:f}}function Pm(t){let{numberOfSingleBinsWithinDataRange:e,dataLength:r,unit:i}=t;return Lo(r,i)>=e}async function km(t){let{queryObject:e,queryConfig:r,x:i,errorStrings:n,abortSignal:a}=t,s=`MIN_${i}`,o=`MAX_${i}`,l=`COUNT_${i}`,u={...r,outStatistics:[{statisticType:A.Minimum,onStatisticField:i,outStatisticFieldName:s},{statisticType:A.Maximum,onStatisticField:i,outStatisticFieldName:o},{statisticType:A.Count,onStatisticField:i,outStatisticFieldName:l}]};delete u.groupByFieldsForStatistics,delete u.orderByFields;let c=await vr({queryObject:e,queryConfig:u,errorStrings:n,abortSignal:a}),d=c.get(s),f=c.get(o),m=c.get(l);return typeof d=="string"&&(d=new Date(d).valueOf()),typeof f=="string"&&(f=new Date(f).valueOf()),{dateRange:{dateMinTimestamp:d,dateMaxTimestamp:f},numberOfFeatures:m}}function Vm(t){let{newDateMin:e,newDateMax:r,seriesConfig:i,data:n,numberOfSingleBinsWithinDataRange:a,initialNumberOfBins:s,timeIntervalInfo:o}=t,{unit:l}=o,u=n;if(!Pm({numberOfSingleBinsWithinDataRange:a,dataLength:s,unit:l})){let{x:c}=i[0],d=i[0].temporalBinning?.timeAggregationType,f=Do(i),m=d===ae.End?r:e,h=d===ae.End?n.length-1:0;for(;h<n.length&&(d===ae.End&&m>e||d!==ae.End&&m<r);)m!==n[h][c]?u.push({...f,[c]:m,[v.xAxisField]:m}):h=d===ae.End?h-1:h+1,m=ft({date:m,unit:l===$.Month||l===$.Year?$.Day:l,size:1,nextOrPrevious:d===ae.End?"previous":"next"})}return u}function $m(t){let{data:e,seriesConfig:r,dateMinTimestamp:i,dateMaxTimestamp:n}=t,a=e;if(r[0].temporalBinning?.trimIncompleteTimeInterval!==!1){let{timeAggregationType:s}=r[0].temporalBinning??{},o=e[0]?.[v.dateBinningRange]?.[0],l=e[e.length-1]?.[v.dateBinningRange]?.[1];if(s===ae.End?o<i:l>n)if(s===ae.End){let u=o;for(;u<i&&e.length>0;)e.shift(),e.length>0&&(u=e[0][v.dateBinningRange]?.[0])}else{let u=l;for(;u>n&&e.length>0;)e.pop(),e.length>0&&(u=e[e.length-1][v.dateBinningRange]?.[1])}}return a}function Rm(t){let{groupByFieldsForStatistics:e,dateField:r,queryStartDate:i,queryEndDate:n,y:a,binIndex:s,lastBin:o}=t,l=e===""?Bt.groupByCaseBegin:e;return l=_e(Im,{groupByFieldsForStatistics:l,dateField:r,startDate:`${i}`,endDate:`${n}`,y:[a].flat()[0],binIndex:`${s}`,endDateOperand:o?"<=":"<"}),l}function*Wm(t){let{queryObject:e,seriesConfig:r,queryConfig:i,completeData:n,errorStrings:a,abortSignal:s}=t;for(let o=0;o<r.length;o+=1){let l=r[o],{query:u,x:c,y:d}=l,f=[{onStatisticField:u?.outStatistics?.[0]?.onStatisticField??"",outStatisticFieldName:A.ContinuousPercentile,statisticType:A.ContinuousPercentile,statisticParameters:{value:.5}}],m=Bt.groupByCaseBegin;for(let g=0;g<n.length;g+=1){let y=n[g],[p,F]=y[v.dateBinningRange],C=Kt(p),x=Kt(F);m=Rm({groupByFieldsForStatistics:m,queryStartDate:C,queryEndDate:x,dateField:c,y:[d].flat()[0],binIndex:g,lastBin:g===n.length-1})}m=`${m} ${Bt.groupByCaseEnd}`;let h={...i,groupByFieldsForStatistics:[m],outStatistics:f,orderByFields:void 0};yield Le({queryObject:e,queryConfig:h,noBatch:!0,errorStrings:a,abortSignal:s})}}async function jm(t){let{queryObject:e,data:r,seriesConfig:i,queryConfig:n,errorStrings:a,abortSignal:s}=t,o=r,{statisticType:l}=i[0].query?.outStatistics?.[0]??gi;if(l===A.ContinuousPercentile&&o.length>0){let u=Wm({queryObject:e,completeData:o,seriesConfig:i,queryConfig:n,errorStrings:a,abortSignal:s}),c=(await Promise.all(u)).flat();if(c.length>0){let{isInItem:d,expr:f}=ar(c[0].attributes);d&&c.forEach(m=>{let h=m.attributes[`${f}`];if(h!==void 0){let[g,y]=h.split("|");if(y!==void 0){let p=m.attributes[A.ContinuousPercentile];o[y][`${g}`]=p}}})}}return o}function js(t){let{dataItem:e,nullPolicy:r,statField:i}=t;if(i&&e[i]==null)switch(!0){case r===we.Zero:e[i]=0;break;case r===we.Null:e[i]=null;break;case r===we.Interpolate:delete e[i];break}}function Zm(t){let{chartConfig:e,queryResults:r,mapToStatField:i,splitByField:n,x:a,y:s,nullPolicy:o,queryObject:l}=t,u=co(a),c=Re(l).find(g=>g.name===a)?.type,d=[],f=e.series[0],m="temporalBinning"in f?f.temporalBinning?.trimIncompleteTimeInterval:!1,h="temporalBinning"in f?f.temporalBinning?.timeAggregationType:!1;return r.forEach((g,y)=>{if(!(m&&(y===0&&h===ae.End||y===r.length-1&&h===ae.Start))){let{attributes:p,stackedAttributes:F}=g,C=p[u.lowerBoundaryAlias],x=p[u.upperBoundaryAlias],w=C,N=x,O=(T,B)=>{let M=T;if(B===Q.DateOnly&&(typeof T=="string"&&T.length===10||typeof T=="number"))if(typeof T=="string"){let q=T.split("-");q.length===3&&(M=z.local(Number(q[0]),Number(q[1]),Number(q[2])).valueOf())}else M=new Date(T),M=new Date(M.valueOf()+M.getTimezoneOffset()*6e4),M=z.local(M.getFullYear(),M.getMonth()+1,M.getDate()).valueOf();else typeof T=="string"&&["+","-"].forEach(q=>{q&&T.lastIndexOf(q)===T.length-6&&(M=new Date(T.slice(0,T.lastIndexOf(q))).valueOf())});return M};if(C=O(C,c),x=O(x,c),typeof C=="number"&&typeof x=="number"){let T={...p};T[v.originalServerBinningRange]=[w,N],T[a]=C,T[v.xAxisField]=C,T[v.dateBinningRange]=[C,x],delete T[u.lowerBoundaryAlias],delete T[u.upperBoundaryAlias],F&&n&&!he(n)&&i?F.forEach(q=>{let I=q[n];if(I===null||typeof I=="string"||typeof I=="number"){let k=i?.get(I);k!==void 0&&(T[k]=q[G.outStatistics?.outStatisticFieldName??""],js({dataItem:T,statField:k,nullPolicy:o}))}}):typeof s=="string"&&js({dataItem:T,statField:s,nullPolicy:o});let{featureExtent:B,featureExtentKey:M}=Po({feature:g,splitByField:n});B&&(T[M]=B),d.push(T)}}}),d}async function _m(t){let{queryObject:e,queryResults:r,x:i,queryConfig:n,seriesConfig:a,dateRange:s,timeIntervalInfo:o,errorStrings:l,abortSignal:u}=t,c=r,{dateMinTimestamp:d,dateMaxTimestamp:f}=s;if(d&&f){let m=r.length;if(gr({arrayToSort:c,sortingField:i}),m>1){let{numberOfFinalBinsWithinDataRange:h,numberOfSingleBinsWithinDataRange:g}=qo({dateMinTimestamp:d,dateMaxTimestamp:f,timeIntervalInfo:o}),{newDateMin:y,newDateMax:p}=Dm({dateMaxTimestamp:f,data:c,numberOfFinalBinsWithinDataRange:h,numberOfSingleBinsWithinDataRange:g,seriesConfig:a,timeIntervalInfo:o});c=Vm({newDateMin:y,newDateMax:p,seriesConfig:a,data:c,initialNumberOfBins:m,numberOfSingleBinsWithinDataRange:g,timeIntervalInfo:o}),gr({arrayToSort:c,sortingField:i}),c=qm({data:c,seriesConfig:a,dateMinTimestamp:d,dateMaxTimestamp:f,timeIntervalInfo:o}),c=$m({data:c,seriesConfig:a,dateMinTimestamp:d,dateMaxTimestamp:f}),e&&(c=await jm({queryObject:e,data:c,seriesConfig:a,queryConfig:n,errorStrings:l,abortSignal:u}))}}return c}function zm(t){return Math.floor(Math.min(Math.max(8,Math.sqrt(t??8)),128)+.5)}function Hm(t){let{dateRange:e,numberOfFeatures:r}=t,i,n,{dateMinTimestamp:a,dateMaxTimestamp:s}=e;if(a&&s){typeof a=="string"&&(a=new Date(a).valueOf()),typeof s=="string"&&(s=new Date(s).valueOf());let o=zm(r),l=(s-a)/o,u=Ws.findIndex(p=>p.threshold>l),c=Ws[u],{unitMs:d,preferredIntervalSize:f}=c;({unit:i}=c);let m=l/d,h=f.findIndex(p=>p>=m),g=f[h],y=h===0?f[0]:f[h-1];n=g-m<m-y?g:y}return{size:n,unit:i}}function Um(t){let{series:e,isTimeBinningSeries:r,setTimeBinningInfoWhenNotProvided:i}=t,n=!1;if(Ve(e)&&r){let{unit:a,size:s}=e.temporalBinning??{};n=!cn(a,s)&&i===!0}return n}function Gm(t){let e=[];for(let r=1;r<=6;r+=1){let i=t[`EXPR_${r}`]??t[`Expr${r}`]??t[`expr${r}`]??t[`EXPR${r}`];i!==null&&e.push(i)}return z.local(Number(e[0]??1969),Number(e[1]??1),Number(e[2]??1),Number(e[3]??0),Number(e[4]??0),Number(e[5]??0)).valueOf()}async function ln(t){let{queryObject:e,queryConfig:r,category:i,splitByField:n,chartLimits:a,errorStrings:s,abortKey:o,abortSignal:l}=t,u=n!==void 0,c=i!==ir?[i]:[];u&&c.push(n);let d=U(e),{idField:f,isTraditionalTypeOID:m}=We(d),h=m?f:"*",g={...r,groupByFieldsForStatistics:Array.from(new Set(c)),outStatistics:[{statisticType:A.Count,onStatisticField:h,outStatisticFieldName:`${A.Count}_OBJECTID`}],orderByFields:void 0,num:a?.maxBarThreePlusSeriesCountTotal},y=await Le({queryObject:e,featureCount:1,queryConfig:g,errorStrings:s,abortKey:o,abortSignal:l});return Array.from(new Set(y.map(p=>p.attributes[u?n:i]))).sort((p,F)=>typeof p=="string"&&typeof F=="string"?p.localeCompare(F):Number(p)-Number(F))}function Po(t){let{feature:e,splitByField:r,chartSubType:i}=t,n;if(e.aggregateGeometries&&"Extent"in e.aggregateGeometries)n=e.aggregateGeometries.Extent;else{let o=e.aggregateGeometries??e.geometry;o?.extent&&(n=o.extent)}let a=n?.toJSON(),s=Ge;return a!==void 0&&r!==void 0&&i!==void 0&&i===b.BarAndLineSplitBy&&(s=e.attributes[r]!==void 0?`${Ge}_${e.attributes[r]}`:Ge),{featureExtent:a,featureExtentKey:s}}function Ym(t){let{input:e,x:r,splitByField:i}=t;return e.reduce((n,a)=>(i!==void 0&&i!==r&&!(v.technicalFieldSplitByField in a)&&delete a[i],Object.assign(n,a)),{})}function br(t){let{data:e,x:r,splitByField:i}=t,n=e;if(e!==void 0&&e.length>0){let a=new Map;for(let s of e){let o=s[r],l=a.get(o)??[];l.push(s),a.set(o,l)}a.size>0&&(n=Array.from(a.values(),s=>Ym({input:s,x:r,splitByField:i})))}return n}function Qm(t,e){let r=t,i=Z(e);if(i!==S.PieSeries&&i!==S.BoxPlotSeries){let n=Se(e),a=e[0].y;t.forEach(s=>{let o=0;if(n.forEach(l=>{let u=s[l];Number.isFinite(u)&&(o+=u)}),s[v.technicalSortingFieldBySum]=o,Number.isFinite(o)&&o>0){let l=s[a];if(Number.isFinite(l)){let u=l/o;s[v.technicalSortingFieldByPercent]=u}}})}return r}function Km(t,e){let r=e,i=Se(t),n=i.length===1;return i.forEach(a=>{let s=Yt(n?void 0:a),o=r[s[P.FirstQuartile]],l=r[s[P.ThirdQuartile]];Number.isFinite(o)&&Number.isFinite(l)&&l>=o&&(r[s[P.IQR]]=l-o)}),r}function Jm(t,e){let r=e.series[0],i=t;if(r.type===S.HeatSeries){let{x:n,y:a}=r;i[j.xField]=i[n]?.toString(),delete i[n],i[j.yField]=i[a]?.toString(),delete i[a];let s=r.query?.outStatistics?.[0]?.outStatisticFieldName;s&&(i[j.valueField]=i[s],delete i[s])}return i}function On(t,e){[e].flat().forEach(r=>{r&&(t[r]===void 0&&(t[r]=t[r.toUpperCase()]!==void 0?t[r.toUpperCase()]:t[r.toLowerCase()]),t[r]!==void 0?(r!==r.toUpperCase()&&delete t[r.toUpperCase()],r!==r.toLowerCase()&&delete t[r.toLowerCase()]):delete t[r])})}function Xm(t,e){let r=[];G.outStatistics.outStatisticFieldName&&Object.keys(t).includes(G.outStatistics.outStatisticFieldName)?r=[G.outStatistics.outStatisticFieldName]:r=Array.from(new Set(e.flatMap(i=>i.query?.outStatistics?.map(n=>n.outStatisticFieldName)))),On(t,r)}function eh(t,e){let r={...t};return t!==void 0&&e[0]!==void 0&&(r=Object.keys(t).reduce((i,n)=>{let a=e.find(s=>s.outStatisticFieldName?.toLowerCase()===n.toLowerCase())?.onStatisticField;return a!==void 0&&t[n]!==void 0&&a!==n?i[a]=t[n]:i[n]=t[n],i},{})),r}function th(t){let{dataItem:e,splitByField:r,y:i,fieldOID:n}=t;if(e!==void 0&&!he(r)&&!he(i)){let a=e[r],s=`${i}_${a?.toString()}`;e[s]=e[i],n&&i!==n&&delete e[i]}}function rh(t,e){Object.keys(t).forEach(r=>{if(r.startsWith(`${e}_`)){let i=r.slice(e.length+1);t[i]=t[r],delete t[r]}})}function ih(t,e){let r=1;switch(t){case b.BarAndLineFromFields:case b.PieFromFields:r=e.series[0].query?.outStatistics?.length??1;break;case b.BoxPlotMultiFields:case b.BoxPlotMultiFieldsAndSplitBy:r=e.series[0].y.length;break;case b.BarAndLineNoAggregation:case b.BoxPlotMonoField:case b.BoxPlotMonoFieldAndCategory:case b.BoxPlotMultiFieldsAndCategory:case b.BoxPlotMonoFieldAndSplitBy:case b.BoxPlotMonoFieldAndCategoryAndSplitBy:case b.PieFromCategory:case b.BarAndLineSplitByNoAggregation:case b.PieNoAggregation:case b.BarAndLineSplitBy:case b.BarAndLineMonoField:case b.BarAndLineMultiFields:case b.NonSpecific:}return r}function nh(t){let{attributes:e,showMean:r,chartSubType:i}=t;r&&(i===b.BoxPlotMonoFieldAndSplitBy||i===b.BoxPlotMultiFieldsAndSplitBy||i===b.BoxPlotMonoFieldAndCategoryAndSplitBy)&&(e[v.boxPlot.boxPlotMeanLineMarkerId]=!0)}function ah(t){let{queryResponse:e,chartConfig:r,maxCategoryCount:i}=t,n=W(r.series);return i&&Number.isFinite(i)&&i<e.length&&Ao.includes(n)?e.slice(0,i):e}function sh(t){let{attributes:e,uniqueCategoryList:r,maxCategoryCount:i,x:n,chartSubType:a}=t,s=!1;if(n&&i&&Number.isFinite(i)&&!Ao.includes(a))if((a===b.BarAndLineFromFields||a===b.PieFromFields)&&Object.keys(e).length>i)Object.keys(e).filter(o=>o!==A.EnvelopeAggregate).forEach((o,l)=>{l>=i&&delete e[o]});else{let o=e[n];o!==void 0&&(r.size===i&&!r.has(o)?s=!0:r.add(o))}return s}function oh(t){let{attributes:e,xValue:r,yValue:i,x:n,y:a,xFieldDomain:s,yFieldDomain:o,chartType:l,chartSubType:u,xAxisValueFormat:c,yAxisValueFormat:d}=t,f,m;u!==b.PieFromFields&&(s&&(typeof r=="string"||typeof r=="number")&&(f=hn(r,s)),o&&l===S.HeatSeries&&typeof a=="string"&&(typeof i=="string"||typeof i=="number")&&(m=hn(i,o)),f!==void 0&&f!==r&&(typeof f!="string"||!ye(c))&&(e[v.originalCategoryValue]=e[n],e[n]=f,e[v.xAxisDisplayField]=f),typeof a=="string"&&!ye(d)&&m!==void 0&&m!==i&&(e[v.originalYCategoryValue]=e[a],e[a]=m))}function lh(t){let e,[r,i,n]=t.split(":");return Number.isFinite(Number(r))&&Number.isFinite(Number(i))&&Number.isFinite(Number(n))&&(e=new Date(2e3,0,1,Number(r),Number(i),Number(n)).valueOf()),e}function ko(t){let{queryObject:e,queryResponse:r,chartConfig:i,mapToStatField:n,splitByField:a,isTimeBinningSeries:s,resultLimit:o,showMean:l,chartLimits:u,fieldList:c}=t,{series:d}=i,f=W(d),m=Z(d),{x:h}=d[0],g="y"in d[0]?d[0].y:void 0,y=d[0].query?.outStatistics??[],p=Ke(i?.axes?.[0]?.valueFormat),{originalYCategoryValue:F,originalCategoryValue:C,originalDateValue:x}=v,w=mn(e,h),N=typeof g=="string"?mn(e,g):void 0,O=bf(c??[]).includes(h),T=[],B=0,M=new Set,{maxCategoryCount:q}=bt(u),I=ah({queryResponse:r,chartConfig:i,maxCategoryCount:q});for(let k=0;I[k]&&k<I.length&&!(o!==void 0&&B>=o);k+=1){B+=ih(f,i);let _=I[k],E={..._.attributes};if(sh({attributes:E,uniqueCategoryList:M,maxCategoryCount:q,x:h,chartSubType:f}))continue;if(Xm(E,d),f===b.PieFromFields||f===b.BarAndLineFromFields)E=eh(E,y);else if(typeof g=="string"&&f===b.BarAndLineSplitByNoAggregation){let fe=U(e),{idField:ge,isTraditionalTypeOID:He}=We(fe);th({dataItem:E,splitByField:a,y:g,fieldOID:He?ge:void 0})}else g&&(f===b.BoxPlotMonoField||f===b.BoxPlotMonoFieldAndCategory||f===b.BoxPlotMonoFieldAndSplitBy||f===b.BoxPlotMonoFieldAndCategoryAndSplitBy)&&rh(E,typeof g=="string"?g:g[0]);nh({attributes:E,showMean:l,chartSubType:f});let D=E[h],Y=typeof g=="string"?E[g]:void 0;D===null&&d[0]?.query?.fetchNullValues===!0&&f!==b.PieFromFields&&(E[C]=null,D=v.nullValue),p||(O&&typeof D=="string"?D=new Date(D).valueOf():s&&(D=Gm(E))),typeof D=="string"&&c?.find(fe=>fe.name===h)?.type===Q.TimeOnly&&(E[C]=D,D=lh(D));let{outStatisticFieldName:J}=G.outStatistics??{},{featureExtent:R,featureExtentKey:ie}=Po({feature:_,splitByField:a,chartSubType:f});if(R&&(E[ie]=R),f===b.BarAndLineSplitBy&&J!==void 0){let fe=E[a],ge=n?.get(fe);ge!==void 0&&(fe===a&&(E[v.technicalFieldSplitByField]=E[ge]),E[ge]=E[J]),delete E[J]}else(f===b.PieNoAggregation||f===b.BarAndLineNoAggregation||f===b.BarAndLineSplitByNoAggregation)&&(O?E[x]=D:D!==v.nullValue&&(E[C]=D),fc({isXAxis:!0,chartType:m,valueFormat:i.axes?.[0]?.valueFormat})&&(E[v.xAxisField]=`${D}-${k}`,E[v.xAxisDisplayField]=D),E[G.uniqueIdsName]=_.getObjectId());m===S.BoxPlotSeries&&(E=Km(d,E)),m===S.PieSeries&&typeof D=="number"&&(E[C]===void 0&&(E[C]=E[h]),D=`${D}`),D!==void 0&&(E[C]===void 0&&(E[C]=E[h]),E[h]===null?E[h]=m===S.HeatSeries?"null":v.nullValue:E[h]=D,oh({attributes:E,xValue:D,yValue:Y,x:h,y:g,xFieldDomain:w,yFieldDomain:N,chartType:m,chartSubType:f,xAxisValueFormat:i.axes?.[0].valueFormat,yAxisValueFormat:i.axes?.[1]?.valueFormat}),m===S.HeatSeries&&typeof g=="string"&&E[g]===null&&(E[g]="null",E[F]=null),E[v.xAxisField]===void 0&&(E[v.xAxisField]=E[h])),E=Jm(E,i),T.push(E)}return T}async function di(t){let{queryObject:e,uniqueQuery:r,chartConfig:i,mapToStatField:n,abortKey:a,abortSignal:s,elementCount:o,isTimeBinningSeries:l,showMean:u,chartLimits:c,popupTemplateFieldInfosEnabled:d,preFetchedQueryResponse:f,errorStrings:m}=t,{series:h}=i,g=W(h),y=[],p=g===b.BarAndLineSplitBy||g===b.BarAndLineSplitByNoAggregation?de(h[0].query?.where):"",F=f??await Le({queryObject:e,queryConfig:r,featureCount:o,abortKey:a,errorStrings:m,abortSignal:s}),C=Re(e,d),{x}=h[0];return y=ko({queryObject:e,queryResponse:F,chartConfig:i,mapToStatField:n,splitByField:p,isTimeBinningSeries:l,fieldList:C,resultLimit:r.num,showMean:u,chartLimits:c}),g!==b.BarAndLineSplitByNoAggregation&&g!==b.BarAndLineFromFields&&(p!==""&&(y=br({data:y,x,splitByField:p})),y=Qm(y,h)),y}async function Vo(t){let{chartConfig:e,queryObject:r,queryConfig:i,numberMaxOfFeaturesToFetch:n,behaviorAfterLimit:a,isGaugeByFeature:s,abortSignal:o}=t,{series:l}=e,u=W(l),{x:c}=l[0],d=l.length,f,m;if(u===b.BoxPlotMonoField||u===b.BoxPlotMonoFieldAndSplitBy?(m=d,f=m):u===b.BoxPlotMultiFields||u===b.BoxPlotMultiFieldsAndSplitBy?(m=e.series[0].y.length,f=m):u===b.PieFromFields||u===b.BarAndLineFromFields?(m=l[0].query?.outStatistics?.filter(h=>h.statisticType!==A.EnvelopeAggregate).length??0,f=m):f=await Rd({queryObject:r,x:c,chartSubType:u,queryConfig:i,isGaugeByFeature:s,abortSignal:o}),f!==void 0){let h=u===b.BoxPlotMonoField||u===b.BoxPlotMonoFieldAndCategory||u===b.BoxPlotMonoFieldAndSplitBy;m=dn(u)&&!h?f*d:f}return a===St.RenderUpToTheLimit&&m!==void 0&&n!==void 0&&n<m&&(m=n,f=Math.ceil(m/d)),{categoryOrDateCount:f,elementCount:m}}async function gn(t){let{chartConfig:e,queryConfig:r,fetchFullBoxPlotData:i,queryObject:n,abortKey:a,fieldList:s,preFetchedQueryResponse:o,errorStrings:l,abortSignal:u,setTimeBinningInfoWhenNotProvided:c,returnFeaturesExtent:d,chartLimits:f,popupTemplateFieldInfosEnabled:m,hideZeroCountCategories:h}=t,g=Jt(e),y=t.replaceNoValueCategoryWithZero??v.options.replaceNoValueCategoryWithZero,p=!(h??!y),{behaviorAfterLimit:F}=f??{},C,x={valid:!0},w,N=!1,O=e.series,T=O[0],B=W(e.series);if(oe(n))C=Z(O)===S.BarSeries?await af(t):x;else{if(T!==void 0){let M=Z(O),{uniqueQuery:q,mapToStatField:I}=xn({chartConfig:e,queryObject:n,queryConfig:r,fetchFullBoxPlotData:i,setTimeBinningInfoWhenNotProvided:c,returnFeaturesExtent:d,chartLimits:f}),{categoryOrDateCount:k,elementCount:_}=await Vo({chartConfig:e,queryObject:n,queryConfig:r,behaviorAfterLimit:F,numberMaxOfFeaturesToFetch:q.num,abortSignal:u}),E=!Number.isFinite(_),D=E||je({count:_??0,seriesCount:O.length,chartType:M,chartLimits:f});if(D&&(w=await di({queryObject:n,uniqueQuery:q,chartConfig:e,preFetchedQueryResponse:o,mapToStatField:I,elementCount:_,isTimeBinningSeries:!1,showMean:g,chartLimits:f,popupTemplateFieldInfosEnabled:m,errorStrings:l,abortKey:a,abortSignal:u}),Fe(e)&&w!==void 0&&(x.data=await um({data:w,queryObject:n,fetchFullBoxPlotData:i,uniqueQuery:q,chartConfig:e,elementCount:_,chartLimits:f,errorStrings:l,abortKey:a,abortSignal:u}),f?.maxBoxPlotOutlierLimit!==void 0&&(D=(x.data.outliers??[]).length<=f.maxBoxPlotOutlierLimit,N=!D)),E&&(k=w.length,_=dn(B)?k*O.length:k,D=je({count:_,seriesCount:O.length,chartType:M,chartLimits:f})),D)){if(M===S.PieSeries){B===b.PieFromFields&&(w=ni({dataToConvert:w[0],x:ve,y:ze,fieldList:s}));let Y="";B===b.PieFromFields?Y=ze:"y"in T&&typeof T.y=="string"&&(Y=T.y),Qc(w,Y)?x.data={dataItems:w}:Qf(x,H.PieChartMixOfNegativePositiveSlices)}else if((M===S.RadarSeries||M===S.BarSeries||M===S.LineSeries||M===S.ComboLineAndBarSeries)&&(B===b.BarAndLineFromFields&&"y"in T&&typeof T.y=="string"?w=ni({dataToConvert:w[0],x:T.x,y:T.y,fieldList:s}):w=await Om({queryObject:n,seriesData:w,chartConfig:e,queryConfig:r,categoryOrDateCount:k,behaviorAfterLimit:F,errorStrings:l,abortKey:a,abortSignal:u}),_=dn(B)?w.length*O.length:w.length,D=je({count:_,seriesCount:O.length,chartType:M,chartLimits:f}),D)){p&&(w=Bm(w,e));let Y={};if(Ve(T)){let{size:J,unit:R}=T.temporalBinning??{};J!==void 0&&R!==void 0&&(Y={size:J,unit:R})}x.data={dataItems:w,timeIntervalInfo:Y}}}D||ai({dataInfo:x,chartType:M,subError:{outlierLimit:N}}),x.count=_}C=x}return C}function uh(t){let e,{start:r,end:i}=Cn({field:"",unit:t,addIntervalStatement:!1});return i&&(e=Array.from({length:i+(r===0?1:0)},(n,a)=>(a+(r??1)).toString())),e}function ch(t){return t.hideEmptyRowsAndColumns===!0&&(t.nullPolicy!==we.Zero||t.series[0].query?.outStatistics?.[0].statisticType===A.Count)}function dh(t){let{dataItems:e,valueField:r,filterOutZero:i}=t,n=[null];i&&n.push(0);let a=new Set(e.filter(o=>!n.includes(o[r])).map(o=>o[j.xField])),s=new Set(e.filter(o=>!n.includes(o[r])).map(o=>o[j.yField]));return e.filter(o=>a.has(o[j.xField])&&s.has(o[j.yField]))}function fh(t){let{dataItems:e,xUniqueValues:r,yUniqueValues:i,valueField:n,emptyCellValue:a,x:s,y:o,queryObject:l}=t,u=[],c=new Set;for(let d of e){let f=d[v.originalCategoryValue]!==void 0?d[v.originalCategoryValue]:d[j.xField],m=d[v.originalYCategoryValue]!==void 0?d[v.originalYCategoryValue]:d[j.yField];c.add(`${f}|${m}`)}for(let d of r){let f=String(d);for(let m of i){let h=String(m);if(!c.has(`${f}|${h}`)){let g=l?As({queryObject:l,fieldName:s,fieldValue:f})??d:d,y=l?As({queryObject:l,fieldName:o,fieldValue:h})??m:m;u.push({[v.originalCategoryValue]:d===null?null:d,[v.originalYCategoryValue]:m===null?null:m,[j.xField]:d===null?"null":g,[j.yField]:m===null?"null":y,[n]:a})}}}return u}function Zs(t){let{day:e,month:r,includeLeapDay:i}=t;return r===2&&e>(i?29:28)||[4,6,9,11].includes(r)&&e>30}async function $o(t){let{chartConfig:e,queryConfig:r,queryObject:i,completeHeatChartDataset:n=!0,errorStrings:a,returnFeaturesExtent:s,chartLimits:o,popupTemplateFieldInfosEnabled:l,view:u,syncViewTimeZone:c,abortKey:d,abortSignal:f}=t,m={valid:!0},h;if(Tt(e)){let{nullPolicy:g}=e,y=e.series[0],{x:p,y:F,query:C,xTemporalBinning:x,yTemporalBinning:w}=y,N=C?.outStatistics?.[0]?.outStatisticFieldName??"",O=C?.outStatistics?.[0]?.statisticType??A.Count,T=ch(e),B=j.valueField,M=g===we.Zero?0:null;if(Uf(e)){let q=await Vd({chartConfig:e,queryObject:i,queryConfig:r,returnFeaturesExtent:s,errorStrings:a,abortKey:d,abortSignal:f});if(!je({count:q?.length??0,seriesCount:1,chartType:S.HeatSeries,chartLimits:o}))ai({dataInfo:m,chartType:S.HeatSeries});else if(typeof q?.[0]=="object"){let I=Re(i,l);h=ko({queryObject:i,queryResponse:q,chartConfig:e,splitByField:"",isTimeBinningSeries:!1,chartLimits:o,resultLimit:r.num,fieldList:I});let k=await ln({queryObject:i,queryConfig:r,category:p,errorStrings:a,abortKey:d,abortSignal:f}),_=await ln({queryObject:i,queryConfig:r,category:F,errorStrings:a,abortKey:d,abortSignal:f});h.length!==k?.length*_?.length&&(h=[...h,...fh({dataItems:h,xUniqueValues:k,yUniqueValues:_,valueField:B,emptyCellValue:M,x:p,y:F,queryObject:i})],T&&(h=dh({dataItems:h,valueField:B,filterOutZero:O===A.Count})))}}else{let q=await kd({chartConfig:e,queryObject:i,queryConfig:r,view:u,syncViewTimeZone:c,errorStrings:a,abortSignal:f}),I=w?uh(w.unit):await ln({queryObject:i,queryConfig:r,category:F,errorStrings:a,abortKey:d,abortSignal:f}),k=0;h=q?.features.flatMap(_=>{let E=[],{attributes:D,stackedAttributes:Y}=_,J=[];if(Y?.forEach(R=>{let ie=`${R[F]}`;J.push(ie),E.push({[j.xField]:`${D[G.heatChartLowerBoundaryAlias]}`,[j.yField]:ie,[B]:R[N]})}),n&&I&&J.length!==I?.length){let R=I.filter(ie=>!J.includes(ie.toString()));T&&(R.length!==I.length||J.length===0)||R.forEach(ie=>{Number.isFinite(Number(D[G.heatChartLowerBoundaryAlias]))&&Number.isFinite(Number(ie))&&(x?.unit===Ce.DayOfMonth&&w?.unit===Ce.MonthOfYear&&Zs({day:Number(D[G.heatChartLowerBoundaryAlias]),month:Number(ie),includeLeapDay:e.includeLeapDay})||w?.unit===Ce.DayOfMonth&&x?.unit===Ce.MonthOfYear&&Zs({day:Number(ie),month:Number(D[G.heatChartLowerBoundaryAlias]),includeLeapDay:e.includeLeapDay}))||E.push({[j.xField]:`${D[G.heatChartLowerBoundaryAlias]}`,[j.yField]:ie,[B]:g===we.Zero?0:null})})}return k+=E.length,E}),je({count:k,seriesCount:1,chartType:S.HeatSeries,chartLimits:o})||ai({dataInfo:m,chartType:S.HeatSeries})}h&&(m.data={dataItems:h,heatChartAxesData:Bo({chartConfig:e,chartData:h})})}return m}function mh(t){let{chartConfig:e,data:r,chartLimits:i}=t,n=e.series,a=r,s=ro(e,i);if(s!==void 0){let o=Se(n);if(o.length===1)a=r.filter(l=>Number.isFinite(l[o[0]])).slice(0,s);else if(r.length*o.length>s){let l=[],u=0,c=0;for(;u<=s&&c<r.length;){let d=r[c];if(l.push(d),u+=o.filter(f=>Number.isFinite(d[f])).length,u>s){let f=u-s,m=o.length-1;for(;f!==0&&m>=0;){let h=o[m];Number.isFinite(d[h])&&(delete d[h],f-=1),m-=1}}c+=1}a=l}}return a}async function Bn(t){let{chartConfig:e,queryConfig:r,queryObject:i,abortKey:n,abortSignal:a,preFetchedQueryResponse:s,errorStrings:o,setTimeBinningInfoWhenNotProvided:l,returnFeaturesExtent:u,chartLimits:c,popupTemplateFieldInfosEnabled:d,view:f,syncViewTimeZone:m}=t,{behaviorAfterLimit:h}=c??{},g=e.series,y=g[0],{x:p}=y,F=de(y.query?.where),C={valid:!0},x;if(Ve(y)){let{temporalBinning:w}=y;if(i&&w){let{unit:N,size:O}=w,T=1,B={unit:N,size:O},M=!1,q=Um({series:y,isTimeBinningSeries:!0,setTimeBinningInfoWhenNotProvided:l}),I=!Qt(F,i)||q?await km({queryObject:i,queryConfig:r,x:p,errorStrings:o,abortSignal:a}):void 0;q&&I&&I.numberOfFeatures>0&&I.dateRange.dateMaxTimestamp!==void 0&&I.dateRange.dateMinTimestamp!==void 0&&(B=Hm(I),Re(i).find(D=>D.name===p)?.type===Q.DateOnly&&B.unit!==void 0&&[$.Hour,$.Minute,$.Second].includes(B.unit)&&(B.unit=$.Day,B.size=1),w.size=B.size,w.unit=B.unit);let{uniqueQuery:k,mapToStatField:_}=xn({chartConfig:e,queryConfig:r,queryObject:i,timeIntervalInfo:B,setTimeBinningInfoWhenNotProvided:l,returnFeaturesExtent:u,chartLimits:c}),E=je({count:T??0,seriesCount:g.length,chartType:S.LineSeries,chartLimits:c});if(E){if(Qt(F,i)){let D=e.axes?.[0].valueFormat.type===S.DateAxisFormat?e.axes[0].valueFormat.intlOptions.timeZone:void 0,Y=s?.[0]instanceof Yu?s:await Zd({queryObject:i,dateField:p,splitByField:F,queryConfig:k,axisTimeZone:D,temporalBinning:w,errorStrings:o,view:f,syncViewTimeZone:m,abortSignal:a}),J="y"in y&&typeof y.y=="string"?y.y:void 0;if(x=Zm({chartConfig:e,queryResults:Y,mapToStatField:_,splitByField:F,x:p,y:J,nullPolicy:w.nullPolicy,queryObject:i}),!je({count:x.length,seriesCount:g.length,chartType:S.LineSeries,chartLimits:c})){let R=Se(g),ie=x.filter(fe=>R.some(ge=>ge in fe&&Number.isFinite(fe[ge]))).length;je({count:ie,seriesCount:g.length,chartType:S.LineSeries,chartLimits:c})||(E=!1)}}else if(I?.dateRange.dateMinTimestamp&&I.dateRange.dateMaxTimestamp){let{numberOfFinalBinsWithinDataRange:D}=qo({dateMinTimestamp:I.dateRange.dateMinTimestamp,dateMaxTimestamp:I.dateRange.dateMaxTimestamp,timeIntervalInfo:B});T=D*g.length,T=Lo(T,B.unit),x=await di({queryObject:i,uniqueQuery:k,chartConfig:e,mapToStatField:_,elementCount:T,chartLimits:c,isTimeBinningSeries:!0,popupTemplateFieldInfosEnabled:d,errorStrings:o,abortKey:n,abortSignal:a}),x=await _m({queryObject:i,queryConfig:r,queryResults:x,x:p,seriesConfig:g,dateRange:I.dateRange,timeIntervalInfo:B,errorStrings:o,abortSignal:a})}Ks(i)&&x&&x?.length===Mm&&(M=!0),h===St.RenderUpToTheLimit&&x&&(x=mh({chartConfig:e,chartLimits:c,data:x}))}E||(C.valid=!1,C.invalidType=H.LineChartExceedsLimit),x&&x.length>0&&(x[x.length-1][v.lastTemporalBin]=!0),C.data={dataItems:x,timeIntervalInfo:B,serverLimitReached:M},C.count=T}}return C}async function hh(t){let{chartConfig:e,queryConfig:r,queryObject:i,abortKey:n,setTimeBinningInfoWhenNotProvided:a,returnFeaturesExtent:s,chartLimits:o,popupTemplateFieldInfosEnabled:l,errorStrings:u}=t,c=Jt(e),d={valid:!0},f=e.series,m=Xe({seriesConfig:f[0],xAxisValueFormatType:$e(e),setTimeBinningInfoWhenNotProvided:a,queryObject:i}),{uniqueQuery:h,mapToStatField:g}=xn({chartConfig:e,queryObject:i,queryConfig:r,setTimeBinningInfoWhenNotProvided:a,fetchFullBoxPlotData:!c,returnFeaturesExtent:s,chartLimits:o}),y=await di({queryObject:i,uniqueQuery:h,elementCount:1,chartConfig:e,mapToStatField:g,isTimeBinningSeries:m,showMean:c,chartLimits:o,popupTemplateFieldInfosEnabled:l,errorStrings:u,abortKey:n});return Fe(e)&&(y=Oo({chartConfig:e,data:y,calculateZScore:!1})),d.data={dataItems:y},d}async function yh(t){let{chartConfig:e,queryConfig:r,queryObject:i,setTimeBinningInfoWhenNotProvided:n,returnFeaturesExtent:a,chartLimits:s,popupTemplateFieldInfosEnabled:o,hideZeroCountCategories:l,replaceNoValueCategoryWithZero:u,view:c,abortKey:d,errorStrings:f}=t,m={valid:!0};if(Fe(e)){let h=Fe(e)?e.showMean:!1;m=await Tn({queryObject:i,chartConfig:e,queryConfig:r,setTimeBinningInfoWhenNotProvided:n,returnFeaturesExtent:a,chartLimits:s,popupTemplateFieldInfosEnabled:o,hideZeroCountCategories:l,replaceNoValueCategoryWithZero:u,view:c,errorStrings:f,abortKey:d}),h&&m.data&&"dataItems"in m.data&&"meanLines"in m.data&&m.data.meanLines&&(m.data.dataItems=[...m.data.dataItems,...m.data.meanLines])}return m}var gh="{ groupByFieldsForStatistics } WHEN ({ y } { yMinOperand } { yValue } AND { y } { yMaxOperand } { yValuePlusStep } AND { x } { xMinOperand } { xValue } AND { x } { xMaxOperand } { xValuePlusStep }) THEN '{ xValue }|{ xValuePlusStep}|{ yValue }|{ yValuePlusStep }'";async function ph(t){let{chartConfig:e,queryObject:r,queryConfig:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o=e.series[0],{x:l,y:u}=o,{dataContextCountDistinctX:c,dataContextCountDistinctY:d}=v.scatterplotAggregationFields,f={...i,outStatistics:[{statisticType:A.Count,outStatisticFieldName:c,onStatisticField:l},{statisticType:A.Count,outStatisticFieldName:d,onStatisticField:u}],returnDistinctValues:!0};return await vr({queryObject:r,queryConfig:f,errorStrings:n,abortKey:a,abortSignal:s})}async function Sh(t){let{statsMap:e,chartConfig:r,queryObject:i,chartLimits:n,queryConfig:a,errorStrings:s,abortKey:o,abortSignal:l}=t,{dataContextXMinField:u,dataContextXMaxField:c,dataContextYMinField:d,dataContextYMaxField:f,dataContextCountDistinctX:m,dataContextCountDistinctY:h}=v.scatterplotAggregationFields,g,y,p,F,C,x=e.get(u),w=e.get(c),N=e.get(d),O=e.get(f);if(x!=null&&N!==void 0&&N!==null&&w!==void 0&&w!==null&&O!==void 0&&O!==null&&!Number.isNaN(x+w+N+O)){let{maxScatterPointsAfterAggregation:T}=bt(n),B=Math.floor(Math.sqrt(T)),M=await ph({queryObject:i,chartConfig:r,queryConfig:a,errorStrings:s,abortKey:o,abortSignal:l});p=Math.min(M.get(h)??Number.NaN,B),F=Math.min(M.get(m)??Number.NaN,B),C=F*p,g=w===x?0:(w-x)/(F-1),y=O===N?0:(O-N)/(p-1),e.set(v.scatterplotAggregationFields.xStep,g),e.set(v.scatterplotAggregationFields.yStep,y),e.set(v.scatterplotAggregationFields.rowCount,p),e.set(v.scatterplotAggregationFields.columnCount,F),e.set(v.scatterplotAggregationFields.realGridSize,C)}}function bh(t){let{groupByFieldsForStatistics:e,x:r,y:i,xValue:n,yValue:a,xStep:s,yStep:o,endOfRow:l,endOfColumn:u}=t,c=e===""?Bt.groupByCaseBegin:e;return c=_e(gh,{groupByFieldsForStatistics:c,x:r,y:i,xValue:`${n}`,yValue:`${a}`,xValuePlusStep:`${n+(u?0:s)}`,yValuePlusStep:`${a+(l?0:o)}`,xMinOperand:u?"=":">=",yMinOperand:l?"=":">=",xMaxOperand:u?"=":"<",yMaxOperand:l?"=":"<"}),c}async function vh(t){let{chartConfig:e,queryConfig:r,queryObject:i,xMin:n,xMax:a,yMin:s,yMax:o,errorStrings:l,abortKey:u,abortSignal:c}=t,d=e.series[0],{x:f,y:m}=d,h={...r};return h.where=ee([h.where,`${f}>=${n}`,`${f}<=${a}`]),f!==m&&(h.where=ee([h.where,`${m}>=${s}`,`${m}<=${o}`])),await Le({queryObject:i,queryConfig:h,noBatch:!0,featureCount:1,errorStrings:l,abortKey:u,abortSignal:c})}async function Fh(t){let{statsMap:e,chartConfig:r,queryObject:i,queryConfig:n,useQueryAttributeBins:a,errorStrings:s,abortKey:o,abortSignal:l}=t,u=r.series[0],{x:c,y:d}=u,{dataContextXMinField:f,dataContextXMaxField:m,dataContextYMinField:h,dataContextYMaxField:g,queryNumberOfFeatures:y,queryNumberOfAggregatedFeatures:p}=v.scatterplotAggregationFields,F,C=e?.get(f)??Number.NaN,x=e?.get(m)??Number.NaN,w=e?.get(y)??Number.NaN,N=e?.get(h)??C,O=e?.get(g)??x;if(C!=null&&N!==void 0&&N!==null&&x!==void 0&&x!==null&&O!==void 0&&O!==null&&!Number.isNaN(C+x+N+O)){let T=U(i),{idField:B,isTraditionalTypeOID:M}=We(T),q=M?B:"*",I=e?.get(v.scatterplotAggregationFields.xStep),k=e?.get(v.scatterplotAggregationFields.yStep),_=e?.get(v.scatterplotAggregationFields.realGridSize),E=e?.get(v.scatterplotAggregationFields.rowCount),D=e?.get(v.scatterplotAggregationFields.columnCount),Y=new Map,J=Re(i);if(J?.forEach(R=>{Sr(R)&&Y.set(R.name,{onStatisticField:R.name,outStatisticFieldName:R.name,statisticType:A.Maximum})}),(J.filter(R=>u?.additionalTooltipFields?.includes(R.name))??[])?.forEach(R=>{Sr(R)||Y.set(R.name,{onStatisticField:R.name,outStatisticFieldName:R.name,statisticType:A.Maximum})}),(await bo(T)).forEach(R=>{Y.set(R,{onStatisticField:R,outStatisticFieldName:R,statisticType:A.Maximum})}),B!==""&&Y.set(B,{onStatisticField:q,outStatisticFieldName:p,statisticType:A.Count}),Y.set(c,{onStatisticField:c,outStatisticFieldName:c,statisticType:A.Maximum}).set(d,{onStatisticField:d,outStatisticFieldName:d,statisticType:A.Maximum}),I!==void 0&&k!==void 0){if(a){let R={...n,outStatistics:[...Y.values()]};F=await $d({queryObject:i,queryConfig:R,xStep:I,xMin:C,xMax:x,x:c,y:d,yStep:k,errorStrings:s,abortSignal:l})}else if(E!==void 0&&D!==void 0){let R=0,{maxScatterCellsPerQuery:ie,maxScatterCellsPerQueryForStandard:fe}=nr(),ge=await Ff(T,l)?fe:ie,He=[],fi=!0,Et=C,ht=N,At="",xr=1,mi=1,Cr=Number.MAX_SAFE_INTEGER,wr=Number.MIN_SAFE_INTEGER,Nr=Number.MAX_SAFE_INTEGER,Tr=Number.MIN_SAFE_INTEGER;for(;mi<=D&&fi;){for(ht=N,xr=1;xr<=E&&fi;){if(At=bh({groupByFieldsForStatistics:At,x:c,y:d,xValue:Et,yValue:ht,xStep:I,yStep:k,endOfRow:xr===E,endOfColumn:mi===D}),Et<Cr&&(Cr=Et),Et+I>wr&&(wr=Et+I),ht<Nr&&(Nr=ht),ht+I>Tr&&(Tr=ht+k),R+=1,R%ge===0||R===_||R===w){At=`${At} ${Bt.groupByCaseEnd}`;let _o={...n,groupByFieldsForStatistics:[At],outStatistics:[...Y.values()]};He.push(vh({chartConfig:r,queryConfig:_o,queryObject:i,xMin:Cr,xMax:wr,yMin:Nr,yMax:Tr,errorStrings:s,abortKey:o,abortSignal:l})),Cr=Number.MAX_SAFE_INTEGER,wr=Number.MIN_SAFE_INTEGER,Nr=Number.MAX_SAFE_INTEGER,Tr=Number.MIN_SAFE_INTEGER,At="",R===_&&(fi=!1)}ht+=k,xr+=1}Et+=I,mi+=1}F=(await Promise.all(He)).flat()}}}return F}async function xh(t){let{chartConfig:e,queryConfig:r,queryObject:i,errorStrings:n,abortKey:a,abortSignal:s}=t,o=e.series[0],{x:l,y:u}=o,c=new Map,{dataContextXMinField:d,dataContextXMaxField:f,dataContextYMinField:m,dataContextYMaxField:h,queryNumberOfFeatures:g}=v.scatterplotAggregationFields,{idField:y,isTraditionalTypeOID:p}=We(U(i)),F=p?y:"*",C=[{statisticType:A.Count,onStatisticField:F,outStatisticFieldName:g},{statisticType:A.Minimum,outStatisticFieldName:d,onStatisticField:l},{statisticType:A.Maximum,outStatisticFieldName:f,onStatisticField:l}];l!==u&&C.push({statisticType:A.Minimum,outStatisticFieldName:m,onStatisticField:u},{statisticType:A.Maximum,outStatisticFieldName:h,onStatisticField:u});let x={...r};return x.outStatistics=C,c=await vr({queryObject:i,queryConfig:x,errorStrings:n,abortKey:a,abortSignal:s}),l===u&&(c.set(m,c.get(d)??Number.NaN),c.set(h,c.get(f)??Number.NaN)),c}function ei(t){let{value:e,valueMin:r,valueMax:i}=t;return e===r||e===i?e:Math.random()*(i-r)+r}function Ch(t){let{useQueryAttributeBins:e,graphic:r,x:i,y:n,yStep:a}=t,{groupByOutKeyword:s}=Bt,{dataContextXMinField:o,dataContextXMaxField:l,dataContextYMinField:u,dataContextYMaxField:c}=v.scatterplotAggregationFields,d=[];if(e&&"stackedAttributes"in r&&r.stackedAttributes){let f=lo(i,n),m=r.attributes[f.lowerBoundaryAlias],h=r.attributes[f.upperBoundaryAlias];r.stackedAttributes.forEach(g=>{let y=g[f.stackAlias],p;typeof y=="number"&&typeof a=="number"&&(y*=a),typeof y=="number"&&typeof a=="number"&&(p=y+a);let F=g[i],C=g[n];typeof y=="number"&&typeof p=="number"&&typeof F=="number"&&typeof C=="number"&&d.push({...g,[i]:ei({value:F,valueMin:m,valueMax:h}),[n]:ei({value:C,valueMin:y,valueMax:p}),[o]:Math.min(m,h),[l]:Math.max(m,h),[u]:y,[c]:p})})}else{let{expr:f,isInItem:m}=ar(r.attributes);if(m&&f&&r.attributes[f]!==s){let[h,g,y,p]=r.attributes[f].split("|");h=Math.min(h,g),g=Math.max(h,g),y=Math.min(y,p),p=Math.max(y,p);let F={...r.attributes,[o]:h,[l]:g,[u]:y,[c]:p};F[i]=ei({value:F[i],valueMin:h,valueMax:g}),F[n]=ei({value:F[n],valueMin:y,valueMax:p}),d=[F]}}return d}function wh(t){let{chartConfig:e,rawData:r,isAggregationMode:i,yStep:n,useQueryAttributeBins:a}=t,s=e.series[0],{x:o,y:l}=s,u=(Array.isArray(r)?r:r?.features)?.flatMap(c=>{let d=[{...c.attributes}];return On(d[0],[o,l]),i?d=Ch({useQueryAttributeBins:a,graphic:c,x:o,y:l,yStep:n}):d[0][G.uniqueIdsName]=c.getObjectId(),d});return u=u?.filter(c=>{let{expr:d}=ar(c);return Number.isFinite(c[o])&&Number.isFinite(c[l])&&(d===void 0||c[d]!==Bt.groupByOutKeyword)}),u??[]}async function Nh(t){let{queryObject:e,queryConfig:r,chartConfig:i,featureCount:n,errorStrings:a,abortKey:s,abortSignal:o}=t,l=i.series[0],{x:u,y:c}=l,d=U(e),f=[],m=Re(e),h=li(d).idFields,g=(m?.filter(x=>Sr(x)&&x.name!==u&&x.name!==c)??[]).map(x=>x.name)??[],y=l?.additionalTooltipFields??[],p=Array.from(new Set([u,c,...h??[],...g,...y])),F=Be(d);if(F&&!F.isTable){let{rendererField:x,rendererNormalizationField:w}=pf(d?.renderer??void 0);he(x)||p.push(x),he(w)||p.push(w)}let C={...r,orderByFields:[`${u} ${be.Ascending}`],outFields:p};return f=await Le({queryObject:e,queryConfig:C,featureCount:n,errorStrings:a,abortKey:s,abortSignal:o}),f}async function Th(t){let e,{chartConfig:r,queryConfig:i,queryObject:n,statsMap:a,numberOfFeatures:s,isAggregationMode:o,useQueryAttributeBins:l,errorStrings:u,abortKey:c,abortSignal:d}=t,f=r.series[0],{x:m,y:h}=f;if(!Number.isNaN(s)&&s>0){let g={...i};g.where=ee([g.where,`${m} IS NOT NULL`,`${h} IS NOT NULL`]),o?e=await Fh({chartConfig:r,queryObject:n,queryConfig:g,statsMap:a,useQueryAttributeBins:l,errorStrings:u,abortKey:c,abortSignal:d}):e=await Nh({queryObject:n,chartConfig:r,queryConfig:g,featureCount:s,errorStrings:u,abortKey:c,abortSignal:d})}return e}async function Ro(t){let{chartConfig:e,queryConfig:r,queryObject:i,sortData:n,calculateTrendLine:a,chartLimits:s,errorStrings:o,abortKey:l,abortSignal:u}=t,c;if(oe(i))c=await Jd(t);else{let d=await xh({chartConfig:e,queryConfig:r,queryObject:i,errorStrings:o,abortKey:l,abortSignal:u}),{queryNumberOfFeatures:f,yStep:m}=v.scatterplotAggregationFields,{maxScatterPointsBeforeAggregation:h}=bt(s),g=d?.get(f)??Number.NaN,y=g>=h,p=pc(i);y&&await Sh({statsMap:d,chartConfig:e,queryObject:i,chartLimits:s,queryConfig:r,errorStrings:o,abortKey:l,abortSignal:u});let F=await Th({...t,queryObject:i,statsMap:d,numberOfFeatures:g,isAggregationMode:y,useQueryAttributeBins:p}),C=wh({chartConfig:e,rawData:F,isAggregationMode:y,yStep:d.get(m),useQueryAttributeBins:p});n!==!1&&gr({arrayToSort:C,sortingField:e.series[0].x,orderBy:be.Ascending});let{r2:x,trendLinePoints:w}=a!==!1?await mo({data:C,statsMap:d,queryConfig:r,queryObject:i,chartConfig:e,errorStrings:o,abortSignal:u}):v.scatterplotSeries;c={dataItems:C,r2:x,trendLinePoints:w,aggregated:y}}return c}function Yt(t){let e=t===void 0||t==="";return{[P.Average]:`${e?"":`${t}_`}${P.Average}`,[P.Min]:`${e?"":`${t}_`}${P.Min}`,[P.Max]:`${e?"":`${t}_`}${P.Max}`,[P.FirstQuartile]:`${e?"":`${t}_`}${P.FirstQuartile}`,[P.Median]:`${e?"":`${t}_`}${P.Median}`,[P.ThirdQuartile]:`${e?"":`${t}_`}${P.ThirdQuartile}`,[P.IQR]:`${e?"":`${t}_`}${P.IQR}`,[P.Outlier]:`${e?"":`${t}_`}${P.Outlier}`,[P.StandardDeviation]:`${e?"":`${t}_`}${P.StandardDeviation}`}}function Wo(t){return"subType"in t&&t.subType===Pn.FeatureGauge}function Mn(t){let e;return t!==void 0&&("bins"in t?e=t.bins:"dataItems"in t&&(e=t.dataItems)),e}function jo(t){return t===b.BoxPlotMultiFields||t===b.BoxPlotMultiFieldsAndCategory||t===b.BoxPlotMultiFieldsAndSplitBy}function se(t){let{key:e,y:r,chartSubType:i,splitBy:n,splitByValue:a,showOutliers:s,standardizeValues:o}=t,l=a,u=Yt(r)[e];return s===!0&&(e===P.Min||e===P.Max)&&(u=`${u}${$n}`),o===!0&&(jo(i)||e===P.Outlier)&&(u=`${u}${Rn}`),(a===void 0||`${a}`.trim()==="")&&(l=xe({where:n,normalize:!0,escape:!1})),l!==void 0&&`${l}`.trim()!==""&&(u=`${l}${u!==""?`_${u}`:""}`),u}function un(t){let{dataItem:e,y:r,splitBy:i,showOutliers:n}=t,a=se({key:P.FirstQuartile,y:r,splitBy:i,showOutliers:n}),s=se({key:P.ThirdQuartile,y:r,splitBy:i,showOutliers:n});return Number.isFinite(e[a])||Number.isFinite(e[s])}function Oh(t){let{configSeries:e,boxPlotDataItem:r,yList:i,showOutliers:n}=t,a=W(e),s=!1;switch(a){case b.BoxPlotMonoField:case b.BoxPlotMultiFields:case b.BoxPlotMonoFieldAndCategory:s=un({dataItem:r,showOutliers:n});break;case b.BoxPlotMultiFieldsAndCategory:s=i.some(o=>un({dataItem:r,y:o,showOutliers:n}));break;case b.BoxPlotMonoFieldAndSplitBy:case b.BoxPlotMultiFieldsAndSplitBy:case b.BoxPlotMonoFieldAndCategoryAndSplitBy:s=e.some(o=>un({dataItem:r,splitBy:o.query?.where,showOutliers:n}));break;default:s=!1;break}return s}function Zo(t){return t.map(e=>e.id).filter(e=>e!==void 0)}function Se(t,e){let r=[],i=e??Zo(t),n=W(t);return r=t.filter(a=>i.includes(a.id)).map(a=>{let s="y"in a?a.y:void 0;return s!==void 0&&n===b.BarAndLineSplitByNoAggregation&&(s=`${s.toString()}_${xe({where:a.query?.where,keepSurroundingQuotes:!1,escape:!1})}`),s}).filter(a=>a!==void 0),Array.from(new Set(r.flat()))}function In(t){let{seriesConfig:e,filteredSeriesIds:r,showMean:i}=t,n=[];if(i===!0){let a=e.find(s=>s.type===S.BoxPlotSeries);a!==void 0&&"y"in a&&(n=[a.y].flat())}else n=Se(e,r);return n}function lt(t,e){return t===null&&e===!0||Number.isFinite(t)}function Bh(t){let{dataItem:e,x:r,y:i,nullAsValid:n=!1,aggregationType:a=A.Count}=t,s=e[r],o=e[i];return s!==void 0&&(typeof s!="number"||Number.isFinite(s))&&lt(o,n)&&(a!==A.Count||o!==0)}function a0(t){let{chartConfig:e,nullAsValid:r=!1,dataSet:i}=t,n=!0;if(e!==void 0){let a=Z(e.series);if(i===void 0||i.length===0)n=!0;else{let s=Se(e.series);n=!i.some(o=>{let l=!1;switch(a){case S.HistogramSeries:{let u=o;l=lt(u.minValue,r)&&lt(u.maxValue,r)}break;case S.ScatterSeries:{let u=o,{x:c,y:d}=e.series[0];l=lt(u[c],r)&&lt(u[d],r)}break;case S.ComboLineAndBarSeries:case S.RadarSeries:case S.LineSeries:case S.BarSeries:{let u=o,{x:c}=e.series[0];l=s.some(d=>Bh({dataItem:u,x:c,y:d,nullAsValid:r,aggregationType:e.series[0].query?.outStatistics?.[0]?.statisticType}));break}case S.BoxPlotSeries:{if(Fe(e)){let u=e.series;l=Oh({configSeries:u,boxPlotDataItem:o,yList:s,showOutliers:e.showOutliers})}break}case S.PieSeries:{let u=o,{x:c,y:d}=e.series[0];W(e.series)===b.PieFromFields&&(c=ve,d=ze);let f=u[d];l=u[c]!==void 0&&u[c]!==null&&!Ln(f)&&lt(Number(f),r)}break;case S.GaugeSeries:{let{x:u}=e.series[0];l=lt(o[u],r)}break;case S.HeatSeries:l=i.some(u=>lt(u[j.valueField],r));break}return l})}}return n}function Mh(t,e){let r=new Map,i=e??Zo(t);return t.forEach(n=>{if(i.includes(n.id)&&"y"in n){let a=r.get(n.type)??[];a.push(n.y),r.set(n.type,a)}}),r}function Ih(t){let{seriesConfig:e,filteredSeriesIds:r,filteredData:i}=t,n=Mh(e,r),a=e.find(u=>u.type===S.LineSeries||u.type===S.RadarSeries)?.stackNegativeValuesToBaseline??!0,s=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER,l=!1;return i.forEach(u=>{n.forEach(c=>{if(a){let d=0,f=0,m=!1,h=!1;for(let g=0;g<c.length;g+=1){let y=u[c[g]];Number.isFinite(y)&&(y<0?(f+=y,h=!0,l=!0):(d+=y,m=!0))}s=m?Math.max(s,d):s,o=h?Math.min(o,f):o,m&&!h&&(o=Math.min(o,d)),!m&&h&&(s=Math.max(s,f)),m&&d<=0&&(l=!0)}else{let d=0;for(let f=0;f<c.length;f+=1){let m=u[c[f]];d+=m,s=Math.max(s,d),o=Math.min(o,d)}(s<=0||o<=0)&&(l=!0)}})}),{stackedMinY:o,stackedMaxY:s,dataHasNegativeValues:l}}function Eh(t){let{dataItem:e,...r}=t,i=se({key:P.Min,...r}),n=se({key:P.Max,...r}),a=e[i],s=e[n];return{min:a,max:s}}function _s(t){let e=Number.NaN,r=Number.NaN,i,n,{chartConfig:a,chartData:s,filteredSeriesIds:o}=t,{series:l}=a;if(l?.length>0){let{x:u}=l[0],c=Z(a.series);if(c===S.HistogramSeries&&s.length>0){let d=s[0]?.[qs.Start],f=s[s.length-1]?.[qs.End];i=typeof d=="number"?d:i,n=typeof f=="number"?f:n}else{let d=s.filter(f=>f[u]!==null);if({min:i,max:n}=pr(d,f=>f[u]),a.axes?.[0]?.valueFormat.type===S.DateAxisFormat&&i!==void 0&&n!==void 0&&([i,n]=[new Date(i).valueOf(),new Date(n).valueOf()]),c===S.BoxPlotSeries){e=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;let f=Se(l,o),m=W(l),h="standardizeValues"in a?a.standardizeValues===!0:void 0,g=a.series.map(y=>y.visible!==!1?xe({where:y.query?.where}):"");g.length===0&&g.push(" "),d.forEach(y=>{f.forEach(p=>{let F=m===b.BoxPlotMultiFieldsAndCategory?p:void 0;g.forEach(C=>{let{min:x,max:w}=Eh({y:F,splitByValue:C,chartSubType:m,showOutliers:!1,standardizeValues:h,dataItem:y});x!=null&&x<e&&(e=x),w!=null&&w>r&&(r=w)})})})}else switch(Ir(a)){case qe.Stacked100:case qe.Stacked:{let{stackedMinY:f,stackedMaxY:m}=Ih({seriesConfig:l,filteredData:d,filteredSeriesIds:o});e=f,r=m;break}case qe.Side:default:{e=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER,Se(l,o).forEach(f=>{let{min:m,max:h}=pr(d,g=>g[f]);m!==void 0&&m<e&&(e=m),h!==void 0&&h>r&&(r=h)});break}}}}return{minY:e,maxY:r,minX:i,maxX:n}}function Ah(t){let{chartConfig:e,isSecondValueAxis:r,seriesIds:i}=t,n=i;return e.axes?.length===3&&(n=e.series.map(a=>{let s="";return(i===void 0||i.includes(a.id))&&(r===!0&&"assignToSecondValueAxis"in a&&a.assignToSecondValueAxis===!0||r!==!0&&(!("assignToSecondValueAxis"in a)||a.assignToSecondValueAxis!==!0))&&({id:s}=a),s}).filter(a=>a!=="")),n}function Lh(t){let e=!1;if(t){let r=t.axes?.[0],i=r?.isLogarithmic===!0,n=r?.valueFormat?.type;e=(n===S.NumberAxisFormat||n===S.DateAxisFormat)&&i}return e}function zs(t,e){let r=!1;return Number.isFinite(t)&&t!==Number.MAX_SAFE_INTEGER&&Number.isFinite(e)&&e!==Number.MIN_SAFE_INTEGER&&(r=t<=0||e<=0),r}function qh(t){let{chartConfig:e,chartData:r,axisConfigIndex:i}=t,n=!1;if(i===0){if(Lh(e)){let{minX:a,maxX:s}=_s({chartConfig:e,chartData:r});n=zs(a,s)}}else{let a=Ah({chartConfig:e,isSecondValueAxis:i===2}),{minY:s,maxY:o}=_s({chartConfig:e,chartData:r,filteredSeriesIds:a});n=zs(s,o)}return n}function s0(t){let{chartConfig:e,axisConfigIndex:r,chartData:i}=t,n=!0,a=e?.axes?.[r];return e&&i&&a?.isLogarithmic===!0&&(n=!qh({chartConfig:e,chartData:i,axisConfigIndex:r})),n}function Dh(t,e){let r=t;if(e?.[0]!==void 0&&W(e)===b.PieFromFields){let{x:i,y:n}=e[0];(Or(t)?r:r.dataItems).forEach(a=>(ve in a&&i!==ve&&(a[i]=a[i]!==void 0?a[i]:a[ve],delete a[ve]),ze in a&&n!==ze&&(a[n]=a[n]!==void 0?a[n]:a[ze],delete a[ze]),a))}return r}function Ph(t,e){let r=Z(e),i=t,n=e?.[0];if((r===S.PieSeries||r===S.BoxPlotSeries||r===S.LineSeries||r===S.RadarSeries||r===S.BarSeries||r===S.HeatSeries||r===S.ComboLineAndBarSeries)&&n!==void 0){let a=Or(t),s=a?t:t.dataItems;if(t!==void 0){let{originalCategoryValue:o,originalYCategoryValue:l,originalDateValue:u,xAxisField:c}=v,d=r===S.HeatSeries?j.xField:n.x,f=r===S.HeatSeries?j.yField:void 0;s=s.map(m=>{let h=m[d];m[u]!==void 0?h=m[u]:m[o]!==void 0&&(h=m[o]);let g={...m,[d]:h};if(delete g[u],delete g[o],delete g[c],f){let y=m[f];m[l]!==void 0&&(y=m[l]),g={...g,[f]:y},delete g[l]}return g}),a?i=s:"dataItems"in i&&(i.dataItems=s)}}return i}function Hs(t){let e={...t};delete e[v.technicalSortingFieldBySum],delete e[v.technicalSortingFieldByPercent],delete e[v.pieChart.technicalFieldSlicePercent],delete e[v.pieChart.technicalFieldGroupedSlices],delete e[v.lastTemporalBin],delete e[v.originalServerBinningRange],delete e[v.technicalFieldSplitByField],delete e[G.uniqueIdsName],Object.keys(e).filter(i=>i.includes(v.rendererSymbolField)).forEach(i=>delete e[i]);let r=ar(e);return r.isInItem&&delete e[r.expr??""],e}function kh(t,e){let r=t,i=Z(e),n=Mn(r);if(n!==void 0)switch(i){case S.ComboLineAndBarSeries:case S.BarSeries:case S.LineSeries:case S.RadarSeries:case S.PieSeries:{n=n.map(Hs),r={dataItems:n};let{timeIntervalInfo:a,serverLimitReached:s}=t??{};An(a)||(r.timeIntervalInfo=a),s!==void 0&&(r.serverLimitReached=s)}break;case S.ScatterSeries:r={...r,dataItems:n.map(Hs)};break}return r}var o0=(t,e)=>{let r=10**e;return Math.round(t*r)/r};function l0(t){let{data:e,seriesConfig:r}=t,i=tt(e);return i!==void 0&&(i=Ph(i,r),i=kh(i,r),i=Dh(i,r)),i}function Vh(t){let{dataFetchingResults:e,numberOfQueries:r,series:i}=t,n=Z(i),a=W(i),s=[],o=new Map;for(let l=0;l<r;l+=1){let u=e[l];if(u!==void 0){let c;if(n===S.ScatterSeries)c=u.dataItems;else if("data"in u&&u.data){let d=u.data;"dataItems"in d&&(c=d.dataItems),"outliers"in d&&d.outliers&&s.push(...d.outliers),"meanLines"in d&&d.meanLines&&s.push(...d.meanLines)}if(c)if(i[0].type===S.HeatSeries)r>0&&c.forEach(d=>{o.set(`${d[j.xField]}-${d[j.yField]}`,d)});else if(i[0].type===S.ScatterSeries){let{x:d,y:f}=i[0];s.push(...c.map(m=>({[d]:m[d],[f]:m[f]})))}else u.valid&&(a===b.PieFromFields?s=ni({dataToConvert:c[0],x:ve,y:ze}):a===b.BarAndLineFromFields?s=ni({dataToConvert:c[0],x:i[0].x,y:i[0].y}):s.push(...c))}}return o.size>0&&(s=Array.from(o.values())),s}async function $h(t){let{numberOfQueries:e,selectionOIDs:r,chartConfig:i,queryConfig:n,errorStrings:a,queryObject:s,splitByField:o,replaceNoValueCategoryWithZero:l,hideZeroCountCategories:u,chartLimits:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,view:h}=t,{series:g}=i,y=Z(g),p=[],{maxOIDsPerSelectionQuery:F}=nr();for(let C=0;C<e;C+=1){let x=C*F,w=(C+1)*F-1,N=r.slice(x===0?0:x-1,w),O={...n};switch(O.objectIds=N,y){case S.HeatSeries:p.push($o({completeHeatChartDataset:!1,chartConfig:i,queryConfig:O,queryObject:s,errorStrings:a,chartLimits:c,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,view:h}));break;case S.PieSeries:case S.BarSeries:case S.LineSeries:case S.RadarSeries:case S.ComboLineAndBarSeries:if(Xe({xAxisValueFormatType:$e(i),setTimeBinningInfoWhenNotProvided:d,seriesConfig:g[0],queryObject:s})){let T=tt(i);"temporalBinning"in T.series[0]&&T.series[0].temporalBinning&&(T.series[0].temporalBinning.trimIncompleteTimeInterval=!1,Qt(o,s)&&(delete T.series[0].temporalBinning.start,delete T.series[0].temporalBinning.end)),p.push(Bn({chartConfig:T,queryConfig:O,queryObject:s,chartLimits:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,view:h,errorStrings:a}))}else p.push(hh({queryObject:s,chartConfig:i,chartLimits:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,errorStrings:a,queryConfig:O}));break;case S.BoxPlotSeries:p.push(yh({queryObject:s,chartConfig:i,replaceNoValueCategoryWithZero:l,hideZeroCountCategories:u,chartLimits:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,view:h,errorStrings:a,queryConfig:O}));break;case S.ScatterSeries:p.push(Ro({queryObject:s,chartConfig:i,queryConfig:O,replaceNoValueCategoryWithZero:l,hideZeroCountCategories:u,chartLimits:c,setTimeBinningInfoWhenNotProvided:d,returnFeaturesExtent:f,popupTemplateFieldInfosEnabled:m,view:h,errorStrings:a,sortData:!1,calculateTrendLine:!1}));break;case S.HistogramSeries:p.push(zf({queryObject:s,queryConfig:O,chartConfig:i,x:g[0].x,errorStrings:a}));break}}return await Promise.all(p)}async function u0(t){let{chartConfig:e,chartData:r,dataWasUpdated:i,replaceNoValueCategoryWithZero:n,hideZeroCountCategories:a,queryObject:s,errorStrings:o,selectionIDsChanged:l,chartLimits:u,setTimeBinningInfoWhenNotProvided:c,returnFeaturesExtent:d,popupTemplateFieldInfosEnabled:f,view:m,viewExtentUpdated:h,runtimeDataFilters:g,ignoreViewExtent:y,returnSelectionOIDs:p,selectionData:F}=t,{series:C}=e,{selectionItems:x,selectionOIDs:w}=F??{},N,O=Z(C),T=O!==S.HistogramSeries&&O!==S.HeatSeries&&x!==void 0&&x.length>0&&!(C[0].x in x[0])&&!(ve in x[0])&&!(v.boxPlot.boxPlotCategory in x[0]);if(h!==!0&&p!==!1&&w!==void 0&&w.length>0&&(i===!0||T||l)){let B=Mn(r),M=vo({queryObject:s,chartConfig:e,runtimeDataFilters:g,ignoreViewExtent:y,viewExtent:m?.extent});if(B!==void 0&&!Bc({dataContext:B[0],chartConfig:e,chartLimits:u}))N=B.filter(q=>{let I=q[G.uniqueIdsName];return typeof I=="number"||typeof I=="string"?w?.includes(I):!1});else if(w?.[0]!==void 0&&M!==void 0){let{maxOIDsPerSelectionQuery:q}=nr(),I=Math.ceil(w.length/q),k=de(e.series[0]?.query?.where),_=await $h({numberOfQueries:I,selectionOIDs:w,queryConfig:M,queryObject:s,replaceNoValueCategoryWithZero:n,hideZeroCountCategories:a,chartLimits:u,setTimeBinningInfoWhenNotProvided:c,returnFeaturesExtent:d,popupTemplateFieldInfosEnabled:f,view:m,splitByField:k,errorStrings:o,chartConfig:e});N=Vh({dataFetchingResults:_,numberOfQueries:I,series:C})}}return N}return{a:z,b:ce,c:ic,d:$e,e:Oy,f:ye,g:By,h:Ke,i:Nt,j:My,k:Iy,l:fc,m:Tt,n:Fe,o:mc,p:Ey,q:ve,r:ze,s:Ay,t:Ly,u:yr,v:qy,w:Dy,x:Py,y:ky,z:Vy,A:$y,B:P,C:Ry,D:ct,E:yc,F:Be,G:Wy,H:Qt,I:jy,J:U,K:Zy,L:bc,M:vc,N:_y,O:mt,P:zy,Q:de,R:xe,S:ut,T:W,U:eo,V:Bc,W:Xe,X:Ve,Y:Ic,Z:Os,_:$c,$:Hy,aa:Uy,ba:Gy,ca:Yy,da:Qy,ea:Ky,fa:Jy,ga:Xy,ha:eg,ia:tg,ja:rg,ka:ig,la:ng,ma:ag,na:sg,oa:og,pa:lg,qa:ug,ra:cg,sa:dg,ta:fg,ua:mg,va:hg,wa:Bs,xa:Uc,ya:Ms,za:yg,Aa:io,Ba:gg,Ca:pg,Da:Sg,Ea:Jc,Fa:bg,Ga:vg,Ha:Fg,Ia:xg,Ja:Cg,Ka:rd,La:ud,Ma:wg,Na:Ng,Oa:Tg,Pa:Og,Qa:dn,Ra:Jt,Sa:yd,Ta:Bg,Ua:xn,Va:pe,Wa:Ot,Xa:Mg,Ya:Ig,Za:H,_a:Eg,$a:Le,ab:Ag,bb:jd,cb:Zd,db:Lg,eb:cf,fb:qg,gb:yo,hb:Fr,ib:Dg,jb:So,kb:Pg,lb:kg,mb:Re,nb:Vg,ob:We,pb:Sr,qb:Sf,rb:$g,sb:Rg,tb:Wg,ub:bf,vb:jg,wb:As,xb:xf,yb:Cf,zb:Zg,Ab:vo,Bb:_g,Cb:ui,Db:ee,Eb:qs,Fb:zg,Gb:Hg,Hb:Ug,Ib:Hf,Jb:Uf,Kb:Gg,Lb:Yg,Mb:Qg,Nb:Kg,Ob:Jg,Pb:No,Qb:Xg,Rb:si,Sb:e0,Tb:t0,Ub:r0,Vb:gm,Wb:i0,Xb:n0,Yb:ln,Zb:br,_b:Vo,$b:Wo,ac:Mn,bc:jo,cc:se,dc:un,ec:Se,fc:In,gc:Bh,hc:a0,ic:Ih,jc:_s,kc:Ah,lc:s0,mc:Dh,nc:Ph,oc:Hs,pc:o0,qc:l0,rc:u0}},"layers/support/FeatureFilter","smartMapping/statistics/histogram","smartMapping/statistics/summaryStatistics","geometry/support/jsonUtils","rest/support/AttributeBinsQuery","rest/support/Query","rest/support/StatisticDefinition","time/TimeExtent","layers/FeatureLayer","layers/support/CodedValueDomain","layers/support/Field","layers/support/fieldUtils","portal/Portal","renderers/support/jsonUtils","request","rest/support/FeatureSet","Graphic","symbols/support/symbolUtils","AttributeBinsGraphic","intl","core/promiseUtils","core/sql","applications/Components/imageryUtils","geometry/Extent","geometry/Point","layers/ImageryLayer","layers/ImageryTileLayer","layers/WCSLayer")