@mozaic-ds/web-components 0.4.1-beta.0 → 0.5.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 (173) hide show
  1. package/package.json +1 -1
  2. package/public/ClickOutside-63071e7a.js +15 -1
  3. package/public/ClickOutside-63071e7a.js.map +1 -1
  4. package/public/DataTableDefaultAction.nested-4da4dc44.js +759 -1
  5. package/public/DataTableDefaultAction.nested-4da4dc44.js.map +1 -1
  6. package/public/DataTableUtilities-60220c78.js +370 -1
  7. package/public/DataTableUtilities-60220c78.js.map +1 -1
  8. package/public/EventForward-8492ff62.js +109 -1
  9. package/public/EventForward-8492ff62.js.map +1 -1
  10. package/public/EventHandler-02058705.js +15 -1
  11. package/public/EventHandler-02058705.js.map +1 -1
  12. package/public/array-5b770a93.js +13 -1
  13. package/public/array-5b770a93.js.map +1 -1
  14. package/public/axis-fbc0f7b5.js +174 -1
  15. package/public/axis-fbc0f7b5.js.map +1 -1
  16. package/public/band-d7a07d2c.js +186 -1
  17. package/public/band-d7a07d2c.js.map +1 -1
  18. package/public/components/accordion/Accordion.js +365 -1
  19. package/public/components/accordion/Accordion.js.map +1 -1
  20. package/public/components/autocomplete/Autocomplete.js +1515 -1
  21. package/public/components/autocomplete/Autocomplete.js.map +1 -1
  22. package/public/components/badge/Badge.js +155 -1
  23. package/public/components/badge/Badge.js.map +1 -1
  24. package/public/components/badge/Badge.nested.js +101 -1
  25. package/public/components/badge/Badge.nested.js.map +1 -1
  26. package/public/components/breadcrumb/Breadcrumb.js +372 -1
  27. package/public/components/breadcrumb/Breadcrumb.js.map +1 -1
  28. package/public/components/breadcrumb/Breadcrumb.nested.js +319 -1
  29. package/public/components/breadcrumb/Breadcrumb.nested.js.map +1 -1
  30. package/public/components/button/Button.js +1138 -1
  31. package/public/components/button/Button.js.map +1 -1
  32. package/public/components/card/Card.js +369 -1
  33. package/public/components/card/Card.js.map +1 -1
  34. package/public/components/chart/BarChart.js +582 -1
  35. package/public/components/chart/BarChart.js.map +1 -1
  36. package/public/components/chart/Donut.js +1189 -1
  37. package/public/components/chart/Donut.js.map +1 -1
  38. package/public/components/chart/GroupedBarChart.js +750 -1
  39. package/public/components/chart/GroupedBarChart.js.map +1 -1
  40. package/public/components/chart/LineChart.js +1731 -1
  41. package/public/components/chart/LineChart.js.map +1 -1
  42. package/public/components/chart/Radar.js +729 -1
  43. package/public/components/chart/Radar.js.map +1 -1
  44. package/public/components/chart/StackedBarChart.js +745 -1
  45. package/public/components/chart/StackedBarChart.js.map +1 -1
  46. package/public/components/checkbox/Checkbox.js +307 -1
  47. package/public/components/checkbox/Checkbox.js.map +1 -1
  48. package/public/components/checkboxgroup/checkboxGroup.js +404 -1
  49. package/public/components/checkboxgroup/checkboxGroup.js.map +1 -1
  50. package/public/components/datatable/DataTable.js +3064 -1
  51. package/public/components/datatable/DataTable.js.map +1 -1
  52. package/public/components/datatable/DataTableDefaultAction.nested.js +4 -1
  53. package/public/components/datatable/DataTableDefaultAction.nested.js.map +1 -1
  54. package/public/components/datatable/DataTableDefaultEdtion.nested.js +164 -1
  55. package/public/components/datatable/DataTableDefaultEdtion.nested.js.map +1 -1
  56. package/public/components/datatable/DataTableDefaultFilterTags.nested.js +380 -1
  57. package/public/components/datatable/DataTableDefaultFilterTags.nested.js.map +1 -1
  58. package/public/components/datatable/DataTableDefaultSelection.nested.js +424 -1
  59. package/public/components/datatable/DataTableDefaultSelection.nested.js.map +1 -1
  60. package/public/components/datatable/DataTableDefaultSelectionLabel.nested.js +263 -1
  61. package/public/components/datatable/DataTableDefaultSelectionLabel.nested.js.map +1 -1
  62. package/public/components/datatable/DataTableFooter.nested.js +637 -1
  63. package/public/components/datatable/DataTableFooter.nested.js.map +1 -1
  64. package/public/components/dropdown/Dropdown.js +1426 -1
  65. package/public/components/dropdown/Dropdown.js.map +1 -1
  66. package/public/components/field/Field.js +375 -1
  67. package/public/components/field/Field.js.map +1 -1
  68. package/public/components/fileuploader/FileUploader.js +555 -1
  69. package/public/components/fileuploader/FileUploader.js.map +1 -1
  70. package/public/components/fileuploader/ResultFile.nested.js +265 -1
  71. package/public/components/fileuploader/ResultFile.nested.js.map +1 -1
  72. package/public/components/flag/Flag.js +174 -1
  73. package/public/components/flag/Flag.js.map +1 -1
  74. package/public/components/header/Header.js +903 -1
  75. package/public/components/header/Header.js.map +1 -1
  76. package/public/components/hero/Hero.js +271 -1
  77. package/public/components/hero/Hero.js.map +1 -1
  78. package/public/components/layer/Layer.js +453 -1
  79. package/public/components/layer/Layer.js.map +1 -1
  80. package/public/components/link/Link.js +380 -1
  81. package/public/components/link/Link.js.map +1 -1
  82. package/public/components/listbox/Listbox.js +595 -1
  83. package/public/components/listbox/Listbox.js.map +1 -1
  84. package/public/components/listbox/Listbox.nested.js +629 -1
  85. package/public/components/listbox/Listbox.nested.js.map +1 -1
  86. package/public/components/loader/Loader.js +246 -1
  87. package/public/components/loader/Loader.js.map +1 -1
  88. package/public/components/loader/Loader.nested.js +176 -1
  89. package/public/components/loader/Loader.nested.js.map +1 -1
  90. package/public/components/modal/Modal.js +395 -1
  91. package/public/components/modal/Modal.js.map +1 -1
  92. package/public/components/notification/Notification.js +458 -1
  93. package/public/components/notification/Notification.js.map +1 -1
  94. package/public/components/optionbutton/OptionButton.js +316 -1
  95. package/public/components/optionbutton/OptionButton.js.map +1 -1
  96. package/public/components/overlay/Overlay.js +104 -1
  97. package/public/components/overlay/Overlay.js.map +1 -1
  98. package/public/components/overlay/OverlayLoader.js +151 -1
  99. package/public/components/overlay/OverlayLoader.js.map +1 -1
  100. package/public/components/pagination/Pagination.js +613 -1
  101. package/public/components/pagination/Pagination.js.map +1 -1
  102. package/public/components/passwordinput/PasswordInput.js +291 -1
  103. package/public/components/passwordinput/PasswordInput.js.map +1 -1
  104. package/public/components/phonenumber/PhoneNumber.js +6894 -1
  105. package/public/components/phonenumber/PhoneNumber.js.map +1 -1
  106. package/public/components/phonenumber/PhoneNumber.svelte +72 -9
  107. package/public/components/price/Price.js +768 -1
  108. package/public/components/price/Price.js.map +1 -1
  109. package/public/components/progressbar/ProgressBar.js +278 -1
  110. package/public/components/progressbar/ProgressBar.js.map +1 -1
  111. package/public/components/quantityselector/QuantitySelector.js +333 -1
  112. package/public/components/quantityselector/QuantitySelector.js.map +1 -1
  113. package/public/components/radio/Radio.js +273 -1
  114. package/public/components/radio/Radio.js.map +1 -1
  115. package/public/components/radiogroup/RadioGroup.js +414 -1
  116. package/public/components/radiogroup/RadioGroup.js.map +1 -1
  117. package/public/components/ratings/StarsInput.js +292 -1
  118. package/public/components/ratings/StarsInput.js.map +1 -1
  119. package/public/components/ratings/StarsResult.js +246 -1
  120. package/public/components/ratings/StarsResult.js.map +1 -1
  121. package/public/components/select/Select.js +451 -1
  122. package/public/components/select/Select.js.map +1 -1
  123. package/public/components/sidebar/Sidebar.js +784 -1
  124. package/public/components/sidebar/Sidebar.js.map +1 -1
  125. package/public/components/sidebar/sidebar-feature-group.nested.js +594 -1
  126. package/public/components/sidebar/sidebar-feature-group.nested.js.map +1 -1
  127. package/public/components/sidebar/sidebar-feature.nested.js +402 -1
  128. package/public/components/sidebar/sidebar-feature.nested.js.map +1 -1
  129. package/public/components/sidebar/sidebar-section.nested.js +394 -1
  130. package/public/components/sidebar/sidebar-section.nested.js.map +1 -1
  131. package/public/components/sidebar/sidebar-segment.nested.js +200 -1
  132. package/public/components/sidebar/sidebar-segment.nested.js.map +1 -1
  133. package/public/components/sidebar/sidebar-separator.nested.js +49 -1
  134. package/public/components/sidebar/sidebar-separator.nested.js.map +1 -1
  135. package/public/components/sidebar/sidebar-sub-features.nested.js +312 -1
  136. package/public/components/sidebar/sidebar-sub-features.nested.js.map +1 -1
  137. package/public/components/sidebar/sidebar-user.nested.js +733 -1
  138. package/public/components/sidebar/sidebar-user.nested.js.map +1 -1
  139. package/public/components/stepper/Stepper.js +371 -1
  140. package/public/components/stepper/Stepper.js.map +1 -1
  141. package/public/components/tabs/Tabs.js +615 -1
  142. package/public/components/tabs/Tabs.js.map +1 -1
  143. package/public/components/tabs/Tabs.nested.js +472 -1
  144. package/public/components/tabs/Tabs.nested.js.map +1 -1
  145. package/public/components/tag/Tag.js +665 -1
  146. package/public/components/tag/Tag.js.map +1 -1
  147. package/public/components/tag/Tag.nested.js +554 -1
  148. package/public/components/tag/Tag.nested.js.map +1 -1
  149. package/public/components/taglist/TagList.js +475 -1
  150. package/public/components/taglist/TagList.js.map +1 -1
  151. package/public/components/textarea/Textarea.js +303 -1
  152. package/public/components/textarea/Textarea.js.map +1 -1
  153. package/public/components/textinput/Textinput.js +497 -1
  154. package/public/components/textinput/Textinput.js.map +1 -1
  155. package/public/components/textinput/Textinput.nested.js +320 -1
  156. package/public/components/textinput/Textinput.nested.js.map +1 -1
  157. package/public/components/toggle/Toggle.js +278 -1
  158. package/public/components/toggle/Toggle.js.map +1 -1
  159. package/public/components/tooltip/Tooltip.js +173 -1
  160. package/public/components/tooltip/Tooltip.js.map +1 -1
  161. package/public/index-c33b3772.js +873 -1
  162. package/public/index-c33b3772.js.map +1 -1
  163. package/public/linear-f46d7e9e.js +700 -1
  164. package/public/linear-f46d7e9e.js.map +1 -1
  165. package/public/path-1b5da959.js +186 -1
  166. package/public/path-1b5da959.js.map +1 -1
  167. package/public/sidebar-service-275bf9ef.js +129 -1
  168. package/public/sidebar-service-275bf9ef.js.map +1 -1
  169. package/public/symbol-b05a6e2b.js +169 -1
  170. package/public/symbol-b05a6e2b.js.map +1 -1
  171. package/public/transform-15d69d5d.js +2743 -1
  172. package/public/transform-15d69d5d.js.map +1 -1
  173. package/public/utilities/stories/phonenumber/PhoneNumber.stories.d.ts.map +1 -1
