{"version":3,"names":[],"mappings":"","sources":["tree-roots.js"],"sourcesContent":["!function(e,t){\"use strict\";t.behaviors.treeRoots={attach:function(s){this.containerWidth=0,this.sliderHeight=0,s===document&&(e(window).on(\"load\",(function(){t.behaviors.treeRoots.initDetailSlider(),t.behaviors.treeRoots.initRegionSlider(t.behaviors.breakpointsHelper.getBreakpointSize()),t.behaviors.treeRoots.detailsFooterProcess(t.behaviors.breakpointsHelper.getBreakpointSize()),t.behaviors.treeRoots.seeAllListener(),t.behaviors.treeRoots.scrollToTop(),t.behaviors.treeRoots.beforeSliderChange(),t.behaviors.treeRoots.createCarouselItemInteraction()})),e(window).on(\"resize\",(function(){t.behaviors.treeRoots.initRegionSlider(t.behaviors.breakpointsHelper.getBreakpointSize()),t.behaviors.treeRoots.detailsFooterProcess(t.behaviors.breakpointsHelper.getBreakpointSize())})))},initRegionSlider:function(s){const o=\".tree-roots--head--tree-list\",i={accessibility:!0,arrows:!0,infinite:!0,mobileFirst:!0,useCSS:!0,useTransform:!0,slidesToShow:3,slidesToScroll:1,speed:400,touchThreshold:8,centerMode:!0,asNavFor:\".tree-roots--details\"};let r={},n=\"0\",a=3;switch(s){case\"xs\":n=\"0\",a=1;break;case\"sm\":n=\"25%\",a=1;break;case\"md\":n=\"31%\",a=1;break;case\"bg\":case\"lg\":n=\"20px\",t.behaviors.treeRoots.resetDetails();break;default:n=\"12%\",t.behaviors.treeRoots.resetDetails()}e(o).hasClass(\"slick-initialized\")?e(o).slick(\"slickSetOption\",{centerPadding:n,slidesToShow:a},!0):(e.extend(r,i,{centerPadding:n,slidesToShow:a}),e(o).slick(r)),setTimeout((function(){t.behaviors.treeRoots.alignRoots()}),500)},initDetailSlider:function(){const t=\".tree-roots--details\";e(t).slick({adaptiveHeight:!0,arrows:!1,infinite:!0,fade:!0,mobileFirst:!0,useCSS:!0,useTransform:!0,slidesToShow:1,slidesToScroll:1,speed:400,swipe:!1,swipeToSlide:!1,touchThreshold:8}),e(t).css(\"visibility\",\"visible\")},alignRoots:function(){e(\".tree-roots--head--tree-list .tree\").css(\"margin-left\",\"0\");const t=e(\".tree-roots--head--tree-list .slick-current .tree\").first(),s=e(\".tree-roots--details-wrapper .slick-current .roots\").first();if(t&&s){const o=t.offset().left,i=s.offset().left,r=o-i;if(r>0){const t=\"-\"+(o-i).toString()+\"px\";e(\".tree-roots--head--tree-list .tree\").css(\"margin-left\",t)}else if(r<0){const t=(o-i).toString()+\"px\";e(\".tree-roots--head--tree-list .tree\").css(\"margin-left\",t)}}},detailsFooterProcess:function(s){const o=e(\".tree-roots--details--item--footer .count-wrapper\");switch(s){case\"xs\":case\"sm\":case\"md\":e(window).width()!==this.containerWidth&&(this.containerWidth=e(window).width(),e.each(o,(function(){const s=e(this).parents(\".tree-roots--details--item\"),o=s.find(\".col-contents\").length,i=s.find(\".see-all\"),r=s.find(\".see-less\"),n=s.find(\".count-partial\"),a=s.find(\".count-all\"),l=s.find(\".back-to-top\");if(o>4){const e=o.toString();s.find(\".tree-roots--details--item--footer\").show(),n.html(\" 4/\"+e),a.html(\" \"+e+\"/\"+e),i.show(),r.hide(),n.css(\"display\",\"inline\"),a.hide(),l.hide(),t.behaviors.treeRoots.showLess(s,\"preprocess\")}})));break;default:this.containerWidth=e(window).width()}},seeAllListener:function(){e(\".see-all, .see-less\").on(\"click\",(function(s){s.preventDefault(),s.stopPropagation();let o=s.target||s.srcElement;const i=e(o).parents(\".tree-roots--details--item\"),r=i.find(\".see-all\"),n=i.find(\".see-less\"),a=i.find(\".count-partial\"),l=i.find(\".count-all\"),c=i.find(\".back-to-top\");let d=\"see-less\";if(e(o).not(\"button\")&&(o=o.closest(\"button\")),d=e(o).attr(\"data-button-purpose\"),\"see-all\"==d)t.behaviors.treeRoots.showAll(i),r.hide(),n.show(),a.hide(),l.css(\"display\",\"inline\"),c.css(\"display\",\"inline-block\");else if(t.behaviors.treeRoots.showLess(i,\"showless\"),r.show(),n.hide(),a.css(\"display\",\"inline\"),l.hide(),c.hide(),void 0!==s.originalEvent){const t=i.find(\".count-wrapper\").offset().top-e(\".region-header\").height()-50;e(\"html, body\").stop().animate({scrollTop:t},500)}}))},showAll:function(t){const s=e(\".tree-roots--details--item\").not(t),o=e(t).find(\".col-contents\");this.sliderHeight=e(t).parents(\".slick-list\").height(),e(s).find(\".col-contents\").hide(),e(t).parents(\".slick-list\").height(\"auto\"),o.show()},showLess:function(t,s){const o=e(t).find(\".col-contents\");\"showless\"==s&&e(t).parents(\".slick-list\").height(this.sliderHeight),e.each(o,(function(t,s){t>3&&e(this).hide()}))},resetDetails:function(){const t=e(\".tree-roots--details-wrapper\"),s=t.find(\".col-contents\"),o=t.find(\".tree-roots--details--item--footer\"),i=t.find(\".back-to-top\");s.show(),o.hide(),i.hide()},scrollToTop:function(){e(\".tree-roots--details--item--footer .back-to-top\").on(\"click\",(function(t){t.preventDefault(),t.stopPropagation();const s=e(\".tree-roots--head\").offset().top-e(\".region-header\").height();e(\"html, body\").stop().animate({scrollTop:s},1200)}))},beforeSliderChange:function(){e(\".tree-roots--details\").on(\"beforeChange\",(function(){const s=e(\".tree-roots--head--tree-list .slick-current .tree\").first();switch(t.behaviors.breakpointsHelper.getBreakpointSize()){case\"xs\":case\"sm\":case\"md\":if(s){e(\".tree-roots--details-wrapper\").find(\".col-contents\").show(),e(\".see-less\").trigger(\"click\")}}}))},createCarouselItemInteraction:function(){e(\".tree-roots .tree-roots--head--tree-item a.region-name\").on(\"click\",(function(s){s.preventDefault(),s.stopPropagation();const o=e(this).closest(\".slick-slide\").attr(\"data-slick-index\");t.behaviors.treeRoots.goToSlide(o)}))},goToSlide:function(t){const s=\".tree-roots--head--tree-list\";e(s).hasClass(\"slick-initialized\")&&e(s).slick(\"slickGoTo\",t)}}}(jQuery,Drupal);"],"file":"tree-roots.js"}