unleash-server 6.2.3 → 6.3.0

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 (234) hide show
  1. package/dist/lib/addons/datadog.d.ts.map +1 -1
  2. package/dist/lib/addons/datadog.js +9 -7
  3. package/dist/lib/addons/datadog.js.map +1 -1
  4. package/dist/lib/addons/feature-event-formatter-md-events.d.ts +8 -0
  5. package/dist/lib/addons/feature-event-formatter-md-events.d.ts.map +1 -0
  6. package/dist/lib/addons/feature-event-formatter-md-events.js +297 -0
  7. package/dist/lib/addons/feature-event-formatter-md-events.js.map +1 -0
  8. package/dist/lib/addons/feature-event-formatter-md.d.ts +17 -6
  9. package/dist/lib/addons/feature-event-formatter-md.d.ts.map +1 -1
  10. package/dist/lib/addons/feature-event-formatter-md.js +32 -246
  11. package/dist/lib/addons/feature-event-formatter-md.js.map +1 -1
  12. package/dist/lib/addons/feature-event-formatter-md.test.js +3 -1
  13. package/dist/lib/addons/feature-event-formatter-md.test.js.map +1 -1
  14. package/dist/lib/addons/new-relic.d.ts.map +1 -1
  15. package/dist/lib/addons/new-relic.js +3 -1
  16. package/dist/lib/addons/new-relic.js.map +1 -1
  17. package/dist/lib/addons/slack-app.d.ts.map +1 -1
  18. package/dist/lib/addons/slack-app.js +12 -7
  19. package/dist/lib/addons/slack-app.js.map +1 -1
  20. package/dist/lib/addons/slack.d.ts.map +1 -1
  21. package/dist/lib/addons/slack.js +14 -9
  22. package/dist/lib/addons/slack.js.map +1 -1
  23. package/dist/lib/addons/teams.d.ts.map +1 -1
  24. package/dist/lib/addons/teams.js +9 -7
  25. package/dist/lib/addons/teams.js.map +1 -1
  26. package/dist/lib/addons/webhook.d.ts.map +1 -1
  27. package/dist/lib/addons/webhook.js +3 -1
  28. package/dist/lib/addons/webhook.js.map +1 -1
  29. package/dist/lib/db/account-store.d.ts +2 -1
  30. package/dist/lib/db/account-store.d.ts.map +1 -1
  31. package/dist/lib/db/account-store.js +18 -0
  32. package/dist/lib/db/account-store.js.map +1 -1
  33. package/dist/lib/features/events/event-search-controller.d.ts +3 -1
  34. package/dist/lib/features/events/event-search-controller.d.ts.map +1 -1
  35. package/dist/lib/features/events/event-search-controller.js +21 -2
  36. package/dist/lib/features/events/event-search-controller.js.map +1 -1
  37. package/dist/lib/features/feature-toggle/feature-toggle-service.d.ts.map +1 -1
  38. package/dist/lib/features/feature-toggle/feature-toggle-service.js +4 -12
  39. package/dist/lib/features/feature-toggle/feature-toggle-service.js.map +1 -1
  40. package/dist/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.js +2 -11
  41. package/dist/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.js.map +1 -1
  42. package/dist/lib/features/index.d.ts +1 -0
  43. package/dist/lib/features/index.d.ts.map +1 -1
  44. package/dist/lib/features/index.js +1 -0
  45. package/dist/lib/features/index.js.map +1 -1
  46. package/dist/lib/features/metrics/client-metrics/client-metrics-store-v2.js +1 -1
  47. package/dist/lib/features/metrics/client-metrics/client-metrics-store-v2.js.map +1 -1
  48. package/dist/lib/features/onboarding/onboarding-read-model.d.ts.map +1 -1
  49. package/dist/lib/features/onboarding/onboarding-read-model.js +1 -0
  50. package/dist/lib/features/onboarding/onboarding-read-model.js.map +1 -1
  51. package/dist/lib/features/personal-dashboard/createPersonalDashboardService.d.ts +6 -0
  52. package/dist/lib/features/personal-dashboard/createPersonalDashboardService.d.ts.map +1 -0
  53. package/dist/lib/features/personal-dashboard/createPersonalDashboardService.js +39 -0
  54. package/dist/lib/features/personal-dashboard/createPersonalDashboardService.js.map +1 -0
  55. package/dist/lib/features/personal-dashboard/fake-personal-dashboard-read-model.d.ts +8 -0
  56. package/dist/lib/features/personal-dashboard/fake-personal-dashboard-read-model.d.ts.map +1 -0
  57. package/dist/lib/features/personal-dashboard/fake-personal-dashboard-read-model.js +16 -0
  58. package/dist/lib/features/personal-dashboard/fake-personal-dashboard-read-model.js.map +1 -0
  59. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.d.ts +16 -0
  60. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.d.ts.map +1 -0
  61. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.e2e.test.d.ts +2 -0
  62. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.e2e.test.d.ts.map +1 -0
  63. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.e2e.test.js +237 -0
  64. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.e2e.test.js.map +1 -0
  65. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.js +71 -0
  66. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.js.map +1 -0
  67. package/dist/lib/features/personal-dashboard/personal-dashboard-read-model-type.d.ts +27 -0
  68. package/dist/lib/features/personal-dashboard/personal-dashboard-read-model-type.d.ts.map +1 -0
  69. package/dist/lib/features/personal-dashboard/personal-dashboard-read-model-type.js +3 -0
  70. package/dist/lib/features/personal-dashboard/personal-dashboard-read-model-type.js.map +1 -0
  71. package/dist/lib/features/personal-dashboard/personal-dashboard-read-model.d.ts +9 -0
  72. package/dist/lib/features/personal-dashboard/personal-dashboard-read-model.d.ts.map +1 -0
  73. package/dist/lib/features/personal-dashboard/personal-dashboard-read-model.js +78 -0
  74. package/dist/lib/features/personal-dashboard/personal-dashboard-read-model.js.map +1 -0
  75. package/dist/lib/features/personal-dashboard/personal-dashboard-service.d.ts +25 -0
  76. package/dist/lib/features/personal-dashboard/personal-dashboard-service.d.ts.map +1 -0
  77. package/dist/lib/features/personal-dashboard/personal-dashboard-service.js +75 -0
  78. package/dist/lib/features/personal-dashboard/personal-dashboard-service.js.map +1 -0
  79. package/dist/lib/features/playground/feature-evaluator/strategy/flexible-rollout-strategy.d.ts.map +1 -1
  80. package/dist/lib/features/playground/feature-evaluator/strategy/flexible-rollout-strategy.js +1 -1
  81. package/dist/lib/features/playground/feature-evaluator/strategy/flexible-rollout-strategy.js.map +1 -1
  82. package/dist/lib/features/project/fake-project-owners-read-model.d.ts +6 -3
  83. package/dist/lib/features/project/fake-project-owners-read-model.d.ts.map +1 -1
  84. package/dist/lib/features/project/fake-project-owners-read-model.js +6 -0
  85. package/dist/lib/features/project/fake-project-owners-read-model.js.map +1 -1
  86. package/dist/lib/features/project/fake-project-read-model.d.ts +2 -0
  87. package/dist/lib/features/project/fake-project-read-model.d.ts.map +1 -1
  88. package/dist/lib/features/project/fake-project-read-model.js +6 -0
  89. package/dist/lib/features/project/fake-project-read-model.js.map +1 -1
  90. package/dist/lib/features/project/project-owners-read-model.d.ts +10 -5
  91. package/dist/lib/features/project/project-owners-read-model.d.ts.map +1 -1
  92. package/dist/lib/features/project/project-owners-read-model.js +26 -10
  93. package/dist/lib/features/project/project-owners-read-model.js.map +1 -1
  94. package/dist/lib/features/project/project-owners-read-model.test.js +62 -20
  95. package/dist/lib/features/project/project-owners-read-model.test.js.map +1 -1
  96. package/dist/lib/features/project/project-owners-read-model.type.d.ts +13 -5
  97. package/dist/lib/features/project/project-owners-read-model.type.d.ts.map +1 -1
  98. package/dist/lib/features/project/project-read-model-type.d.ts +5 -4
  99. package/dist/lib/features/project/project-read-model-type.d.ts.map +1 -1
  100. package/dist/lib/features/project/project-read-model.d.ts +4 -2
  101. package/dist/lib/features/project/project-read-model.d.ts.map +1 -1
  102. package/dist/lib/features/project/project-read-model.js +48 -20
  103. package/dist/lib/features/project/project-read-model.js.map +1 -1
  104. package/dist/lib/features/project/project-service.d.ts +4 -4
  105. package/dist/lib/features/project/project-service.d.ts.map +1 -1
  106. package/dist/lib/features/project/project-service.e2e.test.js +20 -3
  107. package/dist/lib/features/project/project-service.e2e.test.js.map +1 -1
  108. package/dist/lib/features/project/project-service.js +7 -15
  109. package/dist/lib/features/project/project-service.js.map +1 -1
  110. package/dist/lib/features/project/project-store-type.d.ts +4 -6
  111. package/dist/lib/features/project/project-store-type.d.ts.map +1 -1
  112. package/dist/lib/features/project/project-store.d.ts +1 -5
  113. package/dist/lib/features/project/project-store.d.ts.map +1 -1
  114. package/dist/lib/features/project/project-store.e2e.test.js +1 -1
  115. package/dist/lib/features/project/project-store.e2e.test.js.map +1 -1
  116. package/dist/lib/features/project/project-store.js +5 -135
  117. package/dist/lib/features/project/project-store.js.map +1 -1
  118. package/dist/lib/metrics.d.ts.map +1 -1
  119. package/dist/lib/metrics.js +18 -1
  120. package/dist/lib/metrics.js.map +1 -1
  121. package/dist/lib/metrics.test.js +2 -2
  122. package/dist/lib/metrics.test.js.map +1 -1
  123. package/dist/lib/openapi/spec/event-schema.d.ts +10 -0
  124. package/dist/lib/openapi/spec/event-schema.d.ts.map +1 -1
  125. package/dist/lib/openapi/spec/event-schema.js +10 -0
  126. package/dist/lib/openapi/spec/event-schema.js.map +1 -1
  127. package/dist/lib/openapi/spec/event-search-response-schema.d.ts +10 -0
  128. package/dist/lib/openapi/spec/event-search-response-schema.d.ts.map +1 -1
  129. package/dist/lib/openapi/spec/events-schema.d.ts +10 -0
  130. package/dist/lib/openapi/spec/events-schema.d.ts.map +1 -1
  131. package/dist/lib/openapi/spec/feature-events-schema.d.ts +10 -0
  132. package/dist/lib/openapi/spec/feature-events-schema.d.ts.map +1 -1
  133. package/dist/lib/openapi/spec/index.d.ts +2 -0
  134. package/dist/lib/openapi/spec/index.d.ts.map +1 -1
  135. package/dist/lib/openapi/spec/index.js +2 -0
  136. package/dist/lib/openapi/spec/index.js.map +1 -1
  137. package/dist/lib/openapi/spec/integration-event-schema.d.ts +10 -0
  138. package/dist/lib/openapi/spec/integration-event-schema.d.ts.map +1 -1
  139. package/dist/lib/openapi/spec/integration-events-schema.d.ts +20 -0
  140. package/dist/lib/openapi/spec/integration-events-schema.d.ts.map +1 -1
  141. package/dist/lib/openapi/spec/personal-dashboard-project-details-schema.d.ts +168 -0
  142. package/dist/lib/openapi/spec/personal-dashboard-project-details-schema.d.ts.map +1 -0
  143. package/dist/lib/openapi/spec/personal-dashboard-project-details-schema.js +81 -0
  144. package/dist/lib/openapi/spec/personal-dashboard-project-details-schema.js.map +1 -0
  145. package/dist/lib/openapi/spec/personal-dashboard-schema.d.ts +142 -0
  146. package/dist/lib/openapi/spec/personal-dashboard-schema.d.ts.map +1 -0
  147. package/dist/lib/openapi/spec/personal-dashboard-schema.js +149 -0
  148. package/dist/lib/openapi/spec/personal-dashboard-schema.js.map +1 -0
  149. package/dist/lib/routes/admin-api/index.d.ts.map +1 -1
  150. package/dist/lib/routes/admin-api/index.js +2 -0
  151. package/dist/lib/routes/admin-api/index.js.map +1 -1
  152. package/dist/lib/schema/role-schema.js +1 -1
  153. package/dist/lib/schema/role-schema.js.map +1 -1
  154. package/dist/lib/services/access-service.d.ts +1 -0
  155. package/dist/lib/services/access-service.d.ts.map +1 -1
  156. package/dist/lib/services/access-service.js +15 -6
  157. package/dist/lib/services/access-service.js.map +1 -1
  158. package/dist/lib/services/access-service.test.js +22 -0
  159. package/dist/lib/services/access-service.test.js.map +1 -1
  160. package/dist/lib/services/clean-permission-environment.test.d.ts +2 -0
  161. package/dist/lib/services/clean-permission-environment.test.d.ts.map +1 -0
  162. package/dist/lib/services/clean-permission-environment.test.js +114 -0
  163. package/dist/lib/services/clean-permission-environment.test.js.map +1 -0
  164. package/dist/lib/services/index.d.ts +2 -1
  165. package/dist/lib/services/index.d.ts.map +1 -1
  166. package/dist/lib/services/index.js +12 -1
  167. package/dist/lib/services/index.js.map +1 -1
  168. package/dist/lib/types/events.d.ts +4 -0
  169. package/dist/lib/types/events.d.ts.map +1 -1
  170. package/dist/lib/types/events.js.map +1 -1
  171. package/dist/lib/types/experimental.d.ts +1 -1
  172. package/dist/lib/types/experimental.d.ts.map +1 -1
  173. package/dist/lib/types/experimental.js +2 -5
  174. package/dist/lib/types/experimental.js.map +1 -1
  175. package/dist/lib/types/model.d.ts +1 -10
  176. package/dist/lib/types/model.d.ts.map +1 -1
  177. package/dist/lib/types/services.d.ts +3 -0
  178. package/dist/lib/types/services.d.ts.map +1 -1
  179. package/dist/lib/types/stores/account-store.d.ts +2 -1
  180. package/dist/lib/types/stores/account-store.d.ts.map +1 -1
  181. package/dist/lib/types/user.d.ts +1 -0
  182. package/dist/lib/types/user.d.ts.map +1 -1
  183. package/dist/lib/types/user.js.map +1 -1
  184. package/dist/migrations/20240919083625-client-metrics-env-variants-daily-to-bigint.d.ts +3 -0
  185. package/dist/migrations/20240919083625-client-metrics-env-variants-daily-to-bigint.d.ts.map +1 -0
  186. package/dist/migrations/20240919083625-client-metrics-env-variants-daily-to-bigint.js +8 -0
  187. package/dist/migrations/20240919083625-client-metrics-env-variants-daily-to-bigint.js.map +1 -0
  188. package/dist/server-dev.js +1 -3
  189. package/dist/server-dev.js.map +1 -1
  190. package/dist/test/fixtures/fake-access-store.d.ts +2 -2
  191. package/dist/test/fixtures/fake-access-store.d.ts.map +1 -1
  192. package/dist/test/fixtures/fake-access-store.js +5 -3
  193. package/dist/test/fixtures/fake-access-store.js.map +1 -1
  194. package/dist/test/fixtures/fake-account-store.d.ts +1 -0
  195. package/dist/test/fixtures/fake-account-store.d.ts.map +1 -1
  196. package/dist/test/fixtures/fake-account-store.js +3 -0
  197. package/dist/test/fixtures/fake-account-store.js.map +1 -1
  198. package/dist/test/fixtures/fake-project-store.d.ts +2 -4
  199. package/dist/test/fixtures/fake-project-store.d.ts.map +1 -1
  200. package/dist/test/fixtures/fake-project-store.js +0 -20
  201. package/dist/test/fixtures/fake-project-store.js.map +1 -1
  202. package/frontend/build/index.html +1 -1
  203. package/frontend/build/static/{AdvancedPlayground-CRdeeG3w.js → AdvancedPlayground-eDTjzS3E.js} +2 -2
  204. package/frontend/build/static/{CreateProject-8AyZj2dp.js → CreateProject-DEpFVLhl.js} +1 -1
  205. package/frontend/build/static/FeatureMetricsChart-CZKpaUOH.js +2 -0
  206. package/frontend/build/static/FeatureStaleDialog-2jleuqhn.js +7 -0
  207. package/frontend/build/static/FeatureViewLazyExport-CeAl2Yig.js +10 -0
  208. package/frontend/build/static/FlagMetricsChart-BRMGXeEU.js +2 -0
  209. package/frontend/build/static/{LazyAdminExport-0g_UOhr3.js → LazyAdminExport-CpfHUB52.js} +14 -14
  210. package/frontend/build/static/LazyProjectExport-XXHA0k8I.js +735 -0
  211. package/frontend/build/static/{LineChartComponent-BLXX5chp.js → LineChartComponent-B5O_VFku.js} +1 -1
  212. package/frontend/build/static/{NetworkOverview-DqGLVIJ6.js → NetworkOverview-DU1OT7gB.js} +1 -1
  213. package/frontend/build/static/NetworkTraffic-DQdYqYoU.js +1 -0
  214. package/frontend/build/static/NetworkTrafficUsage-CkyWiuAD.js +1 -0
  215. package/frontend/build/static/{ReactJSONEditor-Bvhd5heT.js → ReactJSONEditor-DlQuk0pf.js} +1 -1
  216. package/frontend/build/static/{RoleCell-DGcue0jn.js → RoleCell-DMPAgQMx.js} +1 -1
  217. package/frontend/build/static/{StrategyItemContainer-Das6_30A.js → StrategyItemContainer-L9vwk9uU.js} +1 -1
  218. package/frontend/build/static/aggregateFeatureMetrics-CLK9MToQ.js +1 -0
  219. package/frontend/build/static/formatTickValue-DArtcDRb.js +6 -0
  220. package/frontend/build/static/{index-BsIpdLcw.js → index-DK5jinWf.js} +1 -1
  221. package/frontend/build/static/index-JQ6lMAyk.js +524 -0
  222. package/frontend/build/static/onboardingConcepts-1jcVefeL.png +0 -0
  223. package/frontend/build/static/unknownify-C7SyNno2.js +1 -0
  224. package/frontend/build/static/{useApiTokens-5JgqgHim.js → useApiTokens-DQBXJ3PL.js} +1 -1
  225. package/frontend/package.json +13 -13
  226. package/package.json +7 -6
  227. package/frontend/build/static/FeatureMetricsChart-DEo4WxO1.js +0 -2
  228. package/frontend/build/static/FeatureStaleDialog-CrsbH2rq.js +0 -7
  229. package/frontend/build/static/FeatureViewLazyExport-BwY7TYmZ.js +0 -10
  230. package/frontend/build/static/LazyProjectExport-C1eSkT3Z.js +0 -177
  231. package/frontend/build/static/NetworkTraffic-BWFLlaz7.js +0 -1
  232. package/frontend/build/static/NetworkTrafficUsage-BvoBumVR.js +0 -6
  233. package/frontend/build/static/index-Cx91uh9W.js +0 -524
  234. package/frontend/build/static/unknownify-8qa4PVkQ.js +0 -1
