j1-template 2024.3.13 → 2024.3.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/content_generator_news_panel_posts.html +1 -1
  3. data/_includes/themes/j1/layouts/layout_resource_generator.html +1 -4
  4. data/_includes/themes/j1/procedures/blocks/footer/boxes/social_media_icons.proc +24 -23
  5. data/_includes/themes/j1/procedures/layouts/content_writer.proc +4 -3
  6. data/_includes/themes/j1/procedures/layouts/default_writer.proc +37 -6
  7. data/_includes/themes/j1/procedures/layouts/module_writer.proc +31 -95
  8. data/_includes/themes/j1/procedures/layouts/resource_writer.proc +51 -29
  9. data/assets/data/amplitude.28.html +887 -0
  10. data/assets/data/amplitude.29.html +923 -0
  11. data/assets/data/amplitude.html +311 -46
  12. data/assets/data/banner.html +9 -7
  13. data/assets/data/masterslider.html +128 -7
  14. data/assets/data/panel.html +16 -65
  15. data/assets/theme/j1/adapter/js/amplitude.23.js +1165 -0
  16. data/assets/theme/j1/adapter/js/amplitude.24.js +1164 -0
  17. data/assets/theme/j1/adapter/js/amplitude.25.js +1268 -0
  18. data/assets/theme/j1/adapter/js/amplitude.js +294 -117
  19. data/assets/theme/j1/adapter/js/attic.js +14 -11
  20. data/assets/theme/j1/adapter/js/docsearch.js +2 -2
  21. data/assets/theme/j1/adapter/js/fab.js +2 -2
  22. data/assets/theme/j1/adapter/js/j1.js +8 -8
  23. data/assets/theme/j1/adapter/js/lazyLoader.js +60 -10
  24. data/assets/theme/j1/adapter/js/masonry.js +1 -1
  25. data/assets/theme/j1/adapter/js/masterslider.js +2 -2
  26. data/assets/theme/j1/adapter/js/particles.js +2 -2
  27. data/assets/theme/j1/adapter/js/scroller.js +2 -2
  28. data/assets/theme/j1/adapter/js/slick.js +2 -2
  29. data/assets/theme/j1/adapter/js/themes.js +1 -1
  30. data/assets/theme/j1/adapter/js/translator.js +2 -2
  31. data/assets/theme/j1/adapter/js/waves.js +1 -1
  32. data/assets/theme/j1/core/css/animate.css +1634 -1070
  33. data/assets/theme/j1/core/css/animate.css.map +1 -0
  34. data/assets/theme/j1/core/css/animate.min.css +2 -1
  35. data/assets/theme/j1/core/css/animate.min.css.map +1 -0
  36. data/assets/theme/j1/core/css/icon-fonts/fontawesome.css +3060 -1538
  37. data/assets/theme/j1/core/css/icon-fonts/fontawesome.css.map +1 -0
  38. data/assets/theme/j1/core/css/icon-fonts/fontawesome.min.css +2 -1
  39. data/assets/theme/j1/core/css/icon-fonts/fontawesome.min.css.map +1 -0
  40. data/assets/theme/j1/core/css/icon-fonts/iconify.css +2308 -1153
  41. data/assets/theme/j1/core/css/icon-fonts/iconify.css.map +1 -0
  42. data/assets/theme/j1/core/css/icon-fonts/iconify.min.css +2 -1
  43. data/assets/theme/j1/core/css/icon-fonts/iconify.min.css.map +1 -0
  44. data/assets/theme/j1/core/css/icon-fonts/mdi.css +16716 -8423
  45. data/assets/theme/j1/core/css/icon-fonts/mdi.css.map +1 -0
  46. data/assets/theme/j1/core/css/icon-fonts/mdi.min.css +2 -1
  47. data/assets/theme/j1/core/css/icon-fonts/mdi.min.css.map +1 -0
  48. data/assets/theme/j1/core/css/icon-fonts/mdib.css +5554 -2766
  49. data/assets/theme/j1/core/css/icon-fonts/mdib.css.map +1 -0
  50. data/assets/theme/j1/core/css/icon-fonts/mdib.min.css +2 -1
  51. data/assets/theme/j1/core/css/icon-fonts/mdib.min.css.map +1 -0
  52. data/assets/theme/j1/core/css/icon-fonts/mdil.css +742 -441
  53. data/assets/theme/j1/core/css/icon-fonts/mdil.css.map +1 -0
  54. data/assets/theme/j1/core/css/icon-fonts/mdil.min.css +2 -1
  55. data/assets/theme/j1/core/css/icon-fonts/mdil.min.css.map +1 -0
  56. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.css +6552 -3980
  57. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.css.map +1 -0
  58. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.min.css +2 -5
  59. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.min.css.map +1 -0
  60. data/assets/theme/j1/core/css/themes/unodark/bootstrap.css +6818 -4131
  61. data/assets/theme/j1/core/css/themes/unodark/bootstrap.css.map +1 -0
  62. data/assets/theme/j1/core/css/themes/unodark/bootstrap.min.css +2 -5
  63. data/assets/theme/j1/core/css/themes/unodark/bootstrap.min.css.map +1 -0
  64. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css +18568 -11577
  65. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css.map +1 -0
  66. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css +2 -35
  67. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css.map +1 -0
  68. data/assets/theme/j1/core/css/vendor.css +1771 -1043
  69. data/assets/theme/j1/core/css/vendor.css.map +1 -0
  70. data/assets/theme/j1/core/css/vendor.min.css +2 -1
  71. data/assets/theme/j1/core/css/vendor.min.css.map +1 -0
  72. data/assets/theme/j1/core/js/template.js +399 -447
  73. data/assets/theme/j1/core/js/template.min.js +7 -7
  74. data/assets/theme/j1/core/js/template.min.js.map +1 -1
  75. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/amplitude.css +4 -2
  76. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.css +39 -4
  77. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.min.css +1 -1
  78. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.css +57 -17
  79. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.min.css +1 -1
  80. data/assets/theme/j1/modules/amplitudejs/icons/player/blue/pause.png +0 -0
  81. data/assets/theme/j1/modules/amplitudejs/icons/player/blue/play.png +0 -0
  82. data/assets/theme/j1/modules/amplitudejs/icons/player/blue/play.svg +87 -0
  83. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-backward.svg +60 -0
  84. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-forward.svg +59 -0
  85. data/assets/theme/j1/modules/amplitudejs/js/amplitude.js +65 -21
  86. data/assets/theme/j1/modules/amplitudejs/js/amplitude.min.js +1 -1
  87. data/assets/theme/j1/modules/amplitudejs/js/tech/ytp.js +113 -0
  88. data/assets/theme/j1/modules/iconPicker/js/universal-icon-picker.js +471 -471
  89. data/assets/theme/j1/modules/j1LazyLoader/LICENSE +21 -0
  90. data/assets/theme/j1/modules/j1LazyLoader/js/j1Lazy.js +870 -0
  91. data/assets/theme/j1/modules/js-cookies/js/js.cookie.js +3 -3
  92. data/assets/theme/j1/modules/lazyCssLoader/js/main.0.js +166 -0
  93. data/assets/theme/j1/modules/lazyCssLoader/js/main.1.js +65 -0
  94. data/assets/theme/j1/modules/lazyCssLoader/js/main.js +66 -0
  95. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/examplePlugin.js +13 -0
  96. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/my-plugin.js +25 -0
  97. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/plugin-interface.js +9 -0
  98. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/pluginA.js +46 -0
  99. data/assets/theme/j1/modules/lazyLoader/js/plugins/README.md +324 -0
  100. data/assets/theme/j1/modules/lazyLoader/js/plugins/jquery.lazy.picture.js +188 -0
  101. data/assets/theme/j1/modules/lightGallery/js/lightgallery.js +1 -1
  102. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.0.js +794 -0
  103. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +151 -67
  104. data/assets/theme/j1/modules/slimSelect/js/select.js +1 -1
  105. data/assets/theme/j1/modules/slimSelect/js/select.min.js +3 -3
  106. data/assets/theme/j1/modules/themeSwitcher/js/switcher.js +2 -1
  107. data/assets/theme/j1/modules/videojs/js/plugins/players/dm/dailymotion.min.js +1 -1
  108. data/assets/theme/j1/modules/videojs/js/plugins/players/dm/icon/scalable/dailymotion.svg +62 -0
  109. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/v3.0.0/youtube.js +832 -0
  110. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/v3.0.0/youtube.min.js +17 -0
  111. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/youtube.min.js +1 -1
  112. data/assets/theme/j1/modules/videojs/js/video.js +2 -2
  113. data/lib/j1/version.rb +1 -1
  114. data/lib/starter_web/README.md +577 -560
  115. data/lib/starter_web/_config.yml +2 -2
  116. data/lib/starter_web/_data/blocks/footer.yml +10 -5
  117. data/lib/starter_web/_data/blocks/panel.yml +2 -2
  118. data/lib/starter_web/_data/layouts/default.yml +14 -3
  119. data/lib/starter_web/_data/modules/amplitude.yml +145 -0
  120. data/lib/starter_web/_data/modules/defaults/amplitude.yml +29 -7
  121. data/lib/starter_web/_data/modules/defaults/lazyLoader.yml +2 -2
  122. data/lib/starter_web/_data/modules/gallery.yml +136 -0
  123. data/lib/starter_web/_data/modules/lazyLoader.0.yml +118 -0
  124. data/lib/starter_web/_data/modules/lazyLoader.yml +68 -31
  125. data/lib/starter_web/_data/modules/masonry.yml +4 -4
  126. data/lib/starter_web/_data/modules/masterslider.yml +118 -12
  127. data/lib/starter_web/_data/modules/navigator_menu.yml +831 -803
  128. data/lib/starter_web/_data/resources.yml +154 -190
  129. data/lib/starter_web/_data/templates/feed.xml +1 -1
  130. data/lib/starter_web/_includes/attributes.asciidoc +1 -0
  131. data/lib/starter_web/_plugins/asciidoctor/amplitude-block.rb +1 -1
  132. data/lib/starter_web/_plugins/asciidoctor/dailymotion-block.rb +1 -1
  133. data/lib/starter_web/_plugins/asciidoctor/gallery-block.rb +4 -2
  134. data/lib/starter_web/_plugins/asciidoctor/masonry-block.rb +1 -1
  135. data/lib/starter_web/_plugins/asciidoctor/videojs-block.rb +58 -46
  136. data/lib/starter_web/_plugins/asciidoctor/vimeo-block.rb +26 -19
  137. data/lib/starter_web/_plugins/asciidoctor/youtube-block.rb +30 -40
  138. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  139. data/lib/starter_web/assets/image/icons/lanus/favicon.ico +0 -0
  140. data/lib/starter_web/assets/image/icons/lanus/lanus-512x512.png +0 -0
  141. data/lib/starter_web/assets/image/icons/lanus/lanus.ico +0 -0
  142. data/lib/starter_web/assets/image/icons/lanus/lanus.png +0 -0
  143. data/lib/starter_web/assets/image/icons/lanus/scalable/lanus.svg +76 -0
  144. data/lib/starter_web/assets/image/icons/lanus/scalable/lanus_sw.svg +62 -0
  145. data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x-28 - social.svg +86 -0
  146. data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x-28.svg +64 -0
  147. data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x.svg +1 -0
  148. data/lib/starter_web/assets/image/modules/icons/social/twitter_x.png +0 -0
  149. data/lib/starter_web/package.json +7 -18
  150. data/lib/starter_web/pages/public/amplitude_yt_tester.adoc +218 -0
  151. data/lib/starter_web/pages/public/features/template.adoc +18 -8
  152. data/lib/starter_web/pages/public/features/template.asciidoc +758 -0
  153. data/lib/starter_web/pages/public/lazy_loader_tester.adoc +402 -0
  154. data/lib/starter_web/pages/public/manuals/ytdl/man.adoc +3020 -0
  155. data/lib/starter_web/pages/public/manuals/ytdl/man.md +2378 -0
  156. data/lib/starter_web/pages/public/tools/previewer/_includes/attributes.asciidoc +0 -16
  157. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/amplitudejs.large.css.asciidoc +505 -0
  158. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.hover.html +69 -0
  159. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.nested.html +75 -0
  160. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.textarea.html +57 -0
  161. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/my.content.html +112 -0
  162. data/lib/starter_web/pages/public/tools/previewer/preview_amplitudejs.adoc +172 -0
  163. data/lib/starter_web/pages/public/tour/_includes/attributes.asciidoc +2 -2
  164. data/lib/starter_web/pages/public/tour/_includes/documents/419_advanced_modals_demo.asciidoc +16 -16
  165. data/lib/starter_web/pages/public/tour/asciidoc_extensions.adoc +13 -3
  166. data/lib/starter_web/pages/public/tour/bootstrap_themes.adoc +12 -3
  167. data/lib/starter_web/pages/public/tour/highlghter_rouge.adoc +13 -3
  168. data/lib/starter_web/pages/public/tour/icon_fonts.adoc +12 -3
  169. data/lib/starter_web/pages/public/tour/modal_extentions.adoc +12 -6
  170. data/lib/starter_web/pages/public/tour/{playback_audio.adoc → play_audio.adoc} +207 -188
  171. data/lib/starter_web/pages/public/tour/{playback_video.adoc → play_video.adoc} +49 -51
  172. data/lib/starter_web/pages/public/tour/present_images.adoc +27 -5
  173. data/lib/starter_web/pages/public/tour/quicksearch.adoc +13 -3
  174. data/lib/starter_web/pages/public/tour/responsive_tables.adoc +13 -4
  175. data/lib/starter_web/pages/public/tour/typography.adoc +12 -3
  176. metadata +90 -22
  177. /data/assets/theme/j1/modules/{lazyLoader → j1LazyLoader/js}/plugins/README.md +0 -0
  178. /data/assets/theme/j1/modules/{lazyLoader/plugins/jquery.lazy.picture.js → j1LazyLoader/js/plugins/picture.js} +0 -0
  179. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.ajax.js +0 -0
  180. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.ajax.min.js +0 -0
  181. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.av.js +0 -0
  182. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.av.min.js +0 -0
  183. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.iframe.js +0 -0
  184. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.iframe.min.js +0 -0
  185. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.noop.js +0 -0
  186. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.noop.min.js +0 -0
  187. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.picture.min.js +0 -0
  188. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.script.js +0 -0
  189. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.script.min.js +0 -0
  190. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.vimeo.js +0 -0
  191. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.vimeo.min.js +0 -0
  192. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.youtube.js +0 -0
  193. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.youtube.min.js +0 -0
