@usecapsule/core-components 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (400) hide show
  1. package/dist/capsule/_commonjsHelpers-bc8ff177.js +36 -0
  2. package/dist/capsule/_commonjsHelpers-bc8ff177.js.map +1 -0
  3. package/dist/capsule/capsule.esm.js +52 -1
  4. package/dist/capsule/capsule.esm.js.map +1 -1
  5. package/dist/capsule/cpsl-alert.entry.js +31 -0
  6. package/dist/capsule/cpsl-alert.entry.js.map +1 -0
  7. package/dist/{esm → capsule}/cpsl-animation.entry.js +114 -20
  8. package/dist/capsule/cpsl-animation.entry.js.map +1 -0
  9. package/dist/capsule/cpsl-button.entry.js +24 -0
  10. package/dist/capsule/cpsl-button.entry.js.map +1 -0
  11. package/dist/capsule/cpsl-code-input.entry.js +106 -0
  12. package/dist/capsule/cpsl-code-input.entry.js.map +1 -0
  13. package/dist/{esm → capsule}/cpsl-col.entry.js +3 -4
  14. package/dist/capsule/cpsl-col.entry.js.map +1 -0
  15. package/dist/capsule/cpsl-divider.entry.js +17 -0
  16. package/dist/capsule/cpsl-divider.entry.js.map +1 -0
  17. package/dist/{esm → capsule}/cpsl-grid.entry.js +4 -5
  18. package/dist/capsule/cpsl-grid.entry.js.map +1 -0
  19. package/dist/capsule/cpsl-icon.entry.js +20 -0
  20. package/dist/capsule/cpsl-icon.entry.js.map +1 -0
  21. package/dist/{esm → capsule}/cpsl-info-box.entry.js +3 -4
  22. package/dist/capsule/cpsl-info-box.entry.js.map +1 -0
  23. package/dist/capsule/cpsl-input.entry.js +124 -0
  24. package/dist/capsule/cpsl-input.entry.js.map +1 -0
  25. package/dist/capsule/cpsl-modal.entry.js +3338 -0
  26. package/dist/capsule/cpsl-modal.entry.js.map +1 -0
  27. package/dist/capsule/cpsl-overlay.entry.js +44 -0
  28. package/dist/capsule/cpsl-overlay.entry.js.map +1 -0
  29. package/dist/capsule/cpsl-pill.entry.js +18 -0
  30. package/dist/capsule/cpsl-pill.entry.js.map +1 -0
  31. package/dist/capsule/cpsl-progress-indicator.entry.js +29 -0
  32. package/dist/capsule/cpsl-progress-indicator.entry.js.map +1 -0
  33. package/dist/capsule/cpsl-qr-code.entry.js +56 -0
  34. package/dist/capsule/cpsl-qr-code.entry.js.map +1 -0
  35. package/dist/capsule/cpsl-row.entry.js +17 -0
  36. package/dist/capsule/cpsl-row.entry.js.map +1 -0
  37. package/dist/capsule/cpsl-slide-button.entry.js +130 -0
  38. package/dist/capsule/cpsl-slide-button.entry.js.map +1 -0
  39. package/dist/capsule/cpsl-spinner.entry.js +25 -0
  40. package/dist/capsule/cpsl-spinner.entry.js.map +1 -0
  41. package/dist/capsule/cpsl-tab.entry.js +37 -0
  42. package/dist/capsule/cpsl-tab.entry.js.map +1 -0
  43. package/dist/capsule/cpsl-tabs.entry.js +71 -0
  44. package/dist/capsule/cpsl-tabs.entry.js.map +1 -0
  45. package/dist/capsule/cpsl-text.entry.js +66 -0
  46. package/dist/capsule/cpsl-text.entry.js.map +1 -0
  47. package/dist/capsule/cpsl-tile-button.entry.js +19 -0
  48. package/dist/capsule/cpsl-tile-button.entry.js.map +1 -0
  49. package/dist/capsule/index-3ac1b9e9.js +617 -0
  50. package/dist/capsule/index-3ac1b9e9.js.map +1 -0
  51. package/dist/capsule/index-3ad00c7e.js +6064 -0
  52. package/dist/capsule/index-3ad00c7e.js.map +1 -0
  53. package/dist/capsule/index-f19e63df.js +4148 -0
  54. package/dist/capsule/index-f19e63df.js.map +1 -0
  55. package/dist/capsule/index.esm.js +572 -1
  56. package/dist/capsule/index.esm.js.map +1 -1
  57. package/dist/capsule/shadow-css-bc9e2af8.js +478 -0
  58. package/dist/capsule/shadow-css-bc9e2af8.js.map +1 -0
  59. package/dist/types/components/cpsl-text/cpsl-text.d.ts +4 -0
  60. package/dist/types/index.d.ts +1 -1
  61. package/dist/types/interface.d.ts +15 -0
  62. package/dist/types/utils/theme/generateFont.d.ts +1 -1
  63. package/dist/types/utils/theme/generateTheme.d.ts +1 -2
  64. package/package.json +2 -2
  65. package/dist/capsule/p-0462f723.js +0 -2
  66. package/dist/capsule/p-0462f723.js.map +0 -1
  67. package/dist/capsule/p-654cb899.entry.js +0 -29
  68. package/dist/capsule/p-654cb899.entry.js.map +0 -1
  69. package/dist/capsule/p-68c73705.entry.js +0 -2
  70. package/dist/capsule/p-68c73705.entry.js.map +0 -1
  71. package/dist/capsule/p-6fb7c4d1.js +0 -3
  72. package/dist/capsule/p-6fb7c4d1.js.map +0 -1
  73. package/dist/capsule/p-91412151.entry.js +0 -2
  74. package/dist/capsule/p-91412151.entry.js.map +0 -1
  75. package/dist/capsule/p-a95ec4df.entry.js +0 -2
  76. package/dist/capsule/p-a95ec4df.entry.js.map +0 -1
  77. package/dist/capsule/p-c2bf050b.js +0 -2
  78. package/dist/capsule/p-c2bf050b.js.map +0 -1
  79. package/dist/capsule/p-d7be092d.entry.js +0 -10
  80. package/dist/capsule/p-d7be092d.entry.js.map +0 -1
  81. package/dist/capsule/p-e1255160.js +0 -2
  82. package/dist/capsule/p-e1255160.js.map +0 -1
  83. package/dist/capsule/p-f604b591.entry.js +0 -2
  84. package/dist/capsule/p-f604b591.entry.js.map +0 -1
  85. package/dist/cjs/_commonjsHelpers-b3309d7b.js +0 -12
  86. package/dist/cjs/_commonjsHelpers-b3309d7b.js.map +0 -1
  87. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  88. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  89. package/dist/cjs/capsule.cjs.js +0 -27
  90. package/dist/cjs/capsule.cjs.js.map +0 -1
  91. package/dist/cjs/constants-4bb85cc5.js +0 -12
  92. package/dist/cjs/constants-4bb85cc5.js.map +0 -1
  93. package/dist/cjs/cpsl-alert_17.cjs.entry.js +0 -10711
  94. package/dist/cjs/cpsl-alert_17.cjs.entry.js.map +0 -1
  95. package/dist/cjs/cpsl-animation.cjs.entry.js +0 -20129
  96. package/dist/cjs/cpsl-animation.cjs.entry.js.map +0 -1
  97. package/dist/cjs/cpsl-col.cjs.entry.js +0 -125
  98. package/dist/cjs/cpsl-col.cjs.entry.js.map +0 -1
  99. package/dist/cjs/cpsl-grid.cjs.entry.js +0 -25
  100. package/dist/cjs/cpsl-grid.cjs.entry.js.map +0 -1
  101. package/dist/cjs/cpsl-info-box.cjs.entry.js +0 -22
  102. package/dist/cjs/cpsl-info-box.cjs.entry.js.map +0 -1
  103. package/dist/cjs/cpsl-row.cjs.entry.js +0 -22
  104. package/dist/cjs/cpsl-row.cjs.entry.js.map +0 -1
  105. package/dist/cjs/index-3fccb5b4.js +0 -2012
  106. package/dist/cjs/index-3fccb5b4.js.map +0 -1
  107. package/dist/cjs/index.cjs.js +0 -342
  108. package/dist/cjs/index.cjs.js.map +0 -1
  109. package/dist/cjs/loader.cjs.js +0 -17
  110. package/dist/cjs/loader.cjs.js.map +0 -1
  111. package/dist/collection/assets/icons/alert-circle.svg +0 -3
  112. package/dist/collection/assets/icons/angel-list-brand.svg +0 -3
  113. package/dist/collection/assets/icons/angel-list.svg +0 -3
  114. package/dist/collection/assets/icons/apple-brand.svg +0 -3
  115. package/dist/collection/assets/icons/apple.svg +0 -3
  116. package/dist/collection/assets/icons/arrow-narrow.svg +0 -3
  117. package/dist/collection/assets/icons/arrow.svg +0 -3
  118. package/dist/collection/assets/icons/backup-kit.svg +0 -4
  119. package/dist/collection/assets/icons/capsule-logo.svg +0 -18
  120. package/dist/collection/assets/icons/capsule-rings-dark.svg +0 -34
  121. package/dist/collection/assets/icons/capsule-rings.svg +0 -34
  122. package/dist/collection/assets/icons/capsule.svg +0 -4
  123. package/dist/collection/assets/icons/check.svg +0 -3
  124. package/dist/collection/assets/icons/clock.svg +0 -3
  125. package/dist/collection/assets/icons/close.svg +0 -4
  126. package/dist/collection/assets/icons/clubhouse-brand.svg +0 -4
  127. package/dist/collection/assets/icons/clubhouse.svg +0 -4
  128. package/dist/collection/assets/icons/copy.svg +0 -3
  129. package/dist/collection/assets/icons/discord-brand.svg +0 -4
  130. package/dist/collection/assets/icons/discord.svg +0 -4
  131. package/dist/collection/assets/icons/download-cloud.svg +0 -3
  132. package/dist/collection/assets/icons/dribbble-brand.svg +0 -4
  133. package/dist/collection/assets/icons/dribbble.svg +0 -3
  134. package/dist/collection/assets/icons/eye-off.svg +0 -3
  135. package/dist/collection/assets/icons/eye.svg +0 -4
  136. package/dist/collection/assets/icons/facebook-brand.svg +0 -11
  137. package/dist/collection/assets/icons/facebook.svg +0 -10
  138. package/dist/collection/assets/icons/figma-brand.svg +0 -14
  139. package/dist/collection/assets/icons/figma.svg +0 -3
  140. package/dist/collection/assets/icons/github-brand.svg +0 -10
  141. package/dist/collection/assets/icons/github.svg +0 -10
  142. package/dist/collection/assets/icons/google-brand.svg +0 -13
  143. package/dist/collection/assets/icons/google.svg +0 -10
  144. package/dist/collection/assets/icons/help-circle.svg +0 -3
  145. package/dist/collection/assets/icons/hero-email.svg +0 -12
  146. package/dist/collection/assets/icons/hero-lock.svg +0 -4
  147. package/dist/collection/assets/icons/hero-passkey.svg +0 -12
  148. package/dist/collection/assets/icons/hero-phone.svg +0 -4
  149. package/dist/collection/assets/icons/hero-wallet.svg +0 -5
  150. package/dist/collection/assets/icons/index.js +0 -70
  151. package/dist/collection/assets/icons/index.js.map +0 -1
  152. package/dist/collection/assets/icons/info-circle.svg +0 -3
  153. package/dist/collection/assets/icons/instagram-brand.svg +0 -12
  154. package/dist/collection/assets/icons/instagram.svg +0 -12
  155. package/dist/collection/assets/icons/key.svg +0 -3
  156. package/dist/collection/assets/icons/linkedin-brand.svg +0 -10
  157. package/dist/collection/assets/icons/linkedin.svg +0 -10
  158. package/dist/collection/assets/icons/mail.svg +0 -3
  159. package/dist/collection/assets/icons/more-login-options.svg +0 -13
  160. package/dist/collection/assets/icons/phone.svg +0 -3
  161. package/dist/collection/assets/icons/pintrest-brand.svg +0 -11
  162. package/dist/collection/assets/icons/pintrest.svg +0 -10
  163. package/dist/collection/assets/icons/plus-circle.svg +0 -5
  164. package/dist/collection/assets/icons/reddit-brand.svg +0 -11
  165. package/dist/collection/assets/icons/reddit.svg +0 -3
  166. package/dist/collection/assets/icons/signal-brand.svg +0 -3
  167. package/dist/collection/assets/icons/signal.svg +0 -3
  168. package/dist/collection/assets/icons/snapchat-brand.svg +0 -4
  169. package/dist/collection/assets/icons/snapchat.svg +0 -3
  170. package/dist/collection/assets/icons/telegram-brand.svg +0 -15
  171. package/dist/collection/assets/icons/telegram.svg +0 -10
  172. package/dist/collection/assets/icons/tik-tok-brand.svg +0 -5
  173. package/dist/collection/assets/icons/tik-tok.svg +0 -3
  174. package/dist/collection/assets/icons/tumblr-brand.svg +0 -10
  175. package/dist/collection/assets/icons/tumblr.svg +0 -10
  176. package/dist/collection/assets/icons/twitter-brand.svg +0 -3
  177. package/dist/collection/assets/icons/twitter.svg +0 -3
  178. package/dist/collection/assets/icons/wallet.svg +0 -5
  179. package/dist/collection/assets/icons/youtube-brand.svg +0 -11
  180. package/dist/collection/assets/icons/youtube.svg +0 -3
  181. package/dist/collection/collection-manifest.json +0 -33
  182. package/dist/collection/components/cpsl-alert/cpsl-alert.css +0 -98
  183. package/dist/collection/components/cpsl-alert/cpsl-alert.js +0 -80
  184. package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +0 -1
  185. package/dist/collection/components/cpsl-alert/test/cpsl-alert.e2e.js +0 -29
  186. package/dist/collection/components/cpsl-alert/test/cpsl-alert.e2e.js.map +0 -1
  187. package/dist/collection/components/cpsl-alert/test/cpsl-alert.spec.js +0 -37
  188. package/dist/collection/components/cpsl-alert/test/cpsl-alert.spec.js.map +0 -1
  189. package/dist/collection/components/cpsl-animation/cpsl-animation.css +0 -17
  190. package/dist/collection/components/cpsl-animation/cpsl-animation.js +0 -102
  191. package/dist/collection/components/cpsl-animation/cpsl-animation.js.map +0 -1
  192. package/dist/collection/components/cpsl-animation/test/cpsl-animation.e2e.js +0 -29
  193. package/dist/collection/components/cpsl-animation/test/cpsl-animation.e2e.js.map +0 -1
  194. package/dist/collection/components/cpsl-animation/test/cpsl-animation.spec.js +0 -37
  195. package/dist/collection/components/cpsl-animation/test/cpsl-animation.spec.js.map +0 -1
  196. package/dist/collection/components/cpsl-button/cpsl-button.css +0 -162
  197. package/dist/collection/components/cpsl-button/cpsl-button.js +0 -68
  198. package/dist/collection/components/cpsl-button/cpsl-button.js.map +0 -1
  199. package/dist/collection/components/cpsl-button/test/cpsl-button.e2e.js +0 -29
  200. package/dist/collection/components/cpsl-button/test/cpsl-button.e2e.js.map +0 -1
  201. package/dist/collection/components/cpsl-button/test/cpsl-button.spec.js +0 -37
  202. package/dist/collection/components/cpsl-button/test/cpsl-button.spec.js.map +0 -1
  203. package/dist/collection/components/cpsl-code-input/code-change-interface.js +0 -2
  204. package/dist/collection/components/cpsl-code-input/code-change-interface.js.map +0 -1
  205. package/dist/collection/components/cpsl-code-input/cpsl-code-input.css +0 -134
  206. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +0 -223
  207. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js.map +0 -1
  208. package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.e2e.js +0 -29
  209. package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.e2e.js.map +0 -1
  210. package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.spec.js +0 -37
  211. package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.spec.js.map +0 -1
  212. package/dist/collection/components/cpsl-col/cpsl-col.css +0 -200
  213. package/dist/collection/components/cpsl-col/cpsl-col.js +0 -528
  214. package/dist/collection/components/cpsl-col/cpsl-col.js.map +0 -1
  215. package/dist/collection/components/cpsl-col/test/cpsl-col.e2e.js +0 -29
  216. package/dist/collection/components/cpsl-col/test/cpsl-col.e2e.js.map +0 -1
  217. package/dist/collection/components/cpsl-col/test/cpsl-col.spec.js +0 -37
  218. package/dist/collection/components/cpsl-col/test/cpsl-col.spec.js.map +0 -1
  219. package/dist/collection/components/cpsl-divider/cpsl-divider.css +0 -73
  220. package/dist/collection/components/cpsl-divider/cpsl-divider.js +0 -19
  221. package/dist/collection/components/cpsl-divider/cpsl-divider.js.map +0 -1
  222. package/dist/collection/components/cpsl-divider/test/cpsl-divider.e2e.js +0 -29
  223. package/dist/collection/components/cpsl-divider/test/cpsl-divider.e2e.js.map +0 -1
  224. package/dist/collection/components/cpsl-divider/test/cpsl-divider.spec.js +0 -37
  225. package/dist/collection/components/cpsl-divider/test/cpsl-divider.spec.js.map +0 -1
  226. package/dist/collection/components/cpsl-grid/cpsl-grid.css +0 -235
  227. package/dist/collection/components/cpsl-grid/cpsl-grid.js +0 -46
  228. package/dist/collection/components/cpsl-grid/cpsl-grid.js.map +0 -1
  229. package/dist/collection/components/cpsl-grid/test/cpsl-grid.e2e.js +0 -29
  230. package/dist/collection/components/cpsl-grid/test/cpsl-grid.e2e.js.map +0 -1
  231. package/dist/collection/components/cpsl-grid/test/cpsl-grid.spec.js +0 -37
  232. package/dist/collection/components/cpsl-grid/test/cpsl-grid.spec.js.map +0 -1
  233. package/dist/collection/components/cpsl-icon/cpsl-icon.css +0 -95
  234. package/dist/collection/components/cpsl-icon/cpsl-icon.js +0 -68
  235. package/dist/collection/components/cpsl-icon/cpsl-icon.js.map +0 -1
  236. package/dist/collection/components/cpsl-icon/test/cpsl-icon.e2e.js +0 -29
  237. package/dist/collection/components/cpsl-icon/test/cpsl-icon.e2e.js.map +0 -1
  238. package/dist/collection/components/cpsl-icon/test/cpsl-icon.spec.js +0 -37
  239. package/dist/collection/components/cpsl-icon/test/cpsl-icon.spec.js.map +0 -1
  240. package/dist/collection/components/cpsl-info-box/cpsl-info-box.css +0 -77
  241. package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +0 -19
  242. package/dist/collection/components/cpsl-info-box/cpsl-info-box.js.map +0 -1
  243. package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.e2e.js +0 -29
  244. package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.e2e.js.map +0 -1
  245. package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.spec.js +0 -37
  246. package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.spec.js.map +0 -1
  247. package/dist/collection/components/cpsl-input/cpsl-input.css +0 -194
  248. package/dist/collection/components/cpsl-input/cpsl-input.js +0 -708
  249. package/dist/collection/components/cpsl-input/cpsl-input.js.map +0 -1
  250. package/dist/collection/components/cpsl-input/input-interface.js +0 -2
  251. package/dist/collection/components/cpsl-input/input-interface.js.map +0 -1
  252. package/dist/collection/components/cpsl-input/test/cpsl-input.e2e.js +0 -29
  253. package/dist/collection/components/cpsl-input/test/cpsl-input.e2e.js.map +0 -1
  254. package/dist/collection/components/cpsl-input/test/cpsl-input.spec.js +0 -37
  255. package/dist/collection/components/cpsl-input/test/cpsl-input.spec.js.map +0 -1
  256. package/dist/collection/components/cpsl-modal/cpsl-modal.css +0 -172
  257. package/dist/collection/components/cpsl-modal/cpsl-modal.js +0 -430
  258. package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +0 -1
  259. package/dist/collection/components/cpsl-modal/test/cpsl-modal.e2e.js +0 -29
  260. package/dist/collection/components/cpsl-modal/test/cpsl-modal.e2e.js.map +0 -1
  261. package/dist/collection/components/cpsl-modal/test/cpsl-modal.spec.js +0 -37
  262. package/dist/collection/components/cpsl-modal/test/cpsl-modal.spec.js.map +0 -1
  263. package/dist/collection/components/cpsl-overlay/cpsl-overlay.css +0 -11
  264. package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +0 -108
  265. package/dist/collection/components/cpsl-overlay/cpsl-overlay.js.map +0 -1
  266. package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.e2e.js +0 -29
  267. package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.e2e.js.map +0 -1
  268. package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.spec.js +0 -37
  269. package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.spec.js.map +0 -1
  270. package/dist/collection/components/cpsl-pill/cpsl-pill.css +0 -92
  271. package/dist/collection/components/cpsl-pill/cpsl-pill.js +0 -43
  272. package/dist/collection/components/cpsl-pill/cpsl-pill.js.map +0 -1
  273. package/dist/collection/components/cpsl-pill/test/cpsl-pill.e2e.js +0 -29
  274. package/dist/collection/components/cpsl-pill/test/cpsl-pill.e2e.js.map +0 -1
  275. package/dist/collection/components/cpsl-pill/test/cpsl-pill.spec.js +0 -37
  276. package/dist/collection/components/cpsl-pill/test/cpsl-pill.spec.js.map +0 -1
  277. package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.css +0 -82
  278. package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.js +0 -71
  279. package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.js.map +0 -1
  280. package/dist/collection/components/cpsl-progress-indicator/progress-indicator-interface.js +0 -2
  281. package/dist/collection/components/cpsl-progress-indicator/progress-indicator-interface.js.map +0 -1
  282. package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.e2e.js +0 -29
  283. package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.e2e.js.map +0 -1
  284. package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.spec.js +0 -37
  285. package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.spec.js.map +0 -1
  286. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.css +0 -81
  287. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +0 -107
  288. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js.map +0 -1
  289. package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.e2e.js +0 -29
  290. package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.e2e.js.map +0 -1
  291. package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.spec.js +0 -37
  292. package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.spec.js.map +0 -1
  293. package/dist/collection/components/cpsl-row/cpsl-row.css +0 -136
  294. package/dist/collection/components/cpsl-row/cpsl-row.js +0 -19
  295. package/dist/collection/components/cpsl-row/cpsl-row.js.map +0 -1
  296. package/dist/collection/components/cpsl-row/test/cpsl-row.e2e.js +0 -29
  297. package/dist/collection/components/cpsl-row/test/cpsl-row.e2e.js.map +0 -1
  298. package/dist/collection/components/cpsl-row/test/cpsl-row.spec.js +0 -37
  299. package/dist/collection/components/cpsl-row/test/cpsl-row.spec.js.map +0 -1
  300. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.css +0 -175
  301. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +0 -252
  302. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js.map +0 -1
  303. package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.e2e.js +0 -29
  304. package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.e2e.js.map +0 -1
  305. package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.spec.js +0 -37
  306. package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.spec.js.map +0 -1
  307. package/dist/collection/components/cpsl-spinner/cpsl-spinner.css +0 -68
  308. package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +0 -69
  309. package/dist/collection/components/cpsl-spinner/cpsl-spinner.js.map +0 -1
  310. package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.e2e.js +0 -29
  311. package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.e2e.js.map +0 -1
  312. package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.spec.js +0 -37
  313. package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.spec.js.map +0 -1
  314. package/dist/collection/components/cpsl-tab/cpsl-tab.css +0 -23
  315. package/dist/collection/components/cpsl-tab/cpsl-tab.js +0 -121
  316. package/dist/collection/components/cpsl-tab/cpsl-tab.js.map +0 -1
  317. package/dist/collection/components/cpsl-tab/tab-interface.js +0 -2
  318. package/dist/collection/components/cpsl-tab/tab-interface.js.map +0 -1
  319. package/dist/collection/components/cpsl-tab/test/cpsl-tab.e2e.js +0 -29
  320. package/dist/collection/components/cpsl-tab/test/cpsl-tab.e2e.js.map +0 -1
  321. package/dist/collection/components/cpsl-tab/test/cpsl-tab.spec.js +0 -37
  322. package/dist/collection/components/cpsl-tab/test/cpsl-tab.spec.js.map +0 -1
  323. package/dist/collection/components/cpsl-tabs/cpsl-tabs.css +0 -111
  324. package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +0 -170
  325. package/dist/collection/components/cpsl-tabs/cpsl-tabs.js.map +0 -1
  326. package/dist/collection/components/cpsl-tabs/tabs-interface.js +0 -2
  327. package/dist/collection/components/cpsl-tabs/tabs-interface.js.map +0 -1
  328. package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.e2e.js +0 -29
  329. package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.e2e.js.map +0 -1
  330. package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.spec.js +0 -37
  331. package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.spec.js.map +0 -1
  332. package/dist/collection/components/cpsl-text/cpsl-text.css +0 -59
  333. package/dist/collection/components/cpsl-text/cpsl-text.js +0 -19
  334. package/dist/collection/components/cpsl-text/cpsl-text.js.map +0 -1
  335. package/dist/collection/components/cpsl-text/test/cpsl-text.e2e.js +0 -29
  336. package/dist/collection/components/cpsl-text/test/cpsl-text.e2e.js.map +0 -1
  337. package/dist/collection/components/cpsl-text/test/cpsl-text.spec.js +0 -37
  338. package/dist/collection/components/cpsl-text/test/cpsl-text.spec.js.map +0 -1
  339. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.css +0 -97
  340. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +0 -67
  341. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js.map +0 -1
  342. package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.e2e.js +0 -29
  343. package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.e2e.js.map +0 -1
  344. package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.spec.js +0 -37
  345. package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.spec.js.map +0 -1
  346. package/dist/collection/constants.js +0 -6
  347. package/dist/collection/constants.js.map +0 -1
  348. package/dist/collection/index.js +0 -3
  349. package/dist/collection/index.js.map +0 -1
  350. package/dist/collection/interface.js +0 -2
  351. package/dist/collection/interface.js.map +0 -1
  352. package/dist/collection/utils/media.js +0 -18
  353. package/dist/collection/utils/media.js.map +0 -1
  354. package/dist/collection/utils/theme/generateBorderRadii.js +0 -56
  355. package/dist/collection/utils/theme/generateBorderRadii.js.map +0 -1
  356. package/dist/collection/utils/theme/generateFont.js +0 -7
  357. package/dist/collection/utils/theme/generateFont.js.map +0 -1
  358. package/dist/collection/utils/theme/generatePalette.js +0 -46
  359. package/dist/collection/utils/theme/generatePalette.js.map +0 -1
  360. package/dist/collection/utils/theme/generateTheme.js +0 -12
  361. package/dist/collection/utils/theme/generateTheme.js.map +0 -1
  362. package/dist/collection/utils/theme/utils.js +0 -21
  363. package/dist/collection/utils/theme/utils.js.map +0 -1
  364. package/dist/esm/_commonjsHelpers-1789f0cf.js +0 -9
  365. package/dist/esm/_commonjsHelpers-1789f0cf.js.map +0 -1
  366. package/dist/esm/capsule.js +0 -22
  367. package/dist/esm/capsule.js.map +0 -1
  368. package/dist/esm/cpsl-alert_17.entry.js +0 -10691
  369. package/dist/esm/cpsl-alert_17.entry.js.map +0 -1
  370. package/dist/esm/cpsl-animation.entry.js.map +0 -1
  371. package/dist/esm/cpsl-col.entry.js.map +0 -1
  372. package/dist/esm/cpsl-grid.entry.js.map +0 -1
  373. package/dist/esm/cpsl-info-box.entry.js.map +0 -1
  374. package/dist/esm/cpsl-row.entry.js +0 -18
  375. package/dist/esm/cpsl-row.entry.js.map +0 -1
  376. package/dist/esm/index-f00e090c.js +0 -1982
  377. package/dist/esm/index-f00e090c.js.map +0 -1
  378. package/dist/esm/index.js +0 -338
  379. package/dist/esm/index.js.map +0 -1
  380. package/dist/esm/loader.js +0 -13
  381. package/dist/esm/loader.js.map +0 -1
  382. package/dist/esm/polyfills/core-js.js +0 -11
  383. package/dist/esm/polyfills/dom.js +0 -79
  384. package/dist/esm/polyfills/es5-html-element.js +0 -1
  385. package/dist/esm/polyfills/index.js +0 -34
  386. package/dist/esm/polyfills/system.js +0 -6
  387. package/dist/index.cjs.js +0 -1
  388. package/dist/index.js +0 -1
  389. package/dist/loader/cdn.js +0 -3
  390. package/dist/loader/index.cjs.js +0 -3
  391. package/dist/loader/index.d.ts +0 -21
  392. package/dist/loader/index.es2017.js +0 -3
  393. package/dist/loader/index.js +0 -4
  394. package/dist/loader/package.json +0 -11
  395. package/dist/scripts/buildIconLibrary.js +0 -33
  396. package/dist/scripts/buildIconLibrary.js.map +0 -1
  397. /package/dist/{esm → capsule}/app-globals-0f993ce5.js +0 -0
  398. /package/dist/{esm → capsule}/app-globals-0f993ce5.js.map +0 -0
  399. /package/dist/{esm → capsule}/constants-7b49abd5.js +0 -0
  400. /package/dist/{esm → capsule}/constants-7b49abd5.js.map +0 -0