@@ -1 +1 @@
1
- import{s as c,j as a,B as p,E as f,T as y,V as m,b as S,bb as h,r as u,C,i9 as j,ia as I,ib as v,ic as L,id as w,ie as k,ig as R,ih as z,ii as A}from"./index-Cx91uh9W.js";import{L as B}from"./index-BsIpdLcw.js";const E=c("ul")(({theme:e})=>({listStyle:"none",margin:0,padding:0})),P=c("li")(({theme:e})=>({marginBottom:e.spacing(.5),display:"flex",alignItems:"center"})),T=c("span")(({theme:e})=>({display:"inline-block",width:8,height:8,borderRadius:"50%",marginRight:e.spacing(1)})),g=16,D=e=>e==="left"?"flex-start":e==="right"?"flex-end":"center",Y=(e=0,t)=>t==="left"?e+g:t==="right"?e-g:e,b=({tooltip:e,children:t})=>a.jsx(p,{sx:n=>({top:((e==null?void 0:e.caretY)||0)+g,left:Y(e==null?void 0:e.caretX,e==null?void 0:e.align),width:"1px",position:"absolute",display:e?"flex":"none",pointerEvents:"none",zIndex:n.zIndex.tooltip,flexDirection:"column",alignItems:D(e==null?void 0:e.align)}),children:t}),_=({tooltip:e})=>a.jsx(b,{tooltip:e,children:a.jsxs(f,{elevation:3,sx:t=>({width:220,padding:t.spacing(1.5,2)}),children:[a.jsx(y,{variant:"body2",sx:t=>({marginBottom:t.spacing(1),color:t.palette.text.secondary}),children:e==null?void 0:e.title}),a.jsx(E,{children:e==null?void 0:e.body.map(t=>a.jsxs(P,{children:[a.jsx(T,{sx:{backgroundColor:t.color},children:" "}),a.jsx(y,{variant:"body2",sx:{display:"inline-block"},children:t.title})]},m(t)))})]})}),M=e=>t=>{var s,r;const n=t.tooltip;if(n.opacity===0){e(null);return}e({caretX:n==null?void 0:n.caretX,caretY:n==null?void 0:n.caretY,title:((s=n==null?void 0:n.title)==null?void 0:s.join(" "))||"",align:n==null?void 0:n.xAlign,body:((r=n==null?void 0:n.body)==null?void 0:r.map((i,o)=>{var l,d,x;return{title:(l=i==null?void 0:i.lines)==null?void 0:l.join(" "),color:(x=(d=n==null?void 0:n.labelColors)==null?void 0:d[o])==null?void 0:x.borderColor,value:""}}))||[],dataPoints:(n==null?void 0:n.dataPoints)||[]})},O={position:"bottom",labels:{boxWidth:12,padding:30,generateLabels:e=>{var o;const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:s,textAlign:r,color:i}}=((o=e==null?void 0:e.legend)==null?void 0:o.options)||{labels:{}};return e._getSortedDatasetMetas().map(l=>{const d=l.controller.getStyle(n?0:void 0);return{text:t[l.index].label,fillStyle:d.borderColor,fontColor:i,hidden:!l.visible,lineWidth:0,borderRadius:6,strokeStyle:d.borderColor,pointStyle:s||d.pointStyle,textAlign:r||d.textAlign,datasetIndex:l.index}})}}},W=(e,t,n,s)=>({responsive:!0,...s?{animation:{duration:0}}:{},plugins:{legend:{...O,display:!s},tooltip:{enabled:!1,position:"nearest",interaction:{axis:"xy",mode:"nearest"},external:M(n)}},locale:t.locale,interaction:{intersect:!1,axis:"xy",mode:"nearest"},elements:{point:{radius:0,hitRadius:15}},tension:.1,color:e.palette.text.secondary,scales:{y:{beginAtZero:!0,type:"linear",grid:{color:e.palette.divider,borderColor:e.palette.divider},ticks:{color:e.palette.text.secondary,display:!s,precision:0}},x:{type:"time",time:{unit:"week",tooltipFormat:"PPP"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:e.palette.text.secondary,display:!s,source:"data",maxRotation:90,minRotation:23.5}}}}),X=c("div")(({theme:e})=>({position:"relative"})),F=c("div")(({theme:e})=>({position:"absolute",inset:0,display:"flex",zIndex:e.zIndex.appBar,"&::before":{zIndex:e.zIndex.fab,content:'""',position:"absolute",inset:0,backgroundColor:e.palette.background.paper,opacity:.8}})),G=c("div")(({theme:e})=>({zIndex:e.zIndex.modal,margin:"auto",color:e.palette.text.secondary,textAlign:"center"})),H={id:"customLine",afterDraw:e=>{var n;if((n=e.tooltip)!=null&&n.opacity&&e.tooltip.x){const s=e.tooltip.caretX,r=e.scales.y,i=e.ctx;i.save();const o=i.createLinearGradient(s,r.top,s,r.bottom);o.addColorStop(0,"rgba(129, 122, 254, 0)"),o.addColorStop(1,"rgba(129, 122, 254, 0.12)"),i.fillStyle=o,i.fillRect(s-26/2,r.top,26,r.bottom-r.top),i.restore()}}},q=({data:e,aspectRatio:t=2.5,cover:n,overrideOptions:s,TooltipComponent:r})=>{const i=S(),{locationSettings:o}=h(),[l,d]=u.useState(null),x=u.useMemo(()=>({...W(i,o,d,!!n),...s}),[i,o,s,n]);return a.jsxs(X,{children:[a.jsx(B,{options:x,data:e,plugins:[H],height:100,width:100*t},n?"cover":"chart"),a.jsx(C,{condition:!n,show:r?a.jsx(b,{tooltip:l,children:a.jsx(r,{tooltip:l})}):a.jsx(_,{tooltip:l}),elseShow:a.jsx(F,{children:a.jsx(G,{children:n!==!0?n:" "})})})]})};j.register(I,v,L,w,k,R,z,A);export{q as default};
1
+ import{s as c,j as a,B as b,E as f,T as y,V as m,b as S,bd as h,r as u,C,ig as j,ih as I,ii as v,ip as L,iq as w,ir as k,il as R,im as z,is as A}from"./index-JQ6lMAyk.js";import{L as B}from"./index-DK5jinWf.js";const E=c("ul")(({theme:e})=>({listStyle:"none",margin:0,padding:0})),P=c("li")(({theme:e})=>({marginBottom:e.spacing(.5),display:"flex",alignItems:"center"})),T=c("span")(({theme:e})=>({display:"inline-block",width:8,height:8,borderRadius:"50%",marginRight:e.spacing(1)})),g=16,D=e=>e==="left"?"flex-start":e==="right"?"flex-end":"center",Y=(e=0,t)=>t==="left"?e+g:t==="right"?e-g:e,p=({tooltip:e,children:t})=>a.jsx(b,{sx:n=>({top:((e==null?void 0:e.caretY)||0)+g,left:Y(e==null?void 0:e.caretX,e==null?void 0:e.align),width:"1px",position:"absolute",display:e?"flex":"none",pointerEvents:"none",zIndex:n.zIndex.tooltip,flexDirection:"column",alignItems:D(e==null?void 0:e.align)}),children:t}),_=({tooltip:e})=>a.jsx(p,{tooltip:e,children:a.jsxs(f,{elevation:3,sx:t=>({width:220,padding:t.spacing(1.5,2)}),children:[a.jsx(y,{variant:"body2",sx:t=>({marginBottom:t.spacing(1),color:t.palette.text.secondary}),children:e==null?void 0:e.title}),a.jsx(E,{children:e==null?void 0:e.body.map(t=>a.jsxs(P,{children:[a.jsx(T,{sx:{backgroundColor:t.color},children:" "}),a.jsx(y,{variant:"body2",sx:{display:"inline-block"},children:t.title})]},m(t)))})]})}),M=e=>t=>{var s,r;const n=t.tooltip;if(n.opacity===0){e(null);return}e({caretX:n==null?void 0:n.caretX,caretY:n==null?void 0:n.caretY,title:((s=n==null?void 0:n.title)==null?void 0:s.join(" "))||"",align:n==null?void 0:n.xAlign,body:((r=n==null?void 0:n.body)==null?void 0:r.map((i,o)=>{var l,d,x;return{title:(l=i==null?void 0:i.lines)==null?void 0:l.join(" "),color:(x=(d=n==null?void 0:n.labelColors)==null?void 0:d[o])==null?void 0:x.borderColor,value:""}}))||[],dataPoints:(n==null?void 0:n.dataPoints)||[]})},O={position:"bottom",labels:{boxWidth:12,padding:30,generateLabels:e=>{var o;const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:s,textAlign:r,color:i}}=((o=e==null?void 0:e.legend)==null?void 0:o.options)||{labels:{}};return e._getSortedDatasetMetas().map(l=>{const d=l.controller.getStyle(n?0:void 0);return{text:t[l.index].label,fillStyle:d.borderColor,fontColor:i,hidden:!l.visible,lineWidth:0,borderRadius:6,strokeStyle:d.borderColor,pointStyle:s||d.pointStyle,textAlign:r||d.textAlign,datasetIndex:l.index}})}}},W=(e,t,n,s)=>({responsive:!0,...s?{animation:{duration:0}}:{},plugins:{legend:{...O,display:!s},tooltip:{enabled:!1,position:"nearest",interaction:{axis:"xy",mode:"nearest"},external:M(n)}},locale:t.locale,interaction:{intersect:!1,axis:"xy",mode:"nearest"},elements:{point:{radius:0,hitRadius:15}},tension:.1,color:e.palette.text.secondary,scales:{y:{beginAtZero:!0,type:"linear",grid:{color:e.palette.divider,borderColor:e.palette.divider},ticks:{color:e.palette.text.secondary,display:!s,precision:0}},x:{type:"time",time:{unit:"week",tooltipFormat:"PPP"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:e.palette.text.secondary,display:!s,source:"data",maxRotation:90,minRotation:23.5}}}}),X=c("div")(({theme:e})=>({position:"relative"})),q=c("div")(({theme:e})=>({position:"absolute",inset:0,display:"flex",zIndex:e.zIndex.appBar,"&::before":{zIndex:e.zIndex.fab,content:'""',position:"absolute",inset:0,backgroundColor:e.palette.background.paper,opacity:.8}})),F=c("div")(({theme:e})=>({zIndex:e.zIndex.modal,margin:"auto",color:e.palette.text.secondary,textAlign:"center"})),G={id:"customLine",afterDraw:e=>{var n;if((n=e.tooltip)!=null&&n.opacity&&e.tooltip.x){const s=e.tooltip.caretX,r=e.scales.y,i=e.ctx;i.save();const o=i.createLinearGradient(s,r.top,s,r.bottom);o.addColorStop(0,"rgba(129, 122, 254, 0)"),o.addColorStop(1,"rgba(129, 122, 254, 0.12)"),i.fillStyle=o,i.fillRect(s-26/2,r.top,26,r.bottom-r.top),i.restore()}}},Z=({data:e,aspectRatio:t=2.5,cover:n,overrideOptions:s,TooltipComponent:r})=>{const i=S(),{locationSettings:o}=h(),[l,d]=u.useState(null),x=u.useMemo(()=>({...W(i,o,d,!!n),...s}),[i,o,s,n]);return a.jsxs(X,{children:[a.jsx(B,{options:x,data:e,plugins:[G],height:100,width:100*t},n?"cover":"chart"),a.jsx(C,{condition:!n,show:r?a.jsx(p,{tooltip:l,children:a.jsx(r,{tooltip:l})}):a.jsx(_,{tooltip:l}),elseShow:a.jsx(q,{children:a.jsx(F,{children:n!==!0?n:" "})})})]})};j.register(I,v,L,w,k,R,z,A);export{Z as default};
@@ -1 +1 @@
1
- import{s as i,T as d,cL as h,b as x,r as u,j as t,N as y,g8 as c,im as m,io as f,ip as j}from"./index-Cx91uh9W.js";import{u as b,a as g}from"./unknownify-8qa4PVkQ.js";const v=i("div")(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),w=i("div")(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(4),flexWrap:"wrap"})),p=i("div")(({theme:e})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette.secondary.border,backgroundColor:e.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5),zIndex:1,"& > svg":{width:e.spacing(9),height:e.spacing(9)}})),S=i(d)(({theme:e})=>({fontWeight:e.fontWeight.bold})),k=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),A=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),q=e=>e[0]*1e3>new Date().getTime()-6e5,C=e=>{var a,s;const r=(e.values||[]).filter(l=>q(l)),o=r.length?Number.parseFloat(r[r.length-1][1]):0;return{label:e.label,reqs:o,type:g((s=(a=e.metric)==null?void 0:a.endpoint)==null?void 0:s.split("/")[2])}},E=(e,n)=>{var o;const r=n.label+n.type;return e[r]={...n,reqs:n.reqs+(((o=e[r])==null?void 0:o.reqs)??0)},e},T=e=>{var o,a;const r=(((a=(o=e==null?void 0:e.data)==null?void 0:o.result)==null?void 0:a.map(s=>{var l;return{...s,label:g((l=s.metric)==null?void 0:l.appName)}}).filter(s=>s.label!=="unknown"))||[]).map(C).reduce(E,{});return Object.values(r).map(s=>({...s,reqs:s.reqs.toFixed(2)})).filter(s=>s.reqs!=="0.00")??[]},R=()=>{h("Network - Overview");const e=x(),{metrics:n}=b(),r=u.useMemo(()=>T(n),[n]);return r.length===0?t.jsx(y,{severity:"warning",children:"No data available."}):t.jsxs(c.ArcherContainer,{strokeColor:e.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[t.jsx(v,{children:t.jsx(c.ArcherElement,{id:"unleash",children:t.jsxs(p,{children:[t.jsx(m,{darkmode:t.jsx(f,{}),lightmode:t.jsx(j,{})}),t.jsx(d,{sx:{marginTop:e.spacing(1)},children:"Unleash"})]})})}),t.jsx(w,{children:r.map(({label:o,reqs:a,type:s},l)=>t.jsx(c.ArcherElement,{id:`${l}`,relations:[{targetId:"unleash",targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:e.palette.secondary.border}}],children:t.jsxs(p,{children:[t.jsx(S,{children:o}),t.jsxs(k,{children:[a," req/s"]}),t.jsxs(A,{children:[s," app"]})]})}))})]})};export{R as NetworkOverview,R as default};
1
+ import{s as i,T as d,cQ as h,b as x,r as u,j as t,N as y,fX as c,iu as m,iv as f,iw as j}from"./index-JQ6lMAyk.js";import{u as b,a as g}from"./unknownify-C7SyNno2.js";const v=i("div")(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),w=i("div")(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(4),flexWrap:"wrap"})),p=i("div")(({theme:e})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette.secondary.border,backgroundColor:e.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5),zIndex:1,"& > svg":{width:e.spacing(9),height:e.spacing(9)}})),S=i(d)(({theme:e})=>({fontWeight:e.fontWeight.bold})),k=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),A=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),q=e=>e[0]*1e3>new Date().getTime()-6e5,C=e=>{var a,s;const r=(e.values||[]).filter(l=>q(l)),o=r.length?Number.parseFloat(r[r.length-1][1]):0;return{label:e.label,reqs:o,type:g((s=(a=e.metric)==null?void 0:a.endpoint)==null?void 0:s.split("/")[2])}},E=(e,n)=>{var o;const r=n.label+n.type;return e[r]={...n,reqs:n.reqs+(((o=e[r])==null?void 0:o.reqs)??0)},e},T=e=>{var o,a;const r=(((a=(o=e==null?void 0:e.data)==null?void 0:o.result)==null?void 0:a.map(s=>{var l;return{...s,label:g((l=s.metric)==null?void 0:l.appName)}}).filter(s=>s.label!=="unknown"))||[]).map(C).reduce(E,{});return Object.values(r).map(s=>({...s,reqs:s.reqs.toFixed(2)})).filter(s=>s.reqs!=="0.00")??[]},R=()=>{h("Network - Overview");const e=x(),{metrics:n}=b(),r=u.useMemo(()=>T(n),[n]);return r.length===0?t.jsx(y,{severity:"warning",children:"No data available."}):t.jsxs(c.ArcherContainer,{strokeColor:e.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[t.jsx(v,{children:t.jsx(c.ArcherElement,{id:"unleash",children:t.jsxs(p,{children:[t.jsx(m,{darkmode:t.jsx(f,{}),lightmode:t.jsx(j,{})}),t.jsx(d,{sx:{marginTop:e.spacing(1)},children:"Unleash"})]})})}),t.jsx(w,{children:r.map(({label:o,reqs:a,type:s},l)=>t.jsx(c.ArcherElement,{id:`${l}`,relations:[{targetId:"unleash",targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:e.palette.secondary.border}}],children:t.jsxs(p,{children:[t.jsx(S,{children:o}),t.jsxs(k,{children:[a," req/s"]}),t.jsxs(A,{children:[s," app"]})]})}))})]})};export{R as NetworkOverview,R as default};
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var k=(t,e,i)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var s=(t,e,i)=>k(t,typeof e!="symbol"?e+"":e,i);import{bd as C,b as v,r as p,cQ as w,j as o,C as P,N as S,d3 as j,ig as N,ih as I,ii as M,ip as R,iq as T,ir as q,im as A,il as L,ik as E,ie as u}from"./index-JQ6lMAyk.js";import{u as _,a as g}from"./unknownify-C7SyNno2.js";import{L as D}from"./index-DK5jinWf.js";class H{constructor(e){s(this,"current",0);s(this,"all");this.all=e}next(){const e=this.all[this.current];return this.current=(this.current+1)%this.all.length,e}}const m=["circle","rect","rectRounded","rectRot","triangle"],W=(t,e)=>t.map(i=>({x:i[0],y:e(i[1])})),$=(t,e)=>({locale:e.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:t.palette.text.secondary,plugins:{tooltip:{backgroundColor:t.palette.background.paper,bodyColor:t.palette.text.primary,titleColor:t.palette.action.active,borderColor:t.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,callbacks:{title:i=>u(1e3*i[0].parsed.x,e.locale)},itemSort:(i,a)=>a.parsed.y-i.parsed.y},legend:{position:"bottom",align:"start",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,padding:24}},title:{text:"Top 10 requests per second in the last 6 hours",position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:t.palette.text.primary,padding:{bottom:32}}},scales:{y:{type:"linear",title:{display:!0,text:"Requests per second",color:t.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:t.palette.text.secondary},grid:{color:t.palette.divider,borderColor:t.palette.divider}},x:{type:"time",time:{unit:"minute"},grid:{display:!0,color:t.palette.divider,borderColor:t.palette.divider},ticks:{callback:(i,a,r)=>u(r[a].value*1e3,e.locale)}}}});class z{constructor(e){s(this,"items");s(this,"picked",new Map);this.items=new H(e)}pick(e){return this.picked.has(e)||this.picked.set(e,this.items.next()),this.picked.get(e)}}const B=(t,e)=>{var i;if((i=e==null?void 0:e.data)!=null&&i.result){const a=new z([t.palette.success,t.palette.error,t.palette.primary,t.palette.warning]);return e.data.result.map((r,x)=>{var c,d;const n=g((c=r.metric)==null?void 0:c.endpoint),y=g((d=r.metric)==null?void 0:d.appName),l=a.pick(n),b=r.values||[];return{label:`${n}: ${y}`,borderColor:l.main,backgroundColor:l.main,data:W(b,h=>Number.parseFloat(h)),elements:{point:{radius:4,pointStyle:m[x%m.length]},line:{borderDash:[8,4]}}}})}return[]},J=()=>{const{locationSettings:t}=C(),{metrics:e}=_(),i=v(),a=p.useMemo(()=>$(i,t),[i,t]);w("Network - Traffic");const r=p.useMemo(()=>({datasets:B(i,e)}),[i,e,t]);return o.jsx(P,{condition:r.datasets.length===0,show:o.jsx(S,{severity:"warning",children:"No data available."}),elseShow:o.jsx(j,{sx:{display:"grid",gap:4},children:o.jsx("div",{style:{height:400},children:o.jsx(D,{data:r,options:a,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})})})};N.register(I,M,R,T,q,A,L,E);export{J as NetworkTraffic,J as default};
@@ -0,0 +1 @@
1
+ import{s as d,cx as p,d3 as f,cu as q,j as e,H as S,C as y,cI as C,cQ as Q,b as V,ba as X,r as i,N as v,L,gg as Y,ig as J,ih as K,ii as Z,ij as ee,ik as te,il as se,im as oe}from"./index-JQ6lMAyk.js";import{B as re}from"./index-DK5jinWf.js";import{u as ae,a as ne}from"./LazyAdminExport-CpfHUB52.js";import{a as ie,f as le}from"./formatTickValue-DArtcDRb.js";import"./RoleCell-DMPAgQMx.js";import"./useApiTokens-DQBXJ3PL.js";const ce=d(p)(({theme:t})=>({display:"flex",flexDirection:"row"})),P=d(p)(({theme:t})=>({display:"flex",flexDirection:"row",flex:"1 1"})),E=d(p)(({theme:t})=>({display:"flex",flexDirection:"column",flex:"1 1"})),U=d("div")(({theme:t})=>({display:"flex",flexDirection:"row",flex:"1 1",padding:t.spacing(3),border:`2px solid ${t.palette.divider}`,borderRadius:t.shape.borderRadiusLarge})),w=d(f)(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(2.5),color:t.palette.text.secondary,fontSize:t.fontSizes.smallBody,marginTop:t.spacing(2)})),m=d(f)(({theme:t})=>({display:"flex",flexDirection:"row"})),h=d("div")(({theme:t})=>({marginLeft:"auto",display:"flex",textDecoration:"none",color:t.palette.text.primary})),de=({usageTotal:t,includedTraffic:r,overageCost:s,estimatedMonthlyCost:a})=>{const o=t-r,n=q("estimateTrafficDataCost");return e.jsxs(ce,{container:!0,spacing:4,children:[e.jsx(P,{item:!0,xs:5.5,md:5.5,children:e.jsx(U,{children:e.jsxs(E,{item:!0,children:[e.jsx(f,{children:e.jsx("b",{children:"Number of requests to Unleash"})}),e.jsx(w,{children:e.jsxs(m,{children:["Incoming requests selected month"," ",e.jsx(h,{children:e.jsxs(S,{color:r>0?t<=r?"success":"error":"neutral",children:[t.toLocaleString()," requests"]})})]})}),e.jsx(y,{condition:r>0,show:e.jsx(w,{children:e.jsxs(m,{children:["Included in your plan monthly",e.jsxs(h,{children:[r.toLocaleString()," ","requests"]})]})})})]})})}),e.jsx(y,{condition:n&&r>0&&o>0,show:e.jsx(P,{item:!0,xs:5.5,md:5.5,children:e.jsx(U,{children:e.jsxs(E,{item:!0,children:[e.jsx(f,{children:e.jsx("b",{children:"Accrued traffic charges"})}),e.jsxs(w,{children:[e.jsxs(m,{children:["Requests overages this month (",e.jsx(C,{href:"https://www.getunleash.io/pricing",children:"pricing"}),")",e.jsxs(h,{children:[o.toLocaleString()," requests"]})]}),e.jsxs(m,{children:["Accrued traffic charges",e.jsx(h,{children:e.jsxs(S,{color:"secondary",children:[s," USD"]})})]}),e.jsx(y,{condition:a>0,show:e.jsxs(m,{children:["Estimated traffic charges based on current usage",e.jsx(h,{children:e.jsxs(S,{color:"secondary",children:[a," ","USD"]})})]})})]})]})})})})]})},pe=(t=46,r=34)=>({id:"customLine",beforeDraw:s=>{var a;if((a=s.tooltip)!=null&&a.opacity&&s.tooltip.x){const o=s.tooltip.caretX,n=s.scales.y,l=s.ctx;l.save();const g=l.createLinearGradient(o,n.top,o,n.bottom+34);g.addColorStop(0,"rgba(129, 122, 254, 0)"),g.addColorStop(1,"rgba(129, 122, 254, 0.12)"),l.fillStyle=g,l.roundRect(o-t/2,n.top,t,n.bottom-n.top+r,5),l.fill(),l.restore()}}}),ue=d(f)(({theme:t})=>({display:"grid",gap:t.spacing(5)})),ge=(t,r,s)=>({plugins:{annotation:{clip:!1,annotations:{line:{type:"line",borderDash:[5,5],yMin:s?s/30:0,yMax:s?s/30:0,borderColor:"gray",borderWidth:1,display:!!s,label:{backgroundColor:"rgba(192, 192, 192, 0.8)",color:"black",padding:{top:10,bottom:10,left:10,right:10},content:"Average daily requests included in your plan",display:!!s}}}},legend:{position:"bottom",labels:{color:t.palette.text.primary,pointStyle:"circle",usePointStyle:!0,boxHeight:6,padding:15,boxPadding:5}},tooltip:{backgroundColor:t.palette.background.paper,titleColor:t.palette.text.primary,bodyColor:t.palette.text.primary,bodySpacing:6,padding:{top:20,bottom:20,left:30,right:30},borderColor:"rgba(0, 0, 0, 0.05)",borderWidth:3,usePointStyle:!0,caretSize:0,boxPadding:10,callbacks:{title:r}}},responsive:!0,scales:{x:{stacked:!0,ticks:{color:t.palette.text.secondary},grid:{display:!1}},y:{stacked:!0,ticks:{color:t.palette.text.secondary,maxTicksLimit:5,callback:le},grid:{drawBorder:!1}}},elements:{bar:{borderRadius:5}},interaction:{mode:"index",intersect:!1}}),xe=53e6,we=()=>{Q("Network - Data Usage");const t=V(),{isOss:r,isPro:s}=X(),{record:a,period:o,setPeriod:n,selectablePeriods:l,getDayLabels:g,toChartData:I,toTrafficUsageSum:B,endpointsInfo:R,calculateOverageCost:A,calculateEstimatedMonthlyCost:N}=ae(),u=s()?xe:0,M=i.useMemo(()=>ge(t,c=>{const b=a[o];return new Date(b.year,b.month,Number.parseInt(c[0].label)).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})},u),[t,o]),D=ne(o),[j,G]=i.useState([]),[O,H]=i.useState([]),[z,F]=i.useState(0),[k,T]=i.useState(0),[W,_]=i.useState(0),x={labels:j,datasets:O},$=q("displayTrafficDataUsage");return i.useEffect(()=>{H(I(j,D,R))},[j,D]),i.useEffect(()=>{if(a&&o){const c=a[o];G(g(c.dayCount))}},[o]),i.useEffect(()=>{if(x){const c=B(x.datasets);if(F(c),u>0){const b=A(c,u);T(b),_(N(o,x.datasets,u,new Date))}}},[x]),e.jsx(y,{condition:r()||!$,show:e.jsx(v,{severity:"warning",children:"Not enabled."}),elseShow:e.jsxs(e.Fragment,{children:[e.jsx(y,{condition:u>0&&k>0,show:e.jsxs(v,{severity:"warning",sx:{mb:4},children:[e.jsx("b",{children:"Heads up!"})," You are currently consuming more requests than your plan includes and will be billed according to our terms. Please see"," ",e.jsx(C,{component:L,to:"https://www.getunleash.io/pricing",children:"this page"})," ","for more information. In order to reduce your traffic consumption, you may configure an"," ",e.jsx(C,{component:L,to:"https://docs.getunleash.io/reference/unleash-edge",children:"Unleash Edge instance"})," ","in your own datacenter."]})}),e.jsxs(ue,{children:[e.jsxs(p,{container:!0,component:"header",spacing:2,children:[e.jsx(p,{item:!0,xs:12,md:10,children:e.jsx(de,{usageTotal:z,includedTraffic:u,overageCost:k,estimatedMonthlyCost:W})}),e.jsx(p,{item:!0,xs:12,md:2,children:e.jsx(Y,{id:"dataperiod-select",name:"dataperiod",options:l,value:o,onChange:c=>n(c.target.value),style:{minWidth:"100%",marginBottom:t.spacing(2)},formControlStyles:{width:"100%"}})})]}),e.jsx(p,{item:!0,xs:12,md:2,children:e.jsx(re,{data:x,plugins:[pe()],options:M,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})]})]})})};J.register(ie,K,Z,ee,te,se,oe);export{we as NetworkTrafficUsage,we as default};
@@ -1,4 +1,4 @@
1
- import{g as Lb,i8 as Db,d5 as Fb,s as Bb,r as Ya,U as Ub,j as pu}from"./index-Cx91uh9W.js";import{V as i1,I as Vb,J as Hb,A as bi,K as kc,L as a1,R as s1,H as Jb,B as Ua,o as c1,E as Ji,z as Gd,C as Kb,M as Wb,b as Gb,e as Qb,g as Yb,i as Xb,j as Zb,k as ej,m as tj,n as nj,p as rj,q as oj,r as ij,t as aj,u as sj,v as cj,w as lj,x as uj,c as fj,d as dj,s as pj,h as vj,f as mj,a as hj,l as gj,G as yj,N as bj,O as jj,y as $j,P as wj,Q as xj,T as Sj,U as Va,W as Cj,X as kj,Y as _j,Z as Ej}from"./index-BEpcKp7m.js";function xn(t){return Array.isArray(t)}function In(t){return t!==null&&typeof t=="object"&&(t.constructor===void 0||t.constructor.name==="Object")}function l1(t){return t&&typeof t=="object"?t.op==="add":!1}function u1(t){return t&&typeof t=="object"?t.op==="remove":!1}function vf(t){return t&&typeof t=="object"?t.op==="replace":!1}function vu(t){return t&&typeof t=="object"?t.op==="copy":!1}function la(t){return t&&typeof t=="object"?t.op==="move":!1}function Oj(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Mj(t,e){return t===e}function f1(t){return t.slice(0,t.length-1)}function Pj(t){return t[t.length-1]}function Tj(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mj;if(t.length<e.length)return!1;for(let r=0;r<e.length;r++)if(!n(t[r],e[r]))return!1;return!0}function d1(t){return typeof t=="object"&&t!==null}function mf(t){if(xn(t)){const e=t.slice();return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else if(In(t)){const e={...t};return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else return t}function hf(t,e,n){if(t[e]===n)return t;{const r=mf(t);return r[e]=n,r}}function We(t,e){let n=t,r=0;for(;r<e.length;)In(n)?n=n[e[r]]:xn(n)?n=n[parseInt(e[r])]:n=void 0,r++;return n}function Yr(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length===0)return n;const o=e[0],i=Yr(t?t[o]:void 0,e.slice(1),n,r);if(In(t)||xn(t))return hf(t,o,i);if(r){const a=Rj.test(o)?[]:{};return a[o]=i,a}else throw new Error("Path does not exist")}const Rj=/^\d+$/;function p1(t,e,n){if(e.length===0)return n(t);if(!d1(t))throw new Error("Path doesn't exist");const r=e[0],o=p1(t[r],e.slice(1),n);return hf(t,r,o)}function gf(t,e){if(e.length===0)return t;if(!d1(t))throw new Error("Path does not exist");if(e.length===1){const o=e[0];if(o in t){const i=mf(t);return xn(i)&&i.splice(parseInt(o),1),In(i)&&delete i[o],i}else return t}const n=e[0],r=gf(t[n],e.slice(1));return hf(t,n,r)}function yf(t,e,n){const r=e.slice(0,e.length-1),o=e[e.length-1];return p1(t,r,i=>{if(!Array.isArray(i))throw new TypeError("Array expected at path "+JSON.stringify(r));const a=mf(i);return a.splice(parseInt(o),0,n),a})}function Lr(t,e){return t===void 0?!1:e.length===0?!0:t===null?!1:Lr(t[e[0]],e.slice(1))}function ao(t){const e=t.split("/");return e.shift(),e.map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"))}function Be(t){return t.map(bf).join("")}function bf(t){return"/"+String(t).replace(/~/g,"~0").replace(/\//g,"~1")}function Qd(t,e){return t+bf(e)}function nl(t,e){return t.startsWith(e)&&(t.length===e.length||t[e.length]==="/")}function to(t,e,n){let r=t;for(let o=0;o<e.length;o++){Fj(e[o]);let i=e[o];if(n&&n.before){const l=n.before(r,i);if(l!==void 0){if(l.document!==void 0&&(r=l.document),l.json!==void 0)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"');l.operation!==void 0&&(i=l.operation)}}const a=r,s=yo(r,i.path);if(i.op==="add")r=Ij(r,s,i.value);else if(i.op==="remove")r=Aj(r,s);else if(i.op==="replace")r=Nj(r,s,i.value);else if(i.op==="copy")r=zj(r,s,mu(i.from));else if(i.op==="move")r=qj(r,s,mu(i.from));else if(i.op==="test")Lj(r,s,i.value);else throw new Error("Unknown JSONPatch operation "+JSON.stringify(i));if(n&&n.after){const l=n.after(r,i,a);l!==void 0&&(r=l)}}return r}function Nj(t,e,n){return Yr(t,e,n)}function Aj(t,e){return gf(t,e)}function Ij(t,e,n){return Os(t,e)?yf(t,e,n):Yr(t,e,n)}function zj(t,e,n){const r=We(t,n);if(Os(t,e))return yf(t,e,r);{const o=We(t,n);return Yr(t,e,o)}}function qj(t,e,n){const r=We(t,n),o=gf(t,n);return Os(o,e)?yf(o,e,r):Yr(o,e,r)}function Lj(t,e,n){if(n===void 0)throw new Error(`Test failed: no value provided (path: "${Be(e)}")`);if(!Lr(t,e))throw new Error(`Test failed: path not found (path: "${Be(e)}")`);const r=We(t,e);if(!Oj(r,n))throw new Error(`Test failed, value differs (path: "${Be(e)}")`)}function Os(t,e){if(e.length===0)return!1;const n=We(t,f1(e));return Array.isArray(n)}function Dj(t,e){if(Pj(e)!=="-")return e;const n=f1(e),r=We(t,n);return n.concat(r.length)}function Fj(t){if(!["add","remove","replace","copy","move","test"].includes(t.op))throw new Error("Unknown JSONPatch op "+JSON.stringify(t.op));if(typeof t.path!="string")throw new Error('Required property "path" missing or not a string in operation '+JSON.stringify(t));if((t.op==="copy"||t.op==="move")&&typeof t.from!="string")throw new Error('Required property "from" missing or not a string in operation '+JSON.stringify(t))}function yo(t,e){return Dj(t,ao(e))}function mu(t){return ao(t)}function v1(t,e,n){let r=[];return to(t,e,{before:(i,a)=>{let s;const l=yo(i,a.path);if(a.op==="add")s=g1(i,l);else if(a.op==="remove")s=h1(i,l);else if(a.op==="replace")s=m1(i,l);else if(a.op==="copy")s=Bj(i,l);else if(a.op==="move")s=Uj(i,l,mu(a.from));else if(a.op==="test")s=[];else throw new Error("Unknown JSONPatch operation "+JSON.stringify(a));let c;if(n&&n.before){const u=n.before(i,a,s);if(u&&u.revertOperations&&(s=u.revertOperations),u&&u.document&&(c=u.document),u&&u.json)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"')}if(r=s.concat(r),c!==void 0)return{document:c}}}),r}function m1(t,e){return[{op:"replace",path:Be(e),value:We(t,e)}]}function h1(t,e){return[{op:"add",path:Be(e),value:We(t,e)}]}function g1(t,e){return Os(t,e)||!Lr(t,e)?[{op:"remove",path:Be(e)}]:m1(t,e)}function Bj(t,e){return g1(t,e)}function Uj(t,e,n){if(e.length<n.length&&Tj(n,e))return[{op:"replace",path:Be(e),value:t}];const r={op:"move",from:Be(e),path:Be(n)};return!Os(t,e)&&Lr(t,e)?[r,...h1(t,e)]:[r]}var _c={},Yd={b:"\b",f:"\f",n:`
1
+ import{g as Lb,io as Db,da as Fb,s as Bb,r as Ya,U as Ub,j as pu}from"./index-JQ6lMAyk.js";import{V as i1,I as Vb,J as Hb,A as bi,K as kc,L as a1,R as s1,H as Jb,B as Ua,o as c1,E as Ji,z as Gd,C as Kb,M as Wb,b as Gb,e as Qb,g as Yb,i as Xb,j as Zb,k as ej,m as tj,n as nj,p as rj,q as oj,r as ij,t as aj,u as sj,v as cj,w as lj,x as uj,c as fj,d as dj,s as pj,h as vj,f as mj,a as hj,l as gj,G as yj,N as bj,O as jj,y as $j,P as wj,Q as xj,T as Sj,U as Va,W as Cj,X as kj,Y as _j,Z as Ej}from"./index-BEpcKp7m.js";function xn(t){return Array.isArray(t)}function In(t){return t!==null&&typeof t=="object"&&(t.constructor===void 0||t.constructor.name==="Object")}function l1(t){return t&&typeof t=="object"?t.op==="add":!1}function u1(t){return t&&typeof t=="object"?t.op==="remove":!1}function vf(t){return t&&typeof t=="object"?t.op==="replace":!1}function vu(t){return t&&typeof t=="object"?t.op==="copy":!1}function la(t){return t&&typeof t=="object"?t.op==="move":!1}function Oj(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Mj(t,e){return t===e}function f1(t){return t.slice(0,t.length-1)}function Pj(t){return t[t.length-1]}function Tj(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mj;if(t.length<e.length)return!1;for(let r=0;r<e.length;r++)if(!n(t[r],e[r]))return!1;return!0}function d1(t){return typeof t=="object"&&t!==null}function mf(t){if(xn(t)){const e=t.slice();return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else if(In(t)){const e={...t};return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else return t}function hf(t,e,n){if(t[e]===n)return t;{const r=mf(t);return r[e]=n,r}}function We(t,e){let n=t,r=0;for(;r<e.length;)In(n)?n=n[e[r]]:xn(n)?n=n[parseInt(e[r])]:n=void 0,r++;return n}function Yr(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length===0)return n;const o=e[0],i=Yr(t?t[o]:void 0,e.slice(1),n,r);if(In(t)||xn(t))return hf(t,o,i);if(r){const a=Rj.test(o)?[]:{};return a[o]=i,a}else throw new Error("Path does not exist")}const Rj=/^\d+$/;function p1(t,e,n){if(e.length===0)return n(t);if(!d1(t))throw new Error("Path doesn't exist");const r=e[0],o=p1(t[r],e.slice(1),n);return hf(t,r,o)}function gf(t,e){if(e.length===0)return t;if(!d1(t))throw new Error("Path does not exist");if(e.length===1){const o=e[0];if(o in t){const i=mf(t);return xn(i)&&i.splice(parseInt(o),1),In(i)&&delete i[o],i}else return t}const n=e[0],r=gf(t[n],e.slice(1));return hf(t,n,r)}function yf(t,e,n){const r=e.slice(0,e.length-1),o=e[e.length-1];return p1(t,r,i=>{if(!Array.isArray(i))throw new TypeError("Array expected at path "+JSON.stringify(r));const a=mf(i);return a.splice(parseInt(o),0,n),a})}function Lr(t,e){return t===void 0?!1:e.length===0?!0:t===null?!1:Lr(t[e[0]],e.slice(1))}function ao(t){const e=t.split("/");return e.shift(),e.map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"))}function Be(t){return t.map(bf).join("")}function bf(t){return"/"+String(t).replace(/~/g,"~0").replace(/\//g,"~1")}function Qd(t,e){return t+bf(e)}function nl(t,e){return t.startsWith(e)&&(t.length===e.length||t[e.length]==="/")}function to(t,e,n){let r=t;for(let o=0;o<e.length;o++){Fj(e[o]);let i=e[o];if(n&&n.before){const l=n.before(r,i);if(l!==void 0){if(l.document!==void 0&&(r=l.document),l.json!==void 0)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"');l.operation!==void 0&&(i=l.operation)}}const a=r,s=yo(r,i.path);if(i.op==="add")r=Ij(r,s,i.value);else if(i.op==="remove")r=Aj(r,s);else if(i.op==="replace")r=Nj(r,s,i.value);else if(i.op==="copy")r=zj(r,s,mu(i.from));else if(i.op==="move")r=qj(r,s,mu(i.from));else if(i.op==="test")Lj(r,s,i.value);else throw new Error("Unknown JSONPatch operation "+JSON.stringify(i));if(n&&n.after){const l=n.after(r,i,a);l!==void 0&&(r=l)}}return r}function Nj(t,e,n){return Yr(t,e,n)}function Aj(t,e){return gf(t,e)}function Ij(t,e,n){return Os(t,e)?yf(t,e,n):Yr(t,e,n)}function zj(t,e,n){const r=We(t,n);if(Os(t,e))return yf(t,e,r);{const o=We(t,n);return Yr(t,e,o)}}function qj(t,e,n){const r=We(t,n),o=gf(t,n);return Os(o,e)?yf(o,e,r):Yr(o,e,r)}function Lj(t,e,n){if(n===void 0)throw new Error(`Test failed: no value provided (path: "${Be(e)}")`);if(!Lr(t,e))throw new Error(`Test failed: path not found (path: "${Be(e)}")`);const r=We(t,e);if(!Oj(r,n))throw new Error(`Test failed, value differs (path: "${Be(e)}")`)}function Os(t,e){if(e.length===0)return!1;const n=We(t,f1(e));return Array.isArray(n)}function Dj(t,e){if(Pj(e)!=="-")return e;const n=f1(e),r=We(t,n);return n.concat(r.length)}function Fj(t){if(!["add","remove","replace","copy","move","test"].includes(t.op))throw new Error("Unknown JSONPatch op "+JSON.stringify(t.op));if(typeof t.path!="string")throw new Error('Required property "path" missing or not a string in operation '+JSON.stringify(t));if((t.op==="copy"||t.op==="move")&&typeof t.from!="string")throw new Error('Required property "from" missing or not a string in operation '+JSON.stringify(t))}function yo(t,e){return Dj(t,ao(e))}function mu(t){return ao(t)}function v1(t,e,n){let r=[];return to(t,e,{before:(i,a)=>{let s;const l=yo(i,a.path);if(a.op==="add")s=g1(i,l);else if(a.op==="remove")s=h1(i,l);else if(a.op==="replace")s=m1(i,l);else if(a.op==="copy")s=Bj(i,l);else if(a.op==="move")s=Uj(i,l,mu(a.from));else if(a.op==="test")s=[];else throw new Error("Unknown JSONPatch operation "+JSON.stringify(a));let c;if(n&&n.before){const u=n.before(i,a,s);if(u&&u.revertOperations&&(s=u.revertOperations),u&&u.document&&(c=u.document),u&&u.json)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"')}if(r=s.concat(r),c!==void 0)return{document:c}}}),r}function m1(t,e){return[{op:"replace",path:Be(e),value:We(t,e)}]}function h1(t,e){return[{op:"add",path:Be(e),value:We(t,e)}]}function g1(t,e){return Os(t,e)||!Lr(t,e)?[{op:"remove",path:Be(e)}]:m1(t,e)}function Bj(t,e){return g1(t,e)}function Uj(t,e,n){if(e.length<n.length&&Tj(n,e))return[{op:"replace",path:Be(e),value:t}];const r={op:"move",from:Be(e),path:Be(n)};return!Os(t,e)&&Lr(t,e)?[r,...h1(t,e)]:[r]}var _c={},Yd={b:"\b",f:"\f",n:`
2
2
  `,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},Vj=97;_c.parse=function(t,e,n){var r={},o=0,i=0,a=0,s=n&&n.bigint&&typeof BigInt<"u";return{data:l("",!0),pointers:r};function l(W,U){c();var te;b(W,"value");var F=m();switch(F){case"t":v("rue"),te=!0;break;case"f":v("alse"),te=!1;break;case"n":v("ull"),te=null;break;case'"':te=u();break;case"[":te=d(W);break;case"{":te=p(W);break;default:g(),"-0123456789".indexOf(F)>=0?te=f():R()}return b(W,"valueEnd"),c(),U&&a<t.length&&R(),te}function c(){e:for(;a<t.length;){switch(t[a]){case" ":i++;break;case" ":i+=4;break;case"\r":i=0;break;case`
3
3
  `:i=0,o++;break;default:break e}a++}}function u(){for(var W="",U;U=m(),U!='"';)U=="\\"?(U=m(),U in Yd?W+=Yd[U]:U=="u"?W+=h():D()):W+=U;return W}function f(){var W="",U=!0;t[a]=="-"&&(W+=m()),W+=t[a]=="0"?m():y(),t[a]=="."&&(W+=m()+y(),U=!1),(t[a]=="e"||t[a]=="E")&&(W+=m(),(t[a]=="+"||t[a]=="-")&&(W+=m()),W+=y(),U=!1);var te=+W;return s&&U&&(te>Number.MAX_SAFE_INTEGER||te<Number.MIN_SAFE_INTEGER)?BigInt(W):te}function d(W){c();var U=[],te=0;if(m()=="]")return U;for(g();;){var F=W+"/"+te;U.push(l(F)),c();var J=m();if(J=="]")break;J!=","&&D(),c(),te++}return U}function p(W){c();var U={};if(m()=="}")return U;for(g();;){var te=w();m()!='"'&&D();var F=u(),J=W+"/"+hu(F);S(J,"key",te),b(J,"keyEnd"),c(),m()!=":"&&D(),c(),U[F]=l(J),c();var H=m();if(H=="}")break;H!=","&&D(),c()}return U}function v(W){for(var U=0;U<W.length;U++)m()!==W[U]&&D()}function m(){Z();var W=t[a];return a++,i++,W}function g(){a--,i--}function h(){for(var W=4,U=0;W--;){U<<=4;var te=m().toLowerCase();te>="a"&&te<="f"?U+=te.charCodeAt()-Vj+10:te>="0"&&te<="9"?U+=+te:D()}return String.fromCharCode(U)}function y(){for(var W="";t[a]>="0"&&t[a]<="9";)W+=m();if(W.length)return W;Z(),R()}function b(W,U){S(W,U,w())}function S(W,U,te){r[W]=r[W]||{},r[W][U]=te}function w(){return{line:o,column:i,pos:a}}function R(){throw new SyntaxError("Unexpected token "+t[a]+" in JSON at position "+a)}function D(){g(),R()}function Z(){if(a>=t.length)throw new SyntaxError("Unexpected end of JSON input")}};_c.stringify=function(t,e,n){if(!Js(t))return;var r=0,o,i,a=typeof n=="object"?n.space:n;switch(typeof a){case"number":var s=a>10?10:a<0?0:Math.floor(a);a=s&&S(s," "),o=s,i=s;break;case"string":a=a.slice(0,10),o=0,i=0;for(var l=0;l<a.length;l++){var c=a[l];switch(c){case" ":i++;break;case" ":i+=4;break;case"\r":i=0;break;case`
4
4
  `:i=0,r++;break;default:throw new Error("whitespace characters not allowed in JSON")}o++}break;default:a=void 0}var u="",f={},d=0,p=0,v=0,m=n&&n.es6&&typeof Map=="function";return g(t,0,""),{json:u,pointers:f};function g(w,R,D){switch(b(D,"value"),typeof w){case"number":case"bigint":case"boolean":h(""+w);break;case"string":h(Ks(w));break;case"object":w===null?h("null"):typeof w.toJSON=="function"?h(Ks(w.toJSON())):Array.isArray(w)?Z():m?w.constructor.BYTES_PER_ELEMENT?Z():w instanceof Map?U():w instanceof Set?U(!0):W():W()}b(D,"valueEnd");function Z(){if(w.length){h("[");for(var te=R+1,F=0;F<w.length;F++){F&&h(","),y(te);var J=Js(w[F])?w[F]:null,H=D+"/"+F;g(J,te,H)}y(R),h("]")}else h("[]")}function W(){var te=Object.keys(w);if(te.length){h("{");for(var F=R+1,J=0;J<te.length;J++){var H=te[J],X=w[H];if(Js(X)){J&&h(",");var K=D+"/"+hu(H);y(F),b(K,"key"),h(Ks(H)),b(K,"keyEnd"),h(":"),a&&h(" "),g(X,F,K)}}y(R),h("}")}else h("{}")}function U(te){if(w.size){h("{");for(var F=R+1,J=!0,H=w.entries(),X=H.next();!X.done;){var K=X.value,Q=K[0],M=te?!0:K[1];if(Js(M)){J||h(","),J=!1;var A=D+"/"+hu(Q);y(F),b(A,"key"),h(Ks(Q)),b(A,"keyEnd"),h(":"),a&&h(" "),g(M,F,A)}X=H.next()}y(R),h("}")}else h("{}")}}function h(w){p+=w.length,v+=w.length,u+=w}function y(w){if(a){for(u+=`
@@ -1 +1 @@
1
- import{s as h,b8 as g,e as _,j as e,N as F,t as W,w as z,dn as D,B as j,dt as J,ag as ce,d4 as de,aj as ue,C,au as he,ak as pe,at as q,cD as B,ba as xe,e9 as me,cI as je,i6 as ge,L as X,eo as fe,af as v,fH as L,r as u,ep as S,aq as ye,x as be,y as Ce,ae as V,i3 as Te,ai as R,dW as ke,eh as Ae,a7 as A,a8 as ve,bd as Z,b0 as we,aN as ee,h as Ee,o as Ie,aS as Ne,i as Se,av as te,cp as Re,i7 as b,dA as De,h7 as Q,dy as Le,dz as Pe,T as P,dQ as _e,F as Fe,eK as Be,dN as Ue,eL as Oe,h2 as Me,bj as He,b5 as se,b7 as ne,b6 as $e,b1 as Ke,dJ as Ge}from"./index-Cx91uh9W.js";import{u as We}from"./useApiTokens-5JgqgHim.js";const ze=h("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"auto auto 1fr",gridAutoRows:"min-content",alignItems:"center",gap:t.spacing(1),marginTop:t.spacing(1.5)})),m=j,qe=()=>{const{uiConfig:t}=g(),{setToastData:s}=_(),n=a=>()=>{J(a),s({type:"success",title:"Copied to clipboard"})},o=`${t.unleashUrl}/api/`,r=`${t.unleashUrl}/api/frontend/`;return e.jsxs(F,{severity:"info",children:[e.jsxs("p",{children:["Read the"," ",e.jsx("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"SDK overview"})," ","to connect Unleash to your application. Please note it can take up to ",e.jsx("strong",{children:"1 minute"})," before a new API key is activated."]}),e.jsxs(ze,{children:[e.jsx(m,{children:e.jsx("strong",{children:"CLIENT API URL: "})}),e.jsx(m,{children:e.jsx("pre",{style:{display:"inline"},children:o})}),e.jsx(m,{children:e.jsx(W,{title:"Copy URL",arrow:!0,children:e.jsx(z,{onClick:n(o),size:"small",children:e.jsx(D,{})})})}),e.jsx(m,{children:e.jsx("strong",{children:"FRONTEND API URL: "})}),e.jsx(m,{children:e.jsx("pre",{style:{display:"inline"},children:r})}),e.jsx(m,{children:e.jsx(W,{title:"Copy URL",arrow:!0,children:e.jsx(z,{onClick:n(r),size:"small",children:e.jsx(D,{})})})})]})]})},Ve=["Icon","createdAt","seenAt"],Qe=["Icon","project","seenAt"],At=({compact:t=!1,setHiddenColumns:s,columns:n,loading:o,rows:r,headerGroups:a,globalFilter:i,prepareRow:p})=>{const x=ce(de.breakpoints.down("xl"));return ue([{condition:x,columns:Ve},{condition:t,columns:Qe}],s,n),e.jsxs(e.Fragment,{children:[e.jsx(C,{condition:r.length>0,show:e.jsx(j,{sx:{mb:4},children:e.jsx(qe,{})})}),e.jsx(j,{sx:{overflowX:"auto"},children:e.jsx(he,{value:i,children:e.jsx(pe,{rows:r,headerGroups:a,prepareRow:p})})}),e.jsx(C,{condition:r.length===0&&!o,show:e.jsx(C,{condition:(i==null?void 0:i.length)>0,show:e.jsxs(q,{children:["No tokens found matching “",i,"”"]}),elseShow:e.jsx(q,{children:e.jsxs("span",{children:["No tokens available. Read ",e.jsx(B,{href:"https://docs.getunleash.io/how-to/api",target:"_blank",rel:"noreferrer",children:"API How-to guides"})," "," to learn more."]})})})})]})},Ye=(t,s)=>{const n=s>=t;return{limitReached:n,limitMessage:n?`You have reached the limit of ${t} API tokens`:void 0}},vt=({path:t,permission:s,project:n})=>{const o=xe(),{tokens:r,loading:a}=We(),{uiConfig:i}=g(),{limitReached:p,limitMessage:x}=Ye(i.resourceLimits.apiTokens,r.length);return e.jsx(me,{Icon:je,onClick:()=>o(t),"data-testid":ge,permission:s,projectId:n,maxWidth:"700px",disabled:a||p,tooltipProps:{title:x},children:"New API token"})},Je=h(X)(({theme:t})=>({textDecoration:"none",color:t.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),Xe=h("div")({display:"flex",alignItems:"center"}),Ze=({projects:t,project:s})=>{const{searchQuery:n}=fe(),o=t&&Array.isArray(t)&&t.length>1?t:[];if(o.length>0)return e.jsx(v,{children:e.jsx(L,{title:o.map((r,a)=>e.jsxs(u.Fragment,{children:[a>0&&", ",!r||r==="*"?e.jsx(S,{search:n,children:"*"}):e.jsx(Je,{to:`/projects/${r}`,children:e.jsx(S,{search:n,children:r})})]},r)),placement:"bottom-start",arrow:!0,tabIndex:0,children:e.jsxs("span",{children:[`${o.length}`," projects"]})})});if(o.length===1&&o[0]!=="*"||s&&s!=="*"){const r=s||o[0];return e.jsx(ye,{to:`/projects/${r}`,title:r})}return e.jsx(v,{children:e.jsx(L,{title:"ALL current and future projects.",placement:"bottom",arrow:!0,children:e.jsx(Xe,{children:e.jsx(S,{search:n,children:"*"})})})})};var U={},et=Ce;Object.defineProperty(U,"__esModule",{value:!0});var oe=U.default=void 0,tt=et(be()),st=e,nt=(0,tt.default)((0,st.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"Key");oe=U.default=nt;const ot=({secret:t,project:s,projects:n})=>{const o=t!=null&&t.includes(":")?"v2":"v1",r=t==null?void 0:t.startsWith("*:"),a=n&&(n==null?void 0:n.length)>1||(n==null?void 0:n.length)===1&&n[0]!=="*"||s&&s!=="*";return o==="v2"&&!r&&!a},rt=({...t})=>ot(t)?e.jsx(V,{icon:e.jsx(L,{title:e.jsxs("p",{children:["This is an orphaned token. All of its original projects have been deleted and it now has access to all current and future projects. You should stop using this token and delete it. Read more in"," ",e.jsx(B,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash/releases/tag/v6.1.0",children:"release notes"}),"."]}),placement:"bottom-start",arrow:!0,children:e.jsx(Te,{"aria-label":"Orphaned token",color:"warning","data-testid":"orphaned-token-icon"})})}):e.jsx(V,{icon:e.jsx(oe,{color:"disabled"})}),wt=(t,s)=>{const n=u.useMemo(()=>({sortBy:[{id:"createdAt",desc:!0}]}),[]),o=u.useMemo(()=>[{id:"Icon",Cell:c=>e.jsx(rt,{secret:c.row.original.secret,project:c.row.original.project,projects:c.row.original.projects}),disableSortBy:!0,disableGlobalFilter:!0,width:50},{Header:"Username",accessor:"username",Cell:R,minWidth:35},{Header:"Type",accessor:"type",Cell:({value:c})=>e.jsx(R,{value:Y[c.toLowerCase()].label,subtitle:Y[c.toLowerCase()].title,subtitleTooltip:!0}),width:180},{Header:"Project",accessor:"project",Cell:c=>e.jsx(Ze,{project:c.row.original.project,projects:c.row.original.projects}),width:160},{Header:"Environment",accessor:"environment",Cell:R,width:120},{Header:"Created",accessor:"createdAt",Cell:ke,width:150,disableGlobalFilter:!0},{Header:"Last seen",accessor:"seenAt",Cell:Ae,width:140,disableGlobalFilter:!0},{Header:"Actions",width:120,id:"Actions",align:"center",disableSortBy:!0,disableGlobalFilter:!0,Cell:s}],[]),{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:x,state:f,setGlobalFilter:w,setHiddenColumns:E}=A.useTable({columns:o,data:t,initialState:n,sortTypes:ve,autoResetHiddenColumns:!1,disableSortRemove:!0},A.useGlobalFilter,A.useSortBy,A.useFlexLayout);return{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:x,state:f,setGlobalFilter:w,setHiddenColumns:E,columns:o}},Y={client:{label:"CLIENT",title:"Connect server-side SDK or Unleash Proxy/Edge"},frontend:{label:"FRONTEND",title:"Connect web and mobile SDK"},admin:{label:"ADMIN",title:"Full access for managing Unleash"}},Et=({token:t,project:s,permission:n,track:o})=>{const{setToastData:r}=_(),a=i=>{J(i)&&(r({type:"success",title:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e.jsx(Z,{permission:n,projectId:s,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e.jsx(D,{})})},at=h("ul")({marginBottom:0}),It=({token:t,permission:s,onRemove:n,project:o})=>{const[r,a]=u.useState(!1),{setToastData:i,setToastApiError:p}=_(),x=async()=>{try{await n(),a(!1),i({type:"success",title:"API token removed"})}catch(f){p(Ee(f))}};return e.jsxs(e.Fragment,{children:[e.jsx(Z,{permission:s,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e.jsx(we,{})}),e.jsx(ee,{open:r,onClick:x,onClose:()=>a(!1),title:"Confirm deletion",children:e.jsxs("div",{children:["Are you sure you want to delete the following API token?",e.jsx("br",{}),e.jsxs(at,{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"username"}),":"," ",e.jsx("code",{children:t.username})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"type"}),": ",e.jsx("code",{children:t.type})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"environment"}),":"," ",e.jsx("code",{children:t.environment})]})]})]})})]})},it=h("div")(()=>({maxWidth:"400px"})),lt=h("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),ct=h(Ie)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),dt=h(Ne)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"400px",[t.breakpoints.down("sm")]:{minWidth:"379px"}})),re=h("p")(({theme:t})=>({marginBottom:t.spacing(1)})),ut=h("label")(({theme:t})=>({marginBottom:t.spacing(1)})),ht=h(Se)(({theme:t})=>({marginLeft:t.spacing(3)})),pt=h(j)({marginTop:"auto",display:"flex",justifyContent:"flex-end"}),Nt=({children:t,actions:s,handleSubmit:n,handleCancel:o})=>{var i;const{uiConfig:r}=g(),a=!!((i=r==null?void 0:r.flags)!=null&&i.UNLEASH_CLOUD);return e.jsxs(lt,{onSubmit:n,children:[e.jsx(C,{condition:a,show:e.jsxs(F,{severity:"info",sx:{mb:4},children:["Please be aware of our"," ",e.jsx(B,{href:"https://www.getunleash.io/fair-use-policy",children:"fair use policy"}),"."]})}),t,e.jsxs(pt,{children:[s,e.jsx(ht,{onClick:o,children:"Cancel"})]})]})};var d=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(d||{});const St=t=>{var $,K;const{environments:s}=te(),{uiConfig:n}=g(),o=Re("adminTokenKillSwitch"),r=($=s==null?void 0:s.find(l=>l.enabled))==null?void 0:$.name,a=b(De),i=b(Q,t),p=[{key:d.CLIENT,label:`Server-side SDK (${d.CLIENT})`,title:"Connect server-side SDK or Unleash Proxy/Edge",enabled:a||i}],x=b(Le),f=b(Pe),w=b(Q,t);!t&&!o&&p.push({key:d.ADMIN,label:d.ADMIN,title:"Full access for managing Unleash",enabled:x}),n.flags.embedProxyFrontend&&p.splice(1,0,{key:d.FRONTEND,label:`Client-side SDK (${d.FRONTEND})`,title:"Connect web and mobile SDK directly to Unleash",enabled:f||w});const E=(K=p.find(l=>l.enabled))==null?void 0:K.key,[c,ae]=u.useState(""),[T,O]=u.useState(E||d.CLIENT),[y,I]=u.useState([t||"*"]),[ie,le]=u.useState(y),[M,k]=u.useState(),[H,N]=u.useState({});return u.useEffect(()=>{k(T==="ADMIN"?"*":r)},[T,r]),{username:c,type:T,apiTokenTypes:p,projects:y,environment:M,setUsername:ae,setTokenType:l=>{l==="ADMIN"?(O(d.ADMIN),le(y),I(["*"]),k("*")):(O(l),I(ie),k(r))},setProjects:I,setEnvironment:k,getApiTokenPayload:()=>({username:c,type:T,environment:M,projects:y}),isValid:()=>{const l={};return c||(l.username="Username is required"),y.length===0&&(l.projects="At least one project is required"),N(l),Object.keys(l).length===0},clearErrors:l=>{if(l){const G={...H};delete G[l],N(G)}else N({})},errors:H}},Rt=({open:t,setOpen:s,closeConfirm:n,token:o,type:r})=>e.jsxs(ee,{open:t,setOpen:s,onClick:n,primaryButtonText:"Close",title:"New token created",children:[e.jsx(P,{variant:"body1",children:"Your new token has been created successfully."}),e.jsx(_e,{token:o}),e.jsx(C,{condition:r===d.FRONTEND,show:e.jsxs(F,{sx:{mt:2},severity:"info",children:["By default, all ",d.FRONTEND," tokens may be used from any CORS origin. If you'd like to configure a strict set of origins, please use the"," ",e.jsx(X,{to:"/admin/cors",target:"_blank",rel:"noreferrer",children:"CORS origins configuration page"}),"."]})})]}),Dt=({username:t,setUsername:s,errors:n,clearErrors:o})=>e.jsxs(e.Fragment,{children:[e.jsx(re,{children:"What would you like to call this token?"}),e.jsx(ct,{value:t,name:"username",onChange:r=>s(r.target.value),label:"Token name",error:n.username!==void 0,errorText:n.username,onFocus:()=>o("username"),autoFocus:!0})]}),Lt=({type:t,setType:s,apiTokenTypes:n})=>e.jsx(it,{children:e.jsxs(Fe,{sx:{mb:2,width:"100%"},children:[e.jsx(ut,{id:"token-type",children:"What do you want to connect?"}),e.jsx(Be,{"aria-labelledby":"token-type",defaultValue:"CLIENT",name:"radio-buttons-group",value:t,onChange:(o,r)=>s(r),children:n.map(({key:o,label:r,title:a,enabled:i})=>e.jsx(Ue,{value:o,sx:{mb:1},disabled:!i,control:e.jsx(Oe,{sx:{ml:.75,alignSelf:"flex-start"}}),label:e.jsx(j,{children:e.jsxs(j,{children:[e.jsx(P,{children:r}),e.jsx(P,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),Pt=({type:t,environment:s,setEnvironment:n})=>{const{environments:o}=te(),r=t===d.ADMIN?[{key:"*",label:"ALL"}]:o.map(a=>({key:a.name,label:`${a.name.concat(a.enabled?"":" - deprecated")}`,title:a.name,disabled:!1}));return e.jsxs(e.Fragment,{children:[e.jsx(re,{children:"Which environment should the token have access to?"}),e.jsx(dt,{disabled:t===d.ADMIN,options:r,value:s,onChange:n,label:"Environment",id:"api_key_environment",name:"environment",IconComponent:Me,fullWidth:!0})]})},xt=t=>t.map(s=>({...s.user,joinedAt:new Date(s.joinedAt),createdBy:s.createdBy})),_t=t=>{const{data:s,error:n,mutate:o}=He(se(`api/admin/groups/${t}`),mt);return u.useMemo(()=>({group:s&&{...s,users:xt((s==null?void 0:s.users)??[])},loading:!n&&!s,refetchGroup:()=>o(),error:n}),[s,n,o])},mt=t=>fetch(t).then(ne("Group")).then(s=>s.json()),Ft=()=>{const{isEnterprise:t}=g(),{data:s,error:n,mutate:o}=$e(t(),{serviceAccounts:[],rootRoles:[]},se("api/admin/service-account"),jt);return u.useMemo(()=>({serviceAccounts:(s==null?void 0:s.serviceAccounts)??[],roles:(s==null?void 0:s.rootRoles)??[],loading:!n&&!s,refetch:()=>o(),error:n}),[s,n,o])},jt=t=>fetch(t).then(ne("Service Accounts")).then(s=>s.json()),gt=h("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(.5),"& > *:not(:last-child)":{borderBottom:`1px solid ${t.palette.divider}`,paddingBottom:t.spacing(1)}})),Bt=({role:t,roles:s,value:n})=>{const{isEnterprise:o}=g();if(o()){const r=s||[t];return e.jsx(v,{children:e.jsx(Ke,{tooltip:e.jsx(gt,{children:r.map(a=>e.jsx(Ge,{roleId:a,tooltip:!0},a))}),children:n})})}return e.jsx(v,{children:n})};export{At as A,vt as C,Pt as E,It as R,re as S,d as T,Et as a,St as b,Nt as c,Dt as d,Lt as e,Rt as f,Ft as g,_t as h,Bt as i,oe as j,xt as m,wt as u};
1
+ import{s as h,ba as g,e as _,j as e,N as F,t as W,w as z,dt as D,B as j,dy as J,ag as ce,d9 as de,aj as ue,C,au as he,ak as pe,at as q,cI as B,bc as xe,ee as me,cN as je,ic as ge,L as X,et as fe,af as v,fM as P,r as u,eu as N,aq as ye,x as be,y as Ce,ae as V,i9 as Te,ai as R,d$ as ke,em as Ae,a7 as A,a8 as ve,bf as Z,b2 as we,aY as ee,h as Ee,o as Ie,aS as Se,i as Ne,av as te,cu as Re,id as b,dF as De,hf as Y,dD as Pe,dE as Le,T as L,dV as _e,F as Fe,eP as Be,dS as Ue,eQ as Oe,hb as Me,bo as $e,b7 as se,b9 as ne,b8 as He,b3 as Ge,dO as Ke}from"./index-JQ6lMAyk.js";import{u as We}from"./useApiTokens-DQBXJ3PL.js";const ze=h("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"auto auto 1fr",gridAutoRows:"min-content",alignItems:"center",gap:t.spacing(1),marginTop:t.spacing(1.5)})),m=j,qe=()=>{const{uiConfig:t}=g(),{setToastData:s}=_(),n=a=>()=>{J(a),s({type:"success",title:"Copied to clipboard"})},o=`${t.unleashUrl}/api/`,r=`${t.unleashUrl}/api/frontend/`;return e.jsxs(F,{severity:"info",children:[e.jsxs("p",{children:["Read the"," ",e.jsx("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"SDK overview"})," ","to connect Unleash to your application. Please note it can take up to ",e.jsx("strong",{children:"1 minute"})," before a new API key is activated."]}),e.jsxs(ze,{children:[e.jsx(m,{children:e.jsx("strong",{children:"CLIENT API URL: "})}),e.jsx(m,{children:e.jsx("pre",{style:{display:"inline"},children:o})}),e.jsx(m,{children:e.jsx(W,{title:"Copy URL",arrow:!0,children:e.jsx(z,{onClick:n(o),size:"small",children:e.jsx(D,{})})})}),e.jsx(m,{children:e.jsx("strong",{children:"FRONTEND API URL: "})}),e.jsx(m,{children:e.jsx("pre",{style:{display:"inline"},children:r})}),e.jsx(m,{children:e.jsx(W,{title:"Copy URL",arrow:!0,children:e.jsx(z,{onClick:n(r),size:"small",children:e.jsx(D,{})})})})]})]})},Ve=["Icon","createdAt","seenAt"],Ye=["Icon","project","seenAt"],At=({compact:t=!1,setHiddenColumns:s,columns:n,loading:o,rows:r,headerGroups:a,globalFilter:i,prepareRow:p})=>{const x=ce(de.breakpoints.down("xl"));return ue([{condition:x,columns:Ve},{condition:t,columns:Ye}],s,n),e.jsxs(e.Fragment,{children:[e.jsx(C,{condition:r.length>0,show:e.jsx(j,{sx:{mb:4},children:e.jsx(qe,{})})}),e.jsx(j,{sx:{overflowX:"auto"},children:e.jsx(he,{value:i,children:e.jsx(pe,{rows:r,headerGroups:a,prepareRow:p})})}),e.jsx(C,{condition:r.length===0&&!o,show:e.jsx(C,{condition:(i==null?void 0:i.length)>0,show:e.jsxs(q,{children:["No tokens found matching “",i,"”"]}),elseShow:e.jsx(q,{children:e.jsxs("span",{children:["No tokens available. Read ",e.jsx(B,{href:"https://docs.getunleash.io/how-to/api",target:"_blank",rel:"noreferrer",children:"API How-to guides"})," "," to learn more."]})})})})]})},Qe=(t,s)=>{const n=s>=t;return{limitReached:n,limitMessage:n?`You have reached the limit of ${t} API tokens`:void 0}},vt=({path:t,permission:s,project:n})=>{const o=xe(),{tokens:r,loading:a}=We(),{uiConfig:i}=g(),{limitReached:p,limitMessage:x}=Qe(i.resourceLimits.apiTokens,r.length);return e.jsx(me,{Icon:je,onClick:()=>o(t),"data-testid":ge,permission:s,projectId:n,maxWidth:"700px",disabled:a||p,tooltipProps:{title:x},children:"New API token"})},Je=h(X)(({theme:t})=>({textDecoration:"none",color:t.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),Xe=h("div")({display:"flex",alignItems:"center"}),Ze=({projects:t,project:s})=>{const{searchQuery:n}=fe(),o=t&&Array.isArray(t)&&t.length>1?t:[];if(o.length>0)return e.jsx(v,{children:e.jsx(P,{title:o.map((r,a)=>e.jsxs(u.Fragment,{children:[a>0&&", ",!r||r==="*"?e.jsx(N,{search:n,children:"*"}):e.jsx(Je,{to:`/projects/${r}`,children:e.jsx(N,{search:n,children:r})})]},r)),placement:"bottom-start",arrow:!0,tabIndex:0,children:e.jsxs("span",{children:[`${o.length}`," projects"]})})});if(o.length===1&&o[0]!=="*"||s&&s!=="*"){const r=s||o[0];return e.jsx(ye,{to:`/projects/${r}`,title:r})}return e.jsx(v,{children:e.jsx(P,{title:"ALL current and future projects.",placement:"bottom",arrow:!0,children:e.jsx(Xe,{children:e.jsx(N,{search:n,children:"*"})})})})};var U={},et=Ce;Object.defineProperty(U,"__esModule",{value:!0});var oe=U.default=void 0,tt=et(be()),st=e,nt=(0,tt.default)((0,st.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"Key");oe=U.default=nt;const ot=({secret:t,project:s,projects:n})=>{const o=t!=null&&t.includes(":")?"v2":"v1",r=t==null?void 0:t.startsWith("*:"),a=n&&(n==null?void 0:n.length)>1||(n==null?void 0:n.length)===1&&n[0]!=="*"||s&&s!=="*";return o==="v2"&&!r&&!a},rt=({...t})=>ot(t)?e.jsx(V,{icon:e.jsx(P,{title:e.jsxs("p",{children:["This is an orphaned token. All of its original projects have been deleted and it now has access to all current and future projects. You should stop using this token and delete it. Read more in"," ",e.jsx(B,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash/releases/tag/v6.1.0",children:"release notes"}),"."]}),placement:"bottom-start",arrow:!0,children:e.jsx(Te,{"aria-label":"Orphaned token",color:"warning","data-testid":"orphaned-token-icon"})})}):e.jsx(V,{icon:e.jsx(oe,{color:"disabled"})}),wt=(t,s)=>{const n=u.useMemo(()=>({sortBy:[{id:"createdAt",desc:!0}]}),[]),o=u.useMemo(()=>[{id:"Icon",Cell:c=>e.jsx(rt,{secret:c.row.original.secret,project:c.row.original.project,projects:c.row.original.projects}),disableSortBy:!0,disableGlobalFilter:!0,width:50},{Header:"Username",accessor:"username",Cell:R,minWidth:35},{Header:"Type",accessor:"type",Cell:({value:c})=>e.jsx(R,{value:Q[c.toLowerCase()].label,subtitle:Q[c.toLowerCase()].title,subtitleTooltip:!0}),width:180},{Header:"Project",accessor:"project",Cell:c=>e.jsx(Ze,{project:c.row.original.project,projects:c.row.original.projects}),width:160},{Header:"Environment",accessor:"environment",Cell:R,width:120},{Header:"Created",accessor:"createdAt",Cell:ke,width:150,disableGlobalFilter:!0},{Header:"Last seen",accessor:"seenAt",Cell:Ae,width:140,disableGlobalFilter:!0},{Header:"Actions",width:120,id:"Actions",align:"center",disableSortBy:!0,disableGlobalFilter:!0,Cell:s}],[]),{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:x,state:f,setGlobalFilter:w,setHiddenColumns:E}=A.useTable({columns:o,data:t,initialState:n,sortTypes:ve,autoResetHiddenColumns:!1,disableSortRemove:!0},A.useGlobalFilter,A.useSortBy,A.useFlexLayout);return{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:x,state:f,setGlobalFilter:w,setHiddenColumns:E,columns:o}},Q={client:{label:"CLIENT",title:"Connect server-side SDK or Unleash Proxy/Edge"},frontend:{label:"FRONTEND",title:"Connect web and mobile SDK"},admin:{label:"ADMIN",title:"Full access for managing Unleash"}},Et=({token:t,project:s,permission:n,track:o})=>{const{setToastData:r}=_(),a=i=>{J(i)&&(r({type:"success",title:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e.jsx(Z,{permission:n,projectId:s,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e.jsx(D,{})})},at=h("ul")({marginBottom:0}),It=({token:t,permission:s,onRemove:n,project:o})=>{const[r,a]=u.useState(!1),{setToastData:i,setToastApiError:p}=_(),x=async()=>{try{await n(),a(!1),i({type:"success",title:"API token removed"})}catch(f){p(Ee(f))}};return e.jsxs(e.Fragment,{children:[e.jsx(Z,{permission:s,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e.jsx(we,{})}),e.jsx(ee,{open:r,onClick:x,onClose:()=>a(!1),title:"Confirm deletion",children:e.jsxs("div",{children:["Are you sure you want to delete the following API token?",e.jsx("br",{}),e.jsxs(at,{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"username"}),":"," ",e.jsx("code",{children:t.username})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"type"}),": ",e.jsx("code",{children:t.type})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"environment"}),":"," ",e.jsx("code",{children:t.environment})]})]})]})})]})},it=h("div")(()=>({maxWidth:"400px"})),lt=h("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),ct=h(Ie)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),dt=h(Se)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"400px",[t.breakpoints.down("sm")]:{minWidth:"379px"}})),re=h("p")(({theme:t})=>({marginBottom:t.spacing(1)})),ut=h("label")(({theme:t})=>({marginBottom:t.spacing(1)})),ht=h(Ne)(({theme:t})=>({marginLeft:t.spacing(3)})),pt=h(j)({marginTop:"auto",display:"flex",justifyContent:"flex-end"}),St=({children:t,actions:s,handleSubmit:n,handleCancel:o})=>{var i;const{uiConfig:r}=g(),a=!!((i=r==null?void 0:r.flags)!=null&&i.UNLEASH_CLOUD);return e.jsxs(lt,{onSubmit:n,children:[e.jsx(C,{condition:a,show:e.jsxs(F,{severity:"info",sx:{mb:4},children:["Please be aware of our"," ",e.jsx(B,{href:"https://www.getunleash.io/fair-use-policy",children:"fair use policy"}),"."]})}),t,e.jsxs(pt,{children:[s,e.jsx(ht,{onClick:o,children:"Cancel"})]})]})};var d=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(d||{});const Nt=t=>{var H,G;const{environments:s}=te(),{uiConfig:n}=g(),o=Re("adminTokenKillSwitch"),r=(H=s==null?void 0:s.find(l=>l.enabled))==null?void 0:H.name,a=b(De),i=b(Y,t),p=[{key:d.CLIENT,label:`Server-side SDK (${d.CLIENT})`,title:"Connect server-side SDK or Unleash Proxy/Edge",enabled:a||i}],x=b(Pe),f=b(Le),w=b(Y,t);!t&&!o&&p.push({key:d.ADMIN,label:d.ADMIN,title:"Full access for managing Unleash",enabled:x}),n.flags.embedProxyFrontend&&p.splice(1,0,{key:d.FRONTEND,label:`Client-side SDK (${d.FRONTEND})`,title:"Connect web and mobile SDK directly to Unleash",enabled:f||w});const E=(G=p.find(l=>l.enabled))==null?void 0:G.key,[c,ae]=u.useState(""),[T,O]=u.useState(E||d.CLIENT),[y,I]=u.useState([t||"*"]),[ie,le]=u.useState(y),[M,k]=u.useState(),[$,S]=u.useState({});return u.useEffect(()=>{k(T==="ADMIN"?"*":r)},[T,r]),{username:c,type:T,apiTokenTypes:p,projects:y,environment:M,setUsername:ae,setTokenType:l=>{l==="ADMIN"?(O(d.ADMIN),le(y),I(["*"]),k("*")):(O(l),I(ie),k(r))},setProjects:I,setEnvironment:k,getApiTokenPayload:()=>({username:c,type:T,environment:M,projects:y}),isValid:()=>{const l={};return c||(l.username="Username is required"),y.length===0&&(l.projects="At least one project is required"),S(l),Object.keys(l).length===0},clearErrors:l=>{if(l){const K={...$};delete K[l],S(K)}else S({})},errors:$}},Rt=({open:t,setOpen:s,closeConfirm:n,token:o,type:r})=>e.jsxs(ee,{open:t,setOpen:s,onClick:n,primaryButtonText:"Close",title:"New token created",children:[e.jsx(L,{variant:"body1",children:"Your new token has been created successfully."}),e.jsx(_e,{token:o}),e.jsx(C,{condition:r===d.FRONTEND,show:e.jsxs(F,{sx:{mt:2},severity:"info",children:["By default, all ",d.FRONTEND," tokens may be used from any CORS origin. If you'd like to configure a strict set of origins, please use the"," ",e.jsx(X,{to:"/admin/cors",target:"_blank",rel:"noreferrer",children:"CORS origins configuration page"}),"."]})})]}),Dt=({username:t,setUsername:s,errors:n,clearErrors:o})=>e.jsxs(e.Fragment,{children:[e.jsx(re,{children:"What would you like to call this token?"}),e.jsx(ct,{value:t,name:"username",onChange:r=>s(r.target.value),label:"Token name",error:n.username!==void 0,errorText:n.username,onFocus:()=>o("username"),autoFocus:!0})]}),Pt=({type:t,setType:s,apiTokenTypes:n})=>e.jsx(it,{children:e.jsxs(Fe,{sx:{mb:2,width:"100%"},children:[e.jsx(ut,{id:"token-type",children:"What do you want to connect?"}),e.jsx(Be,{"aria-labelledby":"token-type",defaultValue:"CLIENT",name:"radio-buttons-group",value:t,onChange:(o,r)=>s(r),children:n.map(({key:o,label:r,title:a,enabled:i})=>e.jsx(Ue,{value:o,sx:{mb:1},disabled:!i,control:e.jsx(Oe,{sx:{ml:.75,alignSelf:"flex-start"}}),label:e.jsx(j,{children:e.jsxs(j,{children:[e.jsx(L,{children:r}),e.jsx(L,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),Lt=({type:t,environment:s,setEnvironment:n})=>{const{environments:o}=te(),r=t===d.ADMIN?[{key:"*",label:"ALL"}]:o.map(a=>({key:a.name,label:`${a.name.concat(a.enabled?"":" - deprecated")}`,title:a.name,disabled:!1}));return e.jsxs(e.Fragment,{children:[e.jsx(re,{children:"Which environment should the token have access to?"}),e.jsx(dt,{disabled:t===d.ADMIN,options:r,value:s,onChange:n,label:"Environment",id:"api_key_environment",name:"environment",IconComponent:Me,fullWidth:!0})]})},xt=t=>t.map(s=>({...s.user,joinedAt:new Date(s.joinedAt),createdBy:s.createdBy})),_t=t=>{const{data:s,error:n,mutate:o}=$e(se(`api/admin/groups/${t}`),mt);return u.useMemo(()=>({group:s&&{...s,users:xt((s==null?void 0:s.users)??[])},loading:!n&&!s,refetchGroup:()=>o(),error:n}),[s,n,o])},mt=t=>fetch(t).then(ne("Group")).then(s=>s.json()),Ft=()=>{const{isEnterprise:t}=g(),{data:s,error:n,mutate:o}=He(t(),{serviceAccounts:[],rootRoles:[]},se("api/admin/service-account"),jt);return u.useMemo(()=>({serviceAccounts:(s==null?void 0:s.serviceAccounts)??[],roles:(s==null?void 0:s.rootRoles)??[],loading:!n&&!s,refetch:()=>o(),error:n}),[s,n,o])},jt=t=>fetch(t).then(ne("Service Accounts")).then(s=>s.json()),gt=h("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(.5),"& > *:not(:last-child)":{borderBottom:`1px solid ${t.palette.divider}`,paddingBottom:t.spacing(1)}})),Bt=({role:t,roles:s,value:n})=>{const{isEnterprise:o}=g();if(o()){const r=s||[t];return e.jsx(v,{children:e.jsx(Ge,{tooltip:e.jsx(gt,{children:r.map(a=>e.jsx(Ke,{roleId:a,tooltip:!0},a))}),children:n})})}return e.jsx(v,{children:n})};export{At as A,vt as C,Lt as E,It as R,re as S,d as T,Et as a,Nt as b,St as c,Dt as d,Pt as e,Rt as f,Ft as g,_t as h,Bt as i,oe as j,xt as m,wt as u};
@@ -1 +1 @@
1
- import{s as d,w as j,B as a,cm as f,j as n,C as s,i5 as h,Y as S,bK as c,H as m,L as v}from"./index-Cx91uh9W.js";const k=d(j)({padding:0,cursor:"inherit",transition:"color 0.2s ease-in-out"}),y=d("div")(({theme:i})=>({fontSize:i.typography.fontSize,color:i.palette.text.secondary,position:"absolute",display:"none",right:"calc(100% + 6px)",top:i.spacing(2.5),[i.breakpoints.up("md")]:{display:"block"}})),B=d("div")(({theme:i})=>({fontSize:i.typography.fontSize,fontWeight:"normal",color:i.palette.text.secondary,display:"none",top:i.spacing(2.5),[i.breakpoints.up("md")]:{display:"block"}})),I=d("div")(({theme:i})=>({fontWeight:"normal",display:"none",[i.breakpoints.up("md")]:{display:"block"}})),w=d("div")({flexDirection:"column",justifyContent:"center",verticalAlign:"middle"}),C=d(a,{shouldForwardProp:i=>i!=="disabled"})(({theme:i,disabled:o})=>({borderRadius:i.shape.borderRadiusMedium,border:`1px solid ${i.palette.divider}`,"& + &":{marginTop:i.spacing(2)},background:o?i.palette.envAccordion.disabled:i.palette.background.paper})),L=d("div",{shouldForwardProp:i=>i!=="draggable"&&i!=="disabled"})(({theme:i,draggable:o,disabled:l})=>({padding:i.spacing(.5,2),display:"flex",gap:i.spacing(1),alignItems:"center",borderBottom:`1px solid ${i.palette.divider}`,fontWeight:i.typography.fontWeightMedium,paddingLeft:o?i.spacing(1):i.spacing(2),color:l?i.palette.text.secondary:i.palette.text.primary})),F=({strategy:i,onDragStart:o,onDragEnd:l,actions:p,children:x,orderNumber:t,style:b={},description:r})=>{const u=f(i.name),g="links"in i?({children:e})=>n.jsx(v,{to:i.links.edit,children:e}):({children:e})=>n.jsxs(n.Fragment,{children:[" ",e," "]});return n.jsxs(a,{sx:{position:"relative"},children:[n.jsx(s,{condition:t!==void 0,show:n.jsx(y,{children:t})}),n.jsxs(C,{disabled:(i==null?void 0:i.disabled)||!1,style:b,children:[n.jsxs(L,{draggable:!!o,disabled:!!(i!=null&&i.disabled),children:[n.jsx(s,{condition:!!o,show:()=>n.jsx(k,{draggable:!0,disableRipple:!0,size:"small",onDragStart:o,onDragEnd:l,sx:{cursor:"move"},children:n.jsx(h,{titleAccess:"Drag to reorder",cursor:"grab",sx:{color:"action.active"}})})}),n.jsx(u,{sx:{fill:e=>e.palette.action.disabled}}),n.jsxs(w,{children:[n.jsxs(g,{children:[n.jsx(S,{maxWidth:"400",maxLength:15,text:c(String(i.name))}),n.jsx(s,{condition:!!i.title,show:n.jsx(I,{children:c(String(i.title))})})]}),n.jsx(s,{condition:!!r,show:n.jsx(B,{children:r})})]}),n.jsx(s,{condition:!!(i!=null&&i.disabled),show:()=>n.jsx(n.Fragment,{children:n.jsx(m,{color:"disabled",children:"Disabled"})})}),n.jsx(a,{sx:{marginLeft:"auto",display:"flex",minHeight:e=>e.spacing(6),alignItems:"center"},children:p})]}),n.jsx(a,{sx:{p:2,justifyItems:"center"},children:x})]})]})};export{F as S};
1
+ import{s as d,w as j,B as a,cr as f,j as n,C as s,ib as h,Y as S,bP as c,H as m,L as v}from"./index-JQ6lMAyk.js";const k=d(j)({padding:0,cursor:"inherit",transition:"color 0.2s ease-in-out"}),y=d("div")(({theme:i})=>({fontSize:i.typography.fontSize,color:i.palette.text.secondary,position:"absolute",display:"none",right:"calc(100% + 6px)",top:i.spacing(2.5),[i.breakpoints.up("md")]:{display:"block"}})),B=d("div")(({theme:i})=>({fontSize:i.typography.fontSize,fontWeight:"normal",color:i.palette.text.secondary,display:"none",top:i.spacing(2.5),[i.breakpoints.up("md")]:{display:"block"}})),I=d("div")(({theme:i})=>({fontWeight:"normal",display:"none",[i.breakpoints.up("md")]:{display:"block"}})),w=d("div")({flexDirection:"column",justifyContent:"center",verticalAlign:"middle"}),C=d(a,{shouldForwardProp:i=>i!=="disabled"})(({theme:i,disabled:o})=>({borderRadius:i.shape.borderRadiusMedium,border:`1px solid ${i.palette.divider}`,"& + &":{marginTop:i.spacing(2)},background:o?i.palette.envAccordion.disabled:i.palette.background.paper})),L=d("div",{shouldForwardProp:i=>i!=="draggable"&&i!=="disabled"})(({theme:i,draggable:o,disabled:l})=>({padding:i.spacing(.5,2),display:"flex",gap:i.spacing(1),alignItems:"center",borderBottom:`1px solid ${i.palette.divider}`,fontWeight:i.typography.fontWeightMedium,paddingLeft:o?i.spacing(1):i.spacing(2),color:l?i.palette.text.secondary:i.palette.text.primary})),F=({strategy:i,onDragStart:o,onDragEnd:l,actions:p,children:x,orderNumber:t,style:b={},description:r})=>{const u=f(i.name),g="links"in i?({children:e})=>n.jsx(v,{to:i.links.edit,children:e}):({children:e})=>n.jsxs(n.Fragment,{children:[" ",e," "]});return n.jsxs(a,{sx:{position:"relative"},children:[n.jsx(s,{condition:t!==void 0,show:n.jsx(y,{children:t})}),n.jsxs(C,{disabled:(i==null?void 0:i.disabled)||!1,style:b,children:[n.jsxs(L,{draggable:!!o,disabled:!!(i!=null&&i.disabled),children:[n.jsx(s,{condition:!!o,show:()=>n.jsx(k,{draggable:!0,disableRipple:!0,size:"small",onDragStart:o,onDragEnd:l,sx:{cursor:"move"},children:n.jsx(h,{titleAccess:"Drag to reorder",cursor:"grab",sx:{color:"action.active"}})})}),n.jsx(u,{sx:{fill:e=>e.palette.action.disabled}}),n.jsxs(w,{children:[n.jsxs(g,{children:[n.jsx(S,{maxWidth:"400",maxLength:15,text:c(String(i.name))}),n.jsx(s,{condition:!!i.title,show:n.jsx(I,{children:c(String(i.title))})})]}),n.jsx(s,{condition:!!r,show:n.jsx(B,{children:r})})]}),n.jsx(s,{condition:!!(i!=null&&i.disabled),show:()=>n.jsx(n.Fragment,{children:n.jsx(m,{color:"disabled",children:"Disabled"})})}),n.jsx(a,{sx:{marginLeft:"auto",display:"flex",minHeight:e=>e.spacing(6),alignItems:"center"},children:p})]}),n.jsx(a,{sx:{p:2,justifyItems:"center"},children:x})]})]})};export{F as S};
@@ -0,0 +1 @@
1
+ import{b7 as p,bo as d,r as f,bp as h,b9 as m,s as y,an as g,ba as v,j as c,aS as b}from"./index-JQ6lMAyk.js";const E=p("api/admin/client-metrics/features"),S=(a,s)=>{const e=p(`api/admin/client-metrics/features/${a}/raw?hoursBack=${s}`),{data:t,error:r}=d(e,()=>k(e)),n=f.useCallback(()=>{h(E).catch(console.warn)},[]);return{featureMetrics:t==null?void 0:t.data,loading:!r&&!t,refetchFeatureMetrics:n,error:r}},k=a=>fetch(a).then(m("Features")).then(s=>s.json()).then(),F=y("h2")(({theme:a})=>({margin:0,marginBottom:a.spacing(1),fontSize:a.fontSizes.smallBody,fontWeight:a.fontWeight.thin,color:a.palette.text.secondary})),M=48,L=({hoursBack:a,setHoursBack:s,label:e=c.jsx(F,{children:"Period"})})=>{const{trackEvent:t}=g(),r=i=>{s(Number.parseInt(i)),t("feature-metrics",{props:{eventType:"change-period",hoursBack:i}})},{isEnterprise:n}=v(),l=n()?[...u,...R]:u,o=l.map(i=>Number(i.key)).includes(a)?a:M;return f.useEffect(()=>{a!==o&&s(o)},[a]),c.jsxs("div",{children:[e,c.jsx(b,{name:"feature-metrics-period",id:"feature-metrics-period",options:l,value:String(o),onChange:r,fullWidth:!0})]})},u=[{key:"1",label:"Last hour"},{key:"24",label:"Last 24 hours"},{key:"48",label:"Last 48 hours"}],R=[{key:`${7*24}`,label:"Last 7 days"},{key:`${30*24}`,label:"Last 30 days"},{key:`${90*24}`,label:"Last 90 days"}],T=a=>{const s=new Map;return a.forEach(e=>{let t=s.get(e.timestamp);if(t||(t={...e,yes:0,no:0,variants:{}},s.set(e.timestamp,t)),t.yes+=e.yes,t.no+=e.no,e.variants){t.variants=t.variants||{};for(const[r,n]of Object.entries(e.variants))t.variants[r]=(t.variants[r]||0)+n}}),Array.from(s.values()).map(e=>({...e,variants:e.variants&&Object.keys(e.variants).length===0?void 0:e.variants}))};export{M as F,T as a,L as b,S as u};
@@ -0,0 +1,6 @@
1
+ import{it as ct,ix as R,iy as w,iz as p,iA as Q,iB as fe,iC as ut,iD as b,ig as oe,iE as B,iF as D,iG as ft,iH as ht,iI as _,iJ as he,iK as K,iL as yt,iM as bt,iN as z,iO as J,iP as Ce,iQ as gt,iR as Pe,iS as T,iT as Ve,iU as $e,iV as mt}from"./index-JQ6lMAyk.js";/*!
2
+ * chartjs-plugin-annotation v2.2.1
3
+ * https://www.chartjs.org/chartjs-plugin-annotation/index
4
+ * (c) 2023 chartjs-plugin-annotation Contributors
5
+ * Released under the MIT License
6
+ */const ke={modes:{point(t,e){return q(t,e,{intersect:!0})},nearest(t,e,n){return xt(t,e,n)},x(t,e,n){return q(t,e,{intersect:n.intersect,axis:"x"})},y(t,e,n){return q(t,e,{intersect:n.intersect,axis:"y"})}}};function ye(t,e,n){return(ke.modes[n.mode]||ke.modes.nearest)(t,e,n)}function pt(t,e,n){return n!=="x"&&n!=="y"?t.inRange(e.x,e.y,"x",!0)||t.inRange(e.x,e.y,"y",!0):t.inRange(e.x,e.y,n,!0)}function wt(t,e,n){return n==="x"?{x:t.x,y:e.y}:n==="y"?{x:e.x,y:t.y}:e}function q(t,e,n){return t.visibleElements.filter(o=>n.intersect?o.inRange(e.x,e.y):pt(o,e,n.axis))}function xt(t,e,n){let o=Number.POSITIVE_INFINITY;return q(t,e,n).reduce((r,i)=>{const s=i.getCenterPoint(),a=wt(e,s,n.axis),d=fe(e,a);return d<o?(r=[i],o=d):d===o&&r.push(i),r},[]).sort((r,i)=>r._index-i._index).slice(0,1)}const St=(t,e)=>e>t||t.length>e.length&&t.slice(0,e.length)===e,A=.001,F=(t,e,n)=>Math.min(n,Math.max(e,t));function Mt(t,e,n){for(const o of Object.keys(t))t[o]=F(t[o],e,n);return t}function Ct(t,e,n,o){if(!t||!e||n<=0)return!1;const r=o/2;return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<=Math.pow(n+r,2)}function Je(t,{x:e,y:n,x2:o,y2:r},i,s){const a=s/2,d=t.x>=e-a-A&&t.x<=o+a+A,l=t.y>=n-a-A&&t.y<=r+a+A;return i==="x"?d:(i==="y"||d)&&l}function E(t,e){const{centerX:n,centerY:o}=t.getProps(["centerX","centerY"],e);return{x:n,y:o}}function Pt(t,e,n,o=!0){const r=n.split(".");let i=0;for(const s of e.split(".")){const a=r[i++];if(parseInt(s,10)<parseInt(a,10))break;if(St(a,s)){if(o)throw new Error(`${t} v${n} is not supported. v${e} or newer is required.`);return!1}}return!0}const Ue=t=>typeof t=="string"&&t.endsWith("%"),qe=t=>parseFloat(t)/100,Ke=t=>F(qe(t),0,1);function be(t,e){return e==="start"?0:e==="end"?t:Ue(e)?Ke(e)*t:t/2}function C(t,e,n=!0){return typeof e=="number"?e:Ue(e)?(n?Ke(e):qe(e))*t:t}function kt(t,e){const{x:n,width:o}=t,r=e.textAlign;return r==="center"?n+o/2:r==="end"||r==="right"?n+o:n}function ge(t,e="center"){return B(t)?{x:_(t.x,e),y:_(t.y,e)}:(t=_(t,e),{x:t,y:t})}function Ge(t){return t&&(p(t.xValue)||p(t.yValue))}function H(t,e,n,o=!1){const r=n.init;if(r){if(r===!0)return Fe(e,o)}else return;return vt(e,o,he(r,[{chart:t,properties:e,options:n}]))}function Qe(t,e,n){let o=!1;return e.forEach(r=>{T(t[r])?(o=!0,n[r]=t[r]):p(n[r])&&delete n[r]}),o}function Fe({centerX:t,centerY:e},n){return n?{centerX:t,centerY:e,radius:0,width:0,height:0}:{x:t,y:e,x2:t,y2:e,width:0,height:0}}function vt(t,e,n){if(n===!0)return Fe(t,e);if(B(n))return n}const re=new Map,At=t=>isNaN(t)||t<=0,Dt=t=>t.reduce(function(e,n){return e+=n.string,e},"");function Z(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object HTMLImageElement]"||e==="[object HTMLCanvasElement]"}}function me(t,{x:e,y:n},o){o&&(t.translate(e,n),t.rotate(w(o)),t.translate(-e,-n))}function P(t,e){if(e&&e.borderWidth)return t.lineCap=e.borderCapStyle,t.setLineDash(e.borderDash),t.lineDashOffset=e.borderDashOffset,t.lineJoin=e.borderJoinStyle,t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor,!0}function W(t,e){t.shadowColor=e.backgroundShadowColor,t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY}function pe(t,e){const n=e.content;if(Z(n))return{width:C(n.width,e.width),height:C(n.height,e.height)};const o=e.font,r=D(o)?o.map(d=>K(d)):[K(o)],i=e.textStrokeWidth,s=D(n)?n:[n],a=s.join()+Dt(r)+i+(t._measureText?"-spriting":"");return re.has(a)||re.set(a,Rt(t,s,r,i)),re.get(a)}function Ze(t,e,n){const{x:o,y:r,width:i,height:s}=e;t.save(),W(t,n);const a=P(t,n);t.fillStyle=n.backgroundColor,t.beginPath(),yt(t,{x:o,y:r,w:i,h:s,radius:Mt(bt(n.borderRadius),0,Math.min(i,s)/2)}),t.closePath(),t.fill(),a&&(t.shadowColor=n.borderShadowColor,t.stroke()),t.restore()}function jt(t,e,n){const o=n.content;if(Z(o)){t.save(),t.globalAlpha=Lt(n.opacity,o.style.opacity),t.drawImage(o,e.x,e.y,e.width,e.height),t.restore();return}const r=D(o)?o:[o],i=n.font,s=D(i)?i.map(u=>K(u)):[K(i)],a=n.color,d=D(a)?a:[a],l=kt(e,n),c=e.y+n.textStrokeWidth/2;t.save(),t.textBaseline="middle",t.textAlign=n.textAlign,It(t,n)&&Et(t,{x:l,y:c},r,s),Wt(t,{x:l,y:c},r,{fonts:s,colors:d}),t.restore()}function It(t,e){if(e.textStrokeWidth>0)return t.lineJoin="round",t.miterLimit=2,t.lineWidth=e.textStrokeWidth,t.strokeStyle=e.textStrokeColor,!0}function Tt(t,e,n,o){const{radius:r,options:i}=e,s=i.pointStyle,a=i.rotation;let d=(a||0)*$e;if(Z(s)){t.save(),t.translate(n,o),t.rotate(d),t.drawImage(s,-s.width/2,-s.height/2,s.width,s.height),t.restore();return}At(r)||Ot(t,{x:n,y:o,radius:r,rotation:a,style:s,rad:d})}function Ot(t,{x:e,y:n,radius:o,rotation:r,style:i,rad:s}){let a,d,l,c;switch(t.beginPath(),i){default:t.arc(e,n,o,0,gt),t.closePath();break;case"triangle":t.moveTo(e+Math.sin(s)*o,n-Math.cos(s)*o),s+=Ce,t.lineTo(e+Math.sin(s)*o,n-Math.cos(s)*o),s+=Ce,t.lineTo(e+Math.sin(s)*o,n-Math.cos(s)*o),t.closePath();break;case"rectRounded":c=o*.516,l=o-c,a=Math.cos(s+z)*l,d=Math.sin(s+z)*l,t.arc(e-a,n-d,c,s-b,s-J),t.arc(e+d,n-a,c,s-J,s),t.arc(e+a,n+d,c,s,s+J),t.arc(e-d,n+a,c,s+J,s+b),t.closePath();break;case"rect":if(!r){l=Math.SQRT1_2*o,t.rect(e-l,n-l,2*l,2*l);break}s+=z;case"rectRot":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+d,n-a),t.lineTo(e+a,n+d),t.lineTo(e-d,n+a),t.closePath();break;case"crossRot":s+=z;case"cross":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d),t.moveTo(e+d,n-a),t.lineTo(e-d,n+a);break;case"star":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d),t.moveTo(e+d,n-a),t.lineTo(e-d,n+a),s+=z,a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d),t.moveTo(e+d,n-a),t.lineTo(e-d,n+a);break;case"line":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d);break;case"dash":t.moveTo(e,n),t.lineTo(e+Math.cos(s)*o,n+Math.sin(s)*o);break}t.fill()}function Rt(t,e,n,o){t.save();const r=e.length;let i=0,s=o;for(let a=0;a<r;a++){const d=n[Math.min(a,n.length-1)];t.font=d.string;const l=e[a];i=Math.max(i,t.measureText(l).width+o),s+=d.lineHeight}return t.restore(),{width:i,height:s}}function Et(t,{x:e,y:n},o,r){t.beginPath();let i=0;o.forEach(function(s,a){const d=r[Math.min(a,r.length-1)],l=d.lineHeight;t.font=d.string,t.strokeText(s,e,n+l/2+i),i+=l}),t.stroke()}function Wt(t,{x:e,y:n},o,{fonts:r,colors:i}){let s=0;o.forEach(function(a,d){const l=i[Math.min(d,i.length-1)],c=r[Math.min(d,r.length-1)],u=c.lineHeight;t.beginPath(),t.font=c.string,t.fillStyle=l,t.fillText(a,e,n+u/2+s),s+=u,t.fill()})}function Lt(t,e){const n=Pe(t)?t:e;return Pe(n)?F(n,0,1):1}const ve={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function O(t,e,n){return e=typeof e=="number"?e:t.parse(e),Ve(e)?t.getPixelForValue(e):n}function j(t,e,n){const o=e[n];if(o||n==="scaleID")return o;const r=n.charAt(0),i=Object.values(t).filter(s=>s.axis&&s.axis===r);return i.length?i[0].id:r}function et(t,e){if(t){const n=t.options.reverse,o=O(t,e.min,n?e.end:e.start),r=O(t,e.max,n?e.start:e.end);return{start:o,end:r}}}function tt(t,e){const{chartArea:n,scales:o}=t,r=o[j(o,e,"xScaleID")],i=o[j(o,e,"yScaleID")];let s=n.width/2,a=n.height/2;return r&&(s=O(r,e.xValue,r.left+r.width/2)),i&&(a=O(i,e.yValue,i.top+i.height/2)),{x:s,y:a}}function we(t,e){const n=t.scales,o=n[j(n,e,"xScaleID")],r=n[j(n,e,"yScaleID")];if(!o&&!r)return{};let{left:i,right:s}=o||t.chartArea,{top:a,bottom:d}=r||t.chartArea;const l=Ae(o,{min:e.xMin,max:e.xMax,start:i,end:s});i=l.start,s=l.end;const c=Ae(r,{min:e.yMin,max:e.yMax,start:d,end:a});return a=c.start,d=c.end,{x:i,y:a,x2:s,y2:d,width:s-i,height:d-a,centerX:i+(s-i)/2,centerY:a+(d-a)/2}}function nt(t,e){if(!Ge(e)){const n=we(t,e);let o=e.radius;(!o||isNaN(o))&&(o=Math.min(n.width,n.height)/2,e.radius=o);const r=o*2,i=n.centerX+e.xAdjust,s=n.centerY+e.yAdjust;return{x:i-o,y:s-o,x2:i+o,y2:s+o,centerX:i,centerY:s,width:r,height:r,radius:o}}return zt(t,e)}function Yt(t,e){const{scales:n,chartArea:o}=t,r=n[e.scaleID],i={x:o.left,y:o.top,x2:o.right,y2:o.bottom};return r?Xt(r,i,e):_t(n,i,e),i}function ot(t,e,n){const o=we(t,e);return o.initProperties=H(t,o,e,n),o.elements=[{type:"label",optionScope:"label",properties:Nt(t,o,e),initProperties:o.initProperties}],o}function zt(t,e){const n=tt(t,e),o=e.radius*2;return{x:n.x-e.radius+e.xAdjust,y:n.y-e.radius+e.yAdjust,x2:n.x+e.radius+e.xAdjust,y2:n.y+e.radius+e.yAdjust,centerX:n.x+e.xAdjust,centerY:n.y+e.yAdjust,radius:e.radius,width:o,height:o}}function Ae(t,e){const n=et(t,e)||e;return{start:Math.min(n.start,n.end),end:Math.max(n.start,n.end)}}function Xt(t,e,n){const o=O(t,n.value,NaN),r=O(t,n.endValue,o);t.isHorizontal()?(e.x=o,e.x2=r):(e.y=o,e.y2=r)}function _t(t,e,n){for(const o of Object.keys(ve)){const r=t[j(t,n,o)];if(r){const{min:i,max:s,start:a,end:d,startProp:l,endProp:c}=ve[o],u=et(r,{min:n[i],max:n[s],start:r[a],end:r[d]});e[l]=u.start,e[c]=u.end}}}function Bt({properties:t,options:e},n,o,r){const{x:i,x2:s,width:a}=t;return rt({start:i,end:s,size:a,borderWidth:e.borderWidth},{position:o.x,padding:{start:r.left,end:r.right},adjust:e.label.xAdjust,size:n.width})}function Ht({properties:t,options:e},n,o,r){const{y:i,y2:s,height:a}=t;return rt({start:i,end:s,size:a,borderWidth:e.borderWidth},{position:o.y,padding:{start:r.top,end:r.bottom},adjust:e.label.yAdjust,size:n.height})}function rt(t,e){const{start:n,end:o,borderWidth:r}=t,{position:i,padding:{start:s,end:a},adjust:d}=e,l=o-r-n-s-a-e.size;return n+r/2+d+be(l,i)}function Nt(t,e,n){const o=n.label;o.backgroundColor="transparent",o.callout.display=!1;const r=ge(o.position),i=Q(o.padding),s=pe(t.ctx,o),a=Bt({properties:e,options:n},s,r,i),d=Ht({properties:e,options:n},s,r,i),l=s.width+i.width,c=s.height+i.height;return{x:a,y:d,x2:a+l,y2:d+c,width:l,height:c,centerX:a+l/2,centerY:d+c/2,rotation:o.rotation}}function I(t,e,n){const o=Math.cos(n),r=Math.sin(n),i=e.x,s=e.y;return{x:i+o*(t.x-i)-r*(t.y-s),y:s+r*(t.x-i)+o*(t.y-s)}}const ie=["enter","leave"],xe=ie.concat("click");function Vt(t,e,n){e.listened=Qe(n,xe,e.listeners),e.moveListened=!1,e._getElements=ye,ie.forEach(o=>{T(n[o])&&(e.moveListened=!0)}),(!e.listened||!e.moveListened)&&e.annotations.forEach(o=>{!e.listened&&T(o.click)&&(e.listened=!0),e.moveListened||ie.forEach(r=>{T(o[r])&&(e.listened=!0,e.moveListened=!0)})})}function $t(t,e,n){if(t.listened)switch(e.type){case"mousemove":case"mouseout":return Jt(t,e,n);case"click":return Ut(t,e,n)}}function Jt(t,e,n){if(!t.moveListened)return;let o;e.type==="mousemove"?o=ye(t,e,n.interaction):o=[];const r=t.hovered;t.hovered=o;const i={state:t,event:e};let s=De(i,"leave",r,o);return De(i,"enter",o,r)||s}function De({state:t,event:e},n,o,r){let i;for(const s of o)r.indexOf(s)<0&&(i=it(s.options[n]||t.listeners[n],s,e)||i);return i}function Ut(t,e,n){const o=t.listeners,r=ye(t,e,n.interaction);let i;for(const s of r)i=it(s.options.click||o.click,s,e)||i;return i}function it(t,e,n){return he(t,[e.$context,n])===!0}const G=["afterDraw","beforeDraw"];function qt(t,e,n){const o=e.visibleElements;e.hooked=Qe(n,G,e.hooks),e.hooked||o.forEach(r=>{e.hooked||G.forEach(i=>{T(r.options[i])&&(e.hooked=!0)})})}function je(t,e,n){if(t.hooked){const o=e.options[n]||t.hooks[n];return he(o,[e.$context])}}function Kt(t,e,n){const o=en(t.scales,e,n);let r=Ie(e,o,"min","suggestedMin");r=Ie(e,o,"max","suggestedMax")||r,r&&T(e.handleTickRangeOptions)&&e.handleTickRangeOptions()}function Gt(t,e){for(const n of t)Ft(n,e)}function Ie(t,e,n,o){if(Ve(e[n])&&!Qt(t.options,n,o)){const r=t[n]!==e[n];return t[n]=e[n],r}}function Qt(t,e,n){return p(t[e])||p(t[n])}function Ft(t,e){for(const n of["scaleID","xScaleID","yScaleID"]){const o=j(e,t,n);o&&!e[o]&&Zt(t,n)&&console.warn(`No scale found with id '${o}' for annotation '${t.id}'`)}}function Zt(t,e){if(e==="scaleID")return!0;const n=e.charAt(0);for(const o of["Min","Max","Value"])if(p(t[n+o]))return!0;return!1}function en(t,e,n){const o=e.axis,r=e.id,i=o+"ScaleID",s={min:_(e.min,Number.NEGATIVE_INFINITY),max:_(e.max,Number.POSITIVE_INFINITY)};for(const a of n)a.scaleID===r?Te(a,e,["value","endValue"],s):j(t,a,i)===r&&Te(a,e,[o+"Min",o+"Max",o+"Value"],s);return s}function Te(t,e,n,o){for(const r of n){const i=t[r];if(p(i)){const s=e.parse(i);o.min=Math.min(o.min,s),o.max=Math.max(o.max,s)}}}class L extends R{inRange(e,n,o,r){const{x:i,y:s}=I({x:e,y:n},this.getCenterPoint(r),w(-this.options.rotation));return Je({x:i,y:s},this.getProps(["x","y","x2","y2"],r),o,this.options.borderWidth)}getCenterPoint(e){return E(this,e)}draw(e){e.save(),me(e,this.getCenterPoint(),this.options.rotation),Ze(e,this,this.options),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){return ot(e,n)}}L.id="boxAnnotation";L.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};L.defaultRoutes={borderColor:"color",backgroundColor:"color"};L.descriptors={label:{_fallback:!0}};const st=["left","bottom","top","right"];class N extends R{inRange(e,n,o,r){const{x:i,y:s}=I({x:e,y:n},this.getCenterPoint(r),w(-this.rotation));return Je({x:i,y:s},this.getProps(["x","y","x2","y2"],r),o,this.options.borderWidth)}getCenterPoint(e){return E(this,e)}draw(e){const n=this.options,o=!p(this._visible)||this._visible;!n.display||!n.content||!o||(e.save(),me(e,this.getCenterPoint(),this.rotation),nn(e,this),Ze(e,this,n),jt(e,cn(this),n),e.restore())}resolveElementProperties(e,n){let o;if(Ge(n))o=tt(e,n);else{const{centerX:a,centerY:d}=we(e,n);o={x:a,y:d}}const r=Q(n.padding),i=pe(e.ctx,n),s=tn(o,i,n,r);return{initProperties:H(e,s,n),pointX:o.x,pointY:o.y,...s,rotation:n.rotation}}}N.id="labelAnnotation";N.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};N.defaultRoutes={borderColor:"color"};function tn(t,e,n,o){const r=e.width+o.width+n.borderWidth,i=e.height+o.height+n.borderWidth,s=ge(n.position,"center"),a=Oe(t.x,r,n.xAdjust,s.x),d=Oe(t.y,i,n.yAdjust,s.y);return{x:a,y:d,x2:a+r,y2:d+i,width:r,height:i,centerX:a+r/2,centerY:d+i/2}}function Oe(t,e,n=0,o){return t-be(e,o)+n}function nn(t,e){const{pointX:n,pointY:o,options:r}=e,i=r.callout,s=i&&i.display&&dn(e,i);if(!s||un(e,i,s))return;if(t.save(),t.beginPath(),!P(t,i))return t.restore();const{separatorStart:d,separatorEnd:l}=on(e,s),{sideStart:c,sideEnd:u}=sn(e,s,d);(i.margin>0||r.borderWidth===0)&&(t.moveTo(d.x,d.y),t.lineTo(l.x,l.y)),t.moveTo(c.x,c.y),t.lineTo(u.x,u.y);const f=I({x:n,y:o},e.getCenterPoint(),w(-e.rotation));t.lineTo(f.x,f.y),t.stroke(),t.restore()}function on(t,e){const{x:n,y:o,x2:r,y2:i}=t,s=rn(t,e);let a,d;return e==="left"||e==="right"?(a={x:n+s,y:o},d={x:a.x,y:i}):(a={x:n,y:o+s},d={x:r,y:a.y}),{separatorStart:a,separatorEnd:d}}function rn(t,e){const{width:n,height:o,options:r}=t,i=r.callout.margin+r.borderWidth/2;return e==="right"?n+i:e==="bottom"?o+i:-i}function sn(t,e,n){const{y:o,width:r,height:i,options:s}=t,a=s.callout.start,d=an(e,s.callout);let l,c;return e==="left"||e==="right"?(l={x:n.x,y:o+C(i,a)},c={x:l.x+d,y:l.y}):(l={x:n.x+C(r,a),y:n.y},c={x:l.x,y:l.y+d}),{sideStart:l,sideEnd:c}}function an(t,e){const n=e.side;return t==="left"||t==="top"?-n:n}function dn(t,e){const n=e.position;return st.includes(n)?n:ln(t,e)}function ln(t,e){const{x:n,y:o,x2:r,y2:i,width:s,height:a,pointX:d,pointY:l,centerX:c,centerY:u,rotation:f}=t,h={x:c,y:u},y=e.start,x=C(s,y),Y=C(a,y),g=[n,n+x,n+x,r],m=[o+Y,i,o,i],k=[];for(let v=0;v<4;v++){const ne=I({x:g[v],y:m[v]},h,w(f));k.push({position:st[v],distance:fe(ne,{x:d,y:l})})}return k.sort((v,ne)=>v.distance-ne.distance)[0].position}function cn({x:t,y:e,width:n,height:o,options:r}){const i=r.borderWidth/2,s=Q(r.padding);return{x:t+s.left+i,y:e+s.top+i,width:n-s.left-s.right-r.borderWidth,height:o-s.top-s.bottom-r.borderWidth}}function un(t,e,n){const{pointX:o,pointY:r}=t,i=e.margin;let s=o,a=r;return n==="left"?s+=i:n==="right"?s-=i:n==="top"?a+=i:n==="bottom"&&(a-=i),t.inRange(s,a)}const Se=(t,e,n)=>({x:t.x+n*(e.x-t.x),y:t.y+n*(e.y-t.y)}),se=(t,e,n)=>Se(e,n,Math.abs((t-e.y)/(n.y-e.y))).x,Re=(t,e,n)=>Se(e,n,Math.abs((t-e.x)/(n.x-e.x))).y,X=t=>t*t,fn=(t,e,{x:n,y:o,x2:r,y2:i},s)=>s==="y"?{start:Math.min(o,i),end:Math.max(o,i),value:e}:{start:Math.min(n,r),end:Math.max(n,r),value:t},Ee=(t,e,n,o)=>(1-o)*(1-o)*t+2*(1-o)*o*e+o*o*n,ae=(t,e,n,o)=>({x:Ee(t.x,e.x,n.x,o),y:Ee(t.y,e.y,n.y,o)}),We=(t,e,n,o)=>2*(1-o)*(e-t)+2*o*(n-e),Le=(t,e,n,o)=>-Math.atan2(We(t.x,e.x,n.x,o),We(t.y,e.y,n.y,o))+.5*b;class V extends R{inRange(e,n,o,r){const i=this.options.borderWidth/2;if(o!=="x"&&o!=="y"){const s={mouseX:e,mouseY:n},{path:a,ctx:d}=this;if(a){P(d,this.options);const{chart:c}=this.$context,u=e*c.currentDevicePixelRatio,f=n*c.currentDevicePixelRatio,h=d.isPointInStroke(a,u,f)||de(this,s,r);return d.restore(),h}const l=X(i);return gn(this,s,l,r)||de(this,s,r)}return hn(this,{mouseX:e,mouseY:n},o,{hBorderWidth:i,useFinalPosition:r})}getCenterPoint(e){return E(this,e)}draw(e){const{x:n,y:o,x2:r,y2:i,cp:s,options:a}=this;if(e.save(),!P(e,a))return e.restore();W(e,a);const d=Math.sqrt(Math.pow(r-n,2)+Math.pow(i-o,2));if(a.curve&&s)return Pn(e,this,s,d),e.restore();const{startOpts:l,endOpts:c,startAdjust:u,endAdjust:f}=at(this),h=Math.atan2(i-o,r-n);e.translate(n,o),e.rotate(h),e.beginPath(),e.moveTo(0+u,0),e.lineTo(d-f,0),e.shadowColor=a.borderShadowColor,e.stroke(),le(e,0,u,l),le(e,d,-f,c),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){const o=Yt(e,n),{x:r,y:i,x2:s,y2:a}=o,d=yn(o,e.chartArea),l=d?bn({x:r,y:i},{x:s,y:a},e.chartArea):{x:r,y:i,x2:s,y2:a,width:Math.abs(s-r),height:Math.abs(a-i)};if(l.centerX=(s+r)/2,l.centerY=(a+i)/2,l.initProperties=H(e,l,n),n.curve){const u={x:l.x,y:l.y},f={x:l.x2,y:l.y2};l.cp=Cn(l,n,fe(u,f))}const c=mn(e,l,n.label);return c._visible=d,l.elements=[{type:"label",optionScope:"label",properties:c,initProperties:l.initProperties}],l}}V.id="lineAnnotation";const Ye={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};V.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Ye),fill:!1,length:12,start:Object.assign({},Ye),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},N.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};V.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}};V.defaultRoutes={borderColor:"color"};function hn(t,{mouseX:e,mouseY:n},o,{hBorderWidth:r,useFinalPosition:i}){const s=fn(e,n,t.getProps(["x","y","x2","y2"],i),o);return s.value>=s.start-r&&s.value<=s.end+r||de(t,{mouseX:e,mouseY:n},i,o)}function yn({x:t,y:e,x2:n,y2:o},{top:r,right:i,bottom:s,left:a}){return!(t<a&&n<a||t>i&&n>i||e<r&&o<r||e>s&&o>s)}function ze({x:t,y:e},n,{top:o,right:r,bottom:i,left:s}){return t<s&&(e=Re(s,{x:t,y:e},n),t=s),t>r&&(e=Re(r,{x:t,y:e},n),t=r),e<o&&(t=se(o,{x:t,y:e},n),e=o),e>i&&(t=se(i,{x:t,y:e},n),e=i),{x:t,y:e}}function bn(t,e,n){const{x:o,y:r}=ze(t,e,n),{x:i,y:s}=ze(e,t,n);return{x:o,y:r,x2:i,y2:s,width:Math.abs(i-o),height:Math.abs(s-r)}}function gn(t,{mouseX:e,mouseY:n},o=A,r){const{x:i,y:s,x2:a,y2:d}=t.getProps(["x","y","x2","y2"],r),l=a-i,c=d-s,u=X(l)+X(c),f=u===0?-1:((e-i)*l+(n-s)*c)/u;let h,y;return f<0?(h=i,y=s):f>1?(h=a,y=d):(h=i+f*l,y=s+f*c),X(e-h)+X(n-y)<=o}function de(t,{mouseX:e,mouseY:n},o,r){const i=t.label;return i.options.display&&i.inRange(e,n,r,o)}function mn(t,e,n){const o=n.borderWidth,r=Q(n.padding),i=pe(t.ctx,n),s=i.width+r.width+o,a=i.height+r.height+o;return wn(e,n,{width:s,height:a,padding:r},t.chartArea)}function pn(t){const{x:e,y:n,x2:o,y2:r}=t,i=Math.atan2(r-n,o-e);return i>b/2?i-b:i<b/-2?i+b:i}function wn(t,e,n,o){const{width:r,height:i,padding:s}=n,{xAdjust:a,yAdjust:d}=e,l={x:t.x,y:t.y},c={x:t.x2,y:t.y2},u=e.rotation==="auto"?pn(t):w(e.rotation),f=xn(r,i,u),h=Sn(t,e,{labelSize:f,padding:s},o),y=t.cp?ae(l,t.cp,c,h):Se(l,c,h),x={size:f.w,min:o.left,max:o.right,padding:s.left},Y={size:f.h,min:o.top,max:o.bottom,padding:s.top},g=_e(y.x,x)+a,m=_e(y.y,Y)+d;return{x:g-r/2,y:m-i/2,x2:g+r/2,y2:m+i/2,centerX:g,centerY:m,pointX:y.x,pointY:y.y,width:r,height:i,rotation:ut(u)}}function xn(t,e,n){const o=Math.cos(n),r=Math.sin(n);return{w:Math.abs(t*o)+Math.abs(e*r),h:Math.abs(t*r)+Math.abs(e*o)}}function Sn(t,e,n,o){let r;const i=Mn(t,o);return e.position==="start"?r=Xe({w:t.x2-t.x,h:t.y2-t.y},n,e,i):e.position==="end"?r=1-Xe({w:t.x-t.x2,h:t.y-t.y2},n,e,i):r=be(1,e.position),r}function Xe(t,e,n,o){const{labelSize:r,padding:i}=e,s=t.w*o.dx,a=t.h*o.dy,d=s>0&&(r.w/2+i.left-o.x)/s,l=a>0&&(r.h/2+i.top-o.y)/a;return F(Math.max(d,l),0,.25)}function Mn(t,e){const{x:n,x2:o,y:r,y2:i}=t,s=Math.min(r,i)-e.top,a=Math.min(n,o)-e.left,d=e.bottom-Math.max(r,i),l=e.right-Math.max(n,o);return{x:Math.min(a,l),y:Math.min(s,d),dx:a<=l?1:-1,dy:s<=d?1:-1}}function _e(t,e){const{size:n,min:o,max:r,padding:i}=e,s=n/2;return n>r-o?(r+o)/2:(o>=t-i-s&&(t=o+i+s),r<=t+i+s&&(t=r-i-s),t)}function at(t){const e=t.options,n=e.arrowHeads&&e.arrowHeads.start,o=e.arrowHeads&&e.arrowHeads.end;return{startOpts:n,endOpts:o,startAdjust:Be(t,n),endAdjust:Be(t,o)}}function Be(t,e){if(!e||!e.display)return 0;const{length:n,width:o}=e,r=t.options.borderWidth/2,i={x:n,y:o+r};return Math.abs(se(0,i,{x:0,y:r}))}function le(t,e,n,o){if(!o||!o.display)return;const{length:r,width:i,fill:s,backgroundColor:a,borderColor:d}=o,l=Math.abs(e-r)+n;t.beginPath(),W(t,o),P(t,o),t.moveTo(l,-i),t.lineTo(e+n,0),t.lineTo(l,i),s===!0?(t.fillStyle=a||d,t.closePath(),t.fill(),t.shadowColor="transparent"):t.shadowColor=o.borderShadowColor,t.stroke()}function Cn(t,e,n){const{x:o,y:r,x2:i,y2:s,centerX:a,centerY:d}=t,l=Math.atan2(s-r,i-o),c=ge(e.controlPoint,0),u={x:a+C(n,c.x,!1),y:d+C(n,c.y,!1)};return I(u,{x:a,y:d},l)}function He(t,{x:e,y:n},{angle:o,adjust:r},i){!i||!i.display||(t.save(),t.translate(e,n),t.rotate(o),le(t,0,-r,i),t.restore())}function Pn(t,e,n,o){const{x:r,y:i,x2:s,y2:a,options:d}=e,{startOpts:l,endOpts:c,startAdjust:u,endAdjust:f}=at(e),h={x:r,y:i},y={x:s,y:a},x=Le(h,n,y,0),Y=Le(h,n,y,1)-b,g=ae(h,n,y,u/o),m=ae(h,n,y,1-f/o),k=new Path2D;t.beginPath(),k.moveTo(g.x,g.y),k.quadraticCurveTo(n.x,n.y,m.x,m.y),t.shadowColor=d.borderShadowColor,t.stroke(k),e.path=k,e.ctx=t,He(t,g,{angle:x,adjust:u},l),He(t,m,{angle:Y,adjust:f},c)}class $ extends R{inRange(e,n,o,r){const i=this.options.rotation,s=this.options.borderWidth;if(o!=="x"&&o!=="y")return kn({x:e,y:n},this.getProps(["width","height","centerX","centerY"],r),i,s);const{x:a,y:d,x2:l,y2:c}=this.getProps(["x","y","x2","y2"],r),u=s/2,f=o==="y"?{start:d,end:c}:{start:a,end:l},h=I({x:e,y:n},this.getCenterPoint(r),w(-i));return h[o]>=f.start-u-A&&h[o]<=f.end+u+A}getCenterPoint(e){return E(this,e)}draw(e){const{width:n,height:o,centerX:r,centerY:i,options:s}=this;e.save(),me(e,this.getCenterPoint(),s.rotation),W(e,this.options),e.beginPath(),e.fillStyle=s.backgroundColor;const a=P(e,s);e.ellipse(r,i,o/2,n/2,b/2,0,2*b),e.fill(),a&&(e.shadowColor=s.borderShadowColor,e.stroke()),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){return ot(e,n,!0)}}$.id="ellipseAnnotation";$.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:Object.assign({},L.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};$.defaultRoutes={borderColor:"color",backgroundColor:"color"};$.descriptors={label:{_fallback:!0}};function kn(t,e,n,o){const{width:r,height:i,centerX:s,centerY:a}=e,d=r/2,l=i/2;if(d<=0||l<=0)return!1;const c=w(n||0),u=o/2||0,f=Math.cos(c),h=Math.sin(c),y=Math.pow(f*(t.x-s)+h*(t.y-a),2),x=Math.pow(h*(t.x-s)-f*(t.y-a),2);return y/Math.pow(d+u,2)+x/Math.pow(l+u,2)<=1.0001}class ee extends R{inRange(e,n,o,r){const{x:i,y:s,x2:a,y2:d,width:l}=this.getProps(["x","y","x2","y2","width"],r),c=this.options.borderWidth;if(o!=="x"&&o!=="y")return Ct({x:e,y:n},this.getCenterPoint(r),l/2,c);const u=c/2,f=o==="y"?{start:s,end:d,value:n}:{start:i,end:a,value:e};return f.value>=f.start-u&&f.value<=f.end+u}getCenterPoint(e){return E(this,e)}draw(e){const n=this.options,o=n.borderWidth;if(n.radius<.1)return;e.save(),e.fillStyle=n.backgroundColor,W(e,n);const r=P(e,n);Tt(e,this,this.centerX,this.centerY),r&&!Z(n.pointStyle)&&(e.shadowColor=n.borderShadowColor,e.stroke()),e.restore(),n.borderWidth=o}resolveElementProperties(e,n){const o=nt(e,n);return o.initProperties=H(e,o,n,!0),o}}ee.id="pointAnnotation";ee.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};ee.defaultRoutes={borderColor:"color",backgroundColor:"color"};class te extends R{inRange(e,n,o,r){if(o!=="x"&&o!=="y")return this.options.radius>=.1&&this.elements.length>1&&An(this.elements,e,n,r);const i=I({x:e,y:n},this.getCenterPoint(r),w(-this.options.rotation)),s=this.elements.map(l=>o==="y"?l.bY:l.bX),a=Math.min(...s),d=Math.max(...s);return i[o]>=a&&i[o]<=d}getCenterPoint(e){return E(this,e)}draw(e){const{elements:n,options:o}=this;e.save(),e.beginPath(),e.fillStyle=o.backgroundColor,W(e,o);const r=P(e,o);let i=!0;for(const s of n)i?(e.moveTo(s.x,s.y),i=!1):e.lineTo(s.x,s.y);e.closePath(),e.fill(),r&&(e.shadowColor=o.borderShadowColor,e.stroke()),e.restore()}resolveElementProperties(e,n){const o=nt(e,n),{sides:r,rotation:i}=n,s=[],a=2*b/r;let d=i*$e;for(let l=0;l<r;l++,d+=a){const c=vn(o,n,d);c.initProperties=H(e,o,n),s.push(c)}return o.elements=s,o}}te.id="polygonAnnotation";te.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};te.defaultRoutes={borderColor:"color",backgroundColor:"color"};function vn({centerX:t,centerY:e},{radius:n,borderWidth:o},r){const i=o/2,s=Math.sin(r),a=Math.cos(r),d={x:t+s*n,y:e-a*n};return{type:"point",optionScope:"point",properties:{x:d.x,y:d.y,centerX:d.x,centerY:d.y,bX:t+s*(n+i),bY:e-a*(n+i)}}}function An(t,e,n,o){let r=!1,i=t[t.length-1].getProps(["bX","bY"],o);for(const s of t){const a=s.getProps(["bX","bY"],o);a.bY>n!=i.bY>n&&e<(i.bX-a.bX)*(n-a.bY)/(i.bY-a.bY)+a.bX&&(r=!r),i=a}return r}const M={box:L,ellipse:$,label:N,line:V,point:ee,polygon:te};Object.keys(M).forEach(t=>{ct.describe(`elements.${M[t].id}`,{_fallback:"plugins.annotation.common"})});const Dn={update:Object.assign},jn=xe.concat(G),Ne=(t,e)=>B(e)?ue(t,e):t,ce=t=>t==="color"||t==="font";function Me(t="line"){return M[t]?t:(console.warn(`Unknown annotation type: '${t}', defaulting to 'line'`),"line")}function In(t,e,n,o){const r=On(t,n.animations,o),i=e.annotations,s=Wn(e.elements,i);for(let a=0;a<i.length;a++){const d=i[a],l=dt(s,a,d.type),c=d.setContext(En(t,l,d)),u=l.resolveElementProperties(t,c);u.skip=Tn(u),"elements"in u&&(Rn(l,u.elements,c,r),delete u.elements),p(l.x)||Object.assign(l,u),Object.assign(l,u.initProperties),u.options=lt(c),r.update(l,u)}}function Tn(t){return isNaN(t.x)||isNaN(t.y)}function On(t,e,n){return n==="reset"||n==="none"||n==="resize"?Dn:new mt(t,e)}function Rn(t,e,n,o){const r=t.elements||(t.elements=[]);r.length=e.length;for(let i=0;i<e.length;i++){const s=e[i],a=s.properties,d=dt(r,i,s.type,s.initProperties),l=n[s.optionScope].override(s);a.options=lt(l),o.update(d,a)}}function dt(t,e,n,o){const r=M[Me(n)];let i=t[e];return(!i||!(i instanceof r))&&(i=t[e]=new r,Object.assign(i,o)),i}function lt(t){const e=M[Me(t.type)],n={};n.id=t.id,n.type=t.type,n.drawTime=t.drawTime,Object.assign(n,ue(t,e.defaults),ue(t,e.defaultRoutes));for(const o of jn)n[o]=t[o];return n}function ue(t,e){const n={};for(const o of Object.keys(e)){const r=e[o],i=t[o];ce(o)&&D(i)?n[o]=i.map(s=>Ne(s,r)):n[o]=Ne(i,r)}return n}function En(t,e,n){return e.$context||(e.$context=Object.assign(Object.create(t.getContext()),{element:e,id:n.id,type:"annotation"}))}function Wn(t,e){const n=e.length,o=t.length;if(o<n){const r=n-o;t.splice(o,0,...new Array(r))}else o>n&&t.splice(n,o-n);return t}var Ln="2.2.1";const S=new Map,Yn=xe.concat(G);var Bn={id:"annotation",version:Ln,beforeRegister(){Pt("chart.js","3.7",oe.version)},afterRegister(){oe.register(M)},afterUnregister(){oe.unregister(M)},beforeInit(t){S.set(t,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(t,e,n){const o=S.get(t),r=o.annotations=[];let i=n.annotations;B(i)?Object.keys(i).forEach(s=>{const a=i[s];B(a)&&(a.id=s,r.push(a))}):D(i)&&r.push(...i),Gt(r,t.scales)},afterDataLimits(t,e){const n=S.get(t);Kt(t,e.scale,n.annotations.filter(o=>o.display&&o.adjustScaleRange))},afterUpdate(t,e,n){const o=S.get(t);Vt(t,o,n),In(t,o,n,e.mode),o.visibleElements=o.elements.filter(r=>!r.skip&&r.options.display),qt(t,o,n)},beforeDatasetsDraw(t,e,n){U(t,"beforeDatasetsDraw",n.clip)},afterDatasetsDraw(t,e,n){U(t,"afterDatasetsDraw",n.clip)},beforeDraw(t,e,n){U(t,"beforeDraw",n.clip)},afterDraw(t,e,n){U(t,"afterDraw",n.clip)},beforeEvent(t,e,n){const o=S.get(t);$t(o,e.event,n)&&(e.changed=!0)},afterDestroy(t){S.delete(t)},_getState(t){return S.get(t)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:t=>!Yn.includes(t)&&t!=="init",annotations:{_allKeys:!1,_fallback:(t,e)=>`elements.${M[Me(e.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:ce,_fallback:!0},_indexable:ce}},additionalOptionScopes:[""]};function U(t,e,n){const{ctx:o,chartArea:r}=t,i=S.get(t);n&&ft(o,r);const s=zn(i.visibleElements,e).sort((a,d)=>a.element.options.z-d.element.options.z);for(const a of s)Xn(o,r,i,a);n&&ht(o)}function zn(t,e){const n=[];for(const o of t)if(o.options.drawTime===e&&n.push({element:o,main:!0}),o.elements&&o.elements.length)for(const r of o.elements)r.options.display&&r.options.drawTime===e&&n.push({element:r});return n}function Xn(t,e,n,o){const r=o.element;o.main?(je(n,r,"beforeDraw"),r.draw(t,e),je(n,r,"afterDraw")):r.draw(t,e)}const Hn=(t,e,n)=>{if(typeof t=="string")return t;const o=Number.parseInt(t.toString());return o>999999?`${o/1e6}M`:o>999?`${o/1e3}k`:o};export{Bn as a,Hn as f};
@@ -1 +1 @@
1
- import{i9 as b,r as a,bl as m,iQ as I,iR as K}from"./index-Cx91uh9W.js";const y="label";function h(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function L(t,e){Object.assign(t.options,e)}function C(t,e){t.labels=e}function E(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y;const o=[];t.datasets=e.map(n=>{const c=t.datasets.find(f=>f[s]===n[s]);return!c||!n.data||o.includes(c)?{...n}:(o.push(c),Object.assign(c,n),c)})}function v(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y;const s={labels:[],datasets:[]};return C(s,t.labels),E(s,t.datasets,e),s}function B(t,e){let{height:s=150,width:o=300,redraw:n=!1,datasetIdKey:c,type:f,data:u,options:i,plugins:w=[],fallbackContent:O,updateMode:p,...j}=t;const l=a.useRef(null),r=a.useRef(),d=()=>{l.current&&(r.current=new b(l.current,{type:f,data:v(u,c),options:i&&{...i},plugins:w}),h(e,r.current))},g=()=>{h(e,null),r.current&&(r.current.destroy(),r.current=null)};return a.useEffect(()=>{!n&&r.current&&i&&L(r.current,i)},[n,i]),a.useEffect(()=>{!n&&r.current&&C(r.current.config.data,u.labels)},[n,u.labels]),a.useEffect(()=>{!n&&r.current&&u.datasets&&E(r.current.config.data,u.datasets,c)},[n,u.datasets]),a.useEffect(()=>{r.current&&(n?(g(),setTimeout(d)):r.current.update(p))},[n,i,u.labels,u.datasets,p]),a.useEffect(()=>{r.current&&(g(),setTimeout(d))},[f]),a.useEffect(()=>(d(),()=>g()),[]),m.createElement("canvas",Object.assign({ref:l,role:"img",height:s,width:o},j),O)}const T=a.forwardRef(B);function R(t,e){return b.register(e),a.forwardRef((s,o)=>m.createElement(T,Object.assign({},s,{ref:o,type:t})))}const k=R("line",I),M=R("bar",K);export{M as B,k as L};
1
+ import{ig as b,r as a,bq as m,iW as I,iX as K}from"./index-JQ6lMAyk.js";const y="label";function h(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function L(t,e){Object.assign(t.options,e)}function C(t,e){t.labels=e}function E(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y;const o=[];t.datasets=e.map(n=>{const c=t.datasets.find(f=>f[s]===n[s]);return!c||!n.data||o.includes(c)?{...n}:(o.push(c),Object.assign(c,n),c)})}function v(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y;const s={labels:[],datasets:[]};return C(s,t.labels),E(s,t.datasets,e),s}function B(t,e){let{height:s=150,width:o=300,redraw:n=!1,datasetIdKey:c,type:f,data:u,options:i,plugins:w=[],fallbackContent:O,updateMode:p,...j}=t;const l=a.useRef(null),r=a.useRef(),d=()=>{l.current&&(r.current=new b(l.current,{type:f,data:v(u,c),options:i&&{...i},plugins:w}),h(e,r.current))},g=()=>{h(e,null),r.current&&(r.current.destroy(),r.current=null)};return a.useEffect(()=>{!n&&r.current&&i&&L(r.current,i)},[n,i]),a.useEffect(()=>{!n&&r.current&&C(r.current.config.data,u.labels)},[n,u.labels]),a.useEffect(()=>{!n&&r.current&&u.datasets&&E(r.current.config.data,u.datasets,c)},[n,u.datasets]),a.useEffect(()=>{r.current&&(n?(g(),setTimeout(d)):r.current.update(p))},[n,i,u.labels,u.datasets,p]),a.useEffect(()=>{r.current&&(g(),setTimeout(d))},[f]),a.useEffect(()=>(d(),()=>g()),[]),m.createElement("canvas",Object.assign({ref:l,role:"img",height:s,width:o},j),O)}const T=a.forwardRef(B);function R(t,e){return b.register(e),a.forwardRef((s,o)=>m.createElement(T,Object.assign({},s,{ref:o,type:t})))}const k=R("line",I),q=R("bar",K);export{q as B,k as L};