@@ -385,75 +385,159 @@
385
385
  this.controlVideo(index, 'pause');
386
386
  };
387
387
 
388
+ // jadams
388
389
  Video.prototype.getVideoHtml = function (src, addClass, index, html5Video) {
389
- var video = '';
390
- var videoInfo = this.core.galleryItems[index].__slideVideoInfo || {};
391
- var currentGalleryItem = this.core.galleryItems[index];
392
- var videoTitle = currentGalleryItem.title || currentGalleryItem.alt;
393
- videoTitle = videoTitle ? 'title="' + videoTitle + '"' : '';
394
- var commonIframeProps = "allowtransparency=\"true\"\n frameborder=\"0\"\n scrolling=\"no\"\n allowfullscreen\n mozallowfullscreen\n webkitallowfullscreen\n msallowfullscreen";
395
- if (videoInfo.youtube) {
396
- var videoId = 'lg-youtube' + index;
397
- var youTubeParams = getYouTubeParams(videoInfo, this.settings.youTubePlayerParams);
398
- var isYouTubeNoCookieURL = isYouTubeNoCookie(src);
399
- var youtubeURL = isYouTubeNoCookieURL
400
- ? '//www.youtube-nocookie.com/'
401
- : '//www.youtube.com/';
402
- video = "<iframe allow=\"autoplay\" id=" + videoId + " class=\"lg-video-object lg-youtube " + addClass + "\" " + videoTitle + " src=\"" + youtubeURL + "embed/" + (videoInfo.youtube[1] + youTubeParams) + "\" " + commonIframeProps + "></iframe>";
403
- }
404
- else if (videoInfo.vimeo) {
405
- var videoId = 'lg-vimeo' + index;
406
- var playerParams = getVimeoURLParams(this.settings.vimeoPlayerParams, videoInfo);
407
- video = "<iframe allow=\"autoplay\" id=" + videoId + " class=\"lg-video-object lg-vimeo " + addClass + "\" " + videoTitle + " src=\"//player.vimeo.com/video/" + (videoInfo.vimeo[1] + playerParams) + "\" " + commonIframeProps + "></iframe>";
408
- }
409
- // jadams: added Wistia Player
410
- else if (videoInfo.wistia) {
411
- var wistiaId = 'lg-wistia' + index;
412
- var playerParams = param(this.settings.wistiaPlayerParams);
413
- playerParams = playerParams ? '?' + playerParams : '';
414
- video = "<iframe allow=\"autoplay\" id=\"" + wistiaId + "\" src=\"//fast.wistia.net/embed/" + videoInfo.wistia[3] + (videoInfo.wistia[4] + playerParams) + "\" " + videoTitle + " class=\"wistia_embed lg-video-object lg-wistia " + addClass + "\" name=\"wistia_embed\" " + commonIframeProps + "></iframe>";
415
- }
416
- // jadams: added Dailymotion Player
417
- else if (videoInfo.dailymotion) {
418
- var dailymotionId = 'lg-dailymotion' + index;
419
- var playerParams = param(this.settings.dailymotionPlayerParams);
420
- playerParams = playerParams ? '?' + playerParams : '';
421
- video = "<iframe allow=\"autoplay\" id=\"" + dailymotionId + "\" src=\"//www.dailymotion.com/embed/video/" + (videoInfo.dailymotion[1] + playerParams) + "\" " + videoTitle + " class=\"dailymotion_embed lg-video-object lg-dailymotion " + addClass + "\" name=\"dailymotion_embed\" " + commonIframeProps + "></iframe>";
422
- }
423
- // jadams, 2024-01-22: added TicToc Player
424
- else if (videoInfo.tiktoc) {
425
- var tictocId = 'lg-tictoc' + index;
426
- var playerParams = getTikTokURLParams(this.settings.TicTocPlayerParams);
427
- video = "<iframe allow=\"autoplay\" id=" + videoId + " class=\"lg-video-object lg-tictoc " + addClass + "\" " + videoTitle + " src=\"//tiktok.com/embed/" + (videoInfo.tiktoc[1]) + "\" " + videoTitle + commonIframeProps + "></iframe>";
428
- }
429
- else if (videoInfo.html5) {
430
- var html5VideoMarkup = '';
431
- for (var i = 0; i < html5Video.source.length; i++) {
432
- html5VideoMarkup += "<source src=\"" + html5Video.source[i].src + "\" type=\"" + html5Video.source[i].type + "\">";
433
- }
434
- if (html5Video.tracks) {
435
- var _loop_1 = function (i) {
436
- var trackAttributes = '';
437
- var track = html5Video.tracks[i];
438
- Object.keys(track || {}).forEach(function (key) {
439
- trackAttributes += key + "=\"" + track[key] + "\" ";
440
- });
441
- html5VideoMarkup += "<track " + trackAttributes + ">";
442
- };
443
- for (var i = 0; i < html5Video.tracks.length; i++) {
444
- _loop_1(i);
445
- }
390
+ var video = '';
391
+ var videoInfo = this.core.galleryItems[index].__slideVideoInfo || {};
392
+ var currentGalleryItem = this.core.galleryItems[index];
393
+ var videoTitle = currentGalleryItem.title || currentGalleryItem.alt;
394
+ videoTitle = videoTitle ? 'title="' + videoTitle + '"' : '';
395
+ var commonIframeProps = "allowtransparency=\"true\"\n frameborder=\"0\"\n scrolling=\"no\"\n allowfullscreen\n mozallowfullscreen\n webkitallowfullscreen\n msallowfullscreen";
396
+
397
+ if (videoInfo.youtube) {
398
+ var videoId = 'lg-youtube' + index;
399
+ var youTubeParams = getYouTubeParams(videoInfo, this.settings.youTubePlayerParams);
400
+ var isYouTubeNoCookieURL = isYouTubeNoCookie(src);
401
+ var youtubeURL = isYouTubeNoCookieURL
402
+ ? '//www.youtube-nocookie.com/'
403
+ : '//www.youtube.com/';
404
+
405
+ // var video = `
406
+ // <video
407
+ // id="${videoId}"
408
+ // class="lg-video-object lg-youtube vjs-theme-uno video-js">
409
+ // data-setup='{
410
+ // "fluid" : true,
411
+ // "techOrder": [
412
+ // "youtube", "html5"
413
+ // ],
414
+ // "sources": [{
415
+ // "type": "video/youtube",
416
+ // "src": "//youtube.com/watch?v=nV8UZJNBY6"
417
+ // }],
418
+ // "controlBar": {
419
+ // "pictureInPictureToggle": false,
420
+ // "volumePanel": {
421
+ // "inline": false
422
+ // }
423
+ // }
424
+ // }'>
425
+ // Your browser does not support HTML5 video
426
+ // </video>
427
+ // `;
428
+
429
+ var video_new = `
430
+ <iframe
431
+ id="${videoId}"
432
+ class="lg-video-object lg-youtube ${addClass}"
433
+ allow="autoplay"
434
+ title="${videoTitle}""
435
+ src="${youtubeURL}/embed${videoInfo.youtube[1]}${youTubeParams}"
436
+ ${commonIframeProps}>
437
+ </iframe>
438
+ `;
439
+
440
+ video = "<iframe allow=\"autoplay\" id=" + videoId + " class=\"lg-video-object lg-youtube " + addClass + "\" " + videoTitle + " src=\"" + youtubeURL + "embed/" + (videoInfo.youtube[1] + youTubeParams) + "\" " + commonIframeProps + "></iframe>";
441
+
442
+ }
443
+ else if (videoInfo.vimeo) {
444
+ var videoId = 'lg-vimeo' + index;
445
+ var playerParams = getVimeoURLParams(this.settings.vimeoPlayerParams, videoInfo);
446
+
447
+ video = "<iframe allow=\"autoplay\" id=" + videoId + " class=\"lg-video-object lg-vimeo " + addClass + "\" " + videoTitle + " src=\"//player.vimeo.com/video/" + (videoInfo.vimeo[1] + playerParams) + "\" " + commonIframeProps + "></iframe>";
448
+ }
449
+ // jadams: added Wistia Player
450
+ else if (videoInfo.wistia) {
451
+ var wistiaId = 'lg-wistia' + index;
452
+ var playerParams = param(this.settings.wistiaPlayerParams);
453
+ playerParams = playerParams ? '?' + playerParams : '';
454
+
455
+ video = "<iframe allow=\"autoplay\" id=\"" + wistiaId + "\" src=\"//fast.wistia.net/embed/" + videoInfo.wistia[3] + (videoInfo.wistia[4] + playerParams) + "\" " + videoTitle + " class=\"wistia_embed lg-video-object lg-wistia " + addClass + "\" name=\"wistia_embed\" " + commonIframeProps + "></iframe>";
456
+ }
457
+ // jadams: added Dailymotion Player
458
+ else if (videoInfo.dailymotion) {
459
+ var dailymotionId = 'lg-dailymotion' + index;
460
+ var playerParams = param(this.settings.dailymotionPlayerParams);
461
+ playerParams = playerParams ? '?' + playerParams : '';
462
+
463
+ video = "<iframe allow=\"autoplay\" id=\"" + dailymotionId + "\" src=\"//www.dailymotion.com/embed/video/" + (videoInfo.dailymotion[1] + playerParams) + "\" " + videoTitle + " class=\"dailymotion_embed lg-video-object lg-dailymotion " + addClass + "\" name=\"dailymotion_embed\" " + commonIframeProps + "></iframe>";
464
+ }
465
+ // jadams, 2024-01-22: added TicToc Player
466
+ else if (videoInfo.tiktoc) {
467
+ var tictocId = 'lg-tictoc' + index;
468
+ var playerParams = getTikTokURLParams(this.settings.TicTocPlayerParams);
469
+
470
+ video = "<iframe allow=\"autoplay\" id=" + videoId + " class=\"lg-video-object lg-tictoc " + addClass + "\" " + videoTitle + " src=\"//tiktok.com/embed/" + (videoInfo.tiktoc[1]) + "\" " + videoTitle + commonIframeProps + "></iframe>";
471
+ }
472
+ else if (videoInfo.html5) {
473
+ var html5VideoMarkup = '';
474
+ for (var i = 0; i < html5Video.source.length; i++) {
475
+ html5VideoMarkup += "<source src=\"" + html5Video.source[i].src + "\" type=\"" + html5Video.source[i].type + "\">";
476
+ }
477
+ if (html5Video.tracks) {
478
+ var _loop_1 = function (i) {
479
+ var trackAttributes = '';
480
+ var track = html5Video.tracks[i];
481
+ Object.keys(track || {}).forEach(function (key) {
482
+ trackAttributes += key + "=\"" + track[key] + "\" ";
483
+ });
484
+ html5VideoMarkup += "<track " + trackAttributes + ">";
485
+ };
486
+ for (var i = 0; i < html5Video.tracks.length; i++) {
487
+ _loop_1(i);
446
488
  }
447
- var html5VideoAttrs_1 = '';
448
- var videoAttributes_1 = html5Video.attributes || {};
449
- Object.keys(videoAttributes_1 || {}).forEach(function (key) {
450
- html5VideoAttrs_1 += key + "=\"" + videoAttributes_1[key] + "\" ";
451
- });
452
- video = "<video class=\"lg-video-object lg-html5 " + (this.settings.videojs && this.settings.videojsTheme
453
- ? this.settings.videojsTheme + ' '
454
- : '') + " " + (this.settings.videojs ? ' video-js' : '') + "\" " + html5VideoAttrs_1 + ">\n " + html5VideoMarkup + "\n Your browser does not support HTML5 video.\n </video>";
455
- }
456
- return video;
489
+ }
490
+
491
+ var html5VideoAttrs_1 = '';
492
+ var videoAttributes_1 = html5Video.attributes || {};
493
+ var html5VideoAttrs = html5VideoAttrs_1;
494
+
495
+ Object.keys(videoAttributes_1 || {}).forEach(function (key) {
496
+ html5VideoAttrs_1 += key + "=\"" + videoAttributes_1[key] + "\" ";
497
+ });
498
+
499
+ var videojsTheme = (this.settings.videojsTheme) ? this.settings.videojsTheme : '';
500
+ var videojsSettings = (this.settings.videojs) ? 'video-js' : '';
501
+
502
+ // jadams: template string
503
+ video = `
504
+ <video class="lg-video-object lg-html5 ${videojsTheme} ${videojsSettings} " ${html5VideoAttrs}>
505
+ ${html5VideoMarkup}
506
+ Your browser does not support HTML5 video.
507
+ </video>
508
+ `;
509
+
510
+ // var video = `
511
+ // <video
512
+ // id="${videoId}"
513
+ // class="lg-video-object lg-youtube vjs-theme-uno video-js">
514
+ // data-setup='{
515
+ // "fluid" : true,
516
+ // "techOrder": [
517
+ // "youtube", "html5"
518
+ // ],
519
+ // "sources": [{
520
+ // "type": "video/youtube",
521
+ // "src": "//youtube.com/watch?v=nV8UZJNBY6"
522
+ // }],
523
+ // "controlBar": {
524
+ // "pictureInPictureToggle": false,
525
+ // "volumePanel": {
526
+ // "inline": false
527
+ // }
528
+ // }
529
+ // }'>
530
+ // Your browser does not support HTML5 video
531
+ // </video>
532
+ // `;
533
+
534
+ // video = "<video class=\"lg-video-object lg-html5 " + (this.settings.videojs && this.settings.videojsTheme
535
+ // ? this.settings.videojsTheme + ' '
536
+ // : '') + " " + (this.settings.videojs ? ' video-js' : '') + "\" " + html5VideoAttrs_1 + ">\n " + html5VideoMarkup + "\n Your browser does not support HTML5 video.\n </video>";
537
+
538
+ }
539
+
540
+ return video;
457
541
  };
458
542
 
459
543
  /**
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Licensed MIT © Brian Voelker
6
6
  * https://github.com/brianvoe/slim-select/blob/master/LICENSE
7
- */
7
+ */
8
8
 
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -1,9 +1,9 @@
1
- /*!
1
+ /*
2
2
  * slim-select.js v2.5.1
3
3
  * https://github.com/brianvoe/slim-select/tree/master
4
4
  *
5
5
  * Licensed MIT © Brian Voelker
6
6
  * https://github.com/brianvoe/slim-select/blob/master/LICENSE
7
- */
7
+ */
8
8
 
9
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SlimSelect=t()}(this,(function(){"use strict";function e(){return Math.random().toString(36).substring(2,10)}function t(e,t=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||e.apply(a,n)}),t),l&&e.apply(a,n)}}function s(e,t){return JSON.stringify(e)===JSON.stringify(t)}class i{constructor(t){if(this.id=t.id&&""!==t.id?t.id:e(),this.label=t.label||"",this.selectAll=void 0!==t.selectAll&&t.selectAll,this.selectAllText=t.selectAllText||"Select All",this.closable=t.closable||"off",this.options=[],t.options)for(const e of t.options)this.options.push(new n(e))}}class n{constructor(t){this.id=t.id&&""!==t.id?t.id:e(),this.value=void 0===t.value?t.text:t.value,this.text=t.text||"",this.html=t.html||"",this.selected=void 0!==t.selected&&t.selected,this.display=void 0===t.display||t.display,this.disabled=void 0!==t.disabled&&t.disabled,this.mandatory=void 0!==t.mandatory&&t.mandatory,this.placeholder=void 0!==t.placeholder&&t.placeholder,this.class=t.class||"",this.style=t.style||"",this.data=t.data||{}}}class a{constructor(e,t){this.selectType="single",this.data=[],this.selectType=e,this.setData(t)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let t of e){if(!(t instanceof i||"label"in t))return t instanceof n||"text"in t?this.validateOption(t):new Error("Data object must be a valid optgroup or option");if(!("label"in t))return new Error("Optgroup must have a label");if("options"in t&&t.options)for(let e of t.options)return this.validateOption(e)}return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let t=[];return e.forEach((e=>{if(e instanceof i||"label"in e){let s=[];"options"in e&&e.options&&e.options.forEach((e=>{s.push(new n(e))})),s.length>0&&t.push(new i(e))}(e instanceof n||"text"in e)&&t.push(new n(e))})),t}setData(e){this.data=this.partialToFullData(e),"single"===this.selectType&&this.setSelectedBy("value",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e){this.setData(this.getData().concat(new n(e)))}setSelectedBy(e,t){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&t.includes(i[e]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&t.includes(l[e]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){let e=this.getSelectedOptions(),t=[];return e.forEach((e=>{t.push(e.value)})),t}getSelectedOptions(){return this.filter((e=>e.selected),!1)}getSelectedIDs(){let e=this.getSelectedOptions(),t=[];return e.forEach((e=>{t.push(e.id)})),t}getOptgroupByID(e){for(let t of this.data)if(t instanceof i&&t.id===e)return t;return null}getOptionByID(e){let t=this.filter((t=>t.id===e),!1);return t.length?t[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let t of this.data)if(t instanceof i?e=t.options[0]:t instanceof n&&(e=t),e)break;return e}search(e,t){return""===(e=e.trim())?this.getData():this.filter((s=>t(s,e)),!0)}filter(e,t){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{e&&!e(i)||(t?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let e=new i(a);e.options=l,s.push(e)}}a instanceof n&&(e&&!e(a)||s.push(new n(a)))})),s}}class l{constructor(e,t,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=t,this.settings=e,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const e=this.store.getSelectedOptions();if(e.length){const t=e[e.length-1].id,s=this.content.list.querySelector('[data-id="'+t+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const e of this.settings.class)""!==e.trim()&&(this.main.main.classList.add(e.trim()),this.content.main.classList.add(e.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox")}mainDiv(){var e;const t=document.createElement("div");t.dataset.id=this.settings.id,t.setAttribute("aria-label",this.settings.ariaLabel),t.tabIndex=0,t.onkeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===e.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const t=this.content.list.querySelector("."+this.classes.highlighted);return t&&t.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},t.onclick=e=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(e=this.store)||void 0===e?void 0:e.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=e=>{if(e.stopPropagation(),this.settings.disabled)return;let t=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(t=!0===this.callbacks.beforeChange(i,s)),t){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const e=this.store.getFirstOption(),t=e?e.value:"";this.callbacks.setSelected(t,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),t.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),t.appendChild(o),{main:t,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(e){"click"!==e&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter((e=>e.placeholder),!1);let t=this.settings.placeholderText;e.length&&(""!==e[0].html?t=e[0].html:""!==e[0].text&&(t=e[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=t,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const e=this.store.filter((e=>e.selected&&!e.placeholder),!1),t=e.length>0?e[0]:null;if(t){const e=document.createElement("div");e.classList.add(this.classes.single),t.html?e.innerHTML=t.html:e.innerText=t.text,this.main.values.innerHTML=e.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&e.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,t=this.store.filter((e=>e.selected&&e.display),!1);if(0===t.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const e=this.main.values.querySelector("."+this.classes.placeholder);e&&e.remove()}if(t.length>this.settings.maxValuesShown){const e=document.createElement("div");return e.classList.add(this.classes.max),e.textContent=this.settings.maxValuesMessage.replace("{number}",t.length.toString()),void(this.main.values.innerHTML=e.outerHTML)}{const e=this.main.values.querySelector("."+this.classes.max);e&&e.remove()}let s=[];for(let i=0;i<e.length;i++){const n=e[i],a=n.getAttribute("data-id");if(a){t.filter((e=>e.id===a),!1).length||s.push(n)}}for(const e of s)e.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(e)&&this.main.values.removeChild(e)}),100);e=this.main.values.childNodes;for(let s=0;s<t.length;s++){let i=!0;for(let n=0;n<e.length;n++)t[s].id===String(e[n].dataset.id)&&(i=!1);i&&(this.settings.keepOrder||0===e.length?this.main.values.appendChild(this.multipleValue(t[s])):0===s?this.main.values.insertBefore(this.multipleValue(t[s]),e[s]):e[s-1].insertAdjacentElement("afterend",this.multipleValue(t[s])))}}multipleValue(e){const t=document.createElement("div");t.classList.add(this.classes.value),t.dataset.id=e.id;const s=document.createElement("div");if(s.classList.add(this.classes.valueText),s.innerText=e.text,t.appendChild(s),!e.mandatory){const s=document.createElement("div");s.classList.add(this.classes.valueDelete),s.onclick=t=>{if(t.preventDefault(),t.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((t=>t.selected&&t.id!==e.id),!0);if(!(this.settings.minSelected&&l.length<this.settings.minSelected)&&(this.callbacks.beforeChange&&(s=!0===this.callbacks.beforeChange(l,a)),s)){let e=[];for(const t of l){if(t instanceof i)for(const s of t.options)e.push(s.value);t instanceof n&&e.push(t.value)}this.callbacks.setSelected(e,!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(l),this.updateDeselectAll()}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optionDelete),a.appendChild(l),s.appendChild(a),t.appendChild(s)}return t}contentDiv(){const e=document.createElement("div");e.dataset.id=this.settings.id;const t=this.searchDiv();e.appendChild(t.main);const s=this.listDiv();return e.appendChild(s),{main:e,search:t,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),i=document.createElement("div");e.classList.add(this.classes.search);const a={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,s.setAttribute("aria-label",this.settings.searchPlaceholder),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=t((e=>{this.callbacks.search(e.target.value)}),100),s.onkeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===e.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&e.ctrlKey)return i.click(),!1;{const e=this.content.list.querySelector("."+this.classes.highlighted);if(e)return e.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),t.appendChild(s),i.appendChild(t),i.onclick=e=>{if(e.preventDefault(),e.stopPropagation(),!this.callbacks.addable)return;const t=this.content.search.input.value.trim();if(""===t)return void this.content.search.input.focus();const s=e=>{let t=new n(e);if(this.callbacks.addOption(t),this.settings.isMultiple){let e=this.store.getSelected();e.push(t.value),this.callbacks.setSelected(e,!0)}else this.callbacks.setSelected([t.value],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(t);!1!==i&&null!=i&&(i instanceof Promise?i.then((e=>{s("string"==typeof e?{text:e,value:e}:e)})):s("string"==typeof i?{text:i,value:i}:i))},e.appendChild(i),a.addable={main:i,svg:t,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,t=!1,s=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),t&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const t=this.getOptions(!0,!0,!0);if(0===t.length)return;if(1===t.length&&!t[0].classList.contains(this.classes.highlighted))return void t[0].classList.add(this.classes.highlighted);let s=!1;for(const e of t)e.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const e of t)if(e.classList.contains(this.classes.selected)){e.classList.add(this.classes.highlighted);break}for(let s=0;s<t.length;s++)if(t[s].classList.contains(this.classes.highlighted)){const i=t[s];i.classList.remove(this.classes.highlighted);const n=i.parentElement;if(n&&n.classList.contains(this.classes.open)){const e=n.querySelector("."+this.classes.optgroupLabel);e&&e.click()}let a=t["down"===e?s+1<t.length?s+1:0:s-1>=0?s-1:t.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const e=l.querySelector("."+this.classes.optgroupLabel);e&&e.click()}return}t["down"===e?0:t.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,t["down"===e?0:t.length-1])}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.error),t.textContent=e,this.content.list.appendChild(t)}renderSearching(){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e)}renderOptions(e){if(this.content.list.innerHTML="",0===e.length){const e=document.createElement("div");return e.classList.add(this.classes.search),e.innerHTML=this.settings.searchText,void this.content.list.appendChild(e)}for(const t of e){if(t instanceof i){const e=document.createElement("div");e.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=t.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&t.selectAll){const e=document.createElement("div");e.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const e of t.options)if(!e.selected){s=!1;break}s&&e.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=t.selectAllText,e.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),e.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const i=this.store.getSelected();if(s){const e=i.filter((e=>{for(const s of t.options)if(e===s.value)return!1;return!0}));this.callbacks.setSelected(e,!0)}else{const e=i.concat(t.options.map((e=>e.value)));for(const e of t.options)this.store.getOptionByID(e.id)||this.callbacks.addOption(e);this.callbacks.setSelected(e,!0)}})),n.appendChild(e)}if("off"!==t.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),t.options.some((e=>e.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===t.closable?(e.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===t.closable&&(e.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e.classList.contains(this.classes.close)?(e.classList.remove(this.classes.close),e.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(e.classList.remove(this.classes.open),e.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}e.appendChild(s);for(const s of t.options)e.appendChild(this.option(s));this.content.list.appendChild(e)}t instanceof n&&this.content.list.appendChild(this.option(t))}}option(e){if(e.placeholder){const e=document.createElement("div");return e.classList.add(this.classes.option),e.classList.add(this.classes.hide),e}const t=document.createElement("div");return t.dataset.id=e.id,t.id=e.id,t.classList.add(this.classes.option),t.setAttribute("role","option"),e.class&&e.class.split(" ").forEach((e=>{t.classList.add(e)})),e.style&&(t.style.cssText=e.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?t.innerHTML=this.highlightText(""!==e.html?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):""!==e.html?t.innerHTML=e.html:t.textContent=e.text,this.settings.showOptionTooltips&&t.textContent&&t.setAttribute("title",t.textContent),e.display||t.classList.add(this.classes.hide),e.disabled&&t.classList.add(this.classes.disabled),e.selected&&this.settings.hideSelected&&t.classList.add(this.classes.hide),e.selected?(t.classList.add(this.classes.selected),t.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",t.id)):(t.classList.remove(this.classes.selected),t.setAttribute("aria-selected","false")),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const s=this.store.getSelected(),i=t.currentTarget,n=String(i.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&e.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=e.selected?l.filter((e=>e.id!==n)):l.concat(e)),this.settings.isMultiple||(o=e.selected?[]:[e]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(e),this.callbacks.setSelected(o.map((e=>e.value)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),t}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,t,s){let i=e;const n=new RegExp("("+t.trim()+")(?![^<]*>[^<>]*</)","i");if(!e.match(n))return e;const a=e.match(n).index,l=a+e.match(n)[0].toString().length,o=e.substring(a,l);return i=i.replace(n,`<mark class="${s}">${o}</mark>`),i}moveContentAbove(){const e=this.main.main.offsetHeight,t=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+t-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const e=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=e.top+e.height+window.scrollY+"px",this.content.main.style.left=e.left+window.scrollX+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,t){const s=e.scrollTop+e.offsetTop,i=s+e.clientHeight,n=t.offsetTop,a=n+t.clientHeight;n<s?e.scrollTop-=s-n:a>i&&(e.scrollTop+=a-i)}putContent(){const e=this.main.main.offsetHeight,t=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(t.top+e)<=s&&t.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),t=e&&e.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!t?n.classList.add(a):n.classList.remove(a)}}class o{constructor(e){this.listen=!1,this.observer=null,this.select=e,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(e){this.listen=e,e&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),e||this.observer&&this.observer.disconnect()}valueChange(e){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedValues()),!0}observeCall(e){if(!this.listen)return;let t=!1,s=!1,i=!1;for(const n of e)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(t=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);t&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let e=[];const t=this.select.childNodes;for(const s of t)"OPTGROUP"===s.nodeName&&e.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&e.push(this.getDataFromOption(s));return e}getDataFromOptgroup(e){let t={id:e.id,label:e.label,selectAll:!!e.dataset&&"true"===e.dataset.selectall,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const s=e.childNodes;for(const e of s)"OPTION"===e.nodeName&&t.options.push(this.getDataFromOption(e));return t}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",selected:e.selected,display:"none"!==e.style.display,disabled:e.disabled,mandatory:!!e.dataset&&"true"===e.dataset.mandatory,placeholder:"true"===e.dataset.placeholder,class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedValues(){let e=[];const t=this.select.childNodes;for(const s of t){if("OPTGROUP"===s.nodeName){const t=s.childNodes;for(const s of t)if("OPTION"===s.nodeName){const t=s;t.selected&&e.push(t.value)}}if("OPTION"===s.nodeName){const t=s;t.selected&&e.push(t.value)}}return e}setSelected(e){this.changeListen(!1);const t=this.select.childNodes;for(const s of t){if("OPTGROUP"===s.nodeName){const t=s.childNodes;for(const s of t)if("OPTION"===s.nodeName){const t=s;t.selected=e.includes(t.value)}}if("OPTION"===s.nodeName){const t=s;t.selected=e.includes(t.value)}}this.changeListen(!0)}updateSelect(e,t,s){this.changeListen(!1),e&&(this.select.dataset.id=e),t&&(this.select.style.cssText=t),s&&(this.select.className="",s.forEach((e=>{""!==e.trim()&&this.select.classList.add(e.trim())}))),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const t of e)t instanceof i&&this.select.appendChild(this.createOptgroup(t)),t instanceof n&&this.select.appendChild(this.createOption(t));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(e){const t=document.createElement("optgroup");if(t.id=e.id,t.label=e.label,e.selectAll&&(t.dataset.selectAll="true"),"off"!==e.closable&&(t.dataset.closable=e.closable),e.options)for(const s of e.options)t.appendChild(this.createOption(s));return t}createOption(e){const t=document.createElement("option");return t.id=e.id,t.value=e.value,t.innerHTML=e.text,""!==e.html&&t.setAttribute("data-html",e.html),e.selected&&(t.selected=e.selected),e.disabled&&(t.disabled=!0),!1===e.display&&(t.style.display="none"),e.placeholder&&t.setAttribute("data-placeholder","true"),e.mandatory&&t.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach((e=>{t.classList.add(e)})),e.data&&"object"==typeof e.data&&Object.keys(e.data).forEach((s=>{t.setAttribute("data-"+function(e){const t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(e=>"-"+e.toLowerCase()));return e[0]===e[0].toUpperCase()?t.substring(1):t}(s),e.data[s])})),t}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(t){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,t||(t={}),this.id="ss-"+e(),this.style=t.style||"",this.class=t.class||[],this.disabled=void 0!==t.disabled&&t.disabled,this.alwaysOpen=void 0!==t.alwaysOpen&&t.alwaysOpen,this.showSearch=void 0===t.showSearch||t.showSearch,this.ariaLabel=t.ariaLabel||"Combobox",this.searchPlaceholder=t.searchPlaceholder||"Search",this.searchText=t.searchText||"No Results",this.searchingText=t.searchingText||"Searching...",this.searchHighlight=void 0!==t.searchHighlight&&t.searchHighlight,this.closeOnSelect=void 0===t.closeOnSelect||t.closeOnSelect,this.contentLocation=t.contentLocation||document.body,this.contentPosition=t.contentPosition||"absolute",this.openPosition=t.openPosition||"auto",this.placeholderText=void 0!==t.placeholderText?t.placeholderText:"Select Value",this.allowDeselect=void 0!==t.allowDeselect&&t.allowDeselect,this.hideSelected=void 0!==t.hideSelected&&t.hideSelected,this.keepOrder=void 0!==t.keepOrder&&t.keepOrder,this.showOptionTooltips=void 0!==t.showOptionTooltips&&t.showOptionTooltips,this.minSelected=t.minSelected||0,this.maxSelected=t.maxSelected||1e3,this.timeoutDelay=t.timeoutDelay||200,this.maxValuesShown=t.maxValuesShown||20,this.maxValuesMessage=t.maxValuesMessage||"{number} selected"}}return class{constructor(e){var s;if(this.events={search:void 0,searchFilter:(e,t)=>-1!==e.text.toLowerCase().indexOf(t.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=t((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=t((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=e=>{this.settings.isOpen&&e.target&&!function(e,t){function s(e,s){return s&&e&&e.classList&&e.classList.contains(s)||s&&e&&e.dataset&&e.dataset.id&&e.dataset.id===t?e:null}return s(e,t)||function e(t,i){return t&&t!==document?s(t,i)?t:e(t.parentNode,i):null}(e,t)}(e.target,this.settings.id)&&this.close(e.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof e.select?document.querySelector(e.select):e.select,!this.selectEl)return void(e.events&&e.events.error&&e.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(e.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in e.events)e.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=t(e.events[s],100):this.events[s]=e.events[s]);this.settings.disabled=(null===(s=e.settings)||void 0===s?void 0:s.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=e=>{this.setSelected(e)},this.select.onClassChange=e=>{this.settings.class=e,this.render.updateClassStyles()},this.select.onDisabledChange=e=>{e?this.disable():this.enable()},this.select.onOptionsChange=e=>{this.setData(e)},this.store=new a(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(e){const t=this.store.getSelected(),i=this.store.validateDataArray(e);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(e,t=!0){const i=this.store.getSelected();this.store.setSelectedBy("value",Array.isArray(e)?e:[e]);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(n),t&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const t=this.store.getSelected();this.store.getDataOptions().some((t=>{var s;return t.value===(null!==(s=e.value)&&void 0!==s?s:e.text)}))||this.store.addOption(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(e=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(e),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(e){if(this.render.content.search.input.value!==e&&(this.render.content.search.input.value=e),!this.events.search)return void this.render.renderOptions(""===e?this.store.getData():this.store.search(e,this.events.searchFilter));this.render.renderSearching();const t=this.events.search(e,this.store.getSelectedOptions());t instanceof Promise?t.then((e=>{this.render.renderOptions(this.store.partialToFullData(e))})).catch((e=>{this.render.renderError("string"==typeof e?e:e.message)})):Array.isArray(t)?this.render.renderOptions(this.store.partialToFullData(t)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}}));
9
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SlimSelect=t()}(this,(function(){"use strict";function e(){return Math.random().toString(36).substring(2,10)}function t(e,t=50,s=!1){let i;return function(...n){const a=self,l=s&&!i;clearTimeout(i),i=setTimeout((()=>{i=null,s||e.apply(a,n)}),t),l&&e.apply(a,n)}}function s(e,t){return JSON.stringify(e)===JSON.stringify(t)}class i{constructor(t){if(this.id=t.id&&""!==t.id?t.id:e(),this.label=t.label||"",this.selectAll=void 0!==t.selectAll&&t.selectAll,this.selectAllText=t.selectAllText||"Select All",this.closable=t.closable||"off",this.options=[],t.options)for(const e of t.options)this.options.push(new n(e))}}class n{constructor(t){this.id=t.id&&""!==t.id?t.id:e(),this.value=void 0===t.value?t.text:t.value,this.text=t.text||"",this.html=t.html||"",this.selected=void 0!==t.selected&&t.selected,this.display=void 0===t.display||t.display,this.disabled=void 0!==t.disabled&&t.disabled,this.mandatory=void 0!==t.mandatory&&t.mandatory,this.placeholder=void 0!==t.placeholder&&t.placeholder,this.class=t.class||"",this.style=t.style||"",this.data=t.data||{}}}class a{constructor(e,t){this.selectType="single",this.data=[],this.selectType=e,this.setData(t)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let t of e){if(!(t instanceof i||"label"in t))return t instanceof n||"text"in t?this.validateOption(t):new Error("Data object must be a valid optgroup or option");if(!("label"in t))return new Error("Optgroup must have a label");if("options"in t&&t.options)for(let e of t.options)return this.validateOption(e)}return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let t=[];return e.forEach((e=>{if(e instanceof i||"label"in e){let s=[];"options"in e&&e.options&&e.options.forEach((e=>{s.push(new n(e))})),s.length>0&&t.push(new i(e))}(e instanceof n||"text"in e)&&t.push(new n(e))})),t}setData(e){this.data=this.partialToFullData(e),"single"===this.selectType&&this.setSelectedBy("value",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e){this.setData(this.getData().concat(new n(e)))}setSelectedBy(e,t){let s=null,a=!1;for(let l of this.data){if(l instanceof i)for(let i of l.options)s||(s=i),i.selected=!a&&t.includes(i[e]),i.selected&&"single"===this.selectType&&(a=!0);l instanceof n&&(s||(s=l),l.selected=!a&&t.includes(l[e]),l.selected&&"single"===this.selectType&&(a=!0))}"single"===this.selectType&&s&&!a&&(s.selected=!0)}getSelected(){let e=this.getSelectedOptions(),t=[];return e.forEach((e=>{t.push(e.value)})),t}getSelectedOptions(){return this.filter((e=>e.selected),!1)}getSelectedIDs(){let e=this.getSelectedOptions(),t=[];return e.forEach((e=>{t.push(e.id)})),t}getOptgroupByID(e){for(let t of this.data)if(t instanceof i&&t.id===e)return t;return null}getOptionByID(e){let t=this.filter((t=>t.id===e),!1);return t.length?t[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let t of this.data)if(t instanceof i?e=t.options[0]:t instanceof n&&(e=t),e)break;return e}search(e,t){return""===(e=e.trim())?this.getData():this.filter((s=>t(s,e)),!0)}filter(e,t){const s=[];return this.data.forEach((a=>{if(a instanceof i){let l=[];if(a.options.forEach((i=>{e&&!e(i)||(t?l.push(new n(i)):s.push(new n(i)))})),l.length>0){let e=new i(a);e.options=l,s.push(e)}}a instanceof n&&(e&&!e(a)||s.push(new n(a)))})),s}}class l{constructor(e,t,s){this.classes={main:"ss-main",placeholder:"ss-placeholder",values:"ss-values",single:"ss-single",max:"ss-max",value:"ss-value",valueText:"ss-value-text",valueDelete:"ss-value-delete",valueOut:"ss-value-out",deselect:"ss-deselect",deselectPath:"M10,10 L90,90 M10,90 L90,10",arrow:"ss-arrow",arrowClose:"M10,30 L50,70 L90,30",arrowOpen:"M10,70 L50,30 L90,70",content:"ss-content",openAbove:"ss-open-above",openBelow:"ss-open-below",search:"ss-search",searchHighlighter:"ss-search-highlight",searching:"ss-searching",addable:"ss-addable",addablePath:"M50,10 L50,90 M10,50 L90,50",list:"ss-list",optgroup:"ss-optgroup",optgroupLabel:"ss-optgroup-label",optgroupLabelText:"ss-optgroup-label-text",optgroupActions:"ss-optgroup-actions",optgroupSelectAll:"ss-selectall",optgroupSelectAllBox:"M60,10 L10,10 L10,90 L90,90 L90,50",optgroupSelectAllCheck:"M30,45 L50,70 L90,10",optgroupClosable:"ss-closable",option:"ss-option",optionDelete:"M10,10 L90,90 M10,90 L90,10",highlighted:"ss-highlighted",open:"ss-open",close:"ss-close",selected:"ss-selected",error:"ss-error",disabled:"ss-disabled",hide:"ss-hide"},this.store=t,this.settings=e,this.callbacks=s,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.classList.add("up"===this.settings.openPosition?this.classes.openAbove:this.classes.openBelow),this.main.main.setAttribute("aria-expanded","true"),this.moveContent();const e=this.store.getSelectedOptions();if(e.length){const t=e[e.length-1].id,s=this.content.list.querySelector('[data-id="'+t+'"]');s&&this.ensureElementInView(this.content.list,s)}}close(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.remove(this.classes.openBelow),this.main.main.setAttribute("aria-expanded","false"),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.main.arrow.path.setAttribute("d",this.classes.arrowClose)}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),""!==this.settings.style&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const e of this.settings.class)""!==e.trim()&&(this.main.main.classList.add(e.trim()),this.content.main.classList.add(e.trim()));"relative"===this.settings.contentPosition&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",this.content.main.id),this.main.main.setAttribute("aria-expanded","false"),this.content.main.setAttribute("role","listbox"),this.content.main.setAttribute("aria-label","listbox")}mainDiv(){var e;const t=document.createElement("div");t.dataset.id=this.settings.id,t.setAttribute("aria-label",this.settings.ariaLabel),t.tabIndex=0,t.onkeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),"ArrowDown"===e.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const t=this.content.list.querySelector("."+this.classes.highlighted);return t&&t.click(),!1;case"Escape":return this.callbacks.close(),!1}return!1},t.onclick=e=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const s=document.createElement("div");s.classList.add(this.classes.values),t.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.deselect);const n=null===(e=this.store)||void 0===e?void 0:e.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&n&&n.length<=0?i.classList.add(this.classes.hide):i.classList.remove(this.classes.hide),i.onclick=e=>{if(e.stopPropagation(),this.settings.disabled)return;let t=!0;const s=this.store.getSelectedOptions(),i=[];if(this.callbacks.beforeChange&&(t=!0===this.callbacks.beforeChange(i,s)),t){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const e=this.store.getFirstOption(),t=e?e.value:"";this.callbacks.setSelected(t,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),a.appendChild(l),i.appendChild(a),t.appendChild(i);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.classList.add(this.classes.arrow),o.setAttribute("viewBox","0 0 100 100");const c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&o.classList.add(this.classes.hide),o.appendChild(c),t.appendChild(o),{main:t,values:s,deselect:{main:i,svg:a,path:l},arrow:{main:o,path:c}}}mainFocus(e){"click"!==e&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter((e=>e.placeholder),!1);let t=this.settings.placeholderText;e.length&&(""!==e[0].html?t=e[0].html:""!==e[0].text&&(t=e[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=t,s}renderValues(){this.settings.isMultiple?(this.renderMultipleValues(),this.updateDeselectAll()):this.renderSingleValue()}renderSingleValue(){const e=this.store.filter((e=>e.selected&&!e.placeholder),!1),t=e.length>0?e[0]:null;if(t){const e=document.createElement("div");e.classList.add(this.classes.single),t.html?e.innerHTML=t.html:e.innerText=t.text,this.main.values.innerHTML=e.outerHTML}else this.main.values.innerHTML=this.placeholder().outerHTML;this.settings.allowDeselect&&e.length?this.main.deselect.main.classList.remove(this.classes.hide):this.main.deselect.main.classList.add(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,t=this.store.filter((e=>e.selected&&e.display),!1);if(0===t.length)return void(this.main.values.innerHTML=this.placeholder().outerHTML);{const e=this.main.values.querySelector("."+this.classes.placeholder);e&&e.remove()}if(t.length>this.settings.maxValuesShown){const e=document.createElement("div");return e.classList.add(this.classes.max),e.textContent=this.settings.maxValuesMessage.replace("{number}",t.length.toString()),void(this.main.values.innerHTML=e.outerHTML)}{const e=this.main.values.querySelector("."+this.classes.max);e&&e.remove()}let s=[];for(let i=0;i<e.length;i++){const n=e[i],a=n.getAttribute("data-id");if(a){t.filter((e=>e.id===a),!1).length||s.push(n)}}for(const e of s)e.classList.add(this.classes.valueOut),setTimeout((()=>{this.main.values.hasChildNodes()&&this.main.values.contains(e)&&this.main.values.removeChild(e)}),100);e=this.main.values.childNodes;for(let s=0;s<t.length;s++){let i=!0;for(let n=0;n<e.length;n++)t[s].id===String(e[n].dataset.id)&&(i=!1);i&&(this.settings.keepOrder||0===e.length?this.main.values.appendChild(this.multipleValue(t[s])):0===s?this.main.values.insertBefore(this.multipleValue(t[s]),e[s]):e[s-1].insertAdjacentElement("afterend",this.multipleValue(t[s])))}}multipleValue(e){const t=document.createElement("div");t.classList.add(this.classes.value),t.dataset.id=e.id;const s=document.createElement("div");if(s.classList.add(this.classes.valueText),s.innerText=e.text,t.appendChild(s),!e.mandatory){const s=document.createElement("div");s.classList.add(this.classes.valueDelete),s.onclick=t=>{if(t.preventDefault(),t.stopPropagation(),this.settings.disabled)return;let s=!0;const a=this.store.getSelectedOptions(),l=a.filter((t=>t.selected&&t.id!==e.id),!0);if(!(this.settings.minSelected&&l.length<this.settings.minSelected)&&(this.callbacks.beforeChange&&(s=!0===this.callbacks.beforeChange(l,a)),s)){let e=[];for(const t of l){if(t instanceof i)for(const s of t.options)e.push(s.value);t instanceof n&&e.push(t.value)}this.callbacks.setSelected(e,!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(l),this.updateDeselectAll()}};const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optionDelete),a.appendChild(l),s.appendChild(a),t.appendChild(s)}return t}contentDiv(){const e=document.createElement("div");e.dataset.id=this.settings.id;const t=this.searchDiv();e.appendChild(t.main);const s=this.listDiv();return e.appendChild(s),{main:e,search:t,list:s}}moveContent(){"relative"!==this.settings.contentPosition&&"down"!==this.settings.openPosition?"up"!==this.settings.openPosition?"up"===this.putContent()?this.moveContentAbove():this.moveContentBelow():this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),s=document.createElement("input"),i=document.createElement("div");e.classList.add(this.classes.search);const a={main:e,input:s};if(this.settings.showSearch||(e.classList.add(this.classes.hide),s.readOnly=!0),s.type="search",s.placeholder=this.settings.searchPlaceholder,s.tabIndex=-1,s.setAttribute("aria-label",this.settings.searchPlaceholder),s.setAttribute("autocapitalize","off"),s.setAttribute("autocomplete","off"),s.setAttribute("autocorrect","off"),s.oninput=t((e=>{this.callbacks.search(e.target.value)}),100),s.onkeydown=e=>{switch(e.key){case"ArrowUp":case"ArrowDown":return"ArrowDown"===e.key?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case"Enter":case" ":if(this.callbacks.addable&&e.ctrlKey)return i.click(),!1;{const e=this.content.list.querySelector("."+this.classes.highlighted);if(e)return e.click(),!1}return!0}return!0},e.appendChild(s),this.callbacks.addable){i.classList.add(this.classes.addable);const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 100 100");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",this.classes.addablePath),t.appendChild(s),i.appendChild(t),i.onclick=e=>{if(e.preventDefault(),e.stopPropagation(),!this.callbacks.addable)return;const t=this.content.search.input.value.trim();if(""===t)return void this.content.search.input.focus();const s=e=>{let t=new n(e);if(this.callbacks.addOption(t),this.settings.isMultiple){let e=this.store.getSelected();e.push(t.value),this.callbacks.setSelected(e,!0)}else this.callbacks.setSelected([t.value],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout((()=>{this.callbacks.close()}),100)},i=this.callbacks.addable(t);!1!==i&&null!=i&&(i instanceof Promise?i.then((e=>{s("string"==typeof e?{text:e,value:e}:e)})):s("string"==typeof i?{text:i,value:i}:i))},e.appendChild(i),a.addable={main:i,svg:t,path:s}}return a}searchFocus(){this.content.search.input.focus()}getOptions(e=!1,t=!1,s=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),t&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const t=this.getOptions(!0,!0,!0);if(0===t.length)return;if(1===t.length&&!t[0].classList.contains(this.classes.highlighted))return void t[0].classList.add(this.classes.highlighted);let s=!1;for(const e of t)e.classList.contains(this.classes.highlighted)&&(s=!0);if(!s)for(const e of t)if(e.classList.contains(this.classes.selected)){e.classList.add(this.classes.highlighted);break}for(let s=0;s<t.length;s++)if(t[s].classList.contains(this.classes.highlighted)){const i=t[s];i.classList.remove(this.classes.highlighted);const n=i.parentElement;if(n&&n.classList.contains(this.classes.open)){const e=n.querySelector("."+this.classes.optgroupLabel);e&&e.click()}let a=t["down"===e?s+1<t.length?s+1:0:s-1>=0?s-1:t.length-1];a.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,a);const l=a.parentElement;if(l&&l.classList.contains(this.classes.close)){const e=l.querySelector("."+this.classes.optgroupLabel);e&&e.click()}return}t["down"===e?0:t.length-1].classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,t["down"===e?0:t.length-1])}listDiv(){const e=document.createElement("div");return e.classList.add(this.classes.list),e}renderError(e){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.error),t.textContent=e,this.content.list.appendChild(t)}renderSearching(){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e)}renderOptions(e){if(this.content.list.innerHTML="",0===e.length){const e=document.createElement("div");return e.classList.add(this.classes.search),e.innerHTML=this.settings.searchText,void this.content.list.appendChild(e)}for(const t of e){if(t instanceof i){const e=document.createElement("div");e.classList.add(this.classes.optgroup);const s=document.createElement("div");s.classList.add(this.classes.optgroupLabel),e.appendChild(s);const i=document.createElement("div");i.classList.add(this.classes.optgroupLabelText),i.textContent=t.label,s.appendChild(i);const n=document.createElement("div");if(n.classList.add(this.classes.optgroupActions),s.appendChild(n),this.settings.isMultiple&&t.selectAll){const e=document.createElement("div");e.classList.add(this.classes.optgroupSelectAll);let s=!0;for(const e of t.options)if(!e.selected){s=!1;break}s&&e.classList.add(this.classes.selected);const i=document.createElement("span");i.textContent=t.selectAllText,e.appendChild(i);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),e.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optgroupSelectAllBox),a.appendChild(l);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d",this.classes.optgroupSelectAllCheck),a.appendChild(o),e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const i=this.store.getSelected();if(s){const e=i.filter((e=>{for(const s of t.options)if(e===s.value)return!1;return!0}));this.callbacks.setSelected(e,!0)}else{const e=i.concat(t.options.map((e=>e.value)));for(const e of t.options)this.store.getOptionByID(e.id)||this.callbacks.addOption(e);this.callbacks.setSelected(e,!0)}})),n.appendChild(e)}if("off"!==t.closable){const i=document.createElement("div");i.classList.add(this.classes.optgroupClosable);const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 100 100"),a.classList.add(this.classes.arrow),i.appendChild(a);const l=document.createElementNS("http://www.w3.org/2000/svg","path");a.appendChild(l),t.options.some((e=>e.selected))||""!==this.content.search.input.value.trim()?(i.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"open"===t.closable?(e.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):"close"===t.closable&&(e.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose)),s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e.classList.contains(this.classes.close)?(e.classList.remove(this.classes.close),e.classList.add(this.classes.open),l.setAttribute("d",this.classes.arrowOpen)):(e.classList.remove(this.classes.open),e.classList.add(this.classes.close),l.setAttribute("d",this.classes.arrowClose))})),n.appendChild(i)}e.appendChild(s);for(const s of t.options)e.appendChild(this.option(s));this.content.list.appendChild(e)}t instanceof n&&this.content.list.appendChild(this.option(t))}}option(e){if(e.placeholder){const e=document.createElement("div");return e.classList.add(this.classes.option),e.classList.add(this.classes.hide),e}const t=document.createElement("div");return t.dataset.id=e.id,t.id=e.id,t.classList.add(this.classes.option),t.setAttribute("role","option"),t.setAttribute("aria-labelledby","option"),e.class&&e.class.split(" ").forEach((e=>{t.classList.add(e)})),e.style&&(t.style.cssText=e.style),this.settings.searchHighlight&&""!==this.content.search.input.value.trim()?t.innerHTML=this.highlightText(""!==e.html?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):""!==e.html?t.innerHTML=e.html:t.textContent=e.text,this.settings.showOptionTooltips&&t.textContent&&t.setAttribute("title",t.textContent),e.display||t.classList.add(this.classes.hide),e.disabled&&t.classList.add(this.classes.disabled),e.selected&&this.settings.hideSelected&&t.classList.add(this.classes.hide),e.selected?(t.classList.add(this.classes.selected),t.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",t.id)):(t.classList.remove(this.classes.selected),t.setAttribute("aria-selected","false")),t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const s=this.store.getSelected(),i=t.currentTarget,n=String(i.dataset.id);if(e.disabled||e.selected&&!this.settings.allowDeselect)return;if(this.settings.isMultiple&&this.settings.maxSelected<=s.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=s.length&&e.selected)return;let a=!1;const l=this.store.getSelectedOptions();let o=[];this.settings.isMultiple&&(o=e.selected?l.filter((e=>e.id!==n)):l.concat(e)),this.settings.isMultiple||(o=e.selected?[]:[e]),this.callbacks.beforeChange||(a=!0),this.callbacks.beforeChange&&(a=!1!==this.callbacks.beforeChange(o,l)),a&&(this.store.getOptionByID(n)||this.callbacks.addOption(e),this.callbacks.setSelected(o.map((e=>e.value)),!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(o))})),t}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,t,s){let i=e;const n=new RegExp("("+t.trim()+")(?![^<]*>[^<>]*</)","i");if(!e.match(n))return e;const a=e.match(n).index,l=a+e.match(n)[0].toString().length,o=e.substring(a,l);return i=i.replace(n,`<mark class="${s}">${o}</mark>`),i}moveContentAbove(){const e=this.main.main.offsetHeight,t=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.openBelow),this.main.main.classList.add(this.classes.openAbove),this.content.main.classList.remove(this.classes.openBelow),this.content.main.classList.add(this.classes.openAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+t-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+window.scrollY+"px",this.content.main.style.left=s.left+window.scrollX+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.openAbove),this.main.main.classList.add(this.classes.openBelow),this.content.main.classList.remove(this.classes.openAbove),this.content.main.classList.add(this.classes.openBelow);const e=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px","relative"!==this.settings.contentPosition&&(this.content.main.style.top=e.top+e.height+window.scrollY+"px",this.content.main.style.left=e.left+window.scrollX+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,t){const s=e.scrollTop+e.offsetTop,i=s+e.clientHeight,n=t.offsetTop,a=n+t.clientHeight;n<s?e.scrollTop-=s-n:a>i&&(e.scrollTop+=a-i)}putContent(){const e=this.main.main.offsetHeight,t=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(t.top+e)<=s&&t.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),t=e&&e.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,a=this.classes.hide;!i||s&&!t?n.classList.add(a):n.classList.remove(a)}}class o{constructor(e){this.listen=!1,this.observer=null,this.select=e,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.display="none",this.select.setAttribute("aria-hidden","true")}showUI(){this.select.removeAttribute("tabindex"),this.select.style.display="",this.select.removeAttribute("aria-hidden")}changeListen(e){this.listen=e,e&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),e||this.observer&&this.observer.disconnect()}valueChange(e){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedValues()),!0}observeCall(e){if(!this.listen)return;let t=!1,s=!1,i=!1;for(const n of e)n.target===this.select&&("disabled"===n.attributeName&&(s=!0),"class"===n.attributeName&&(t=!0)),"OPTGROUP"!==n.target.nodeName&&"OPTION"!==n.target.nodeName||(i=!0);t&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange&&(this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0))}getData(){let e=[];const t=this.select.childNodes;for(const s of t)"OPTGROUP"===s.nodeName&&e.push(this.getDataFromOptgroup(s)),"OPTION"===s.nodeName&&e.push(this.getDataFromOption(s));return e}getDataFromOptgroup(e){let t={id:e.id,label:e.label,selectAll:!!e.dataset&&"true"===e.dataset.selectall,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const s=e.childNodes;for(const e of s)"OPTION"===e.nodeName&&t.options.push(this.getDataFromOption(e));return t}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",selected:e.selected,display:"none"!==e.style.display,disabled:e.disabled,mandatory:!!e.dataset&&"true"===e.dataset.mandatory,placeholder:"true"===e.dataset.placeholder,class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedValues(){let e=[];const t=this.select.childNodes;for(const s of t){if("OPTGROUP"===s.nodeName){const t=s.childNodes;for(const s of t)if("OPTION"===s.nodeName){const t=s;t.selected&&e.push(t.value)}}if("OPTION"===s.nodeName){const t=s;t.selected&&e.push(t.value)}}return e}setSelected(e){this.changeListen(!1);const t=this.select.childNodes;for(const s of t){if("OPTGROUP"===s.nodeName){const t=s.childNodes;for(const s of t)if("OPTION"===s.nodeName){const t=s;t.selected=e.includes(t.value)}}if("OPTION"===s.nodeName){const t=s;t.selected=e.includes(t.value)}}this.changeListen(!0)}updateSelect(e,t,s){this.changeListen(!1),e&&(this.select.dataset.id=e),t&&(this.select.style.cssText=t),s&&(this.select.className="",s.forEach((e=>{""!==e.trim()&&this.select.classList.add(e.trim())}))),this.changeListen(!0)}updateOptions(e){this.changeListen(!1),this.select.innerHTML="";for(const t of e)t instanceof i&&this.select.appendChild(this.createOptgroup(t)),t instanceof n&&this.select.appendChild(this.createOption(t));this.select.dispatchEvent(new Event("change")),this.changeListen(!0)}createOptgroup(e){const t=document.createElement("optgroup");if(t.id=e.id,t.label=e.label,e.selectAll&&(t.dataset.selectAll="true"),"off"!==e.closable&&(t.dataset.closable=e.closable),e.options)for(const s of e.options)t.appendChild(this.createOption(s));return t}createOption(e){const t=document.createElement("option");return t.id=e.id,t.value=e.value,t.innerHTML=e.text,""!==e.html&&t.setAttribute("data-html",e.html),e.selected&&(t.selected=e.selected),e.disabled&&(t.disabled=!0),!1===e.display&&(t.style.display="none"),e.placeholder&&t.setAttribute("data-placeholder","true"),e.mandatory&&t.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach((e=>{t.classList.add(e)})),e.data&&"object"==typeof e.data&&Object.keys(e.data).forEach((s=>{t.setAttribute("data-"+function(e){const t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(e=>"-"+e.toLowerCase()));return e[0]===e[0].toUpperCase()?t.substring(1):t}(s),e.data[s])})),t}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.observer&&(this.observer.disconnect(),this.observer=null),delete this.select.dataset.id,this.showUI()}}class c{constructor(t){this.id="",this.style="",this.class=[],this.isMultiple=!1,this.isOpen=!1,this.isFullOpen=!1,this.intervalMove=null,t||(t={}),this.id="ss-"+e(),this.style=t.style||"",this.class=t.class||[],this.disabled=void 0!==t.disabled&&t.disabled,this.alwaysOpen=void 0!==t.alwaysOpen&&t.alwaysOpen,this.showSearch=void 0===t.showSearch||t.showSearch,this.ariaLabel=t.ariaLabel||"Combobox",this.searchPlaceholder=t.searchPlaceholder||"Search",this.searchText=t.searchText||"No Results",this.searchingText=t.searchingText||"Searching...",this.searchHighlight=void 0!==t.searchHighlight&&t.searchHighlight,this.closeOnSelect=void 0===t.closeOnSelect||t.closeOnSelect,this.contentLocation=t.contentLocation||document.body,this.contentPosition=t.contentPosition||"absolute",this.openPosition=t.openPosition||"auto",this.placeholderText=void 0!==t.placeholderText?t.placeholderText:"Select Value",this.allowDeselect=void 0!==t.allowDeselect&&t.allowDeselect,this.hideSelected=void 0!==t.hideSelected&&t.hideSelected,this.keepOrder=void 0!==t.keepOrder&&t.keepOrder,this.showOptionTooltips=void 0!==t.showOptionTooltips&&t.showOptionTooltips,this.minSelected=t.minSelected||0,this.maxSelected=t.maxSelected||1e3,this.timeoutDelay=t.timeoutDelay||200,this.maxValuesShown=t.maxValuesShown||20,this.maxValuesMessage=t.maxValuesMessage||"{number} selected"}}return class{constructor(e){var s;if(this.events={search:void 0,searchFilter:(e,t)=>-1!==e.text.toLowerCase().indexOf(t.toLowerCase()),addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0},this.windowResize=t((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.windowScroll=t((()=>{(this.settings.isOpen||this.settings.isFullOpen)&&this.render.moveContent()})),this.documentClick=e=>{this.settings.isOpen&&e.target&&!function(e,t){function s(e,s){return s&&e&&e.classList&&e.classList.contains(s)||s&&e&&e.dataset&&e.dataset.id&&e.dataset.id===t?e:null}return s(e,t)||function e(t,i){return t&&t!==document?s(t,i)?t:e(t.parentNode,i):null}(e,t)}(e.target,this.settings.id)&&this.close(e.type)},this.windowVisibilityChange=()=>{document.hidden&&this.close()},this.selectEl="string"==typeof e.select?document.querySelector(e.select):e.select,!this.selectEl)return void(e.events&&e.events.error&&e.events.error(new Error("Could not find select element")));if("SELECT"!==this.selectEl.tagName)return void(e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select")));this.selectEl.dataset.ssid&&this.destroy(),this.settings=new c(e.settings);const i=["afterChange","beforeOpen","afterOpen","beforeClose","afterClose"];for(const s in e.events)e.events.hasOwnProperty(s)&&(-1!==i.indexOf(s)?this.events[s]=t(e.events[s],100):this.events[s]=e.events[s]);this.settings.disabled=(null===(s=e.settings)||void 0===s?void 0:s.disabled)?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new o(this.selectEl),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=e=>{this.setSelected(e)},this.select.onClassChange=e=>{this.settings.class=e,this.render.updateClassStyles()},this.select.onDisabledChange=e=>{e?this.disable():this.enable()},this.select.onOptionsChange=e=>{this.setData(e)},this.store=new a(this.settings.isMultiple?"multiple":"single",e.data?e.data:this.select.getData()),e.data&&this.select.updateOptions(this.store.getData());const n={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new l(this.settings,this.store,n),this.render.renderValues(),this.render.renderOptions(this.store.getData());const h=this.selectEl.getAttribute("aria-label"),r=this.selectEl.getAttribute("aria-labelledby");h?this.render.main.main.setAttribute("aria-label",h):r&&this.render.main.main.setAttribute("aria-labelledby",r),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(e){const t=this.store.getSelected(),i=this.store.validateDataArray(e);if(i)return void(this.events.error&&this.events.error(i));this.store.setData(e);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),this.render.renderOptions(n),this.events.afterChange&&!s(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){return this.store.getSelected()}setSelected(e,t=!0){const i=this.store.getSelected();this.store.setSelectedBy("value",Array.isArray(e)?e:[e]);const n=this.store.getData();this.select.updateOptions(n),this.render.renderValues(),""!==this.render.content.search.input.value?this.search(this.render.content.search.input.value):this.render.renderOptions(n),t&&this.events.afterChange&&!s(i,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const t=this.store.getSelected();this.store.getDataOptions().some((t=>{var s;return t.value===(null!==(s=e.value)&&void 0!==s?s:e.text)}))||this.store.addOption(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!s(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.render.searchFocus(),this.settings.isOpen=!0,setTimeout((()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)}),this.settings.timeoutDelay),"absolute"===this.settings.contentPosition&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(e=null){this.settings.isOpen&&!this.settings.alwaysOpen&&(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),""!==this.render.content.search.input.value&&this.search(""),this.render.mainFocus(e),this.settings.isOpen=!1,this.settings.isFullOpen=!1,setTimeout((()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)}),this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(e){if(this.render.content.search.input.value!==e&&(this.render.content.search.input.value=e),!this.events.search)return void this.render.renderOptions(""===e?this.store.getData():this.store.search(e,this.events.searchFilter));this.render.renderSearching();const t=this.events.search(e,this.store.getSelectedOptions());t instanceof Promise?t.then((e=>{this.render.renderOptions(this.store.partialToFullData(e))})).catch((e=>{this.render.renderError("string"==typeof e?e:e.message)})):Array.isArray(t)?this.render.renderOptions(this.store.partialToFullData(t)):this.render.renderError("Search event must return a promise or an array of data")}destroy(){document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),"auto"===this.settings.openPosition&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}}}));
@@ -42,8 +42,9 @@
42
42
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
43
43
  */
44
44
 
45
- 'use strict';
46
45
  ;(function ($, window, document, undefined) {
46
+ "use strict";
47
+
47
48
  var cookie_names = j1.getCookieNames();
48
49
  var gaCookies = j1.findCookie('_ga');
49
50
  var j1Cookies = j1.findCookie('j1');
@@ -16,4 +16,4 @@
16
16
 
17
17
  /* Dailymotion Javascript SDK (J1 Version) - v2022-10-18 */
18
18
 
19
- !function(e,t){if("object"==typeof exports&&"undefined"!=typeof module){var i=require("video.js");module.exports=t(i.default||i)}else"function"==typeof define&&define.amd?define(["videojs"],(function(i){return e.Dailymotion=t(i)})):e.Dailymotion=t(e.videojs)}(this,(function(e){"use strict";var t,i,r=log4javascript.getLogger("videoJS.plugin.dailymotion"),s=e.browser.IS_IOS||e.browser.IS_ANDROID,a=e.getTech("Tech");class d extends a{constructor(e,t){super(e,t),this.setPoster(e.poster),this.setSrc(this.options_.source,!0);var i=this;setTimeout(function(){this.el_&&(this.el_.parentNode.className+=" vjs-dailymotion",s&&(this.el_.parentNode.className+=" vjs-dailymotion-mobile"),d.isSdkReady?i.initDMPlayer():d.sdkReadyQueue.push(i))}.bind(this))}getPlayerParams(){var e={autoplay:!1,mute:!1,controls:!1,"queue-autoplay-next":!1,"queue-enable":!1},t=this.options_;if(["api","autoplay","autoplay-mute","id","mute","origin","quality","queue-autoplay-next","queue-enable","sharing-enable","start","subtitles-default","syndication","ui-highlight","ui-logo","ui-start-screen-info","ui-theme","apimode","playlist"].forEach((i=>{void 0!==t[i]&&(e[i]=t[i])})),void 0!==this.options_.dmControls&&(e.controls=this.options_.dmControls),this.url&&void 0!==this.url.playlist&&(e.playlist=this.url.playlist),void 0!==this.options_.customVars){var i=this.options_.customVars;Object.keys(i).forEach((t=>{e[t]=i[t]}))}return e}getPlayerConfig(){var e={width:"100%",height:"100%",params:this.getPlayerParams()};return this.url&&void 0!==this.url.video?e.video=this.url.video:void 0!==this.options_.video&&(e.video=this.options_.video),e}initDMPlayer(){if(this.dmPlayer)this.dmPlayer.dmPlayerState={ended:!1,playing:!1,muted:!1,volume:0,progress:{seconds:0,percent:0,duration:0}};else{this.dmPlayer=new DM.player(document.getElementById(this.options_.techId),this.getPlayerConfig());var e=this;this.isApiReady=!1,this.dmPlayer.addEventListener("apiready",(()=>{e.triggerReady(),e.isApiReady=!0})),this.dmPlayer.addEventListener("durationchange",(()=>{e.trigger("durationchange")})),this.dmPlayer.addEventListener("end",(()=>{e.trigger("ended")})),this.dmPlayer.addEventListener("error",(()=>{e.trigger("error")})),this.dmPlayer.addEventListener("loadedmetadata",(()=>{e.trigger("loadeddata"),e.trigger("loadedmetadata")})),this.dmPlayer.addEventListener("pause",(()=>{e.trigger("pause")})),this.dmPlayer.addEventListener("play",(()=>{e.trigger("loadStart"),e.trigger("play"),e.trigger("playing"),e.trigger("waiting")})),this.dmPlayer.addEventListener("playback_ready",(()=>{e.trigger("loadeddata")})),this.dmPlayer.addEventListener("timeupdate",(()=>{e.trigger("timeupdate")})),this.dmPlayer.addEventListener("volumechange",(()=>{e.trigger("volumechange")})),this.triggerReady(),r.debug("\ncreated "+this.name_+" player on ID: "+e.dmPlayer.id)}}autoplay(e){return void 0!==e?this.setAutoplay(e):this.options_.autoplay}setAutoplay(e){return this.options_.autoplay=e}buffered(){return this.dmPlayer&&this.dmPlayer.bufferedTime?e.time.createTimeRanges(0,this.dmPlayer.bufferedTime):e.time.createTimeRanges()}createEl(){var e=document.createElement("div");e.setAttribute("id",this.options_.techId),e.setAttribute("style","cursor: default; width:100%; height:100%; top:0; left:0; position:absolute"),e.setAttribute("class","vjs-tech");var t=document.createElement("div");return t.appendChild(e),t}currentSrc(){return this.source&&this.source.src}currentTime(e){return void 0!==e?this.setCurrentTime(e):this.dmPlayer&&this.dmPlayer.currentTime}setCurrentTime(e){if(this.dmPlayer&&this.dmPlayer.seek)return this.dmPlayer.seek(e)}dispose(){if(DM&&DM.destroy)DM.destroy(this.options_.techId);else{var e=d.sdkReadyQueue.indexOf(this);-1!==e&&d.sdkReadyQueue.splice(e,1)}this.dmPlayer=void 0,this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-dailymotion","").replace(" vjs-dailymotion-mobile",""),this.el_.parentNode.removeChild(this.el_),a.prototype.dispose.call(this)}duration(e){return void 0!==e?this.setDuration(e):this.dmPlayer?this.dmPlayer.duration:0}setDuration(e){if(this.dmPlayer&&this.dmPlayer.seek)return this.dmPlayer.seek(e)}ended(){return this.dmPlayer&&this.dmPlayer.ended}enterFullWindow(){if(this.dmPlayer&&this.dmPlayer.setFullscreen)return this.dmPlayer.setFullscreen(!0)}error(){return this.dmPlayer&&this.dmPlayer.error}exitFullscreen(){if(this.dmPlayer&&this.dmPlayer.setFullscreen)return this.dmPlayer.setFullscreen(!1)}isFullscreen(){return this.dmPlayer&&this.dmPlayer.fullscreen}language(){}languages(){}load(){if(this.dmPlayer&&this.dmPlayer.load)return this.dmPlayer.load(this.getPlayerConfig())}loop(){}muted(e){return void 0!==typeof e?this.setMuted(e):this.dmPlayer&&this.dmPlayer.mute}setMuted(e){void 0!==e&&this.dmPlayer&&this.dmPlayer.setMuted&&(e?(this.volumeBeforeMute=this.volume(),this.setVolume(0)):this.setVolume(this.volumeBeforeMute),this.dmPlayer.setMuted(e))}networkState(){return!this.dmPlayer||this.dmPlayer.error?0:this.dmPlayer.seeking?2:void 0}pause(){if(this.dmPlayer&&this.dmPlayer.pause)return this.dmPlayer.pause()}paused(){return this.dmPlayer&&this.dmPlayer.paused}play(){if(this.isApiReady&&this.dmPlayer&&this.dmPlayer.play)return this.trigger("loadStart"),this.trigger("waiting"),this.dmPlayer.play()}playbackRate(){return 1}poster(){}preload(){}readyState(){return!this.dmPlayer||this.dmPlayer.error?0:this.dmPlayer.seeking?1:4}remainingTime(){return this.dmPlayer&&this.dmPlayer.duration-this.dmPlayer.currentTime}requestFullscreen(){return this.enterFullWindow()}enterFullScreen(){return this.enterFullWindow()}reset(){this.load()}seekable(){return this.ytPlayer?e.time.createTimeRanges(0,this.ytPlayer.getDuration()):e.time.createTimeRanges()}seeking(){return this.dmPlayer&&this.dmPlayer.seeking}src(e){return void 0!==e?this.setSrc(e):this.source}setSrc(e){if(void 0!==e)return this.source=e,this.url=d.parseUrl(e.src||e),d.isSdkReady&&this.load(),this.source}supportsFullScreen(){return!0}volume(){return this.dmPlayer?this.dmPlayer.volume:1}setVolume(e){this.dmPlayer&&this.dmPlayer.setMuted&&this.dmPlayer.setVolume&&this.dmPlayer.apiReady&&(this.dmPlayer.setMuted(!1),this.dmPlayer.setVolume(e))}}function l(){r.debug("\nAPI loaded successfully"),d.isSdkReady=!0;for(var e=0;e<d.sdkReadyQueue.length;++e)d.sdkReadyQueue[e].initDMPlayer();r.debug("\ncreated all players from queue: #"+e),i=Date.now(),r.debug("\ninitializing plugin: finished"),r.debug("\nplugin initializing time: "+(i-t)+"ms")}d.isSupported=()=>!0,d.canPlaySource=e=>d.canPlayType(e.type),d.canPlayType=e=>"video/dailymotion"===e,d.parseUrl=e=>{var t={},i=e.match(/video\/[^?|^\/]*/);i&&i[0]&&(t.video=i[0].replace("video/",""));return(i=e.match(/playlist(=|\/)[^&]*/))&&i[0]&&(t.playlist=i[0].replace(/playlist(=|\/)/,"")),t},d.VERSION="1.0.0",d.sdkReadyQueue=[];var n=setInterval((()=>{var i="block"===$("#content").css("display");"finished"===j1.getState()&&i&&(t=Date.now(),r.debug("\ninitializing plugin: started"),r.debug("\nversion of videoJS detected: "+e.VERSION),function(e,t){var i=!1,r=document.createElement("script"),s=document.getElementsByTagName("script")[0];s&&(s.parentNode.insertBefore(r,s),r.onload=()=>{i||(i=!0,t())},r.onreadystatechange=()=>{i||"complete"!==this.readyState&&"loaded"!==this.readyState||(i=!0,t())},r.src=e)}("/assets/theme/j1/modules/videojs/js/plugins/players/dm/api/dailymotion.sdk.min.js",l),function(){const e="\n .vjs-dailymotion .vjs-iframe-blocker { display: none; }\n .vjs-dailymotion.vjs-user-inactive .vjs-iframe-blocker { display: block; }\n .vjs-dailymotion .vjs-poster { background-size: cover; }\n .vjs-dailymotion-mobile .vjs-big-play-button { display: none; }\n ";var t=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.setAttribute("type","text/css"),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),t.appendChild(i),r.debug("\nadded additional CSS styles")}(),clearInterval(n))}),10);void 0!==e.registerTech?e.registerTech("Dailymotion",d):e.registerComponent("Dailymotion",d)}));
19
+ !function(e,t){if("object"==typeof exports&&"undefined"!=typeof module){var i=require("video.js");module.exports=t(i.default||i)}else"function"==typeof define&&define.amd?define(["videojs"],function(i){return e.Dailymotion=t(i)}):e.Dailymotion=t(e.videojs)}(this,function(e){"use strict";var t,i,r=log4javascript.getLogger("videoJS.plugin.dailymotion"),s=e.browser.IS_IOS||e.browser.IS_ANDROID,a=e.getTech("Tech");class d extends a{constructor(e,t){super(e,t),this.setPoster(e.poster),this.setSrc(this.options_.source,!0);var i=this;setTimeout(function(){this.el_&&(this.el_.parentNode.className+=" vjs-dailymotion",s&&(this.el_.parentNode.className+=" vjs-dailymotion-mobile"),d.isSdkReady?i.initDMPlayer():d.sdkReadyQueue.push(i))}.bind(this))}getPlayerParams(){var e={autoplay:!1,mute:!1,controls:!1,"queue-autoplay-next":!1,"queue-enable":!1},t=this.options_;if(["api","autoplay","autoplay-mute","id","mute","origin","quality","queue-autoplay-next","queue-enable","sharing-enable","start","subtitles-default","syndication","ui-highlight","ui-logo","ui-start-screen-info","ui-theme","apimode","playlist"].forEach(i=>{void 0!==t[i]&&(e[i]=t[i])}),void 0!==this.options_.dmControls&&(e.controls=this.options_.dmControls),this.url&&void 0!==this.url.playlist&&(e.playlist=this.url.playlist),void 0!==this.options_.customVars){var i=this.options_.customVars;Object.keys(i).forEach(t=>{e[t]=i[t]})}return e}getPlayerConfig(){var e={width:"100%",height:"100%",params:this.getPlayerParams()};return this.url&&void 0!==this.url.video?e.video=this.url.video:void 0!==this.options_.video&&(e.video=this.options_.video),e}initDMPlayer(){if(!this.dmPlayer){this.dmPlayer=new DM.player(document.getElementById(this.options_.techId),this.getPlayerConfig());var e=this;this.isApiReady=!1,this.dmPlayer.addEventListener("apiready",()=>{e.triggerReady(),e.isApiReady=!0}),this.dmPlayer.addEventListener("durationchange",()=>{e.trigger("durationchange")}),this.dmPlayer.addEventListener("end",()=>{e.trigger("ended")}),this.dmPlayer.addEventListener("error",()=>{e.trigger("error")}),this.dmPlayer.addEventListener("loadedmetadata",()=>{e.trigger("loadeddata"),e.trigger("loadedmetadata")}),this.dmPlayer.addEventListener("pause",()=>{e.trigger("pause")}),this.dmPlayer.addEventListener("play",()=>{e.trigger("loadStart"),e.trigger("play"),e.trigger("playing"),e.trigger("waiting")}),this.dmPlayer.addEventListener("playback_ready",()=>{e.trigger("loadeddata")}),this.dmPlayer.addEventListener("timeupdate",()=>{e.trigger("timeupdate")}),this.dmPlayer.addEventListener("volumechange",()=>{e.trigger("volumechange")}),this.triggerReady(),r.debug("\ncreated "+this.name_+" player on ID: "+e.dmPlayer.id)}}autoplay(e){return void 0!==e?this.setAutoplay(e):this.options_.autoplay}setAutoplay(e){return this.options_.autoplay=e}buffered(){return this.dmPlayer&&this.dmPlayer.bufferedTime?e.time.createTimeRanges(0,this.dmPlayer.bufferedTime):e.time.createTimeRanges()}createEl(){var e=document.createElement("div");e.setAttribute("id",this.options_.techId),e.setAttribute("style","width:100%;height:100%;top:0;left:0;position:absolute"),e.setAttribute("class","vjs-tech");var t=document.createElement("div");return t.appendChild(e),t}currentSrc(){return this.source&&this.source.src}currentTime(e){return void 0!==e?this.setCurrentTime(e):this.dmPlayer&&this.dmPlayer.currentTime}setCurrentTime(e){if(this.dmPlayer&&this.dmPlayer.seek)return this.dmPlayer.seek(e)}dispose(){if(DM&&DM.destroy)DM.destroy(this.options_.techId);else{var e=d.sdkReadyQueue.indexOf(this);-1!==e&&d.sdkReadyQueue.splice(e,1)}this.dmPlayer=void 0,this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-dailymotion","").replace(" vjs-dailymotion-mobile",""),this.el_.parentNode.removeChild(this.el_),a.prototype.dispose.call(this)}duration(e){return void 0!==e?this.setDuration(e):this.dmPlayer?this.dmPlayer.duration:0}setDuration(e){if(this.dmPlayer&&this.dmPlayer.seek)return this.dmPlayer.seek(e)}ended(){return this.dmPlayer&&this.dmPlayer.ended}enterFullWindow(){if(this.dmPlayer&&this.dmPlayer.setFullscreen)return this.dmPlayer.setFullscreen(!0)}error(){return this.dmPlayer&&this.dmPlayer.error}exitFullscreen(){if(this.dmPlayer&&this.dmPlayer.setFullscreen)return this.dmPlayer.setFullscreen(!1)}isFullscreen(){return this.dmPlayer&&this.dmPlayer.fullscreen}language(){}languages(){}load(){if(this.dmPlayer&&this.dmPlayer.load)return this.dmPlayer.load(this.getPlayerConfig())}loop(){}muted(e){return void 0!==typeof e?this.setMuted(e):this.dmPlayer&&this.dmPlayer.mute}setMuted(e){void 0!==e&&this.dmPlayer&&this.dmPlayer.setMuted&&(e?(this.volumeBeforeMute=this.volume(),this.setVolume(0)):this.setVolume(this.volumeBeforeMute),this.dmPlayer.setMuted(e))}networkState(){return!this.dmPlayer||this.dmPlayer.error?0:this.dmPlayer.seeking?2:void 0}pause(){if(this.dmPlayer&&this.dmPlayer.pause)return this.dmPlayer.pause()}paused(){return this.dmPlayer&&this.dmPlayer.paused}play(){if(this.isApiReady&&this.dmPlayer&&this.dmPlayer.play)return this.trigger("loadStart"),this.trigger("waiting"),this.dmPlayer.play()}playbackRate(){return 1}poster(){}preload(){}readyState(){return!this.dmPlayer||this.dmPlayer.error?0:this.dmPlayer.seeking?1:4}remainingTime(){return this.dmPlayer&&this.dmPlayer.duration-this.dmPlayer.currentTime}requestFullscreen(){return this.enterFullWindow()}enterFullScreen(){return this.enterFullWindow()}reset(){this.load()}seekable(){return this.ytPlayer?e.time.createTimeRanges(0,this.ytPlayer.getDuration()):e.time.createTimeRanges()}seeking(){return this.dmPlayer&&this.dmPlayer.seeking}src(e){return void 0!==e?this.setSrc(e):this.source}setSrc(e){if(void 0!==e)return this.source=e,this.url=d.parseUrl(e.src||e),d.isSdkReady&&this.load(),this.source}supportsFullScreen(){return!0}volume(){return this.dmPlayer?this.dmPlayer.volume:1}setVolume(e){this.dmPlayer&&this.dmPlayer.setMuted&&this.dmPlayer.setVolume&&(this.dmPlayer.setMuted(!1),this.dmPlayer.setVolume(e))}}function l(){r.debug("\nAPI loaded successfully"),d.isSdkReady=!0;for(var e=0;e<d.sdkReadyQueue.length;++e)d.sdkReadyQueue[e].initDMPlayer();r.debug("\ncreated all players from queue: #"+e),i=Date.now(),r.debug("\ninitializing plugin: finished"),r.debug("\nplugin initializing time: "+(i-t)+"ms")}d.isSupported=(()=>!0),d.canPlaySource=(e=>d.canPlayType(e.type)),d.canPlayType=(e=>"video/dailymotion"===e),d.parseUrl=(e=>{var t={},i=e.match(/video\/[^?|^\/]*/);i&&i[0]&&(t.video=i[0].replace("video/",""));return(i=e.match(/playlist(=|\/)[^&]*/))&&i[0]&&(t.playlist=i[0].replace(/playlist(=|\/)/,"")),t}),d.VERSION="1.0.0",d.sdkReadyQueue=[];var n=setInterval(()=>{var i="block"===$("#content").css("display");"finished"===j1.getState()&&i&&(t=Date.now(),r.debug("\ninitializing plugin: started"),r.debug("\nversion of videoJS detected: "+e.VERSION),function(e,t){var i=!1,r=document.createElement("script"),s=document.getElementsByTagName("script")[0];s&&(s.parentNode.insertBefore(r,s),r.onload=(()=>{i||(i=!0,t())}),r.onreadystatechange=(()=>{i||"complete"!==this.readyState&&"loaded"!==this.readyState||(i=!0,t())}),r.src=e)}("/assets/theme/j1/modules/videojs/js/plugins/players/dm/api/dailymotion.sdk.min.js",l),function(){const e="\n .vjs-dailymotion .vjs-iframe-blocker { display: none; }\n .vjs-dailymotion.vjs-user-inactive .vjs-iframe-blocker { display: block; }\n .vjs-dailymotion .vjs-poster { background-size: cover; }\n .vjs-dailymotion-mobile .vjs-big-play-button { display: none; }\n ";var t=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.setAttribute("type","text/css"),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),t.appendChild(i),r.debug("\nadded additional CSS styles")}(),clearInterval(n))},10);void 0!==e.registerTech?e.registerTech("Dailymotion",d):e.registerComponent("Dailymotion",d)});
@@ -0,0 +1,62 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:cc="http://creativecommons.org/ns#"
5
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
+ xmlns:svg="http://www.w3.org/2000/svg"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
9
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10
+ width="512"
11
+ height="512"
12
+ viewBox="0 0 512 512"
13
+ version="1.1"
14
+ id="svg6"
15
+ sodipodi:docname="dailymotion.svg"
16
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
17
+ <metadata
18
+ id="metadata12">
19
+ <rdf:RDF>
20
+ <cc:Work
21
+ rdf:about="">
22
+ <dc:format>image/svg+xml</dc:format>
23
+ <dc:type
24
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
25
+ <dc:title></dc:title>
26
+ </cc:Work>
27
+ </rdf:RDF>
28
+ </metadata>
29
+ <defs
30
+ id="defs10" />
31
+ <sodipodi:namedview
32
+ pagecolor="#ffffff"
33
+ bordercolor="#666666"
34
+ borderopacity="1"
35
+ objecttolerance="10"
36
+ gridtolerance="10"
37
+ guidetolerance="10"
38
+ inkscape:pageopacity="0"
39
+ inkscape:pageshadow="2"
40
+ inkscape:window-width="1961"
41
+ inkscape:window-height="1181"
42
+ id="namedview8"
43
+ showgrid="false"
44
+ inkscape:pagecheckerboard="true"
45
+ inkscape:showpageshadow="false"
46
+ inkscape:zoom="1.8339844"
47
+ inkscape:cx="256"
48
+ inkscape:cy="168.75825"
49
+ inkscape:window-x="0"
50
+ inkscape:window-y="0"
51
+ inkscape:window-maximized="0"
52
+ inkscape:current-layer="svg6" />
53
+ <path
54
+ fill="currentColor"
55
+ d="m 14.068,11.313 h -0.023 a 3.1,3.1 0 1 0 0.183,6.195 H 14.204 A 2.97,2.97 0 0 0 17.13,14.54 l -10e-4,-0.076 v 0.004 l 0.002,-0.103 a 3.054,3.054 0 0 0 -3.054,-3.054 h -0.01 10e-4 z"
56
+ id="path2" />
57
+ <path
58
+ fill="currentColor"
59
+ d="M 0,0 V 512.00852 H 513.09904 V 0 Z m 442.39827,443.89005 h -76.45176 v -30.0165 a 103.47497,103.25505 0 0 1 -79.68,31.36053 h 0.23517 l -2.22343,0.0213 a 120.79207,120.53534 0 0 1 -81.88206,-31.7872 l 0.0855,0.0853 A 135.97125,135.68226 0 0 1 155.42625,310.83184 l 0.0214,-2.70938 v -0.64001 a 135.54366,135.25558 0 0 1 42.90791,-98.88165 l 0.0641,-0.064 a 124.42652,124.16207 0 0 1 88.65923,-36.90728 h 0.87655 -0.0428 a 89.578541,89.388154 0 0 1 75.3828,33.66456 l 0.14965,0.19201 V 88.684142 l 78.95312,-16.320271 z"
60
+ id="path4"
61
+ style="stroke-width:21.3564" />
62
+ </svg>