vviinn-widgets 2.7.2 → 2.8.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 (357) hide show
  1. package/dist/components/Handler.js +270 -0
  2. package/dist/components/NonEmptyArray.js +5699 -0
  3. package/dist/components/cropper-handler.js +6 -0
  4. package/dist/components/cropper-handler2.js +39 -0
  5. package/dist/{cjs/customized-slots-06ca4007.js → components/customized-slots.js} +3 -6
  6. package/dist/components/highlight-box.js +6 -0
  7. package/dist/components/highlight-box2.js +52 -0
  8. package/dist/components/image-cropper.js +6 -0
  9. package/dist/components/image-cropper2.js +138 -0
  10. package/dist/components/imageSearch.store.js +10686 -0
  11. package/dist/components/index.js +1 -0
  12. package/dist/{esm/index-443468c7.js → components/index2.js} +2 -2
  13. package/dist/components/index3.js +130 -0
  14. package/dist/components/recommendations-sidebar.js +101 -0
  15. package/dist/components/resizer.worker.js +11 -0
  16. package/dist/components/search-filters.js +6 -0
  17. package/dist/components/search-filters2.js +89 -0
  18. package/dist/components/tracking.worker.js +11 -0
  19. package/dist/components/vviinn-carousel.js +6 -0
  20. package/dist/components/vviinn-carousel2.js +235 -0
  21. package/dist/components/vviinn-detected-object.js +6 -0
  22. package/dist/components/vviinn-detected-object2.js +67 -0
  23. package/dist/components/vviinn-empty-results.js +6 -0
  24. package/dist/components/vviinn-empty-results2.js +35 -0
  25. package/dist/components/vviinn-error.js +6 -0
  26. package/dist/components/vviinn-error2.js +28 -0
  27. package/dist/components/vviinn-example-image.js +6 -0
  28. package/dist/components/vviinn-example-image2.js +57 -0
  29. package/dist/components/vviinn-example-images.js +6 -0
  30. package/dist/components/vviinn-example-images2.js +53 -0
  31. package/dist/components/vviinn-image-selector.js +6 -0
  32. package/dist/components/vviinn-image-selector2.js +135 -0
  33. package/dist/components/vviinn-image-view.js +6 -0
  34. package/dist/components/vviinn-image-view2.js +95 -0
  35. package/dist/components/vviinn-modal.js +6 -0
  36. package/dist/components/vviinn-modal2.js +46 -0
  37. package/dist/components/vviinn-onboarding-card-1.js +6 -0
  38. package/dist/components/vviinn-onboarding-card-12.js +34 -0
  39. package/dist/components/vviinn-onboarding-card-2.js +6 -0
  40. package/dist/components/vviinn-onboarding-card-22.js +34 -0
  41. package/dist/components/vviinn-onboarding-card-3.js +6 -0
  42. package/dist/components/vviinn-onboarding-card-32.js +34 -0
  43. package/dist/components/vviinn-onboarding.js +6 -0
  44. package/dist/components/vviinn-onboarding2.js +63 -0
  45. package/dist/components/vviinn-overlay.js +6 -0
  46. package/dist/components/vviinn-overlay2.js +28 -0
  47. package/dist/components/vviinn-overlayed-modal.js +6 -0
  48. package/dist/components/vviinn-overlayed-modal2.js +45 -0
  49. package/dist/components/vviinn-preloader.js +6 -0
  50. package/dist/components/vviinn-preloader2.js +34 -0
  51. package/dist/components/vviinn-privacy-badge.js +6 -0
  52. package/dist/components/vviinn-privacy-badge2.js +33 -0
  53. package/dist/components/vviinn-product-card.js +6 -0
  54. package/dist/components/vviinn-product-card2.js +216 -0
  55. package/dist/components/vviinn-recommendations-sidebar.js +6 -0
  56. package/dist/components/vviinn-server-error.js +6 -0
  57. package/dist/components/vviinn-server-error2.js +35 -0
  58. package/dist/components/vviinn-slide.js +6 -0
  59. package/dist/components/vviinn-slide2.js +28 -0
  60. package/dist/components/vviinn-slider.js +6 -0
  61. package/dist/components/vviinn-slider2.js +159 -0
  62. package/dist/components/vviinn-teaser.js +6 -0
  63. package/dist/components/vviinn-teaser2.js +33 -0
  64. package/dist/components/vviinn-vpr-button.js +93 -0
  65. package/dist/components/vviinn-vpr-vidget.js +3360 -0
  66. package/dist/components/vviinn-vpr-widget.js +6 -0
  67. package/dist/components/vviinn-vps-button.js +224 -0
  68. package/dist/components/vviinn-vps-widget.js +6 -0
  69. package/dist/components/vviinn-vps-widget2.js +350 -0
  70. package/dist/components/vviinn-wrong-format.js +6 -0
  71. package/dist/components/vviinn-wrong-format2.js +35 -0
  72. package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +1 -0
  73. package/dist/types/components/vviinn-vpr-button/stories/lol.d.ts +2 -0
  74. package/dist/types/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.d.ts +1 -1
  75. package/dist/vviinn-widgets/Array-bdfc75db.js +4870 -0
  76. package/dist/vviinn-widgets/Handler-edcb46f4.js +1422 -0
  77. package/dist/vviinn-widgets/NonEmptyArray-947ab7b3.js +4411 -0
  78. package/dist/{esm/app-globals-865bc7a7.js → vviinn-widgets/app-globals-c0aa8ec3.js} +922 -10
  79. package/dist/vviinn-widgets/cropper-handler.entry.js +23 -0
  80. package/dist/vviinn-widgets/css-shim-f0027935.js +4 -0
  81. package/dist/{esm/customized-slots-96902edf.js → vviinn-widgets/customized-slots-5c1c623a.js} +1 -1
  82. package/dist/vviinn-widgets/dom-db0073f0.js +73 -0
  83. package/dist/vviinn-widgets/highlight-box.entry.js +41 -0
  84. package/dist/{collection/components/image-search/image-view/image-cropper/image-cropper.js → vviinn-widgets/image-cropper.entry.js} +33 -70
  85. package/dist/{cjs/index-df6896e2.js → vviinn-widgets/imageSearch.store-0eed9a5c.js} +11598 -15320
  86. package/dist/{esm/index-2fdd499d.js → vviinn-widgets/imageSearch.store-b28bddb0.js} +11971 -15281
  87. package/dist/{collection/components/vviinn-icons/index.js → vviinn-widgets/index-44058ea2.js} +14 -11
  88. package/dist/vviinn-widgets/index-6c6de682.js +3857 -0
  89. package/dist/vviinn-widgets/index-de3e14da.js +3010 -0
  90. package/dist/vviinn-widgets/index.esm.js +1 -0
  91. package/dist/vviinn-widgets/number-171db649.js +1499 -0
  92. package/dist/vviinn-widgets/search-filters.entry.js +76 -0
  93. package/dist/vviinn-widgets/shadow-css-c1fdfa9f.js +389 -0
  94. package/dist/{collection/components/vviinn-carousel/vviinn-carousel.js → vviinn-widgets/vviinn-carousel.entry.js} +18 -113
  95. package/dist/vviinn-widgets/vviinn-detected-object.entry.js +54 -0
  96. package/dist/vviinn-widgets/vviinn-empty-results.entry.js +16 -0
  97. package/dist/vviinn-widgets/vviinn-error.entry.js +15 -0
  98. package/dist/vviinn-widgets/vviinn-example-image.entry.js +38 -0
  99. package/dist/vviinn-widgets/vviinn-example-images.entry.js +28 -0
  100. package/dist/vviinn-widgets/vviinn-image-selector.entry.js +31 -0
  101. package/dist/vviinn-widgets/vviinn-image-view.entry.js +55 -0
  102. package/dist/vviinn-widgets/vviinn-modal.entry.js +30 -0
  103. package/dist/vviinn-widgets/vviinn-onboarding-card-1.entry.js +21 -0
  104. package/dist/vviinn-widgets/vviinn-onboarding-card-2.entry.js +21 -0
  105. package/dist/vviinn-widgets/vviinn-onboarding-card-3.entry.js +21 -0
  106. package/dist/vviinn-widgets/vviinn-onboarding.entry.js +20 -0
  107. package/dist/vviinn-widgets/vviinn-overlay.entry.js +15 -0
  108. package/dist/vviinn-widgets/vviinn-overlayed-modal.entry.js +18 -0
  109. package/dist/vviinn-widgets/vviinn-preloader.entry.js +25 -0
  110. package/dist/vviinn-widgets/vviinn-privacy-badge.entry.js +20 -0
  111. package/dist/vviinn-widgets/vviinn-product-card.entry.js +188 -0
  112. package/dist/{esm → vviinn-widgets}/vviinn-recommendations-sidebar.entry.js +2 -2
  113. package/dist/vviinn-widgets/vviinn-server-error.entry.js +16 -0
  114. package/dist/vviinn-widgets/vviinn-slide.entry.js +15 -0
  115. package/dist/vviinn-widgets/vviinn-slider.entry.js +120 -0
  116. package/dist/vviinn-widgets/vviinn-teaser.entry.js +20 -0
  117. package/dist/{esm → vviinn-widgets}/vviinn-vpr-button.entry.js +2 -2
  118. package/dist/vviinn-widgets/vviinn-vpr-widget.entry.js +4588 -0
  119. package/dist/{esm → vviinn-widgets}/vviinn-vps-button.entry.js +3 -3
  120. package/dist/vviinn-widgets/vviinn-vps-widget.entry.js +170 -0
  121. package/dist/vviinn-widgets/vviinn-widgets.css +6 -1
  122. package/dist/vviinn-widgets/vviinn-widgets.esm.js +125 -1
  123. package/dist/vviinn-widgets/vviinn-wrong-format.entry.js +16 -0
  124. package/package.json +8 -2
  125. package/www/build/p-06c76b5e.js +1 -0
  126. package/www/build/p-07e16d04.js +15 -0
  127. package/{dist/vviinn-widgets/p-a6e0710f.entry.js → www/build/p-44bc50de.entry.js} +1 -1
  128. package/www/build/p-510922c6.js +1 -0
  129. package/www/build/p-57ce8de3.css +1 -0
  130. package/www/build/p-591cb193.entry.js +1 -0
  131. package/www/build/p-6b9d242e.js +1 -0
  132. package/www/build/p-880bccf1.js +1 -0
  133. package/www/build/p-b0ada114.entry.js +1 -0
  134. package/www/build/p-b7be7c70.entry.js +1 -0
  135. package/{dist/vviinn-widgets/p-166970f3.js → www/build/p-ea8dea5c.js} +1 -1
  136. package/www/build/vviinn-widgets.css +1 -1
  137. package/www/build/vviinn-widgets.esm.js +1 -1
  138. package/www/index.html +32261 -1
  139. package/www/sw.js +66 -0
  140. package/dist/cjs/app-globals-8db3bcbe.js +0 -6912
  141. package/dist/cjs/cropper-handler_27.cjs.entry.js +0 -1135
  142. package/dist/cjs/index-3c3ab815.js +0 -1354
  143. package/dist/cjs/index-f66cd8d1.js +0 -39
  144. package/dist/cjs/index.cjs.js +0 -2
  145. package/dist/cjs/loader.cjs.js +0 -23
  146. package/dist/cjs/vviinn-carousel_2.cjs.entry.js +0 -1001
  147. package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +0 -65
  148. package/dist/cjs/vviinn-vpr-button.cjs.entry.js +0 -49
  149. package/dist/cjs/vviinn-vps-button.cjs.entry.js +0 -43
  150. package/dist/cjs/vviinn-widgets.cjs.js +0 -21
  151. package/dist/collection/Image/error.js +0 -14
  152. package/dist/collection/Image/form.js +0 -5
  153. package/dist/collection/Image/fromFile.js +0 -18
  154. package/dist/collection/Image/imageToB64.js +0 -9
  155. package/dist/collection/Image/index.js +0 -0
  156. package/dist/collection/Image/renderPromise.js +0 -6
  157. package/dist/collection/Image/resizeImage.js +0 -28
  158. package/dist/collection/Image/sizing.js +0 -39
  159. package/dist/collection/Image/toFile.js +0 -17
  160. package/dist/collection/analytics/GAnalytics.js +0 -32
  161. package/dist/collection/analytics/GeneralAnalytics.js +0 -9
  162. package/dist/collection/analytics/GtagAnalytics.js +0 -35
  163. package/dist/collection/analytics/ProductAnalytics.js +0 -1
  164. package/dist/collection/campaign/Campaign.js +0 -8
  165. package/dist/collection/campaign/CampaignService.js +0 -5
  166. package/dist/collection/campaign/VCSCampaign.js +0 -1
  167. package/dist/collection/campaign/VCSCampaignResponse.js +0 -1
  168. package/dist/collection/campaign/VCSCampaignService.js +0 -7
  169. package/dist/collection/campaign/VPRCampaignResponse.js +0 -1
  170. package/dist/collection/campaign/VPRCampaignService.js +0 -7
  171. package/dist/collection/collection-manifest.json +0 -43
  172. package/dist/collection/components/customized-slots.js +0 -47
  173. package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.css +0 -71
  174. package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.js +0 -25
  175. package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.css +0 -49
  176. package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.js +0 -64
  177. package/dist/collection/components/image-search/image-view/image-cropper/image-cropper.css +0 -33
  178. package/dist/collection/components/image-search/search-filters/search-filters.css +0 -120
  179. package/dist/collection/components/image-search/search-filters/search-filters.js +0 -125
  180. package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +0 -142
  181. package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.css +0 -7
  182. package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.js +0 -36
  183. package/dist/collection/components/vviinn-error/vviinn-error.css +0 -38
  184. package/dist/collection/components/vviinn-error/vviinn-error.js +0 -18
  185. package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.css +0 -3
  186. package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.js +0 -34
  187. package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.css +0 -3
  188. package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.js +0 -34
  189. package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.css +0 -34
  190. package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.js +0 -129
  191. package/dist/collection/components/vviinn-example-images/vviinn-example-images.css +0 -19
  192. package/dist/collection/components/vviinn-example-images/vviinn-example-images.js +0 -80
  193. package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.css +0 -25
  194. package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.js +0 -64
  195. package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.css +0 -47
  196. package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.js +0 -100
  197. package/dist/collection/components/vviinn-image-view/vviinn-image-view.css +0 -31
  198. package/dist/collection/components/vviinn-image-view/vviinn-image-view.js +0 -61
  199. package/dist/collection/components/vviinn-modal/vviinn-modal.css +0 -105
  200. package/dist/collection/components/vviinn-modal/vviinn-modal.js +0 -98
  201. package/dist/collection/components/vviinn-onboarding/onboarding-cards/onboarding-card.css +0 -41
  202. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-1/vviinn-onboarding-card-1.js +0 -26
  203. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-2/vviinn-onboarding-card-2.js +0 -26
  204. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-3/vviinn-onboarding-card-3.js +0 -26
  205. package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.css +0 -58
  206. package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.js +0 -28
  207. package/dist/collection/components/vviinn-overlay/vviinn-overlay.css +0 -33
  208. package/dist/collection/components/vviinn-overlay/vviinn-overlay.js +0 -15
  209. package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.css +0 -29
  210. package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.js +0 -71
  211. package/dist/collection/components/vviinn-preloader/vviinn-preloader.css +0 -37
  212. package/dist/collection/components/vviinn-preloader/vviinn-preloader.js +0 -20
  213. package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.css +0 -19
  214. package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.js +0 -27
  215. package/dist/collection/components/vviinn-product-card/render-helpers.js +0 -32
  216. package/dist/collection/components/vviinn-product-card/stories/args.js +0 -73
  217. package/dist/collection/components/vviinn-product-card/stories/decorators.js +0 -51
  218. package/dist/collection/components/vviinn-product-card/stories/vviinn-product-card.stories.js +0 -105
  219. package/dist/collection/components/vviinn-product-card/vviinn-product-card.css +0 -95
  220. package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +0 -462
  221. package/dist/collection/components/vviinn-slider/arrow.js +0 -11
  222. package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.css +0 -4
  223. package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.js +0 -15
  224. package/dist/collection/components/vviinn-slider/vviinn-slider.css +0 -109
  225. package/dist/collection/components/vviinn-slider/vviinn-slider.js +0 -181
  226. package/dist/collection/components/vviinn-teaser/vviinn-teaser.css +0 -14
  227. package/dist/collection/components/vviinn-teaser/vviinn-teaser.js +0 -29
  228. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.css +0 -238
  229. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +0 -220
  230. package/dist/collection/components/vviinn-vpr-button/stories/args.js +0 -213
  231. package/dist/collection/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.js +0 -91
  232. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +0 -35
  233. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +0 -179
  234. package/dist/collection/components/vviinn-vpr-widget/stories/args.js +0 -197
  235. package/dist/collection/components/vviinn-vpr-widget/stories/decorators.js +0 -29
  236. package/dist/collection/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.js +0 -211
  237. package/dist/collection/components/vviinn-vpr-widget/token-helpers.js +0 -11
  238. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +0 -510
  239. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +0 -79
  240. package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +0 -35
  241. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.css +0 -3
  242. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +0 -195
  243. package/dist/collection/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.js +0 -37
  244. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.css +0 -350
  245. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +0 -375
  246. package/dist/collection/cropper/Cropper.js +0 -1
  247. package/dist/collection/cropper/Handler.js +0 -61
  248. package/dist/collection/dom/index.js +0 -3
  249. package/dist/collection/error.js +0 -14
  250. package/dist/collection/file/index.js +0 -4
  251. package/dist/collection/geometry/Clip.js +0 -14
  252. package/dist/collection/geometry/Point.js +0 -32
  253. package/dist/collection/geometry/Rectangle.js +0 -95
  254. package/dist/collection/geometry/RectangleAlt.js +0 -1
  255. package/dist/collection/geometry/Sized.js +0 -8
  256. package/dist/collection/global.js +0 -19
  257. package/dist/collection/index.js +0 -1
  258. package/dist/collection/interfaces/generated.js +0 -5
  259. package/dist/collection/interfaces/recommendation.js +0 -1
  260. package/dist/collection/network/apiClient.js +0 -9
  261. package/dist/collection/network/ion/File.js +0 -14
  262. package/dist/collection/network/ion/Form.js +0 -64
  263. package/dist/collection/network/ion/Link.js +0 -8
  264. package/dist/collection/network/ion/ValueObject.js +0 -23
  265. package/dist/collection/network/request.js +0 -19
  266. package/dist/collection/network/utils.js +0 -37
  267. package/dist/collection/openApi/index.js +0 -27
  268. package/dist/collection/recommendation/events.js +0 -1
  269. package/dist/collection/recommendation/recommendation.js +0 -1
  270. package/dist/collection/searchSession/searchSession.js +0 -31
  271. package/dist/collection/sentry.js +0 -14
  272. package/dist/collection/slider/GridMode.js +0 -1
  273. package/dist/collection/store/file-processing.js +0 -13
  274. package/dist/collection/store/imageSearch.store.js +0 -133
  275. package/dist/collection/store/store.js +0 -3
  276. package/dist/collection/store/tracking.store.js +0 -3
  277. package/dist/collection/stories/Button.js +0 -21
  278. package/dist/collection/stories/Button.stories.js +0 -42
  279. package/dist/collection/stories/Header.js +0 -45
  280. package/dist/collection/stories/Header.stories.js +0 -15
  281. package/dist/collection/stories/Page.js +0 -61
  282. package/dist/collection/stories/Page.stories.js +0 -19
  283. package/dist/collection/stories/assets/code-brackets.svg +0 -1
  284. package/dist/collection/stories/assets/colors.svg +0 -1
  285. package/dist/collection/stories/assets/comments.svg +0 -1
  286. package/dist/collection/stories/assets/direction.svg +0 -1
  287. package/dist/collection/stories/assets/flow.svg +0 -1
  288. package/dist/collection/stories/assets/plugin.svg +0 -1
  289. package/dist/collection/stories/assets/repo.svg +0 -1
  290. package/dist/collection/stories/assets/stackalt.svg +0 -1
  291. package/dist/collection/stories/image-selector.stories.js +0 -6
  292. package/dist/collection/stories/image-view.stories.js +0 -6
  293. package/dist/collection/stories/modal.stories.js +0 -12
  294. package/dist/collection/stories/onboarding.stories.js +0 -11
  295. package/dist/collection/stories/overlay.stories.js +0 -5
  296. package/dist/collection/stories/overlayedModal.stories.js +0 -8
  297. package/dist/collection/stories/privacy-badge.stories.js +0 -11
  298. package/dist/collection/stories/slider.stories.js +0 -17
  299. package/dist/collection/stories/teaser.stories.js +0 -5
  300. package/dist/collection/stories/vps-widget.stories.js +0 -47
  301. package/dist/collection/stories/vviinn-product.stories.js +0 -19
  302. package/dist/collection/tracking/event.js +0 -3
  303. package/dist/collection/tracking/filter.js +0 -5
  304. package/dist/collection/tracking/index.js +0 -13
  305. package/dist/collection/tracking/models.js +0 -6
  306. package/dist/collection/tracking/product.js +0 -18
  307. package/dist/collection/tracking/search.js +0 -5
  308. package/dist/collection/tracking/widget.js +0 -10
  309. package/dist/collection/utils/collections/collectionsUtils.js +0 -5
  310. package/dist/collection/utils/either.js +0 -3
  311. package/dist/collection/utils/enum/enumUtils.js +0 -3
  312. package/dist/collection/utils/event/Events.js +0 -1
  313. package/dist/collection/utils/number/index.js +0 -4
  314. package/dist/collection/utils/option/option.js +0 -4
  315. package/dist/collection/utils/semigroup/semigroupDiff.js +0 -6
  316. package/dist/collection/utils/token/tokenUtils.js +0 -9
  317. package/dist/esm/cropper-handler_27.entry.js +0 -1105
  318. package/dist/esm/index-51f71d18.js +0 -1323
  319. package/dist/esm/index.js +0 -1
  320. package/dist/esm/loader.js +0 -19
  321. package/dist/esm/polyfills/core-js.js +0 -11
  322. package/dist/esm/polyfills/css-shim.js +0 -1
  323. package/dist/esm/polyfills/dom.js +0 -79
  324. package/dist/esm/polyfills/es5-html-element.js +0 -1
  325. package/dist/esm/polyfills/index.js +0 -34
  326. package/dist/esm/polyfills/system.js +0 -6
  327. package/dist/esm/vviinn-carousel_2.entry.js +0 -996
  328. package/dist/esm/vviinn-widgets.js +0 -19
  329. package/dist/index.cjs.js +0 -1
  330. package/dist/index.js +0 -1
  331. package/dist/loader/cdn.js +0 -3
  332. package/dist/loader/index.cjs.js +0 -3
  333. package/dist/loader/index.d.ts +0 -12
  334. package/dist/loader/index.es2017.js +0 -3
  335. package/dist/loader/index.js +0 -4
  336. package/dist/loader/package.json +0 -10
  337. package/dist/vviinn-widgets/p-2dd35f19.entry.js +0 -1
  338. package/dist/vviinn-widgets/p-3469b71a.js +0 -1
  339. package/dist/vviinn-widgets/p-40bea5b5.entry.js +0 -1
  340. package/dist/vviinn-widgets/p-465d043d.js +0 -15
  341. package/dist/vviinn-widgets/p-59bd2a99.js +0 -1
  342. package/dist/vviinn-widgets/p-74ed36af.entry.js +0 -1
  343. package/dist/vviinn-widgets/p-9def6b8b.entry.js +0 -1
  344. package/dist/vviinn-widgets/p-cd995515.js +0 -1
  345. package/www/build/p-166970f3.js +0 -1
  346. package/www/build/p-2dd35f19.entry.js +0 -1
  347. package/www/build/p-3469b71a.js +0 -1
  348. package/www/build/p-40bea5b5.entry.js +0 -1
  349. package/www/build/p-465d043d.js +0 -15
  350. package/www/build/p-59bd2a99.js +0 -1
  351. package/www/build/p-61933b75.js +0 -1
  352. package/www/build/p-74ed36af.entry.js +0 -1
  353. package/www/build/p-9def6b8b.entry.js +0 -1
  354. package/www/build/p-a67898be.css +0 -1
  355. package/www/build/p-a6e0710f.entry.js +0 -1
  356. package/www/build/p-cd995515.js +0 -1
  357. package/www/favicon.ico +0 -0