@@ -0,0 +1,3338 @@
1
+ import { r as registerInstance, e as createEvent, h, a as Host, g as getElement } from './index-f19e63df.js';
2
+ import { g as gsapWithCSS } from './index-3ad00c7e.js';
3
+ import { M as MOBILE_SIZE } from './constants-7b49abd5.js';
4
+
5
+ /*!
6
+ * matrix 3.12.5
7
+ * https://gsap.com
8
+ *
9
+ * Copyright 2008-2024, GreenSock. All rights reserved.
10
+ * Subject to the terms at https://gsap.com/standard-license or for
11
+ * Club GSAP members, the agreement issued with that membership.
12
+ * @author: Jack Doyle, jack@greensock.com
13
+ */
14
+
15
+ /* eslint-disable */
16
+ var _doc$1,
17
+ _win$1,
18
+ _docElement$1,
19
+ _body$1,
20
+ _divContainer,
21
+ _svgContainer,
22
+ _identityMatrix$1,
23
+ _gEl,
24
+ _transformProp$1 = "transform",
25
+ _transformOriginProp$1 = _transformProp$1 + "Origin",
26
+ _hasOffsetBug,
27
+ _setDoc = function _setDoc(element) {
28
+ var doc = element.ownerDocument || element;
29
+
30
+ if (!(_transformProp$1 in element.style) && "msTransform" in element.style) {
31
+ //to improve compatibility with old Microsoft browsers
32
+ _transformProp$1 = "msTransform";
33
+ _transformOriginProp$1 = _transformProp$1 + "Origin";
34
+ }
35
+
36
+ while (doc.parentNode && (doc = doc.parentNode)) {}
37
+
38
+ _win$1 = window;
39
+ _identityMatrix$1 = new Matrix2D();
40
+
41
+ if (doc) {
42
+ _doc$1 = doc;
43
+ _docElement$1 = doc.documentElement;
44
+ _body$1 = doc.body;
45
+ _gEl = _doc$1.createElementNS("http://www.w3.org/2000/svg", "g"); // prevent any existing CSS from transforming it
46
+
47
+ _gEl.style.transform = "none"; // now test for the offset reporting bug. Use feature detection instead of browser sniffing to make things more bulletproof and future-proof. Hopefully Safari will fix their bug soon.
48
+
49
+ var d1 = doc.createElement("div"),
50
+ d2 = doc.createElement("div"),
51
+ root = doc && (doc.body || doc.firstElementChild);
52
+
53
+ if (root && root.appendChild) {
54
+ root.appendChild(d1);
55
+ d1.appendChild(d2);
56
+ d1.setAttribute("style", "position:static;transform:translate3d(0,0,1px)");
57
+ _hasOffsetBug = d2.offsetParent !== d1;
58
+ root.removeChild(d1);
59
+ }
60
+ }
61
+
62
+ return doc;
63
+ },
64
+ _forceNonZeroScale = function _forceNonZeroScale(e) {
65
+ // walks up the element's ancestors and finds any that had their scale set to 0 via GSAP, and changes them to 0.0001 to ensure that measurements work. Firefox has a bug that causes it to incorrectly report getBoundingClientRect() when scale is 0.
66
+ var a, cache;
67
+
68
+ while (e && e !== _body$1) {
69
+ cache = e._gsap;
70
+ cache && cache.uncache && cache.get(e, "x"); // force re-parsing of transforms if necessary
71
+
72
+ if (cache && !cache.scaleX && !cache.scaleY && cache.renderTransform) {
73
+ cache.scaleX = cache.scaleY = 1e-4;
74
+ cache.renderTransform(1, cache);
75
+ a ? a.push(cache) : a = [cache];
76
+ }
77
+
78
+ e = e.parentNode;
79
+ }
80
+
81
+ return a;
82
+ },
83
+ // possible future addition: pass an element to _forceDisplay() and it'll walk up all its ancestors and make sure anything with display: none is set to display: block, and if there's no parentNode, it'll add it to the body. It returns an Array that you can then feed to _revertDisplay() to have it revert all the changes it made.
84
+ // _forceDisplay = e => {
85
+ // let a = [],
86
+ // parent;
87
+ // while (e && e !== _body) {
88
+ // parent = e.parentNode;
89
+ // (_win.getComputedStyle(e).display === "none" || !parent) && a.push(e, e.style.display, parent) && (e.style.display = "block");
90
+ // parent || _body.appendChild(e);
91
+ // e = parent;
92
+ // }
93
+ // return a;
94
+ // },
95
+ // _revertDisplay = a => {
96
+ // for (let i = 0; i < a.length; i+=3) {
97
+ // a[i+1] ? (a[i].style.display = a[i+1]) : a[i].style.removeProperty("display");
98
+ // a[i+2] || a[i].parentNode.removeChild(a[i]);
99
+ // }
100
+ // },
101
+ _svgTemps = [],
102
+ //we create 3 elements for SVG, and 3 for other DOM elements and cache them for performance reasons. They get nested in _divContainer and _svgContainer so that just one element is added to the DOM on each successive attempt. Again, performance is key.
103
+ _divTemps = [],
104
+ _getDocScrollTop$1 = function _getDocScrollTop() {
105
+ return _win$1.pageYOffset || _doc$1.scrollTop || _docElement$1.scrollTop || _body$1.scrollTop || 0;
106
+ },
107
+ _getDocScrollLeft$1 = function _getDocScrollLeft() {
108
+ return _win$1.pageXOffset || _doc$1.scrollLeft || _docElement$1.scrollLeft || _body$1.scrollLeft || 0;
109
+ },
110
+ _svgOwner = function _svgOwner(element) {
111
+ return element.ownerSVGElement || ((element.tagName + "").toLowerCase() === "svg" ? element : null);
112
+ },
113
+ _isFixed$1 = function _isFixed(element) {
114
+ if (_win$1.getComputedStyle(element).position === "fixed") {
115
+ return true;
116
+ }
117
+
118
+ element = element.parentNode;
119
+
120
+ if (element && element.nodeType === 1) {
121
+ // avoid document fragments which will throw an error.
122
+ return _isFixed(element);
123
+ }
124
+ },
125
+ _createSibling = function _createSibling(element, i) {
126
+ if (element.parentNode && (_doc$1 || _setDoc(element))) {
127
+ var svg = _svgOwner(element),
128
+ ns = svg ? svg.getAttribute("xmlns") || "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml",
129
+ type = svg ? i ? "rect" : "g" : "div",
130
+ x = i !== 2 ? 0 : 100,
131
+ y = i === 3 ? 100 : 0,
132
+ css = "position:absolute;display:block;pointer-events:none;margin:0;padding:0;",
133
+ e = _doc$1.createElementNS ? _doc$1.createElementNS(ns.replace(/^https/, "http"), type) : _doc$1.createElement(type);
134
+
135
+ if (i) {
136
+ if (!svg) {
137
+ if (!_divContainer) {
138
+ _divContainer = _createSibling(element);
139
+ _divContainer.style.cssText = css;
140
+ }
141
+
142
+ e.style.cssText = css + "width:0.1px;height:0.1px;top:" + y + "px;left:" + x + "px";
143
+
144
+ _divContainer.appendChild(e);
145
+ } else {
146
+ _svgContainer || (_svgContainer = _createSibling(element));
147
+ e.setAttribute("width", 0.01);
148
+ e.setAttribute("height", 0.01);
149
+ e.setAttribute("transform", "translate(" + x + "," + y + ")");
150
+
151
+ _svgContainer.appendChild(e);
152
+ }
153
+ }
154
+
155
+ return e;
156
+ }
157
+
158
+ throw "Need document and parent.";
159
+ },
160
+ _consolidate = function _consolidate(m) {
161
+ // replaces SVGTransformList.consolidate() because a bug in Firefox causes it to break pointer events. See https://gsap.com/forums/topic/23248-touch-is-not-working-on-draggable-in-firefox-windows-v324/?tab=comments#comment-109800
162
+ var c = new Matrix2D(),
163
+ i = 0;
164
+
165
+ for (; i < m.numberOfItems; i++) {
166
+ c.multiply(m.getItem(i).matrix);
167
+ }
168
+
169
+ return c;
170
+ },
171
+ _getCTM = function _getCTM(svg) {
172
+ var m = svg.getCTM(),
173
+ transform;
174
+
175
+ if (!m) {
176
+ // Firefox returns null for getCTM() on root <svg> elements, so this is a workaround using a <g> that we temporarily append.
177
+ transform = svg.style[_transformProp$1];
178
+ svg.style[_transformProp$1] = "none"; // a bug in Firefox causes css transforms to contaminate the getCTM()
179
+
180
+ svg.appendChild(_gEl);
181
+ m = _gEl.getCTM();
182
+ svg.removeChild(_gEl);
183
+ transform ? svg.style[_transformProp$1] = transform : svg.style.removeProperty(_transformProp$1.replace(/([A-Z])/g, "-$1").toLowerCase());
184
+ }
185
+
186
+ return m || _identityMatrix$1.clone(); // Firefox will still return null if the <svg> has a width/height of 0 in the browser.
187
+ },
188
+ _placeSiblings = function _placeSiblings(element, adjustGOffset) {
189
+ var svg = _svgOwner(element),
190
+ isRootSVG = element === svg,
191
+ siblings = svg ? _svgTemps : _divTemps,
192
+ parent = element.parentNode,
193
+ container,
194
+ m,
195
+ b,
196
+ x,
197
+ y,
198
+ cs;
199
+
200
+ if (element === _win$1) {
201
+ return element;
202
+ }
203
+
204
+ siblings.length || siblings.push(_createSibling(element, 1), _createSibling(element, 2), _createSibling(element, 3));
205
+ container = svg ? _svgContainer : _divContainer;
206
+
207
+ if (svg) {
208
+ if (isRootSVG) {
209
+ b = _getCTM(element);
210
+ x = -b.e / b.a;
211
+ y = -b.f / b.d;
212
+ m = _identityMatrix$1;
213
+ } else if (element.getBBox) {
214
+ b = element.getBBox();
215
+ m = element.transform ? element.transform.baseVal : {}; // IE11 doesn't follow the spec.
216
+
217
+ m = !m.numberOfItems ? _identityMatrix$1 : m.numberOfItems > 1 ? _consolidate(m) : m.getItem(0).matrix; // don't call m.consolidate().matrix because a bug in Firefox makes pointer events not work when consolidate() is called on the same tick as getBoundingClientRect()! See https://gsap.com/forums/topic/23248-touch-is-not-working-on-draggable-in-firefox-windows-v324/?tab=comments#comment-109800
218
+
219
+ x = m.a * b.x + m.c * b.y;
220
+ y = m.b * b.x + m.d * b.y;
221
+ } else {
222
+ // may be a <mask> which has no getBBox() so just use defaults instead of throwing errors.
223
+ m = new Matrix2D();
224
+ x = y = 0;
225
+ }
226
+
227
+ if (adjustGOffset && element.tagName.toLowerCase() === "g") {
228
+ x = y = 0;
229
+ }
230
+
231
+ (isRootSVG ? svg : parent).appendChild(container);
232
+ container.setAttribute("transform", "matrix(" + m.a + "," + m.b + "," + m.c + "," + m.d + "," + (m.e + x) + "," + (m.f + y) + ")");
233
+ } else {
234
+ x = y = 0;
235
+
236
+ if (_hasOffsetBug) {
237
+ // some browsers (like Safari) have a bug that causes them to misreport offset values. When an ancestor element has a transform applied, it's supposed to treat it as if it's position: relative (new context). Safari botches this, so we need to find the closest ancestor (between the element and its offsetParent) that has a transform applied and if one is found, grab its offsetTop/Left and subtract them to compensate.
238
+ m = element.offsetParent;
239
+ b = element;
240
+
241
+ while (b && (b = b.parentNode) && b !== m && b.parentNode) {
242
+ if ((_win$1.getComputedStyle(b)[_transformProp$1] + "").length > 4) {
243
+ x = b.offsetLeft;
244
+ y = b.offsetTop;
245
+ b = 0;
246
+ }
247
+ }
248
+ }
249
+
250
+ cs = _win$1.getComputedStyle(element);
251
+
252
+ if (cs.position !== "absolute" && cs.position !== "fixed") {
253
+ m = element.offsetParent;
254
+
255
+ while (parent && parent !== m) {
256
+ // if there's an ancestor element between the element and its offsetParent that's scrolled, we must factor that in.
257
+ x += parent.scrollLeft || 0;
258
+ y += parent.scrollTop || 0;
259
+ parent = parent.parentNode;
260
+ }
261
+ }
262
+
263
+ b = container.style;
264
+ b.top = element.offsetTop - y + "px";
265
+ b.left = element.offsetLeft - x + "px";
266
+ b[_transformProp$1] = cs[_transformProp$1];
267
+ b[_transformOriginProp$1] = cs[_transformOriginProp$1]; // b.border = m.border;
268
+ // b.borderLeftStyle = m.borderLeftStyle;
269
+ // b.borderTopStyle = m.borderTopStyle;
270
+ // b.borderLeftWidth = m.borderLeftWidth;
271
+ // b.borderTopWidth = m.borderTopWidth;
272
+
273
+ b.position = cs.position === "fixed" ? "fixed" : "absolute";
274
+ element.parentNode.appendChild(container);
275
+ }
276
+
277
+ return container;
278
+ },
279
+ _setMatrix = function _setMatrix(m, a, b, c, d, e, f) {
280
+ m.a = a;
281
+ m.b = b;
282
+ m.c = c;
283
+ m.d = d;
284
+ m.e = e;
285
+ m.f = f;
286
+ return m;
287
+ };
288
+
289
+ var Matrix2D = /*#__PURE__*/function () {
290
+ function Matrix2D(a, b, c, d, e, f) {
291
+ if (a === void 0) {
292
+ a = 1;
293
+ }
294
+
295
+ if (b === void 0) {
296
+ b = 0;
297
+ }
298
+
299
+ if (c === void 0) {
300
+ c = 0;
301
+ }
302
+
303
+ if (d === void 0) {
304
+ d = 1;
305
+ }
306
+
307
+ if (e === void 0) {
308
+ e = 0;
309
+ }
310
+
311
+ if (f === void 0) {
312
+ f = 0;
313
+ }
314
+
315
+ _setMatrix(this, a, b, c, d, e, f);
316
+ }
317
+
318
+ var _proto = Matrix2D.prototype;
319
+
320
+ _proto.inverse = function inverse() {
321
+ var a = this.a,
322
+ b = this.b,
323
+ c = this.c,
324
+ d = this.d,
325
+ e = this.e,
326
+ f = this.f,
327
+ determinant = a * d - b * c || 1e-10;
328
+ return _setMatrix(this, d / determinant, -b / determinant, -c / determinant, a / determinant, (c * f - d * e) / determinant, -(a * f - b * e) / determinant);
329
+ };
330
+
331
+ _proto.multiply = function multiply(matrix) {
332
+ var a = this.a,
333
+ b = this.b,
334
+ c = this.c,
335
+ d = this.d,
336
+ e = this.e,
337
+ f = this.f,
338
+ a2 = matrix.a,
339
+ b2 = matrix.c,
340
+ c2 = matrix.b,
341
+ d2 = matrix.d,
342
+ e2 = matrix.e,
343
+ f2 = matrix.f;
344
+ return _setMatrix(this, a2 * a + c2 * c, a2 * b + c2 * d, b2 * a + d2 * c, b2 * b + d2 * d, e + e2 * a + f2 * c, f + e2 * b + f2 * d);
345
+ };
346
+
347
+ _proto.clone = function clone() {
348
+ return new Matrix2D(this.a, this.b, this.c, this.d, this.e, this.f);
349
+ };
350
+
351
+ _proto.equals = function equals(matrix) {
352
+ var a = this.a,
353
+ b = this.b,
354
+ c = this.c,
355
+ d = this.d,
356
+ e = this.e,
357
+ f = this.f;
358
+ return a === matrix.a && b === matrix.b && c === matrix.c && d === matrix.d && e === matrix.e && f === matrix.f;
359
+ };
360
+
361
+ _proto.apply = function apply(point, decoratee) {
362
+ if (decoratee === void 0) {
363
+ decoratee = {};
364
+ }
365
+
366
+ var x = point.x,
367
+ y = point.y,
368
+ a = this.a,
369
+ b = this.b,
370
+ c = this.c,
371
+ d = this.d,
372
+ e = this.e,
373
+ f = this.f;
374
+ decoratee.x = x * a + y * c + e || 0;
375
+ decoratee.y = x * b + y * d + f || 0;
376
+ return decoratee;
377
+ };
378
+
379
+ return Matrix2D;
380
+ }(); // Feed in an element and it'll return a 2D matrix (optionally inverted) so that you can translate between coordinate spaces.
381
+ // Inverting lets you translate a global point into a local coordinate space. No inverting lets you go the other way.
382
+ // We needed this to work around various browser bugs, like Firefox doesn't accurately report getScreenCTM() when there
383
+ // are transforms applied to ancestor elements.
384
+ // The matrix math to convert any x/y coordinate is as follows, which is wrapped in a convenient apply() method of Matrix2D above:
385
+ // tx = m.a * x + m.c * y + m.e
386
+ // ty = m.b * x + m.d * y + m.f
387
+
388
+ function getGlobalMatrix(element, inverse, adjustGOffset, includeScrollInFixed) {
389
+ // adjustGOffset is typically used only when grabbing an element's PARENT's global matrix, and it ignores the x/y offset of any SVG <g> elements because they behave in a special way.
390
+ if (!element || !element.parentNode || (_doc$1 || _setDoc(element)).documentElement === element) {
391
+ return new Matrix2D();
392
+ }
393
+
394
+ var zeroScales = _forceNonZeroScale(element),
395
+ svg = _svgOwner(element),
396
+ temps = svg ? _svgTemps : _divTemps,
397
+ container = _placeSiblings(element, adjustGOffset),
398
+ b1 = temps[0].getBoundingClientRect(),
399
+ b2 = temps[1].getBoundingClientRect(),
400
+ b3 = temps[2].getBoundingClientRect(),
401
+ parent = container.parentNode,
402
+ isFixed = !includeScrollInFixed && _isFixed$1(element),
403
+ m = new Matrix2D((b2.left - b1.left) / 100, (b2.top - b1.top) / 100, (b3.left - b1.left) / 100, (b3.top - b1.top) / 100, b1.left + (isFixed ? 0 : _getDocScrollLeft$1()), b1.top + (isFixed ? 0 : _getDocScrollTop$1()));
404
+
405
+ parent.removeChild(container);
406
+
407
+ if (zeroScales) {
408
+ b1 = zeroScales.length;
409
+
410
+ while (b1--) {
411
+ b2 = zeroScales[b1];
412
+ b2.scaleX = b2.scaleY = 0;
413
+ b2.renderTransform(1, b2);
414
+ }
415
+ }
416
+
417
+ return inverse ? m.inverse() : m;
418
+ }
419
+ // _doc || _setDoc(element);
420
+ // let m = (_win.getComputedStyle(element)[_transformProp] + "").substr(7).match(/[-.]*\d+[.e\-+]*\d*[e\-\+]*\d*/g),
421
+ // is2D = m && m.length === 6;
422
+ // return !m || m.length < 6 ? new Matrix2D() : new Matrix2D(+m[0], +m[1], +m[is2D ? 2 : 4], +m[is2D ? 3 : 5], +m[is2D ? 4 : 12], +m[is2D ? 5 : 13]);
423
+ // }
424
+
425
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
426
+
427
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
428
+
429
+ var gsap,
430
+ _win,
431
+ _doc,
432
+ _docElement,
433
+ _body,
434
+ _tempDiv,
435
+ _placeholderDiv,
436
+ _coreInitted,
437
+ _checkPrefix,
438
+ _toArray,
439
+ _supportsPassive,
440
+ _isTouchDevice,
441
+ _touchEventLookup,
442
+ _isMultiTouching,
443
+ _isAndroid,
444
+ InertiaPlugin,
445
+ _defaultCursor,
446
+ _supportsPointer,
447
+ _context,
448
+ _getStyleSaver,
449
+ _dragCount = 0,
450
+ _windowExists = function _windowExists() {
451
+ return typeof window !== "undefined";
452
+ },
453
+ _getGSAP = function _getGSAP() {
454
+ return gsap || _windowExists() && (gsap = window.gsap) && gsap.registerPlugin && gsap;
455
+ },
456
+ _isFunction = function _isFunction(value) {
457
+ return typeof value === "function";
458
+ },
459
+ _isObject = function _isObject(value) {
460
+ return typeof value === "object";
461
+ },
462
+ _isUndefined = function _isUndefined(value) {
463
+ return typeof value === "undefined";
464
+ },
465
+ _emptyFunc = function _emptyFunc() {
466
+ return false;
467
+ },
468
+ _transformProp = "transform",
469
+ _transformOriginProp = "transformOrigin",
470
+ _round = function _round(value) {
471
+ return Math.round(value * 10000) / 10000;
472
+ },
473
+ _isArray = Array.isArray,
474
+ _createElement = function _createElement(type, ns) {
475
+ var e = _doc.createElementNS ? _doc.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc.createElement(type); //some servers swap in https for http in the namespace which can break things, making "style" inaccessible.
476
+
477
+ return e.style ? e : _doc.createElement(type); //some environments won't allow access to the element's style when created with a namespace in which case we default to the standard createElement() to work around the issue. Also note that when GSAP is embedded directly inside an SVG file, createElement() won't allow access to the style object in Firefox (see https://gsap.com/forums/topic/20215-problem-using-tweenmax-in-standalone-self-containing-svg-file-err-cannot-set-property-csstext-of-undefined/).
478
+ },
479
+ _RAD2DEG = 180 / Math.PI,
480
+ _bigNum = 1e20,
481
+ _identityMatrix = new Matrix2D(),
482
+ _getTime = Date.now || function () {
483
+ return new Date().getTime();
484
+ },
485
+ _renderQueue = [],
486
+ _lookup = {},
487
+ //when a Draggable is created, the target gets a unique _gsDragID property that allows gets associated with the Draggable instance for quick lookups in Draggable.get(). This avoids circular references that could cause gc problems.
488
+ _lookupCount = 0,
489
+ _clickableTagExp = /^(?:a|input|textarea|button|select)$/i,
490
+ _lastDragTime = 0,
491
+ _temp1 = {},
492
+ // a simple object we reuse and populate (usually x/y properties) to conserve memory and improve performance.
493
+ _windowProxy = {},
494
+ //memory/performance optimization - we reuse this object during autoScroll to store window-related bounds/offsets.
495
+ _copy = function _copy(obj, factor) {
496
+ var copy = {},
497
+ p;
498
+
499
+ for (p in obj) {
500
+ copy[p] = factor ? obj[p] * factor : obj[p];
501
+ }
502
+
503
+ return copy;
504
+ },
505
+ _extend = function _extend(obj, defaults) {
506
+ for (var p in defaults) {
507
+ if (!(p in obj)) {
508
+ obj[p] = defaults[p];
509
+ }
510
+ }
511
+
512
+ return obj;
513
+ },
514
+ _setTouchActionForAllDescendants = function _setTouchActionForAllDescendants(elements, value) {
515
+ var i = elements.length,
516
+ children;
517
+
518
+ while (i--) {
519
+ value ? elements[i].style.touchAction = value : elements[i].style.removeProperty("touch-action");
520
+ children = elements[i].children;
521
+ children && children.length && _setTouchActionForAllDescendants(children, value);
522
+ }
523
+ },
524
+ _renderQueueTick = function _renderQueueTick() {
525
+ return _renderQueue.forEach(function (func) {
526
+ return func();
527
+ });
528
+ },
529
+ _addToRenderQueue = function _addToRenderQueue(func) {
530
+ _renderQueue.push(func);
531
+
532
+ if (_renderQueue.length === 1) {
533
+ gsap.ticker.add(_renderQueueTick);
534
+ }
535
+ },
536
+ _renderQueueTimeout = function _renderQueueTimeout() {
537
+ return !_renderQueue.length && gsap.ticker.remove(_renderQueueTick);
538
+ },
539
+ _removeFromRenderQueue = function _removeFromRenderQueue(func) {
540
+ var i = _renderQueue.length;
541
+
542
+ while (i--) {
543
+ if (_renderQueue[i] === func) {
544
+ _renderQueue.splice(i, 1);
545
+ }
546
+ }
547
+
548
+ gsap.to(_renderQueueTimeout, {
549
+ overwrite: true,
550
+ delay: 15,
551
+ duration: 0,
552
+ onComplete: _renderQueueTimeout,
553
+ data: "_draggable"
554
+ }); //remove the "tick" listener only after the render queue is empty for 15 seconds (to improve performance). Adding/removing it constantly for every click/touch wouldn't deliver optimal speed, and we also don't want the ticker to keep calling the render method when things are idle for long periods of time (we want to improve battery life on mobile devices).
555
+ },
556
+ _setDefaults = function _setDefaults(obj, defaults) {
557
+ for (var p in defaults) {
558
+ if (!(p in obj)) {
559
+ obj[p] = defaults[p];
560
+ }
561
+ }
562
+
563
+ return obj;
564
+ },
565
+ _addListener = function _addListener(element, type, func, capture) {
566
+ if (element.addEventListener) {
567
+ var touchType = _touchEventLookup[type];
568
+ capture = capture || (_supportsPassive ? {
569
+ passive: false
570
+ } : null);
571
+ element.addEventListener(touchType || type, func, capture);
572
+ touchType && type !== touchType && element.addEventListener(type, func, capture); //some browsers actually support both, so must we. But pointer events cover all.
573
+ }
574
+ },
575
+ _removeListener = function _removeListener(element, type, func, capture) {
576
+ if (element.removeEventListener) {
577
+ var touchType = _touchEventLookup[type];
578
+ element.removeEventListener(touchType || type, func, capture);
579
+ touchType && type !== touchType && element.removeEventListener(type, func, capture);
580
+ }
581
+ },
582
+ _preventDefault = function _preventDefault(event) {
583
+ event.preventDefault && event.preventDefault();
584
+ event.preventManipulation && event.preventManipulation(); //for some Microsoft browsers
585
+ },
586
+ _hasTouchID = function _hasTouchID(list, ID) {
587
+ var i = list.length;
588
+
589
+ while (i--) {
590
+ if (list[i].identifier === ID) {
591
+ return true;
592
+ }
593
+ }
594
+ },
595
+ _onMultiTouchDocumentEnd = function _onMultiTouchDocumentEnd(event) {
596
+ _isMultiTouching = event.touches && _dragCount < event.touches.length;
597
+
598
+ _removeListener(event.target, "touchend", _onMultiTouchDocumentEnd);
599
+ },
600
+ _onMultiTouchDocument = function _onMultiTouchDocument(event) {
601
+ _isMultiTouching = event.touches && _dragCount < event.touches.length;
602
+
603
+ _addListener(event.target, "touchend", _onMultiTouchDocumentEnd);
604
+ },
605
+ _getDocScrollTop = function _getDocScrollTop(doc) {
606
+ return _win.pageYOffset || doc.scrollTop || doc.documentElement.scrollTop || doc.body.scrollTop || 0;
607
+ },
608
+ _getDocScrollLeft = function _getDocScrollLeft(doc) {
609
+ return _win.pageXOffset || doc.scrollLeft || doc.documentElement.scrollLeft || doc.body.scrollLeft || 0;
610
+ },
611
+ _addScrollListener = function _addScrollListener(e, callback) {
612
+ _addListener(e, "scroll", callback);
613
+
614
+ if (!_isRoot(e.parentNode)) {
615
+ _addScrollListener(e.parentNode, callback);
616
+ }
617
+ },
618
+ _removeScrollListener = function _removeScrollListener(e, callback) {
619
+ _removeListener(e, "scroll", callback);
620
+
621
+ if (!_isRoot(e.parentNode)) {
622
+ _removeScrollListener(e.parentNode, callback);
623
+ }
624
+ },
625
+ _isRoot = function _isRoot(e) {
626
+ return !!(!e || e === _docElement || e.nodeType === 9 || e === _doc.body || e === _win || !e.nodeType || !e.parentNode);
627
+ },
628
+ _getMaxScroll = function _getMaxScroll(element, axis) {
629
+ var dim = axis === "x" ? "Width" : "Height",
630
+ scroll = "scroll" + dim,
631
+ client = "client" + dim;
632
+ return Math.max(0, _isRoot(element) ? Math.max(_docElement[scroll], _body[scroll]) - (_win["inner" + dim] || _docElement[client] || _body[client]) : element[scroll] - element[client]);
633
+ },
634
+ _recordMaxScrolls = function _recordMaxScrolls(e, skipCurrent) {
635
+ //records _gsMaxScrollX and _gsMaxScrollY properties for the element and all ancestors up the chain so that we can cap it, otherwise dragging beyond the edges with autoScroll on can endlessly scroll.
636
+ var x = _getMaxScroll(e, "x"),
637
+ y = _getMaxScroll(e, "y");
638
+
639
+ if (_isRoot(e)) {
640
+ e = _windowProxy;
641
+ } else {
642
+ _recordMaxScrolls(e.parentNode, skipCurrent);
643
+ }
644
+
645
+ e._gsMaxScrollX = x;
646
+ e._gsMaxScrollY = y;
647
+
648
+ if (!skipCurrent) {
649
+ e._gsScrollX = e.scrollLeft || 0;
650
+ e._gsScrollY = e.scrollTop || 0;
651
+ }
652
+ },
653
+ _setStyle = function _setStyle(element, property, value) {
654
+ var style = element.style;
655
+
656
+ if (!style) {
657
+ return;
658
+ }
659
+
660
+ if (_isUndefined(style[property])) {
661
+ property = _checkPrefix(property, element) || property;
662
+ }
663
+
664
+ if (value == null) {
665
+ style.removeProperty && style.removeProperty(property.replace(/([A-Z])/g, "-$1").toLowerCase());
666
+ } else {
667
+ style[property] = value;
668
+ }
669
+ },
670
+ _getComputedStyle = function _getComputedStyle(element) {
671
+ return _win.getComputedStyle(element instanceof Element ? element : element.host || (element.parentNode || {}).host || element);
672
+ },
673
+ //the "host" stuff helps to accommodate ShadowDom objects.
674
+ _tempRect = {},
675
+ //reuse to reduce garbage collection tasks
676
+ _parseRect = function _parseRect(e) {
677
+ //accepts a DOM element, a mouse event, or a rectangle object and returns the corresponding rectangle with left, right, width, height, top, and bottom properties
678
+ if (e === _win) {
679
+ _tempRect.left = _tempRect.top = 0;
680
+ _tempRect.width = _tempRect.right = _docElement.clientWidth || e.innerWidth || _body.clientWidth || 0;
681
+ _tempRect.height = _tempRect.bottom = (e.innerHeight || 0) - 20 < _docElement.clientHeight ? _docElement.clientHeight : e.innerHeight || _body.clientHeight || 0;
682
+ return _tempRect;
683
+ }
684
+
685
+ var doc = e.ownerDocument || _doc,
686
+ r = !_isUndefined(e.pageX) ? {
687
+ left: e.pageX - _getDocScrollLeft(doc),
688
+ top: e.pageY - _getDocScrollTop(doc),
689
+ right: e.pageX - _getDocScrollLeft(doc) + 1,
690
+ bottom: e.pageY - _getDocScrollTop(doc) + 1
691
+ } : !e.nodeType && !_isUndefined(e.left) && !_isUndefined(e.top) ? e : _toArray(e)[0].getBoundingClientRect();
692
+
693
+ if (_isUndefined(r.right) && !_isUndefined(r.width)) {
694
+ r.right = r.left + r.width;
695
+ r.bottom = r.top + r.height;
696
+ } else if (_isUndefined(r.width)) {
697
+ //some browsers don't include width and height properties. We can't just set them directly on r because some browsers throw errors, so create a new generic object.
698
+ r = {
699
+ width: r.right - r.left,
700
+ height: r.bottom - r.top,
701
+ right: r.right,
702
+ left: r.left,
703
+ bottom: r.bottom,
704
+ top: r.top
705
+ };
706
+ }
707
+
708
+ return r;
709
+ },
710
+ _dispatchEvent = function _dispatchEvent(target, type, callbackName) {
711
+ var vars = target.vars,
712
+ callback = vars[callbackName],
713
+ listeners = target._listeners[type],
714
+ result;
715
+
716
+ if (_isFunction(callback)) {
717
+ result = callback.apply(vars.callbackScope || target, vars[callbackName + "Params"] || [target.pointerEvent]);
718
+ }
719
+
720
+ if (listeners && target.dispatchEvent(type) === false) {
721
+ result = false;
722
+ }
723
+
724
+ return result;
725
+ },
726
+ _getBounds = function _getBounds(target, context) {
727
+ //accepts any of the following: a DOM element, jQuery object, selector text, or an object defining bounds as {top, left, width, height} or {minX, maxX, minY, maxY}. Returns an object with left, top, width, and height properties.
728
+ var e = _toArray(target)[0],
729
+ top,
730
+ left,
731
+ offset;
732
+
733
+ if (!e.nodeType && e !== _win) {
734
+ if (!_isUndefined(target.left)) {
735
+ offset = {
736
+ x: 0,
737
+ y: 0
738
+ }; //_getOffsetTransformOrigin(context); //the bounds should be relative to the origin
739
+
740
+ return {
741
+ left: target.left - offset.x,
742
+ top: target.top - offset.y,
743
+ width: target.width,
744
+ height: target.height
745
+ };
746
+ }
747
+
748
+ left = target.min || target.minX || target.minRotation || 0;
749
+ top = target.min || target.minY || 0;
750
+ return {
751
+ left: left,
752
+ top: top,
753
+ width: (target.max || target.maxX || target.maxRotation || 0) - left,
754
+ height: (target.max || target.maxY || 0) - top
755
+ };
756
+ }
757
+
758
+ return _getElementBounds(e, context);
759
+ },
760
+ _point1 = {},
761
+ //we reuse to minimize garbage collection tasks.
762
+ _getElementBounds = function _getElementBounds(element, context) {
763
+ context = _toArray(context)[0];
764
+ var isSVG = element.getBBox && element.ownerSVGElement,
765
+ doc = element.ownerDocument || _doc,
766
+ left,
767
+ right,
768
+ top,
769
+ bottom,
770
+ matrix,
771
+ p1,
772
+ p2,
773
+ p3,
774
+ p4,
775
+ bbox,
776
+ width,
777
+ height,
778
+ cs;
779
+
780
+ if (element === _win) {
781
+ top = _getDocScrollTop(doc);
782
+ left = _getDocScrollLeft(doc);
783
+ right = left + (doc.documentElement.clientWidth || element.innerWidth || doc.body.clientWidth || 0);
784
+ bottom = top + ((element.innerHeight || 0) - 20 < doc.documentElement.clientHeight ? doc.documentElement.clientHeight : element.innerHeight || doc.body.clientHeight || 0); //some browsers (like Firefox) ignore absolutely positioned elements, and collapse the height of the documentElement, so it could be 8px, for example, if you have just an absolutely positioned div. In that case, we use the innerHeight to resolve this.
785
+ } else if (context === _win || _isUndefined(context)) {
786
+ return element.getBoundingClientRect();
787
+ } else {
788
+ left = top = 0;
789
+
790
+ if (isSVG) {
791
+ bbox = element.getBBox();
792
+ width = bbox.width;
793
+ height = bbox.height;
794
+ } else {
795
+ if (element.viewBox && (bbox = element.viewBox.baseVal)) {
796
+ left = bbox.x || 0;
797
+ top = bbox.y || 0;
798
+ width = bbox.width;
799
+ height = bbox.height;
800
+ }
801
+
802
+ if (!width) {
803
+ cs = _getComputedStyle(element);
804
+ bbox = cs.boxSizing === "border-box";
805
+ width = (parseFloat(cs.width) || element.clientWidth || 0) + (bbox ? 0 : parseFloat(cs.borderLeftWidth) + parseFloat(cs.borderRightWidth));
806
+ height = (parseFloat(cs.height) || element.clientHeight || 0) + (bbox ? 0 : parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth));
807
+ }
808
+ }
809
+
810
+ right = width;
811
+ bottom = height;
812
+ }
813
+
814
+ if (element === context) {
815
+ return {
816
+ left: left,
817
+ top: top,
818
+ width: right - left,
819
+ height: bottom - top
820
+ };
821
+ }
822
+
823
+ matrix = getGlobalMatrix(context, true).multiply(getGlobalMatrix(element));
824
+ p1 = matrix.apply({
825
+ x: left,
826
+ y: top
827
+ });
828
+ p2 = matrix.apply({
829
+ x: right,
830
+ y: top
831
+ });
832
+ p3 = matrix.apply({
833
+ x: right,
834
+ y: bottom
835
+ });
836
+ p4 = matrix.apply({
837
+ x: left,
838
+ y: bottom
839
+ });
840
+ left = Math.min(p1.x, p2.x, p3.x, p4.x);
841
+ top = Math.min(p1.y, p2.y, p3.y, p4.y);
842
+ return {
843
+ left: left,
844
+ top: top,
845
+ width: Math.max(p1.x, p2.x, p3.x, p4.x) - left,
846
+ height: Math.max(p1.y, p2.y, p3.y, p4.y) - top
847
+ };
848
+ },
849
+ _parseInertia = function _parseInertia(draggable, snap, max, min, factor, forceZeroVelocity) {
850
+ var vars = {},
851
+ a,
852
+ i,
853
+ l;
854
+
855
+ if (snap) {
856
+ if (factor !== 1 && snap instanceof Array) {
857
+ //some data must be altered to make sense, like if the user passes in an array of rotational values in degrees, we must convert it to radians. Or for scrollLeft and scrollTop, we invert the values.
858
+ vars.end = a = [];
859
+ l = snap.length;
860
+
861
+ if (_isObject(snap[0])) {
862
+ //if the array is populated with objects, like points ({x:100, y:200}), make copies before multiplying by the factor, otherwise we'll mess up the originals and the user may reuse it elsewhere.
863
+ for (i = 0; i < l; i++) {
864
+ a[i] = _copy(snap[i], factor);
865
+ }
866
+ } else {
867
+ for (i = 0; i < l; i++) {
868
+ a[i] = snap[i] * factor;
869
+ }
870
+ }
871
+
872
+ max += 1.1; //allow 1.1 pixels of wiggle room when snapping in order to work around some browser inconsistencies in the way bounds are reported which can make them roughly a pixel off. For example, if "snap:[-$('#menu').width(), 0]" was defined and #menu had a wrapper that was used as the bounds, some browsers would be one pixel off, making the minimum -752 for example when snap was [-753,0], thus instead of snapping to -753, it would snap to 0 since -753 was below the minimum.
873
+
874
+ min -= 1.1;
875
+ } else if (_isFunction(snap)) {
876
+ vars.end = function (value) {
877
+ var result = snap.call(draggable, value),
878
+ copy,
879
+ p;
880
+
881
+ if (factor !== 1) {
882
+ if (_isObject(result)) {
883
+ copy = {};
884
+
885
+ for (p in result) {
886
+ copy[p] = result[p] * factor;
887
+ }
888
+
889
+ result = copy;
890
+ } else {
891
+ result *= factor;
892
+ }
893
+ }
894
+
895
+ return result; //we need to ensure that we can scope the function call to the Draggable instance itself so that users can access important values like maxX, minX, maxY, minY, x, and y from within that function.
896
+ };
897
+ } else {
898
+ vars.end = snap;
899
+ }
900
+ }
901
+
902
+ if (max || max === 0) {
903
+ vars.max = max;
904
+ }
905
+
906
+ if (min || min === 0) {
907
+ vars.min = min;
908
+ }
909
+
910
+ if (forceZeroVelocity) {
911
+ vars.velocity = 0;
912
+ }
913
+
914
+ return vars;
915
+ },
916
+ _isClickable = function _isClickable(element) {
917
+ //sometimes it's convenient to mark an element as clickable by adding a data-clickable="true" attribute (in which case we won't preventDefault() the mouse/touch event). This method checks if the element is an <a>, <input>, or <button> or has the data-clickable or contentEditable attribute set to true (or any of its parent elements).
918
+ var data;
919
+ return !element || !element.getAttribute || element === _body ? false : (data = element.getAttribute("data-clickable")) === "true" || data !== "false" && (_clickableTagExp.test(element.nodeName + "") || element.getAttribute("contentEditable") === "true") ? true : _isClickable(element.parentNode);
920
+ },
921
+ _setSelectable = function _setSelectable(elements, selectable) {
922
+ var i = elements.length,
923
+ e;
924
+
925
+ while (i--) {
926
+ e = elements[i];
927
+ e.ondragstart = e.onselectstart = selectable ? null : _emptyFunc;
928
+ gsap.set(e, {
929
+ lazy: true,
930
+ userSelect: selectable ? "text" : "none"
931
+ });
932
+ }
933
+ },
934
+ _isFixed = function _isFixed(element) {
935
+ if (_getComputedStyle(element).position === "fixed") {
936
+ return true;
937
+ }
938
+
939
+ element = element.parentNode;
940
+
941
+ if (element && element.nodeType === 1) {
942
+ // avoid document fragments which will throw an error.
943
+ return _isFixed(element);
944
+ }
945
+ },
946
+ _supports3D,
947
+ _addPaddingBR,
948
+ //The ScrollProxy class wraps an element's contents into another div (we call it "content") that we either add padding when necessary or apply a translate3d() transform in order to overscroll (scroll past the boundaries). This allows us to simply set the scrollTop/scrollLeft (or top/left for easier reverse-axis orientation, which is what we do in Draggable) and it'll do all the work for us. For example, if we tried setting scrollTop to -100 on a normal DOM element, it wouldn't work - it'd look the same as setting it to 0, but if we set scrollTop of a ScrollProxy to -100, it'll give the correct appearance by either setting paddingTop of the wrapper to 100 or applying a 100-pixel translateY.
949
+ ScrollProxy = function ScrollProxy(element, vars) {
950
+ element = gsap.utils.toArray(element)[0];
951
+ vars = vars || {};
952
+ var content = document.createElement("div"),
953
+ style = content.style,
954
+ node = element.firstChild,
955
+ offsetTop = 0,
956
+ offsetLeft = 0,
957
+ prevTop = element.scrollTop,
958
+ prevLeft = element.scrollLeft,
959
+ scrollWidth = element.scrollWidth,
960
+ scrollHeight = element.scrollHeight,
961
+ extraPadRight = 0,
962
+ maxLeft = 0,
963
+ maxTop = 0,
964
+ elementWidth,
965
+ elementHeight,
966
+ contentHeight,
967
+ nextNode,
968
+ transformStart,
969
+ transformEnd;
970
+
971
+ if (_supports3D && vars.force3D !== false) {
972
+ transformStart = "translate3d(";
973
+ transformEnd = "px,0px)";
974
+ } else if (_transformProp) {
975
+ transformStart = "translate(";
976
+ transformEnd = "px)";
977
+ }
978
+
979
+ this.scrollTop = function (value, force) {
980
+ if (!arguments.length) {
981
+ return -this.top();
982
+ }
983
+
984
+ this.top(-value, force);
985
+ };
986
+
987
+ this.scrollLeft = function (value, force) {
988
+ if (!arguments.length) {
989
+ return -this.left();
990
+ }
991
+
992
+ this.left(-value, force);
993
+ };
994
+
995
+ this.left = function (value, force) {
996
+ if (!arguments.length) {
997
+ return -(element.scrollLeft + offsetLeft);
998
+ }
999
+
1000
+ var dif = element.scrollLeft - prevLeft,
1001
+ oldOffset = offsetLeft;
1002
+
1003
+ if ((dif > 2 || dif < -2) && !force) {
1004
+ //if the user interacts with the scrollbar (or something else scrolls it, like the mouse wheel), we should kill any tweens of the ScrollProxy.
1005
+ prevLeft = element.scrollLeft;
1006
+ gsap.killTweensOf(this, {
1007
+ left: 1,
1008
+ scrollLeft: 1
1009
+ });
1010
+ this.left(-prevLeft);
1011
+
1012
+ if (vars.onKill) {
1013
+ vars.onKill();
1014
+ }
1015
+
1016
+ return;
1017
+ }
1018
+
1019
+ value = -value; //invert because scrolling works in the opposite direction
1020
+
1021
+ if (value < 0) {
1022
+ offsetLeft = value - 0.5 | 0;
1023
+ value = 0;
1024
+ } else if (value > maxLeft) {
1025
+ offsetLeft = value - maxLeft | 0;
1026
+ value = maxLeft;
1027
+ } else {
1028
+ offsetLeft = 0;
1029
+ }
1030
+
1031
+ if (offsetLeft || oldOffset) {
1032
+ if (!this._skip) {
1033
+ style[_transformProp] = transformStart + -offsetLeft + "px," + -offsetTop + transformEnd;
1034
+ }
1035
+
1036
+ if (offsetLeft + extraPadRight >= 0) {
1037
+ style.paddingRight = offsetLeft + extraPadRight + "px";
1038
+ }
1039
+ }
1040
+
1041
+ element.scrollLeft = value | 0;
1042
+ prevLeft = element.scrollLeft; //don't merge this with the line above because some browsers adjust the scrollLeft after it's set, so in order to be 100% accurate in tracking it, we need to ask the browser to report it.
1043
+ };
1044
+
1045
+ this.top = function (value, force) {
1046
+ if (!arguments.length) {
1047
+ return -(element.scrollTop + offsetTop);
1048
+ }
1049
+
1050
+ var dif = element.scrollTop - prevTop,
1051
+ oldOffset = offsetTop;
1052
+
1053
+ if ((dif > 2 || dif < -2) && !force) {
1054
+ //if the user interacts with the scrollbar (or something else scrolls it, like the mouse wheel), we should kill any tweens of the ScrollProxy.
1055
+ prevTop = element.scrollTop;
1056
+ gsap.killTweensOf(this, {
1057
+ top: 1,
1058
+ scrollTop: 1
1059
+ });
1060
+ this.top(-prevTop);
1061
+
1062
+ if (vars.onKill) {
1063
+ vars.onKill();
1064
+ }
1065
+
1066
+ return;
1067
+ }
1068
+
1069
+ value = -value; //invert because scrolling works in the opposite direction
1070
+
1071
+ if (value < 0) {
1072
+ offsetTop = value - 0.5 | 0;
1073
+ value = 0;
1074
+ } else if (value > maxTop) {
1075
+ offsetTop = value - maxTop | 0;
1076
+ value = maxTop;
1077
+ } else {
1078
+ offsetTop = 0;
1079
+ }
1080
+
1081
+ if (offsetTop || oldOffset) {
1082
+ if (!this._skip) {
1083
+ style[_transformProp] = transformStart + -offsetLeft + "px," + -offsetTop + transformEnd;
1084
+ }
1085
+ }
1086
+
1087
+ element.scrollTop = value | 0;
1088
+ prevTop = element.scrollTop;
1089
+ };
1090
+
1091
+ this.maxScrollTop = function () {
1092
+ return maxTop;
1093
+ };
1094
+
1095
+ this.maxScrollLeft = function () {
1096
+ return maxLeft;
1097
+ };
1098
+
1099
+ this.disable = function () {
1100
+ node = content.firstChild;
1101
+
1102
+ while (node) {
1103
+ nextNode = node.nextSibling;
1104
+ element.appendChild(node);
1105
+ node = nextNode;
1106
+ }
1107
+
1108
+ if (element === content.parentNode) {
1109
+ //in case disable() is called when it's already disabled.
1110
+ element.removeChild(content);
1111
+ }
1112
+ };
1113
+
1114
+ this.enable = function () {
1115
+ node = element.firstChild;
1116
+
1117
+ if (node === content) {
1118
+ return;
1119
+ }
1120
+
1121
+ while (node) {
1122
+ nextNode = node.nextSibling;
1123
+ content.appendChild(node);
1124
+ node = nextNode;
1125
+ }
1126
+
1127
+ element.appendChild(content);
1128
+ this.calibrate();
1129
+ };
1130
+
1131
+ this.calibrate = function (force) {
1132
+ var widthMatches = element.clientWidth === elementWidth,
1133
+ cs,
1134
+ x,
1135
+ y;
1136
+ prevTop = element.scrollTop;
1137
+ prevLeft = element.scrollLeft;
1138
+
1139
+ if (widthMatches && element.clientHeight === elementHeight && content.offsetHeight === contentHeight && scrollWidth === element.scrollWidth && scrollHeight === element.scrollHeight && !force) {
1140
+ return; //no need to recalculate things if the width and height haven't changed.
1141
+ }
1142
+
1143
+ if (offsetTop || offsetLeft) {
1144
+ x = this.left();
1145
+ y = this.top();
1146
+ this.left(-element.scrollLeft);
1147
+ this.top(-element.scrollTop);
1148
+ }
1149
+
1150
+ cs = _getComputedStyle(element); //first, we need to remove any width constraints to see how the content naturally flows so that we can see if it's wider than the containing element. If so, we've got to record the amount of overage so that we can apply that as padding in order for browsers to correctly handle things. Then we switch back to a width of 100% (without that, some browsers don't flow the content correctly)
1151
+
1152
+ if (!widthMatches || force) {
1153
+ style.display = "block";
1154
+ style.width = "auto";
1155
+ style.paddingRight = "0px";
1156
+ extraPadRight = Math.max(0, element.scrollWidth - element.clientWidth); //if the content is wider than the container, we need to add the paddingLeft and paddingRight in order for things to behave correctly.
1157
+
1158
+ if (extraPadRight) {
1159
+ extraPadRight += parseFloat(cs.paddingLeft) + (_addPaddingBR ? parseFloat(cs.paddingRight) : 0);
1160
+ }
1161
+ }
1162
+
1163
+ style.display = "inline-block";
1164
+ style.position = "relative";
1165
+ style.overflow = "visible";
1166
+ style.verticalAlign = "top";
1167
+ style.boxSizing = "content-box";
1168
+ style.width = "100%";
1169
+ style.paddingRight = extraPadRight + "px"; //some browsers neglect to factor in the bottom padding when calculating the scrollHeight, so we need to add that padding to the content when that happens. Allow a 2px margin for error
1170
+
1171
+ if (_addPaddingBR) {
1172
+ style.paddingBottom = cs.paddingBottom;
1173
+ }
1174
+
1175
+ elementWidth = element.clientWidth;
1176
+ elementHeight = element.clientHeight;
1177
+ scrollWidth = element.scrollWidth;
1178
+ scrollHeight = element.scrollHeight;
1179
+ maxLeft = element.scrollWidth - elementWidth;
1180
+ maxTop = element.scrollHeight - elementHeight;
1181
+ contentHeight = content.offsetHeight;
1182
+ style.display = "block";
1183
+
1184
+ if (x || y) {
1185
+ this.left(x);
1186
+ this.top(y);
1187
+ }
1188
+ };
1189
+
1190
+ this.content = content;
1191
+ this.element = element;
1192
+ this._skip = false;
1193
+ this.enable();
1194
+ },
1195
+ _initCore = function _initCore(required) {
1196
+ if (_windowExists() && document.body) {
1197
+ var nav = window && window.navigator;
1198
+ _win = window;
1199
+ _doc = document;
1200
+ _docElement = _doc.documentElement;
1201
+ _body = _doc.body;
1202
+ _tempDiv = _createElement("div");
1203
+ _supportsPointer = !!window.PointerEvent;
1204
+ _placeholderDiv = _createElement("div");
1205
+ _placeholderDiv.style.cssText = "visibility:hidden;height:1px;top:-1px;pointer-events:none;position:relative;clear:both;cursor:grab";
1206
+ _defaultCursor = _placeholderDiv.style.cursor === "grab" ? "grab" : "move";
1207
+ _isAndroid = nav && nav.userAgent.toLowerCase().indexOf("android") !== -1; //Android handles touch events in an odd way and it's virtually impossible to "feature test" so we resort to UA sniffing
1208
+
1209
+ _isTouchDevice = "ontouchstart" in _docElement && "orientation" in _win || nav && (nav.MaxTouchPoints > 0 || nav.msMaxTouchPoints > 0);
1210
+
1211
+ _addPaddingBR = function () {
1212
+ //this function is in charge of analyzing browser behavior related to padding. It sets the _addPaddingBR to true if the browser doesn't normally factor in the bottom or right padding on the element inside the scrolling area, and it sets _addPaddingLeft to true if it's a browser that requires the extra offset (offsetLeft) to be added to the paddingRight (like Opera).
1213
+ var div = _createElement("div"),
1214
+ child = _createElement("div"),
1215
+ childStyle = child.style,
1216
+ parent = _body,
1217
+ val;
1218
+
1219
+ childStyle.display = "inline-block";
1220
+ childStyle.position = "relative";
1221
+ div.style.cssText = "width:90px;height:40px;padding:10px;overflow:auto;visibility:hidden";
1222
+ div.appendChild(child);
1223
+ parent.appendChild(div);
1224
+ val = child.offsetHeight + 18 > div.scrollHeight; //div.scrollHeight should be child.offsetHeight + 20 because of the 10px of padding on each side, but some browsers ignore one side. We allow a 2px margin of error.
1225
+
1226
+ parent.removeChild(div);
1227
+ return val;
1228
+ }();
1229
+
1230
+ _touchEventLookup = function (types) {
1231
+ //we create an object that makes it easy to translate touch event types into their "pointer" counterparts if we're in a browser that uses those instead. Like IE10 uses "MSPointerDown" instead of "touchstart", for example.
1232
+ var standard = types.split(","),
1233
+ converted = ("onpointerdown" in _tempDiv ? "pointerdown,pointermove,pointerup,pointercancel" : "onmspointerdown" in _tempDiv ? "MSPointerDown,MSPointerMove,MSPointerUp,MSPointerCancel" : types).split(","),
1234
+ obj = {},
1235
+ i = 4;
1236
+
1237
+ while (--i > -1) {
1238
+ obj[standard[i]] = converted[i];
1239
+ obj[converted[i]] = standard[i];
1240
+ } //to avoid problems in iOS 9, test to see if the browser supports the "passive" option on addEventListener().
1241
+
1242
+
1243
+ try {
1244
+ _docElement.addEventListener("test", null, Object.defineProperty({}, "passive", {
1245
+ get: function get() {
1246
+ _supportsPassive = 1;
1247
+ }
1248
+ }));
1249
+ } catch (e) {}
1250
+
1251
+ return obj;
1252
+ }("touchstart,touchmove,touchend,touchcancel");
1253
+
1254
+ _addListener(_doc, "touchcancel", _emptyFunc); //some older Android devices intermittently stop dispatching "touchmove" events if we don't listen for "touchcancel" on the document. Very strange indeed.
1255
+
1256
+
1257
+ _addListener(_win, "touchmove", _emptyFunc); //works around Safari bugs that still allow the page to scroll even when we preventDefault() on the touchmove event.
1258
+
1259
+
1260
+ _body && _body.addEventListener("touchstart", _emptyFunc); //works around Safari bug: https://gsap.com/forums/topic/21450-draggable-in-iframe-on-mobile-is-buggy/
1261
+
1262
+ _addListener(_doc, "contextmenu", function () {
1263
+ for (var p in _lookup) {
1264
+ if (_lookup[p].isPressed) {
1265
+ _lookup[p].endDrag();
1266
+ }
1267
+ }
1268
+ });
1269
+
1270
+ gsap = _coreInitted = _getGSAP();
1271
+ }
1272
+
1273
+ if (gsap) {
1274
+ InertiaPlugin = gsap.plugins.inertia;
1275
+
1276
+ _context = gsap.core.context || function () {};
1277
+
1278
+ _checkPrefix = gsap.utils.checkPrefix;
1279
+ _transformProp = _checkPrefix(_transformProp);
1280
+ _transformOriginProp = _checkPrefix(_transformOriginProp);
1281
+ _toArray = gsap.utils.toArray;
1282
+ _getStyleSaver = gsap.core.getStyleSaver;
1283
+ _supports3D = !!_checkPrefix("perspective");
1284
+ } else if (required) {
1285
+ console.warn("Please gsap.registerPlugin(Draggable)");
1286
+ }
1287
+ };
1288
+
1289
+ var EventDispatcher = /*#__PURE__*/function () {
1290
+ function EventDispatcher(target) {
1291
+ this._listeners = {};
1292
+ this.target = target || this;
1293
+ }
1294
+
1295
+ var _proto = EventDispatcher.prototype;
1296
+
1297
+ _proto.addEventListener = function addEventListener(type, callback) {
1298
+ var list = this._listeners[type] || (this._listeners[type] = []);
1299
+
1300
+ if (!~list.indexOf(callback)) {
1301
+ list.push(callback);
1302
+ }
1303
+ };
1304
+
1305
+ _proto.removeEventListener = function removeEventListener(type, callback) {
1306
+ var list = this._listeners[type],
1307
+ i = list && list.indexOf(callback);
1308
+ i >= 0 && list.splice(i, 1);
1309
+ };
1310
+
1311
+ _proto.dispatchEvent = function dispatchEvent(type) {
1312
+ var _this = this;
1313
+
1314
+ var result;
1315
+ (this._listeners[type] || []).forEach(function (callback) {
1316
+ return callback.call(_this, {
1317
+ type: type,
1318
+ target: _this.target
1319
+ }) === false && (result = false);
1320
+ });
1321
+ return result; //if any of the callbacks return false, pass that along.
1322
+ };
1323
+
1324
+ return EventDispatcher;
1325
+ }();
1326
+
1327
+ var Draggable = /*#__PURE__*/function (_EventDispatcher) {
1328
+ _inheritsLoose(Draggable, _EventDispatcher);
1329
+
1330
+ function Draggable(target, vars) {
1331
+ var _this2;
1332
+
1333
+ _this2 = _EventDispatcher.call(this) || this;
1334
+ _coreInitted || _initCore(1);
1335
+ target = _toArray(target)[0]; //in case the target is a selector object or selector text
1336
+
1337
+ _this2.styles = _getStyleSaver && _getStyleSaver(target, "transform,left,top");
1338
+
1339
+ if (!InertiaPlugin) {
1340
+ InertiaPlugin = gsap.plugins.inertia;
1341
+ }
1342
+
1343
+ _this2.vars = vars = _copy(vars || {});
1344
+ _this2.target = target;
1345
+ _this2.x = _this2.y = _this2.rotation = 0;
1346
+ _this2.dragResistance = parseFloat(vars.dragResistance) || 0;
1347
+ _this2.edgeResistance = isNaN(vars.edgeResistance) ? 1 : parseFloat(vars.edgeResistance) || 0;
1348
+ _this2.lockAxis = vars.lockAxis;
1349
+ _this2.autoScroll = vars.autoScroll || 0;
1350
+ _this2.lockedAxis = null;
1351
+ _this2.allowEventDefault = !!vars.allowEventDefault;
1352
+ gsap.getProperty(target, "x"); // to ensure that transforms are instantiated.
1353
+
1354
+ var type = (vars.type || "x,y").toLowerCase(),
1355
+ xyMode = ~type.indexOf("x") || ~type.indexOf("y"),
1356
+ rotationMode = type.indexOf("rotation") !== -1,
1357
+ xProp = rotationMode ? "rotation" : xyMode ? "x" : "left",
1358
+ yProp = xyMode ? "y" : "top",
1359
+ allowX = !!(~type.indexOf("x") || ~type.indexOf("left") || type === "scroll"),
1360
+ allowY = !!(~type.indexOf("y") || ~type.indexOf("top") || type === "scroll"),
1361
+ minimumMovement = vars.minimumMovement || 2,
1362
+ self = _assertThisInitialized(_this2),
1363
+ triggers = _toArray(vars.trigger || vars.handle || target),
1364
+ killProps = {},
1365
+ dragEndTime = 0,
1366
+ checkAutoScrollBounds = false,
1367
+ autoScrollMarginTop = vars.autoScrollMarginTop || 40,
1368
+ autoScrollMarginRight = vars.autoScrollMarginRight || 40,
1369
+ autoScrollMarginBottom = vars.autoScrollMarginBottom || 40,
1370
+ autoScrollMarginLeft = vars.autoScrollMarginLeft || 40,
1371
+ isClickable = vars.clickableTest || _isClickable,
1372
+ clickTime = 0,
1373
+ gsCache = target._gsap || gsap.core.getCache(target),
1374
+ isFixed = _isFixed(target),
1375
+ getPropAsNum = function getPropAsNum(property, unit) {
1376
+ return parseFloat(gsCache.get(target, property, unit));
1377
+ },
1378
+ ownerDoc = target.ownerDocument || _doc,
1379
+ enabled,
1380
+ scrollProxy,
1381
+ startPointerX,
1382
+ startPointerY,
1383
+ startElementX,
1384
+ startElementY,
1385
+ hasBounds,
1386
+ hasDragCallback,
1387
+ hasMoveCallback,
1388
+ maxX,
1389
+ minX,
1390
+ maxY,
1391
+ minY,
1392
+ touch,
1393
+ touchID,
1394
+ rotationOrigin,
1395
+ dirty,
1396
+ old,
1397
+ snapX,
1398
+ snapY,
1399
+ snapXY,
1400
+ isClicking,
1401
+ touchEventTarget,
1402
+ matrix,
1403
+ interrupted,
1404
+ allowNativeTouchScrolling,
1405
+ touchDragAxis,
1406
+ isDispatching,
1407
+ clickDispatch,
1408
+ trustedClickDispatch,
1409
+ isPreventingDefault,
1410
+ innerMatrix,
1411
+ dragged,
1412
+ onContextMenu = function onContextMenu(e) {
1413
+ //used to prevent long-touch from triggering a context menu.
1414
+ // (self.isPressed && e.which < 2) && self.endDrag() // previously ended drag when context menu was triggered, but instead we should just stop propagation and prevent the default event behavior.
1415
+ _preventDefault(e);
1416
+
1417
+ e.stopImmediatePropagation && e.stopImmediatePropagation();
1418
+ return false;
1419
+ },
1420
+ //this method gets called on every tick of TweenLite.ticker which allows us to synchronize the renders to the core engine (which is typically synchronized with the display refresh via requestAnimationFrame). This is an optimization - it's better than applying the values inside the "mousemove" or "touchmove" event handler which may get called many times inbetween refreshes.
1421
+ render = function render(suppressEvents) {
1422
+ if (self.autoScroll && self.isDragging && (checkAutoScrollBounds || dirty)) {
1423
+ var e = target,
1424
+ autoScrollFactor = self.autoScroll * 15,
1425
+ //multiplying by 15 just gives us a better "feel" speed-wise.
1426
+ parent,
1427
+ isRoot,
1428
+ rect,
1429
+ pointerX,
1430
+ pointerY,
1431
+ changeX,
1432
+ changeY,
1433
+ gap;
1434
+ checkAutoScrollBounds = false;
1435
+ _windowProxy.scrollTop = _win.pageYOffset != null ? _win.pageYOffset : ownerDoc.documentElement.scrollTop != null ? ownerDoc.documentElement.scrollTop : ownerDoc.body.scrollTop;
1436
+ _windowProxy.scrollLeft = _win.pageXOffset != null ? _win.pageXOffset : ownerDoc.documentElement.scrollLeft != null ? ownerDoc.documentElement.scrollLeft : ownerDoc.body.scrollLeft;
1437
+ pointerX = self.pointerX - _windowProxy.scrollLeft;
1438
+ pointerY = self.pointerY - _windowProxy.scrollTop;
1439
+
1440
+ while (e && !isRoot) {
1441
+ //walk up the chain and sense wherever the pointer is within 40px of an edge that's scrollable.
1442
+ isRoot = _isRoot(e.parentNode);
1443
+ parent = isRoot ? _windowProxy : e.parentNode;
1444
+ rect = isRoot ? {
1445
+ bottom: Math.max(_docElement.clientHeight, _win.innerHeight || 0),
1446
+ right: Math.max(_docElement.clientWidth, _win.innerWidth || 0),
1447
+ left: 0,
1448
+ top: 0
1449
+ } : parent.getBoundingClientRect();
1450
+ changeX = changeY = 0;
1451
+
1452
+ if (allowY) {
1453
+ gap = parent._gsMaxScrollY - parent.scrollTop;
1454
+
1455
+ if (gap < 0) {
1456
+ changeY = gap;
1457
+ } else if (pointerY > rect.bottom - autoScrollMarginBottom && gap) {
1458
+ checkAutoScrollBounds = true;
1459
+ changeY = Math.min(gap, autoScrollFactor * (1 - Math.max(0, rect.bottom - pointerY) / autoScrollMarginBottom) | 0);
1460
+ } else if (pointerY < rect.top + autoScrollMarginTop && parent.scrollTop) {
1461
+ checkAutoScrollBounds = true;
1462
+ changeY = -Math.min(parent.scrollTop, autoScrollFactor * (1 - Math.max(0, pointerY - rect.top) / autoScrollMarginTop) | 0);
1463
+ }
1464
+
1465
+ if (changeY) {
1466
+ parent.scrollTop += changeY;
1467
+ }
1468
+ }
1469
+
1470
+ if (allowX) {
1471
+ gap = parent._gsMaxScrollX - parent.scrollLeft;
1472
+
1473
+ if (gap < 0) {
1474
+ changeX = gap;
1475
+ } else if (pointerX > rect.right - autoScrollMarginRight && gap) {
1476
+ checkAutoScrollBounds = true;
1477
+ changeX = Math.min(gap, autoScrollFactor * (1 - Math.max(0, rect.right - pointerX) / autoScrollMarginRight) | 0);
1478
+ } else if (pointerX < rect.left + autoScrollMarginLeft && parent.scrollLeft) {
1479
+ checkAutoScrollBounds = true;
1480
+ changeX = -Math.min(parent.scrollLeft, autoScrollFactor * (1 - Math.max(0, pointerX - rect.left) / autoScrollMarginLeft) | 0);
1481
+ }
1482
+
1483
+ if (changeX) {
1484
+ parent.scrollLeft += changeX;
1485
+ }
1486
+ }
1487
+
1488
+ if (isRoot && (changeX || changeY)) {
1489
+ _win.scrollTo(parent.scrollLeft, parent.scrollTop);
1490
+
1491
+ setPointerPosition(self.pointerX + changeX, self.pointerY + changeY);
1492
+ }
1493
+
1494
+ e = parent;
1495
+ }
1496
+ }
1497
+
1498
+ if (dirty) {
1499
+ var x = self.x,
1500
+ y = self.y;
1501
+
1502
+ if (rotationMode) {
1503
+ self.deltaX = x - parseFloat(gsCache.rotation);
1504
+ self.rotation = x;
1505
+ gsCache.rotation = x + "deg";
1506
+ gsCache.renderTransform(1, gsCache);
1507
+ } else {
1508
+ if (scrollProxy) {
1509
+ if (allowY) {
1510
+ self.deltaY = y - scrollProxy.top();
1511
+ scrollProxy.top(y);
1512
+ }
1513
+
1514
+ if (allowX) {
1515
+ self.deltaX = x - scrollProxy.left();
1516
+ scrollProxy.left(x);
1517
+ }
1518
+ } else if (xyMode) {
1519
+ if (allowY) {
1520
+ self.deltaY = y - parseFloat(gsCache.y);
1521
+ gsCache.y = y + "px";
1522
+ }
1523
+
1524
+ if (allowX) {
1525
+ self.deltaX = x - parseFloat(gsCache.x);
1526
+ gsCache.x = x + "px";
1527
+ }
1528
+
1529
+ gsCache.renderTransform(1, gsCache);
1530
+ } else {
1531
+ if (allowY) {
1532
+ self.deltaY = y - parseFloat(target.style.top || 0);
1533
+ target.style.top = y + "px";
1534
+ }
1535
+
1536
+ if (allowX) {
1537
+ self.deltaX = x - parseFloat(target.style.left || 0);
1538
+ target.style.left = x + "px";
1539
+ }
1540
+ }
1541
+ }
1542
+
1543
+ if (hasDragCallback && !suppressEvents && !isDispatching) {
1544
+ isDispatching = true; //in case onDrag has an update() call (avoid endless loop)
1545
+
1546
+ if (_dispatchEvent(self, "drag", "onDrag") === false) {
1547
+ if (allowX) {
1548
+ self.x -= self.deltaX;
1549
+ }
1550
+
1551
+ if (allowY) {
1552
+ self.y -= self.deltaY;
1553
+ }
1554
+
1555
+ render(true);
1556
+ }
1557
+
1558
+ isDispatching = false;
1559
+ }
1560
+ }
1561
+
1562
+ dirty = false;
1563
+ },
1564
+ //copies the x/y from the element (whether that be transforms, top/left, or ScrollProxy's top/left) to the Draggable's x and y (and rotation if necessary) properties so that they reflect reality and it also (optionally) applies any snapping necessary. This is used by the InertiaPlugin tween in an onUpdate to ensure things are synced and snapped.
1565
+ syncXY = function syncXY(skipOnUpdate, skipSnap) {
1566
+ var x = self.x,
1567
+ y = self.y,
1568
+ snappedValue,
1569
+ cs;
1570
+
1571
+ if (!target._gsap) {
1572
+ //just in case the _gsap cache got wiped, like if the user called clearProps on the transform or something (very rare).
1573
+ gsCache = gsap.core.getCache(target);
1574
+ }
1575
+
1576
+ gsCache.uncache && gsap.getProperty(target, "x"); // trigger a re-cache
1577
+
1578
+ if (xyMode) {
1579
+ self.x = parseFloat(gsCache.x);
1580
+ self.y = parseFloat(gsCache.y);
1581
+ } else if (rotationMode) {
1582
+ self.x = self.rotation = parseFloat(gsCache.rotation);
1583
+ } else if (scrollProxy) {
1584
+ self.y = scrollProxy.top();
1585
+ self.x = scrollProxy.left();
1586
+ } else {
1587
+ self.y = parseFloat(target.style.top || (cs = _getComputedStyle(target)) && cs.top) || 0;
1588
+ self.x = parseFloat(target.style.left || (cs || {}).left) || 0;
1589
+ }
1590
+
1591
+ if ((snapX || snapY || snapXY) && !skipSnap && (self.isDragging || self.isThrowing)) {
1592
+ if (snapXY) {
1593
+ _temp1.x = self.x;
1594
+ _temp1.y = self.y;
1595
+ snappedValue = snapXY(_temp1);
1596
+
1597
+ if (snappedValue.x !== self.x) {
1598
+ self.x = snappedValue.x;
1599
+ dirty = true;
1600
+ }
1601
+
1602
+ if (snappedValue.y !== self.y) {
1603
+ self.y = snappedValue.y;
1604
+ dirty = true;
1605
+ }
1606
+ }
1607
+
1608
+ if (snapX) {
1609
+ snappedValue = snapX(self.x);
1610
+
1611
+ if (snappedValue !== self.x) {
1612
+ self.x = snappedValue;
1613
+
1614
+ if (rotationMode) {
1615
+ self.rotation = snappedValue;
1616
+ }
1617
+
1618
+ dirty = true;
1619
+ }
1620
+ }
1621
+
1622
+ if (snapY) {
1623
+ snappedValue = snapY(self.y);
1624
+
1625
+ if (snappedValue !== self.y) {
1626
+ self.y = snappedValue;
1627
+ }
1628
+
1629
+ dirty = true;
1630
+ }
1631
+ }
1632
+
1633
+ dirty && render(true);
1634
+
1635
+ if (!skipOnUpdate) {
1636
+ self.deltaX = self.x - x;
1637
+ self.deltaY = self.y - y;
1638
+
1639
+ _dispatchEvent(self, "throwupdate", "onThrowUpdate");
1640
+ }
1641
+ },
1642
+ buildSnapFunc = function buildSnapFunc(snap, min, max, factor) {
1643
+ if (min == null) {
1644
+ min = -_bigNum;
1645
+ }
1646
+
1647
+ if (max == null) {
1648
+ max = _bigNum;
1649
+ }
1650
+
1651
+ if (_isFunction(snap)) {
1652
+ return function (n) {
1653
+ var edgeTolerance = !self.isPressed ? 1 : 1 - self.edgeResistance; //if we're tweening, disable the edgeTolerance because it's already factored into the tweening values (we don't want to apply it multiple times)
1654
+
1655
+ return snap.call(self, (n > max ? max + (n - max) * edgeTolerance : n < min ? min + (n - min) * edgeTolerance : n) * factor) * factor;
1656
+ };
1657
+ }
1658
+
1659
+ if (_isArray(snap)) {
1660
+ return function (n) {
1661
+ var i = snap.length,
1662
+ closest = 0,
1663
+ absDif = _bigNum,
1664
+ val,
1665
+ dif;
1666
+
1667
+ while (--i > -1) {
1668
+ val = snap[i];
1669
+ dif = val - n;
1670
+
1671
+ if (dif < 0) {
1672
+ dif = -dif;
1673
+ }
1674
+
1675
+ if (dif < absDif && val >= min && val <= max) {
1676
+ closest = i;
1677
+ absDif = dif;
1678
+ }
1679
+ }
1680
+
1681
+ return snap[closest];
1682
+ };
1683
+ }
1684
+
1685
+ return isNaN(snap) ? function (n) {
1686
+ return n;
1687
+ } : function () {
1688
+ return snap * factor;
1689
+ };
1690
+ },
1691
+ buildPointSnapFunc = function buildPointSnapFunc(snap, minX, maxX, minY, maxY, radius, factor) {
1692
+ radius = radius && radius < _bigNum ? radius * radius : _bigNum; //so we don't have to Math.sqrt() in the functions. Performance optimization.
1693
+
1694
+ if (_isFunction(snap)) {
1695
+ return function (point) {
1696
+ var edgeTolerance = !self.isPressed ? 1 : 1 - self.edgeResistance,
1697
+ x = point.x,
1698
+ y = point.y,
1699
+ result,
1700
+ dx,
1701
+ dy; //if we're tweening, disable the edgeTolerance because it's already factored into the tweening values (we don't want to apply it multiple times)
1702
+
1703
+ point.x = x = x > maxX ? maxX + (x - maxX) * edgeTolerance : x < minX ? minX + (x - minX) * edgeTolerance : x;
1704
+ point.y = y = y > maxY ? maxY + (y - maxY) * edgeTolerance : y < minY ? minY + (y - minY) * edgeTolerance : y;
1705
+ result = snap.call(self, point);
1706
+
1707
+ if (result !== point) {
1708
+ point.x = result.x;
1709
+ point.y = result.y;
1710
+ }
1711
+
1712
+ if (factor !== 1) {
1713
+ point.x *= factor;
1714
+ point.y *= factor;
1715
+ }
1716
+
1717
+ if (radius < _bigNum) {
1718
+ dx = point.x - x;
1719
+ dy = point.y - y;
1720
+
1721
+ if (dx * dx + dy * dy > radius) {
1722
+ point.x = x;
1723
+ point.y = y;
1724
+ }
1725
+ }
1726
+
1727
+ return point;
1728
+ };
1729
+ }
1730
+
1731
+ if (_isArray(snap)) {
1732
+ return function (p) {
1733
+ var i = snap.length,
1734
+ closest = 0,
1735
+ minDist = _bigNum,
1736
+ x,
1737
+ y,
1738
+ point,
1739
+ dist;
1740
+
1741
+ while (--i > -1) {
1742
+ point = snap[i];
1743
+ x = point.x - p.x;
1744
+ y = point.y - p.y;
1745
+ dist = x * x + y * y;
1746
+
1747
+ if (dist < minDist) {
1748
+ closest = i;
1749
+ minDist = dist;
1750
+ }
1751
+ }
1752
+
1753
+ return minDist <= radius ? snap[closest] : p;
1754
+ };
1755
+ }
1756
+
1757
+ return function (n) {
1758
+ return n;
1759
+ };
1760
+ },
1761
+ calculateBounds = function calculateBounds() {
1762
+ var bounds, targetBounds, snap, snapIsRaw;
1763
+ hasBounds = false;
1764
+
1765
+ if (scrollProxy) {
1766
+ scrollProxy.calibrate();
1767
+ self.minX = minX = -scrollProxy.maxScrollLeft();
1768
+ self.minY = minY = -scrollProxy.maxScrollTop();
1769
+ self.maxX = maxX = self.maxY = maxY = 0;
1770
+ hasBounds = true;
1771
+ } else if (!!vars.bounds) {
1772
+ bounds = _getBounds(vars.bounds, target.parentNode); //could be a selector/jQuery object or a DOM element or a generic object like {top:0, left:100, width:1000, height:800} or {minX:100, maxX:1100, minY:0, maxY:800}
1773
+
1774
+ if (rotationMode) {
1775
+ self.minX = minX = bounds.left;
1776
+ self.maxX = maxX = bounds.left + bounds.width;
1777
+ self.minY = minY = self.maxY = maxY = 0;
1778
+ } else if (!_isUndefined(vars.bounds.maxX) || !_isUndefined(vars.bounds.maxY)) {
1779
+ bounds = vars.bounds;
1780
+ self.minX = minX = bounds.minX;
1781
+ self.minY = minY = bounds.minY;
1782
+ self.maxX = maxX = bounds.maxX;
1783
+ self.maxY = maxY = bounds.maxY;
1784
+ } else {
1785
+ targetBounds = _getBounds(target, target.parentNode);
1786
+ self.minX = minX = Math.round(getPropAsNum(xProp, "px") + bounds.left - targetBounds.left);
1787
+ self.minY = minY = Math.round(getPropAsNum(yProp, "px") + bounds.top - targetBounds.top);
1788
+ self.maxX = maxX = Math.round(minX + (bounds.width - targetBounds.width));
1789
+ self.maxY = maxY = Math.round(minY + (bounds.height - targetBounds.height));
1790
+ }
1791
+
1792
+ if (minX > maxX) {
1793
+ self.minX = maxX;
1794
+ self.maxX = maxX = minX;
1795
+ minX = self.minX;
1796
+ }
1797
+
1798
+ if (minY > maxY) {
1799
+ self.minY = maxY;
1800
+ self.maxY = maxY = minY;
1801
+ minY = self.minY;
1802
+ }
1803
+
1804
+ if (rotationMode) {
1805
+ self.minRotation = minX;
1806
+ self.maxRotation = maxX;
1807
+ }
1808
+
1809
+ hasBounds = true;
1810
+ }
1811
+
1812
+ if (vars.liveSnap) {
1813
+ snap = vars.liveSnap === true ? vars.snap || {} : vars.liveSnap;
1814
+ snapIsRaw = _isArray(snap) || _isFunction(snap);
1815
+
1816
+ if (rotationMode) {
1817
+ snapX = buildSnapFunc(snapIsRaw ? snap : snap.rotation, minX, maxX, 1);
1818
+ snapY = null;
1819
+ } else {
1820
+ if (snap.points) {
1821
+ snapXY = buildPointSnapFunc(snapIsRaw ? snap : snap.points, minX, maxX, minY, maxY, snap.radius, scrollProxy ? -1 : 1);
1822
+ } else {
1823
+ if (allowX) {
1824
+ snapX = buildSnapFunc(snapIsRaw ? snap : snap.x || snap.left || snap.scrollLeft, minX, maxX, scrollProxy ? -1 : 1);
1825
+ }
1826
+
1827
+ if (allowY) {
1828
+ snapY = buildSnapFunc(snapIsRaw ? snap : snap.y || snap.top || snap.scrollTop, minY, maxY, scrollProxy ? -1 : 1);
1829
+ }
1830
+ }
1831
+ }
1832
+ }
1833
+ },
1834
+ onThrowComplete = function onThrowComplete() {
1835
+ self.isThrowing = false;
1836
+
1837
+ _dispatchEvent(self, "throwcomplete", "onThrowComplete");
1838
+ },
1839
+ onThrowInterrupt = function onThrowInterrupt() {
1840
+ self.isThrowing = false;
1841
+ },
1842
+ animate = function animate(inertia, forceZeroVelocity) {
1843
+ var snap, snapIsRaw, tween, overshootTolerance;
1844
+
1845
+ if (inertia && InertiaPlugin) {
1846
+ if (inertia === true) {
1847
+ snap = vars.snap || vars.liveSnap || {};
1848
+ snapIsRaw = _isArray(snap) || _isFunction(snap);
1849
+ inertia = {
1850
+ resistance: (vars.throwResistance || vars.resistance || 1000) / (rotationMode ? 10 : 1)
1851
+ };
1852
+
1853
+ if (rotationMode) {
1854
+ inertia.rotation = _parseInertia(self, snapIsRaw ? snap : snap.rotation, maxX, minX, 1, forceZeroVelocity);
1855
+ } else {
1856
+ if (allowX) {
1857
+ inertia[xProp] = _parseInertia(self, snapIsRaw ? snap : snap.points || snap.x || snap.left, maxX, minX, scrollProxy ? -1 : 1, forceZeroVelocity || self.lockedAxis === "x");
1858
+ }
1859
+
1860
+ if (allowY) {
1861
+ inertia[yProp] = _parseInertia(self, snapIsRaw ? snap : snap.points || snap.y || snap.top, maxY, minY, scrollProxy ? -1 : 1, forceZeroVelocity || self.lockedAxis === "y");
1862
+ }
1863
+
1864
+ if (snap.points || _isArray(snap) && _isObject(snap[0])) {
1865
+ inertia.linkedProps = xProp + "," + yProp;
1866
+ inertia.radius = snap.radius; //note: we also disable liveSnapping while throwing if there's a "radius" defined, otherwise it looks weird to have the item thrown past a snapping point but live-snapping mid-tween. We do this by altering the onUpdateParams so that "skipSnap" parameter is true for syncXY.
1867
+ }
1868
+ }
1869
+ }
1870
+
1871
+ self.isThrowing = true;
1872
+ overshootTolerance = !isNaN(vars.overshootTolerance) ? vars.overshootTolerance : vars.edgeResistance === 1 ? 0 : 1 - self.edgeResistance + 0.2;
1873
+
1874
+ if (!inertia.duration) {
1875
+ inertia.duration = {
1876
+ max: Math.max(vars.minDuration || 0, "maxDuration" in vars ? vars.maxDuration : 2),
1877
+ min: !isNaN(vars.minDuration) ? vars.minDuration : overshootTolerance === 0 || _isObject(inertia) && inertia.resistance > 1000 ? 0 : 0.5,
1878
+ overshoot: overshootTolerance
1879
+ };
1880
+ }
1881
+
1882
+ self.tween = tween = gsap.to(scrollProxy || target, {
1883
+ inertia: inertia,
1884
+ data: "_draggable",
1885
+ inherit: false,
1886
+ onComplete: onThrowComplete,
1887
+ onInterrupt: onThrowInterrupt,
1888
+ onUpdate: vars.fastMode ? _dispatchEvent : syncXY,
1889
+ onUpdateParams: vars.fastMode ? [self, "onthrowupdate", "onThrowUpdate"] : snap && snap.radius ? [false, true] : []
1890
+ });
1891
+
1892
+ if (!vars.fastMode) {
1893
+ if (scrollProxy) {
1894
+ scrollProxy._skip = true; // Microsoft browsers have a bug that causes them to briefly render the position incorrectly (it flashes to the end state when we seek() the tween even though we jump right back to the current position, and this only seems to happen when we're affecting both top and left), so we set a _suspendTransforms flag to prevent it from actually applying the values in the ScrollProxy.
1895
+ }
1896
+
1897
+ tween.render(1e9, true, true); // force to the end. Remember, the duration will likely change upon initting because that's when InertiaPlugin calculates it.
1898
+
1899
+ syncXY(true, true);
1900
+ self.endX = self.x;
1901
+ self.endY = self.y;
1902
+
1903
+ if (rotationMode) {
1904
+ self.endRotation = self.x;
1905
+ }
1906
+
1907
+ tween.play(0);
1908
+ syncXY(true, true);
1909
+
1910
+ if (scrollProxy) {
1911
+ scrollProxy._skip = false; //Microsoft browsers have a bug that causes them to briefly render the position incorrectly (it flashes to the end state when we seek() the tween even though we jump right back to the current position, and this only seems to happen when we're affecting both top and left), so we set a _suspendTransforms flag to prevent it from actually applying the values in the ScrollProxy.
1912
+ }
1913
+ }
1914
+ } else if (hasBounds) {
1915
+ self.applyBounds();
1916
+ }
1917
+ },
1918
+ updateMatrix = function updateMatrix(shiftStart) {
1919
+ var start = matrix,
1920
+ p;
1921
+ matrix = getGlobalMatrix(target.parentNode, true);
1922
+
1923
+ if (shiftStart && self.isPressed && !matrix.equals(start || new Matrix2D())) {
1924
+ //if the matrix changes WHILE the element is pressed, we must adjust the startPointerX and startPointerY accordingly, so we invert the original matrix and figure out where the pointerX and pointerY were in the global space, then apply the new matrix to get the updated coordinates.
1925
+ p = start.inverse().apply({
1926
+ x: startPointerX,
1927
+ y: startPointerY
1928
+ });
1929
+ matrix.apply(p, p);
1930
+ startPointerX = p.x;
1931
+ startPointerY = p.y;
1932
+ }
1933
+
1934
+ if (matrix.equals(_identityMatrix)) {
1935
+ //if there are no transforms, we can optimize performance by not factoring in the matrix
1936
+ matrix = null;
1937
+ }
1938
+ },
1939
+ recordStartPositions = function recordStartPositions() {
1940
+ var edgeTolerance = 1 - self.edgeResistance,
1941
+ offsetX = isFixed ? _getDocScrollLeft(ownerDoc) : 0,
1942
+ offsetY = isFixed ? _getDocScrollTop(ownerDoc) : 0,
1943
+ parsedOrigin,
1944
+ x,
1945
+ y;
1946
+
1947
+ if (xyMode) {
1948
+ // in case the user set it as a different unit, like animating the x to "100%". We must convert it back to px!
1949
+ gsCache.x = getPropAsNum(xProp, "px") + "px";
1950
+ gsCache.y = getPropAsNum(yProp, "px") + "px";
1951
+ gsCache.renderTransform();
1952
+ }
1953
+
1954
+ updateMatrix(false);
1955
+ _point1.x = self.pointerX - offsetX;
1956
+ _point1.y = self.pointerY - offsetY;
1957
+ matrix && matrix.apply(_point1, _point1);
1958
+ startPointerX = _point1.x; //translate to local coordinate system
1959
+
1960
+ startPointerY = _point1.y;
1961
+
1962
+ if (dirty) {
1963
+ setPointerPosition(self.pointerX, self.pointerY);
1964
+ render(true);
1965
+ }
1966
+
1967
+ innerMatrix = getGlobalMatrix(target);
1968
+
1969
+ if (scrollProxy) {
1970
+ calculateBounds();
1971
+ startElementY = scrollProxy.top();
1972
+ startElementX = scrollProxy.left();
1973
+ } else {
1974
+ //if the element is in the process of tweening, don't force snapping to occur because it could make it jump. Imagine the user throwing, then before it's done, clicking on the element in its inbetween state.
1975
+ if (isTweening()) {
1976
+ syncXY(true, true);
1977
+ calculateBounds();
1978
+ } else {
1979
+ self.applyBounds();
1980
+ }
1981
+
1982
+ if (rotationMode) {
1983
+ parsedOrigin = target.ownerSVGElement ? [gsCache.xOrigin - target.getBBox().x, gsCache.yOrigin - target.getBBox().y] : (_getComputedStyle(target)[_transformOriginProp] || "0 0").split(" ");
1984
+ rotationOrigin = self.rotationOrigin = getGlobalMatrix(target).apply({
1985
+ x: parseFloat(parsedOrigin[0]) || 0,
1986
+ y: parseFloat(parsedOrigin[1]) || 0
1987
+ });
1988
+ syncXY(true, true);
1989
+ x = self.pointerX - rotationOrigin.x - offsetX;
1990
+ y = rotationOrigin.y - self.pointerY + offsetY;
1991
+ startElementX = self.x; //starting rotation (x always refers to rotation in type:"rotation", measured in degrees)
1992
+
1993
+ startElementY = self.y = Math.atan2(y, x) * _RAD2DEG;
1994
+ } else {
1995
+ //parent = !isFixed && target.parentNode;
1996
+ //startScrollTop = parent ? parent.scrollTop || 0 : 0;
1997
+ //startScrollLeft = parent ? parent.scrollLeft || 0 : 0;
1998
+ startElementY = getPropAsNum(yProp, "px"); //record the starting top and left values so that we can just add the mouse's movement to them later.
1999
+
2000
+ startElementX = getPropAsNum(xProp, "px");
2001
+ }
2002
+ }
2003
+
2004
+ if (hasBounds && edgeTolerance) {
2005
+ if (startElementX > maxX) {
2006
+ startElementX = maxX + (startElementX - maxX) / edgeTolerance;
2007
+ } else if (startElementX < minX) {
2008
+ startElementX = minX - (minX - startElementX) / edgeTolerance;
2009
+ }
2010
+
2011
+ if (!rotationMode) {
2012
+ if (startElementY > maxY) {
2013
+ startElementY = maxY + (startElementY - maxY) / edgeTolerance;
2014
+ } else if (startElementY < minY) {
2015
+ startElementY = minY - (minY - startElementY) / edgeTolerance;
2016
+ }
2017
+ }
2018
+ }
2019
+
2020
+ self.startX = startElementX = _round(startElementX);
2021
+ self.startY = startElementY = _round(startElementY);
2022
+ },
2023
+ isTweening = function isTweening() {
2024
+ return self.tween && self.tween.isActive();
2025
+ },
2026
+ removePlaceholder = function removePlaceholder() {
2027
+ if (_placeholderDiv.parentNode && !isTweening() && !self.isDragging) {
2028
+ //_placeholderDiv just props open auto-scrolling containers so they don't collapse as the user drags left/up. We remove it after dragging (and throwing, if necessary) finishes.
2029
+ _placeholderDiv.parentNode.removeChild(_placeholderDiv);
2030
+ }
2031
+ },
2032
+ //called when the mouse is pressed (or touch starts)
2033
+ onPress = function onPress(e, force) {
2034
+ var i;
2035
+
2036
+ if (!enabled || self.isPressed || !e || (e.type === "mousedown" || e.type === "pointerdown") && !force && _getTime() - clickTime < 30 && _touchEventLookup[self.pointerEvent.type]) {
2037
+ //when we DON'T preventDefault() in order to accommodate touch-scrolling and the user just taps, many browsers also fire a mousedown/mouseup sequence AFTER the touchstart/touchend sequence, thus it'd result in two quick "click" events being dispatched. This line senses that condition and halts it on the subsequent mousedown.
2038
+ isPreventingDefault && e && enabled && _preventDefault(e); // in some browsers, we must listen for multiple event types like touchstart, pointerdown, mousedown. The first time this function is called, we record whether or not we _preventDefault() so that on duplicate calls, we can do the same if necessary.
2039
+
2040
+ return;
2041
+ }
2042
+
2043
+ interrupted = isTweening();
2044
+ dragged = false; // we need to track whether or not it was dragged in this interaction so that if, for example, the user calls .endDrag() to FORCE it to stop and then they keep the mouse pressed down and eventually release, that would normally cause an onClick but we have to skip it in that case if there was dragging that occurred.
2045
+
2046
+ self.pointerEvent = e;
2047
+
2048
+ if (_touchEventLookup[e.type]) {
2049
+ //note: on iOS, BOTH touchmove and mousemove are dispatched, but the mousemove has pageY and pageX of 0 which would mess up the calculations and needlessly hurt performance.
2050
+ touchEventTarget = ~e.type.indexOf("touch") ? e.currentTarget || e.target : ownerDoc; //pointer-based touches (for Microsoft browsers) don't remain locked to the original target like other browsers, so we must use the document instead. The event type would be "MSPointerDown" or "pointerdown".
2051
+
2052
+ _addListener(touchEventTarget, "touchend", onRelease);
2053
+
2054
+ _addListener(touchEventTarget, "touchmove", onMove); // possible future change if PointerEvents are more standardized: https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture
2055
+
2056
+
2057
+ _addListener(touchEventTarget, "touchcancel", onRelease);
2058
+
2059
+ _addListener(ownerDoc, "touchstart", _onMultiTouchDocument);
2060
+ } else {
2061
+ touchEventTarget = null;
2062
+
2063
+ _addListener(ownerDoc, "mousemove", onMove); //attach these to the document instead of the box itself so that if the user's mouse moves too quickly (and off of the box), things still work.
2064
+
2065
+ }
2066
+
2067
+ touchDragAxis = null;
2068
+
2069
+ if (!_supportsPointer || !touchEventTarget) {
2070
+ _addListener(ownerDoc, "mouseup", onRelease);
2071
+
2072
+ e && e.target && _addListener(e.target, "mouseup", onRelease); //we also have to listen directly on the element because some browsers don't bubble up the event to the _doc on elements with contentEditable="true"
2073
+ }
2074
+
2075
+ isClicking = isClickable.call(self, e.target) && vars.dragClickables === false && !force;
2076
+
2077
+ if (isClicking) {
2078
+ _addListener(e.target, "change", onRelease); //in some browsers, when you mousedown on a <select> element, no mouseup gets dispatched! So we listen for a "change" event instead.
2079
+
2080
+
2081
+ _dispatchEvent(self, "pressInit", "onPressInit");
2082
+
2083
+ _dispatchEvent(self, "press", "onPress");
2084
+
2085
+ _setSelectable(triggers, true); //accommodates things like inputs and elements with contentEditable="true" (otherwise user couldn't drag to select text)
2086
+
2087
+
2088
+ isPreventingDefault = false;
2089
+ return;
2090
+ }
2091
+
2092
+ allowNativeTouchScrolling = !touchEventTarget || allowX === allowY || self.vars.allowNativeTouchScrolling === false || self.vars.allowContextMenu && e && (e.ctrlKey || e.which > 2) ? false : allowX ? "y" : "x"; //note: in Chrome, right-clicking (for a context menu) fires onPress and it doesn't have the event.which set properly, so we must look for event.ctrlKey. If the user wants to allow context menus we should of course sense it here and not allow native touch scrolling.
2093
+
2094
+ isPreventingDefault = !allowNativeTouchScrolling && !self.allowEventDefault;
2095
+
2096
+ if (isPreventingDefault) {
2097
+ _preventDefault(e);
2098
+
2099
+ _addListener(_win, "touchforcechange", _preventDefault); //works around safari bug: https://gsap.com/forums/topic/21450-draggable-in-iframe-on-mobile-is-buggy/
2100
+
2101
+ }
2102
+
2103
+ if (e.changedTouches) {
2104
+ //touch events store the data slightly differently
2105
+ e = touch = e.changedTouches[0];
2106
+ touchID = e.identifier;
2107
+ } else if (e.pointerId) {
2108
+ touchID = e.pointerId; //for some Microsoft browsers
2109
+ } else {
2110
+ touch = touchID = null;
2111
+ }
2112
+
2113
+ _dragCount++;
2114
+
2115
+ _addToRenderQueue(render); //causes the Draggable to render on each "tick" of gsap.ticker (performance optimization - updating values in a mousemove can cause them to happen too frequently, like multiple times between frame redraws which is wasteful, and it also prevents values from updating properly in IE8)
2116
+
2117
+
2118
+ startPointerY = self.pointerY = e.pageY; //record the starting x and y so that we can calculate the movement from the original in _onMouseMove
2119
+
2120
+ startPointerX = self.pointerX = e.pageX;
2121
+
2122
+ _dispatchEvent(self, "pressInit", "onPressInit");
2123
+
2124
+ if (allowNativeTouchScrolling || self.autoScroll) {
2125
+ _recordMaxScrolls(target.parentNode);
2126
+ }
2127
+
2128
+ if (target.parentNode && self.autoScroll && !scrollProxy && !rotationMode && target.parentNode._gsMaxScrollX && !_placeholderDiv.parentNode && !target.getBBox) {
2129
+ //add a placeholder div to prevent the parent container from collapsing when the user drags the element left.
2130
+ _placeholderDiv.style.width = target.parentNode.scrollWidth + "px";
2131
+ target.parentNode.appendChild(_placeholderDiv);
2132
+ }
2133
+
2134
+ recordStartPositions();
2135
+ self.tween && self.tween.kill();
2136
+ self.isThrowing = false;
2137
+ gsap.killTweensOf(scrollProxy || target, killProps, true); //in case the user tries to drag it before the last tween is done.
2138
+
2139
+ scrollProxy && gsap.killTweensOf(target, {
2140
+ scrollTo: 1
2141
+ }, true); //just in case the original target's scroll position is being tweened somewhere else.
2142
+
2143
+ self.tween = self.lockedAxis = null;
2144
+
2145
+ if (vars.zIndexBoost || !rotationMode && !scrollProxy && vars.zIndexBoost !== false) {
2146
+ target.style.zIndex = Draggable.zIndex++;
2147
+ }
2148
+
2149
+ self.isPressed = true;
2150
+ hasDragCallback = !!(vars.onDrag || self._listeners.drag);
2151
+ hasMoveCallback = !!(vars.onMove || self._listeners.move);
2152
+
2153
+ if (vars.cursor !== false || vars.activeCursor) {
2154
+ i = triggers.length;
2155
+
2156
+ while (--i > -1) {
2157
+ gsap.set(triggers[i], {
2158
+ cursor: vars.activeCursor || vars.cursor || (_defaultCursor === "grab" ? "grabbing" : _defaultCursor)
2159
+ });
2160
+ }
2161
+ }
2162
+
2163
+ _dispatchEvent(self, "press", "onPress");
2164
+ },
2165
+ //called every time the mouse/touch moves
2166
+ onMove = function onMove(e) {
2167
+ var originalEvent = e,
2168
+ touches,
2169
+ pointerX,
2170
+ pointerY,
2171
+ i,
2172
+ dx,
2173
+ dy;
2174
+
2175
+ if (!enabled || _isMultiTouching || !self.isPressed || !e) {
2176
+ isPreventingDefault && e && enabled && _preventDefault(e); // in some browsers, we must listen for multiple event types like touchmove, pointermove, mousemove. The first time this function is called, we record whether or not we _preventDefault() so that on duplicate calls, we can do the same if necessary.
2177
+
2178
+ return;
2179
+ }
2180
+
2181
+ self.pointerEvent = e;
2182
+ touches = e.changedTouches;
2183
+
2184
+ if (touches) {
2185
+ //touch events store the data slightly differently
2186
+ e = touches[0];
2187
+
2188
+ if (e !== touch && e.identifier !== touchID) {
2189
+ //Usually changedTouches[0] will be what we're looking for, but in case it's not, look through the rest of the array...(and Android browsers don't reuse the event like iOS)
2190
+ i = touches.length;
2191
+
2192
+ while (--i > -1 && (e = touches[i]).identifier !== touchID && e.target !== target) {} // Some Android devices dispatch a touchstart AND pointerdown initially, and then only pointermove thus the touchID may not match because it was grabbed from the touchstart event whereas the pointer event is the one that the browser dispatches for move, so if the event target matches this Draggable's target, let it through.
2193
+
2194
+
2195
+ if (i < 0) {
2196
+ return;
2197
+ }
2198
+ }
2199
+ } else if (e.pointerId && touchID && e.pointerId !== touchID) {
2200
+ //for some Microsoft browsers, we must attach the listener to the doc rather than the trigger so that when the finger moves outside the bounds of the trigger, things still work. So if the event we're receiving has a pointerId that doesn't match the touchID, ignore it (for multi-touch)
2201
+ return;
2202
+ }
2203
+
2204
+ if (touchEventTarget && allowNativeTouchScrolling && !touchDragAxis) {
2205
+ //Android browsers force us to decide on the first "touchmove" event if we should allow the default (scrolling) behavior or preventDefault(). Otherwise, a "touchcancel" will be fired and then no "touchmove" or "touchend" will fire during the scrolling (no good).
2206
+ _point1.x = e.pageX - (isFixed ? _getDocScrollLeft(ownerDoc) : 0);
2207
+ _point1.y = e.pageY - (isFixed ? _getDocScrollTop(ownerDoc) : 0);
2208
+ matrix && matrix.apply(_point1, _point1);
2209
+ pointerX = _point1.x;
2210
+ pointerY = _point1.y;
2211
+ dx = Math.abs(pointerX - startPointerX);
2212
+ dy = Math.abs(pointerY - startPointerY);
2213
+
2214
+ if (dx !== dy && (dx > minimumMovement || dy > minimumMovement) || _isAndroid && allowNativeTouchScrolling === touchDragAxis) {
2215
+ touchDragAxis = dx > dy && allowX ? "x" : "y";
2216
+
2217
+ if (allowNativeTouchScrolling && touchDragAxis !== allowNativeTouchScrolling) {
2218
+ _addListener(_win, "touchforcechange", _preventDefault); // prevents native touch scrolling from taking over if the user started dragging in the other direction in iOS Safari
2219
+
2220
+ }
2221
+
2222
+ if (self.vars.lockAxisOnTouchScroll !== false && allowX && allowY) {
2223
+ self.lockedAxis = touchDragAxis === "x" ? "y" : "x";
2224
+ _isFunction(self.vars.onLockAxis) && self.vars.onLockAxis.call(self, originalEvent);
2225
+ }
2226
+
2227
+ if (_isAndroid && allowNativeTouchScrolling === touchDragAxis) {
2228
+ onRelease(originalEvent);
2229
+ return;
2230
+ }
2231
+ }
2232
+ }
2233
+
2234
+ if (!self.allowEventDefault && (!allowNativeTouchScrolling || touchDragAxis && allowNativeTouchScrolling !== touchDragAxis) && originalEvent.cancelable !== false) {
2235
+ _preventDefault(originalEvent);
2236
+
2237
+ isPreventingDefault = true;
2238
+ } else if (isPreventingDefault) {
2239
+ isPreventingDefault = false;
2240
+ }
2241
+
2242
+ if (self.autoScroll) {
2243
+ checkAutoScrollBounds = true;
2244
+ }
2245
+
2246
+ setPointerPosition(e.pageX, e.pageY, hasMoveCallback);
2247
+ },
2248
+ setPointerPosition = function setPointerPosition(pointerX, pointerY, invokeOnMove) {
2249
+ var dragTolerance = 1 - self.dragResistance,
2250
+ edgeTolerance = 1 - self.edgeResistance,
2251
+ prevPointerX = self.pointerX,
2252
+ prevPointerY = self.pointerY,
2253
+ prevStartElementY = startElementY,
2254
+ prevX = self.x,
2255
+ prevY = self.y,
2256
+ prevEndX = self.endX,
2257
+ prevEndY = self.endY,
2258
+ prevEndRotation = self.endRotation,
2259
+ prevDirty = dirty,
2260
+ xChange,
2261
+ yChange,
2262
+ x,
2263
+ y,
2264
+ dif,
2265
+ temp;
2266
+ self.pointerX = pointerX;
2267
+ self.pointerY = pointerY;
2268
+
2269
+ if (isFixed) {
2270
+ pointerX -= _getDocScrollLeft(ownerDoc);
2271
+ pointerY -= _getDocScrollTop(ownerDoc);
2272
+ }
2273
+
2274
+ if (rotationMode) {
2275
+ y = Math.atan2(rotationOrigin.y - pointerY, pointerX - rotationOrigin.x) * _RAD2DEG;
2276
+ dif = self.y - y;
2277
+
2278
+ if (dif > 180) {
2279
+ startElementY -= 360;
2280
+ self.y = y;
2281
+ } else if (dif < -180) {
2282
+ startElementY += 360;
2283
+ self.y = y;
2284
+ }
2285
+
2286
+ if (self.x !== startElementX || Math.abs(startElementY - y) > minimumMovement) {
2287
+ self.y = y;
2288
+ x = startElementX + (startElementY - y) * dragTolerance;
2289
+ } else {
2290
+ x = startElementX;
2291
+ }
2292
+ } else {
2293
+ if (matrix) {
2294
+ temp = pointerX * matrix.a + pointerY * matrix.c + matrix.e;
2295
+ pointerY = pointerX * matrix.b + pointerY * matrix.d + matrix.f;
2296
+ pointerX = temp;
2297
+ }
2298
+
2299
+ yChange = pointerY - startPointerY;
2300
+ xChange = pointerX - startPointerX;
2301
+
2302
+ if (yChange < minimumMovement && yChange > -minimumMovement) {
2303
+ yChange = 0;
2304
+ }
2305
+
2306
+ if (xChange < minimumMovement && xChange > -minimumMovement) {
2307
+ xChange = 0;
2308
+ }
2309
+
2310
+ if ((self.lockAxis || self.lockedAxis) && (xChange || yChange)) {
2311
+ temp = self.lockedAxis;
2312
+
2313
+ if (!temp) {
2314
+ self.lockedAxis = temp = allowX && Math.abs(xChange) > Math.abs(yChange) ? "y" : allowY ? "x" : null;
2315
+
2316
+ if (temp && _isFunction(self.vars.onLockAxis)) {
2317
+ self.vars.onLockAxis.call(self, self.pointerEvent);
2318
+ }
2319
+ }
2320
+
2321
+ if (temp === "y") {
2322
+ yChange = 0;
2323
+ } else if (temp === "x") {
2324
+ xChange = 0;
2325
+ }
2326
+ }
2327
+
2328
+ x = _round(startElementX + xChange * dragTolerance);
2329
+ y = _round(startElementY + yChange * dragTolerance);
2330
+ }
2331
+
2332
+ if ((snapX || snapY || snapXY) && (self.x !== x || self.y !== y && !rotationMode)) {
2333
+ if (snapXY) {
2334
+ _temp1.x = x;
2335
+ _temp1.y = y;
2336
+ temp = snapXY(_temp1);
2337
+ x = _round(temp.x);
2338
+ y = _round(temp.y);
2339
+ }
2340
+
2341
+ if (snapX) {
2342
+ x = _round(snapX(x));
2343
+ }
2344
+
2345
+ if (snapY) {
2346
+ y = _round(snapY(y));
2347
+ }
2348
+ }
2349
+
2350
+ if (hasBounds) {
2351
+ if (x > maxX) {
2352
+ x = maxX + Math.round((x - maxX) * edgeTolerance);
2353
+ } else if (x < minX) {
2354
+ x = minX + Math.round((x - minX) * edgeTolerance);
2355
+ }
2356
+
2357
+ if (!rotationMode) {
2358
+ if (y > maxY) {
2359
+ y = Math.round(maxY + (y - maxY) * edgeTolerance);
2360
+ } else if (y < minY) {
2361
+ y = Math.round(minY + (y - minY) * edgeTolerance);
2362
+ }
2363
+ }
2364
+ }
2365
+
2366
+ if (self.x !== x || self.y !== y && !rotationMode) {
2367
+ if (rotationMode) {
2368
+ self.endRotation = self.x = self.endX = x;
2369
+ dirty = true;
2370
+ } else {
2371
+ if (allowY) {
2372
+ self.y = self.endY = y;
2373
+ dirty = true; //a flag that indicates we need to render the target next time the TweenLite.ticker dispatches a "tick" event (typically on a requestAnimationFrame) - this is a performance optimization (we shouldn't render on every move because sometimes many move events can get dispatched between screen refreshes, and that'd be wasteful to render every time)
2374
+ }
2375
+
2376
+ if (allowX) {
2377
+ self.x = self.endX = x;
2378
+ dirty = true;
2379
+ }
2380
+ }
2381
+
2382
+ if (!invokeOnMove || _dispatchEvent(self, "move", "onMove") !== false) {
2383
+ if (!self.isDragging && self.isPressed) {
2384
+ self.isDragging = dragged = true;
2385
+
2386
+ _dispatchEvent(self, "dragstart", "onDragStart");
2387
+ }
2388
+ } else {
2389
+ //revert because the onMove returned false!
2390
+ self.pointerX = prevPointerX;
2391
+ self.pointerY = prevPointerY;
2392
+ startElementY = prevStartElementY;
2393
+ self.x = prevX;
2394
+ self.y = prevY;
2395
+ self.endX = prevEndX;
2396
+ self.endY = prevEndY;
2397
+ self.endRotation = prevEndRotation;
2398
+ dirty = prevDirty;
2399
+ }
2400
+ }
2401
+ },
2402
+ //called when the mouse/touch is released
2403
+ onRelease = function onRelease(e, force) {
2404
+ if (!enabled || !self.isPressed || e && touchID != null && !force && (e.pointerId && e.pointerId !== touchID && e.target !== target || e.changedTouches && !_hasTouchID(e.changedTouches, touchID))) {
2405
+ //for some Microsoft browsers, we must attach the listener to the doc rather than the trigger so that when the finger moves outside the bounds of the trigger, things still work. So if the event we're receiving has a pointerId that doesn't match the touchID, ignore it (for multi-touch)
2406
+ isPreventingDefault && e && enabled && _preventDefault(e); // in some browsers, we must listen for multiple event types like touchend, pointerup, mouseup. The first time this function is called, we record whether or not we _preventDefault() so that on duplicate calls, we can do the same if necessary.
2407
+
2408
+ return;
2409
+ }
2410
+
2411
+ self.isPressed = false;
2412
+ var originalEvent = e,
2413
+ wasDragging = self.isDragging,
2414
+ isContextMenuRelease = self.vars.allowContextMenu && e && (e.ctrlKey || e.which > 2),
2415
+ placeholderDelayedCall = gsap.delayedCall(0.001, removePlaceholder),
2416
+ touches,
2417
+ i,
2418
+ syntheticEvent,
2419
+ eventTarget,
2420
+ syntheticClick;
2421
+
2422
+ if (touchEventTarget) {
2423
+ _removeListener(touchEventTarget, "touchend", onRelease);
2424
+
2425
+ _removeListener(touchEventTarget, "touchmove", onMove);
2426
+
2427
+ _removeListener(touchEventTarget, "touchcancel", onRelease);
2428
+
2429
+ _removeListener(ownerDoc, "touchstart", _onMultiTouchDocument);
2430
+ } else {
2431
+ _removeListener(ownerDoc, "mousemove", onMove);
2432
+ }
2433
+
2434
+ _removeListener(_win, "touchforcechange", _preventDefault);
2435
+
2436
+ if (!_supportsPointer || !touchEventTarget) {
2437
+ _removeListener(ownerDoc, "mouseup", onRelease);
2438
+
2439
+ e && e.target && _removeListener(e.target, "mouseup", onRelease);
2440
+ }
2441
+
2442
+ dirty = false;
2443
+
2444
+ if (wasDragging) {
2445
+ dragEndTime = _lastDragTime = _getTime();
2446
+ self.isDragging = false;
2447
+ }
2448
+
2449
+ _removeFromRenderQueue(render);
2450
+
2451
+ if (isClicking && !isContextMenuRelease) {
2452
+ if (e) {
2453
+ _removeListener(e.target, "change", onRelease);
2454
+
2455
+ self.pointerEvent = originalEvent;
2456
+ }
2457
+
2458
+ _setSelectable(triggers, false);
2459
+
2460
+ _dispatchEvent(self, "release", "onRelease");
2461
+
2462
+ _dispatchEvent(self, "click", "onClick");
2463
+
2464
+ isClicking = false;
2465
+ return;
2466
+ }
2467
+
2468
+ i = triggers.length;
2469
+
2470
+ while (--i > -1) {
2471
+ _setStyle(triggers[i], "cursor", vars.cursor || (vars.cursor !== false ? _defaultCursor : null));
2472
+ }
2473
+
2474
+ _dragCount--;
2475
+
2476
+ if (e) {
2477
+ touches = e.changedTouches;
2478
+
2479
+ if (touches) {
2480
+ //touch events store the data slightly differently
2481
+ e = touches[0];
2482
+
2483
+ if (e !== touch && e.identifier !== touchID) {
2484
+ //Usually changedTouches[0] will be what we're looking for, but in case it's not, look through the rest of the array...(and Android browsers don't reuse the event like iOS)
2485
+ i = touches.length;
2486
+
2487
+ while (--i > -1 && (e = touches[i]).identifier !== touchID && e.target !== target) {}
2488
+
2489
+ if (i < 0 && !force) {
2490
+ return;
2491
+ }
2492
+ }
2493
+ }
2494
+
2495
+ self.pointerEvent = originalEvent;
2496
+ self.pointerX = e.pageX;
2497
+ self.pointerY = e.pageY;
2498
+ }
2499
+
2500
+ if (isContextMenuRelease && originalEvent) {
2501
+ _preventDefault(originalEvent);
2502
+
2503
+ isPreventingDefault = true;
2504
+
2505
+ _dispatchEvent(self, "release", "onRelease");
2506
+ } else if (originalEvent && !wasDragging) {
2507
+ isPreventingDefault = false;
2508
+
2509
+ if (interrupted && (vars.snap || vars.bounds)) {
2510
+ //otherwise, if the user clicks on the object while it's animating to a snapped position, and then releases without moving 3 pixels, it will just stay there (it should animate/snap)
2511
+ animate(vars.inertia || vars.throwProps);
2512
+ }
2513
+
2514
+ _dispatchEvent(self, "release", "onRelease");
2515
+
2516
+ if ((!_isAndroid || originalEvent.type !== "touchmove") && originalEvent.type.indexOf("cancel") === -1) {
2517
+ //to accommodate native scrolling on Android devices, we have to immediately call onRelease() on the first touchmove event, but that shouldn't trigger a "click".
2518
+ _dispatchEvent(self, "click", "onClick");
2519
+
2520
+ if (_getTime() - clickTime < 300) {
2521
+ _dispatchEvent(self, "doubleclick", "onDoubleClick");
2522
+ }
2523
+
2524
+ eventTarget = originalEvent.target || target; //old IE uses srcElement
2525
+
2526
+ clickTime = _getTime();
2527
+
2528
+ syntheticClick = function syntheticClick() {
2529
+ // some browsers (like Firefox) won't trust script-generated clicks, so if the user tries to click on a video to play it, for example, it simply won't work. Since a regular "click" event will most likely be generated anyway (one that has its isTrusted flag set to true), we must slightly delay our script-generated click so that the "real"/trusted one is prioritized. Remember, when there are duplicate events in quick succession, we suppress all but the first one. Some browsers don't even trigger the "real" one at all, so our synthetic one is a safety valve that ensures that no matter what, a click event does get dispatched.
2530
+ if (clickTime !== clickDispatch && self.enabled() && !self.isPressed && !originalEvent.defaultPrevented) {
2531
+ if (eventTarget.click) {
2532
+ //some browsers (like mobile Safari) don't properly trigger the click event
2533
+ eventTarget.click();
2534
+ } else if (ownerDoc.createEvent) {
2535
+ syntheticEvent = ownerDoc.createEvent("MouseEvents");
2536
+ syntheticEvent.initMouseEvent("click", true, true, _win, 1, self.pointerEvent.screenX, self.pointerEvent.screenY, self.pointerX, self.pointerY, false, false, false, false, 0, null);
2537
+ eventTarget.dispatchEvent(syntheticEvent);
2538
+ }
2539
+ }
2540
+ };
2541
+
2542
+ if (!_isAndroid && !originalEvent.defaultPrevented) {
2543
+ //iOS Safari requires the synthetic click to happen immediately or else it simply won't work, but Android doesn't play nice.
2544
+ gsap.delayedCall(0.05, syntheticClick); //in addition to the iOS bug workaround, there's a Firefox issue with clicking on things like a video to play, so we must fake a click event in a slightly delayed fashion. Previously, we listened for the "click" event with "capture" false which solved the video-click-to-play issue, but it would allow the "click" event to be dispatched twice like if you were using a jQuery.click() because that was handled in the capture phase, thus we had to switch to the capture phase to avoid the double-dispatching, but do the delayed synthetic click. Don't fire it too fast (like 0.00001) because we want to give the native event a chance to fire first as it's "trusted".
2545
+ }
2546
+ }
2547
+ } else {
2548
+ animate(vars.inertia || vars.throwProps); //will skip if inertia/throwProps isn't defined or InertiaPlugin isn't loaded.
2549
+
2550
+ if (!self.allowEventDefault && originalEvent && (vars.dragClickables !== false || !isClickable.call(self, originalEvent.target)) && wasDragging && (!allowNativeTouchScrolling || touchDragAxis && allowNativeTouchScrolling === touchDragAxis) && originalEvent.cancelable !== false) {
2551
+ isPreventingDefault = true;
2552
+
2553
+ _preventDefault(originalEvent);
2554
+ } else {
2555
+ isPreventingDefault = false;
2556
+ }
2557
+
2558
+ _dispatchEvent(self, "release", "onRelease");
2559
+ }
2560
+
2561
+ isTweening() && placeholderDelayedCall.duration(self.tween.duration()); //sync the timing so that the placeholder DIV gets
2562
+
2563
+ wasDragging && _dispatchEvent(self, "dragend", "onDragEnd");
2564
+ return true;
2565
+ },
2566
+ updateScroll = function updateScroll(e) {
2567
+ if (e && self.isDragging && !scrollProxy) {
2568
+ var parent = e.target || target.parentNode,
2569
+ deltaX = parent.scrollLeft - parent._gsScrollX,
2570
+ deltaY = parent.scrollTop - parent._gsScrollY;
2571
+
2572
+ if (deltaX || deltaY) {
2573
+ if (matrix) {
2574
+ startPointerX -= deltaX * matrix.a + deltaY * matrix.c;
2575
+ startPointerY -= deltaY * matrix.d + deltaX * matrix.b;
2576
+ } else {
2577
+ startPointerX -= deltaX;
2578
+ startPointerY -= deltaY;
2579
+ }
2580
+
2581
+ parent._gsScrollX += deltaX;
2582
+ parent._gsScrollY += deltaY;
2583
+ setPointerPosition(self.pointerX, self.pointerY);
2584
+ }
2585
+ }
2586
+ },
2587
+ onClick = function onClick(e) {
2588
+ //this was a huge pain in the neck to align all the various browsers and their behaviors. Chrome, Firefox, Safari, Opera, Android, and Microsoft Edge all handle events differently! Some will only trigger native behavior (like checkbox toggling) from trusted events. Others don't even support isTrusted, but require 2 events to flow through before triggering native behavior. Edge treats everything as trusted but also mandates that 2 flow through to trigger the correct native behavior.
2589
+ var time = _getTime(),
2590
+ recentlyClicked = time - clickTime < 100,
2591
+ recentlyDragged = time - dragEndTime < 50,
2592
+ alreadyDispatched = recentlyClicked && clickDispatch === clickTime,
2593
+ defaultPrevented = self.pointerEvent && self.pointerEvent.defaultPrevented,
2594
+ alreadyDispatchedTrusted = recentlyClicked && trustedClickDispatch === clickTime,
2595
+ trusted = e.isTrusted || e.isTrusted == null && recentlyClicked && alreadyDispatched; //note: Safari doesn't support isTrusted, and it won't properly execute native behavior (like toggling checkboxes) on the first synthetic "click" event - we must wait for the 2nd and treat it as trusted (but stop propagation at that point). Confusing, I know. Don't you love cross-browser compatibility challenges?
2596
+
2597
+
2598
+ if ((alreadyDispatched || recentlyDragged && self.vars.suppressClickOnDrag !== false) && e.stopImmediatePropagation) {
2599
+ e.stopImmediatePropagation();
2600
+ }
2601
+
2602
+ if (recentlyClicked && !(self.pointerEvent && self.pointerEvent.defaultPrevented) && (!alreadyDispatched || trusted && !alreadyDispatchedTrusted)) {
2603
+ //let the first click pass through unhindered. Let the next one only if it's trusted, then no more (stop quick-succession ones)
2604
+ if (trusted && alreadyDispatched) {
2605
+ trustedClickDispatch = clickTime;
2606
+ }
2607
+
2608
+ clickDispatch = clickTime;
2609
+ return;
2610
+ }
2611
+
2612
+ if (self.isPressed || recentlyDragged || recentlyClicked) {
2613
+ if (!trusted || !e.detail || !recentlyClicked || defaultPrevented) {
2614
+ _preventDefault(e);
2615
+ }
2616
+ }
2617
+
2618
+ if (!recentlyClicked && !recentlyDragged && !dragged) {
2619
+ // for script-triggered event dispatches, like element.click()
2620
+ e && e.target && (self.pointerEvent = e);
2621
+
2622
+ _dispatchEvent(self, "click", "onClick");
2623
+ }
2624
+ },
2625
+ localizePoint = function localizePoint(p) {
2626
+ return matrix ? {
2627
+ x: p.x * matrix.a + p.y * matrix.c + matrix.e,
2628
+ y: p.x * matrix.b + p.y * matrix.d + matrix.f
2629
+ } : {
2630
+ x: p.x,
2631
+ y: p.y
2632
+ };
2633
+ };
2634
+
2635
+ old = Draggable.get(target);
2636
+ old && old.kill(); // avoids duplicates (an element can only be controlled by one Draggable)
2637
+ //give the user access to start/stop dragging...
2638
+
2639
+ _this2.startDrag = function (event, align) {
2640
+ var r1, r2, p1, p2;
2641
+ onPress(event || self.pointerEvent, true); //if the pointer isn't on top of the element, adjust things accordingly
2642
+
2643
+ if (align && !self.hitTest(event || self.pointerEvent)) {
2644
+ r1 = _parseRect(event || self.pointerEvent);
2645
+ r2 = _parseRect(target);
2646
+ p1 = localizePoint({
2647
+ x: r1.left + r1.width / 2,
2648
+ y: r1.top + r1.height / 2
2649
+ });
2650
+ p2 = localizePoint({
2651
+ x: r2.left + r2.width / 2,
2652
+ y: r2.top + r2.height / 2
2653
+ });
2654
+ startPointerX -= p1.x - p2.x;
2655
+ startPointerY -= p1.y - p2.y;
2656
+ }
2657
+
2658
+ if (!self.isDragging) {
2659
+ self.isDragging = dragged = true;
2660
+
2661
+ _dispatchEvent(self, "dragstart", "onDragStart");
2662
+ }
2663
+ };
2664
+
2665
+ _this2.drag = onMove;
2666
+
2667
+ _this2.endDrag = function (e) {
2668
+ return onRelease(e || self.pointerEvent, true);
2669
+ };
2670
+
2671
+ _this2.timeSinceDrag = function () {
2672
+ return self.isDragging ? 0 : (_getTime() - dragEndTime) / 1000;
2673
+ };
2674
+
2675
+ _this2.timeSinceClick = function () {
2676
+ return (_getTime() - clickTime) / 1000;
2677
+ };
2678
+
2679
+ _this2.hitTest = function (target, threshold) {
2680
+ return Draggable.hitTest(self.target, target, threshold);
2681
+ };
2682
+
2683
+ _this2.getDirection = function (from, diagonalThreshold) {
2684
+ //from can be "start" (default), "velocity", or an element
2685
+ var mode = from === "velocity" && InertiaPlugin ? from : _isObject(from) && !rotationMode ? "element" : "start",
2686
+ xChange,
2687
+ yChange,
2688
+ ratio,
2689
+ direction,
2690
+ r1,
2691
+ r2;
2692
+
2693
+ if (mode === "element") {
2694
+ r1 = _parseRect(self.target);
2695
+ r2 = _parseRect(from);
2696
+ }
2697
+
2698
+ xChange = mode === "start" ? self.x - startElementX : mode === "velocity" ? InertiaPlugin.getVelocity(target, xProp) : r1.left + r1.width / 2 - (r2.left + r2.width / 2);
2699
+
2700
+ if (rotationMode) {
2701
+ return xChange < 0 ? "counter-clockwise" : "clockwise";
2702
+ } else {
2703
+ diagonalThreshold = diagonalThreshold || 2;
2704
+ yChange = mode === "start" ? self.y - startElementY : mode === "velocity" ? InertiaPlugin.getVelocity(target, yProp) : r1.top + r1.height / 2 - (r2.top + r2.height / 2);
2705
+ ratio = Math.abs(xChange / yChange);
2706
+ direction = ratio < 1 / diagonalThreshold ? "" : xChange < 0 ? "left" : "right";
2707
+
2708
+ if (ratio < diagonalThreshold) {
2709
+ if (direction !== "") {
2710
+ direction += "-";
2711
+ }
2712
+
2713
+ direction += yChange < 0 ? "up" : "down";
2714
+ }
2715
+ }
2716
+
2717
+ return direction;
2718
+ };
2719
+
2720
+ _this2.applyBounds = function (newBounds, sticky) {
2721
+ var x, y, forceZeroVelocity, e, parent, isRoot;
2722
+
2723
+ if (newBounds && vars.bounds !== newBounds) {
2724
+ vars.bounds = newBounds;
2725
+ return self.update(true, sticky);
2726
+ }
2727
+
2728
+ syncXY(true);
2729
+ calculateBounds();
2730
+
2731
+ if (hasBounds && !isTweening()) {
2732
+ x = self.x;
2733
+ y = self.y;
2734
+
2735
+ if (x > maxX) {
2736
+ x = maxX;
2737
+ } else if (x < minX) {
2738
+ x = minX;
2739
+ }
2740
+
2741
+ if (y > maxY) {
2742
+ y = maxY;
2743
+ } else if (y < minY) {
2744
+ y = minY;
2745
+ }
2746
+
2747
+ if (self.x !== x || self.y !== y) {
2748
+ forceZeroVelocity = true;
2749
+ self.x = self.endX = x;
2750
+
2751
+ if (rotationMode) {
2752
+ self.endRotation = x;
2753
+ } else {
2754
+ self.y = self.endY = y;
2755
+ }
2756
+
2757
+ dirty = true;
2758
+ render(true);
2759
+
2760
+ if (self.autoScroll && !self.isDragging) {
2761
+ _recordMaxScrolls(target.parentNode);
2762
+
2763
+ e = target;
2764
+ _windowProxy.scrollTop = _win.pageYOffset != null ? _win.pageYOffset : ownerDoc.documentElement.scrollTop != null ? ownerDoc.documentElement.scrollTop : ownerDoc.body.scrollTop;
2765
+ _windowProxy.scrollLeft = _win.pageXOffset != null ? _win.pageXOffset : ownerDoc.documentElement.scrollLeft != null ? ownerDoc.documentElement.scrollLeft : ownerDoc.body.scrollLeft;
2766
+
2767
+ while (e && !isRoot) {
2768
+ //walk up the chain and sense wherever the scrollTop/scrollLeft exceeds the maximum.
2769
+ isRoot = _isRoot(e.parentNode);
2770
+ parent = isRoot ? _windowProxy : e.parentNode;
2771
+
2772
+ if (allowY && parent.scrollTop > parent._gsMaxScrollY) {
2773
+ parent.scrollTop = parent._gsMaxScrollY;
2774
+ }
2775
+
2776
+ if (allowX && parent.scrollLeft > parent._gsMaxScrollX) {
2777
+ parent.scrollLeft = parent._gsMaxScrollX;
2778
+ }
2779
+
2780
+ e = parent;
2781
+ }
2782
+ }
2783
+ }
2784
+
2785
+ if (self.isThrowing && (forceZeroVelocity || self.endX > maxX || self.endX < minX || self.endY > maxY || self.endY < minY)) {
2786
+ animate(vars.inertia || vars.throwProps, forceZeroVelocity);
2787
+ }
2788
+ }
2789
+
2790
+ return self;
2791
+ };
2792
+
2793
+ _this2.update = function (applyBounds, sticky, ignoreExternalChanges) {
2794
+ if (sticky && self.isPressed) {
2795
+ // in case the element was repositioned in the document flow, thus its x/y may be identical but its position is actually quite different.
2796
+ var m = getGlobalMatrix(target),
2797
+ p = innerMatrix.apply({
2798
+ x: self.x - startElementX,
2799
+ y: self.y - startElementY
2800
+ }),
2801
+ m2 = getGlobalMatrix(target.parentNode, true);
2802
+ m2.apply({
2803
+ x: m.e - p.x,
2804
+ y: m.f - p.y
2805
+ }, p);
2806
+ self.x -= p.x - m2.e;
2807
+ self.y -= p.y - m2.f;
2808
+ render(true);
2809
+ recordStartPositions();
2810
+ }
2811
+
2812
+ var x = self.x,
2813
+ y = self.y;
2814
+ updateMatrix(!sticky);
2815
+
2816
+ if (applyBounds) {
2817
+ self.applyBounds();
2818
+ } else {
2819
+ dirty && ignoreExternalChanges && render(true);
2820
+ syncXY(true);
2821
+ }
2822
+
2823
+ if (sticky) {
2824
+ setPointerPosition(self.pointerX, self.pointerY);
2825
+ dirty && render(true);
2826
+ }
2827
+
2828
+ if (self.isPressed && !sticky && (allowX && Math.abs(x - self.x) > 0.01 || allowY && Math.abs(y - self.y) > 0.01 && !rotationMode)) {
2829
+ recordStartPositions();
2830
+ }
2831
+
2832
+ if (self.autoScroll) {
2833
+ _recordMaxScrolls(target.parentNode, self.isDragging);
2834
+
2835
+ checkAutoScrollBounds = self.isDragging;
2836
+ render(true); //in case reparenting occurred.
2837
+
2838
+ _removeScrollListener(target, updateScroll);
2839
+
2840
+ _addScrollListener(target, updateScroll);
2841
+ }
2842
+
2843
+ return self;
2844
+ };
2845
+
2846
+ _this2.enable = function (type) {
2847
+ var setVars = {
2848
+ lazy: true
2849
+ },
2850
+ id,
2851
+ i,
2852
+ trigger;
2853
+
2854
+ if (vars.cursor !== false) {
2855
+ setVars.cursor = vars.cursor || _defaultCursor;
2856
+ }
2857
+
2858
+ if (gsap.utils.checkPrefix("touchCallout")) {
2859
+ setVars.touchCallout = "none";
2860
+ }
2861
+
2862
+ if (type !== "soft") {
2863
+ _setTouchActionForAllDescendants(triggers, allowX === allowY ? "none" : vars.allowNativeTouchScrolling && target.scrollHeight === target.clientHeight === (target.scrollWidth === target.clientHeight) || vars.allowEventDefault ? "manipulation" : allowX ? "pan-y" : "pan-x"); // Some browsers like Internet Explorer will fire a pointercancel event when the user attempts to drag when touchAction is "manipulate" because it's perceived as a pan. If the element has scrollable content in only one direction, we should use pan-x or pan-y accordingly so that the pointercancel doesn't prevent dragging.
2864
+
2865
+
2866
+ i = triggers.length;
2867
+
2868
+ while (--i > -1) {
2869
+ trigger = triggers[i];
2870
+ _supportsPointer || _addListener(trigger, "mousedown", onPress);
2871
+
2872
+ _addListener(trigger, "touchstart", onPress);
2873
+
2874
+ _addListener(trigger, "click", onClick, true); // note: used to pass true for capture but it prevented click-to-play-video functionality in Firefox.
2875
+
2876
+
2877
+ gsap.set(trigger, setVars);
2878
+
2879
+ if (trigger.getBBox && trigger.ownerSVGElement && allowX !== allowY) {
2880
+ // a bug in chrome doesn't respect touch-action on SVG elements - it only works if we set it on the parent SVG.
2881
+ gsap.set(trigger.ownerSVGElement, {
2882
+ touchAction: vars.allowNativeTouchScrolling || vars.allowEventDefault ? "manipulation" : allowX ? "pan-y" : "pan-x"
2883
+ });
2884
+ }
2885
+
2886
+ vars.allowContextMenu || _addListener(trigger, "contextmenu", onContextMenu);
2887
+ }
2888
+
2889
+ _setSelectable(triggers, false);
2890
+ }
2891
+
2892
+ _addScrollListener(target, updateScroll);
2893
+
2894
+ enabled = true;
2895
+
2896
+ if (InertiaPlugin && type !== "soft") {
2897
+ InertiaPlugin.track(scrollProxy || target, xyMode ? "x,y" : rotationMode ? "rotation" : "top,left");
2898
+ }
2899
+
2900
+ target._gsDragID = id = "d" + _lookupCount++;
2901
+ _lookup[id] = self;
2902
+
2903
+ if (scrollProxy) {
2904
+ scrollProxy.enable();
2905
+ scrollProxy.element._gsDragID = id;
2906
+ }
2907
+
2908
+ (vars.bounds || rotationMode) && recordStartPositions();
2909
+ vars.bounds && self.applyBounds();
2910
+ return self;
2911
+ };
2912
+
2913
+ _this2.disable = function (type) {
2914
+ var dragging = self.isDragging,
2915
+ i = triggers.length,
2916
+ trigger;
2917
+
2918
+ while (--i > -1) {
2919
+ _setStyle(triggers[i], "cursor", null);
2920
+ }
2921
+
2922
+ if (type !== "soft") {
2923
+ _setTouchActionForAllDescendants(triggers, null);
2924
+
2925
+ i = triggers.length;
2926
+
2927
+ while (--i > -1) {
2928
+ trigger = triggers[i];
2929
+
2930
+ _setStyle(trigger, "touchCallout", null);
2931
+
2932
+ _removeListener(trigger, "mousedown", onPress);
2933
+
2934
+ _removeListener(trigger, "touchstart", onPress);
2935
+
2936
+ _removeListener(trigger, "click", onClick, true);
2937
+
2938
+ _removeListener(trigger, "contextmenu", onContextMenu);
2939
+ }
2940
+
2941
+ _setSelectable(triggers, true);
2942
+
2943
+ if (touchEventTarget) {
2944
+ _removeListener(touchEventTarget, "touchcancel", onRelease);
2945
+
2946
+ _removeListener(touchEventTarget, "touchend", onRelease);
2947
+
2948
+ _removeListener(touchEventTarget, "touchmove", onMove);
2949
+ }
2950
+
2951
+ _removeListener(ownerDoc, "mouseup", onRelease);
2952
+
2953
+ _removeListener(ownerDoc, "mousemove", onMove);
2954
+ }
2955
+
2956
+ _removeScrollListener(target, updateScroll);
2957
+
2958
+ enabled = false;
2959
+
2960
+ if (InertiaPlugin && type !== "soft") {
2961
+ InertiaPlugin.untrack(scrollProxy || target, xyMode ? "x,y" : rotationMode ? "rotation" : "top,left");
2962
+ self.tween && self.tween.kill();
2963
+ }
2964
+
2965
+ scrollProxy && scrollProxy.disable();
2966
+
2967
+ _removeFromRenderQueue(render);
2968
+
2969
+ self.isDragging = self.isPressed = isClicking = false;
2970
+ dragging && _dispatchEvent(self, "dragend", "onDragEnd");
2971
+ return self;
2972
+ };
2973
+
2974
+ _this2.enabled = function (value, type) {
2975
+ return arguments.length ? value ? self.enable(type) : self.disable(type) : enabled;
2976
+ };
2977
+
2978
+ _this2.kill = function () {
2979
+ self.isThrowing = false;
2980
+ self.tween && self.tween.kill();
2981
+ self.disable();
2982
+ gsap.set(triggers, {
2983
+ clearProps: "userSelect"
2984
+ });
2985
+ delete _lookup[target._gsDragID];
2986
+ return self;
2987
+ };
2988
+
2989
+ _this2.revert = function () {
2990
+ this.kill();
2991
+ this.styles && this.styles.revert();
2992
+ };
2993
+
2994
+ if (~type.indexOf("scroll")) {
2995
+ scrollProxy = _this2.scrollProxy = new ScrollProxy(target, _extend({
2996
+ onKill: function onKill() {
2997
+ //ScrollProxy's onKill() gets called if/when the ScrollProxy senses that the user interacted with the scroll position manually (like using the scrollbar). IE9 doesn't fire the "mouseup" properly when users drag the scrollbar of an element, so this works around that issue.
2998
+ self.isPressed && onRelease(null);
2999
+ }
3000
+ }, vars)); //a bug in many Android devices' stock browser causes scrollTop to get forced back to 0 after it is altered via JS, so we set overflow to "hidden" on mobile/touch devices (they hide the scroll bar anyway). That works around the bug. (This bug is discussed at https://code.google.com/p/android/issues/detail?id=19625)
3001
+
3002
+ target.style.overflowY = allowY && !_isTouchDevice ? "auto" : "hidden";
3003
+ target.style.overflowX = allowX && !_isTouchDevice ? "auto" : "hidden";
3004
+ target = scrollProxy.content;
3005
+ }
3006
+
3007
+ if (rotationMode) {
3008
+ killProps.rotation = 1;
3009
+ } else {
3010
+ if (allowX) {
3011
+ killProps[xProp] = 1;
3012
+ }
3013
+
3014
+ if (allowY) {
3015
+ killProps[yProp] = 1;
3016
+ }
3017
+ }
3018
+
3019
+ gsCache.force3D = "force3D" in vars ? vars.force3D : true; //otherwise, normal dragging would be in 2D and then as soon as it's released and there's an inertia tween, it'd jump to 3D which can create an initial jump due to the work the browser must to do layerize it.
3020
+
3021
+ _context(_assertThisInitialized(_this2));
3022
+
3023
+ _this2.enable();
3024
+
3025
+ return _this2;
3026
+ }
3027
+
3028
+ Draggable.register = function register(core) {
3029
+ gsap = core;
3030
+
3031
+ _initCore();
3032
+ };
3033
+
3034
+ Draggable.create = function create(targets, vars) {
3035
+ _coreInitted || _initCore(true);
3036
+ return _toArray(targets).map(function (target) {
3037
+ return new Draggable(target, vars);
3038
+ });
3039
+ };
3040
+
3041
+ Draggable.get = function get(target) {
3042
+ return _lookup[(_toArray(target)[0] || {})._gsDragID];
3043
+ };
3044
+
3045
+ Draggable.timeSinceDrag = function timeSinceDrag() {
3046
+ return (_getTime() - _lastDragTime) / 1000;
3047
+ };
3048
+
3049
+ Draggable.hitTest = function hitTest(obj1, obj2, threshold) {
3050
+ if (obj1 === obj2) {
3051
+ return false;
3052
+ }
3053
+
3054
+ var r1 = _parseRect(obj1),
3055
+ r2 = _parseRect(obj2),
3056
+ top = r1.top,
3057
+ left = r1.left,
3058
+ right = r1.right,
3059
+ bottom = r1.bottom,
3060
+ width = r1.width,
3061
+ height = r1.height,
3062
+ isOutside = r2.left > right || r2.right < left || r2.top > bottom || r2.bottom < top,
3063
+ overlap,
3064
+ area,
3065
+ isRatio;
3066
+
3067
+ if (isOutside || !threshold) {
3068
+ return !isOutside;
3069
+ }
3070
+
3071
+ isRatio = (threshold + "").indexOf("%") !== -1;
3072
+ threshold = parseFloat(threshold) || 0;
3073
+ overlap = {
3074
+ left: Math.max(left, r2.left),
3075
+ top: Math.max(top, r2.top)
3076
+ };
3077
+ overlap.width = Math.min(right, r2.right) - overlap.left;
3078
+ overlap.height = Math.min(bottom, r2.bottom) - overlap.top;
3079
+
3080
+ if (overlap.width < 0 || overlap.height < 0) {
3081
+ return false;
3082
+ }
3083
+
3084
+ if (isRatio) {
3085
+ threshold *= 0.01;
3086
+ area = overlap.width * overlap.height;
3087
+ return area >= width * height * threshold || area >= r2.width * r2.height * threshold;
3088
+ }
3089
+
3090
+ return overlap.width > threshold && overlap.height > threshold;
3091
+ };
3092
+
3093
+ return Draggable;
3094
+ }(EventDispatcher);
3095
+
3096
+ _setDefaults(Draggable.prototype, {
3097
+ pointerX: 0,
3098
+ pointerY: 0,
3099
+ startX: 0,
3100
+ startY: 0,
3101
+ deltaX: 0,
3102
+ deltaY: 0,
3103
+ isDragging: false,
3104
+ isPressed: false
3105
+ });
3106
+
3107
+ Draggable.zIndex = 1000;
3108
+ Draggable.version = "3.12.5";
3109
+ _getGSAP() && gsap.registerPlugin(Draggable);
3110
+
3111
+ const cpslModalCss = ":host{--container-width:360px;--container-gap:16px;--container-border-radius:var(--cpsl-border-radius-modal);--container-border-width:1px;--container-border-color:var(--cpsl-color-modal-border);--container-background-color:var(--cpsl-color-modal-surface-footer);--container-padding-bottom:16px;--container-box-shadow:0px 2px 4px 0px var(--cpsl-color-alpha-black-8);--inner-container-background-color:var(--cpsl-color-modal-surface-main);--inner-container-border-radius:var(--cpsl-border-radius-modal);--inner-container-box-shadow:0px 1px 2px 0px var(--cpsl-color-alpha-black-8);--inner-container-padding-top:16px;--inner-container-padding-end:16px;--inner-container-padding-bottom:24px;--inner-container-padding-start:16px;--inner-container-margin-bottom:16px;display:inline-block}@media (max-width: 480px){:host(.include-mobile-styling) .modal-wrapper{scale:none;top:100%;left:0;height:unset;opacity:1}:host(.include-mobile-styling) .modal-container{width:100%;max-width:none;border-bottom-left-radius:0px;border-bottom-right-radius:0px}}.modal-header{position:sticky;top:0;padding-top:var(--inner-container-padding-top);background-color:var(--inner-container-background-color)}.modal-wrapper{z-index:9999999999998;position:fixed;top:0;left:0;display:none;height:100%;width:100%;justify-content:center;align-items:center;scale:0.8;opacity:0;transform:none}.modal-container{position:relative;overflow:hidden;-webkit-padding-start:var(--container-padding-start);padding-inline-start:var(--container-padding-start);-webkit-padding-end:var(--container-padding-end);padding-inline-end:var(--container-padding-end);padding-top:var(--container-padding-top);padding-bottom:var(--container-padding-bottom);width:var(--container-width);display:flex;flex-direction:column;border:var(--container-border-width) solid var(--container-border-color);border-radius:var(--container-border-radius);box-shadow:var(--container-box-shadow);background-color:var(--container-background-color);max-width:95vw;max-height:95vh;max-height:95dvh;overflow:auto;-ms-overflow-style:none;scrollbar-width:none;}.modal-container ::-webkit-scrollbar{display:none}.modal-inner-container{-webkit-padding-start:var(--inner-container-padding-start);padding-inline-start:var(--inner-container-padding-start);-webkit-padding-end:var(--inner-container-padding-end);padding-inline-end:var(--inner-container-padding-end);padding-top:0;padding-bottom:var(--inner-container-padding-bottom);margin-bottom:var(--inner-container-margin-bottom);border-radius:var(--inner-container-border-radius);box-shadow:var(--inner-container-box-shadow);background-color:var(--inner-container-background-color)}.expanded{height:0px;overflow:hidden;display:none}.modal-inner-container.no-footer{margin-bottom:0px;box-shadow:none}.modal-container.no-footer{padding-bottom:0px}.no-opacity{opacity:0}";
3112
+
3113
+ gsapWithCSS.registerPlugin(Draggable);
3114
+ const mm = gsapWithCSS.matchMedia();
3115
+ const CpslModal = class {
3116
+ constructor(hostRef) {
3117
+ registerInstance(this, hostRef);
3118
+ this.cpslModalEntering = createEvent(this, "cpslModalEntering", 7);
3119
+ this.cpslModalEntered = createEvent(this, "cpslModalEntered", 7);
3120
+ this.cpslModalExiting = createEvent(this, "cpslModalExiting", 7);
3121
+ this.cpslModalExited = createEvent(this, "cpslModalExited", 7);
3122
+ this.cpslModalRequestClose = createEvent(this, "cpslModalRequestClose", 7);
3123
+ this.getDraggableHeight = () => {
3124
+ return this.innerContainerEl.clientHeight;
3125
+ };
3126
+ this.hasFooter = undefined;
3127
+ this.enterTransitionDuration = 0.15;
3128
+ this.exitTransitionDuration = 0.15;
3129
+ this.footerExpanded = undefined;
3130
+ this.footerTransitionDuration = 0.15;
3131
+ this.noOverlay = undefined;
3132
+ this.open = undefined;
3133
+ }
3134
+ toggleHeight() {
3135
+ this.footerExpanded ? this.expandFooterTl.play() : this.expandFooterTl.reverse();
3136
+ }
3137
+ toggleModal() {
3138
+ if (this.hasAnimatedIn) {
3139
+ this.handleAnimation();
3140
+ }
3141
+ }
3142
+ componentDidLoad() {
3143
+ this.handleAnimation();
3144
+ this.hasAnimatedIn = true;
3145
+ mm.add(`(min-width: ${MOBILE_SIZE + 1}px)`, () => {
3146
+ var _a;
3147
+ (_a = this.draggable) === null || _a === void 0 ? void 0 : _a.disable();
3148
+ gsapWithCSS.timeline({}).set(this.modalWrapperEl, { yPercent: 0, scale: this.open ? 1 : 0.8, opacity: this.open ? 1 : 0 });
3149
+ });
3150
+ mm.add(`(max-width: ${MOBILE_SIZE}px)`, () => {
3151
+ this.initDraggable();
3152
+ gsapWithCSS.timeline({}).set(this.modalWrapperEl, { scale: 1, opacity: 1, yPercent: this.open ? -100 : 0 });
3153
+ });
3154
+ this.footerSlotEl.addEventListener('slotchange', () => {
3155
+ if (this.footerSlotEl.assignedNodes().length >= 1) {
3156
+ this.hasFooter = true;
3157
+ }
3158
+ else {
3159
+ this.hasFooter = false;
3160
+ }
3161
+ });
3162
+ }
3163
+ handleAnimation() {
3164
+ if (this.open) {
3165
+ if (window.innerWidth >= MOBILE_SIZE + 1) {
3166
+ gsapWithCSS
3167
+ .timeline({
3168
+ onStart: () => {
3169
+ this.cpslModalEntering.emit();
3170
+ },
3171
+ onComplete: () => {
3172
+ this.addExpandAnim();
3173
+ this.cpslModalEntered.emit();
3174
+ },
3175
+ })
3176
+ .set(this.modalWrapperEl, { display: 'flex', yPercent: 0 })
3177
+ .to(this.modalWrapperEl, {
3178
+ scale: 1,
3179
+ opacity: 1,
3180
+ duration: this.enterTransitionDuration,
3181
+ });
3182
+ }
3183
+ else {
3184
+ gsapWithCSS
3185
+ .timeline({
3186
+ onStart: () => {
3187
+ this.cpslModalEntering.emit();
3188
+ },
3189
+ onComplete: () => {
3190
+ this.addExpandAnim();
3191
+ this.cpslModalEntered.emit();
3192
+ },
3193
+ })
3194
+ .set(this.modalWrapperEl, { display: 'flex', scale: 1, opacity: 1 })
3195
+ .to(this.modalWrapperEl, {
3196
+ yPercent: -100,
3197
+ duration: this.enterTransitionDuration,
3198
+ });
3199
+ }
3200
+ }
3201
+ else {
3202
+ if (window.innerWidth >= MOBILE_SIZE + 1) {
3203
+ gsapWithCSS
3204
+ .timeline({
3205
+ onStart: () => {
3206
+ this.cpslModalExiting.emit();
3207
+ },
3208
+ onComplete: () => {
3209
+ this.cpslModalExited.emit();
3210
+ this.modalWrapperEl.style.setProperty('display', 'none');
3211
+ },
3212
+ })
3213
+ .to(this.modalWrapperEl, {
3214
+ scale: 0.8,
3215
+ opacity: 0,
3216
+ duration: this.exitTransitionDuration,
3217
+ });
3218
+ }
3219
+ else {
3220
+ gsapWithCSS
3221
+ .timeline({
3222
+ onStart: () => {
3223
+ this.cpslModalExiting.emit();
3224
+ },
3225
+ onComplete: () => {
3226
+ this.cpslModalExited.emit();
3227
+ this.modalWrapperEl.style.setProperty('display', 'none');
3228
+ },
3229
+ })
3230
+ .to(this.modalWrapperEl, {
3231
+ yPercent: 0,
3232
+ duration: this.exitTransitionDuration,
3233
+ })
3234
+ .set(this.modalContainerEl, { y: 0 });
3235
+ }
3236
+ }
3237
+ }
3238
+ addExpandAnim() {
3239
+ setTimeout(() => {
3240
+ this.expandFooterTl = gsapWithCSS
3241
+ .timeline({
3242
+ reversed: true,
3243
+ paused: true,
3244
+ onReverseComplete: () => {
3245
+ this.contentEl.style.setProperty('height', 'auto');
3246
+ },
3247
+ defaults: {
3248
+ duration: this.footerTransitionDuration,
3249
+ },
3250
+ })
3251
+ .set(this.footerExpandedEl, { overflow: 'auto', display: 'block' })
3252
+ .set(this.headerExpandedEl, { display: 'block' })
3253
+ .to(this.innerContainerEl, { paddingBottom: '8px' })
3254
+ .to(this.contentEl, { height: '0px', overflow: 'hidden', opacity: 0 }, '<')
3255
+ .to(this.footerEl, { height: '0px', overflow: 'hidden', opacity: 0 }, '<')
3256
+ .to(this.footerExpandedEl, { height: 'auto', opacity: 1 }, '<')
3257
+ .to(this.headerExpandedEl, { height: 'auto', opacity: 1 }, '<');
3258
+ }, 10);
3259
+ }
3260
+ initDraggable() {
3261
+ this.draggable = Draggable.create(this.modalContainerEl, {
3262
+ trigger: this.headerEl,
3263
+ dragClickables: false,
3264
+ type: 'y',
3265
+ edgeResistance: 0.2,
3266
+ liveSnap: {
3267
+ y: function (y) {
3268
+ if (y < 0)
3269
+ return 0;
3270
+ return y;
3271
+ },
3272
+ },
3273
+ onDrag: () => {
3274
+ const y = gsapWithCSS.utils.mapRange(0, this.getDraggableHeight(), 1, 0, this.draggable.y);
3275
+ gsapWithCSS.set(this.overlayEl, { opacity: y });
3276
+ },
3277
+ onDragEnd: () => {
3278
+ if (this.draggable.y > 60) {
3279
+ this.cpslModalRequestClose.emit();
3280
+ }
3281
+ else {
3282
+ gsapWithCSS.set(this.overlayEl, { opacity: 1 });
3283
+ gsapWithCSS.set(this.modalWrapperEl, { yPercent: -100 });
3284
+ gsapWithCSS.set(this.modalContainerEl, { y: 0 });
3285
+ }
3286
+ },
3287
+ })[0];
3288
+ }
3289
+ get footerEl() {
3290
+ return this.el.shadowRoot.getElementById('modal-footer');
3291
+ }
3292
+ get footerExpandedEl() {
3293
+ return this.el.shadowRoot.getElementById('modal-footer-expanded');
3294
+ }
3295
+ get headerExpandedEl() {
3296
+ return this.el.shadowRoot.getElementById('modal-header-expanded');
3297
+ }
3298
+ get innerContainerEl() {
3299
+ return this.el.shadowRoot.getElementById('modal-inner-container');
3300
+ }
3301
+ get contentEl() {
3302
+ return this.el.shadowRoot.getElementById('modal-content');
3303
+ }
3304
+ get modalWrapperEl() {
3305
+ return this.el.shadowRoot.getElementById('modal-wrapper');
3306
+ }
3307
+ get modalContainerEl() {
3308
+ return this.el.shadowRoot.getElementById('modal-container');
3309
+ }
3310
+ get overlayEl() {
3311
+ return this.el.shadowRoot.getElementById('overlay');
3312
+ }
3313
+ get footerSlotEl() {
3314
+ return this.footerEl.querySelectorAll('slot')[0];
3315
+ }
3316
+ get headerEl() {
3317
+ return this.el.shadowRoot.getElementById('modal-header');
3318
+ }
3319
+ get Modal() {
3320
+ return (h("div", { class: { 'modal-container': true, 'no-footer': !this.hasFooter }, part: "modal-container", id: "modal-container" }, h("slot", null), h("div", { id: "modal-inner-container", class: { 'modal-inner-container': true, 'no-footer': !this.hasFooter }, part: "modal-inner-container" }, h("div", { id: "modal-content", part: "modal-content" }, h("div", { id: "modal-header", class: "modal-header", part: "modal-header" }, h("slot", { name: "header" })), h("div", { id: "modal-body", class: "modal-body", part: "modal-body" }, h("slot", { name: "body" }))), h("div", { id: "modal-header-expanded", class: { 'modal-header': true, 'expanded': true, 'no-opacity': true }, part: "modal-header-expanded" }, h("slot", { name: "footerExpandedHeader" }))), h("div", { id: "modal-footer", part: "modal-footer" }, h("slot", { name: "footer" })), h("div", { id: "modal-footer-expanded", class: { 'expanded': true, 'no-opacity': true }, part: "modal-footer-expanded" }, h("slot", { name: "footerExpandedFooter" }))));
3321
+ }
3322
+ render() {
3323
+ if (this.noOverlay) {
3324
+ return h(Host, null, this.Modal);
3325
+ }
3326
+ return (h(Host, { class: { 'include-mobile-styling': true } }, h("cpsl-overlay", { id: "overlay", open: this.open, enterTransitionDuration: this.enterTransitionDuration, exitTransitionDuration: this.exitTransitionDuration }), h("div", { id: "modal-wrapper", class: "modal-wrapper" }, this.Modal)));
3327
+ }
3328
+ get el() { return getElement(this); }
3329
+ static get watchers() { return {
3330
+ "footerExpanded": ["toggleHeight"],
3331
+ "open": ["toggleModal"]
3332
+ }; }
3333
+ };
3334
+ CpslModal.style = cpslModalCss;
3335
+
3336
+ export { CpslModal as cpsl_modal };
3337
+
3338
+ //# sourceMappingURL=cpsl-modal.entry.js.map