@@ -1,2 +1,1732 @@
1
- import{S as t,i as e,a as n,b as r,f as o,s as i,e as a,d as u,T as s,n as c,g as l,y as f,o as g,J as h,a1 as d,t as m,j as p,k as y,v as T}from"../../index-c33b3772.js";import{s as x}from"../../transform-15d69d5d.js";import{E as v}from"../../EventHandler-02058705.js";import{b,t as C,i as w,c as U,a as M,l as D}from"../../linear-f46d7e9e.js";import{S as k,s as F,a as Y,b as $,l as S}from"../../symbol-b05a6e2b.js";import{a as H,b as A}from"../../axis-fbc0f7b5.js";import"../../array-5b770a93.js";import"../../path-1b5da959.js";function L(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let o=-1;for(let i of t)null!=(i=e(i,++o,t))&&(void 0===n?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)))}return[n,r]}const j=new Date,_=new Date;function Z(t,e,n,r){function o(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return o.floor=e=>(t(e=new Date(+e)),e),o.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),o.round=t=>{const e=o(t),n=o.ceil(t);return t-e<n-t?e:n},o.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),o.range=(n,r,i)=>{const a=[];if(n=o.ceil(n),i=null==i?1:Math.floor(i),!(n<r&&i>0))return a;let u;do{a.push(u=new Date(+n)),e(n,i),t(n)}while(u<n&&n<r);return a},o.filter=n=>Z((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););})),n&&(o.count=(e,r)=>(j.setTime(+e),_.setTime(+r),t(j),t(_),Math.floor(n(j,_))),o.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?o.filter(r?e=>r(e)%t==0:e=>o.count(0,e)%t==0):o:null)),o}const E=Z((()=>{}),((t,e)=>{t.setTime(+t+e)}),((t,e)=>e-t));E.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Z((e=>{e.setTime(Math.floor(e/t)*t)}),((e,n)=>{e.setTime(+e+n*t)}),((e,n)=>(n-e)/t)):E:null),E.range;const W=1e3,z=6e4,O=60*z,P=24*O,V=7*P,I=30*P,J=365*P,q=Z((t=>{t.setTime(t-t.getMilliseconds())}),((t,e)=>{t.setTime(+t+e*W)}),((t,e)=>(e-t)/W),(t=>t.getUTCSeconds()));q.range;const Q=Z((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*W)}),((t,e)=>{t.setTime(+t+e*z)}),((t,e)=>(e-t)/z),(t=>t.getMinutes()));Q.range;const X=Z((t=>{t.setUTCSeconds(0,0)}),((t,e)=>{t.setTime(+t+e*z)}),((t,e)=>(e-t)/z),(t=>t.getUTCMinutes()));X.range;const B=Z((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*W-t.getMinutes()*z)}),((t,e)=>{t.setTime(+t+e*O)}),((t,e)=>(e-t)/O),(t=>t.getHours()));B.range;const N=Z((t=>{t.setUTCMinutes(0,0,0)}),((t,e)=>{t.setTime(+t+e*O)}),((t,e)=>(e-t)/O),(t=>t.getUTCHours()));N.range;const R=Z((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*z)/P),(t=>t.getDate()-1));R.range;const G=Z((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/P),(t=>t.getUTCDate()-1));G.range;const K=Z((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/P),(t=>Math.floor(t/P)));function tt(t){return Z((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*z)/V))}K.range;const et=tt(0),nt=tt(1),rt=tt(2),ot=tt(3),it=tt(4),at=tt(5),ut=tt(6);function st(t){return Z((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/V))}et.range,nt.range,rt.range,ot.range,it.range,at.range,ut.range;const ct=st(0),lt=st(1),ft=st(2),gt=st(3),ht=st(4),dt=st(5),mt=st(6);ct.range,lt.range,ft.range,gt.range,ht.range,dt.range,mt.range;const pt=Z((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,e)=>{t.setMonth(t.getMonth()+e)}),((t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())),(t=>t.getMonth()));pt.range;const yt=Z((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)}),((t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth()));yt.range;const Tt=Z((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));Tt.every=t=>isFinite(t=Math.floor(t))&&t>0?Z((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,Tt.range;const xt=Z((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));xt.every=t=>isFinite(t=Math.floor(t))&&t>0?Z((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,xt.range;const[vt,bt]=function(t,e,n,r,o,i){const a=[[q,1,W],[q,5,5e3],[q,15,15e3],[q,30,3e4],[i,1,z],[i,5,5*z],[i,15,15*z],[i,30,30*z],[o,1,O],[o,3,3*O],[o,6,6*O],[o,12,12*O],[r,1,P],[r,2,2*P],[n,1,V],[e,1,I],[e,3,3*I],[t,1,J]];function u(e,n,r){const o=Math.abs(n-e)/r,i=b((([,,t])=>t)).right(a,o);if(i===a.length)return t.every(C(e/J,n/J,r));if(0===i)return E.every(Math.max(C(e,n,r),1));const[u,s]=a[o/a[i-1][2]<a[i][2]/o?i-1:i];return u.every(s)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const o=n&&"function"==typeof n.range?n:u(t,e,n),i=o?o.range(t,+e+1):[];return r?i.reverse():i},u]}(Tt,pt,et,R,B,Q);function Ct(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function wt(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Ut(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var Mt,Dt,kt,Ft={"-":"",_:" ",0:"0"},Yt=/^\s*\d+/,$t=/^%/,St=/[\\^$*+?|[\]().{}]/g;function Ht(t,e,n){var r=t<0?"-":"",o=(r?-t:t)+"",i=o.length;return r+(i<n?new Array(n-i+1).join(e)+o:o)}function At(t){return t.replace(St,"\\$&")}function Lt(t){return new RegExp("^(?:"+t.map(At).join("|")+")","i")}function jt(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function _t(t,e,n){var r=Yt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Zt(t,e,n){var r=Yt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Et(t,e,n){var r=Yt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Wt(t,e,n){var r=Yt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function zt(t,e,n){var r=Yt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Ot(t,e,n){var r=Yt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Pt(t,e,n){var r=Yt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Vt(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function It(t,e,n){var r=Yt.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Jt(t,e,n){var r=Yt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function qt(t,e,n){var r=Yt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Qt(t,e,n){var r=Yt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Xt(t,e,n){var r=Yt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Bt(t,e,n){var r=Yt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Nt(t,e,n){var r=Yt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Rt(t,e,n){var r=Yt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Gt(t,e,n){var r=Yt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Kt(t,e,n){var r=$t.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function te(t,e,n){var r=Yt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function ee(t,e,n){var r=Yt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function ne(t,e){return Ht(t.getDate(),e,2)}function re(t,e){return Ht(t.getHours(),e,2)}function oe(t,e){return Ht(t.getHours()%12||12,e,2)}function ie(t,e){return Ht(1+R.count(Tt(t),t),e,3)}function ae(t,e){return Ht(t.getMilliseconds(),e,3)}function ue(t,e){return ae(t,e)+"000"}function se(t,e){return Ht(t.getMonth()+1,e,2)}function ce(t,e){return Ht(t.getMinutes(),e,2)}function le(t,e){return Ht(t.getSeconds(),e,2)}function fe(t){var e=t.getDay();return 0===e?7:e}function ge(t,e){return Ht(et.count(Tt(t)-1,t),e,2)}function he(t){var e=t.getDay();return e>=4||0===e?it(t):it.ceil(t)}function de(t,e){return t=he(t),Ht(it.count(Tt(t),t)+(4===Tt(t).getDay()),e,2)}function me(t){return t.getDay()}function pe(t,e){return Ht(nt.count(Tt(t)-1,t),e,2)}function ye(t,e){return Ht(t.getFullYear()%100,e,2)}function Te(t,e){return Ht((t=he(t)).getFullYear()%100,e,2)}function xe(t,e){return Ht(t.getFullYear()%1e4,e,4)}function ve(t,e){var n=t.getDay();return Ht((t=n>=4||0===n?it(t):it.ceil(t)).getFullYear()%1e4,e,4)}function be(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ht(e/60|0,"0",2)+Ht(e%60,"0",2)}function Ce(t,e){return Ht(t.getUTCDate(),e,2)}function we(t,e){return Ht(t.getUTCHours(),e,2)}function Ue(t,e){return Ht(t.getUTCHours()%12||12,e,2)}function Me(t,e){return Ht(1+G.count(xt(t),t),e,3)}function De(t,e){return Ht(t.getUTCMilliseconds(),e,3)}function ke(t,e){return De(t,e)+"000"}function Fe(t,e){return Ht(t.getUTCMonth()+1,e,2)}function Ye(t,e){return Ht(t.getUTCMinutes(),e,2)}function $e(t,e){return Ht(t.getUTCSeconds(),e,2)}function Se(t){var e=t.getUTCDay();return 0===e?7:e}function He(t,e){return Ht(ct.count(xt(t)-1,t),e,2)}function Ae(t){var e=t.getUTCDay();return e>=4||0===e?ht(t):ht.ceil(t)}function Le(t,e){return t=Ae(t),Ht(ht.count(xt(t),t)+(4===xt(t).getUTCDay()),e,2)}function je(t){return t.getUTCDay()}function _e(t,e){return Ht(lt.count(xt(t)-1,t),e,2)}function Ze(t,e){return Ht(t.getUTCFullYear()%100,e,2)}function Ee(t,e){return Ht((t=Ae(t)).getUTCFullYear()%100,e,2)}function We(t,e){return Ht(t.getUTCFullYear()%1e4,e,4)}function ze(t,e){var n=t.getUTCDay();return Ht((t=n>=4||0===n?ht(t):ht.ceil(t)).getUTCFullYear()%1e4,e,4)}function Oe(){return"+0000"}function Pe(){return"%"}function Ve(t){return+t}function Ie(t){return Math.floor(+t/1e3)}function Je(t){return new Date(t)}function qe(t){return t instanceof Date?+t:+new Date(+t)}function Qe(t,e,n,r,o,i,a,u,s,c){var l=U(),f=l.invert,g=l.domain,h=c(".%L"),d=c(":%S"),m=c("%I:%M"),p=c("%I %p"),y=c("%a %d"),T=c("%b %d"),x=c("%B"),v=c("%Y");function b(t){return(s(t)<t?h:u(t)<t?d:a(t)<t?m:i(t)<t?p:r(t)<t?o(t)<t?y:T:n(t)<t?x:v)(t)}return l.invert=function(t){return new Date(f(t))},l.domain=function(t){return arguments.length?g(Array.from(t,qe)):g().map(Je)},l.ticks=function(e){var n=g();return t(n[0],n[n.length-1],null==e?10:e)},l.tickFormat=function(t,e){return null==e?b:c(e)},l.nice=function(t){var n=g();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?g(function(t,e){var n,r=0,o=(t=t.slice()).length-1,i=t[r],a=t[o];return a<i&&(n=r,r=o,o=n,n=i,i=a,a=n),t[r]=e.floor(i),t[o]=e.ceil(a),t}(n,t)):l},l.copy=function(){return M(l,Qe(t,e,n,r,o,i,a,u,s,c))},l}function Xe(){return w.apply(Qe(vt,bt,Tt,pt,et,R,B,Q,q,Dt).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Be(t,e,n){const r=t.slice();return r[27]=e[n],r}function Ne(t){let e;function n(t,e){return t[3].customtooltip?Ge:Re}let o=n(t),i=o(t);return{c(){e=a("div"),i.c(),l(e,"class","tooltip"),l(e,"style",`right: ${t[4].right}px; top: ${t[4].top}px;`)},m(t,n){r(t,e,n),i.m(e,null)},p(t,r){o===(o=n(t))&&i?i.p(t,r):(i.d(1),i=o(t),i&&(i.c(),i.m(e,null)))},d(t){t&&g(e),i.d()}}}function Re(t){let e,n,o,i,u=t[3].date+"",s=t[3].value+"";return{c(){e=m(u),n=m(": "),o=a("b"),i=m(s)},m(t,a){r(t,e,a),r(t,n,a),r(t,o,a),p(o,i)},p(t,n){8&n&&u!==(u=t[3].date+"")&&y(e,u),8&n&&s!==(s=t[3].value+"")&&y(i,s)},d(t){t&&g(e),t&&g(n),t&&g(o)}}}function Ge(t){let e,n=t[3].customtooltip+"";return{c(){e=m(n)},m(t,n){r(t,e,n)},p(t,r){8&r&&n!==(n=t[3].customtooltip+"")&&y(e,n)},d(t){t&&g(e)}}}function Ke(t){let e,n,o,i,c,f,h,d,T=t[27].title+"";return{c(){e=a("div"),n=s("svg"),o=s("rect"),c=u(),f=a("span"),h=m(T),d=u(),l(o,"x","0"),l(o,"y","0"),l(o,"width","24"),l(o,"height","16"),l(o,"fill",i=t[27].color),l(n,"class","legend__box"),l(f,"class","legend__title"),l(e,"class","legend__item")},m(t,i){r(t,e,i),p(e,n),p(n,o),p(e,c),p(e,f),p(f,h),p(e,d)},p(t,e){2&e&&i!==(i=t[27].color)&&l(o,"fill",i),2&e&&T!==(T=t[27].title+"")&&y(h,T)},d(t){t&&g(e)}}}function tn(t){let e,n,o,i,d,m=t[3].show&&Ne(t),p=t[1],y=[];for(let e=0;e<p.length;e+=1)y[e]=Ke(Be(t,p,e));return{c(){e=a("div"),m&&m.c(),n=u(),o=a("div");for(let t=0;t<y.length;t+=1)y[t].c();i=u(),d=s("text"),this.c=c,l(e,"class","chart"),f(e,"background-color",t[0]),l(o,"class","legend"),f(d,"display","none")},m(a,u){r(a,e,u),m&&m.m(e,null),t[10](e),r(a,n,u),r(a,o,u);for(let t=0;t<y.length;t+=1)y[t]&&y[t].m(o,null);r(a,i,u),r(a,d,u)},p(t,[n]){if(t[3].show?m?m.p(t,n):(m=Ne(t),m.c(),m.m(e,null)):m&&(m.d(1),m=null),1&n&&f(e,"background-color",t[0]),2&n){let e;for(p=t[1],e=0;e<p.length;e+=1){const r=Be(t,p,e);y[e]?y[e].p(r,n):(y[e]=Ke(r),y[e].c(),y[e].m(o,null))}for(;e<y.length;e+=1)y[e].d(1);y.length=p.length}},i:c,o:c,d(r){r&&g(e),m&&m.d(),t[10](null),r&&g(n),r&&g(o),h(y,r),r&&g(i),r&&g(d)}}}function en(t,e,n){let{data:r=""}=e,{backgroundcolor:o="#fff"}=e,{height:i=300}=e,{ticknumbers:a=5}=e;const u=kt("%d-%m-%Y");let s,c,l,f,g,h,m,p,y=!1,b=new v,C=[];const w={top:20,right:40,bottom:40,left:60,yAxisPadding:20};let U={date:"",value:0,show:!1,customtooltip:""};function M(){let t=x(l).style("width");return""!==t&&t||(t=""+window.innerWidth/2),parseInt(t)}function j(t,e){const r=new Date(e.time).toDateString(),o=e.value;n(3,U={date:r,value:parseInt(o),show:!0,customtooltip:e.customtooltip})}function _(t){const e=M(),n=t.flatMap((t=>t.points)),[r=0,o=0]=L(n,(t=>Number(t.value))),a=L(n,(t=>u(t.time)));g.domain(a),f.selectAll(".x-axis").attr("transform",`translate(${w.yAxisPadding},${i+w.bottom/2})`).call(m).attr("stroke-width","0"),h.domain([r,o]),f.selectAll(".y-axis").call(p).select(".domain").attr("stroke-width","0"),f.selectAll(".y-axis .tick line").attr("x1",w.yAxisPadding/2).attr("x2",e-w.left).attr("stroke","#EEEDEA").attr("stroke-width","1.4px")}function Z(t){const e=M();g=Xe().range([0,e-w.left-w.right]),m=H(g).tickSize(0).ticks(R).ticks(a).tickPadding(5),h=D().range([i,0]),p=A(h).ticks(a),t||(f=x(l).append("svg").attr("width",e).attr("height",i+w.top+w.bottom).attr("id","svg-chart").append("g").attr("transform",`translate(${w.left/2+w.right/2},${w.top})`),f.append("g").attr("transform","translate(0,"+String(i)+")").attr("class","x-axis"),f.append("g").attr("class","y-axis")),_(c),c.forEach(((e,n)=>{t||C.push(f.append("g").append("path")),E(e,n)}))}function E(t,e){const r=t.points.map((t=>({time:u(t.time)||"",value:t.value,customtooltip:t.customtooltip})));!function(t,e,n,r){t.datum(e).attr("d",S().x((t=>g(+t.time))).y((t=>h(+t.value)))).attr("stroke",n).style("stroke-width",2.5).style("fill","none").attr("transform",`translate(${w.yAxisPadding},0)`).attr("stroke-dasharray",r||0)}(C[e],r,t.color,t.strokeDasharray),f.selectAll(`.chart__symbol-line-${e}`).remove(),function(t,e,r,o){let i=k(F);switch(r){case"circle":i=k($);break;case"triangle":i=k(Y)}f.selectAll().data(t).join("path").attr("d",i.size(50)).attr("opacity",1).attr("transform",(t=>`translate(${g(+t.time)+w.yAxisPadding},${h(+t.value)})`)).attr("class",`chart__symbol-line-${o}`).style("fill",e).style("cursor","pointer").on("mouseover",j).on("mouseout",(()=>n(3,U.show=!1,U))).on("click",((t,e)=>{b.dispatch("point-clicked",e)}))}(r,t.color,t.symbol,e)}function W(){var t;if(s&&y){const e=M();null===(t=l.querySelector("#svg-chart"))||void 0===t||t.setAttribute("width",`${e}px`),Z(!0)}}return d((()=>{new ResizeObserver(W).observe(l),n(9,y=!0)})),t.$$set=t=>{"data"in t&&n(5,r=t.data),"backgroundcolor"in t&&n(0,o=t.backgroundcolor),"height"in t&&n(6,i=t.height),"ticknumbers"in t&&n(7,a=t.ticknumbers)},t.$$.update=()=>{32&t.$$.dirty&&n(1,c=r?JSON.parse(r):[]),802&t.$$.dirty&&r.length>0&&y&&(s?r!==s&&(_(c),c.forEach(((t,e)=>E(t,e))),n(8,s=r)):(Z(),n(8,s=r)))},[o,c,l,U,w,r,i,a,s,y,function(t){T[t?"unshift":"push"]((()=>{l=t,n(2,l)}))}]}Mt=function(t){var e=t.dateTime,n=t.date,r=t.time,o=t.periods,i=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,c=Lt(o),l=jt(o),f=Lt(i),g=jt(i),h=Lt(a),d=jt(a),m=Lt(u),p=jt(u),y=Lt(s),T=jt(s),x={a:function(t){return a[t.getDay()]},A:function(t){return i[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:ne,e:ne,f:ue,g:Te,G:ve,H:re,I:oe,j:ie,L:ae,m:se,M:ce,p:function(t){return o[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ve,s:Ie,S:le,u:fe,U:ge,V:de,w:me,W:pe,x:null,X:null,y:ye,Y:xe,Z:be,"%":Pe},v={a:function(t){return a[t.getUTCDay()]},A:function(t){return i[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Ce,e:Ce,f:ke,g:Ee,G:ze,H:we,I:Ue,j:Me,L:De,m:Fe,M:Ye,p:function(t){return o[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ve,s:Ie,S:$e,u:Se,U:He,V:Le,w:je,W:_e,x:null,X:null,y:Ze,Y:We,Z:Oe,"%":Pe},b={a:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=g.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=T.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=p.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return U(t,e,n,r)},d:qt,e:qt,f:Gt,g:Pt,G:Ot,H:Xt,I:Xt,j:Qt,L:Rt,m:Jt,M:Bt,p:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.p=l.get(r[0].toLowerCase()),n+r[0].length):-1},q:It,Q:te,s:ee,S:Nt,u:Zt,U:Et,V:Wt,w:_t,W:zt,x:function(t,e,r){return U(t,n,e,r)},X:function(t,e,n){return U(t,r,e,n)},y:Pt,Y:Ot,Z:Vt,"%":Kt};function C(t,e){return function(n){var r,o,i,a=[],u=-1,s=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(o=Ft[r=t.charAt(++u)])?r=t.charAt(++u):o="e"===r?" ":"0",(i=e[r])&&(r=i(n,o)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function w(t,e){return function(n){var r,o,i=Ut(1900,void 0,1);if(U(i,t,n+="",0)!=n.length)return null;if("Q"in i)return new Date(i.Q);if("s"in i)return new Date(1e3*i.s+("L"in i?i.L:0));if(e&&!("Z"in i)&&(i.Z=0),"p"in i&&(i.H=i.H%12+12*i.p),void 0===i.m&&(i.m="q"in i?i.q:0),"V"in i){if(i.V<1||i.V>53)return null;"w"in i||(i.w=1),"Z"in i?(o=(r=wt(Ut(i.y,0,1))).getUTCDay(),r=o>4||0===o?lt.ceil(r):lt(r),r=G.offset(r,7*(i.V-1)),i.y=r.getUTCFullYear(),i.m=r.getUTCMonth(),i.d=r.getUTCDate()+(i.w+6)%7):(o=(r=Ct(Ut(i.y,0,1))).getDay(),r=o>4||0===o?nt.ceil(r):nt(r),r=R.offset(r,7*(i.V-1)),i.y=r.getFullYear(),i.m=r.getMonth(),i.d=r.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),o="Z"in i?wt(Ut(i.y,0,1)).getUTCDay():Ct(Ut(i.y,0,1)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(o+5)%7:i.w+7*i.U-(o+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,wt(i)):Ct(i)}}function U(t,e,n,r){for(var o,i,a=0,u=e.length,s=n.length;a<u;){if(r>=s)return-1;if(37===(o=e.charCodeAt(a++))){if(o=e.charAt(a++),!(i=b[o in Ft?e.charAt(a++):o])||(r=i(t,n,r))<0)return-1}else if(o!=n.charCodeAt(r++))return-1}return r}return x.x=C(n,x),x.X=C(r,x),x.c=C(e,x),v.x=C(n,v),v.X=C(r,v),v.c=C(e,v),{format:function(t){var e=C(t+="",x);return e.toString=function(){return t},e},parse:function(t){var e=w(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=C(t+="",v);return e.toString=function(){return t},e},utcParse:function(t){var e=w(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Dt=Mt.format,kt=Mt.parse,Mt.utcFormat,Mt.utcParse;class nn extends t{constructor(t){super();const a=document.createElement("style");a.textContent='.legend{margin-top:1rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 1.5rem;height:100%;color:#000000;gap:1rem}.legend__item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-size:0.875rem;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.legend__title{white-space:nowrap;margin:0}.legend__box{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:0.25rem;height:16px;width:24px}text{font-family:"LeroyMerlin", sans-serif;font-size:14px;color:#555550}.tooltip{background-color:#4d4d4d;border-radius:4px;color:#ffffff;text-align:center;padding:0.5rem 1rem;top:0;position:absolute}',this.shadowRoot.appendChild(a),e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},en,tn,i,{data:5,backgroundcolor:0,height:6,ticknumbers:7},null),t&&(t.target&&r(t.target,this,t.anchor),t.props&&(this.$set(t.props),o()))}static get observedAttributes(){return["data","backgroundcolor","height","ticknumbers"]}get data(){return this.$$.ctx[5]}set data(t){this.$$set({data:t}),o()}get backgroundcolor(){return this.$$.ctx[0]}set backgroundcolor(t){this.$$set({backgroundcolor:t}),o()}get height(){return this.$$.ctx[6]}set height(t){this.$$set({height:t}),o()}get ticknumbers(){return this.$$.ctx[7]}set ticknumbers(t){this.$$set({ticknumbers:t}),o()}}export{nn as default};
1
+ import { S as SvelteElement, i as init, a as attribute_to_object, b as insert, f as flush, s as safe_not_equal, e as element, d as space, T as svg_element, n as noop, g as attr, y as set_style, o as detach, J as destroy_each, a1 as onMount, t as text, j as append, k as set_data, v as binding_callbacks } from '../../index-c33b3772.js';
2
+ import { s as select } from '../../transform-15d69d5d.js';
3
+ import { E as EventHandler } from '../../EventHandler-02058705.js';
4
+ import { b as bisector, t as tickStep, i as initRange, c as continuous, a as copy, l as linear } from '../../linear-f46d7e9e.js';
5
+ import { S as Symbol, s as symbolSquare, a as symbolTriangle, b as symbolCircle, l as line } from '../../symbol-b05a6e2b.js';
6
+ import { a as axisBottom, b as axisLeft } from '../../axis-fbc0f7b5.js';
7
+ import '../../array-5b770a93.js';
8
+ import '../../path-1b5da959.js';
9
+
10
+ function extent(values, valueof) {
11
+ let min;
12
+ let max;
13
+ if (valueof === undefined) {
14
+ for (const value of values) {
15
+ if (value != null) {
16
+ if (min === undefined) {
17
+ if (value >= value) min = max = value;
18
+ } else {
19
+ if (min > value) min = value;
20
+ if (max < value) max = value;
21
+ }
22
+ }
23
+ }
24
+ } else {
25
+ let index = -1;
26
+ for (let value of values) {
27
+ if ((value = valueof(value, ++index, values)) != null) {
28
+ if (min === undefined) {
29
+ if (value >= value) min = max = value;
30
+ } else {
31
+ if (min > value) min = value;
32
+ if (max < value) max = value;
33
+ }
34
+ }
35
+ }
36
+ }
37
+ return [min, max];
38
+ }
39
+
40
+ function nice(domain, interval) {
41
+ domain = domain.slice();
42
+
43
+ var i0 = 0,
44
+ i1 = domain.length - 1,
45
+ x0 = domain[i0],
46
+ x1 = domain[i1],
47
+ t;
48
+
49
+ if (x1 < x0) {
50
+ t = i0, i0 = i1, i1 = t;
51
+ t = x0, x0 = x1, x1 = t;
52
+ }
53
+
54
+ domain[i0] = interval.floor(x0);
55
+ domain[i1] = interval.ceil(x1);
56
+ return domain;
57
+ }
58
+
59
+ const t0 = new Date, t1 = new Date;
60
+
61
+ function timeInterval(floori, offseti, count, field) {
62
+
63
+ function interval(date) {
64
+ return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;
65
+ }
66
+
67
+ interval.floor = (date) => {
68
+ return floori(date = new Date(+date)), date;
69
+ };
70
+
71
+ interval.ceil = (date) => {
72
+ return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
73
+ };
74
+
75
+ interval.round = (date) => {
76
+ const d0 = interval(date), d1 = interval.ceil(date);
77
+ return date - d0 < d1 - date ? d0 : d1;
78
+ };
79
+
80
+ interval.offset = (date, step) => {
81
+ return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
82
+ };
83
+
84
+ interval.range = (start, stop, step) => {
85
+ const range = [];
86
+ start = interval.ceil(start);
87
+ step = step == null ? 1 : Math.floor(step);
88
+ if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
89
+ let previous;
90
+ do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
91
+ while (previous < start && start < stop);
92
+ return range;
93
+ };
94
+
95
+ interval.filter = (test) => {
96
+ return timeInterval((date) => {
97
+ if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
98
+ }, (date, step) => {
99
+ if (date >= date) {
100
+ if (step < 0) while (++step <= 0) {
101
+ while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
102
+ } else while (--step >= 0) {
103
+ while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
104
+ }
105
+ }
106
+ });
107
+ };
108
+
109
+ if (count) {
110
+ interval.count = (start, end) => {
111
+ t0.setTime(+start), t1.setTime(+end);
112
+ floori(t0), floori(t1);
113
+ return Math.floor(count(t0, t1));
114
+ };
115
+
116
+ interval.every = (step) => {
117
+ step = Math.floor(step);
118
+ return !isFinite(step) || !(step > 0) ? null
119
+ : !(step > 1) ? interval
120
+ : interval.filter(field
121
+ ? (d) => field(d) % step === 0
122
+ : (d) => interval.count(0, d) % step === 0);
123
+ };
124
+ }
125
+
126
+ return interval;
127
+ }
128
+
129
+ const millisecond = timeInterval(() => {
130
+ // noop
131
+ }, (date, step) => {
132
+ date.setTime(+date + step);
133
+ }, (start, end) => {
134
+ return end - start;
135
+ });
136
+
137
+ // An optimized implementation for this simple case.
138
+ millisecond.every = (k) => {
139
+ k = Math.floor(k);
140
+ if (!isFinite(k) || !(k > 0)) return null;
141
+ if (!(k > 1)) return millisecond;
142
+ return timeInterval((date) => {
143
+ date.setTime(Math.floor(date / k) * k);
144
+ }, (date, step) => {
145
+ date.setTime(+date + step * k);
146
+ }, (start, end) => {
147
+ return (end - start) / k;
148
+ });
149
+ };
150
+
151
+ millisecond.range;
152
+
153
+ const durationSecond = 1000;
154
+ const durationMinute = durationSecond * 60;
155
+ const durationHour = durationMinute * 60;
156
+ const durationDay = durationHour * 24;
157
+ const durationWeek = durationDay * 7;
158
+ const durationMonth = durationDay * 30;
159
+ const durationYear = durationDay * 365;
160
+
161
+ const second = timeInterval((date) => {
162
+ date.setTime(date - date.getMilliseconds());
163
+ }, (date, step) => {
164
+ date.setTime(+date + step * durationSecond);
165
+ }, (start, end) => {
166
+ return (end - start) / durationSecond;
167
+ }, (date) => {
168
+ return date.getUTCSeconds();
169
+ });
170
+
171
+ second.range;
172
+
173
+ const timeMinute = timeInterval((date) => {
174
+ date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
175
+ }, (date, step) => {
176
+ date.setTime(+date + step * durationMinute);
177
+ }, (start, end) => {
178
+ return (end - start) / durationMinute;
179
+ }, (date) => {
180
+ return date.getMinutes();
181
+ });
182
+
183
+ timeMinute.range;
184
+
185
+ const utcMinute = timeInterval((date) => {
186
+ date.setUTCSeconds(0, 0);
187
+ }, (date, step) => {
188
+ date.setTime(+date + step * durationMinute);
189
+ }, (start, end) => {
190
+ return (end - start) / durationMinute;
191
+ }, (date) => {
192
+ return date.getUTCMinutes();
193
+ });
194
+
195
+ utcMinute.range;
196
+
197
+ const timeHour = timeInterval((date) => {
198
+ date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
199
+ }, (date, step) => {
200
+ date.setTime(+date + step * durationHour);
201
+ }, (start, end) => {
202
+ return (end - start) / durationHour;
203
+ }, (date) => {
204
+ return date.getHours();
205
+ });
206
+
207
+ timeHour.range;
208
+
209
+ const utcHour = timeInterval((date) => {
210
+ date.setUTCMinutes(0, 0, 0);
211
+ }, (date, step) => {
212
+ date.setTime(+date + step * durationHour);
213
+ }, (start, end) => {
214
+ return (end - start) / durationHour;
215
+ }, (date) => {
216
+ return date.getUTCHours();
217
+ });
218
+
219
+ utcHour.range;
220
+
221
+ const timeDay = timeInterval(
222
+ date => date.setHours(0, 0, 0, 0),
223
+ (date, step) => date.setDate(date.getDate() + step),
224
+ (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
225
+ date => date.getDate() - 1
226
+ );
227
+
228
+ timeDay.range;
229
+
230
+ const utcDay = timeInterval((date) => {
231
+ date.setUTCHours(0, 0, 0, 0);
232
+ }, (date, step) => {
233
+ date.setUTCDate(date.getUTCDate() + step);
234
+ }, (start, end) => {
235
+ return (end - start) / durationDay;
236
+ }, (date) => {
237
+ return date.getUTCDate() - 1;
238
+ });
239
+
240
+ utcDay.range;
241
+
242
+ const unixDay = timeInterval((date) => {
243
+ date.setUTCHours(0, 0, 0, 0);
244
+ }, (date, step) => {
245
+ date.setUTCDate(date.getUTCDate() + step);
246
+ }, (start, end) => {
247
+ return (end - start) / durationDay;
248
+ }, (date) => {
249
+ return Math.floor(date / durationDay);
250
+ });
251
+
252
+ unixDay.range;
253
+
254
+ function timeWeekday(i) {
255
+ return timeInterval((date) => {
256
+ date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
257
+ date.setHours(0, 0, 0, 0);
258
+ }, (date, step) => {
259
+ date.setDate(date.getDate() + step * 7);
260
+ }, (start, end) => {
261
+ return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
262
+ });
263
+ }
264
+
265
+ const timeSunday = timeWeekday(0);
266
+ const timeMonday = timeWeekday(1);
267
+ const timeTuesday = timeWeekday(2);
268
+ const timeWednesday = timeWeekday(3);
269
+ const timeThursday = timeWeekday(4);
270
+ const timeFriday = timeWeekday(5);
271
+ const timeSaturday = timeWeekday(6);
272
+
273
+ timeSunday.range;
274
+ timeMonday.range;
275
+ timeTuesday.range;
276
+ timeWednesday.range;
277
+ timeThursday.range;
278
+ timeFriday.range;
279
+ timeSaturday.range;
280
+
281
+ function utcWeekday(i) {
282
+ return timeInterval((date) => {
283
+ date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
284
+ date.setUTCHours(0, 0, 0, 0);
285
+ }, (date, step) => {
286
+ date.setUTCDate(date.getUTCDate() + step * 7);
287
+ }, (start, end) => {
288
+ return (end - start) / durationWeek;
289
+ });
290
+ }
291
+
292
+ const utcSunday = utcWeekday(0);
293
+ const utcMonday = utcWeekday(1);
294
+ const utcTuesday = utcWeekday(2);
295
+ const utcWednesday = utcWeekday(3);
296
+ const utcThursday = utcWeekday(4);
297
+ const utcFriday = utcWeekday(5);
298
+ const utcSaturday = utcWeekday(6);
299
+
300
+ utcSunday.range;
301
+ utcMonday.range;
302
+ utcTuesday.range;
303
+ utcWednesday.range;
304
+ utcThursday.range;
305
+ utcFriday.range;
306
+ utcSaturday.range;
307
+
308
+ const timeMonth = timeInterval((date) => {
309
+ date.setDate(1);
310
+ date.setHours(0, 0, 0, 0);
311
+ }, (date, step) => {
312
+ date.setMonth(date.getMonth() + step);
313
+ }, (start, end) => {
314
+ return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
315
+ }, (date) => {
316
+ return date.getMonth();
317
+ });
318
+
319
+ timeMonth.range;
320
+
321
+ const utcMonth = timeInterval((date) => {
322
+ date.setUTCDate(1);
323
+ date.setUTCHours(0, 0, 0, 0);
324
+ }, (date, step) => {
325
+ date.setUTCMonth(date.getUTCMonth() + step);
326
+ }, (start, end) => {
327
+ return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
328
+ }, (date) => {
329
+ return date.getUTCMonth();
330
+ });
331
+
332
+ utcMonth.range;
333
+
334
+ const timeYear = timeInterval((date) => {
335
+ date.setMonth(0, 1);
336
+ date.setHours(0, 0, 0, 0);
337
+ }, (date, step) => {
338
+ date.setFullYear(date.getFullYear() + step);
339
+ }, (start, end) => {
340
+ return end.getFullYear() - start.getFullYear();
341
+ }, (date) => {
342
+ return date.getFullYear();
343
+ });
344
+
345
+ // An optimized implementation for this simple case.
346
+ timeYear.every = (k) => {
347
+ return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
348
+ date.setFullYear(Math.floor(date.getFullYear() / k) * k);
349
+ date.setMonth(0, 1);
350
+ date.setHours(0, 0, 0, 0);
351
+ }, (date, step) => {
352
+ date.setFullYear(date.getFullYear() + step * k);
353
+ });
354
+ };
355
+
356
+ timeYear.range;
357
+
358
+ const utcYear = timeInterval((date) => {
359
+ date.setUTCMonth(0, 1);
360
+ date.setUTCHours(0, 0, 0, 0);
361
+ }, (date, step) => {
362
+ date.setUTCFullYear(date.getUTCFullYear() + step);
363
+ }, (start, end) => {
364
+ return end.getUTCFullYear() - start.getUTCFullYear();
365
+ }, (date) => {
366
+ return date.getUTCFullYear();
367
+ });
368
+
369
+ // An optimized implementation for this simple case.
370
+ utcYear.every = (k) => {
371
+ return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
372
+ date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
373
+ date.setUTCMonth(0, 1);
374
+ date.setUTCHours(0, 0, 0, 0);
375
+ }, (date, step) => {
376
+ date.setUTCFullYear(date.getUTCFullYear() + step * k);
377
+ });
378
+ };
379
+
380
+ utcYear.range;
381
+
382
+ function ticker(year, month, week, day, hour, minute) {
383
+
384
+ const tickIntervals = [
385
+ [second, 1, durationSecond],
386
+ [second, 5, 5 * durationSecond],
387
+ [second, 15, 15 * durationSecond],
388
+ [second, 30, 30 * durationSecond],
389
+ [minute, 1, durationMinute],
390
+ [minute, 5, 5 * durationMinute],
391
+ [minute, 15, 15 * durationMinute],
392
+ [minute, 30, 30 * durationMinute],
393
+ [ hour, 1, durationHour ],
394
+ [ hour, 3, 3 * durationHour ],
395
+ [ hour, 6, 6 * durationHour ],
396
+ [ hour, 12, 12 * durationHour ],
397
+ [ day, 1, durationDay ],
398
+ [ day, 2, 2 * durationDay ],
399
+ [ week, 1, durationWeek ],
400
+ [ month, 1, durationMonth ],
401
+ [ month, 3, 3 * durationMonth ],
402
+ [ year, 1, durationYear ]
403
+ ];
404
+
405
+ function ticks(start, stop, count) {
406
+ const reverse = stop < start;
407
+ if (reverse) [start, stop] = [stop, start];
408
+ const interval = count && typeof count.range === "function" ? count : tickInterval(start, stop, count);
409
+ const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop
410
+ return reverse ? ticks.reverse() : ticks;
411
+ }
412
+
413
+ function tickInterval(start, stop, count) {
414
+ const target = Math.abs(stop - start) / count;
415
+ const i = bisector(([,, step]) => step).right(tickIntervals, target);
416
+ if (i === tickIntervals.length) return year.every(tickStep(start / durationYear, stop / durationYear, count));
417
+ if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));
418
+ const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
419
+ return t.every(step);
420
+ }
421
+
422
+ return [ticks, tickInterval];
423
+ }
424
+ const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);
425
+
426
+ function localDate(d) {
427
+ if (0 <= d.y && d.y < 100) {
428
+ var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
429
+ date.setFullYear(d.y);
430
+ return date;
431
+ }
432
+ return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
433
+ }
434
+
435
+ function utcDate(d) {
436
+ if (0 <= d.y && d.y < 100) {
437
+ var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
438
+ date.setUTCFullYear(d.y);
439
+ return date;
440
+ }
441
+ return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
442
+ }
443
+
444
+ function newDate(y, m, d) {
445
+ return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0};
446
+ }
447
+
448
+ function formatLocale(locale) {
449
+ var locale_dateTime = locale.dateTime,
450
+ locale_date = locale.date,
451
+ locale_time = locale.time,
452
+ locale_periods = locale.periods,
453
+ locale_weekdays = locale.days,
454
+ locale_shortWeekdays = locale.shortDays,
455
+ locale_months = locale.months,
456
+ locale_shortMonths = locale.shortMonths;
457
+
458
+ var periodRe = formatRe(locale_periods),
459
+ periodLookup = formatLookup(locale_periods),
460
+ weekdayRe = formatRe(locale_weekdays),
461
+ weekdayLookup = formatLookup(locale_weekdays),
462
+ shortWeekdayRe = formatRe(locale_shortWeekdays),
463
+ shortWeekdayLookup = formatLookup(locale_shortWeekdays),
464
+ monthRe = formatRe(locale_months),
465
+ monthLookup = formatLookup(locale_months),
466
+ shortMonthRe = formatRe(locale_shortMonths),
467
+ shortMonthLookup = formatLookup(locale_shortMonths);
468
+
469
+ var formats = {
470
+ "a": formatShortWeekday,
471
+ "A": formatWeekday,
472
+ "b": formatShortMonth,
473
+ "B": formatMonth,
474
+ "c": null,
475
+ "d": formatDayOfMonth,
476
+ "e": formatDayOfMonth,
477
+ "f": formatMicroseconds,
478
+ "g": formatYearISO,
479
+ "G": formatFullYearISO,
480
+ "H": formatHour24,
481
+ "I": formatHour12,
482
+ "j": formatDayOfYear,
483
+ "L": formatMilliseconds,
484
+ "m": formatMonthNumber,
485
+ "M": formatMinutes,
486
+ "p": formatPeriod,
487
+ "q": formatQuarter,
488
+ "Q": formatUnixTimestamp,
489
+ "s": formatUnixTimestampSeconds,
490
+ "S": formatSeconds,
491
+ "u": formatWeekdayNumberMonday,
492
+ "U": formatWeekNumberSunday,
493
+ "V": formatWeekNumberISO,
494
+ "w": formatWeekdayNumberSunday,
495
+ "W": formatWeekNumberMonday,
496
+ "x": null,
497
+ "X": null,
498
+ "y": formatYear,
499
+ "Y": formatFullYear,
500
+ "Z": formatZone,
501
+ "%": formatLiteralPercent
502
+ };
503
+
504
+ var utcFormats = {
505
+ "a": formatUTCShortWeekday,
506
+ "A": formatUTCWeekday,
507
+ "b": formatUTCShortMonth,
508
+ "B": formatUTCMonth,
509
+ "c": null,
510
+ "d": formatUTCDayOfMonth,
511
+ "e": formatUTCDayOfMonth,
512
+ "f": formatUTCMicroseconds,
513
+ "g": formatUTCYearISO,
514
+ "G": formatUTCFullYearISO,
515
+ "H": formatUTCHour24,
516
+ "I": formatUTCHour12,
517
+ "j": formatUTCDayOfYear,
518
+ "L": formatUTCMilliseconds,
519
+ "m": formatUTCMonthNumber,
520
+ "M": formatUTCMinutes,
521
+ "p": formatUTCPeriod,
522
+ "q": formatUTCQuarter,
523
+ "Q": formatUnixTimestamp,
524
+ "s": formatUnixTimestampSeconds,
525
+ "S": formatUTCSeconds,
526
+ "u": formatUTCWeekdayNumberMonday,
527
+ "U": formatUTCWeekNumberSunday,
528
+ "V": formatUTCWeekNumberISO,
529
+ "w": formatUTCWeekdayNumberSunday,
530
+ "W": formatUTCWeekNumberMonday,
531
+ "x": null,
532
+ "X": null,
533
+ "y": formatUTCYear,
534
+ "Y": formatUTCFullYear,
535
+ "Z": formatUTCZone,
536
+ "%": formatLiteralPercent
537
+ };
538
+
539
+ var parses = {
540
+ "a": parseShortWeekday,
541
+ "A": parseWeekday,
542
+ "b": parseShortMonth,
543
+ "B": parseMonth,
544
+ "c": parseLocaleDateTime,
545
+ "d": parseDayOfMonth,
546
+ "e": parseDayOfMonth,
547
+ "f": parseMicroseconds,
548
+ "g": parseYear,
549
+ "G": parseFullYear,
550
+ "H": parseHour24,
551
+ "I": parseHour24,
552
+ "j": parseDayOfYear,
553
+ "L": parseMilliseconds,
554
+ "m": parseMonthNumber,
555
+ "M": parseMinutes,
556
+ "p": parsePeriod,
557
+ "q": parseQuarter,
558
+ "Q": parseUnixTimestamp,
559
+ "s": parseUnixTimestampSeconds,
560
+ "S": parseSeconds,
561
+ "u": parseWeekdayNumberMonday,
562
+ "U": parseWeekNumberSunday,
563
+ "V": parseWeekNumberISO,
564
+ "w": parseWeekdayNumberSunday,
565
+ "W": parseWeekNumberMonday,
566
+ "x": parseLocaleDate,
567
+ "X": parseLocaleTime,
568
+ "y": parseYear,
569
+ "Y": parseFullYear,
570
+ "Z": parseZone,
571
+ "%": parseLiteralPercent
572
+ };
573
+
574
+ // These recursive directive definitions must be deferred.
575
+ formats.x = newFormat(locale_date, formats);
576
+ formats.X = newFormat(locale_time, formats);
577
+ formats.c = newFormat(locale_dateTime, formats);
578
+ utcFormats.x = newFormat(locale_date, utcFormats);
579
+ utcFormats.X = newFormat(locale_time, utcFormats);
580
+ utcFormats.c = newFormat(locale_dateTime, utcFormats);
581
+
582
+ function newFormat(specifier, formats) {
583
+ return function(date) {
584
+ var string = [],
585
+ i = -1,
586
+ j = 0,
587
+ n = specifier.length,
588
+ c,
589
+ pad,
590
+ format;
591
+
592
+ if (!(date instanceof Date)) date = new Date(+date);
593
+
594
+ while (++i < n) {
595
+ if (specifier.charCodeAt(i) === 37) {
596
+ string.push(specifier.slice(j, i));
597
+ if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
598
+ else pad = c === "e" ? " " : "0";
599
+ if (format = formats[c]) c = format(date, pad);
600
+ string.push(c);
601
+ j = i + 1;
602
+ }
603
+ }
604
+
605
+ string.push(specifier.slice(j, i));
606
+ return string.join("");
607
+ };
608
+ }
609
+
610
+ function newParse(specifier, Z) {
611
+ return function(string) {
612
+ var d = newDate(1900, undefined, 1),
613
+ i = parseSpecifier(d, specifier, string += "", 0),
614
+ week, day;
615
+ if (i != string.length) return null;
616
+
617
+ // If a UNIX timestamp is specified, return it.
618
+ if ("Q" in d) return new Date(d.Q);
619
+ if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0));
620
+
621
+ // If this is utcParse, never use the local timezone.
622
+ if (Z && !("Z" in d)) d.Z = 0;
623
+
624
+ // The am-pm flag is 0 for AM, and 1 for PM.
625
+ if ("p" in d) d.H = d.H % 12 + d.p * 12;
626
+
627
+ // If the month was not specified, inherit from the quarter.
628
+ if (d.m === undefined) d.m = "q" in d ? d.q : 0;
629
+
630
+ // Convert day-of-week and week-of-year to day-of-year.
631
+ if ("V" in d) {
632
+ if (d.V < 1 || d.V > 53) return null;
633
+ if (!("w" in d)) d.w = 1;
634
+ if ("Z" in d) {
635
+ week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();
636
+ week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
637
+ week = utcDay.offset(week, (d.V - 1) * 7);
638
+ d.y = week.getUTCFullYear();
639
+ d.m = week.getUTCMonth();
640
+ d.d = week.getUTCDate() + (d.w + 6) % 7;
641
+ } else {
642
+ week = localDate(newDate(d.y, 0, 1)), day = week.getDay();
643
+ week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
644
+ week = timeDay.offset(week, (d.V - 1) * 7);
645
+ d.y = week.getFullYear();
646
+ d.m = week.getMonth();
647
+ d.d = week.getDate() + (d.w + 6) % 7;
648
+ }
649
+ } else if ("W" in d || "U" in d) {
650
+ if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
651
+ day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
652
+ d.m = 0;
653
+ d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
654
+ }
655
+
656
+ // If a time zone is specified, all fields are interpreted as UTC and then
657
+ // offset according to the specified time zone.
658
+ if ("Z" in d) {
659
+ d.H += d.Z / 100 | 0;
660
+ d.M += d.Z % 100;
661
+ return utcDate(d);
662
+ }
663
+
664
+ // Otherwise, all fields are in local time.
665
+ return localDate(d);
666
+ };
667
+ }
668
+
669
+ function parseSpecifier(d, specifier, string, j) {
670
+ var i = 0,
671
+ n = specifier.length,
672
+ m = string.length,
673
+ c,
674
+ parse;
675
+
676
+ while (i < n) {
677
+ if (j >= m) return -1;
678
+ c = specifier.charCodeAt(i++);
679
+ if (c === 37) {
680
+ c = specifier.charAt(i++);
681
+ parse = parses[c in pads ? specifier.charAt(i++) : c];
682
+ if (!parse || ((j = parse(d, string, j)) < 0)) return -1;
683
+ } else if (c != string.charCodeAt(j++)) {
684
+ return -1;
685
+ }
686
+ }
687
+
688
+ return j;
689
+ }
690
+
691
+ function parsePeriod(d, string, i) {
692
+ var n = periodRe.exec(string.slice(i));
693
+ return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
694
+ }
695
+
696
+ function parseShortWeekday(d, string, i) {
697
+ var n = shortWeekdayRe.exec(string.slice(i));
698
+ return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
699
+ }
700
+
701
+ function parseWeekday(d, string, i) {
702
+ var n = weekdayRe.exec(string.slice(i));
703
+ return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
704
+ }
705
+
706
+ function parseShortMonth(d, string, i) {
707
+ var n = shortMonthRe.exec(string.slice(i));
708
+ return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
709
+ }
710
+
711
+ function parseMonth(d, string, i) {
712
+ var n = monthRe.exec(string.slice(i));
713
+ return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
714
+ }
715
+
716
+ function parseLocaleDateTime(d, string, i) {
717
+ return parseSpecifier(d, locale_dateTime, string, i);
718
+ }
719
+
720
+ function parseLocaleDate(d, string, i) {
721
+ return parseSpecifier(d, locale_date, string, i);
722
+ }
723
+
724
+ function parseLocaleTime(d, string, i) {
725
+ return parseSpecifier(d, locale_time, string, i);
726
+ }
727
+
728
+ function formatShortWeekday(d) {
729
+ return locale_shortWeekdays[d.getDay()];
730
+ }
731
+
732
+ function formatWeekday(d) {
733
+ return locale_weekdays[d.getDay()];
734
+ }
735
+
736
+ function formatShortMonth(d) {
737
+ return locale_shortMonths[d.getMonth()];
738
+ }
739
+
740
+ function formatMonth(d) {
741
+ return locale_months[d.getMonth()];
742
+ }
743
+
744
+ function formatPeriod(d) {
745
+ return locale_periods[+(d.getHours() >= 12)];
746
+ }
747
+
748
+ function formatQuarter(d) {
749
+ return 1 + ~~(d.getMonth() / 3);
750
+ }
751
+
752
+ function formatUTCShortWeekday(d) {
753
+ return locale_shortWeekdays[d.getUTCDay()];
754
+ }
755
+
756
+ function formatUTCWeekday(d) {
757
+ return locale_weekdays[d.getUTCDay()];
758
+ }
759
+
760
+ function formatUTCShortMonth(d) {
761
+ return locale_shortMonths[d.getUTCMonth()];
762
+ }
763
+
764
+ function formatUTCMonth(d) {
765
+ return locale_months[d.getUTCMonth()];
766
+ }
767
+
768
+ function formatUTCPeriod(d) {
769
+ return locale_periods[+(d.getUTCHours() >= 12)];
770
+ }
771
+
772
+ function formatUTCQuarter(d) {
773
+ return 1 + ~~(d.getUTCMonth() / 3);
774
+ }
775
+
776
+ return {
777
+ format: function(specifier) {
778
+ var f = newFormat(specifier += "", formats);
779
+ f.toString = function() { return specifier; };
780
+ return f;
781
+ },
782
+ parse: function(specifier) {
783
+ var p = newParse(specifier += "", false);
784
+ p.toString = function() { return specifier; };
785
+ return p;
786
+ },
787
+ utcFormat: function(specifier) {
788
+ var f = newFormat(specifier += "", utcFormats);
789
+ f.toString = function() { return specifier; };
790
+ return f;
791
+ },
792
+ utcParse: function(specifier) {
793
+ var p = newParse(specifier += "", true);
794
+ p.toString = function() { return specifier; };
795
+ return p;
796
+ }
797
+ };
798
+ }
799
+
800
+ var pads = {"-": "", "_": " ", "0": "0"},
801
+ numberRe = /^\s*\d+/, // note: ignores next directive
802
+ percentRe = /^%/,
803
+ requoteRe = /[\\^$*+?|[\]().{}]/g;
804
+
805
+ function pad(value, fill, width) {
806
+ var sign = value < 0 ? "-" : "",
807
+ string = (sign ? -value : value) + "",
808
+ length = string.length;
809
+ return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
810
+ }
811
+
812
+ function requote(s) {
813
+ return s.replace(requoteRe, "\\$&");
814
+ }
815
+
816
+ function formatRe(names) {
817
+ return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
818
+ }
819
+
820
+ function formatLookup(names) {
821
+ return new Map(names.map((name, i) => [name.toLowerCase(), i]));
822
+ }
823
+
824
+ function parseWeekdayNumberSunday(d, string, i) {
825
+ var n = numberRe.exec(string.slice(i, i + 1));
826
+ return n ? (d.w = +n[0], i + n[0].length) : -1;
827
+ }
828
+
829
+ function parseWeekdayNumberMonday(d, string, i) {
830
+ var n = numberRe.exec(string.slice(i, i + 1));
831
+ return n ? (d.u = +n[0], i + n[0].length) : -1;
832
+ }
833
+
834
+ function parseWeekNumberSunday(d, string, i) {
835
+ var n = numberRe.exec(string.slice(i, i + 2));
836
+ return n ? (d.U = +n[0], i + n[0].length) : -1;
837
+ }
838
+
839
+ function parseWeekNumberISO(d, string, i) {
840
+ var n = numberRe.exec(string.slice(i, i + 2));
841
+ return n ? (d.V = +n[0], i + n[0].length) : -1;
842
+ }
843
+
844
+ function parseWeekNumberMonday(d, string, i) {
845
+ var n = numberRe.exec(string.slice(i, i + 2));
846
+ return n ? (d.W = +n[0], i + n[0].length) : -1;
847
+ }
848
+
849
+ function parseFullYear(d, string, i) {
850
+ var n = numberRe.exec(string.slice(i, i + 4));
851
+ return n ? (d.y = +n[0], i + n[0].length) : -1;
852
+ }
853
+
854
+ function parseYear(d, string, i) {
855
+ var n = numberRe.exec(string.slice(i, i + 2));
856
+ return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
857
+ }
858
+
859
+ function parseZone(d, string, i) {
860
+ var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
861
+ return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
862
+ }
863
+
864
+ function parseQuarter(d, string, i) {
865
+ var n = numberRe.exec(string.slice(i, i + 1));
866
+ return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1;
867
+ }
868
+
869
+ function parseMonthNumber(d, string, i) {
870
+ var n = numberRe.exec(string.slice(i, i + 2));
871
+ return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
872
+ }
873
+
874
+ function parseDayOfMonth(d, string, i) {
875
+ var n = numberRe.exec(string.slice(i, i + 2));
876
+ return n ? (d.d = +n[0], i + n[0].length) : -1;
877
+ }
878
+
879
+ function parseDayOfYear(d, string, i) {
880
+ var n = numberRe.exec(string.slice(i, i + 3));
881
+ return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
882
+ }
883
+
884
+ function parseHour24(d, string, i) {
885
+ var n = numberRe.exec(string.slice(i, i + 2));
886
+ return n ? (d.H = +n[0], i + n[0].length) : -1;
887
+ }
888
+
889
+ function parseMinutes(d, string, i) {
890
+ var n = numberRe.exec(string.slice(i, i + 2));
891
+ return n ? (d.M = +n[0], i + n[0].length) : -1;
892
+ }
893
+
894
+ function parseSeconds(d, string, i) {
895
+ var n = numberRe.exec(string.slice(i, i + 2));
896
+ return n ? (d.S = +n[0], i + n[0].length) : -1;
897
+ }
898
+
899
+ function parseMilliseconds(d, string, i) {
900
+ var n = numberRe.exec(string.slice(i, i + 3));
901
+ return n ? (d.L = +n[0], i + n[0].length) : -1;
902
+ }
903
+
904
+ function parseMicroseconds(d, string, i) {
905
+ var n = numberRe.exec(string.slice(i, i + 6));
906
+ return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
907
+ }
908
+
909
+ function parseLiteralPercent(d, string, i) {
910
+ var n = percentRe.exec(string.slice(i, i + 1));
911
+ return n ? i + n[0].length : -1;
912
+ }
913
+
914
+ function parseUnixTimestamp(d, string, i) {
915
+ var n = numberRe.exec(string.slice(i));
916
+ return n ? (d.Q = +n[0], i + n[0].length) : -1;
917
+ }
918
+
919
+ function parseUnixTimestampSeconds(d, string, i) {
920
+ var n = numberRe.exec(string.slice(i));
921
+ return n ? (d.s = +n[0], i + n[0].length) : -1;
922
+ }
923
+
924
+ function formatDayOfMonth(d, p) {
925
+ return pad(d.getDate(), p, 2);
926
+ }
927
+
928
+ function formatHour24(d, p) {
929
+ return pad(d.getHours(), p, 2);
930
+ }
931
+
932
+ function formatHour12(d, p) {
933
+ return pad(d.getHours() % 12 || 12, p, 2);
934
+ }
935
+
936
+ function formatDayOfYear(d, p) {
937
+ return pad(1 + timeDay.count(timeYear(d), d), p, 3);
938
+ }
939
+
940
+ function formatMilliseconds(d, p) {
941
+ return pad(d.getMilliseconds(), p, 3);
942
+ }
943
+
944
+ function formatMicroseconds(d, p) {
945
+ return formatMilliseconds(d, p) + "000";
946
+ }
947
+
948
+ function formatMonthNumber(d, p) {
949
+ return pad(d.getMonth() + 1, p, 2);
950
+ }
951
+
952
+ function formatMinutes(d, p) {
953
+ return pad(d.getMinutes(), p, 2);
954
+ }
955
+
956
+ function formatSeconds(d, p) {
957
+ return pad(d.getSeconds(), p, 2);
958
+ }
959
+
960
+ function formatWeekdayNumberMonday(d) {
961
+ var day = d.getDay();
962
+ return day === 0 ? 7 : day;
963
+ }
964
+
965
+ function formatWeekNumberSunday(d, p) {
966
+ return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);
967
+ }
968
+
969
+ function dISO(d) {
970
+ var day = d.getDay();
971
+ return (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);
972
+ }
973
+
974
+ function formatWeekNumberISO(d, p) {
975
+ d = dISO(d);
976
+ return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);
977
+ }
978
+
979
+ function formatWeekdayNumberSunday(d) {
980
+ return d.getDay();
981
+ }
982
+
983
+ function formatWeekNumberMonday(d, p) {
984
+ return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);
985
+ }
986
+
987
+ function formatYear(d, p) {
988
+ return pad(d.getFullYear() % 100, p, 2);
989
+ }
990
+
991
+ function formatYearISO(d, p) {
992
+ d = dISO(d);
993
+ return pad(d.getFullYear() % 100, p, 2);
994
+ }
995
+
996
+ function formatFullYear(d, p) {
997
+ return pad(d.getFullYear() % 10000, p, 4);
998
+ }
999
+
1000
+ function formatFullYearISO(d, p) {
1001
+ var day = d.getDay();
1002
+ d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);
1003
+ return pad(d.getFullYear() % 10000, p, 4);
1004
+ }
1005
+
1006
+ function formatZone(d) {
1007
+ var z = d.getTimezoneOffset();
1008
+ return (z > 0 ? "-" : (z *= -1, "+"))
1009
+ + pad(z / 60 | 0, "0", 2)
1010
+ + pad(z % 60, "0", 2);
1011
+ }
1012
+
1013
+ function formatUTCDayOfMonth(d, p) {
1014
+ return pad(d.getUTCDate(), p, 2);
1015
+ }
1016
+
1017
+ function formatUTCHour24(d, p) {
1018
+ return pad(d.getUTCHours(), p, 2);
1019
+ }
1020
+
1021
+ function formatUTCHour12(d, p) {
1022
+ return pad(d.getUTCHours() % 12 || 12, p, 2);
1023
+ }
1024
+
1025
+ function formatUTCDayOfYear(d, p) {
1026
+ return pad(1 + utcDay.count(utcYear(d), d), p, 3);
1027
+ }
1028
+
1029
+ function formatUTCMilliseconds(d, p) {
1030
+ return pad(d.getUTCMilliseconds(), p, 3);
1031
+ }
1032
+
1033
+ function formatUTCMicroseconds(d, p) {
1034
+ return formatUTCMilliseconds(d, p) + "000";
1035
+ }
1036
+
1037
+ function formatUTCMonthNumber(d, p) {
1038
+ return pad(d.getUTCMonth() + 1, p, 2);
1039
+ }
1040
+
1041
+ function formatUTCMinutes(d, p) {
1042
+ return pad(d.getUTCMinutes(), p, 2);
1043
+ }
1044
+
1045
+ function formatUTCSeconds(d, p) {
1046
+ return pad(d.getUTCSeconds(), p, 2);
1047
+ }
1048
+
1049
+ function formatUTCWeekdayNumberMonday(d) {
1050
+ var dow = d.getUTCDay();
1051
+ return dow === 0 ? 7 : dow;
1052
+ }
1053
+
1054
+ function formatUTCWeekNumberSunday(d, p) {
1055
+ return pad(utcSunday.count(utcYear(d) - 1, d), p, 2);
1056
+ }
1057
+
1058
+ function UTCdISO(d) {
1059
+ var day = d.getUTCDay();
1060
+ return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
1061
+ }
1062
+
1063
+ function formatUTCWeekNumberISO(d, p) {
1064
+ d = UTCdISO(d);
1065
+ return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
1066
+ }
1067
+
1068
+ function formatUTCWeekdayNumberSunday(d) {
1069
+ return d.getUTCDay();
1070
+ }
1071
+
1072
+ function formatUTCWeekNumberMonday(d, p) {
1073
+ return pad(utcMonday.count(utcYear(d) - 1, d), p, 2);
1074
+ }
1075
+
1076
+ function formatUTCYear(d, p) {
1077
+ return pad(d.getUTCFullYear() % 100, p, 2);
1078
+ }
1079
+
1080
+ function formatUTCYearISO(d, p) {
1081
+ d = UTCdISO(d);
1082
+ return pad(d.getUTCFullYear() % 100, p, 2);
1083
+ }
1084
+
1085
+ function formatUTCFullYear(d, p) {
1086
+ return pad(d.getUTCFullYear() % 10000, p, 4);
1087
+ }
1088
+
1089
+ function formatUTCFullYearISO(d, p) {
1090
+ var day = d.getUTCDay();
1091
+ d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
1092
+ return pad(d.getUTCFullYear() % 10000, p, 4);
1093
+ }
1094
+
1095
+ function formatUTCZone() {
1096
+ return "+0000";
1097
+ }
1098
+
1099
+ function formatLiteralPercent() {
1100
+ return "%";
1101
+ }
1102
+
1103
+ function formatUnixTimestamp(d) {
1104
+ return +d;
1105
+ }
1106
+
1107
+ function formatUnixTimestampSeconds(d) {
1108
+ return Math.floor(+d / 1000);
1109
+ }
1110
+
1111
+ var locale;
1112
+ var timeFormat;
1113
+ var timeParse;
1114
+
1115
+ defaultLocale({
1116
+ dateTime: "%x, %X",
1117
+ date: "%-m/%-d/%Y",
1118
+ time: "%-I:%M:%S %p",
1119
+ periods: ["AM", "PM"],
1120
+ days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
1121
+ shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1122
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
1123
+ shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
1124
+ });
1125
+
1126
+ function defaultLocale(definition) {
1127
+ locale = formatLocale(definition);
1128
+ timeFormat = locale.format;
1129
+ timeParse = locale.parse;
1130
+ locale.utcFormat;
1131
+ locale.utcParse;
1132
+ return locale;
1133
+ }
1134
+
1135
+ function date(t) {
1136
+ return new Date(t);
1137
+ }
1138
+
1139
+ function number(t) {
1140
+ return t instanceof Date ? +t : +new Date(+t);
1141
+ }
1142
+
1143
+ function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {
1144
+ var scale = continuous(),
1145
+ invert = scale.invert,
1146
+ domain = scale.domain;
1147
+
1148
+ var formatMillisecond = format(".%L"),
1149
+ formatSecond = format(":%S"),
1150
+ formatMinute = format("%I:%M"),
1151
+ formatHour = format("%I %p"),
1152
+ formatDay = format("%a %d"),
1153
+ formatWeek = format("%b %d"),
1154
+ formatMonth = format("%B"),
1155
+ formatYear = format("%Y");
1156
+
1157
+ function tickFormat(date) {
1158
+ return (second(date) < date ? formatMillisecond
1159
+ : minute(date) < date ? formatSecond
1160
+ : hour(date) < date ? formatMinute
1161
+ : day(date) < date ? formatHour
1162
+ : month(date) < date ? (week(date) < date ? formatDay : formatWeek)
1163
+ : year(date) < date ? formatMonth
1164
+ : formatYear)(date);
1165
+ }
1166
+
1167
+ scale.invert = function(y) {
1168
+ return new Date(invert(y));
1169
+ };
1170
+
1171
+ scale.domain = function(_) {
1172
+ return arguments.length ? domain(Array.from(_, number)) : domain().map(date);
1173
+ };
1174
+
1175
+ scale.ticks = function(interval) {
1176
+ var d = domain();
1177
+ return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);
1178
+ };
1179
+
1180
+ scale.tickFormat = function(count, specifier) {
1181
+ return specifier == null ? tickFormat : format(specifier);
1182
+ };
1183
+
1184
+ scale.nice = function(interval) {
1185
+ var d = domain();
1186
+ if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);
1187
+ return interval ? domain(nice(d, interval)) : scale;
1188
+ };
1189
+
1190
+ scale.copy = function() {
1191
+ return copy(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));
1192
+ };
1193
+
1194
+ return scale;
1195
+ }
1196
+
1197
+ function time() {
1198
+ return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
1199
+ }
1200
+
1201
+ /* src/components/chart/LineChart.svelte generated by Svelte v3.58.0 */
1202
+
1203
+ function get_each_context(ctx, list, i) {
1204
+ const child_ctx = ctx.slice();
1205
+ child_ctx[27] = list[i];
1206
+ return child_ctx;
1207
+ }
1208
+
1209
+ // (176:2) {#if tooltipData.show}
1210
+ function create_if_block(ctx) {
1211
+ let div;
1212
+
1213
+ function select_block_type(ctx, dirty) {
1214
+ if (/*tooltipData*/ ctx[3].customtooltip) return create_if_block_1;
1215
+ return create_else_block;
1216
+ }
1217
+
1218
+ let current_block_type = select_block_type(ctx);
1219
+ let if_block = current_block_type(ctx);
1220
+
1221
+ return {
1222
+ c() {
1223
+ div = element("div");
1224
+ if_block.c();
1225
+ attr(div, "class", "tooltip");
1226
+ attr(div, "style", `right: ${/*margin*/ ctx[4].right}px; top: ${/*margin*/ ctx[4].top}px;`);
1227
+ },
1228
+ m(target, anchor) {
1229
+ insert(target, div, anchor);
1230
+ if_block.m(div, null);
1231
+ },
1232
+ p(ctx, dirty) {
1233
+ if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
1234
+ if_block.p(ctx, dirty);
1235
+ } else {
1236
+ if_block.d(1);
1237
+ if_block = current_block_type(ctx);
1238
+
1239
+ if (if_block) {
1240
+ if_block.c();
1241
+ if_block.m(div, null);
1242
+ }
1243
+ }
1244
+ },
1245
+ d(detaching) {
1246
+ if (detaching) detach(div);
1247
+ if_block.d();
1248
+ }
1249
+ };
1250
+ }
1251
+
1252
+ // (183:6) {:else}
1253
+ function create_else_block(ctx) {
1254
+ let t0_value = /*tooltipData*/ ctx[3].date + "";
1255
+ let t0;
1256
+ let t1;
1257
+ let b;
1258
+ let t2_value = /*tooltipData*/ ctx[3].value + "";
1259
+ let t2;
1260
+
1261
+ return {
1262
+ c() {
1263
+ t0 = text(t0_value);
1264
+ t1 = text(": ");
1265
+ b = element("b");
1266
+ t2 = text(t2_value);
1267
+ },
1268
+ m(target, anchor) {
1269
+ insert(target, t0, anchor);
1270
+ insert(target, t1, anchor);
1271
+ insert(target, b, anchor);
1272
+ append(b, t2);
1273
+ },
1274
+ p(ctx, dirty) {
1275
+ if (dirty & /*tooltipData*/ 8 && t0_value !== (t0_value = /*tooltipData*/ ctx[3].date + "")) set_data(t0, t0_value);
1276
+ if (dirty & /*tooltipData*/ 8 && t2_value !== (t2_value = /*tooltipData*/ ctx[3].value + "")) set_data(t2, t2_value);
1277
+ },
1278
+ d(detaching) {
1279
+ if (detaching) detach(t0);
1280
+ if (detaching) detach(t1);
1281
+ if (detaching) detach(b);
1282
+ }
1283
+ };
1284
+ }
1285
+
1286
+ // (181:6) {#if tooltipData.customtooltip}
1287
+ function create_if_block_1(ctx) {
1288
+ let t_value = /*tooltipData*/ ctx[3].customtooltip + "";
1289
+ let t;
1290
+
1291
+ return {
1292
+ c() {
1293
+ t = text(t_value);
1294
+ },
1295
+ m(target, anchor) {
1296
+ insert(target, t, anchor);
1297
+ },
1298
+ p(ctx, dirty) {
1299
+ if (dirty & /*tooltipData*/ 8 && t_value !== (t_value = /*tooltipData*/ ctx[3].customtooltip + "")) set_data(t, t_value);
1300
+ },
1301
+ d(detaching) {
1302
+ if (detaching) detach(t);
1303
+ }
1304
+ };
1305
+ }
1306
+
1307
+ // (191:2) {#each parsedData as d}
1308
+ function create_each_block(ctx) {
1309
+ let div;
1310
+ let svg_1;
1311
+ let rect;
1312
+ let rect_fill_value;
1313
+ let t0;
1314
+ let span;
1315
+ let t1_value = /*d*/ ctx[27].title + "";
1316
+ let t1;
1317
+ let t2;
1318
+
1319
+ return {
1320
+ c() {
1321
+ div = element("div");
1322
+ svg_1 = svg_element("svg");
1323
+ rect = svg_element("rect");
1324
+ t0 = space();
1325
+ span = element("span");
1326
+ t1 = text(t1_value);
1327
+ t2 = space();
1328
+ attr(rect, "x", "0");
1329
+ attr(rect, "y", "0");
1330
+ attr(rect, "width", "24");
1331
+ attr(rect, "height", "16");
1332
+ attr(rect, "fill", rect_fill_value = /*d*/ ctx[27].color);
1333
+ attr(svg_1, "class", "legend__box");
1334
+ attr(span, "class", "legend__title");
1335
+ attr(div, "class", "legend__item");
1336
+ },
1337
+ m(target, anchor) {
1338
+ insert(target, div, anchor);
1339
+ append(div, svg_1);
1340
+ append(svg_1, rect);
1341
+ append(div, t0);
1342
+ append(div, span);
1343
+ append(span, t1);
1344
+ append(div, t2);
1345
+ },
1346
+ p(ctx, dirty) {
1347
+ if (dirty & /*parsedData*/ 2 && rect_fill_value !== (rect_fill_value = /*d*/ ctx[27].color)) {
1348
+ attr(rect, "fill", rect_fill_value);
1349
+ }
1350
+
1351
+ if (dirty & /*parsedData*/ 2 && t1_value !== (t1_value = /*d*/ ctx[27].title + "")) set_data(t1, t1_value);
1352
+ },
1353
+ d(detaching) {
1354
+ if (detaching) detach(div);
1355
+ }
1356
+ };
1357
+ }
1358
+
1359
+ function create_fragment(ctx) {
1360
+ let div0;
1361
+ let t0;
1362
+ let div1;
1363
+ let t1;
1364
+ let text_1;
1365
+ let if_block = /*tooltipData*/ ctx[3].show && create_if_block(ctx);
1366
+ let each_value = /*parsedData*/ ctx[1];
1367
+ let each_blocks = [];
1368
+
1369
+ for (let i = 0; i < each_value.length; i += 1) {
1370
+ each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
1371
+ }
1372
+
1373
+ return {
1374
+ c() {
1375
+ div0 = element("div");
1376
+ if (if_block) if_block.c();
1377
+ t0 = space();
1378
+ div1 = element("div");
1379
+
1380
+ for (let i = 0; i < each_blocks.length; i += 1) {
1381
+ each_blocks[i].c();
1382
+ }
1383
+
1384
+ t1 = space();
1385
+ text_1 = svg_element("text");
1386
+ this.c = noop;
1387
+ attr(div0, "class", "chart");
1388
+ set_style(div0, "background-color", /*backgroundcolor*/ ctx[0]);
1389
+ attr(div1, "class", "legend");
1390
+ set_style(text_1, "display", "none");
1391
+ },
1392
+ m(target, anchor) {
1393
+ insert(target, div0, anchor);
1394
+ if (if_block) if_block.m(div0, null);
1395
+ /*div0_binding*/ ctx[10](div0);
1396
+ insert(target, t0, anchor);
1397
+ insert(target, div1, anchor);
1398
+
1399
+ for (let i = 0; i < each_blocks.length; i += 1) {
1400
+ if (each_blocks[i]) {
1401
+ each_blocks[i].m(div1, null);
1402
+ }
1403
+ }
1404
+
1405
+ insert(target, t1, anchor);
1406
+ insert(target, text_1, anchor);
1407
+ },
1408
+ p(ctx, [dirty]) {
1409
+ if (/*tooltipData*/ ctx[3].show) {
1410
+ if (if_block) {
1411
+ if_block.p(ctx, dirty);
1412
+ } else {
1413
+ if_block = create_if_block(ctx);
1414
+ if_block.c();
1415
+ if_block.m(div0, null);
1416
+ }
1417
+ } else if (if_block) {
1418
+ if_block.d(1);
1419
+ if_block = null;
1420
+ }
1421
+
1422
+ if (dirty & /*backgroundcolor*/ 1) {
1423
+ set_style(div0, "background-color", /*backgroundcolor*/ ctx[0]);
1424
+ }
1425
+
1426
+ if (dirty & /*parsedData*/ 2) {
1427
+ each_value = /*parsedData*/ ctx[1];
1428
+ let i;
1429
+
1430
+ for (i = 0; i < each_value.length; i += 1) {
1431
+ const child_ctx = get_each_context(ctx, each_value, i);
1432
+
1433
+ if (each_blocks[i]) {
1434
+ each_blocks[i].p(child_ctx, dirty);
1435
+ } else {
1436
+ each_blocks[i] = create_each_block(child_ctx);
1437
+ each_blocks[i].c();
1438
+ each_blocks[i].m(div1, null);
1439
+ }
1440
+ }
1441
+
1442
+ for (; i < each_blocks.length; i += 1) {
1443
+ each_blocks[i].d(1);
1444
+ }
1445
+
1446
+ each_blocks.length = each_value.length;
1447
+ }
1448
+ },
1449
+ i: noop,
1450
+ o: noop,
1451
+ d(detaching) {
1452
+ if (detaching) detach(div0);
1453
+ if (if_block) if_block.d();
1454
+ /*div0_binding*/ ctx[10](null);
1455
+ if (detaching) detach(t0);
1456
+ if (detaching) detach(div1);
1457
+ destroy_each(each_blocks, detaching);
1458
+ if (detaching) detach(t1);
1459
+ if (detaching) detach(text_1);
1460
+ }
1461
+ };
1462
+ }
1463
+
1464
+ function instance($$self, $$props, $$invalidate) {
1465
+ let { data = '' } = $$props;
1466
+ let { backgroundcolor = '#fff' } = $$props;
1467
+ let { height = 300 } = $$props;
1468
+ let { ticknumbers = 5 } = $$props;
1469
+ const parseTime = timeParse('%d-%m-%Y');
1470
+ let _data;
1471
+ let hasMounted = false;
1472
+ let eventHandler = new EventHandler();
1473
+ let parsedData;
1474
+ let chart;
1475
+ let svg;
1476
+ let x, y, xAxis, yAxis, linesD3 = [];
1477
+
1478
+ const margin = {
1479
+ top: 20,
1480
+ right: 40,
1481
+ bottom: 40,
1482
+ left: 60,
1483
+ yAxisPadding: 20
1484
+ };
1485
+
1486
+ let tooltipData = {
1487
+ date: '',
1488
+ value: 0,
1489
+ show: false,
1490
+ customtooltip: ''
1491
+ };
1492
+
1493
+ function getChartWidth() {
1494
+ let chartWidth = select(chart).style('width');
1495
+
1496
+ if (chartWidth === '' || !chartWidth) {
1497
+ chartWidth = `${window.innerWidth / 2}`;
1498
+ }
1499
+
1500
+ return parseInt(chartWidth);
1501
+ }
1502
+
1503
+ function appendSymbols(data, color, symbolType, i) {
1504
+ let symbolPath = Symbol(symbolSquare);
1505
+
1506
+ switch (symbolType) {
1507
+ case 'circle':
1508
+ symbolPath = Symbol(symbolCircle);
1509
+ break;
1510
+ case 'triangle':
1511
+ symbolPath = Symbol(symbolTriangle);
1512
+ break;
1513
+ }
1514
+
1515
+ svg.selectAll().data(data).join('path').attr('d', symbolPath.size(50)).attr('opacity', 1).attr('transform', d => `translate(${x(+d.time) + margin.yAxisPadding},${y(+d.value)})`).attr('class', `chart__symbol-line-${i}`).style('fill', color).style('cursor', 'pointer').on('mouseover', handleTickMouseOver).on('mouseout', () => $$invalidate(3, tooltipData.show = false, tooltipData)).on('click', (_e, point) => {
1516
+ eventHandler.dispatch('point-clicked', point);
1517
+ });
1518
+ }
1519
+
1520
+ function handleTickMouseOver(_e, point) {
1521
+ const date = new Date(point.time).toDateString();
1522
+ const value = point.value;
1523
+
1524
+ $$invalidate(3, tooltipData = {
1525
+ date,
1526
+ value: parseInt(value),
1527
+ show: true,
1528
+ customtooltip: point.customtooltip
1529
+ });
1530
+ }
1531
+
1532
+ function updatePath(lineD3, points, color, strokeDasharray) {
1533
+ lineD3.datum(points).attr('d', line().x(d => x(+d.time)).y(d => y(+d.value))).attr('stroke', color).style('stroke-width', 2.5).style('fill', 'none').attr('transform', `translate(${margin.yAxisPadding},0)`).attr('stroke-dasharray', strokeDasharray || 0);
1534
+ }
1535
+
1536
+ function updateAxes(data) {
1537
+ const width = getChartWidth();
1538
+ const mergedLineData = data.flatMap(d => d.points);
1539
+ const [yMin = 0, yMax = 0] = extent(mergedLineData, d => Number(d.value));
1540
+ const xDomain = extent(mergedLineData, d => parseTime(d.time));
1541
+ x.domain(xDomain);
1542
+ svg.selectAll('.x-axis').attr('transform', `translate(${margin.yAxisPadding},${height + margin.bottom / 2})`).call(xAxis).attr('stroke-width', '0');
1543
+ y.domain([yMin, yMax]);
1544
+ svg.selectAll('.y-axis').call(yAxis).select('.domain').attr('stroke-width', '0');
1545
+ svg.selectAll('.y-axis .tick line').attr('x1', margin.yAxisPadding / 2).attr('x2', width - margin.left).attr('stroke', '#EEEDEA').attr('stroke-width', '1.4px');
1546
+ }
1547
+
1548
+ function render(resize) {
1549
+ const width = getChartWidth();
1550
+ x = time().range([0, width - margin.left - margin.right]);
1551
+ xAxis = axisBottom(x).tickSize(0).ticks(timeDay).ticks(ticknumbers).tickPadding(5);
1552
+ y = linear().range([height, 0]);
1553
+ yAxis = axisLeft(y).ticks(ticknumbers);
1554
+
1555
+ if (!resize) {
1556
+ svg = select(chart).append('svg').attr('width', width).attr('height', height + margin.top + margin.bottom).attr('id', 'svg-chart').append('g').attr('transform', `translate(${margin.left / 2 + margin.right / 2},${margin.top})`);
1557
+ svg.append('g').attr('transform', 'translate(0,' + String(height) + ')').attr('class', 'x-axis');
1558
+ svg.append('g').attr('class', 'y-axis');
1559
+ }
1560
+
1561
+ updateAxes(parsedData);
1562
+
1563
+ parsedData.forEach((data, i) => {
1564
+ if (!resize) {
1565
+ linesD3.push(svg.append('g').append('path'));
1566
+ }
1567
+
1568
+ updateLine(data, i);
1569
+ });
1570
+ }
1571
+
1572
+ function updateLine(data, i) {
1573
+ const points = data.points.map(d => ({
1574
+ time: parseTime(d.time) || '',
1575
+ value: d.value,
1576
+ customtooltip: d.customtooltip
1577
+ }));
1578
+
1579
+ updatePath(linesD3[i], points, data.color, data.strokeDasharray);
1580
+ svg.selectAll(`.chart__symbol-line-${i}`).remove();
1581
+ appendSymbols(points, data.color, data.symbol, i);
1582
+ }
1583
+
1584
+ function resize() {
1585
+ var _a;
1586
+
1587
+ if (_data && hasMounted) {
1588
+ const width = getChartWidth();
1589
+
1590
+ (_a = chart.querySelector('#svg-chart')) === null || _a === void 0
1591
+ ? void 0
1592
+ : _a.setAttribute('width', `${width}px`);
1593
+
1594
+ render(true);
1595
+ }
1596
+ }
1597
+
1598
+ onMount(() => {
1599
+ const resizeObserver = new ResizeObserver(resize);
1600
+ resizeObserver.observe(chart);
1601
+ $$invalidate(9, hasMounted = true);
1602
+ });
1603
+
1604
+ function div0_binding($$value) {
1605
+ binding_callbacks[$$value ? 'unshift' : 'push'](() => {
1606
+ chart = $$value;
1607
+ $$invalidate(2, chart);
1608
+ });
1609
+ }
1610
+
1611
+ $$self.$$set = $$props => {
1612
+ if ('data' in $$props) $$invalidate(5, data = $$props.data);
1613
+ if ('backgroundcolor' in $$props) $$invalidate(0, backgroundcolor = $$props.backgroundcolor);
1614
+ if ('height' in $$props) $$invalidate(6, height = $$props.height);
1615
+ if ('ticknumbers' in $$props) $$invalidate(7, ticknumbers = $$props.ticknumbers);
1616
+ };
1617
+
1618
+ $$self.$$.update = () => {
1619
+ if ($$self.$$.dirty & /*data*/ 32) {
1620
+ $$invalidate(1, parsedData = data ? JSON.parse(data) : []);
1621
+ }
1622
+
1623
+ if ($$self.$$.dirty & /*data, hasMounted, _data, parsedData*/ 802) {
1624
+ if (data.length > 0 && hasMounted) {
1625
+ if (!_data) {
1626
+ render();
1627
+ $$invalidate(8, _data = data);
1628
+ } else if (data !== _data) {
1629
+ updateAxes(parsedData);
1630
+ parsedData.forEach((data, i) => updateLine(data, i));
1631
+ $$invalidate(8, _data = data);
1632
+ }
1633
+ }
1634
+ }
1635
+ };
1636
+
1637
+ return [
1638
+ backgroundcolor,
1639
+ parsedData,
1640
+ chart,
1641
+ tooltipData,
1642
+ margin,
1643
+ data,
1644
+ height,
1645
+ ticknumbers,
1646
+ _data,
1647
+ hasMounted,
1648
+ div0_binding
1649
+ ];
1650
+ }
1651
+
1652
+ class LineChart extends SvelteElement {
1653
+ constructor(options) {
1654
+ super();
1655
+ const style = document.createElement('style');
1656
+ style.textContent = `.legend{margin-top:1rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 1.5rem;height:100%;color:#000000;gap:1rem}.legend__item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-size:0.875rem;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.legend__title{white-space:nowrap;margin:0}.legend__box{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:0.25rem;height:16px;width:24px}text{font-family:"LeroyMerlin", sans-serif;font-size:14px;color:#555550}.tooltip{background-color:#4d4d4d;border-radius:4px;color:#ffffff;text-align:center;padding:0.5rem 1rem;top:0;position:absolute}`;
1657
+ this.shadowRoot.appendChild(style);
1658
+
1659
+ init(
1660
+ this,
1661
+ {
1662
+ target: this.shadowRoot,
1663
+ props: attribute_to_object(this.attributes),
1664
+ customElement: true
1665
+ },
1666
+ instance,
1667
+ create_fragment,
1668
+ safe_not_equal,
1669
+ {
1670
+ data: 5,
1671
+ backgroundcolor: 0,
1672
+ height: 6,
1673
+ ticknumbers: 7
1674
+ },
1675
+ null
1676
+ );
1677
+
1678
+ if (options) {
1679
+ if (options.target) {
1680
+ insert(options.target, this, options.anchor);
1681
+ }
1682
+
1683
+ if (options.props) {
1684
+ this.$set(options.props);
1685
+ flush();
1686
+ }
1687
+ }
1688
+ }
1689
+
1690
+ static get observedAttributes() {
1691
+ return ["data", "backgroundcolor", "height", "ticknumbers"];
1692
+ }
1693
+
1694
+ get data() {
1695
+ return this.$$.ctx[5];
1696
+ }
1697
+
1698
+ set data(data) {
1699
+ this.$$set({ data });
1700
+ flush();
1701
+ }
1702
+
1703
+ get backgroundcolor() {
1704
+ return this.$$.ctx[0];
1705
+ }
1706
+
1707
+ set backgroundcolor(backgroundcolor) {
1708
+ this.$$set({ backgroundcolor });
1709
+ flush();
1710
+ }
1711
+
1712
+ get height() {
1713
+ return this.$$.ctx[6];
1714
+ }
1715
+
1716
+ set height(height) {
1717
+ this.$$set({ height });
1718
+ flush();
1719
+ }
1720
+
1721
+ get ticknumbers() {
1722
+ return this.$$.ctx[7];
1723
+ }
1724
+
1725
+ set ticknumbers(ticknumbers) {
1726
+ this.$$set({ ticknumbers });
1727
+ flush();
1728
+ }
1729
+ }
1730
+
1731
+ export { LineChart as default };
2
1732
  //# sourceMappingURL=LineChart.js.map