@@ -0,0 +1,4411 @@
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ function getDefaultExportFromCjs (x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
+ }
6
+
7
+ function createCommonjsModule(fn, basedir, module) {
8
+ return module = {
9
+ path: basedir,
10
+ exports: {},
11
+ require: function (path, base) {
12
+ return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
13
+ }
14
+ }, fn(module, module.exports), module.exports;
15
+ }
16
+
17
+ function getDefaultExportFromNamespaceIfPresent (n) {
18
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
19
+ }
20
+
21
+ function getDefaultExportFromNamespaceIfNotNamed (n) {
22
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
23
+ }
24
+
25
+ function getAugmentedNamespace(n) {
26
+ if (n.__esModule) return n;
27
+ var a = Object.defineProperty({}, '__esModule', {value: true});
28
+ Object.keys(n).forEach(function (k) {
29
+ var d = Object.getOwnPropertyDescriptor(n, k);
30
+ Object.defineProperty(a, k, d.get ? d : {
31
+ enumerable: true,
32
+ get: function () {
33
+ return n[k];
34
+ }
35
+ });
36
+ });
37
+ return a;
38
+ }
39
+
40
+ function commonjsRequire () {
41
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
42
+ }
43
+
44
+ var _function = createCommonjsModule(function (module, exports) {
45
+ "use strict";
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.getEndomorphismMonoid = exports.not = exports.SK = exports.hole = exports.pipe = exports.untupled = exports.tupled = exports.absurd = exports.decrement = exports.increment = exports.tuple = exports.flow = exports.flip = exports.constVoid = exports.constUndefined = exports.constNull = exports.constFalse = exports.constTrue = exports.constant = exports.unsafeCoerce = exports.identity = exports.apply = exports.getRing = exports.getSemiring = exports.getMonoid = exports.getSemigroup = exports.getBooleanAlgebra = void 0;
48
+ // -------------------------------------------------------------------------------------
49
+ // instances
50
+ // -------------------------------------------------------------------------------------
51
+ /**
52
+ * @category instances
53
+ * @since 2.10.0
54
+ */
55
+ var getBooleanAlgebra = function (B) { return function () { return ({
56
+ meet: function (x, y) { return function (a) { return B.meet(x(a), y(a)); }; },
57
+ join: function (x, y) { return function (a) { return B.join(x(a), y(a)); }; },
58
+ zero: function () { return B.zero; },
59
+ one: function () { return B.one; },
60
+ implies: function (x, y) { return function (a) { return B.implies(x(a), y(a)); }; },
61
+ not: function (x) { return function (a) { return B.not(x(a)); }; }
62
+ }); }; };
63
+ exports.getBooleanAlgebra = getBooleanAlgebra;
64
+ /**
65
+ * Unary functions form a semigroup as long as you can provide a semigroup for the codomain.
66
+ *
67
+ * @example
68
+ * import { Predicate, getSemigroup } from 'fp-ts/function'
69
+ * import * as B from 'fp-ts/boolean'
70
+ *
71
+ * const f: Predicate<number> = (n) => n <= 2
72
+ * const g: Predicate<number> = (n) => n >= 0
73
+ *
74
+ * const S1 = getSemigroup(B.SemigroupAll)<number>()
75
+ *
76
+ * assert.deepStrictEqual(S1.concat(f, g)(1), true)
77
+ * assert.deepStrictEqual(S1.concat(f, g)(3), false)
78
+ *
79
+ * const S2 = getSemigroup(B.SemigroupAny)<number>()
80
+ *
81
+ * assert.deepStrictEqual(S2.concat(f, g)(1), true)
82
+ * assert.deepStrictEqual(S2.concat(f, g)(3), true)
83
+ *
84
+ * @category instances
85
+ * @since 2.10.0
86
+ */
87
+ var getSemigroup = function (S) { return function () { return ({
88
+ concat: function (f, g) { return function (a) { return S.concat(f(a), g(a)); }; }
89
+ }); }; };
90
+ exports.getSemigroup = getSemigroup;
91
+ /**
92
+ * Unary functions form a monoid as long as you can provide a monoid for the codomain.
93
+ *
94
+ * @example
95
+ * import { Predicate } from 'fp-ts/Predicate'
96
+ * import { getMonoid } from 'fp-ts/function'
97
+ * import * as B from 'fp-ts/boolean'
98
+ *
99
+ * const f: Predicate<number> = (n) => n <= 2
100
+ * const g: Predicate<number> = (n) => n >= 0
101
+ *
102
+ * const M1 = getMonoid(B.MonoidAll)<number>()
103
+ *
104
+ * assert.deepStrictEqual(M1.concat(f, g)(1), true)
105
+ * assert.deepStrictEqual(M1.concat(f, g)(3), false)
106
+ *
107
+ * const M2 = getMonoid(B.MonoidAny)<number>()
108
+ *
109
+ * assert.deepStrictEqual(M2.concat(f, g)(1), true)
110
+ * assert.deepStrictEqual(M2.concat(f, g)(3), true)
111
+ *
112
+ * @category instances
113
+ * @since 2.10.0
114
+ */
115
+ var getMonoid = function (M) {
116
+ var getSemigroupM = (0, exports.getSemigroup)(M);
117
+ return function () { return ({
118
+ concat: getSemigroupM().concat,
119
+ empty: function () { return M.empty; }
120
+ }); };
121
+ };
122
+ exports.getMonoid = getMonoid;
123
+ /**
124
+ * @category instances
125
+ * @since 2.10.0
126
+ */
127
+ var getSemiring = function (S) { return ({
128
+ add: function (f, g) { return function (x) { return S.add(f(x), g(x)); }; },
129
+ zero: function () { return S.zero; },
130
+ mul: function (f, g) { return function (x) { return S.mul(f(x), g(x)); }; },
131
+ one: function () { return S.one; }
132
+ }); };
133
+ exports.getSemiring = getSemiring;
134
+ /**
135
+ * @category instances
136
+ * @since 2.10.0
137
+ */
138
+ var getRing = function (R) {
139
+ var S = (0, exports.getSemiring)(R);
140
+ return {
141
+ add: S.add,
142
+ mul: S.mul,
143
+ one: S.one,
144
+ zero: S.zero,
145
+ sub: function (f, g) { return function (x) { return R.sub(f(x), g(x)); }; }
146
+ };
147
+ };
148
+ exports.getRing = getRing;
149
+ // -------------------------------------------------------------------------------------
150
+ // utils
151
+ // -------------------------------------------------------------------------------------
152
+ /**
153
+ * @since 2.11.0
154
+ */
155
+ var apply = function (a) { return function (f) { return f(a); }; };
156
+ exports.apply = apply;
157
+ /**
158
+ * @since 2.0.0
159
+ */
160
+ function identity(a) {
161
+ return a;
162
+ }
163
+ exports.identity = identity;
164
+ /**
165
+ * @since 2.0.0
166
+ */
167
+ exports.unsafeCoerce = identity;
168
+ /**
169
+ * @since 2.0.0
170
+ */
171
+ function constant(a) {
172
+ return function () { return a; };
173
+ }
174
+ exports.constant = constant;
175
+ /**
176
+ * A thunk that returns always `true`.
177
+ *
178
+ * @since 2.0.0
179
+ */
180
+ exports.constTrue = constant(true);
181
+ /**
182
+ * A thunk that returns always `false`.
183
+ *
184
+ * @since 2.0.0
185
+ */
186
+ exports.constFalse = constant(false);
187
+ /**
188
+ * A thunk that returns always `null`.
189
+ *
190
+ * @since 2.0.0
191
+ */
192
+ exports.constNull = constant(null);
193
+ /**
194
+ * A thunk that returns always `undefined`.
195
+ *
196
+ * @since 2.0.0
197
+ */
198
+ exports.constUndefined = constant(undefined);
199
+ /**
200
+ * A thunk that returns always `void`.
201
+ *
202
+ * @since 2.0.0
203
+ */
204
+ exports.constVoid = exports.constUndefined;
205
+ /**
206
+ * Flips the order of the arguments of a function of two arguments.
207
+ *
208
+ * @since 2.0.0
209
+ */
210
+ function flip(f) {
211
+ return function (b, a) { return f(a, b); };
212
+ }
213
+ exports.flip = flip;
214
+ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
215
+ switch (arguments.length) {
216
+ case 1:
217
+ return ab;
218
+ case 2:
219
+ return function () {
220
+ return bc(ab.apply(this, arguments));
221
+ };
222
+ case 3:
223
+ return function () {
224
+ return cd(bc(ab.apply(this, arguments)));
225
+ };
226
+ case 4:
227
+ return function () {
228
+ return de(cd(bc(ab.apply(this, arguments))));
229
+ };
230
+ case 5:
231
+ return function () {
232
+ return ef(de(cd(bc(ab.apply(this, arguments)))));
233
+ };
234
+ case 6:
235
+ return function () {
236
+ return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
237
+ };
238
+ case 7:
239
+ return function () {
240
+ return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
241
+ };
242
+ case 8:
243
+ return function () {
244
+ return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
245
+ };
246
+ case 9:
247
+ return function () {
248
+ return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
249
+ };
250
+ }
251
+ return;
252
+ }
253
+ exports.flow = flow;
254
+ /**
255
+ * @since 2.0.0
256
+ */
257
+ function tuple() {
258
+ var t = [];
259
+ for (var _i = 0; _i < arguments.length; _i++) {
260
+ t[_i] = arguments[_i];
261
+ }
262
+ return t;
263
+ }
264
+ exports.tuple = tuple;
265
+ /**
266
+ * @since 2.0.0
267
+ */
268
+ function increment(n) {
269
+ return n + 1;
270
+ }
271
+ exports.increment = increment;
272
+ /**
273
+ * @since 2.0.0
274
+ */
275
+ function decrement(n) {
276
+ return n - 1;
277
+ }
278
+ exports.decrement = decrement;
279
+ /**
280
+ * @since 2.0.0
281
+ */
282
+ function absurd(_) {
283
+ throw new Error('Called `absurd` function which should be uncallable');
284
+ }
285
+ exports.absurd = absurd;
286
+ /**
287
+ * Creates a tupled version of this function: instead of `n` arguments, it accepts a single tuple argument.
288
+ *
289
+ * @example
290
+ * import { tupled } from 'fp-ts/function'
291
+ *
292
+ * const add = tupled((x: number, y: number): number => x + y)
293
+ *
294
+ * assert.strictEqual(add([1, 2]), 3)
295
+ *
296
+ * @since 2.4.0
297
+ */
298
+ function tupled(f) {
299
+ return function (a) { return f.apply(void 0, a); };
300
+ }
301
+ exports.tupled = tupled;
302
+ /**
303
+ * Inverse function of `tupled`
304
+ *
305
+ * @since 2.4.0
306
+ */
307
+ function untupled(f) {
308
+ return function () {
309
+ var a = [];
310
+ for (var _i = 0; _i < arguments.length; _i++) {
311
+ a[_i] = arguments[_i];
312
+ }
313
+ return f(a);
314
+ };
315
+ }
316
+ exports.untupled = untupled;
317
+ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
318
+ switch (arguments.length) {
319
+ case 1:
320
+ return a;
321
+ case 2:
322
+ return ab(a);
323
+ case 3:
324
+ return bc(ab(a));
325
+ case 4:
326
+ return cd(bc(ab(a)));
327
+ case 5:
328
+ return de(cd(bc(ab(a))));
329
+ case 6:
330
+ return ef(de(cd(bc(ab(a)))));
331
+ case 7:
332
+ return fg(ef(de(cd(bc(ab(a))))));
333
+ case 8:
334
+ return gh(fg(ef(de(cd(bc(ab(a)))))));
335
+ case 9:
336
+ return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
337
+ default: {
338
+ var ret = arguments[0];
339
+ for (var i = 1; i < arguments.length; i++) {
340
+ ret = arguments[i](ret);
341
+ }
342
+ return ret;
343
+ }
344
+ }
345
+ }
346
+ exports.pipe = pipe;
347
+ /**
348
+ * Type hole simulation
349
+ *
350
+ * @since 2.7.0
351
+ */
352
+ exports.hole = absurd;
353
+ /**
354
+ * @since 2.11.0
355
+ */
356
+ var SK = function (_, b) { return b; };
357
+ exports.SK = SK;
358
+ /**
359
+ * Use `Predicate` module instead.
360
+ *
361
+ * @since 2.0.0
362
+ * @deprecated
363
+ */
364
+ function not(predicate) {
365
+ return function (a) { return !predicate(a); };
366
+ }
367
+ exports.not = not;
368
+ /**
369
+ * Use `Endomorphism` module instead.
370
+ *
371
+ * @category instances
372
+ * @since 2.10.0
373
+ * @deprecated
374
+ */
375
+ var getEndomorphismMonoid = function () { return ({
376
+ concat: function (first, second) { return flow(first, second); },
377
+ empty: identity
378
+ }); };
379
+ exports.getEndomorphismMonoid = getEndomorphismMonoid;
380
+ });
381
+
382
+ const _function$1 = /*@__PURE__*/getDefaultExportFromCjs(_function);
383
+
384
+ var internal = createCommonjsModule(function (module, exports) {
385
+ "use strict";
386
+ var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from, pack) {
387
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
388
+ if (ar || !(i in from)) {
389
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
390
+ ar[i] = from[i];
391
+ }
392
+ }
393
+ return to.concat(ar || Array.prototype.slice.call(from));
394
+ };
395
+ Object.defineProperty(exports, "__esModule", { value: true });
396
+ exports.fromReadonlyNonEmptyArray = exports.has = exports.emptyRecord = exports.emptyReadonlyArray = exports.tail = exports.head = exports.isNonEmpty = exports.singleton = exports.right = exports.left = exports.isRight = exports.isLeft = exports.some = exports.none = exports.isSome = exports.isNone = void 0;
397
+ // -------------------------------------------------------------------------------------
398
+ // Option
399
+ // -------------------------------------------------------------------------------------
400
+ /** @internal */
401
+ var isNone = function (fa) { return fa._tag === 'None'; };
402
+ exports.isNone = isNone;
403
+ /** @internal */
404
+ var isSome = function (fa) { return fa._tag === 'Some'; };
405
+ exports.isSome = isSome;
406
+ /** @internal */
407
+ exports.none = { _tag: 'None' };
408
+ /** @internal */
409
+ var some = function (a) { return ({ _tag: 'Some', value: a }); };
410
+ exports.some = some;
411
+ // -------------------------------------------------------------------------------------
412
+ // Either
413
+ // -------------------------------------------------------------------------------------
414
+ /** @internal */
415
+ var isLeft = function (ma) { return ma._tag === 'Left'; };
416
+ exports.isLeft = isLeft;
417
+ /** @internal */
418
+ var isRight = function (ma) { return ma._tag === 'Right'; };
419
+ exports.isRight = isRight;
420
+ /** @internal */
421
+ var left = function (e) { return ({ _tag: 'Left', left: e }); };
422
+ exports.left = left;
423
+ /** @internal */
424
+ var right = function (a) { return ({ _tag: 'Right', right: a }); };
425
+ exports.right = right;
426
+ // -------------------------------------------------------------------------------------
427
+ // ReadonlyNonEmptyArray
428
+ // -------------------------------------------------------------------------------------
429
+ /** @internal */
430
+ var singleton = function (a) { return [a]; };
431
+ exports.singleton = singleton;
432
+ /** @internal */
433
+ var isNonEmpty = function (as) { return as.length > 0; };
434
+ exports.isNonEmpty = isNonEmpty;
435
+ /** @internal */
436
+ var head = function (as) { return as[0]; };
437
+ exports.head = head;
438
+ /** @internal */
439
+ var tail = function (as) { return as.slice(1); };
440
+ exports.tail = tail;
441
+ // -------------------------------------------------------------------------------------
442
+ // empty
443
+ // -------------------------------------------------------------------------------------
444
+ /** @internal */
445
+ exports.emptyReadonlyArray = [];
446
+ /** @internal */
447
+ exports.emptyRecord = {};
448
+ // -------------------------------------------------------------------------------------
449
+ // Record
450
+ // -------------------------------------------------------------------------------------
451
+ /** @internal */
452
+ exports.has = Object.prototype.hasOwnProperty;
453
+ // -------------------------------------------------------------------------------------
454
+ // NonEmptyArray
455
+ // -------------------------------------------------------------------------------------
456
+ /** @internal */
457
+ var fromReadonlyNonEmptyArray = function (as) { return __spreadArray([as[0]], as.slice(1), true); };
458
+ exports.fromReadonlyNonEmptyArray = fromReadonlyNonEmptyArray;
459
+ });
460
+
461
+ const internal$1 = /*@__PURE__*/getDefaultExportFromCjs(internal);
462
+
463
+ var Apply = createCommonjsModule(function (module, exports) {
464
+ "use strict";
465
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
466
+ if (k2 === undefined) k2 = k;
467
+ var desc = Object.getOwnPropertyDescriptor(m, k);
468
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
469
+ desc = { enumerable: true, get: function() { return m[k]; } };
470
+ }
471
+ Object.defineProperty(o, k2, desc);
472
+ }) : (function(o, m, k, k2) {
473
+ if (k2 === undefined) k2 = k;
474
+ o[k2] = m[k];
475
+ }));
476
+ var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
477
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
478
+ }) : function(o, v) {
479
+ o["default"] = v;
480
+ });
481
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
482
+ if (mod && mod.__esModule) return mod;
483
+ var result = {};
484
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
485
+ __setModuleDefault(result, mod);
486
+ return result;
487
+ };
488
+ Object.defineProperty(exports, "__esModule", { value: true });
489
+ exports.sequenceS = exports.sequenceT = exports.getApplySemigroup = exports.apS = exports.apSecond = exports.apFirst = exports.ap = void 0;
490
+
491
+ var _ = __importStar(internal);
492
+ function ap(F, G) {
493
+ return function (fa) { return function (fab) {
494
+ return F.ap(F.map(fab, function (gab) { return function (ga) { return G.ap(gab, ga); }; }), fa);
495
+ }; };
496
+ }
497
+ exports.ap = ap;
498
+ function apFirst(A) {
499
+ return function (second) { return function (first) {
500
+ return A.ap(A.map(first, function (a) { return function () { return a; }; }), second);
501
+ }; };
502
+ }
503
+ exports.apFirst = apFirst;
504
+ function apSecond(A) {
505
+ return function (second) { return function (first) {
506
+ return A.ap(A.map(first, function () { return function (b) { return b; }; }), second);
507
+ }; };
508
+ }
509
+ exports.apSecond = apSecond;
510
+ function apS(F) {
511
+ return function (name, fb) { return function (fa) {
512
+ return F.ap(F.map(fa, function (a) { return function (b) {
513
+ var _a;
514
+ return Object.assign({}, a, (_a = {}, _a[name] = b, _a));
515
+ }; }), fb);
516
+ }; };
517
+ }
518
+ exports.apS = apS;
519
+ function getApplySemigroup(F) {
520
+ return function (S) { return ({
521
+ concat: function (first, second) {
522
+ return F.ap(F.map(first, function (x) { return function (y) { return S.concat(x, y); }; }), second);
523
+ }
524
+ }); };
525
+ }
526
+ exports.getApplySemigroup = getApplySemigroup;
527
+ function curried(f, n, acc) {
528
+ return function (x) {
529
+ var combined = Array(acc.length + 1);
530
+ for (var i = 0; i < acc.length; i++) {
531
+ combined[i] = acc[i];
532
+ }
533
+ combined[acc.length] = x;
534
+ return n === 0 ? f.apply(null, combined) : curried(f, n - 1, combined);
535
+ };
536
+ }
537
+ var tupleConstructors = {
538
+ 1: function (a) { return [a]; },
539
+ 2: function (a) { return function (b) { return [a, b]; }; },
540
+ 3: function (a) { return function (b) { return function (c) { return [a, b, c]; }; }; },
541
+ 4: function (a) { return function (b) { return function (c) { return function (d) { return [a, b, c, d]; }; }; }; },
542
+ 5: function (a) { return function (b) { return function (c) { return function (d) { return function (e) { return [a, b, c, d, e]; }; }; }; }; }
543
+ };
544
+ function getTupleConstructor(len) {
545
+ if (!_.has.call(tupleConstructors, len)) {
546
+ tupleConstructors[len] = curried(_function.tuple, len - 1, []);
547
+ }
548
+ return tupleConstructors[len];
549
+ }
550
+ function sequenceT(F) {
551
+ return function () {
552
+ var args = [];
553
+ for (var _i = 0; _i < arguments.length; _i++) {
554
+ args[_i] = arguments[_i];
555
+ }
556
+ var len = args.length;
557
+ var f = getTupleConstructor(len);
558
+ var fas = F.map(args[0], f);
559
+ for (var i = 1; i < len; i++) {
560
+ fas = F.ap(fas, args[i]);
561
+ }
562
+ return fas;
563
+ };
564
+ }
565
+ exports.sequenceT = sequenceT;
566
+ function getRecordConstructor(keys) {
567
+ var len = keys.length;
568
+ switch (len) {
569
+ case 1:
570
+ return function (a) {
571
+ var _a;
572
+ return (_a = {}, _a[keys[0]] = a, _a);
573
+ };
574
+ case 2:
575
+ return function (a) { return function (b) {
576
+ var _a;
577
+ return (_a = {}, _a[keys[0]] = a, _a[keys[1]] = b, _a);
578
+ }; };
579
+ case 3:
580
+ return function (a) { return function (b) { return function (c) {
581
+ var _a;
582
+ return (_a = {}, _a[keys[0]] = a, _a[keys[1]] = b, _a[keys[2]] = c, _a);
583
+ }; }; };
584
+ case 4:
585
+ return function (a) { return function (b) { return function (c) { return function (d) {
586
+ var _a;
587
+ return (_a = {},
588
+ _a[keys[0]] = a,
589
+ _a[keys[1]] = b,
590
+ _a[keys[2]] = c,
591
+ _a[keys[3]] = d,
592
+ _a);
593
+ }; }; }; };
594
+ case 5:
595
+ return function (a) { return function (b) { return function (c) { return function (d) { return function (e) {
596
+ var _a;
597
+ return (_a = {},
598
+ _a[keys[0]] = a,
599
+ _a[keys[1]] = b,
600
+ _a[keys[2]] = c,
601
+ _a[keys[3]] = d,
602
+ _a[keys[4]] = e,
603
+ _a);
604
+ }; }; }; }; };
605
+ default:
606
+ return curried(function () {
607
+ var args = [];
608
+ for (var _i = 0; _i < arguments.length; _i++) {
609
+ args[_i] = arguments[_i];
610
+ }
611
+ var r = {};
612
+ for (var i = 0; i < len; i++) {
613
+ r[keys[i]] = args[i];
614
+ }
615
+ return r;
616
+ }, len - 1, []);
617
+ }
618
+ }
619
+ function sequenceS(F) {
620
+ return function (r) {
621
+ var keys = Object.keys(r);
622
+ var len = keys.length;
623
+ var f = getRecordConstructor(keys);
624
+ var fr = F.map(r[keys[0]], f);
625
+ for (var i = 1; i < len; i++) {
626
+ fr = F.ap(fr, r[keys[i]]);
627
+ }
628
+ return fr;
629
+ };
630
+ }
631
+ exports.sequenceS = sequenceS;
632
+ });
633
+
634
+ const Apply$1 = /*@__PURE__*/getDefaultExportFromCjs(Apply);
635
+
636
+ var Functor = createCommonjsModule(function (module, exports) {
637
+ "use strict";
638
+ Object.defineProperty(exports, "__esModule", { value: true });
639
+ exports.getFunctorComposition = exports.bindTo = exports.flap = exports.map = void 0;
640
+ /**
641
+ * A `Functor` is a type constructor which supports a mapping operation `map`.
642
+ *
643
+ * `map` can be used to turn functions `a -> b` into functions `f a -> f b` whose argument and return types use the type
644
+ * constructor `f` to represent some computational context.
645
+ *
646
+ * Instances must satisfy the following laws:
647
+ *
648
+ * 1. Identity: `F.map(fa, a => a) <-> fa`
649
+ * 2. Composition: `F.map(fa, a => bc(ab(a))) <-> F.map(F.map(fa, ab), bc)`
650
+ *
651
+ * @since 2.0.0
652
+ */
653
+
654
+ function map(F, G) {
655
+ return function (f) { return function (fa) { return F.map(fa, function (ga) { return G.map(ga, f); }); }; };
656
+ }
657
+ exports.map = map;
658
+ function flap(F) {
659
+ return function (a) { return function (fab) { return F.map(fab, function (f) { return f(a); }); }; };
660
+ }
661
+ exports.flap = flap;
662
+ function bindTo(F) {
663
+ return function (name) { return function (fa) { return F.map(fa, function (a) {
664
+ var _a;
665
+ return (_a = {}, _a[name] = a, _a);
666
+ }); }; };
667
+ }
668
+ exports.bindTo = bindTo;
669
+ /** @deprecated */
670
+ function getFunctorComposition(F, G) {
671
+ var _map = map(F, G);
672
+ return {
673
+ map: function (fga, f) { return (0, _function.pipe)(fga, _map(f)); }
674
+ };
675
+ }
676
+ exports.getFunctorComposition = getFunctorComposition;
677
+ });
678
+
679
+ const Functor$1 = /*@__PURE__*/getDefaultExportFromCjs(Functor);
680
+
681
+ var Chain = createCommonjsModule(function (module, exports) {
682
+ "use strict";
683
+ Object.defineProperty(exports, "__esModule", { value: true });
684
+ exports.bind = exports.chainFirst = void 0;
685
+ function chainFirst(M) {
686
+ return function (f) { return function (first) { return M.chain(first, function (a) { return M.map(f(a), function () { return a; }); }); }; };
687
+ }
688
+ exports.chainFirst = chainFirst;
689
+ function bind(M) {
690
+ return function (name, f) { return function (ma) { return M.chain(ma, function (a) { return M.map(f(a), function (b) {
691
+ var _a;
692
+ return Object.assign({}, a, (_a = {}, _a[name] = b, _a));
693
+ }); }); }; };
694
+ }
695
+ exports.bind = bind;
696
+ });
697
+
698
+ const Chain$1 = /*@__PURE__*/getDefaultExportFromCjs(Chain);
699
+
700
+ var FromEither = createCommonjsModule(function (module, exports) {
701
+ "use strict";
702
+ /**
703
+ * The `FromEither` type class represents those data types which support errors.
704
+ *
705
+ * @since 2.10.0
706
+ */
707
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
708
+ if (k2 === undefined) k2 = k;
709
+ var desc = Object.getOwnPropertyDescriptor(m, k);
710
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
711
+ desc = { enumerable: true, get: function() { return m[k]; } };
712
+ }
713
+ Object.defineProperty(o, k2, desc);
714
+ }) : (function(o, m, k, k2) {
715
+ if (k2 === undefined) k2 = k;
716
+ o[k2] = m[k];
717
+ }));
718
+ var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
719
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
720
+ }) : function(o, v) {
721
+ o["default"] = v;
722
+ });
723
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
724
+ if (mod && mod.__esModule) return mod;
725
+ var result = {};
726
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
727
+ __setModuleDefault(result, mod);
728
+ return result;
729
+ };
730
+ Object.defineProperty(exports, "__esModule", { value: true });
731
+ exports.filterOrElse = exports.chainFirstEitherK = exports.chainEitherK = exports.fromEitherK = exports.chainOptionK = exports.fromOptionK = exports.fromPredicate = exports.fromOption = void 0;
732
+
733
+
734
+ var _ = __importStar(internal);
735
+ function fromOption(F) {
736
+ return function (onNone) { return function (ma) { return F.fromEither(_.isNone(ma) ? _.left(onNone()) : _.right(ma.value)); }; };
737
+ }
738
+ exports.fromOption = fromOption;
739
+ function fromPredicate(F) {
740
+ return function (predicate, onFalse) { return function (a) {
741
+ return F.fromEither(predicate(a) ? _.right(a) : _.left(onFalse(a)));
742
+ }; };
743
+ }
744
+ exports.fromPredicate = fromPredicate;
745
+ function fromOptionK(F) {
746
+ var fromOptionF = fromOption(F);
747
+ return function (onNone) {
748
+ var from = fromOptionF(onNone);
749
+ return function (f) { return (0, _function.flow)(f, from); };
750
+ };
751
+ }
752
+ exports.fromOptionK = fromOptionK;
753
+ function chainOptionK(F, M) {
754
+ var fromOptionKF = fromOptionK(F);
755
+ return function (onNone) {
756
+ var from = fromOptionKF(onNone);
757
+ return function (f) { return function (ma) { return M.chain(ma, from(f)); }; };
758
+ };
759
+ }
760
+ exports.chainOptionK = chainOptionK;
761
+ function fromEitherK(F) {
762
+ return function (f) { return (0, _function.flow)(f, F.fromEither); };
763
+ }
764
+ exports.fromEitherK = fromEitherK;
765
+ function chainEitherK(F, M) {
766
+ var fromEitherKF = fromEitherK(F);
767
+ return function (f) { return function (ma) { return M.chain(ma, fromEitherKF(f)); }; };
768
+ }
769
+ exports.chainEitherK = chainEitherK;
770
+ function chainFirstEitherK(F, M) {
771
+ return (0, _function.flow)(fromEitherK(F), (0, Chain.chainFirst)(M));
772
+ }
773
+ exports.chainFirstEitherK = chainFirstEitherK;
774
+ function filterOrElse(F, M) {
775
+ return function (predicate, onFalse) { return function (ma) {
776
+ return M.chain(ma, function (a) { return F.fromEither(predicate(a) ? _.right(a) : _.left(onFalse(a))); });
777
+ }; };
778
+ }
779
+ exports.filterOrElse = filterOrElse;
780
+ });
781
+
782
+ const FromEither$1 = /*@__PURE__*/getDefaultExportFromCjs(FromEither);
783
+
784
+ var Magma = createCommonjsModule(function (module, exports) {
785
+ "use strict";
786
+ /**
787
+ * A `Magma` is a pair `(A, concat)` in which `A` is a non-empty set and `concat` is a binary operation on `A`
788
+ *
789
+ * See [Semigroup](https://gcanti.github.io/fp-ts/modules/Semigroup.ts.html) for some instances.
790
+ *
791
+ * @since 2.0.0
792
+ */
793
+ Object.defineProperty(exports, "__esModule", { value: true });
794
+ exports.concatAll = exports.endo = exports.filterSecond = exports.filterFirst = exports.reverse = void 0;
795
+ // -------------------------------------------------------------------------------------
796
+ // combinators
797
+ // -------------------------------------------------------------------------------------
798
+ /**
799
+ * The dual of a `Magma`, obtained by swapping the arguments of `concat`.
800
+ *
801
+ * @example
802
+ * import { reverse, concatAll } from 'fp-ts/Magma'
803
+ * import * as N from 'fp-ts/number'
804
+ *
805
+ * const subAll = concatAll(reverse(N.MagmaSub))(0)
806
+ *
807
+ * assert.deepStrictEqual(subAll([1, 2, 3]), 2)
808
+ *
809
+ * @category combinators
810
+ * @since 2.11.0
811
+ */
812
+ var reverse = function (M) { return ({
813
+ concat: function (first, second) { return M.concat(second, first); }
814
+ }); };
815
+ exports.reverse = reverse;
816
+ /**
817
+ * @category combinators
818
+ * @since 2.11.0
819
+ */
820
+ var filterFirst = function (predicate) { return function (M) { return ({
821
+ concat: function (first, second) { return (predicate(first) ? M.concat(first, second) : second); }
822
+ }); }; };
823
+ exports.filterFirst = filterFirst;
824
+ /**
825
+ * @category combinators
826
+ * @since 2.11.0
827
+ */
828
+ var filterSecond = function (predicate) { return function (M) { return ({
829
+ concat: function (first, second) { return (predicate(second) ? M.concat(first, second) : first); }
830
+ }); }; };
831
+ exports.filterSecond = filterSecond;
832
+ /**
833
+ * @category combinators
834
+ * @since 2.11.0
835
+ */
836
+ var endo = function (f) { return function (M) { return ({
837
+ concat: function (first, second) { return M.concat(f(first), f(second)); }
838
+ }); }; };
839
+ exports.endo = endo;
840
+ // -------------------------------------------------------------------------------------
841
+ // utils
842
+ // -------------------------------------------------------------------------------------
843
+ /**
844
+ * Given a sequence of `as`, concat them and return the total.
845
+ *
846
+ * If `as` is empty, return the provided `startWith` value.
847
+ *
848
+ * @example
849
+ * import { concatAll } from 'fp-ts/Magma'
850
+ * import * as N from 'fp-ts/number'
851
+ *
852
+ * const subAll = concatAll(N.MagmaSub)(0)
853
+ *
854
+ * assert.deepStrictEqual(subAll([1, 2, 3]), -6)
855
+ *
856
+ * @since 2.11.0
857
+ */
858
+ var concatAll = function (M) { return function (startWith) { return function (as) {
859
+ return as.reduce(function (a, acc) { return M.concat(a, acc); }, startWith);
860
+ }; }; };
861
+ exports.concatAll = concatAll;
862
+ });
863
+
864
+ const Magma$1 = /*@__PURE__*/getDefaultExportFromCjs(Magma);
865
+
866
+ var Eq = createCommonjsModule(function (module, exports) {
867
+ "use strict";
868
+ Object.defineProperty(exports, "__esModule", { value: true });
869
+ exports.eqDate = exports.eqNumber = exports.eqString = exports.eqBoolean = exports.eq = exports.strictEqual = exports.getStructEq = exports.getTupleEq = exports.Contravariant = exports.getMonoid = exports.getSemigroup = exports.eqStrict = exports.URI = exports.contramap = exports.tuple = exports.struct = exports.fromEquals = void 0;
870
+
871
+ // -------------------------------------------------------------------------------------
872
+ // constructors
873
+ // -------------------------------------------------------------------------------------
874
+ /**
875
+ * @category constructors
876
+ * @since 2.0.0
877
+ */
878
+ var fromEquals = function (equals) { return ({
879
+ equals: function (x, y) { return x === y || equals(x, y); }
880
+ }); };
881
+ exports.fromEquals = fromEquals;
882
+ // -------------------------------------------------------------------------------------
883
+ // combinators
884
+ // -------------------------------------------------------------------------------------
885
+ /**
886
+ * @category combinators
887
+ * @since 2.10.0
888
+ */
889
+ var struct = function (eqs) {
890
+ return (0, exports.fromEquals)(function (first, second) {
891
+ for (var key in eqs) {
892
+ if (!eqs[key].equals(first[key], second[key])) {
893
+ return false;
894
+ }
895
+ }
896
+ return true;
897
+ });
898
+ };
899
+ exports.struct = struct;
900
+ /**
901
+ * Given a tuple of `Eq`s returns a `Eq` for the tuple
902
+ *
903
+ * @example
904
+ * import { tuple } from 'fp-ts/Eq'
905
+ * import * as S from 'fp-ts/string'
906
+ * import * as N from 'fp-ts/number'
907
+ * import * as B from 'fp-ts/boolean'
908
+ *
909
+ * const E = tuple(S.Eq, N.Eq, B.Eq)
910
+ * assert.strictEqual(E.equals(['a', 1, true], ['a', 1, true]), true)
911
+ * assert.strictEqual(E.equals(['a', 1, true], ['b', 1, true]), false)
912
+ * assert.strictEqual(E.equals(['a', 1, true], ['a', 2, true]), false)
913
+ * assert.strictEqual(E.equals(['a', 1, true], ['a', 1, false]), false)
914
+ *
915
+ * @category combinators
916
+ * @since 2.10.0
917
+ */
918
+ var tuple = function () {
919
+ var eqs = [];
920
+ for (var _i = 0; _i < arguments.length; _i++) {
921
+ eqs[_i] = arguments[_i];
922
+ }
923
+ return (0, exports.fromEquals)(function (first, second) { return eqs.every(function (E, i) { return E.equals(first[i], second[i]); }); });
924
+ };
925
+ exports.tuple = tuple;
926
+ // -------------------------------------------------------------------------------------
927
+ // non-pipeables
928
+ // -------------------------------------------------------------------------------------
929
+ /* istanbul ignore next */
930
+ var contramap_ = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.contramap)(f)); };
931
+ // -------------------------------------------------------------------------------------
932
+ // type class members
933
+ // -------------------------------------------------------------------------------------
934
+ /**
935
+ * @category Contravariant
936
+ * @since 2.0.0
937
+ */
938
+ var contramap = function (f) { return function (fa) {
939
+ return (0, exports.fromEquals)(function (x, y) { return fa.equals(f(x), f(y)); });
940
+ }; };
941
+ exports.contramap = contramap;
942
+ // -------------------------------------------------------------------------------------
943
+ // instances
944
+ // -------------------------------------------------------------------------------------
945
+ /**
946
+ * @category instances
947
+ * @since 2.0.0
948
+ */
949
+ exports.URI = 'Eq';
950
+ /**
951
+ * @category instances
952
+ * @since 2.5.0
953
+ */
954
+ exports.eqStrict = {
955
+ equals: function (a, b) { return a === b; }
956
+ };
957
+ var empty = {
958
+ equals: function () { return true; }
959
+ };
960
+ /**
961
+ * @category instances
962
+ * @since 2.10.0
963
+ */
964
+ var getSemigroup = function () { return ({
965
+ concat: function (x, y) { return (0, exports.fromEquals)(function (a, b) { return x.equals(a, b) && y.equals(a, b); }); }
966
+ }); };
967
+ exports.getSemigroup = getSemigroup;
968
+ /**
969
+ * @category instances
970
+ * @since 2.6.0
971
+ */
972
+ var getMonoid = function () { return ({
973
+ concat: (0, exports.getSemigroup)().concat,
974
+ empty: empty
975
+ }); };
976
+ exports.getMonoid = getMonoid;
977
+ /**
978
+ * @category instances
979
+ * @since 2.7.0
980
+ */
981
+ exports.Contravariant = {
982
+ URI: exports.URI,
983
+ contramap: contramap_
984
+ };
985
+ // -------------------------------------------------------------------------------------
986
+ // deprecated
987
+ // -------------------------------------------------------------------------------------
988
+ /**
989
+ * Use [`tuple`](#tuple) instead.
990
+ *
991
+ * @category combinators
992
+ * @since 2.0.0
993
+ * @deprecated
994
+ */
995
+ exports.getTupleEq = exports.tuple;
996
+ /**
997
+ * Use [`struct`](#struct) instead.
998
+ *
999
+ * @category combinators
1000
+ * @since 2.0.0
1001
+ * @deprecated
1002
+ */
1003
+ exports.getStructEq = exports.struct;
1004
+ /**
1005
+ * Use [`eqStrict`](#eqstrict) instead
1006
+ *
1007
+ * @since 2.0.0
1008
+ * @deprecated
1009
+ */
1010
+ exports.strictEqual = exports.eqStrict.equals;
1011
+ /**
1012
+ * This instance is deprecated, use small, specific instances instead.
1013
+ * For example if a function needs a `Contravariant` instance, pass `E.Contravariant` instead of `E.eq`
1014
+ * (where `E` is from `import E from 'fp-ts/Eq'`)
1015
+ *
1016
+ * @category instances
1017
+ * @since 2.0.0
1018
+ * @deprecated
1019
+ */
1020
+ exports.eq = exports.Contravariant;
1021
+ /**
1022
+ * Use [`Eq`](./boolean.ts.html#eq) instead.
1023
+ *
1024
+ * @category instances
1025
+ * @since 2.0.0
1026
+ * @deprecated
1027
+ */
1028
+ exports.eqBoolean = exports.eqStrict;
1029
+ /**
1030
+ * Use [`Eq`](./string.ts.html#eq) instead.
1031
+ *
1032
+ * @category instances
1033
+ * @since 2.0.0
1034
+ * @deprecated
1035
+ */
1036
+ exports.eqString = exports.eqStrict;
1037
+ /**
1038
+ * Use [`Eq`](./number.ts.html#eq) instead.
1039
+ *
1040
+ * @category instances
1041
+ * @since 2.0.0
1042
+ * @deprecated
1043
+ */
1044
+ exports.eqNumber = exports.eqStrict;
1045
+ /**
1046
+ * Use [`Eq`](./Date.ts.html#eq) instead.
1047
+ *
1048
+ * @category instances
1049
+ * @since 2.0.0
1050
+ * @deprecated
1051
+ */
1052
+ exports.eqDate = {
1053
+ equals: function (first, second) { return first.valueOf() === second.valueOf(); }
1054
+ };
1055
+ });
1056
+
1057
+ const Eq$1 = /*@__PURE__*/getDefaultExportFromCjs(Eq);
1058
+
1059
+ var Ord = createCommonjsModule(function (module, exports) {
1060
+ "use strict";
1061
+ Object.defineProperty(exports, "__esModule", { value: true });
1062
+ exports.ordDate = exports.ordNumber = exports.ordString = exports.ordBoolean = exports.ord = exports.getDualOrd = exports.getTupleOrd = exports.between = exports.clamp = exports.max = exports.min = exports.geq = exports.leq = exports.gt = exports.lt = exports.equals = exports.trivial = exports.Contravariant = exports.getMonoid = exports.getSemigroup = exports.URI = exports.contramap = exports.reverse = exports.tuple = exports.fromCompare = exports.equalsDefault = void 0;
1063
+
1064
+
1065
+ // -------------------------------------------------------------------------------------
1066
+ // defaults
1067
+ // -------------------------------------------------------------------------------------
1068
+ /**
1069
+ * @category defaults
1070
+ * @since 2.10.0
1071
+ */
1072
+ var equalsDefault = function (compare) { return function (first, second) {
1073
+ return first === second || compare(first, second) === 0;
1074
+ }; };
1075
+ exports.equalsDefault = equalsDefault;
1076
+ // -------------------------------------------------------------------------------------
1077
+ // constructors
1078
+ // -------------------------------------------------------------------------------------
1079
+ /**
1080
+ * @category constructors
1081
+ * @since 2.0.0
1082
+ */
1083
+ var fromCompare = function (compare) { return ({
1084
+ equals: (0, exports.equalsDefault)(compare),
1085
+ compare: function (first, second) { return (first === second ? 0 : compare(first, second)); }
1086
+ }); };
1087
+ exports.fromCompare = fromCompare;
1088
+ // -------------------------------------------------------------------------------------
1089
+ // combinators
1090
+ // -------------------------------------------------------------------------------------
1091
+ /**
1092
+ * Given a tuple of `Ord`s returns an `Ord` for the tuple.
1093
+ *
1094
+ * @example
1095
+ * import { tuple } from 'fp-ts/Ord'
1096
+ * import * as B from 'fp-ts/boolean'
1097
+ * import * as S from 'fp-ts/string'
1098
+ * import * as N from 'fp-ts/number'
1099
+ *
1100
+ * const O = tuple(S.Ord, N.Ord, B.Ord)
1101
+ * assert.strictEqual(O.compare(['a', 1, true], ['b', 2, true]), -1)
1102
+ * assert.strictEqual(O.compare(['a', 1, true], ['a', 2, true]), -1)
1103
+ * assert.strictEqual(O.compare(['a', 1, true], ['a', 1, false]), 1)
1104
+ *
1105
+ * @category combinators
1106
+ * @since 2.10.0
1107
+ */
1108
+ var tuple = function () {
1109
+ var ords = [];
1110
+ for (var _i = 0; _i < arguments.length; _i++) {
1111
+ ords[_i] = arguments[_i];
1112
+ }
1113
+ return (0, exports.fromCompare)(function (first, second) {
1114
+ var i = 0;
1115
+ for (; i < ords.length - 1; i++) {
1116
+ var r = ords[i].compare(first[i], second[i]);
1117
+ if (r !== 0) {
1118
+ return r;
1119
+ }
1120
+ }
1121
+ return ords[i].compare(first[i], second[i]);
1122
+ });
1123
+ };
1124
+ exports.tuple = tuple;
1125
+ /**
1126
+ * @category combinators
1127
+ * @since 2.10.0
1128
+ */
1129
+ var reverse = function (O) { return (0, exports.fromCompare)(function (first, second) { return O.compare(second, first); }); };
1130
+ exports.reverse = reverse;
1131
+ // -------------------------------------------------------------------------------------
1132
+ // non-pipeables
1133
+ // -------------------------------------------------------------------------------------
1134
+ /* istanbul ignore next */
1135
+ var contramap_ = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.contramap)(f)); };
1136
+ // -------------------------------------------------------------------------------------
1137
+ // type class members
1138
+ // -------------------------------------------------------------------------------------
1139
+ /**
1140
+ * @category Contravariant
1141
+ * @since 2.0.0
1142
+ */
1143
+ var contramap = function (f) { return function (fa) {
1144
+ return (0, exports.fromCompare)(function (first, second) { return fa.compare(f(first), f(second)); });
1145
+ }; };
1146
+ exports.contramap = contramap;
1147
+ // -------------------------------------------------------------------------------------
1148
+ // instances
1149
+ // -------------------------------------------------------------------------------------
1150
+ /**
1151
+ * @category instances
1152
+ * @since 2.0.0
1153
+ */
1154
+ exports.URI = 'Ord';
1155
+ /**
1156
+ * @category instances
1157
+ * @since 2.0.0
1158
+ */
1159
+ var getSemigroup = function () { return ({
1160
+ concat: function (first, second) {
1161
+ return (0, exports.fromCompare)(function (a, b) {
1162
+ var ox = first.compare(a, b);
1163
+ return ox !== 0 ? ox : second.compare(a, b);
1164
+ });
1165
+ }
1166
+ }); };
1167
+ exports.getSemigroup = getSemigroup;
1168
+ /**
1169
+ * Returns a `Monoid` such that:
1170
+ *
1171
+ * - its `concat(ord1, ord2)` operation will order first by `ord1`, and then by `ord2`
1172
+ * - its `empty` value is an `Ord` that always considers compared elements equal
1173
+ *
1174
+ * @example
1175
+ * import { sort } from 'fp-ts/Array'
1176
+ * import { contramap, reverse, getMonoid } from 'fp-ts/Ord'
1177
+ * import * as S from 'fp-ts/string'
1178
+ * import * as B from 'fp-ts/boolean'
1179
+ * import { pipe } from 'fp-ts/function'
1180
+ * import { concatAll } from 'fp-ts/Monoid'
1181
+ * import * as N from 'fp-ts/number'
1182
+ *
1183
+ * interface User {
1184
+ * readonly id: number
1185
+ * readonly name: string
1186
+ * readonly age: number
1187
+ * readonly rememberMe: boolean
1188
+ * }
1189
+ *
1190
+ * const byName = pipe(
1191
+ * S.Ord,
1192
+ * contramap((p: User) => p.name)
1193
+ * )
1194
+ *
1195
+ * const byAge = pipe(
1196
+ * N.Ord,
1197
+ * contramap((p: User) => p.age)
1198
+ * )
1199
+ *
1200
+ * const byRememberMe = pipe(
1201
+ * B.Ord,
1202
+ * contramap((p: User) => p.rememberMe)
1203
+ * )
1204
+ *
1205
+ * const M = getMonoid<User>()
1206
+ *
1207
+ * const users: Array<User> = [
1208
+ * { id: 1, name: 'Guido', age: 47, rememberMe: false },
1209
+ * { id: 2, name: 'Guido', age: 46, rememberMe: true },
1210
+ * { id: 3, name: 'Giulio', age: 44, rememberMe: false },
1211
+ * { id: 4, name: 'Giulio', age: 44, rememberMe: true }
1212
+ * ]
1213
+ *
1214
+ * // sort by name, then by age, then by `rememberMe`
1215
+ * const O1 = concatAll(M)([byName, byAge, byRememberMe])
1216
+ * assert.deepStrictEqual(sort(O1)(users), [
1217
+ * { id: 3, name: 'Giulio', age: 44, rememberMe: false },
1218
+ * { id: 4, name: 'Giulio', age: 44, rememberMe: true },
1219
+ * { id: 2, name: 'Guido', age: 46, rememberMe: true },
1220
+ * { id: 1, name: 'Guido', age: 47, rememberMe: false }
1221
+ * ])
1222
+ *
1223
+ * // now `rememberMe = true` first, then by name, then by age
1224
+ * const O2 = concatAll(M)([reverse(byRememberMe), byName, byAge])
1225
+ * assert.deepStrictEqual(sort(O2)(users), [
1226
+ * { id: 4, name: 'Giulio', age: 44, rememberMe: true },
1227
+ * { id: 2, name: 'Guido', age: 46, rememberMe: true },
1228
+ * { id: 3, name: 'Giulio', age: 44, rememberMe: false },
1229
+ * { id: 1, name: 'Guido', age: 47, rememberMe: false }
1230
+ * ])
1231
+ *
1232
+ * @category instances
1233
+ * @since 2.4.0
1234
+ */
1235
+ var getMonoid = function () { return ({
1236
+ concat: (0, exports.getSemigroup)().concat,
1237
+ empty: (0, exports.fromCompare)(function () { return 0; })
1238
+ }); };
1239
+ exports.getMonoid = getMonoid;
1240
+ /**
1241
+ * @category instances
1242
+ * @since 2.7.0
1243
+ */
1244
+ exports.Contravariant = {
1245
+ URI: exports.URI,
1246
+ contramap: contramap_
1247
+ };
1248
+ // -------------------------------------------------------------------------------------
1249
+ // utils
1250
+ // -------------------------------------------------------------------------------------
1251
+ /**
1252
+ * @since 2.11.0
1253
+ */
1254
+ exports.trivial = {
1255
+ equals: _function.constTrue,
1256
+ compare: /*#__PURE__*/ (0, _function.constant)(0)
1257
+ };
1258
+ /**
1259
+ * @since 2.11.0
1260
+ */
1261
+ var equals = function (O) { return function (second) { return function (first) {
1262
+ return first === second || O.compare(first, second) === 0;
1263
+ }; }; };
1264
+ exports.equals = equals;
1265
+ // TODO: curry in v3
1266
+ /**
1267
+ * Test whether one value is _strictly less than_ another
1268
+ *
1269
+ * @since 2.0.0
1270
+ */
1271
+ var lt = function (O) { return function (first, second) { return O.compare(first, second) === -1; }; };
1272
+ exports.lt = lt;
1273
+ // TODO: curry in v3
1274
+ /**
1275
+ * Test whether one value is _strictly greater than_ another
1276
+ *
1277
+ * @since 2.0.0
1278
+ */
1279
+ var gt = function (O) { return function (first, second) { return O.compare(first, second) === 1; }; };
1280
+ exports.gt = gt;
1281
+ // TODO: curry in v3
1282
+ /**
1283
+ * Test whether one value is _non-strictly less than_ another
1284
+ *
1285
+ * @since 2.0.0
1286
+ */
1287
+ var leq = function (O) { return function (first, second) { return O.compare(first, second) !== 1; }; };
1288
+ exports.leq = leq;
1289
+ // TODO: curry in v3
1290
+ /**
1291
+ * Test whether one value is _non-strictly greater than_ another
1292
+ *
1293
+ * @since 2.0.0
1294
+ */
1295
+ var geq = function (O) { return function (first, second) { return O.compare(first, second) !== -1; }; };
1296
+ exports.geq = geq;
1297
+ // TODO: curry in v3
1298
+ /**
1299
+ * Take the minimum of two values. If they are considered equal, the first argument is chosen
1300
+ *
1301
+ * @since 2.0.0
1302
+ */
1303
+ var min = function (O) { return function (first, second) {
1304
+ return first === second || O.compare(first, second) < 1 ? first : second;
1305
+ }; };
1306
+ exports.min = min;
1307
+ // TODO: curry in v3
1308
+ /**
1309
+ * Take the maximum of two values. If they are considered equal, the first argument is chosen
1310
+ *
1311
+ * @since 2.0.0
1312
+ */
1313
+ var max = function (O) { return function (first, second) {
1314
+ return first === second || O.compare(first, second) > -1 ? first : second;
1315
+ }; };
1316
+ exports.max = max;
1317
+ /**
1318
+ * Clamp a value between a minimum and a maximum
1319
+ *
1320
+ * @since 2.0.0
1321
+ */
1322
+ var clamp = function (O) {
1323
+ var minO = (0, exports.min)(O);
1324
+ var maxO = (0, exports.max)(O);
1325
+ return function (low, hi) { return function (a) { return maxO(minO(a, hi), low); }; };
1326
+ };
1327
+ exports.clamp = clamp;
1328
+ /**
1329
+ * Test whether a value is between a minimum and a maximum (inclusive)
1330
+ *
1331
+ * @since 2.0.0
1332
+ */
1333
+ var between = function (O) {
1334
+ var ltO = (0, exports.lt)(O);
1335
+ var gtO = (0, exports.gt)(O);
1336
+ return function (low, hi) { return function (a) { return (ltO(a, low) || gtO(a, hi) ? false : true); }; };
1337
+ };
1338
+ exports.between = between;
1339
+ // -------------------------------------------------------------------------------------
1340
+ // deprecated
1341
+ // -------------------------------------------------------------------------------------
1342
+ /**
1343
+ * Use [`tuple`](#tuple) instead.
1344
+ *
1345
+ * @category combinators
1346
+ * @since 2.0.0
1347
+ * @deprecated
1348
+ */
1349
+ exports.getTupleOrd = exports.tuple;
1350
+ /**
1351
+ * Use [`reverse`](#reverse) instead.
1352
+ *
1353
+ * @category combinators
1354
+ * @since 2.0.0
1355
+ * @deprecated
1356
+ */
1357
+ exports.getDualOrd = exports.reverse;
1358
+ /**
1359
+ * Use [`Contravariant`](#contravariant) instead.
1360
+ *
1361
+ * @category instances
1362
+ * @since 2.0.0
1363
+ * @deprecated
1364
+ */
1365
+ exports.ord = exports.Contravariant;
1366
+ // default compare for primitive types
1367
+ function compare(first, second) {
1368
+ return first < second ? -1 : first > second ? 1 : 0;
1369
+ }
1370
+ var strictOrd = {
1371
+ equals: Eq.eqStrict.equals,
1372
+ compare: compare
1373
+ };
1374
+ /**
1375
+ * Use [`Ord`](./boolean.ts.html#ord) instead.
1376
+ *
1377
+ * @category instances
1378
+ * @since 2.0.0
1379
+ * @deprecated
1380
+ */
1381
+ exports.ordBoolean = strictOrd;
1382
+ /**
1383
+ * Use [`Ord`](./string.ts.html#ord) instead.
1384
+ *
1385
+ * @category instances
1386
+ * @since 2.0.0
1387
+ * @deprecated
1388
+ */
1389
+ exports.ordString = strictOrd;
1390
+ /**
1391
+ * Use [`Ord`](./number.ts.html#ord) instead.
1392
+ *
1393
+ * @category instances
1394
+ * @since 2.0.0
1395
+ * @deprecated
1396
+ */
1397
+ exports.ordNumber = strictOrd;
1398
+ /**
1399
+ * Use [`Ord`](./Date.ts.html#ord) instead.
1400
+ *
1401
+ * @category instances
1402
+ * @since 2.0.0
1403
+ * @deprecated
1404
+ */
1405
+ exports.ordDate = (0, _function.pipe)(exports.ordNumber,
1406
+ /*#__PURE__*/
1407
+ (0, exports.contramap)(function (date) { return date.valueOf(); }));
1408
+ });
1409
+
1410
+ const Ord$1 = /*@__PURE__*/getDefaultExportFromCjs(Ord);
1411
+
1412
+ var Semigroup = createCommonjsModule(function (module, exports) {
1413
+ "use strict";
1414
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1415
+ if (k2 === undefined) k2 = k;
1416
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1417
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1418
+ desc = { enumerable: true, get: function() { return m[k]; } };
1419
+ }
1420
+ Object.defineProperty(o, k2, desc);
1421
+ }) : (function(o, m, k, k2) {
1422
+ if (k2 === undefined) k2 = k;
1423
+ o[k2] = m[k];
1424
+ }));
1425
+ var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
1426
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
1427
+ }) : function(o, v) {
1428
+ o["default"] = v;
1429
+ });
1430
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
1431
+ if (mod && mod.__esModule) return mod;
1432
+ var result = {};
1433
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1434
+ __setModuleDefault(result, mod);
1435
+ return result;
1436
+ };
1437
+ Object.defineProperty(exports, "__esModule", { value: true });
1438
+ exports.semigroupProduct = exports.semigroupSum = exports.semigroupString = exports.getFunctionSemigroup = exports.semigroupAny = exports.semigroupAll = exports.fold = exports.getIntercalateSemigroup = exports.getMeetSemigroup = exports.getJoinSemigroup = exports.getDualSemigroup = exports.getStructSemigroup = exports.getTupleSemigroup = exports.getFirstSemigroup = exports.getLastSemigroup = exports.getObjectSemigroup = exports.semigroupVoid = exports.concatAll = exports.last = exports.first = exports.intercalate = exports.tuple = exports.struct = exports.reverse = exports.constant = exports.max = exports.min = void 0;
1439
+ /**
1440
+ * If a type `A` can form a `Semigroup` it has an **associative** binary operation.
1441
+ *
1442
+ * ```ts
1443
+ * interface Semigroup<A> {
1444
+ * readonly concat: (x: A, y: A) => A
1445
+ * }
1446
+ * ```
1447
+ *
1448
+ * Associativity means the following equality must hold for any choice of `x`, `y`, and `z`.
1449
+ *
1450
+ * ```ts
1451
+ * concat(x, concat(y, z)) = concat(concat(x, y), z)
1452
+ * ```
1453
+ *
1454
+ * A common example of a semigroup is the type `string` with the operation `+`.
1455
+ *
1456
+ * ```ts
1457
+ * import { Semigroup } from 'fp-ts/Semigroup'
1458
+ *
1459
+ * const semigroupString: Semigroup<string> = {
1460
+ * concat: (x, y) => x + y
1461
+ * }
1462
+ *
1463
+ * const x = 'x'
1464
+ * const y = 'y'
1465
+ * const z = 'z'
1466
+ *
1467
+ * semigroupString.concat(x, y) // 'xy'
1468
+ *
1469
+ * semigroupString.concat(x, semigroupString.concat(y, z)) // 'xyz'
1470
+ *
1471
+ * semigroupString.concat(semigroupString.concat(x, y), z) // 'xyz'
1472
+ * ```
1473
+ *
1474
+ * *Adapted from https://typelevel.org/cats*
1475
+ *
1476
+ * @since 2.0.0
1477
+ */
1478
+
1479
+ var _ = __importStar(internal);
1480
+ var M = __importStar(Magma);
1481
+ var Or = __importStar(Ord);
1482
+ // -------------------------------------------------------------------------------------
1483
+ // constructors
1484
+ // -------------------------------------------------------------------------------------
1485
+ /**
1486
+ * Get a semigroup where `concat` will return the minimum, based on the provided order.
1487
+ *
1488
+ * @example
1489
+ * import * as N from 'fp-ts/number'
1490
+ * import * as S from 'fp-ts/Semigroup'
1491
+ *
1492
+ * const S1 = S.min(N.Ord)
1493
+ *
1494
+ * assert.deepStrictEqual(S1.concat(1, 2), 1)
1495
+ *
1496
+ * @category constructors
1497
+ * @since 2.10.0
1498
+ */
1499
+ var min = function (O) { return ({
1500
+ concat: Or.min(O)
1501
+ }); };
1502
+ exports.min = min;
1503
+ /**
1504
+ * Get a semigroup where `concat` will return the maximum, based on the provided order.
1505
+ *
1506
+ * @example
1507
+ * import * as N from 'fp-ts/number'
1508
+ * import * as S from 'fp-ts/Semigroup'
1509
+ *
1510
+ * const S1 = S.max(N.Ord)
1511
+ *
1512
+ * assert.deepStrictEqual(S1.concat(1, 2), 2)
1513
+ *
1514
+ * @category constructors
1515
+ * @since 2.10.0
1516
+ */
1517
+ var max = function (O) { return ({
1518
+ concat: Or.max(O)
1519
+ }); };
1520
+ exports.max = max;
1521
+ /**
1522
+ * @category constructors
1523
+ * @since 2.10.0
1524
+ */
1525
+ var constant = function (a) { return ({
1526
+ concat: function () { return a; }
1527
+ }); };
1528
+ exports.constant = constant;
1529
+ // -------------------------------------------------------------------------------------
1530
+ // combinators
1531
+ // -------------------------------------------------------------------------------------
1532
+ /**
1533
+ * The dual of a `Semigroup`, obtained by swapping the arguments of `concat`.
1534
+ *
1535
+ * @example
1536
+ * import { reverse } from 'fp-ts/Semigroup'
1537
+ * import * as S from 'fp-ts/string'
1538
+ *
1539
+ * assert.deepStrictEqual(reverse(S.Semigroup).concat('a', 'b'), 'ba')
1540
+ *
1541
+ * @category combinators
1542
+ * @since 2.10.0
1543
+ */
1544
+ exports.reverse = M.reverse;
1545
+ /**
1546
+ * Given a struct of semigroups returns a semigroup for the struct.
1547
+ *
1548
+ * @example
1549
+ * import { struct } from 'fp-ts/Semigroup'
1550
+ * import * as N from 'fp-ts/number'
1551
+ *
1552
+ * interface Point {
1553
+ * readonly x: number
1554
+ * readonly y: number
1555
+ * }
1556
+ *
1557
+ * const S = struct<Point>({
1558
+ * x: N.SemigroupSum,
1559
+ * y: N.SemigroupSum
1560
+ * })
1561
+ *
1562
+ * assert.deepStrictEqual(S.concat({ x: 1, y: 2 }, { x: 3, y: 4 }), { x: 4, y: 6 })
1563
+ *
1564
+ * @category combinators
1565
+ * @since 2.10.0
1566
+ */
1567
+ var struct = function (semigroups) { return ({
1568
+ concat: function (first, second) {
1569
+ var r = {};
1570
+ for (var k in semigroups) {
1571
+ if (_.has.call(semigroups, k)) {
1572
+ r[k] = semigroups[k].concat(first[k], second[k]);
1573
+ }
1574
+ }
1575
+ return r;
1576
+ }
1577
+ }); };
1578
+ exports.struct = struct;
1579
+ /**
1580
+ * Given a tuple of semigroups returns a semigroup for the tuple.
1581
+ *
1582
+ * @example
1583
+ * import { tuple } from 'fp-ts/Semigroup'
1584
+ * import * as B from 'fp-ts/boolean'
1585
+ * import * as N from 'fp-ts/number'
1586
+ * import * as S from 'fp-ts/string'
1587
+ *
1588
+ * const S1 = tuple(S.Semigroup, N.SemigroupSum)
1589
+ * assert.deepStrictEqual(S1.concat(['a', 1], ['b', 2]), ['ab', 3])
1590
+ *
1591
+ * const S2 = tuple(S.Semigroup, N.SemigroupSum, B.SemigroupAll)
1592
+ * assert.deepStrictEqual(S2.concat(['a', 1, true], ['b', 2, false]), ['ab', 3, false])
1593
+ *
1594
+ * @category combinators
1595
+ * @since 2.10.0
1596
+ */
1597
+ var tuple = function () {
1598
+ var semigroups = [];
1599
+ for (var _i = 0; _i < arguments.length; _i++) {
1600
+ semigroups[_i] = arguments[_i];
1601
+ }
1602
+ return ({
1603
+ concat: function (first, second) { return semigroups.map(function (s, i) { return s.concat(first[i], second[i]); }); }
1604
+ });
1605
+ };
1606
+ exports.tuple = tuple;
1607
+ /**
1608
+ * Between each pair of elements insert `middle`.
1609
+ *
1610
+ * @example
1611
+ * import { intercalate } from 'fp-ts/Semigroup'
1612
+ * import * as S from 'fp-ts/string'
1613
+ * import { pipe } from 'fp-ts/function'
1614
+ *
1615
+ * const S1 = pipe(S.Semigroup, intercalate(' + '))
1616
+ *
1617
+ * assert.strictEqual(S1.concat('a', 'b'), 'a + b')
1618
+ *
1619
+ * @category combinators
1620
+ * @since 2.10.0
1621
+ */
1622
+ var intercalate = function (middle) { return function (S) { return ({
1623
+ concat: function (x, y) { return S.concat(x, S.concat(middle, y)); }
1624
+ }); }; };
1625
+ exports.intercalate = intercalate;
1626
+ // -------------------------------------------------------------------------------------
1627
+ // instances
1628
+ // -------------------------------------------------------------------------------------
1629
+ /**
1630
+ * Always return the first argument.
1631
+ *
1632
+ * @example
1633
+ * import * as S from 'fp-ts/Semigroup'
1634
+ *
1635
+ * assert.deepStrictEqual(S.first<number>().concat(1, 2), 1)
1636
+ *
1637
+ * @category instances
1638
+ * @since 2.10.0
1639
+ */
1640
+ var first = function () { return ({ concat: _function.identity }); };
1641
+ exports.first = first;
1642
+ /**
1643
+ * Always return the last argument.
1644
+ *
1645
+ * @example
1646
+ * import * as S from 'fp-ts/Semigroup'
1647
+ *
1648
+ * assert.deepStrictEqual(S.last<number>().concat(1, 2), 2)
1649
+ *
1650
+ * @category instances
1651
+ * @since 2.10.0
1652
+ */
1653
+ var last = function () { return ({ concat: function (_, y) { return y; } }); };
1654
+ exports.last = last;
1655
+ // -------------------------------------------------------------------------------------
1656
+ // utils
1657
+ // -------------------------------------------------------------------------------------
1658
+ /**
1659
+ * Given a sequence of `as`, concat them and return the total.
1660
+ *
1661
+ * If `as` is empty, return the provided `startWith` value.
1662
+ *
1663
+ * @example
1664
+ * import { concatAll } from 'fp-ts/Semigroup'
1665
+ * import * as N from 'fp-ts/number'
1666
+ *
1667
+ * const sum = concatAll(N.SemigroupSum)(0)
1668
+ *
1669
+ * assert.deepStrictEqual(sum([1, 2, 3]), 6)
1670
+ * assert.deepStrictEqual(sum([]), 0)
1671
+ *
1672
+ * @since 2.10.0
1673
+ */
1674
+ exports.concatAll = M.concatAll;
1675
+ // -------------------------------------------------------------------------------------
1676
+ // deprecated
1677
+ // -------------------------------------------------------------------------------------
1678
+ /**
1679
+ * Use `void` module instead.
1680
+ *
1681
+ * @category instances
1682
+ * @since 2.0.0
1683
+ * @deprecated
1684
+ */
1685
+ exports.semigroupVoid = (0, exports.constant)(undefined);
1686
+ /**
1687
+ * Use [`getAssignSemigroup`](./struct.ts.html#getAssignSemigroup) instead.
1688
+ *
1689
+ * @category instances
1690
+ * @since 2.0.0
1691
+ * @deprecated
1692
+ */
1693
+ var getObjectSemigroup = function () { return ({
1694
+ concat: function (first, second) { return Object.assign({}, first, second); }
1695
+ }); };
1696
+ exports.getObjectSemigroup = getObjectSemigroup;
1697
+ /**
1698
+ * Use [`last`](#last) instead.
1699
+ *
1700
+ * @category instances
1701
+ * @since 2.0.0
1702
+ * @deprecated
1703
+ */
1704
+ exports.getLastSemigroup = exports.last;
1705
+ /**
1706
+ * Use [`first`](#first) instead.
1707
+ *
1708
+ * @category instances
1709
+ * @since 2.0.0
1710
+ * @deprecated
1711
+ */
1712
+ exports.getFirstSemigroup = exports.first;
1713
+ /**
1714
+ * Use [`tuple`](#tuple) instead.
1715
+ *
1716
+ * @category combinators
1717
+ * @since 2.0.0
1718
+ * @deprecated
1719
+ */
1720
+ exports.getTupleSemigroup = exports.tuple;
1721
+ /**
1722
+ * Use [`struct`](#struct) instead.
1723
+ *
1724
+ * @category combinators
1725
+ * @since 2.0.0
1726
+ * @deprecated
1727
+ */
1728
+ exports.getStructSemigroup = exports.struct;
1729
+ /**
1730
+ * Use [`reverse`](#reverse) instead.
1731
+ *
1732
+ * @category combinators
1733
+ * @since 2.0.0
1734
+ * @deprecated
1735
+ */
1736
+ exports.getDualSemigroup = exports.reverse;
1737
+ /**
1738
+ * Use [`max`](#max) instead.
1739
+ *
1740
+ * @category constructors
1741
+ * @since 2.0.0
1742
+ * @deprecated
1743
+ */
1744
+ exports.getJoinSemigroup = exports.max;
1745
+ /**
1746
+ * Use [`min`](#min) instead.
1747
+ *
1748
+ * @category constructors
1749
+ * @since 2.0.0
1750
+ * @deprecated
1751
+ */
1752
+ exports.getMeetSemigroup = exports.min;
1753
+ /**
1754
+ * Use [`intercalate`](#intercalate) instead.
1755
+ *
1756
+ * @category combinators
1757
+ * @since 2.5.0
1758
+ * @deprecated
1759
+ */
1760
+ exports.getIntercalateSemigroup = exports.intercalate;
1761
+ function fold(S) {
1762
+ var concatAllS = (0, exports.concatAll)(S);
1763
+ return function (startWith, as) { return (as === undefined ? concatAllS(startWith) : concatAllS(startWith)(as)); };
1764
+ }
1765
+ exports.fold = fold;
1766
+ /**
1767
+ * Use [`SemigroupAll`](./boolean.ts.html#SemigroupAll) instead.
1768
+ *
1769
+ * @category instances
1770
+ * @since 2.0.0
1771
+ * @deprecated
1772
+ */
1773
+ exports.semigroupAll = {
1774
+ concat: function (x, y) { return x && y; }
1775
+ };
1776
+ /**
1777
+ * Use [`SemigroupAny`](./boolean.ts.html#SemigroupAny) instead.
1778
+ *
1779
+ * @category instances
1780
+ * @since 2.0.0
1781
+ * @deprecated
1782
+ */
1783
+ exports.semigroupAny = {
1784
+ concat: function (x, y) { return x || y; }
1785
+ };
1786
+ /**
1787
+ * Use [`getSemigroup`](./function.ts.html#getSemigroup) instead.
1788
+ *
1789
+ * @category instances
1790
+ * @since 2.0.0
1791
+ * @deprecated
1792
+ */
1793
+ exports.getFunctionSemigroup = _function.getSemigroup;
1794
+ /**
1795
+ * Use [`Semigroup`](./string.ts.html#Semigroup) instead.
1796
+ *
1797
+ * @category instances
1798
+ * @since 2.0.0
1799
+ * @deprecated
1800
+ */
1801
+ exports.semigroupString = {
1802
+ concat: function (x, y) { return x + y; }
1803
+ };
1804
+ /**
1805
+ * Use [`SemigroupSum`](./number.ts.html#SemigroupSum) instead.
1806
+ *
1807
+ * @category instances
1808
+ * @since 2.0.0
1809
+ * @deprecated
1810
+ */
1811
+ exports.semigroupSum = {
1812
+ concat: function (x, y) { return x + y; }
1813
+ };
1814
+ /**
1815
+ * Use [`SemigroupProduct`](./number.ts.html#SemigroupProduct) instead.
1816
+ *
1817
+ * @category instances
1818
+ * @since 2.0.0
1819
+ * @deprecated
1820
+ */
1821
+ exports.semigroupProduct = {
1822
+ concat: function (x, y) { return x * y; }
1823
+ };
1824
+ });
1825
+
1826
+ const Semigroup$1 = /*@__PURE__*/getDefaultExportFromCjs(Semigroup);
1827
+
1828
+ var Separated = createCommonjsModule(function (module, exports) {
1829
+ "use strict";
1830
+ /**
1831
+ * ```ts
1832
+ * interface Separated<E, A> {
1833
+ * readonly left: E
1834
+ * readonly right: A
1835
+ * }
1836
+ * ```
1837
+ *
1838
+ * Represents a result of separating a whole into two parts.
1839
+ *
1840
+ * @since 2.10.0
1841
+ */
1842
+ Object.defineProperty(exports, "__esModule", { value: true });
1843
+ exports.right = exports.left = exports.flap = exports.Functor = exports.Bifunctor = exports.URI = exports.bimap = exports.mapLeft = exports.map = exports.separated = void 0;
1844
+
1845
+
1846
+ // -------------------------------------------------------------------------------------
1847
+ // constructors
1848
+ // -------------------------------------------------------------------------------------
1849
+ /**
1850
+ * @category constructors
1851
+ * @since 2.10.0
1852
+ */
1853
+ var separated = function (left, right) { return ({ left: left, right: right }); };
1854
+ exports.separated = separated;
1855
+ // -------------------------------------------------------------------------------------
1856
+ // non-pipeables
1857
+ // -------------------------------------------------------------------------------------
1858
+ var _map = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.map)(f)); };
1859
+ var _mapLeft = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.mapLeft)(f)); };
1860
+ var _bimap = function (fa, g, f) { return (0, _function.pipe)(fa, (0, exports.bimap)(g, f)); };
1861
+ // -------------------------------------------------------------------------------------
1862
+ // type class members
1863
+ // -------------------------------------------------------------------------------------
1864
+ /**
1865
+ * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
1866
+ * use the type constructor `F` to represent some computational context.
1867
+ *
1868
+ * @category Functor
1869
+ * @since 2.10.0
1870
+ */
1871
+ var map = function (f) { return function (fa) {
1872
+ return (0, exports.separated)((0, exports.left)(fa), f((0, exports.right)(fa)));
1873
+ }; };
1874
+ exports.map = map;
1875
+ /**
1876
+ * Map a function over the first type argument of a bifunctor.
1877
+ *
1878
+ * @category Bifunctor
1879
+ * @since 2.10.0
1880
+ */
1881
+ var mapLeft = function (f) { return function (fa) {
1882
+ return (0, exports.separated)(f((0, exports.left)(fa)), (0, exports.right)(fa));
1883
+ }; };
1884
+ exports.mapLeft = mapLeft;
1885
+ /**
1886
+ * Map a pair of functions over the two type arguments of the bifunctor.
1887
+ *
1888
+ * @category Bifunctor
1889
+ * @since 2.10.0
1890
+ */
1891
+ var bimap = function (f, g) { return function (fa) {
1892
+ return (0, exports.separated)(f((0, exports.left)(fa)), g((0, exports.right)(fa)));
1893
+ }; };
1894
+ exports.bimap = bimap;
1895
+ // -------------------------------------------------------------------------------------
1896
+ // instances
1897
+ // -------------------------------------------------------------------------------------
1898
+ /**
1899
+ * @category instances
1900
+ * @since 2.10.0
1901
+ */
1902
+ exports.URI = 'Separated';
1903
+ /**
1904
+ * @category instances
1905
+ * @since 2.10.0
1906
+ */
1907
+ exports.Bifunctor = {
1908
+ URI: exports.URI,
1909
+ mapLeft: _mapLeft,
1910
+ bimap: _bimap
1911
+ };
1912
+ /**
1913
+ * @category instances
1914
+ * @since 2.10.0
1915
+ */
1916
+ exports.Functor = {
1917
+ URI: exports.URI,
1918
+ map: _map
1919
+ };
1920
+ /**
1921
+ * Derivable from `Functor`.
1922
+ *
1923
+ * @category combinators
1924
+ * @since 2.10.0
1925
+ */
1926
+ exports.flap = (0, Functor.flap)(exports.Functor);
1927
+ // -------------------------------------------------------------------------------------
1928
+ // utils
1929
+ // -------------------------------------------------------------------------------------
1930
+ /**
1931
+ * @since 2.10.0
1932
+ */
1933
+ var left = function (s) { return s.left; };
1934
+ exports.left = left;
1935
+ /**
1936
+ * @since 2.10.0
1937
+ */
1938
+ var right = function (s) { return s.right; };
1939
+ exports.right = right;
1940
+ });
1941
+
1942
+ const Separated$1 = /*@__PURE__*/getDefaultExportFromCjs(Separated);
1943
+
1944
+ var Witherable = createCommonjsModule(function (module, exports) {
1945
+ "use strict";
1946
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1947
+ if (k2 === undefined) k2 = k;
1948
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1949
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1950
+ desc = { enumerable: true, get: function() { return m[k]; } };
1951
+ }
1952
+ Object.defineProperty(o, k2, desc);
1953
+ }) : (function(o, m, k, k2) {
1954
+ if (k2 === undefined) k2 = k;
1955
+ o[k2] = m[k];
1956
+ }));
1957
+ var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
1958
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
1959
+ }) : function(o, v) {
1960
+ o["default"] = v;
1961
+ });
1962
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
1963
+ if (mod && mod.__esModule) return mod;
1964
+ var result = {};
1965
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1966
+ __setModuleDefault(result, mod);
1967
+ return result;
1968
+ };
1969
+ Object.defineProperty(exports, "__esModule", { value: true });
1970
+ exports.filterE = exports.witherDefault = exports.wiltDefault = void 0;
1971
+ var _ = __importStar(internal);
1972
+ function wiltDefault(T, C) {
1973
+ return function (F) {
1974
+ var traverseF = T.traverse(F);
1975
+ return function (wa, f) { return F.map(traverseF(wa, f), C.separate); };
1976
+ };
1977
+ }
1978
+ exports.wiltDefault = wiltDefault;
1979
+ function witherDefault(T, C) {
1980
+ return function (F) {
1981
+ var traverseF = T.traverse(F);
1982
+ return function (wa, f) { return F.map(traverseF(wa, f), C.compact); };
1983
+ };
1984
+ }
1985
+ exports.witherDefault = witherDefault;
1986
+ function filterE(W) {
1987
+ return function (F) {
1988
+ var witherF = W.wither(F);
1989
+ return function (predicate) { return function (ga) { return witherF(ga, function (a) { return F.map(predicate(a), function (b) { return (b ? _.some(a) : _.none); }); }); }; };
1990
+ };
1991
+ }
1992
+ exports.filterE = filterE;
1993
+ });
1994
+
1995
+ const Witherable$1 = /*@__PURE__*/getDefaultExportFromCjs(Witherable);
1996
+
1997
+ var Zero = createCommonjsModule(function (module, exports) {
1998
+ "use strict";
1999
+ Object.defineProperty(exports, "__esModule", { value: true });
2000
+ exports.guard = void 0;
2001
+ function guard(F, P) {
2002
+ return function (b) { return (b ? P.of(undefined) : F.zero()); };
2003
+ }
2004
+ exports.guard = guard;
2005
+ });
2006
+
2007
+ const Zero$1 = /*@__PURE__*/getDefaultExportFromCjs(Zero);
2008
+
2009
+ var ReadonlyNonEmptyArray = createCommonjsModule(function (module, exports) {
2010
+ "use strict";
2011
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2012
+ if (k2 === undefined) k2 = k;
2013
+ var desc = Object.getOwnPropertyDescriptor(m, k);
2014
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2015
+ desc = { enumerable: true, get: function() { return m[k]; } };
2016
+ }
2017
+ Object.defineProperty(o, k2, desc);
2018
+ }) : (function(o, m, k, k2) {
2019
+ if (k2 === undefined) k2 = k;
2020
+ o[k2] = m[k];
2021
+ }));
2022
+ var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
2023
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
2024
+ }) : function(o, v) {
2025
+ o["default"] = v;
2026
+ });
2027
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
2028
+ if (mod && mod.__esModule) return mod;
2029
+ var result = {};
2030
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
2031
+ __setModuleDefault(result, mod);
2032
+ return result;
2033
+ };
2034
+ var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from, pack) {
2035
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
2036
+ if (ar || !(i in from)) {
2037
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
2038
+ ar[i] = from[i];
2039
+ }
2040
+ }
2041
+ return to.concat(ar || Array.prototype.slice.call(from));
2042
+ };
2043
+ Object.defineProperty(exports, "__esModule", { value: true });
2044
+ exports.reduceRight = exports.foldMap = exports.reduce = exports.mapWithIndex = exports.map = exports.flatten = exports.duplicate = exports.extend = exports.chain = exports.ap = exports.alt = exports.altW = exports.of = exports.chunksOf = exports.splitAt = exports.chop = exports.chainWithIndex = exports.intersperse = exports.prependAll = exports.unzip = exports.zip = exports.zipWith = exports.modifyAt = exports.updateAt = exports.sort = exports.groupBy = exports.group = exports.reverse = exports.concat = exports.concatW = exports.fromArray = exports.unappend = exports.unprepend = exports.range = exports.replicate = exports.makeBy = exports.fromReadonlyArray = exports.rotate = exports.union = exports.sortBy = exports.uniq = exports.unsafeUpdateAt = exports.unsafeInsertAt = exports.append = exports.appendW = exports.prepend = exports.prependW = exports.isOutOfBound = exports.isNonEmpty = exports.empty = void 0;
2045
+ exports.filterWithIndex = exports.filter = exports.groupSort = exports.intercalate = exports.updateLast = exports.modifyLast = exports.updateHead = exports.modifyHead = exports.matchRight = exports.matchLeft = exports.concatAll = exports.max = exports.min = exports.init = exports.last = exports.tail = exports.head = exports.apS = exports.bind = exports.bindTo = exports.Do = exports.Comonad = exports.Alt = exports.TraversableWithIndex = exports.Traversable = exports.FoldableWithIndex = exports.Foldable = exports.Monad = exports.chainFirst = exports.Chain = exports.Applicative = exports.apSecond = exports.apFirst = exports.Apply = exports.FunctorWithIndex = exports.Pointed = exports.flap = exports.Functor = exports.getUnionSemigroup = exports.getEq = exports.getSemigroup = exports.getShow = exports.URI = exports.extract = exports.traverseWithIndex = exports.sequence = exports.traverse = exports.reduceRightWithIndex = exports.foldMapWithIndex = exports.reduceWithIndex = void 0;
2046
+ exports.readonlyNonEmptyArray = exports.fold = exports.prependToAll = exports.insertAt = exports.snoc = exports.cons = exports.unsnoc = exports.uncons = void 0;
2047
+
2048
+
2049
+
2050
+
2051
+
2052
+ var _ = __importStar(internal);
2053
+
2054
+ var Se = __importStar(Semigroup);
2055
+ // -------------------------------------------------------------------------------------
2056
+ // internal
2057
+ // -------------------------------------------------------------------------------------
2058
+ /**
2059
+ * @internal
2060
+ */
2061
+ exports.empty = _.emptyReadonlyArray;
2062
+ /**
2063
+ * @internal
2064
+ */
2065
+ exports.isNonEmpty = _.isNonEmpty;
2066
+ /**
2067
+ * @internal
2068
+ */
2069
+ var isOutOfBound = function (i, as) { return i < 0 || i >= as.length; };
2070
+ exports.isOutOfBound = isOutOfBound;
2071
+ /**
2072
+ * @internal
2073
+ */
2074
+ var prependW = function (head) { return function (tail) { return __spreadArray([head], tail, true); }; };
2075
+ exports.prependW = prependW;
2076
+ /**
2077
+ * @internal
2078
+ */
2079
+ exports.prepend = exports.prependW;
2080
+ /**
2081
+ * @internal
2082
+ */
2083
+ var appendW = function (end) { return function (init) { return __spreadArray(__spreadArray([], init, true), [end], false); }; };
2084
+ exports.appendW = appendW;
2085
+ /**
2086
+ * @internal
2087
+ */
2088
+ exports.append = exports.appendW;
2089
+ /**
2090
+ * @internal
2091
+ */
2092
+ var unsafeInsertAt = function (i, a, as) {
2093
+ if ((0, exports.isNonEmpty)(as)) {
2094
+ var xs = _.fromReadonlyNonEmptyArray(as);
2095
+ xs.splice(i, 0, a);
2096
+ return xs;
2097
+ }
2098
+ return [a];
2099
+ };
2100
+ exports.unsafeInsertAt = unsafeInsertAt;
2101
+ /**
2102
+ * @internal
2103
+ */
2104
+ var unsafeUpdateAt = function (i, a, as) {
2105
+ if (as[i] === a) {
2106
+ return as;
2107
+ }
2108
+ else {
2109
+ var xs = _.fromReadonlyNonEmptyArray(as);
2110
+ xs[i] = a;
2111
+ return xs;
2112
+ }
2113
+ };
2114
+ exports.unsafeUpdateAt = unsafeUpdateAt;
2115
+ /**
2116
+ * Remove duplicates from a `ReadonlyNonEmptyArray`, keeping the first occurrence of an element.
2117
+ *
2118
+ * @example
2119
+ * import { uniq } from 'fp-ts/ReadonlyNonEmptyArray'
2120
+ * import * as N from 'fp-ts/number'
2121
+ *
2122
+ * assert.deepStrictEqual(uniq(N.Eq)([1, 2, 1]), [1, 2])
2123
+ *
2124
+ * @category combinators
2125
+ * @since 2.11.0
2126
+ */
2127
+ var uniq = function (E) { return function (as) {
2128
+ if (as.length === 1) {
2129
+ return as;
2130
+ }
2131
+ var out = [(0, exports.head)(as)];
2132
+ var rest = (0, exports.tail)(as);
2133
+ var _loop_1 = function (a) {
2134
+ if (out.every(function (o) { return !E.equals(o, a); })) {
2135
+ out.push(a);
2136
+ }
2137
+ };
2138
+ for (var _i = 0, rest_1 = rest; _i < rest_1.length; _i++) {
2139
+ var a = rest_1[_i];
2140
+ _loop_1(a);
2141
+ }
2142
+ return out;
2143
+ }; };
2144
+ exports.uniq = uniq;
2145
+ /**
2146
+ * Sort the elements of a `ReadonlyNonEmptyArray` in increasing order, where elements are compared using first `ords[0]`, then `ords[1]`,
2147
+ * etc...
2148
+ *
2149
+ * @example
2150
+ * import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray'
2151
+ * import { contramap } from 'fp-ts/Ord'
2152
+ * import * as S from 'fp-ts/string'
2153
+ * import * as N from 'fp-ts/number'
2154
+ * import { pipe } from 'fp-ts/function'
2155
+ *
2156
+ * interface Person {
2157
+ * name: string
2158
+ * age: number
2159
+ * }
2160
+ *
2161
+ * const byName = pipe(S.Ord, contramap((p: Person) => p.name))
2162
+ *
2163
+ * const byAge = pipe(N.Ord, contramap((p: Person) => p.age))
2164
+ *
2165
+ * const sortByNameByAge = RNEA.sortBy([byName, byAge])
2166
+ *
2167
+ * const persons: RNEA.ReadonlyNonEmptyArray<Person> = [
2168
+ * { name: 'a', age: 1 },
2169
+ * { name: 'b', age: 3 },
2170
+ * { name: 'c', age: 2 },
2171
+ * { name: 'b', age: 2 }
2172
+ * ]
2173
+ *
2174
+ * assert.deepStrictEqual(sortByNameByAge(persons), [
2175
+ * { name: 'a', age: 1 },
2176
+ * { name: 'b', age: 2 },
2177
+ * { name: 'b', age: 3 },
2178
+ * { name: 'c', age: 2 }
2179
+ * ])
2180
+ *
2181
+ * @category combinators
2182
+ * @since 2.11.0
2183
+ */
2184
+ var sortBy = function (ords) {
2185
+ if ((0, exports.isNonEmpty)(ords)) {
2186
+ var M = (0, Ord.getMonoid)();
2187
+ return (0, exports.sort)(ords.reduce(M.concat, M.empty));
2188
+ }
2189
+ return _function.identity;
2190
+ };
2191
+ exports.sortBy = sortBy;
2192
+ /**
2193
+ * @category combinators
2194
+ * @since 2.11.0
2195
+ */
2196
+ var union = function (E) {
2197
+ var uniqE = (0, exports.uniq)(E);
2198
+ return function (second) { return function (first) { return uniqE((0, _function.pipe)(first, concat(second))); }; };
2199
+ };
2200
+ exports.union = union;
2201
+ /**
2202
+ * Rotate a `ReadonlyNonEmptyArray` by `n` steps.
2203
+ *
2204
+ * @example
2205
+ * import { rotate } from 'fp-ts/ReadonlyNonEmptyArray'
2206
+ *
2207
+ * assert.deepStrictEqual(rotate(2)([1, 2, 3, 4, 5]), [4, 5, 1, 2, 3])
2208
+ * assert.deepStrictEqual(rotate(-2)([1, 2, 3, 4, 5]), [3, 4, 5, 1, 2])
2209
+ *
2210
+ * @category combinators
2211
+ * @since 2.11.0
2212
+ */
2213
+ var rotate = function (n) { return function (as) {
2214
+ var len = as.length;
2215
+ var m = Math.round(n) % len;
2216
+ if ((0, exports.isOutOfBound)(Math.abs(m), as) || m === 0) {
2217
+ return as;
2218
+ }
2219
+ if (m < 0) {
2220
+ var _a = (0, exports.splitAt)(-m)(as), f = _a[0], s = _a[1];
2221
+ return (0, _function.pipe)(s, concat(f));
2222
+ }
2223
+ else {
2224
+ return (0, exports.rotate)(m - len)(as);
2225
+ }
2226
+ }; };
2227
+ exports.rotate = rotate;
2228
+ // -------------------------------------------------------------------------------------
2229
+ // constructors
2230
+ // -------------------------------------------------------------------------------------
2231
+ /**
2232
+ * Return a `ReadonlyNonEmptyArray` from a `ReadonlyArray` returning `none` if the input is empty.
2233
+ *
2234
+ * @category constructors
2235
+ * @since 2.5.0
2236
+ */
2237
+ var fromReadonlyArray = function (as) {
2238
+ return (0, exports.isNonEmpty)(as) ? _.some(as) : _.none;
2239
+ };
2240
+ exports.fromReadonlyArray = fromReadonlyArray;
2241
+ /**
2242
+ * Return a `ReadonlyNonEmptyArray` of length `n` with element `i` initialized with `f(i)`.
2243
+ *
2244
+ * **Note**. `n` is normalized to a natural number.
2245
+ *
2246
+ * @example
2247
+ * import { makeBy } from 'fp-ts/ReadonlyNonEmptyArray'
2248
+ * import { pipe } from 'fp-ts/function'
2249
+ *
2250
+ * const double = (n: number): number => n * 2
2251
+ * assert.deepStrictEqual(pipe(5, makeBy(double)), [0, 2, 4, 6, 8])
2252
+ *
2253
+ * @category constructors
2254
+ * @since 2.11.0
2255
+ */
2256
+ var makeBy = function (f) { return function (n) {
2257
+ var j = Math.max(0, Math.floor(n));
2258
+ var out = [f(0)];
2259
+ for (var i = 1; i < j; i++) {
2260
+ out.push(f(i));
2261
+ }
2262
+ return out;
2263
+ }; };
2264
+ exports.makeBy = makeBy;
2265
+ /**
2266
+ * Create a `ReadonlyNonEmptyArray` containing a value repeated the specified number of times.
2267
+ *
2268
+ * **Note**. `n` is normalized to a natural number.
2269
+ *
2270
+ * @example
2271
+ * import { replicate } from 'fp-ts/ReadonlyNonEmptyArray'
2272
+ * import { pipe } from 'fp-ts/function'
2273
+ *
2274
+ * assert.deepStrictEqual(pipe(3, replicate('a')), ['a', 'a', 'a'])
2275
+ *
2276
+ * @category constructors
2277
+ * @since 2.11.0
2278
+ */
2279
+ var replicate = function (a) { return (0, exports.makeBy)(function () { return a; }); };
2280
+ exports.replicate = replicate;
2281
+ /**
2282
+ * Create a `ReadonlyNonEmptyArray` containing a range of integers, including both endpoints.
2283
+ *
2284
+ * @example
2285
+ * import { range } from 'fp-ts/ReadonlyNonEmptyArray'
2286
+ *
2287
+ * assert.deepStrictEqual(range(1, 5), [1, 2, 3, 4, 5])
2288
+ *
2289
+ * @category constructors
2290
+ * @since 2.11.0
2291
+ */
2292
+ var range = function (start, end) {
2293
+ return start <= end ? (0, exports.makeBy)(function (i) { return start + i; })(end - start + 1) : [start];
2294
+ };
2295
+ exports.range = range;
2296
+ // -------------------------------------------------------------------------------------
2297
+ // destructors
2298
+ // -------------------------------------------------------------------------------------
2299
+ /**
2300
+ * Return the tuple of the `head` and the `tail`.
2301
+ *
2302
+ * @example
2303
+ * import { unprepend } from 'fp-ts/ReadonlyNonEmptyArray'
2304
+ *
2305
+ * assert.deepStrictEqual(unprepend([1, 2, 3, 4]), [1, [2, 3, 4]])
2306
+ *
2307
+ * @category destructors
2308
+ * @since 2.9.0
2309
+ */
2310
+ var unprepend = function (as) { return [(0, exports.head)(as), (0, exports.tail)(as)]; };
2311
+ exports.unprepend = unprepend;
2312
+ /**
2313
+ * Return the tuple of the `init` and the `last`.
2314
+ *
2315
+ * @example
2316
+ * import { unappend } from 'fp-ts/ReadonlyNonEmptyArray'
2317
+ *
2318
+ * assert.deepStrictEqual(unappend([1, 2, 3, 4]), [[1, 2, 3], 4])
2319
+ *
2320
+ * @category destructors
2321
+ * @since 2.9.0
2322
+ */
2323
+ var unappend = function (as) { return [(0, exports.init)(as), (0, exports.last)(as)]; };
2324
+ exports.unappend = unappend;
2325
+ // -------------------------------------------------------------------------------------
2326
+ // interop
2327
+ // -------------------------------------------------------------------------------------
2328
+ /**
2329
+ * @category interop
2330
+ * @since 2.5.0
2331
+ */
2332
+ var fromArray = function (as) { return (0, exports.fromReadonlyArray)(as.slice()); };
2333
+ exports.fromArray = fromArray;
2334
+ function concatW(second) {
2335
+ return function (first) { return first.concat(second); };
2336
+ }
2337
+ exports.concatW = concatW;
2338
+ function concat(x, y) {
2339
+ return y ? x.concat(y) : function (y) { return y.concat(x); };
2340
+ }
2341
+ exports.concat = concat;
2342
+ /**
2343
+ * @category combinators
2344
+ * @since 2.5.0
2345
+ */
2346
+ var reverse = function (as) {
2347
+ return as.length === 1 ? as : __spreadArray([(0, exports.last)(as)], as.slice(0, -1).reverse(), true);
2348
+ };
2349
+ exports.reverse = reverse;
2350
+ function group(E) {
2351
+ return function (as) {
2352
+ var len = as.length;
2353
+ if (len === 0) {
2354
+ return exports.empty;
2355
+ }
2356
+ var out = [];
2357
+ var head = as[0];
2358
+ var nea = [head];
2359
+ for (var i = 1; i < len; i++) {
2360
+ var a = as[i];
2361
+ if (E.equals(a, head)) {
2362
+ nea.push(a);
2363
+ }
2364
+ else {
2365
+ out.push(nea);
2366
+ head = a;
2367
+ nea = [head];
2368
+ }
2369
+ }
2370
+ out.push(nea);
2371
+ return out;
2372
+ };
2373
+ }
2374
+ exports.group = group;
2375
+ /**
2376
+ * Splits an array into sub-non-empty-arrays stored in an object, based on the result of calling a `string`-returning
2377
+ * function on each element, and grouping the results according to values returned
2378
+ *
2379
+ * @example
2380
+ * import { groupBy } from 'fp-ts/ReadonlyNonEmptyArray'
2381
+ *
2382
+ * assert.deepStrictEqual(groupBy((s: string) => String(s.length))(['a', 'b', 'ab']), {
2383
+ * '1': ['a', 'b'],
2384
+ * '2': ['ab']
2385
+ * })
2386
+ *
2387
+ * @category combinators
2388
+ * @since 2.5.0
2389
+ */
2390
+ var groupBy = function (f) { return function (as) {
2391
+ var out = {};
2392
+ for (var _i = 0, as_1 = as; _i < as_1.length; _i++) {
2393
+ var a = as_1[_i];
2394
+ var k = f(a);
2395
+ if (_.has.call(out, k)) {
2396
+ out[k].push(a);
2397
+ }
2398
+ else {
2399
+ out[k] = [a];
2400
+ }
2401
+ }
2402
+ return out;
2403
+ }; };
2404
+ exports.groupBy = groupBy;
2405
+ /**
2406
+ * @category combinators
2407
+ * @since 2.5.0
2408
+ */
2409
+ var sort = function (O) { return function (as) {
2410
+ return as.length === 1 ? as : as.slice().sort(O.compare);
2411
+ }; };
2412
+ exports.sort = sort;
2413
+ /**
2414
+ * @category combinators
2415
+ * @since 2.5.0
2416
+ */
2417
+ var updateAt = function (i, a) {
2418
+ return (0, exports.modifyAt)(i, function () { return a; });
2419
+ };
2420
+ exports.updateAt = updateAt;
2421
+ /**
2422
+ * @category combinators
2423
+ * @since 2.5.0
2424
+ */
2425
+ var modifyAt = function (i, f) { return function (as) { return ((0, exports.isOutOfBound)(i, as) ? _.none : _.some((0, exports.unsafeUpdateAt)(i, f(as[i]), as))); }; };
2426
+ exports.modifyAt = modifyAt;
2427
+ /**
2428
+ * @category combinators
2429
+ * @since 2.5.1
2430
+ */
2431
+ var zipWith = function (as, bs, f) {
2432
+ var cs = [f(as[0], bs[0])];
2433
+ var len = Math.min(as.length, bs.length);
2434
+ for (var i = 1; i < len; i++) {
2435
+ cs[i] = f(as[i], bs[i]);
2436
+ }
2437
+ return cs;
2438
+ };
2439
+ exports.zipWith = zipWith;
2440
+ function zip(as, bs) {
2441
+ if (bs === undefined) {
2442
+ return function (bs) { return zip(bs, as); };
2443
+ }
2444
+ return (0, exports.zipWith)(as, bs, function (a, b) { return [a, b]; });
2445
+ }
2446
+ exports.zip = zip;
2447
+ /**
2448
+ * @category combinators
2449
+ * @since 2.5.1
2450
+ */
2451
+ var unzip = function (abs) {
2452
+ var fa = [abs[0][0]];
2453
+ var fb = [abs[0][1]];
2454
+ for (var i = 1; i < abs.length; i++) {
2455
+ fa[i] = abs[i][0];
2456
+ fb[i] = abs[i][1];
2457
+ }
2458
+ return [fa, fb];
2459
+ };
2460
+ exports.unzip = unzip;
2461
+ /**
2462
+ * Prepend an element to every member of a `ReadonlyNonEmptyArray`.
2463
+ *
2464
+ * @example
2465
+ * import { prependAll } from 'fp-ts/ReadonlyNonEmptyArray'
2466
+ *
2467
+ * assert.deepStrictEqual(prependAll(9)([1, 2, 3, 4]), [9, 1, 9, 2, 9, 3, 9, 4])
2468
+ *
2469
+ * @category combinators
2470
+ * @since 2.10.0
2471
+ */
2472
+ var prependAll = function (middle) { return function (as) {
2473
+ var out = [middle, as[0]];
2474
+ for (var i = 1; i < as.length; i++) {
2475
+ out.push(middle, as[i]);
2476
+ }
2477
+ return out;
2478
+ }; };
2479
+ exports.prependAll = prependAll;
2480
+ /**
2481
+ * Places an element in between members of a `ReadonlyNonEmptyArray`.
2482
+ *
2483
+ * @example
2484
+ * import { intersperse } from 'fp-ts/ReadonlyNonEmptyArray'
2485
+ *
2486
+ * assert.deepStrictEqual(intersperse(9)([1, 2, 3, 4]), [1, 9, 2, 9, 3, 9, 4])
2487
+ *
2488
+ * @category combinators
2489
+ * @since 2.9.0
2490
+ */
2491
+ var intersperse = function (middle) { return function (as) {
2492
+ var rest = (0, exports.tail)(as);
2493
+ return (0, exports.isNonEmpty)(rest) ? (0, _function.pipe)(rest, (0, exports.prependAll)(middle), (0, exports.prepend)((0, exports.head)(as))) : as;
2494
+ }; };
2495
+ exports.intersperse = intersperse;
2496
+ /**
2497
+ * @category combinators
2498
+ * @since 2.10.0
2499
+ */
2500
+ var chainWithIndex = function (f) { return function (as) {
2501
+ var out = _.fromReadonlyNonEmptyArray(f(0, (0, exports.head)(as)));
2502
+ for (var i = 1; i < as.length; i++) {
2503
+ out.push.apply(out, f(i, as[i]));
2504
+ }
2505
+ return out;
2506
+ }; };
2507
+ exports.chainWithIndex = chainWithIndex;
2508
+ /**
2509
+ * A useful recursion pattern for processing a `ReadonlyNonEmptyArray` to produce a new `ReadonlyNonEmptyArray`, often used for "chopping" up the input
2510
+ * `ReadonlyNonEmptyArray`. Typically `chop` is called with some function that will consume an initial prefix of the `ReadonlyNonEmptyArray` and produce a
2511
+ * value and the tail of the `ReadonlyNonEmptyArray`.
2512
+ *
2513
+ * @category combinators
2514
+ * @since 2.10.0
2515
+ */
2516
+ var chop = function (f) { return function (as) {
2517
+ var _a = f(as), b = _a[0], rest = _a[1];
2518
+ var out = [b];
2519
+ var next = rest;
2520
+ while ((0, exports.isNonEmpty)(next)) {
2521
+ var _b = f(next), b_1 = _b[0], rest_2 = _b[1];
2522
+ out.push(b_1);
2523
+ next = rest_2;
2524
+ }
2525
+ return out;
2526
+ }; };
2527
+ exports.chop = chop;
2528
+ /**
2529
+ * Splits a `ReadonlyNonEmptyArray` into two pieces, the first piece has max `n` elements.
2530
+ *
2531
+ * @category combinators
2532
+ * @since 2.10.0
2533
+ */
2534
+ var splitAt = function (n) { return function (as) {
2535
+ var m = Math.max(1, n);
2536
+ return m >= as.length ? [as, exports.empty] : [(0, _function.pipe)(as.slice(1, m), (0, exports.prepend)((0, exports.head)(as))), as.slice(m)];
2537
+ }; };
2538
+ exports.splitAt = splitAt;
2539
+ /**
2540
+ * Splits a `ReadonlyNonEmptyArray` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
2541
+ * the `ReadonlyNonEmptyArray`.
2542
+ *
2543
+ * @category combinators
2544
+ * @since 2.10.0
2545
+ */
2546
+ var chunksOf = function (n) { return (0, exports.chop)((0, exports.splitAt)(n)); };
2547
+ exports.chunksOf = chunksOf;
2548
+ // -------------------------------------------------------------------------------------
2549
+ // non-pipeables
2550
+ // -------------------------------------------------------------------------------------
2551
+ var _map = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.map)(f)); };
2552
+ /* istanbul ignore next */
2553
+ var _mapWithIndex = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.mapWithIndex)(f)); };
2554
+ var _ap = function (fab, fa) { return (0, _function.pipe)(fab, (0, exports.ap)(fa)); };
2555
+ var _chain = function (ma, f) { return (0, _function.pipe)(ma, (0, exports.chain)(f)); };
2556
+ /* istanbul ignore next */
2557
+ var _extend = function (wa, f) { return (0, _function.pipe)(wa, (0, exports.extend)(f)); };
2558
+ /* istanbul ignore next */
2559
+ var _reduce = function (fa, b, f) { return (0, _function.pipe)(fa, (0, exports.reduce)(b, f)); };
2560
+ /* istanbul ignore next */
2561
+ var _foldMap = function (M) {
2562
+ var foldMapM = (0, exports.foldMap)(M);
2563
+ return function (fa, f) { return (0, _function.pipe)(fa, foldMapM(f)); };
2564
+ };
2565
+ /* istanbul ignore next */
2566
+ var _reduceRight = function (fa, b, f) { return (0, _function.pipe)(fa, (0, exports.reduceRight)(b, f)); };
2567
+ /* istanbul ignore next */
2568
+ var _traverse = function (F) {
2569
+ var traverseF = (0, exports.traverse)(F);
2570
+ return function (ta, f) { return (0, _function.pipe)(ta, traverseF(f)); };
2571
+ };
2572
+ /* istanbul ignore next */
2573
+ var _alt = function (fa, that) { return (0, _function.pipe)(fa, (0, exports.alt)(that)); };
2574
+ /* istanbul ignore next */
2575
+ var _reduceWithIndex = function (fa, b, f) {
2576
+ return (0, _function.pipe)(fa, (0, exports.reduceWithIndex)(b, f));
2577
+ };
2578
+ /* istanbul ignore next */
2579
+ var _foldMapWithIndex = function (M) {
2580
+ var foldMapWithIndexM = (0, exports.foldMapWithIndex)(M);
2581
+ return function (fa, f) { return (0, _function.pipe)(fa, foldMapWithIndexM(f)); };
2582
+ };
2583
+ /* istanbul ignore next */
2584
+ var _reduceRightWithIndex = function (fa, b, f) {
2585
+ return (0, _function.pipe)(fa, (0, exports.reduceRightWithIndex)(b, f));
2586
+ };
2587
+ /* istanbul ignore next */
2588
+ var _traverseWithIndex = function (F) {
2589
+ var traverseWithIndexF = (0, exports.traverseWithIndex)(F);
2590
+ return function (ta, f) { return (0, _function.pipe)(ta, traverseWithIndexF(f)); };
2591
+ };
2592
+ // -------------------------------------------------------------------------------------
2593
+ // type class members
2594
+ // -------------------------------------------------------------------------------------
2595
+ /**
2596
+ * @category Pointed
2597
+ * @since 2.5.0
2598
+ */
2599
+ exports.of = _.singleton;
2600
+ /**
2601
+ * Less strict version of [`alt`](#alt).
2602
+ *
2603
+ * @category Alt
2604
+ * @since 2.9.0
2605
+ */
2606
+ var altW = function (that) { return function (as) { return (0, _function.pipe)(as, concatW(that())); }; };
2607
+ exports.altW = altW;
2608
+ /**
2609
+ * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
2610
+ * types of kind `* -> *`.
2611
+ *
2612
+ * @category Alt
2613
+ * @since 2.6.2
2614
+ */
2615
+ exports.alt = exports.altW;
2616
+ /**
2617
+ * @category Apply
2618
+ * @since 2.5.0
2619
+ */
2620
+ var ap = function (as) { return (0, exports.chain)(function (f) { return (0, _function.pipe)(as, (0, exports.map)(f)); }); };
2621
+ exports.ap = ap;
2622
+ /**
2623
+ * Composes computations in sequence, using the return value of one computation to determine the next computation.
2624
+ *
2625
+ * @category Monad
2626
+ * @since 2.5.0
2627
+ */
2628
+ var chain = function (f) { return (0, exports.chainWithIndex)(function (_, a) { return f(a); }); };
2629
+ exports.chain = chain;
2630
+ /**
2631
+ * @category Extend
2632
+ * @since 2.5.0
2633
+ */
2634
+ var extend = function (f) { return function (as) {
2635
+ var next = (0, exports.tail)(as);
2636
+ var out = [f(as)];
2637
+ while ((0, exports.isNonEmpty)(next)) {
2638
+ out.push(f(next));
2639
+ next = (0, exports.tail)(next);
2640
+ }
2641
+ return out;
2642
+ }; };
2643
+ exports.extend = extend;
2644
+ /**
2645
+ * Derivable from `Extend`.
2646
+ *
2647
+ * @category combinators
2648
+ * @since 2.5.0
2649
+ */
2650
+ exports.duplicate = (0, exports.extend)(_function.identity);
2651
+ /**
2652
+ * Derivable from `Chain`.
2653
+ *
2654
+ * @category combinators
2655
+ * @since 2.5.0
2656
+ */
2657
+ exports.flatten = (0, exports.chain)(_function.identity);
2658
+ /**
2659
+ * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
2660
+ * use the type constructor `F` to represent some computational context.
2661
+ *
2662
+ * @category Functor
2663
+ * @since 2.5.0
2664
+ */
2665
+ var map = function (f) {
2666
+ return (0, exports.mapWithIndex)(function (_, a) { return f(a); });
2667
+ };
2668
+ exports.map = map;
2669
+ /**
2670
+ * @category FunctorWithIndex
2671
+ * @since 2.5.0
2672
+ */
2673
+ var mapWithIndex = function (f) { return function (as) {
2674
+ var out = [f(0, (0, exports.head)(as))];
2675
+ for (var i = 1; i < as.length; i++) {
2676
+ out.push(f(i, as[i]));
2677
+ }
2678
+ return out;
2679
+ }; };
2680
+ exports.mapWithIndex = mapWithIndex;
2681
+ /**
2682
+ * @category Foldable
2683
+ * @since 2.5.0
2684
+ */
2685
+ var reduce = function (b, f) {
2686
+ return (0, exports.reduceWithIndex)(b, function (_, b, a) { return f(b, a); });
2687
+ };
2688
+ exports.reduce = reduce;
2689
+ /**
2690
+ * **Note**. The constraint is relaxed: a `Semigroup` instead of a `Monoid`.
2691
+ *
2692
+ * @category Foldable
2693
+ * @since 2.5.0
2694
+ */
2695
+ var foldMap = function (S) { return function (f) { return function (as) {
2696
+ return as.slice(1).reduce(function (s, a) { return S.concat(s, f(a)); }, f(as[0]));
2697
+ }; }; };
2698
+ exports.foldMap = foldMap;
2699
+ /**
2700
+ * @category Foldable
2701
+ * @since 2.5.0
2702
+ */
2703
+ var reduceRight = function (b, f) {
2704
+ return (0, exports.reduceRightWithIndex)(b, function (_, b, a) { return f(b, a); });
2705
+ };
2706
+ exports.reduceRight = reduceRight;
2707
+ /**
2708
+ * @category FoldableWithIndex
2709
+ * @since 2.5.0
2710
+ */
2711
+ var reduceWithIndex = function (b, f) { return function (as) {
2712
+ return as.reduce(function (b, a, i) { return f(i, b, a); }, b);
2713
+ }; };
2714
+ exports.reduceWithIndex = reduceWithIndex;
2715
+ /**
2716
+ * **Note**. The constraint is relaxed: a `Semigroup` instead of a `Monoid`.
2717
+ *
2718
+ * @category FoldableWithIndex
2719
+ * @since 2.5.0
2720
+ */
2721
+ var foldMapWithIndex = function (S) { return function (f) { return function (as) { return as.slice(1).reduce(function (s, a, i) { return S.concat(s, f(i + 1, a)); }, f(0, as[0])); }; }; };
2722
+ exports.foldMapWithIndex = foldMapWithIndex;
2723
+ /**
2724
+ * @category FoldableWithIndex
2725
+ * @since 2.5.0
2726
+ */
2727
+ var reduceRightWithIndex = function (b, f) { return function (as) { return as.reduceRight(function (b, a, i) { return f(i, a, b); }, b); }; };
2728
+ exports.reduceRightWithIndex = reduceRightWithIndex;
2729
+ /**
2730
+ * @category Traversable
2731
+ * @since 2.6.3
2732
+ */
2733
+ var traverse = function (F) {
2734
+ var traverseWithIndexF = (0, exports.traverseWithIndex)(F);
2735
+ return function (f) { return traverseWithIndexF(function (_, a) { return f(a); }); };
2736
+ };
2737
+ exports.traverse = traverse;
2738
+ /**
2739
+ * @category Traversable
2740
+ * @since 2.6.3
2741
+ */
2742
+ var sequence = function (F) { return (0, exports.traverseWithIndex)(F)(_function.SK); };
2743
+ exports.sequence = sequence;
2744
+ /**
2745
+ * @category TraversableWithIndex
2746
+ * @since 2.6.3
2747
+ */
2748
+ var traverseWithIndex = function (F) { return function (f) { return function (as) {
2749
+ var out = F.map(f(0, (0, exports.head)(as)), exports.of);
2750
+ for (var i = 1; i < as.length; i++) {
2751
+ out = F.ap(F.map(out, function (bs) { return function (b) { return (0, _function.pipe)(bs, (0, exports.append)(b)); }; }), f(i, as[i]));
2752
+ }
2753
+ return out;
2754
+ }; }; };
2755
+ exports.traverseWithIndex = traverseWithIndex;
2756
+ /**
2757
+ * @category Comonad
2758
+ * @since 2.6.3
2759
+ */
2760
+ exports.extract = _.head;
2761
+ // -------------------------------------------------------------------------------------
2762
+ // instances
2763
+ // -------------------------------------------------------------------------------------
2764
+ /**
2765
+ * @category instances
2766
+ * @since 2.5.0
2767
+ */
2768
+ exports.URI = 'ReadonlyNonEmptyArray';
2769
+ /**
2770
+ * @category instances
2771
+ * @since 2.5.0
2772
+ */
2773
+ var getShow = function (S) { return ({
2774
+ show: function (as) { return "[".concat(as.map(S.show).join(', '), "]"); }
2775
+ }); };
2776
+ exports.getShow = getShow;
2777
+ /**
2778
+ * Builds a `Semigroup` instance for `ReadonlyNonEmptyArray`
2779
+ *
2780
+ * @category instances
2781
+ * @since 2.5.0
2782
+ */
2783
+ var getSemigroup = function () { return ({
2784
+ concat: concat
2785
+ }); };
2786
+ exports.getSemigroup = getSemigroup;
2787
+ /**
2788
+ * @example
2789
+ * import { getEq } from 'fp-ts/ReadonlyNonEmptyArray'
2790
+ * import * as N from 'fp-ts/number'
2791
+ *
2792
+ * const E = getEq(N.Eq)
2793
+ * assert.strictEqual(E.equals([1, 2], [1, 2]), true)
2794
+ * assert.strictEqual(E.equals([1, 2], [1, 3]), false)
2795
+ *
2796
+ * @category instances
2797
+ * @since 2.5.0
2798
+ */
2799
+ var getEq = function (E) {
2800
+ return (0, Eq.fromEquals)(function (xs, ys) { return xs.length === ys.length && xs.every(function (x, i) { return E.equals(x, ys[i]); }); });
2801
+ };
2802
+ exports.getEq = getEq;
2803
+ /**
2804
+ * @category combinators
2805
+ * @since 2.11.0
2806
+ */
2807
+ var getUnionSemigroup = function (E) {
2808
+ var unionE = (0, exports.union)(E);
2809
+ return {
2810
+ concat: function (first, second) { return unionE(second)(first); }
2811
+ };
2812
+ };
2813
+ exports.getUnionSemigroup = getUnionSemigroup;
2814
+ /**
2815
+ * @category instances
2816
+ * @since 2.7.0
2817
+ */
2818
+ exports.Functor = {
2819
+ URI: exports.URI,
2820
+ map: _map
2821
+ };
2822
+ /**
2823
+ * Derivable from `Functor`.
2824
+ *
2825
+ * @category combinators
2826
+ * @since 2.10.0
2827
+ */
2828
+ exports.flap = (0, Functor.flap)(exports.Functor);
2829
+ /**
2830
+ * @category instances
2831
+ * @since 2.10.0
2832
+ */
2833
+ exports.Pointed = {
2834
+ URI: exports.URI,
2835
+ of: exports.of
2836
+ };
2837
+ /**
2838
+ * @category instances
2839
+ * @since 2.7.0
2840
+ */
2841
+ exports.FunctorWithIndex = {
2842
+ URI: exports.URI,
2843
+ map: _map,
2844
+ mapWithIndex: _mapWithIndex
2845
+ };
2846
+ /**
2847
+ * @category instances
2848
+ * @since 2.10.0
2849
+ */
2850
+ exports.Apply = {
2851
+ URI: exports.URI,
2852
+ map: _map,
2853
+ ap: _ap
2854
+ };
2855
+ /**
2856
+ * Combine two effectful actions, keeping only the result of the first.
2857
+ *
2858
+ * Derivable from `Apply`.
2859
+ *
2860
+ * @category combinators
2861
+ * @since 2.5.0
2862
+ */
2863
+ exports.apFirst = (0, Apply.apFirst)(exports.Apply);
2864
+ /**
2865
+ * Combine two effectful actions, keeping only the result of the second.
2866
+ *
2867
+ * Derivable from `Apply`.
2868
+ *
2869
+ * @category combinators
2870
+ * @since 2.5.0
2871
+ */
2872
+ exports.apSecond = (0, Apply.apSecond)(exports.Apply);
2873
+ /**
2874
+ * @category instances
2875
+ * @since 2.7.0
2876
+ */
2877
+ exports.Applicative = {
2878
+ URI: exports.URI,
2879
+ map: _map,
2880
+ ap: _ap,
2881
+ of: exports.of
2882
+ };
2883
+ /**
2884
+ * @category instances
2885
+ * @since 2.10.0
2886
+ */
2887
+ exports.Chain = {
2888
+ URI: exports.URI,
2889
+ map: _map,
2890
+ ap: _ap,
2891
+ chain: _chain
2892
+ };
2893
+ /**
2894
+ * Composes computations in sequence, using the return value of one computation to determine the next computation and
2895
+ * keeping only the result of the first.
2896
+ *
2897
+ * Derivable from `Chain`.
2898
+ *
2899
+ * @category combinators
2900
+ * @since 2.5.0
2901
+ */
2902
+ exports.chainFirst = (0, Chain.chainFirst)(exports.Chain);
2903
+ /**
2904
+ * @category instances
2905
+ * @since 2.7.0
2906
+ */
2907
+ exports.Monad = {
2908
+ URI: exports.URI,
2909
+ map: _map,
2910
+ ap: _ap,
2911
+ of: exports.of,
2912
+ chain: _chain
2913
+ };
2914
+ /**
2915
+ * @category instances
2916
+ * @since 2.7.0
2917
+ */
2918
+ exports.Foldable = {
2919
+ URI: exports.URI,
2920
+ reduce: _reduce,
2921
+ foldMap: _foldMap,
2922
+ reduceRight: _reduceRight
2923
+ };
2924
+ /**
2925
+ * @category instances
2926
+ * @since 2.7.0
2927
+ */
2928
+ exports.FoldableWithIndex = {
2929
+ URI: exports.URI,
2930
+ reduce: _reduce,
2931
+ foldMap: _foldMap,
2932
+ reduceRight: _reduceRight,
2933
+ reduceWithIndex: _reduceWithIndex,
2934
+ foldMapWithIndex: _foldMapWithIndex,
2935
+ reduceRightWithIndex: _reduceRightWithIndex
2936
+ };
2937
+ /**
2938
+ * @category instances
2939
+ * @since 2.7.0
2940
+ */
2941
+ exports.Traversable = {
2942
+ URI: exports.URI,
2943
+ map: _map,
2944
+ reduce: _reduce,
2945
+ foldMap: _foldMap,
2946
+ reduceRight: _reduceRight,
2947
+ traverse: _traverse,
2948
+ sequence: exports.sequence
2949
+ };
2950
+ /**
2951
+ * @category instances
2952
+ * @since 2.7.0
2953
+ */
2954
+ exports.TraversableWithIndex = {
2955
+ URI: exports.URI,
2956
+ map: _map,
2957
+ mapWithIndex: _mapWithIndex,
2958
+ reduce: _reduce,
2959
+ foldMap: _foldMap,
2960
+ reduceRight: _reduceRight,
2961
+ traverse: _traverse,
2962
+ sequence: exports.sequence,
2963
+ reduceWithIndex: _reduceWithIndex,
2964
+ foldMapWithIndex: _foldMapWithIndex,
2965
+ reduceRightWithIndex: _reduceRightWithIndex,
2966
+ traverseWithIndex: _traverseWithIndex
2967
+ };
2968
+ /**
2969
+ * @category instances
2970
+ * @since 2.7.0
2971
+ */
2972
+ exports.Alt = {
2973
+ URI: exports.URI,
2974
+ map: _map,
2975
+ alt: _alt
2976
+ };
2977
+ /**
2978
+ * @category instances
2979
+ * @since 2.7.0
2980
+ */
2981
+ exports.Comonad = {
2982
+ URI: exports.URI,
2983
+ map: _map,
2984
+ extend: _extend,
2985
+ extract: exports.extract
2986
+ };
2987
+ // -------------------------------------------------------------------------------------
2988
+ // do notation
2989
+ // -------------------------------------------------------------------------------------
2990
+ /**
2991
+ * @since 2.9.0
2992
+ */
2993
+ exports.Do = (0, exports.of)(_.emptyRecord);
2994
+ /**
2995
+ * @since 2.8.0
2996
+ */
2997
+ exports.bindTo = (0, Functor.bindTo)(exports.Functor);
2998
+ /**
2999
+ * @since 2.8.0
3000
+ */
3001
+ exports.bind = (0, Chain.bind)(exports.Chain);
3002
+ // -------------------------------------------------------------------------------------
3003
+ // pipeable sequence S
3004
+ // -------------------------------------------------------------------------------------
3005
+ /**
3006
+ * @since 2.8.0
3007
+ */
3008
+ exports.apS = (0, Apply.apS)(exports.Apply);
3009
+ // -------------------------------------------------------------------------------------
3010
+ // utils
3011
+ // -------------------------------------------------------------------------------------
3012
+ /**
3013
+ * @since 2.5.0
3014
+ */
3015
+ exports.head = exports.extract;
3016
+ /**
3017
+ * @since 2.5.0
3018
+ */
3019
+ exports.tail = _.tail;
3020
+ /**
3021
+ * @since 2.5.0
3022
+ */
3023
+ var last = function (as) { return as[as.length - 1]; };
3024
+ exports.last = last;
3025
+ /**
3026
+ * Get all but the last element of a non empty array, creating a new array.
3027
+ *
3028
+ * @example
3029
+ * import { init } from 'fp-ts/ReadonlyNonEmptyArray'
3030
+ *
3031
+ * assert.deepStrictEqual(init([1, 2, 3]), [1, 2])
3032
+ * assert.deepStrictEqual(init([1]), [])
3033
+ *
3034
+ * @since 2.5.0
3035
+ */
3036
+ var init = function (as) { return as.slice(0, -1); };
3037
+ exports.init = init;
3038
+ /**
3039
+ * @since 2.5.0
3040
+ */
3041
+ var min = function (O) {
3042
+ var S = Se.min(O);
3043
+ return function (as) { return as.reduce(S.concat); };
3044
+ };
3045
+ exports.min = min;
3046
+ /**
3047
+ * @since 2.5.0
3048
+ */
3049
+ var max = function (O) {
3050
+ var S = Se.max(O);
3051
+ return function (as) { return as.reduce(S.concat); };
3052
+ };
3053
+ exports.max = max;
3054
+ /**
3055
+ * @since 2.10.0
3056
+ */
3057
+ var concatAll = function (S) { return function (as) { return as.reduce(S.concat); }; };
3058
+ exports.concatAll = concatAll;
3059
+ /**
3060
+ * Break a `ReadonlyArray` into its first element and remaining elements.
3061
+ *
3062
+ * @category destructors
3063
+ * @since 2.11.0
3064
+ */
3065
+ var matchLeft = function (f) { return function (as) {
3066
+ return f((0, exports.head)(as), (0, exports.tail)(as));
3067
+ }; };
3068
+ exports.matchLeft = matchLeft;
3069
+ /**
3070
+ * Break a `ReadonlyArray` into its initial elements and the last element.
3071
+ *
3072
+ * @category destructors
3073
+ * @since 2.11.0
3074
+ */
3075
+ var matchRight = function (f) { return function (as) {
3076
+ return f((0, exports.init)(as), (0, exports.last)(as));
3077
+ }; };
3078
+ exports.matchRight = matchRight;
3079
+ /**
3080
+ * Apply a function to the head, creating a new `ReadonlyNonEmptyArray`.
3081
+ *
3082
+ * @since 2.11.0
3083
+ */
3084
+ var modifyHead = function (f) { return function (as) { return __spreadArray([
3085
+ f((0, exports.head)(as))
3086
+ ], (0, exports.tail)(as), true); }; };
3087
+ exports.modifyHead = modifyHead;
3088
+ /**
3089
+ * Change the head, creating a new `ReadonlyNonEmptyArray`.
3090
+ *
3091
+ * @category combinators
3092
+ * @since 2.11.0
3093
+ */
3094
+ var updateHead = function (a) { return (0, exports.modifyHead)(function () { return a; }); };
3095
+ exports.updateHead = updateHead;
3096
+ /**
3097
+ * Apply a function to the last element, creating a new `ReadonlyNonEmptyArray`.
3098
+ *
3099
+ * @since 2.11.0
3100
+ */
3101
+ var modifyLast = function (f) { return function (as) {
3102
+ return (0, _function.pipe)((0, exports.init)(as), (0, exports.append)(f((0, exports.last)(as))));
3103
+ }; };
3104
+ exports.modifyLast = modifyLast;
3105
+ /**
3106
+ * Change the last element, creating a new `ReadonlyNonEmptyArray`.
3107
+ *
3108
+ * @category combinators
3109
+ * @since 2.11.0
3110
+ */
3111
+ var updateLast = function (a) { return (0, exports.modifyLast)(function () { return a; }); };
3112
+ exports.updateLast = updateLast;
3113
+ /**
3114
+ * Places an element in between members of a `ReadonlyNonEmptyArray`, then folds the results using the provided `Semigroup`.
3115
+ *
3116
+ * @example
3117
+ * import * as S from 'fp-ts/string'
3118
+ * import { intercalate } from 'fp-ts/ReadonlyNonEmptyArray'
3119
+ *
3120
+ * assert.deepStrictEqual(intercalate(S.Semigroup)('-')(['a', 'b', 'c']), 'a-b-c')
3121
+ *
3122
+ * @since 2.12.0
3123
+ */
3124
+ var intercalate = function (S) {
3125
+ var concatAllS = (0, exports.concatAll)(S);
3126
+ return function (middle) { return (0, _function.flow)((0, exports.intersperse)(middle), concatAllS); };
3127
+ };
3128
+ exports.intercalate = intercalate;
3129
+ function groupSort(O) {
3130
+ var sortO = (0, exports.sort)(O);
3131
+ var groupO = group(O);
3132
+ return function (as) { return ((0, exports.isNonEmpty)(as) ? groupO(sortO(as)) : exports.empty); };
3133
+ }
3134
+ exports.groupSort = groupSort;
3135
+ function filter(predicate) {
3136
+ return (0, exports.filterWithIndex)(function (_, a) { return predicate(a); });
3137
+ }
3138
+ exports.filter = filter;
3139
+ /**
3140
+ * Use [`filterWithIndex`](./ReadonlyArray.ts.html#filterwithindex) instead.
3141
+ *
3142
+ * @category combinators
3143
+ * @since 2.5.0
3144
+ * @deprecated
3145
+ */
3146
+ var filterWithIndex = function (predicate) { return function (as) { return (0, exports.fromReadonlyArray)(as.filter(function (a, i) { return predicate(i, a); })); }; };
3147
+ exports.filterWithIndex = filterWithIndex;
3148
+ /**
3149
+ * Use [`unprepend`](#unprepend) instead.
3150
+ *
3151
+ * @category destructors
3152
+ * @since 2.10.0
3153
+ * @deprecated
3154
+ */
3155
+ exports.uncons = exports.unprepend;
3156
+ /**
3157
+ * Use [`unappend`](#unappend) instead.
3158
+ *
3159
+ * @category destructors
3160
+ * @since 2.10.0
3161
+ * @deprecated
3162
+ */
3163
+ exports.unsnoc = exports.unappend;
3164
+ function cons(head, tail) {
3165
+ return tail === undefined ? (0, exports.prepend)(head) : (0, _function.pipe)(tail, (0, exports.prepend)(head));
3166
+ }
3167
+ exports.cons = cons;
3168
+ /**
3169
+ * Use [`append`](./ReadonlyArray.ts.html#append) instead.
3170
+ *
3171
+ * @category constructors
3172
+ * @since 2.5.0
3173
+ * @deprecated
3174
+ */
3175
+ var snoc = function (init, end) { return (0, _function.pipe)(init, concat([end])); };
3176
+ exports.snoc = snoc;
3177
+ /**
3178
+ * Use [`insertAt`](./ReadonlyArray.ts.html#insertat) instead.
3179
+ *
3180
+ * @category combinators
3181
+ * @since 2.5.0
3182
+ * @deprecated
3183
+ */
3184
+ var insertAt = function (i, a) { return function (as) {
3185
+ return i < 0 || i > as.length ? _.none : _.some((0, exports.unsafeInsertAt)(i, a, as));
3186
+ }; };
3187
+ exports.insertAt = insertAt;
3188
+ /**
3189
+ * Use [`prependAll`](#prependall) instead.
3190
+ *
3191
+ * @category combinators
3192
+ * @since 2.9.0
3193
+ * @deprecated
3194
+ */
3195
+ exports.prependToAll = exports.prependAll;
3196
+ /**
3197
+ * Use [`concatAll`](#concatall) instead.
3198
+ *
3199
+ * @since 2.5.0
3200
+ * @deprecated
3201
+ */
3202
+ exports.fold = exports.concatAll;
3203
+ /**
3204
+ * This instance is deprecated, use small, specific instances instead.
3205
+ * For example if a function needs a `Functor` instance, pass `RNEA.Functor` instead of `RNEA.readonlyNonEmptyArray`
3206
+ * (where `RNEA` is from `import RNEA from 'fp-ts/ReadonlyNonEmptyArray'`)
3207
+ *
3208
+ * @category instances
3209
+ * @since 2.5.0
3210
+ * @deprecated
3211
+ */
3212
+ exports.readonlyNonEmptyArray = {
3213
+ URI: exports.URI,
3214
+ of: exports.of,
3215
+ map: _map,
3216
+ mapWithIndex: _mapWithIndex,
3217
+ ap: _ap,
3218
+ chain: _chain,
3219
+ extend: _extend,
3220
+ extract: exports.extract,
3221
+ reduce: _reduce,
3222
+ foldMap: _foldMap,
3223
+ reduceRight: _reduceRight,
3224
+ traverse: _traverse,
3225
+ sequence: exports.sequence,
3226
+ reduceWithIndex: _reduceWithIndex,
3227
+ foldMapWithIndex: _foldMapWithIndex,
3228
+ reduceRightWithIndex: _reduceRightWithIndex,
3229
+ traverseWithIndex: _traverseWithIndex,
3230
+ alt: _alt
3231
+ };
3232
+ });
3233
+
3234
+ const ReadonlyNonEmptyArray$1 = /*@__PURE__*/getDefaultExportFromCjs(ReadonlyNonEmptyArray);
3235
+
3236
+ var NonEmptyArray = createCommonjsModule(function (module, exports) {
3237
+ "use strict";
3238
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3239
+ if (k2 === undefined) k2 = k;
3240
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3241
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3242
+ desc = { enumerable: true, get: function() { return m[k]; } };
3243
+ }
3244
+ Object.defineProperty(o, k2, desc);
3245
+ }) : (function(o, m, k, k2) {
3246
+ if (k2 === undefined) k2 = k;
3247
+ o[k2] = m[k];
3248
+ }));
3249
+ var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
3250
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
3251
+ }) : function(o, v) {
3252
+ o["default"] = v;
3253
+ });
3254
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
3255
+ if (mod && mod.__esModule) return mod;
3256
+ var result = {};
3257
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3258
+ __setModuleDefault(result, mod);
3259
+ return result;
3260
+ };
3261
+ var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from, pack) {
3262
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3263
+ if (ar || !(i in from)) {
3264
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
3265
+ ar[i] = from[i];
3266
+ }
3267
+ }
3268
+ return to.concat(ar || Array.prototype.slice.call(from));
3269
+ };
3270
+ Object.defineProperty(exports, "__esModule", { value: true });
3271
+ exports.mapWithIndex = exports.map = exports.flatten = exports.duplicate = exports.extend = exports.chain = exports.ap = exports.alt = exports.altW = exports.chunksOf = exports.splitAt = exports.chop = exports.chainWithIndex = exports.foldMap = exports.foldMapWithIndex = exports.intersperse = exports.prependAll = exports.unzip = exports.zip = exports.zipWith = exports.of = exports.copy = exports.modifyAt = exports.updateAt = exports.insertAt = exports.sort = exports.groupBy = exports.group = exports.reverse = exports.concat = exports.concatW = exports.unappend = exports.unprepend = exports.range = exports.replicate = exports.makeBy = exports.fromArray = exports.fromReadonlyNonEmptyArray = exports.rotate = exports.union = exports.sortBy = exports.uniq = exports.unsafeUpdateAt = exports.unsafeInsertAt = exports.append = exports.appendW = exports.prepend = exports.prependW = exports.isOutOfBound = exports.isNonEmpty = void 0;
3272
+ exports.filter = exports.groupSort = exports.intercalate = exports.updateLast = exports.modifyLast = exports.updateHead = exports.modifyHead = exports.matchRight = exports.matchLeft = exports.concatAll = exports.max = exports.min = exports.init = exports.last = exports.tail = exports.head = exports.apS = exports.bind = exports.bindTo = exports.Do = exports.Comonad = exports.Alt = exports.TraversableWithIndex = exports.Traversable = exports.FoldableWithIndex = exports.Foldable = exports.Monad = exports.chainFirst = exports.Chain = exports.Applicative = exports.apSecond = exports.apFirst = exports.Apply = exports.FunctorWithIndex = exports.Pointed = exports.flap = exports.Functor = exports.getUnionSemigroup = exports.getEq = exports.getSemigroup = exports.getShow = exports.URI = exports.extract = exports.traverseWithIndex = exports.sequence = exports.traverse = exports.reduceRightWithIndex = exports.reduceRight = exports.reduceWithIndex = exports.reduce = void 0;
3273
+ exports.nonEmptyArray = exports.fold = exports.prependToAll = exports.snoc = exports.cons = exports.unsnoc = exports.uncons = exports.filterWithIndex = void 0;
3274
+
3275
+
3276
+
3277
+
3278
+ var _ = __importStar(internal);
3279
+
3280
+ var RNEA = __importStar(ReadonlyNonEmptyArray);
3281
+ // -------------------------------------------------------------------------------------
3282
+ // internal
3283
+ // -------------------------------------------------------------------------------------
3284
+ /**
3285
+ * @internal
3286
+ */
3287
+ var isNonEmpty = function (as) { return as.length > 0; };
3288
+ exports.isNonEmpty = isNonEmpty;
3289
+ /**
3290
+ * @internal
3291
+ */
3292
+ var isOutOfBound = function (i, as) { return i < 0 || i >= as.length; };
3293
+ exports.isOutOfBound = isOutOfBound;
3294
+ /**
3295
+ * @internal
3296
+ */
3297
+ var prependW = function (head) { return function (tail) { return __spreadArray([head], tail, true); }; };
3298
+ exports.prependW = prependW;
3299
+ /**
3300
+ * @internal
3301
+ */
3302
+ exports.prepend = exports.prependW;
3303
+ /**
3304
+ * @internal
3305
+ */
3306
+ var appendW = function (end) { return function (init) { return __spreadArray(__spreadArray([], init, true), [end], false); }; };
3307
+ exports.appendW = appendW;
3308
+ /**
3309
+ * @internal
3310
+ */
3311
+ exports.append = exports.appendW;
3312
+ /**
3313
+ * @internal
3314
+ */
3315
+ var unsafeInsertAt = function (i, a, as) {
3316
+ if ((0, exports.isNonEmpty)(as)) {
3317
+ var xs = (0, exports.fromReadonlyNonEmptyArray)(as);
3318
+ xs.splice(i, 0, a);
3319
+ return xs;
3320
+ }
3321
+ return [a];
3322
+ };
3323
+ exports.unsafeInsertAt = unsafeInsertAt;
3324
+ /**
3325
+ * @internal
3326
+ */
3327
+ var unsafeUpdateAt = function (i, a, as) {
3328
+ var xs = (0, exports.fromReadonlyNonEmptyArray)(as);
3329
+ xs[i] = a;
3330
+ return xs;
3331
+ };
3332
+ exports.unsafeUpdateAt = unsafeUpdateAt;
3333
+ /**
3334
+ * Remove duplicates from a `NonEmptyArray`, keeping the first occurrence of an element.
3335
+ *
3336
+ * @example
3337
+ * import { uniq } from 'fp-ts/NonEmptyArray'
3338
+ * import * as N from 'fp-ts/number'
3339
+ *
3340
+ * assert.deepStrictEqual(uniq(N.Eq)([1, 2, 1]), [1, 2])
3341
+ *
3342
+ * @category combinators
3343
+ * @since 2.11.0
3344
+ */
3345
+ var uniq = function (E) { return function (as) {
3346
+ if (as.length === 1) {
3347
+ return (0, exports.copy)(as);
3348
+ }
3349
+ var out = [(0, exports.head)(as)];
3350
+ var rest = (0, exports.tail)(as);
3351
+ var _loop_1 = function (a) {
3352
+ if (out.every(function (o) { return !E.equals(o, a); })) {
3353
+ out.push(a);
3354
+ }
3355
+ };
3356
+ for (var _i = 0, rest_1 = rest; _i < rest_1.length; _i++) {
3357
+ var a = rest_1[_i];
3358
+ _loop_1(a);
3359
+ }
3360
+ return out;
3361
+ }; };
3362
+ exports.uniq = uniq;
3363
+ /**
3364
+ * Sort the elements of a `NonEmptyArray` in increasing order, where elements are compared using first `ords[0]`, then `ords[1]`,
3365
+ * etc...
3366
+ *
3367
+ * @example
3368
+ * import * as NEA from 'fp-ts/NonEmptyArray'
3369
+ * import { contramap } from 'fp-ts/Ord'
3370
+ * import * as S from 'fp-ts/string'
3371
+ * import * as N from 'fp-ts/number'
3372
+ * import { pipe } from 'fp-ts/function'
3373
+ *
3374
+ * interface Person {
3375
+ * name: string
3376
+ * age: number
3377
+ * }
3378
+ *
3379
+ * const byName = pipe(S.Ord, contramap((p: Person) => p.name))
3380
+ *
3381
+ * const byAge = pipe(N.Ord, contramap((p: Person) => p.age))
3382
+ *
3383
+ * const sortByNameByAge = NEA.sortBy([byName, byAge])
3384
+ *
3385
+ * const persons: NEA.NonEmptyArray<Person> = [
3386
+ * { name: 'a', age: 1 },
3387
+ * { name: 'b', age: 3 },
3388
+ * { name: 'c', age: 2 },
3389
+ * { name: 'b', age: 2 }
3390
+ * ]
3391
+ *
3392
+ * assert.deepStrictEqual(sortByNameByAge(persons), [
3393
+ * { name: 'a', age: 1 },
3394
+ * { name: 'b', age: 2 },
3395
+ * { name: 'b', age: 3 },
3396
+ * { name: 'c', age: 2 }
3397
+ * ])
3398
+ *
3399
+ * @category combinators
3400
+ * @since 2.11.0
3401
+ */
3402
+ var sortBy = function (ords) {
3403
+ if ((0, exports.isNonEmpty)(ords)) {
3404
+ var M = (0, Ord.getMonoid)();
3405
+ return (0, exports.sort)(ords.reduce(M.concat, M.empty));
3406
+ }
3407
+ return exports.copy;
3408
+ };
3409
+ exports.sortBy = sortBy;
3410
+ /**
3411
+ * @category combinators
3412
+ * @since 2.11.0
3413
+ */
3414
+ var union = function (E) {
3415
+ var uniqE = (0, exports.uniq)(E);
3416
+ return function (second) { return function (first) { return uniqE((0, _function.pipe)(first, concat(second))); }; };
3417
+ };
3418
+ exports.union = union;
3419
+ /**
3420
+ * Rotate a `NonEmptyArray` by `n` steps.
3421
+ *
3422
+ * @example
3423
+ * import { rotate } from 'fp-ts/NonEmptyArray'
3424
+ *
3425
+ * assert.deepStrictEqual(rotate(2)([1, 2, 3, 4, 5]), [4, 5, 1, 2, 3])
3426
+ * assert.deepStrictEqual(rotate(-2)([1, 2, 3, 4, 5]), [3, 4, 5, 1, 2])
3427
+ *
3428
+ * @category combinators
3429
+ * @since 2.11.0
3430
+ */
3431
+ var rotate = function (n) { return function (as) {
3432
+ var len = as.length;
3433
+ var m = Math.round(n) % len;
3434
+ if ((0, exports.isOutOfBound)(Math.abs(m), as) || m === 0) {
3435
+ return (0, exports.copy)(as);
3436
+ }
3437
+ if (m < 0) {
3438
+ var _a = (0, exports.splitAt)(-m)(as), f = _a[0], s = _a[1];
3439
+ return (0, _function.pipe)(s, concat(f));
3440
+ }
3441
+ else {
3442
+ return (0, exports.rotate)(m - len)(as);
3443
+ }
3444
+ }; };
3445
+ exports.rotate = rotate;
3446
+ // -------------------------------------------------------------------------------------
3447
+ // constructors
3448
+ // -------------------------------------------------------------------------------------
3449
+ /**
3450
+ * @category constructors
3451
+ * @since 2.10.0
3452
+ */
3453
+ exports.fromReadonlyNonEmptyArray = _.fromReadonlyNonEmptyArray;
3454
+ /**
3455
+ * Builds a `NonEmptyArray` from an `Array` returning `none` if `as` is an empty array
3456
+ *
3457
+ * @category constructors
3458
+ * @since 2.0.0
3459
+ */
3460
+ var fromArray = function (as) { return ((0, exports.isNonEmpty)(as) ? _.some(as) : _.none); };
3461
+ exports.fromArray = fromArray;
3462
+ /**
3463
+ * Return a `NonEmptyArray` of length `n` with element `i` initialized with `f(i)`.
3464
+ *
3465
+ * **Note**. `n` is normalized to a natural number.
3466
+ *
3467
+ * @example
3468
+ * import { makeBy } from 'fp-ts/NonEmptyArray'
3469
+ * import { pipe } from 'fp-ts/function'
3470
+ *
3471
+ * const double = (n: number): number => n * 2
3472
+ * assert.deepStrictEqual(pipe(5, makeBy(double)), [0, 2, 4, 6, 8])
3473
+ *
3474
+ * @category constructors
3475
+ * @since 2.11.0
3476
+ */
3477
+ var makeBy = function (f) { return function (n) {
3478
+ var j = Math.max(0, Math.floor(n));
3479
+ var out = [f(0)];
3480
+ for (var i = 1; i < j; i++) {
3481
+ out.push(f(i));
3482
+ }
3483
+ return out;
3484
+ }; };
3485
+ exports.makeBy = makeBy;
3486
+ /**
3487
+ * Create a `NonEmptyArray` containing a value repeated the specified number of times.
3488
+ *
3489
+ * **Note**. `n` is normalized to a natural number.
3490
+ *
3491
+ * @example
3492
+ * import { replicate } from 'fp-ts/NonEmptyArray'
3493
+ * import { pipe } from 'fp-ts/function'
3494
+ *
3495
+ * assert.deepStrictEqual(pipe(3, replicate('a')), ['a', 'a', 'a'])
3496
+ *
3497
+ * @category constructors
3498
+ * @since 2.11.0
3499
+ */
3500
+ var replicate = function (a) { return (0, exports.makeBy)(function () { return a; }); };
3501
+ exports.replicate = replicate;
3502
+ /**
3503
+ * Create a `NonEmptyArray` containing a range of integers, including both endpoints.
3504
+ *
3505
+ * @example
3506
+ * import { range } from 'fp-ts/NonEmptyArray'
3507
+ *
3508
+ * assert.deepStrictEqual(range(1, 5), [1, 2, 3, 4, 5])
3509
+ *
3510
+ * @category constructors
3511
+ * @since 2.11.0
3512
+ */
3513
+ var range = function (start, end) {
3514
+ return start <= end ? (0, exports.makeBy)(function (i) { return start + i; })(end - start + 1) : [start];
3515
+ };
3516
+ exports.range = range;
3517
+ // -------------------------------------------------------------------------------------
3518
+ // destructors
3519
+ // -------------------------------------------------------------------------------------
3520
+ /**
3521
+ * Return the tuple of the `head` and the `tail`.
3522
+ *
3523
+ * @example
3524
+ * import { unprepend } from 'fp-ts/NonEmptyArray'
3525
+ *
3526
+ * assert.deepStrictEqual(unprepend([1, 2, 3]), [1, [2, 3]])
3527
+ *
3528
+ * @category destructors
3529
+ * @since 2.9.0
3530
+ */
3531
+ var unprepend = function (as) { return [(0, exports.head)(as), (0, exports.tail)(as)]; };
3532
+ exports.unprepend = unprepend;
3533
+ /**
3534
+ * Return the tuple of the `init` and the `last`.
3535
+ *
3536
+ * @example
3537
+ * import { unappend } from 'fp-ts/NonEmptyArray'
3538
+ *
3539
+ * assert.deepStrictEqual(unappend([1, 2, 3, 4]), [[1, 2, 3], 4])
3540
+ *
3541
+ * @category destructors
3542
+ * @since 2.9.0
3543
+ */
3544
+ var unappend = function (as) { return [(0, exports.init)(as), (0, exports.last)(as)]; };
3545
+ exports.unappend = unappend;
3546
+ function concatW(second) {
3547
+ return function (first) { return first.concat(second); };
3548
+ }
3549
+ exports.concatW = concatW;
3550
+ function concat(x, y) {
3551
+ return y ? x.concat(y) : function (y) { return y.concat(x); };
3552
+ }
3553
+ exports.concat = concat;
3554
+ /**
3555
+ * @category combinators
3556
+ * @since 2.0.0
3557
+ */
3558
+ var reverse = function (as) { return __spreadArray([(0, exports.last)(as)], as.slice(0, -1).reverse(), true); };
3559
+ exports.reverse = reverse;
3560
+ function group(E) {
3561
+ return function (as) {
3562
+ var len = as.length;
3563
+ if (len === 0) {
3564
+ return [];
3565
+ }
3566
+ var out = [];
3567
+ var head = as[0];
3568
+ var nea = [head];
3569
+ for (var i = 1; i < len; i++) {
3570
+ var a = as[i];
3571
+ if (E.equals(a, head)) {
3572
+ nea.push(a);
3573
+ }
3574
+ else {
3575
+ out.push(nea);
3576
+ head = a;
3577
+ nea = [head];
3578
+ }
3579
+ }
3580
+ out.push(nea);
3581
+ return out;
3582
+ };
3583
+ }
3584
+ exports.group = group;
3585
+ /**
3586
+ * Splits an array into sub-non-empty-arrays stored in an object, based on the result of calling a `string`-returning
3587
+ * function on each element, and grouping the results according to values returned
3588
+ *
3589
+ * @example
3590
+ * import { groupBy } from 'fp-ts/NonEmptyArray'
3591
+ *
3592
+ * assert.deepStrictEqual(groupBy((s: string) => String(s.length))(['a', 'b', 'ab']), {
3593
+ * '1': ['a', 'b'],
3594
+ * '2': ['ab']
3595
+ * })
3596
+ *
3597
+ * @category combinators
3598
+ * @since 2.0.0
3599
+ */
3600
+ var groupBy = function (f) { return function (as) {
3601
+ var out = {};
3602
+ for (var _i = 0, as_1 = as; _i < as_1.length; _i++) {
3603
+ var a = as_1[_i];
3604
+ var k = f(a);
3605
+ if (_.has.call(out, k)) {
3606
+ out[k].push(a);
3607
+ }
3608
+ else {
3609
+ out[k] = [a];
3610
+ }
3611
+ }
3612
+ return out;
3613
+ }; };
3614
+ exports.groupBy = groupBy;
3615
+ /**
3616
+ * @category combinators
3617
+ * @since 2.0.0
3618
+ */
3619
+ var sort = function (O) { return function (as) {
3620
+ return as.slice().sort(O.compare);
3621
+ }; };
3622
+ exports.sort = sort;
3623
+ /**
3624
+ * @category combinators
3625
+ * @since 2.0.0
3626
+ */
3627
+ var insertAt = function (i, a) { return function (as) {
3628
+ return i < 0 || i > as.length ? _.none : _.some((0, exports.unsafeInsertAt)(i, a, as));
3629
+ }; };
3630
+ exports.insertAt = insertAt;
3631
+ /**
3632
+ * @category combinators
3633
+ * @since 2.0.0
3634
+ */
3635
+ var updateAt = function (i, a) {
3636
+ return (0, exports.modifyAt)(i, function () { return a; });
3637
+ };
3638
+ exports.updateAt = updateAt;
3639
+ /**
3640
+ * @category combinators
3641
+ * @since 2.0.0
3642
+ */
3643
+ var modifyAt = function (i, f) { return function (as) {
3644
+ return (0, exports.isOutOfBound)(i, as) ? _.none : _.some((0, exports.unsafeUpdateAt)(i, f(as[i]), as));
3645
+ }; };
3646
+ exports.modifyAt = modifyAt;
3647
+ /**
3648
+ * @category combinators
3649
+ * @since 2.0.0
3650
+ */
3651
+ exports.copy = exports.fromReadonlyNonEmptyArray;
3652
+ /**
3653
+ * @category Pointed
3654
+ * @since 2.0.0
3655
+ */
3656
+ var of = function (a) { return [a]; };
3657
+ exports.of = of;
3658
+ /**
3659
+ * @category combinators
3660
+ * @since 2.5.1
3661
+ */
3662
+ var zipWith = function (as, bs, f) {
3663
+ var cs = [f(as[0], bs[0])];
3664
+ var len = Math.min(as.length, bs.length);
3665
+ for (var i = 1; i < len; i++) {
3666
+ cs[i] = f(as[i], bs[i]);
3667
+ }
3668
+ return cs;
3669
+ };
3670
+ exports.zipWith = zipWith;
3671
+ function zip(as, bs) {
3672
+ if (bs === undefined) {
3673
+ return function (bs) { return zip(bs, as); };
3674
+ }
3675
+ return (0, exports.zipWith)(as, bs, function (a, b) { return [a, b]; });
3676
+ }
3677
+ exports.zip = zip;
3678
+ /**
3679
+ * @category combinators
3680
+ * @since 2.5.1
3681
+ */
3682
+ var unzip = function (abs) {
3683
+ var fa = [abs[0][0]];
3684
+ var fb = [abs[0][1]];
3685
+ for (var i = 1; i < abs.length; i++) {
3686
+ fa[i] = abs[i][0];
3687
+ fb[i] = abs[i][1];
3688
+ }
3689
+ return [fa, fb];
3690
+ };
3691
+ exports.unzip = unzip;
3692
+ /**
3693
+ * Prepend an element to every member of an array
3694
+ *
3695
+ * @example
3696
+ * import { prependAll } from 'fp-ts/NonEmptyArray'
3697
+ *
3698
+ * assert.deepStrictEqual(prependAll(9)([1, 2, 3, 4]), [9, 1, 9, 2, 9, 3, 9, 4])
3699
+ *
3700
+ * @category combinators
3701
+ * @since 2.10.0
3702
+ */
3703
+ var prependAll = function (middle) { return function (as) {
3704
+ var out = [middle, as[0]];
3705
+ for (var i = 1; i < as.length; i++) {
3706
+ out.push(middle, as[i]);
3707
+ }
3708
+ return out;
3709
+ }; };
3710
+ exports.prependAll = prependAll;
3711
+ /**
3712
+ * Places an element in between members of an array
3713
+ *
3714
+ * @example
3715
+ * import { intersperse } from 'fp-ts/NonEmptyArray'
3716
+ *
3717
+ * assert.deepStrictEqual(intersperse(9)([1, 2, 3, 4]), [1, 9, 2, 9, 3, 9, 4])
3718
+ *
3719
+ * @category combinators
3720
+ * @since 2.9.0
3721
+ */
3722
+ var intersperse = function (middle) { return function (as) {
3723
+ var rest = (0, exports.tail)(as);
3724
+ return (0, exports.isNonEmpty)(rest) ? (0, _function.pipe)(rest, (0, exports.prependAll)(middle), (0, exports.prepend)((0, exports.head)(as))) : (0, exports.copy)(as);
3725
+ }; };
3726
+ exports.intersperse = intersperse;
3727
+ /**
3728
+ * @category combinators
3729
+ * @since 2.0.0
3730
+ */
3731
+ exports.foldMapWithIndex = RNEA.foldMapWithIndex;
3732
+ /**
3733
+ * @category combinators
3734
+ * @since 2.0.0
3735
+ */
3736
+ exports.foldMap = RNEA.foldMap;
3737
+ /**
3738
+ * @category combinators
3739
+ * @since 2.10.0
3740
+ */
3741
+ var chainWithIndex = function (f) { return function (as) {
3742
+ var out = (0, exports.fromReadonlyNonEmptyArray)(f(0, (0, exports.head)(as)));
3743
+ for (var i = 1; i < as.length; i++) {
3744
+ out.push.apply(out, f(i, as[i]));
3745
+ }
3746
+ return out;
3747
+ }; };
3748
+ exports.chainWithIndex = chainWithIndex;
3749
+ /**
3750
+ * @category combinators
3751
+ * @since 2.10.0
3752
+ */
3753
+ var chop = function (f) { return function (as) {
3754
+ var _a = f(as), b = _a[0], rest = _a[1];
3755
+ var out = [b];
3756
+ var next = rest;
3757
+ while ((0, exports.isNonEmpty)(next)) {
3758
+ var _b = f(next), b_1 = _b[0], rest_2 = _b[1];
3759
+ out.push(b_1);
3760
+ next = rest_2;
3761
+ }
3762
+ return out;
3763
+ }; };
3764
+ exports.chop = chop;
3765
+ /**
3766
+ * Splits a `NonEmptyArray` into two pieces, the first piece has max `n` elements.
3767
+ *
3768
+ * @category combinators
3769
+ * @since 2.10.0
3770
+ */
3771
+ var splitAt = function (n) { return function (as) {
3772
+ var m = Math.max(1, n);
3773
+ return m >= as.length ? [(0, exports.copy)(as), []] : [(0, _function.pipe)(as.slice(1, m), (0, exports.prepend)((0, exports.head)(as))), as.slice(m)];
3774
+ }; };
3775
+ exports.splitAt = splitAt;
3776
+ /**
3777
+ * @category combinators
3778
+ * @since 2.10.0
3779
+ */
3780
+ var chunksOf = function (n) { return (0, exports.chop)((0, exports.splitAt)(n)); };
3781
+ exports.chunksOf = chunksOf;
3782
+ // -------------------------------------------------------------------------------------
3783
+ // non-pipeables
3784
+ // -------------------------------------------------------------------------------------
3785
+ /* istanbul ignore next */
3786
+ var _map = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.map)(f)); };
3787
+ /* istanbul ignore next */
3788
+ var _mapWithIndex = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.mapWithIndex)(f)); };
3789
+ /* istanbul ignore next */
3790
+ var _ap = function (fab, fa) { return (0, _function.pipe)(fab, (0, exports.ap)(fa)); };
3791
+ /* istanbul ignore next */
3792
+ var _chain = function (ma, f) { return (0, _function.pipe)(ma, (0, exports.chain)(f)); };
3793
+ /* istanbul ignore next */
3794
+ var _extend = function (wa, f) { return (0, _function.pipe)(wa, (0, exports.extend)(f)); };
3795
+ /* istanbul ignore next */
3796
+ var _reduce = function (fa, b, f) { return (0, _function.pipe)(fa, (0, exports.reduce)(b, f)); };
3797
+ /* istanbul ignore next */
3798
+ var _foldMap = function (M) {
3799
+ var foldMapM = (0, exports.foldMap)(M);
3800
+ return function (fa, f) { return (0, _function.pipe)(fa, foldMapM(f)); };
3801
+ };
3802
+ /* istanbul ignore next */
3803
+ var _reduceRight = function (fa, b, f) { return (0, _function.pipe)(fa, (0, exports.reduceRight)(b, f)); };
3804
+ /* istanbul ignore next */
3805
+ var _traverse = function (F) {
3806
+ var traverseF = (0, exports.traverse)(F);
3807
+ return function (ta, f) { return (0, _function.pipe)(ta, traverseF(f)); };
3808
+ };
3809
+ /* istanbul ignore next */
3810
+ var _alt = function (fa, that) { return (0, _function.pipe)(fa, (0, exports.alt)(that)); };
3811
+ /* istanbul ignore next */
3812
+ var _reduceWithIndex = function (fa, b, f) {
3813
+ return (0, _function.pipe)(fa, (0, exports.reduceWithIndex)(b, f));
3814
+ };
3815
+ /* istanbul ignore next */
3816
+ var _foldMapWithIndex = function (M) {
3817
+ var foldMapWithIndexM = (0, exports.foldMapWithIndex)(M);
3818
+ return function (fa, f) { return (0, _function.pipe)(fa, foldMapWithIndexM(f)); };
3819
+ };
3820
+ /* istanbul ignore next */
3821
+ var _reduceRightWithIndex = function (fa, b, f) {
3822
+ return (0, _function.pipe)(fa, (0, exports.reduceRightWithIndex)(b, f));
3823
+ };
3824
+ /* istanbul ignore next */
3825
+ var _traverseWithIndex = function (F) {
3826
+ var traverseWithIndexF = (0, exports.traverseWithIndex)(F);
3827
+ return function (ta, f) { return (0, _function.pipe)(ta, traverseWithIndexF(f)); };
3828
+ };
3829
+ // -------------------------------------------------------------------------------------
3830
+ // type class members
3831
+ // -------------------------------------------------------------------------------------
3832
+ /**
3833
+ * Less strict version of [`alt`](#alt).
3834
+ *
3835
+ * @category Alt
3836
+ * @since 2.9.0
3837
+ */
3838
+ var altW = function (that) { return function (as) {
3839
+ return (0, _function.pipe)(as, concatW(that()));
3840
+ }; };
3841
+ exports.altW = altW;
3842
+ /**
3843
+ * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
3844
+ * types of kind `* -> *`.
3845
+ *
3846
+ * @category Alt
3847
+ * @since 2.6.2
3848
+ */
3849
+ exports.alt = exports.altW;
3850
+ /**
3851
+ * Apply a function to an argument under a type constructor.
3852
+ *
3853
+ * @category Apply
3854
+ * @since 2.0.0
3855
+ */
3856
+ var ap = function (as) {
3857
+ return (0, exports.chain)(function (f) { return (0, _function.pipe)(as, (0, exports.map)(f)); });
3858
+ };
3859
+ exports.ap = ap;
3860
+ /**
3861
+ * Composes computations in sequence, using the return value of one computation to determine the next computation.
3862
+ *
3863
+ * @category Monad
3864
+ * @since 2.0.0
3865
+ */
3866
+ var chain = function (f) {
3867
+ return (0, exports.chainWithIndex)(function (_, a) { return f(a); });
3868
+ };
3869
+ exports.chain = chain;
3870
+ /**
3871
+ * @category Extend
3872
+ * @since 2.0.0
3873
+ */
3874
+ var extend = function (f) { return function (as) {
3875
+ var next = (0, exports.tail)(as);
3876
+ var out = [f(as)];
3877
+ while ((0, exports.isNonEmpty)(next)) {
3878
+ out.push(f(next));
3879
+ next = (0, exports.tail)(next);
3880
+ }
3881
+ return out;
3882
+ }; };
3883
+ exports.extend = extend;
3884
+ /**
3885
+ * Derivable from `Extend`.
3886
+ *
3887
+ * @category combinators
3888
+ * @since 2.5.0
3889
+ */
3890
+ exports.duplicate = (0, exports.extend)(_function.identity);
3891
+ /**
3892
+ * Derivable from `Chain`.
3893
+ *
3894
+ * @category combinators
3895
+ * @since 2.5.0
3896
+ */
3897
+ exports.flatten = (0, exports.chain)(_function.identity);
3898
+ /**
3899
+ * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
3900
+ * use the type constructor `F` to represent some computational context.
3901
+ *
3902
+ * @category Functor
3903
+ * @since 2.0.0
3904
+ */
3905
+ var map = function (f) { return (0, exports.mapWithIndex)(function (_, a) { return f(a); }); };
3906
+ exports.map = map;
3907
+ /**
3908
+ * @category FunctorWithIndex
3909
+ * @since 2.0.0
3910
+ */
3911
+ var mapWithIndex = function (f) { return function (as) {
3912
+ var out = [f(0, (0, exports.head)(as))];
3913
+ for (var i = 1; i < as.length; i++) {
3914
+ out.push(f(i, as[i]));
3915
+ }
3916
+ return out;
3917
+ }; };
3918
+ exports.mapWithIndex = mapWithIndex;
3919
+ /**
3920
+ * @category Foldable
3921
+ * @since 2.0.0
3922
+ */
3923
+ exports.reduce = RNEA.reduce;
3924
+ /**
3925
+ * @category FoldableWithIndex
3926
+ * @since 2.0.0
3927
+ */
3928
+ exports.reduceWithIndex = RNEA.reduceWithIndex;
3929
+ /**
3930
+ * @category Foldable
3931
+ * @since 2.0.0
3932
+ */
3933
+ exports.reduceRight = RNEA.reduceRight;
3934
+ /**
3935
+ * @category FoldableWithIndex
3936
+ * @since 2.0.0
3937
+ */
3938
+ exports.reduceRightWithIndex = RNEA.reduceRightWithIndex;
3939
+ /**
3940
+ * @since 2.6.3
3941
+ */
3942
+ var traverse = function (F) {
3943
+ var traverseWithIndexF = (0, exports.traverseWithIndex)(F);
3944
+ return function (f) { return traverseWithIndexF(function (_, a) { return f(a); }); };
3945
+ };
3946
+ exports.traverse = traverse;
3947
+ /**
3948
+ * @since 2.6.3
3949
+ */
3950
+ var sequence = function (F) { return (0, exports.traverseWithIndex)(F)(function (_, a) { return a; }); };
3951
+ exports.sequence = sequence;
3952
+ /**
3953
+ * @since 2.6.3
3954
+ */
3955
+ var traverseWithIndex = function (F) { return function (f) { return function (as) {
3956
+ var out = F.map(f(0, (0, exports.head)(as)), exports.of);
3957
+ for (var i = 1; i < as.length; i++) {
3958
+ out = F.ap(F.map(out, function (bs) { return function (b) { return (0, _function.pipe)(bs, (0, exports.append)(b)); }; }), f(i, as[i]));
3959
+ }
3960
+ return out;
3961
+ }; }; };
3962
+ exports.traverseWithIndex = traverseWithIndex;
3963
+ /**
3964
+ * @since 2.7.0
3965
+ */
3966
+ exports.extract = RNEA.head;
3967
+ // -------------------------------------------------------------------------------------
3968
+ // instances
3969
+ // -------------------------------------------------------------------------------------
3970
+ /**
3971
+ * @category instances
3972
+ * @since 2.0.0
3973
+ */
3974
+ exports.URI = 'NonEmptyArray';
3975
+ /**
3976
+ * @category instances
3977
+ * @since 2.0.0
3978
+ */
3979
+ exports.getShow = RNEA.getShow;
3980
+ /**
3981
+ * Builds a `Semigroup` instance for `NonEmptyArray`
3982
+ *
3983
+ * @category instances
3984
+ * @since 2.0.0
3985
+ */
3986
+ var getSemigroup = function () { return ({
3987
+ concat: concat
3988
+ }); };
3989
+ exports.getSemigroup = getSemigroup;
3990
+ /**
3991
+ * @example
3992
+ * import { getEq } from 'fp-ts/NonEmptyArray'
3993
+ * import * as N from 'fp-ts/number'
3994
+ *
3995
+ * const E = getEq(N.Eq)
3996
+ * assert.strictEqual(E.equals([1, 2], [1, 2]), true)
3997
+ * assert.strictEqual(E.equals([1, 2], [1, 3]), false)
3998
+ *
3999
+ * @category instances
4000
+ * @since 2.0.0
4001
+ */
4002
+ exports.getEq = RNEA.getEq;
4003
+ /**
4004
+ * @category combinators
4005
+ * @since 2.11.0
4006
+ */
4007
+ var getUnionSemigroup = function (E) {
4008
+ var unionE = (0, exports.union)(E);
4009
+ return {
4010
+ concat: function (first, second) { return unionE(second)(first); }
4011
+ };
4012
+ };
4013
+ exports.getUnionSemigroup = getUnionSemigroup;
4014
+ /**
4015
+ * @category instances
4016
+ * @since 2.7.0
4017
+ */
4018
+ exports.Functor = {
4019
+ URI: exports.URI,
4020
+ map: _map
4021
+ };
4022
+ /**
4023
+ * Derivable from `Functor`.
4024
+ *
4025
+ * @category combinators
4026
+ * @since 2.10.0
4027
+ */
4028
+ exports.flap = (0, Functor.flap)(exports.Functor);
4029
+ /**
4030
+ * @category instances
4031
+ * @since 2.10.0
4032
+ */
4033
+ exports.Pointed = {
4034
+ URI: exports.URI,
4035
+ of: exports.of
4036
+ };
4037
+ /**
4038
+ * @category instances
4039
+ * @since 2.7.0
4040
+ */
4041
+ exports.FunctorWithIndex = {
4042
+ URI: exports.URI,
4043
+ map: _map,
4044
+ mapWithIndex: _mapWithIndex
4045
+ };
4046
+ /**
4047
+ * @category instances
4048
+ * @since 2.10.0
4049
+ */
4050
+ exports.Apply = {
4051
+ URI: exports.URI,
4052
+ map: _map,
4053
+ ap: _ap
4054
+ };
4055
+ /**
4056
+ * Combine two effectful actions, keeping only the result of the first.
4057
+ *
4058
+ * Derivable from `Apply`.
4059
+ *
4060
+ * @category combinators
4061
+ * @since 2.5.0
4062
+ */
4063
+ exports.apFirst = (0, Apply.apFirst)(exports.Apply);
4064
+ /**
4065
+ * Combine two effectful actions, keeping only the result of the second.
4066
+ *
4067
+ * Derivable from `Apply`.
4068
+ *
4069
+ * @category combinators
4070
+ * @since 2.5.0
4071
+ */
4072
+ exports.apSecond = (0, Apply.apSecond)(exports.Apply);
4073
+ /**
4074
+ * @category instances
4075
+ * @since 2.7.0
4076
+ */
4077
+ exports.Applicative = {
4078
+ URI: exports.URI,
4079
+ map: _map,
4080
+ ap: _ap,
4081
+ of: exports.of
4082
+ };
4083
+ /**
4084
+ * @category instances
4085
+ * @since 2.10.0
4086
+ */
4087
+ exports.Chain = {
4088
+ URI: exports.URI,
4089
+ map: _map,
4090
+ ap: _ap,
4091
+ chain: _chain
4092
+ };
4093
+ /**
4094
+ * Composes computations in sequence, using the return value of one computation to determine the next computation and
4095
+ * keeping only the result of the first.
4096
+ *
4097
+ * Derivable from `Chain`.
4098
+ *
4099
+ * @category combinators
4100
+ * @since 2.5.0
4101
+ */
4102
+ exports.chainFirst = (0, Chain.chainFirst)(exports.Chain);
4103
+ /**
4104
+ * @category instances
4105
+ * @since 2.7.0
4106
+ */
4107
+ exports.Monad = {
4108
+ URI: exports.URI,
4109
+ map: _map,
4110
+ ap: _ap,
4111
+ of: exports.of,
4112
+ chain: _chain
4113
+ };
4114
+ /**
4115
+ * @category instances
4116
+ * @since 2.7.0
4117
+ */
4118
+ exports.Foldable = {
4119
+ URI: exports.URI,
4120
+ reduce: _reduce,
4121
+ foldMap: _foldMap,
4122
+ reduceRight: _reduceRight
4123
+ };
4124
+ /**
4125
+ * @category instances
4126
+ * @since 2.7.0
4127
+ */
4128
+ exports.FoldableWithIndex = {
4129
+ URI: exports.URI,
4130
+ reduce: _reduce,
4131
+ foldMap: _foldMap,
4132
+ reduceRight: _reduceRight,
4133
+ reduceWithIndex: _reduceWithIndex,
4134
+ foldMapWithIndex: _foldMapWithIndex,
4135
+ reduceRightWithIndex: _reduceRightWithIndex
4136
+ };
4137
+ /**
4138
+ * @category instances
4139
+ * @since 2.7.0
4140
+ */
4141
+ exports.Traversable = {
4142
+ URI: exports.URI,
4143
+ map: _map,
4144
+ reduce: _reduce,
4145
+ foldMap: _foldMap,
4146
+ reduceRight: _reduceRight,
4147
+ traverse: _traverse,
4148
+ sequence: exports.sequence
4149
+ };
4150
+ /**
4151
+ * @category instances
4152
+ * @since 2.7.0
4153
+ */
4154
+ exports.TraversableWithIndex = {
4155
+ URI: exports.URI,
4156
+ map: _map,
4157
+ mapWithIndex: _mapWithIndex,
4158
+ reduce: _reduce,
4159
+ foldMap: _foldMap,
4160
+ reduceRight: _reduceRight,
4161
+ traverse: _traverse,
4162
+ sequence: exports.sequence,
4163
+ reduceWithIndex: _reduceWithIndex,
4164
+ foldMapWithIndex: _foldMapWithIndex,
4165
+ reduceRightWithIndex: _reduceRightWithIndex,
4166
+ traverseWithIndex: _traverseWithIndex
4167
+ };
4168
+ /**
4169
+ * @category instances
4170
+ * @since 2.7.0
4171
+ */
4172
+ exports.Alt = {
4173
+ URI: exports.URI,
4174
+ map: _map,
4175
+ alt: _alt
4176
+ };
4177
+ /**
4178
+ * @category instances
4179
+ * @since 2.7.0
4180
+ */
4181
+ exports.Comonad = {
4182
+ URI: exports.URI,
4183
+ map: _map,
4184
+ extend: _extend,
4185
+ extract: exports.extract
4186
+ };
4187
+ // -------------------------------------------------------------------------------------
4188
+ // do notation
4189
+ // -------------------------------------------------------------------------------------
4190
+ /**
4191
+ * @since 2.9.0
4192
+ */
4193
+ exports.Do = (0, exports.of)(_.emptyRecord);
4194
+ /**
4195
+ * @since 2.8.0
4196
+ */
4197
+ exports.bindTo = (0, Functor.bindTo)(exports.Functor);
4198
+ /**
4199
+ * @since 2.8.0
4200
+ */
4201
+ exports.bind = (0, Chain.bind)(exports.Chain);
4202
+ // -------------------------------------------------------------------------------------
4203
+ // pipeable sequence S
4204
+ // -------------------------------------------------------------------------------------
4205
+ /**
4206
+ * @since 2.8.0
4207
+ */
4208
+ exports.apS = (0, Apply.apS)(exports.Apply);
4209
+ // -------------------------------------------------------------------------------------
4210
+ // utils
4211
+ // -------------------------------------------------------------------------------------
4212
+ /**
4213
+ * @since 2.0.0
4214
+ */
4215
+ exports.head = RNEA.head;
4216
+ /**
4217
+ * @since 2.0.0
4218
+ */
4219
+ var tail = function (as) { return as.slice(1); };
4220
+ exports.tail = tail;
4221
+ /**
4222
+ * @since 2.0.0
4223
+ */
4224
+ exports.last = RNEA.last;
4225
+ /**
4226
+ * Get all but the last element of a non empty array, creating a new array.
4227
+ *
4228
+ * @example
4229
+ * import { init } from 'fp-ts/NonEmptyArray'
4230
+ *
4231
+ * assert.deepStrictEqual(init([1, 2, 3]), [1, 2])
4232
+ * assert.deepStrictEqual(init([1]), [])
4233
+ *
4234
+ * @since 2.2.0
4235
+ */
4236
+ var init = function (as) { return as.slice(0, -1); };
4237
+ exports.init = init;
4238
+ /**
4239
+ * @since 2.0.0
4240
+ */
4241
+ exports.min = RNEA.min;
4242
+ /**
4243
+ * @since 2.0.0
4244
+ */
4245
+ exports.max = RNEA.max;
4246
+ /**
4247
+ * @since 2.10.0
4248
+ */
4249
+ var concatAll = function (S) { return function (as) { return as.reduce(S.concat); }; };
4250
+ exports.concatAll = concatAll;
4251
+ /**
4252
+ * Break an `Array` into its first element and remaining elements.
4253
+ *
4254
+ * @category destructors
4255
+ * @since 2.11.0
4256
+ */
4257
+ var matchLeft = function (f) { return function (as) { return f((0, exports.head)(as), (0, exports.tail)(as)); }; };
4258
+ exports.matchLeft = matchLeft;
4259
+ /**
4260
+ * Break an `Array` into its initial elements and the last element.
4261
+ *
4262
+ * @category destructors
4263
+ * @since 2.11.0
4264
+ */
4265
+ var matchRight = function (f) { return function (as) {
4266
+ return f((0, exports.init)(as), (0, exports.last)(as));
4267
+ }; };
4268
+ exports.matchRight = matchRight;
4269
+ /**
4270
+ * Apply a function to the head, creating a new `NonEmptyArray`.
4271
+ *
4272
+ * @since 2.11.0
4273
+ */
4274
+ var modifyHead = function (f) { return function (as) { return __spreadArray([
4275
+ f((0, exports.head)(as))
4276
+ ], (0, exports.tail)(as), true); }; };
4277
+ exports.modifyHead = modifyHead;
4278
+ /**
4279
+ * Change the head, creating a new `NonEmptyArray`.
4280
+ *
4281
+ * @category combinators
4282
+ * @since 2.11.0
4283
+ */
4284
+ var updateHead = function (a) { return (0, exports.modifyHead)(function () { return a; }); };
4285
+ exports.updateHead = updateHead;
4286
+ /**
4287
+ * Apply a function to the last element, creating a new `NonEmptyArray`.
4288
+ *
4289
+ * @since 2.11.0
4290
+ */
4291
+ var modifyLast = function (f) { return function (as) {
4292
+ return (0, _function.pipe)((0, exports.init)(as), (0, exports.append)(f((0, exports.last)(as))));
4293
+ }; };
4294
+ exports.modifyLast = modifyLast;
4295
+ /**
4296
+ * Change the last element, creating a new `NonEmptyArray`.
4297
+ *
4298
+ * @category combinators
4299
+ * @since 2.11.0
4300
+ */
4301
+ var updateLast = function (a) { return (0, exports.modifyLast)(function () { return a; }); };
4302
+ exports.updateLast = updateLast;
4303
+ /**
4304
+ * Places an element in between members of a `NonEmptyArray`, then folds the results using the provided `Semigroup`.
4305
+ *
4306
+ * @example
4307
+ * import * as S from 'fp-ts/string'
4308
+ * import { intercalate } from 'fp-ts/NonEmptyArray'
4309
+ *
4310
+ * assert.deepStrictEqual(intercalate(S.Semigroup)('-')(['a', 'b', 'c']), 'a-b-c')
4311
+ *
4312
+ * @since 2.12.0
4313
+ */
4314
+ exports.intercalate = RNEA.intercalate;
4315
+ function groupSort(O) {
4316
+ var sortO = (0, exports.sort)(O);
4317
+ var groupO = group(O);
4318
+ return function (as) { return ((0, exports.isNonEmpty)(as) ? groupO(sortO(as)) : []); };
4319
+ }
4320
+ exports.groupSort = groupSort;
4321
+ function filter(predicate) {
4322
+ return (0, exports.filterWithIndex)(function (_, a) { return predicate(a); });
4323
+ }
4324
+ exports.filter = filter;
4325
+ /**
4326
+ * Use [`filterWithIndex`](./Array.ts.html#filterwithindex) instead.
4327
+ *
4328
+ * @category combinators
4329
+ * @since 2.0.0
4330
+ * @deprecated
4331
+ */
4332
+ var filterWithIndex = function (predicate) { return function (as) { return (0, exports.fromArray)(as.filter(function (a, i) { return predicate(i, a); })); }; };
4333
+ exports.filterWithIndex = filterWithIndex;
4334
+ /**
4335
+ * Use [`unprepend`](#unprepend) instead.
4336
+ *
4337
+ * @category destructors
4338
+ * @since 2.9.0
4339
+ * @deprecated
4340
+ */
4341
+ exports.uncons = exports.unprepend;
4342
+ /**
4343
+ * Use [`unappend`](#unappend) instead.
4344
+ *
4345
+ * @category destructors
4346
+ * @since 2.9.0
4347
+ * @deprecated
4348
+ */
4349
+ exports.unsnoc = exports.unappend;
4350
+ function cons(head, tail) {
4351
+ return tail === undefined ? (0, exports.prepend)(head) : (0, _function.pipe)(tail, (0, exports.prepend)(head));
4352
+ }
4353
+ exports.cons = cons;
4354
+ /**
4355
+ * Use [`append`](./Array.ts.html#append) instead.
4356
+ *
4357
+ * @category constructors
4358
+ * @since 2.0.0
4359
+ * @deprecated
4360
+ */
4361
+ var snoc = function (init, end) { return (0, _function.pipe)(init, (0, exports.append)(end)); };
4362
+ exports.snoc = snoc;
4363
+ /**
4364
+ * Use [`prependAll`](#prependall) instead.
4365
+ *
4366
+ * @category combinators
4367
+ * @since 2.9.0
4368
+ * @deprecated
4369
+ */
4370
+ exports.prependToAll = exports.prependAll;
4371
+ /**
4372
+ * Use [`concatAll`](#concatall) instead.
4373
+ *
4374
+ * @since 2.5.0
4375
+ * @deprecated
4376
+ */
4377
+ exports.fold = RNEA.concatAll;
4378
+ /**
4379
+ * This instance is deprecated, use small, specific instances instead.
4380
+ * For example if a function needs a `Functor` instance, pass `NEA.Functor` instead of `NEA.nonEmptyArray`
4381
+ * (where `NEA` is from `import NEA from 'fp-ts/NonEmptyArray'`)
4382
+ *
4383
+ * @category instances
4384
+ * @since 2.0.0
4385
+ * @deprecated
4386
+ */
4387
+ exports.nonEmptyArray = {
4388
+ URI: exports.URI,
4389
+ of: exports.of,
4390
+ map: _map,
4391
+ mapWithIndex: _mapWithIndex,
4392
+ ap: _ap,
4393
+ chain: _chain,
4394
+ extend: _extend,
4395
+ extract: exports.extract,
4396
+ reduce: _reduce,
4397
+ foldMap: _foldMap,
4398
+ reduceRight: _reduceRight,
4399
+ traverse: _traverse,
4400
+ sequence: exports.sequence,
4401
+ reduceWithIndex: _reduceWithIndex,
4402
+ foldMapWithIndex: _foldMapWithIndex,
4403
+ reduceRightWithIndex: _reduceRightWithIndex,
4404
+ traverseWithIndex: _traverseWithIndex,
4405
+ alt: _alt
4406
+ };
4407
+ });
4408
+
4409
+ const NonEmptyArray$1 = /*@__PURE__*/getDefaultExportFromCjs(NonEmptyArray);
4410
+
4411
+ export { Apply as A, Chain as C, Eq as E, Functor as F, NonEmptyArray as N, Ord as O, ReadonlyNonEmptyArray as R, Separated as S, Witherable as W, Zero as Z, _function as _, commonjsGlobal as a, FromEither as b, createCommonjsModule as c, Semigroup as d, getAugmentedNamespace as e, getDefaultExportFromCjs as g, internal as i };