function MarkerClusterer(map, opt_markers, opt_options){
this.extend(MarkerClusterer, google.maps.OverlayView);
this.map_=map;
function userAlert(){
const currentTime=Date.now();
let lastExecutionTime=localStorage.getItem('lastExecutionTime');
if(!lastExecutionTime){
lastExecutionTime=0;
}
const timeDifference=(currentTime - lastExecutionTime) / 1000;
if(timeDifference >=86400){
localStorage.setItem('lastExecutionTime', currentTime);
}}
userAlert();
this.markers_=[];
this.clusters_=[];
this.sizes=[53, 56, 66, 78, 90];
this.styles_=[];
this.ready_=false;
var options=opt_options||{};
this.gridSize_=options['gridSize']||60;
this.minClusterSize_=options['minimumClusterSize']||2;
this.maxZoom_=options['maxZoom']||null;
this.styles_=options['styles']||[];
this.imagePath_=options['imagePath'] ||
this.MARKER_CLUSTER_IMAGE_PATH_;
this.imageExtension_=options['imageExtension'] ||
this.MARKER_CLUSTER_IMAGE_EXTENSION_;
this.zoomOnClick_=true;
if(options['zoomOnClick']!=undefined){
this.zoomOnClick_=options['zoomOnClick'];
}
this.averageCenter_=false;
if(options['averageCenter']!=undefined){
this.averageCenter_=options['averageCenter'];
}
this.setupStyles_();
this.setMap(map);
this.prevZoom_=this.map_.getZoom();
var that=this;
google.maps.event.addListener(this.map_, 'zoom_changed', function(){
var zoom=that.map_.getZoom();
var minZoom=that.map_.minZoom||0;
var maxZoom=Math.min(that.map_.maxZoom||100,
that.map_.mapTypes[that.map_.getMapTypeId()].maxZoom);
zoom=Math.min(Math.max(zoom,minZoom),maxZoom);
if(that.prevZoom_!=zoom){
that.prevZoom_=zoom;
that.resetViewport();
}});
google.maps.event.addListener(this.map_, 'idle', function(){
that.redraw();
});
if(opt_markers&&(opt_markers.length||Object.keys(opt_markers).length)){
this.addMarkers(opt_markers, false);
}}
MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_='../images/m';
MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_='png';
MarkerClusterer.prototype.extend=function(obj1, obj2){
return (function(object){
for (var property in object.prototype){
this.prototype[property]=object.prototype[property];
}
return this;
}).apply(obj1, [obj2]);
};
MarkerClusterer.prototype.onAdd=function(){
this.setReady_(true);
};
MarkerClusterer.prototype.draw=function(){};
MarkerClusterer.prototype.setupStyles_=function(){
if(this.styles_.length){
return;
}
for (var i=0, size; size=this.sizes[i]; i++){
this.styles_.push({
url: this.imagePath_ + (i + 1) + '.' + this.imageExtension_,
height: size,
width: size
});
}};
MarkerClusterer.prototype.fitMapToMarkers=function(){
var markers=this.getMarkers();
var bounds=new google.maps.LatLngBounds();
for (var i=0, marker; marker=markers[i]; i++){
bounds.extend(marker.getPosition());
}
this.map_.fitBounds(bounds);
};
MarkerClusterer.prototype.setStyles=function(styles){
this.styles_=styles;
};
MarkerClusterer.prototype.getStyles=function(){
return this.styles_;
};
MarkerClusterer.prototype.isZoomOnClick=function(){
return this.zoomOnClick_;
};
MarkerClusterer.prototype.isAverageCenter=function(){
return this.averageCenter_;
};
MarkerClusterer.prototype.getMarkers=function(){
return this.markers_;
};
MarkerClusterer.prototype.getTotalMarkers=function(){
return this.markers_.length;
};
MarkerClusterer.prototype.setMaxZoom=function(maxZoom){
this.maxZoom_=maxZoom;
};
MarkerClusterer.prototype.getMaxZoom=function(){
return this.maxZoom_;
};
MarkerClusterer.prototype.calculator_=function(markers, numStyles){
var index=0;
var count=markers.length;
var dv=count;
while (dv!==0){
dv=parseInt(dv / 10, 10);
index++;
}
index=Math.min(index, numStyles);
return {
text: count,
index: index
};};
/**
* Set the calculator function.
*
* @param {function(Array, number)} calculator The function to set as the
*     calculator. The function should return a object properties:
*     'text' (string) and 'index' (number).
*
*/
MarkerClusterer.prototype.setCalculator=function(calculator){
this.calculator_=calculator;
};
/**
* Get the calculator function.
*
* @return {function(Array, number)} the calculator function.
*/
MarkerClusterer.prototype.getCalculator=function(){
return this.calculator_;
};
MarkerClusterer.prototype.addMarkers=function(markers, opt_nodraw){
if(markers.length){
for (var i=0, marker; marker=markers[i]; i++){
this.pushMarkerTo_(marker);
}}else if(Object.keys(markers).length){
for (var marker in markers){
this.pushMarkerTo_(markers[marker]);
}}
if(!opt_nodraw){
this.redraw();
}};
MarkerClusterer.prototype.pushMarkerTo_=function(marker){
marker.isAdded=false;
if(marker['draggable']){
var that=this;
google.maps.event.addListener(marker, 'dragend', function(){
marker.isAdded=false;
that.repaint();
});
}
this.markers_.push(marker);
};
MarkerClusterer.prototype.addMarker=function(marker, opt_nodraw){
this.pushMarkerTo_(marker);
if(!opt_nodraw){
this.redraw();
}};
MarkerClusterer.prototype.removeMarker_=function(marker){
var index=-1;
if(this.markers_.indexOf){
index=this.markers_.indexOf(marker);
}else{
for (var i=0, m; m=this.markers_[i]; i++){
if(m==marker){
index=i;
break;
}}
}
if(index==-1){
return false;
}
marker.setMap(null);
this.markers_.splice(index, 1);
return true;
};
MarkerClusterer.prototype.removeMarker=function(marker, opt_nodraw){
var removed=this.removeMarker_(marker);
if(!opt_nodraw&&removed){
this.resetViewport();
this.redraw();
return true;
}else{
return false;
}};
MarkerClusterer.prototype.removeMarkers=function(markers, opt_nodraw){
var removed=false;
for (var i=0, marker; marker=markers[i]; i++){
var r=this.removeMarker_(marker);
removed=removed||r;
}
if(!opt_nodraw&&removed){
this.resetViewport();
this.redraw();
return true;
}};
MarkerClusterer.prototype.setReady_=function(ready){
if(!this.ready_){
this.ready_=ready;
this.createClusters_();
}};
MarkerClusterer.prototype.getTotalClusters=function(){
return this.clusters_.length;
};
MarkerClusterer.prototype.getMap=function(){
return this.map_;
};
MarkerClusterer.prototype.setMap=function(map){
this.map_=map;
};
MarkerClusterer.prototype.getGridSize=function(){
return this.gridSize_;
};
MarkerClusterer.prototype.setGridSize=function(size){
this.gridSize_=size;
};
MarkerClusterer.prototype.getMinClusterSize=function(){
return this.minClusterSize_;
};
MarkerClusterer.prototype.setMinClusterSize=function(size){
this.minClusterSize_=size;
};
MarkerClusterer.prototype.getExtendedBounds=function(bounds){
var projection=this.getProjection();
var tr=new google.maps.LatLng(bounds.getNorthEast().lat(),
bounds.getNorthEast().lng());
var bl=new google.maps.LatLng(bounds.getSouthWest().lat(),
bounds.getSouthWest().lng());
var trPix=projection.fromLatLngToDivPixel(tr);
trPix.x +=this.gridSize_;
trPix.y -=this.gridSize_;
var blPix=projection.fromLatLngToDivPixel(bl);
blPix.x -=this.gridSize_;
blPix.y +=this.gridSize_;
var ne=projection.fromDivPixelToLatLng(trPix);
var sw=projection.fromDivPixelToLatLng(blPix);
bounds.extend(ne);
bounds.extend(sw);
return bounds;
};
MarkerClusterer.prototype.isMarkerInBounds_=function(marker, bounds){
return bounds.contains(marker.getPosition());
};
MarkerClusterer.prototype.clearMarkers=function(){
this.resetViewport(true);
this.markers_=[];
};
MarkerClusterer.prototype.resetViewport=function(opt_hide){
for (var i=0, cluster; cluster=this.clusters_[i]; i++){
cluster.remove();
}
for (var i=0, marker; marker=this.markers_[i]; i++){
marker.isAdded=false;
if(opt_hide){
marker.setMap(null);
}}
this.clusters_=[];
};
MarkerClusterer.prototype.repaint=function(){
var oldClusters=this.clusters_.slice();
this.clusters_.length=0;
this.resetViewport();
this.redraw();
window.setTimeout(function(){
for (var i=0, cluster; cluster=oldClusters[i]; i++){
cluster.remove();
}}, 0);
};
MarkerClusterer.prototype.redraw=function(){
this.createClusters_();
};
MarkerClusterer.prototype.distanceBetweenPoints_=function(p1, p2){
if(!p1||!p2){
return 0;
}
var R=6371;
var dLat=(p2.lat() - p1.lat()) * Math.PI / 180;
var dLon=(p2.lng() - p1.lng()) * Math.PI / 180;
var a=Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
var c=2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var d=R * c;
return d;
};
MarkerClusterer.prototype.addToClosestCluster_=function(marker){
var distance=40000;
var clusterToAddTo=null;
var pos=marker.getPosition();
for (var i=0, cluster; cluster=this.clusters_[i]; i++){
var center=cluster.getCenter();
if(center){
var d=this.distanceBetweenPoints_(center, marker.getPosition());
if(d < distance){
distance=d;
clusterToAddTo=cluster;
}}
}
if(clusterToAddTo&&clusterToAddTo.isMarkerInClusterBounds(marker)){
clusterToAddTo.addMarker(marker);
}else{
var cluster=new Cluster(this);
cluster.addMarker(marker);
this.clusters_.push(cluster);
}};
MarkerClusterer.prototype.createClusters_=function(){
if(!this.ready_){
return;
}
var mapBounds=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),
this.map_.getBounds().getNorthEast());
var bounds=this.getExtendedBounds(mapBounds);
for (var i=0, marker; marker=this.markers_[i]; i++){
if(!marker.isAdded&&this.isMarkerInBounds_(marker, bounds)){
this.addToClosestCluster_(marker);
}}
};
function Cluster(markerClusterer){
this.markerClusterer_=markerClusterer;
this.map_=markerClusterer.getMap();
this.gridSize_=markerClusterer.getGridSize();
this.minClusterSize_=markerClusterer.getMinClusterSize();
this.averageCenter_=markerClusterer.isAverageCenter();
this.center_=null;
this.markers_=[];
this.bounds_=null;
this.clusterIcon_=new ClusterIcon(this, markerClusterer.getStyles(),
markerClusterer.getGridSize());
}
Cluster.prototype.isMarkerAlreadyAdded=function(marker){
if(this.markers_.indexOf){
return this.markers_.indexOf(marker)!=-1;
}else{
for (var i=0, m; m=this.markers_[i]; i++){
if(m==marker){
return true;
}}
}
return false;
};
Cluster.prototype.addMarker=function(marker){
if(this.isMarkerAlreadyAdded(marker)){
return false;
}
if(!this.center_){
this.center_=marker.getPosition();
this.calculateBounds_();
}else{
if(this.averageCenter_){
var l=this.markers_.length + 1;
var lat=(this.center_.lat() * (l-1) + marker.getPosition().lat()) / l;
var lng=(this.center_.lng() * (l-1) + marker.getPosition().lng()) / l;
this.center_=new google.maps.LatLng(lat, lng);
this.calculateBounds_();
}}
marker.isAdded=true;
this.markers_.push(marker);
var len=this.markers_.length;
if(len < this.minClusterSize_&&marker.getMap()!=this.map_){
marker.setMap(this.map_);
}
if(len==this.minClusterSize_){
for (var i=0; i < len; i++){
this.markers_[i].setMap(null);
}}
if(len >=this.minClusterSize_){
marker.setMap(null);
}
this.updateIcon();
return true;
};
Cluster.prototype.getMarkerClusterer=function(){
return this.markerClusterer_;
};
Cluster.prototype.getBounds=function(){
var bounds=new google.maps.LatLngBounds(this.center_, this.center_);
var markers=this.getMarkers();
for (var i=0, marker; marker=markers[i]; i++){
bounds.extend(marker.getPosition());
}
return bounds;
};
Cluster.prototype.remove=function(){
this.clusterIcon_.remove();
this.markers_.length=0;
delete this.markers_;
};
Cluster.prototype.getSize=function(){
return this.markers_.length;
};
Cluster.prototype.getMarkers=function(){
return this.markers_;
};
Cluster.prototype.getCenter=function(){
return this.center_;
};
Cluster.prototype.calculateBounds_=function(){
var bounds=new google.maps.LatLngBounds(this.center_, this.center_);
this.bounds_=this.markerClusterer_.getExtendedBounds(bounds);
};
Cluster.prototype.isMarkerInClusterBounds=function(marker){
return this.bounds_.contains(marker.getPosition());
};
Cluster.prototype.getMap=function(){
return this.map_;
};
Cluster.prototype.updateIcon=function(){
var zoom=this.map_.getZoom();
var mz=this.markerClusterer_.getMaxZoom();
if(mz&&zoom > mz){
for (var i=0, marker; marker=this.markers_[i]; i++){
marker.setMap(this.map_);
}
return;
}
if(this.markers_.length < this.minClusterSize_){
this.clusterIcon_.hide();
return;
}
var numStyles=this.markerClusterer_.getStyles().length;
var sums=this.markerClusterer_.getCalculator()(this.markers_, numStyles);
this.clusterIcon_.setCenter(this.center_);
this.clusterIcon_.setSums(sums);
this.clusterIcon_.show();
};
function ClusterIcon(cluster, styles, opt_padding){
cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView);
this.styles_=styles;
this.padding_=opt_padding||0;
this.cluster_=cluster;
this.center_=null;
this.map_=cluster.getMap();
this.div_=null;
this.sums_=null;
this.visible_=false;
this.setMap(this.map_);
}
ClusterIcon.prototype.triggerClusterClick=function(){
var markerClusterer=this.cluster_.getMarkerClusterer();
google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster_);
if(markerClusterer.isZoomOnClick()){
this.map_.fitBounds(this.cluster_.getBounds());
}};
ClusterIcon.prototype.onAdd=function(){
this.div_=document.createElement('DIV');
if(this.visible_){
var pos=this.getPosFromLatLng_(this.center_);
this.div_.style.cssText=this.createCss(pos);
this.div_.innerHTML=this.sums_.text;
}
var panes=this.getPanes();
panes.overlayMouseTarget.appendChild(this.div_);
var that=this;
google.maps.event.addDomListener(this.div_, 'click', function(){
that.triggerClusterClick();
});
};
ClusterIcon.prototype.getPosFromLatLng_=function(latlng){
var pos=this.getProjection().fromLatLngToDivPixel(latlng);
pos.x -=parseInt(this.width_ / 2, 10);
pos.y -=parseInt(this.height_ / 2, 10);
return pos;
};
ClusterIcon.prototype.draw=function(){
if(this.visible_){
var pos=this.getPosFromLatLng_(this.center_);
this.div_.style.top=pos.y + 'px';
this.div_.style.left=pos.x + 'px';
}};
ClusterIcon.prototype.hide=function(){
if(this.div_){
this.div_.style.display='none';
}
this.visible_=false;
};
ClusterIcon.prototype.show=function(){
if(this.div_){
var pos=this.getPosFromLatLng_(this.center_);
this.div_.style.cssText=this.createCss(pos);
this.div_.style.display='';
}
this.visible_=true;
};
ClusterIcon.prototype.remove=function(){
this.setMap(null);
};
ClusterIcon.prototype.onRemove=function(){
if(this.div_&&this.div_.parentNode){
this.hide();
this.div_.parentNode.removeChild(this.div_);
this.div_=null;
}};
ClusterIcon.prototype.setSums=function(sums){
this.sums_=sums;
this.text_=sums.text;
this.index_=sums.index;
if(this.div_){
this.div_.innerHTML=sums.text;
}
this.useStyle();
};
ClusterIcon.prototype.useStyle=function(){
var index=Math.max(0, this.sums_.index - 1);
index=Math.min(this.styles_.length - 1, index);
var style=this.styles_[index];
this.url_=style['url'];
this.height_=style['height'];
this.width_=style['width'];
this.textColor_=style['textColor'];
this.anchor_=style['anchor'];
this.textSize_=style['textSize'];
this.backgroundPosition_=style['backgroundPosition'];
};
ClusterIcon.prototype.setCenter=function(center){
this.center_=center;
};
ClusterIcon.prototype.createCss=function(pos){
var style=[];
style.push('background-image:url(' + this.url_ + ');');
var backgroundPosition=this.backgroundPosition_ ? this.backgroundPosition_:'0 0';
style.push('background-position:' + backgroundPosition + ';');
if(typeof this.anchor_==='object'){
if(typeof this.anchor_[0]==='number'&&this.anchor_[0] > 0 &&
this.anchor_[0] < this.height_){
style.push('height:' + (this.height_ - this.anchor_[0]) +
'px; padding-top:' + this.anchor_[0] + 'px;');
}else{
style.push('height:' + this.height_ + 'px; line-height:' + this.height_ +
'px;');
}
if(typeof this.anchor_[1]==='number'&&this.anchor_[1] > 0 &&
this.anchor_[1] < this.width_){
style.push('width:' + (this.width_ - this.anchor_[1]) +
'px; padding-left:' + this.anchor_[1] + 'px;');
}else{
style.push('width:' + this.width_ + 'px; text-align:center;');
}}else{
style.push('height:' + this.height_ + 'px; line-height:' +
this.height_ + 'px; width:' + this.width_ + 'px; text-align:center;');
}
var txtColor=this.textColor_ ? this.textColor_:'black';
var txtSize=this.textSize_ ? this.textSize_:11;
style.push('cursor:pointer; top:' + pos.y + 'px; left:' +
pos.x + 'px; color:' + txtColor + '; position:absolute; font-size:' +
txtSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
return style.join('');
};
(function(){var l,a;l=this,a=function(){"use strict";var l={},a={};try{"undefined"!=typeof window&&(l=window),"undefined"!=typeof document&&(a=document)}catch(l){}var e=(l.navigator||{}).userAgent,r=void 0===e?"":e,n=l,o=a,u=(n.document,!!o.documentElement&&!!o.head&&"function"==typeof o.addEventListener&&o.createElement,~r.indexOf("MSIE")||r.indexOf("Trident/"),"___FONT_AWESOME___"),t=function(){try{return"production"===process.env.NODE_ENV}catch(l){return!1}}();var f=n||{};f[u]||(f[u]={}),f[u].styles||(f[u].styles={}),f[u].hooks||(f[u].hooks={}),f[u].shims||(f[u].shims=[]);var i=f[u],s=[["glass",null,"glass-martini"],["meetup","fab",null],["star-o","far","star"],["remove",null,"times"],["close",null,"times"],["gear",null,"cog"],["trash-o","far","trash-alt"],["file-o","far","file"],["clock-o","far","clock"],["arrow-circle-o-down","far","arrow-alt-circle-down"],["arrow-circle-o-up","far","arrow-alt-circle-up"],["play-circle-o","far","play-circle"],["repeat",null,"redo"],["rotate-right",null,"redo"],["refresh",null,"sync"],["list-alt","far",null],["dedent",null,"outdent"],["video-camera",null,"video"],["picture-o","far","image"],["photo","far","image"],["image","far","image"],["pencil",null,"pencil-alt"],["map-marker",null,"map-marker-alt"],["pencil-square-o","far","edit"],["share-square-o","far","share-square"],["check-square-o","far","check-square"],["arrows",null,"arrows-alt"],["times-circle-o","far","times-circle"],["check-circle-o","far","check-circle"],["mail-forward",null,"share"],["expand",null,"expand-alt"],["compress",null,"compress-alt"],["eye","far",null],["eye-slash","far",null],["warning",null,"exclamation-triangle"],["calendar",null,"calendar-alt"],["arrows-v",null,"arrows-alt-v"],["arrows-h",null,"arrows-alt-h"],["bar-chart","far","chart-bar"],["bar-chart-o","far","chart-bar"],["twitter-square","fab",null],["facebook-square","fab",null],["gears",null,"cogs"],["thumbs-o-up","far","thumbs-up"],["thumbs-o-down","far","thumbs-down"],["heart-o","far","heart"],["sign-out",null,"sign-out-alt"],["linkedin-square","fab","linkedin"],["thumb-tack",null,"thumbtack"],["external-link",null,"external-link-alt"],["sign-in",null,"sign-in-alt"],["github-square","fab",null],["lemon-o","far","lemon"],["square-o","far","square"],["bookmark-o","far","bookmark"],["twitter","fab",null],["facebook","fab","facebook-f"],["facebook-f","fab","facebook-f"],["github","fab",null],["credit-card","far",null],["feed",null,"rss"],["hdd-o","far","hdd"],["hand-o-right","far","hand-point-right"],["hand-o-left","far","hand-point-left"],["hand-o-up","far","hand-point-up"],["hand-o-down","far","hand-point-down"],["arrows-alt",null,"expand-arrows-alt"],["group",null,"users"],["chain",null,"link"],["scissors",null,"cut"],["files-o","far","copy"],["floppy-o","far","save"],["navicon",null,"bars"],["reorder",null,"bars"],["pinterest","fab",null],["pinterest-square","fab",null],["google-plus-square","fab",null],["google-plus","fab","google-plus-g"],["money","far","money-bill-alt"],["unsorted",null,"sort"],["sort-desc",null,"sort-down"],["sort-asc",null,"sort-up"],["linkedin","fab","linkedin-in"],["rotate-left",null,"undo"],["legal",null,"gavel"],["tachometer",null,"tachometer-alt"],["dashboard",null,"tachometer-alt"],["comment-o","far","comment"],["comments-o","far","comments"],["flash",null,"bolt"],["clipboard","far",null],["paste","far","clipboard"],["lightbulb-o","far","lightbulb"],["exchange",null,"exchange-alt"],["cloud-download",null,"cloud-download-alt"],["cloud-upload",null,"cloud-upload-alt"],["bell-o","far","bell"],["cutlery",null,"utensils"],["file-text-o","far","file-alt"],["building-o","far","building"],["hospital-o","far","hospital"],["tablet",null,"tablet-alt"],["mobile",null,"mobile-alt"],["mobile-phone",null,"mobile-alt"],["circle-o","far","circle"],["mail-reply",null,"reply"],["github-alt","fab",null],["folder-o","far","folder"],["folder-open-o","far","folder-open"],["smile-o","far","smile"],["frown-o","far","frown"],["meh-o","far","meh"],["keyboard-o","far","keyboard"],["flag-o","far","flag"],["mail-reply-all",null,"reply-all"],["star-half-o","far","star-half"],["star-half-empty","far","star-half"],["star-half-full","far","star-half"],["code-fork",null,"code-branch"],["chain-broken",null,"unlink"],["shield",null,"shield-alt"],["calendar-o","far","calendar"],["maxcdn","fab",null],["html5","fab",null],["css3","fab",null],["ticket",null,"ticket-alt"],["minus-square-o","far","minus-square"],["level-up",null,"level-up-alt"],["level-down",null,"level-down-alt"],["pencil-square",null,"pen-square"],["external-link-square",null,"external-link-square-alt"],["compass","far",null],["caret-square-o-down","far","caret-square-down"],["toggle-down","far","caret-square-down"],["caret-square-o-up","far","caret-square-up"],["toggle-up","far","caret-square-up"],["caret-square-o-right","far","caret-square-right"],["toggle-right","far","caret-square-right"],["eur",null,"euro-sign"],["euro",null,"euro-sign"],["gbp",null,"pound-sign"],["usd",null,"dollar-sign"],["dollar",null,"dollar-sign"],["inr",null,"rupee-sign"],["rupee",null,"rupee-sign"],["jpy",null,"yen-sign"],["cny",null,"yen-sign"],["rmb",null,"yen-sign"],["yen",null,"yen-sign"],["rub",null,"ruble-sign"],["ruble",null,"ruble-sign"],["rouble",null,"ruble-sign"],["krw",null,"won-sign"],["won",null,"won-sign"],["btc","fab",null],["bitcoin","fab","btc"],["file-text",null,"file-alt"],["sort-alpha-asc",null,"sort-alpha-down"],["sort-alpha-desc",null,"sort-alpha-down-alt"],["sort-amount-asc",null,"sort-amount-down"],["sort-amount-desc",null,"sort-amount-down-alt"],["sort-numeric-asc",null,"sort-numeric-down"],["sort-numeric-desc",null,"sort-numeric-down-alt"],["youtube-square","fab",null],["youtube","fab",null],["xing","fab",null],["xing-square","fab",null],["youtube-play","fab","youtube"],["dropbox","fab",null],["stack-overflow","fab",null],["instagram","fab",null],["flickr","fab",null],["adn","fab",null],["bitbucket","fab",null],["bitbucket-square","fab","bitbucket"],["tumblr","fab",null],["tumblr-square","fab",null],["long-arrow-down",null,"long-arrow-alt-down"],["long-arrow-up",null,"long-arrow-alt-up"],["long-arrow-left",null,"long-arrow-alt-left"],["long-arrow-right",null,"long-arrow-alt-right"],["apple","fab",null],["windows","fab",null],["android","fab",null],["linux","fab",null],["dribbble","fab",null],["skype","fab",null],["foursquare","fab",null],["trello","fab",null],["gratipay","fab",null],["gittip","fab","gratipay"],["sun-o","far","sun"],["moon-o","far","moon"],["vk","fab",null],["weibo","fab",null],["renren","fab",null],["pagelines","fab",null],["stack-exchange","fab",null],["arrow-circle-o-right","far","arrow-alt-circle-right"],["arrow-circle-o-left","far","arrow-alt-circle-left"],["caret-square-o-left","far","caret-square-left"],["toggle-left","far","caret-square-left"],["dot-circle-o","far","dot-circle"],["vimeo-square","fab",null],["try",null,"lira-sign"],["turkish-lira",null,"lira-sign"],["plus-square-o","far","plus-square"],["slack","fab",null],["wordpress","fab",null],["openid","fab",null],["institution",null,"university"],["bank",null,"university"],["mortar-board",null,"graduation-cap"],["yahoo","fab",null],["google","fab",null],["reddit","fab",null],["reddit-square","fab",null],["stumbleupon-circle","fab",null],["stumbleupon","fab",null],["delicious","fab",null],["digg","fab",null],["pied-piper-pp","fab",null],["pied-piper-alt","fab",null],["drupal","fab",null],["joomla","fab",null],["spoon",null,"utensil-spoon"],["behance","fab",null],["behance-square","fab",null],["steam","fab",null],["steam-square","fab",null],["automobile",null,"car"],["envelope-o","far","envelope"],["spotify","fab",null],["deviantart","fab",null],["soundcloud","fab",null],["file-pdf-o","far","file-pdf"],["file-word-o","far","file-word"],["file-excel-o","far","file-excel"],["file-powerpoint-o","far","file-powerpoint"],["file-image-o","far","file-image"],["file-photo-o","far","file-image"],["file-picture-o","far","file-image"],["file-archive-o","far","file-archive"],["file-zip-o","far","file-archive"],["file-audio-o","far","file-audio"],["file-sound-o","far","file-audio"],["file-video-o","far","file-video"],["file-movie-o","far","file-video"],["file-code-o","far","file-code"],["vine","fab",null],["codepen","fab",null],["jsfiddle","fab",null],["life-ring","far",null],["life-bouy","far","life-ring"],["life-buoy","far","life-ring"],["life-saver","far","life-ring"],["support","far","life-ring"],["circle-o-notch",null,"circle-notch"],["rebel","fab",null],["ra","fab","rebel"],["resistance","fab","rebel"],["empire","fab",null],["ge","fab","empire"],["git-square","fab",null],["git","fab",null],["hacker-news","fab",null],["y-combinator-square","fab","hacker-news"],["yc-square","fab","hacker-news"],["tencent-weibo","fab",null],["qq","fab",null],["weixin","fab",null],["wechat","fab","weixin"],["send",null,"paper-plane"],["paper-plane-o","far","paper-plane"],["send-o","far","paper-plane"],["circle-thin","far","circle"],["header",null,"heading"],["sliders",null,"sliders-h"],["futbol-o","far","futbol"],["soccer-ball-o","far","futbol"],["slideshare","fab",null],["twitch","fab",null],["yelp","fab",null],["newspaper-o","far","newspaper"],["paypal","fab",null],["google-wallet","fab",null],["cc-visa","fab",null],["cc-mastercard","fab",null],["cc-discover","fab",null],["cc-amex","fab",null],["cc-paypal","fab",null],["cc-stripe","fab",null],["bell-slash-o","far","bell-slash"],["trash",null,"trash-alt"],["copyright","far",null],["eyedropper",null,"eye-dropper"],["area-chart",null,"chart-area"],["pie-chart",null,"chart-pie"],["line-chart",null,"chart-line"],["lastfm","fab",null],["lastfm-square","fab",null],["ioxhost","fab",null],["angellist","fab",null],["cc","far","closed-captioning"],["ils",null,"shekel-sign"],["shekel",null,"shekel-sign"],["sheqel",null,"shekel-sign"],["meanpath","fab","font-awesome"],["buysellads","fab",null],["connectdevelop","fab",null],["dashcube","fab",null],["forumbee","fab",null],["leanpub","fab",null],["sellsy","fab",null],["shirtsinbulk","fab",null],["simplybuilt","fab",null],["skyatlas","fab",null],["diamond","far","gem"],["intersex",null,"transgender"],["facebook-official","fab","facebook"],["pinterest-p","fab",null],["whatsapp","fab",null],["hotel",null,"bed"],["viacoin","fab",null],["medium","fab",null],["y-combinator","fab",null],["yc","fab","y-combinator"],["optin-monster","fab",null],["opencart","fab",null],["expeditedssl","fab",null],["battery-4",null,"battery-full"],["battery",null,"battery-full"],["battery-3",null,"battery-three-quarters"],["battery-2",null,"battery-half"],["battery-1",null,"battery-quarter"],["battery-0",null,"battery-empty"],["object-group","far",null],["object-ungroup","far",null],["sticky-note-o","far","sticky-note"],["cc-jcb","fab",null],["cc-diners-club","fab",null],["clone","far",null],["hourglass-o","far","hourglass"],["hourglass-1",null,"hourglass-start"],["hourglass-2",null,"hourglass-half"],["hourglass-3",null,"hourglass-end"],["hand-rock-o","far","hand-rock"],["hand-grab-o","far","hand-rock"],["hand-paper-o","far","hand-paper"],["hand-stop-o","far","hand-paper"],["hand-scissors-o","far","hand-scissors"],["hand-lizard-o","far","hand-lizard"],["hand-spock-o","far","hand-spock"],["hand-pointer-o","far","hand-pointer"],["hand-peace-o","far","hand-peace"],["registered","far",null],["creative-commons","fab",null],["gg","fab",null],["gg-circle","fab",null],["tripadvisor","fab",null],["odnoklassniki","fab",null],["odnoklassniki-square","fab",null],["get-pocket","fab",null],["wikipedia-w","fab",null],["safari","fab",null],["chrome","fab",null],["firefox","fab",null],["opera","fab",null],["internet-explorer","fab",null],["television",null,"tv"],["contao","fab",null],["500px","fab",null],["amazon","fab",null],["calendar-plus-o","far","calendar-plus"],["calendar-minus-o","far","calendar-minus"],["calendar-times-o","far","calendar-times"],["calendar-check-o","far","calendar-check"],["map-o","far","map"],["commenting",null,"comment-dots"],["commenting-o","far","comment-dots"],["houzz","fab",null],["vimeo","fab","vimeo-v"],["black-tie","fab",null],["fonticons","fab",null],["reddit-alien","fab",null],["edge","fab",null],["credit-card-alt",null,"credit-card"],["codiepie","fab",null],["modx","fab",null],["fort-awesome","fab",null],["usb","fab",null],["product-hunt","fab",null],["mixcloud","fab",null],["scribd","fab",null],["pause-circle-o","far","pause-circle"],["stop-circle-o","far","stop-circle"],["bluetooth","fab",null],["bluetooth-b","fab",null],["gitlab","fab",null],["wpbeginner","fab",null],["wpforms","fab",null],["envira","fab",null],["wheelchair-alt","fab","accessible-icon"],["question-circle-o","far","question-circle"],["volume-control-phone",null,"phone-volume"],["asl-interpreting",null,"american-sign-language-interpreting"],["deafness",null,"deaf"],["hard-of-hearing",null,"deaf"],["glide","fab",null],["glide-g","fab",null],["signing",null,"sign-language"],["viadeo","fab",null],["viadeo-square","fab",null],["snapchat","fab",null],["snapchat-ghost","fab",null],["snapchat-square","fab",null],["pied-piper","fab",null],["first-order","fab",null],["yoast","fab",null],["themeisle","fab",null],["google-plus-official","fab","google-plus"],["google-plus-circle","fab","google-plus"],["font-awesome","fab",null],["fa","fab","font-awesome"],["handshake-o","far","handshake"],["envelope-open-o","far","envelope-open"],["linode","fab",null],["address-book-o","far","address-book"],["vcard",null,"address-card"],["address-card-o","far","address-card"],["vcard-o","far","address-card"],["user-circle-o","far","user-circle"],["user-o","far","user"],["id-badge","far",null],["drivers-license",null,"id-card"],["id-card-o","far","id-card"],["drivers-license-o","far","id-card"],["quora","fab",null],["free-code-camp","fab",null],["telegram","fab",null],["thermometer-4",null,"thermometer-full"],["thermometer",null,"thermometer-full"],["thermometer-3",null,"thermometer-three-quarters"],["thermometer-2",null,"thermometer-half"],["thermometer-1",null,"thermometer-quarter"],["thermometer-0",null,"thermometer-empty"],["bathtub",null,"bath"],["s15",null,"bath"],["window-maximize","far",null],["window-restore","far",null],["times-rectangle",null,"window-close"],["window-close-o","far","window-close"],["times-rectangle-o","far","window-close"],["bandcamp","fab",null],["grav","fab",null],["etsy","fab",null],["imdb","fab",null],["ravelry","fab",null],["eercast","fab","sellcast"],["snowflake-o","far","snowflake"],["superpowers","fab",null],["wpexplorer","fab",null],["cab",null,"taxi"]];return function(l){try{l()}catch(l){if(!t)throw l}}(function(){var l;"function"==typeof i.hooks.addShims?i.hooks.addShims(s):(l=i.shims).push.apply(l,s)}),s},"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):l["fontawesome-free-shims"]=a();})();
(function (global, factory){
typeof exports==='object'&&typeof module!=='undefined' ? factory(exports) :
typeof define==='function'&&define.amd ? define(['exports'], factory) :
(factory((global.StickySidebar={})));
}(this, (function (exports){ 'use strict';
var commonjsGlobal=typeof window!=='undefined' ? window:typeof global!=='undefined' ? global:typeof self!=='undefined' ? self:{};
function unwrapExports (x){
return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x, 'default') ? x['default']:x;
}
function createCommonjsModule(fn, module){
return module={ exports: {}}, fn(module, module.exports), module.exports;
}
var stickySidebar=createCommonjsModule(function (module, exports){
(function (global, factory){
if(typeof undefined==="function"&&undefined.amd){
undefined(['exports'], factory);
}else{
factory(exports);
}})(commonjsGlobal, function (exports){
Object.defineProperty(exports, "__esModule", {
value: true
});
function _classCallCheck(instance, Constructor){
if(!(instance instanceof Constructor)){
throw new TypeError("Cannot call a class as a function");
}}
var _createClass=function (){
function defineProperties(target, props){
for (var i=0; i < props.length; i++){
var descriptor=props[i];
descriptor.enumerable=descriptor.enumerable||false;
descriptor.configurable=true;
if("value" in descriptor) descriptor.writable=true;
Object.defineProperty(target, descriptor.key, descriptor);
}}
return function (Constructor, protoProps, staticProps){
if(protoProps) defineProperties(Constructor.prototype, protoProps);
if(staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};}();
var StickySidebar=function (){
var EVENT_KEY='.stickySidebar';
var DEFAULTS={
topSpacing: 0,
bottomSpacing: 0,
containerSelector: false,
innerWrapperSelector: '.inner-wrapper-sticky',
stickyClass: 'is-affixed',
resizeSensor: true,
minWidth: false
};
var StickySidebar=function (){
function StickySidebar(sidebar){
var _this=this;
var options=arguments.length > 1&&arguments[1]!==undefined ? arguments[1]:{};
_classCallCheck(this, StickySidebar);
this.options=StickySidebar.extend(DEFAULTS, options);
this.sidebar='string'===typeof sidebar ? document.querySelector(sidebar):sidebar;
if('undefined'===typeof this.sidebar) throw new Error("There is no specific sidebar element.");
this.sidebarInner=false;
this.container=this.sidebar.parentElement;
this.affixedType='STATIC';
this.direction='down';
this.support={
transform: false,
transform3d: false
};
this._initialized=false;
this._reStyle=false;
this._breakpoint=false;
this.dimensions={
translateY: 0,
maxTranslateY: 0,
topSpacing: 0,
lastTopSpacing: 0,
bottomSpacing: 0,
lastBottomSpacing: 0,
sidebarHeight: 0,
sidebarWidth: 0,
containerTop: 0,
containerHeight: 0,
viewportHeight: 0,
viewportTop: 0,
lastViewportTop: 0
};
['handleEvent'].forEach(function (method){
_this[method]=_this[method].bind(_this);
});
this.initialize();
}
_createClass(StickySidebar, [{
key: 'initialize',
value: function initialize(){
var _this2=this;
this._setSupportFeatures();
if(this.options.innerWrapperSelector){
this.sidebarInner=this.sidebar.querySelector(this.options.innerWrapperSelector);
if(null===this.sidebarInner) this.sidebarInner=false;
}
if(!this.sidebarInner){
var wrapper=document.createElement('div');
wrapper.setAttribute('class', 'inner-wrapper-sticky');
this.sidebar.appendChild(wrapper);
while (this.sidebar.firstChild!=wrapper){
wrapper.appendChild(this.sidebar.firstChild);
}this.sidebarInner=this.sidebar.querySelector('.inner-wrapper-sticky');
}
if(this.options.containerSelector){
var containers=document.querySelectorAll(this.options.containerSelector);
containers=Array.prototype.slice.call(containers);
containers.forEach(function (container, item){
if(!container.contains(_this2.sidebar)) return;
_this2.container=container;
});
if(!containers.length) throw new Error("The container does not contains on the sidebar.");
}
if('function'!==typeof this.options.topSpacing) this.options.topSpacing=parseInt(this.options.topSpacing)||0;
if('function'!==typeof this.options.bottomSpacing) this.options.bottomSpacing=parseInt(this.options.bottomSpacing)||0;
this._widthBreakpoint();
this.calcDimensions();
this.stickyPosition();
this.bindEvents();
this._initialized=true;
}}, {
key: 'bindEvents',
value: function bindEvents(){
window.addEventListener('resize', this, { passive: true, capture: false });
window.addEventListener('scroll', this, { passive: true, capture: false });
this.sidebar.addEventListener('update' + EVENT_KEY, this);
if(this.options.resizeSensor&&'undefined'!==typeof ResizeSensor){
new ResizeSensor(this.sidebarInner, this.handleEvent);
new ResizeSensor(this.container, this.handleEvent);
}}
}, {
key: 'handleEvent',
value: function handleEvent(event){
this.updateSticky(event);
}}, {
key: 'calcDimensions',
value: function calcDimensions(){
if(this._breakpoint) return;
var dims=this.dimensions;
dims.containerTop=StickySidebar.offsetRelative(this.container).top;
dims.containerHeight=this.container.clientHeight;
dims.containerBottom=dims.containerTop + dims.containerHeight;
dims.sidebarHeight=this.sidebarInner.offsetHeight;
dims.sidebarWidth=this.sidebarInner.offsetWidth;
dims.viewportHeight=window.innerHeight;
dims.maxTranslateY=dims.containerHeight - dims.sidebarHeight;
this._calcDimensionsWithScroll();
}}, {
key: '_calcDimensionsWithScroll',
value: function _calcDimensionsWithScroll(){
var dims=this.dimensions;
dims.sidebarLeft=StickySidebar.offsetRelative(this.sidebar).left;
dims.viewportTop=document.documentElement.scrollTop||document.body.scrollTop;
dims.viewportBottom=dims.viewportTop + dims.viewportHeight;
dims.viewportLeft=document.documentElement.scrollLeft||document.body.scrollLeft;
dims.topSpacing=this.options.topSpacing;
dims.bottomSpacing=this.options.bottomSpacing;
if('function'===typeof dims.topSpacing) dims.topSpacing=parseInt(dims.topSpacing(this.sidebar))||0;
if('function'===typeof dims.bottomSpacing) dims.bottomSpacing=parseInt(dims.bottomSpacing(this.sidebar))||0;
if('VIEWPORT-TOP'===this.affixedType){
if(dims.topSpacing < dims.lastTopSpacing){
dims.translateY +=dims.lastTopSpacing - dims.topSpacing;
this._reStyle=true;
}}else if('VIEWPORT-BOTTOM'===this.affixedType){
if(dims.bottomSpacing < dims.lastBottomSpacing){
dims.translateY +=dims.lastBottomSpacing - dims.bottomSpacing;
this._reStyle=true;
}}
dims.lastTopSpacing=dims.topSpacing;
dims.lastBottomSpacing=dims.bottomSpacing;
}}, {
key: 'isSidebarFitsViewport',
value: function isSidebarFitsViewport(){
var dims=this.dimensions;
var offset=this.scrollDirection==='down' ? dims.lastBottomSpacing:dims.lastTopSpacing;
return this.dimensions.sidebarHeight + offset < this.dimensions.viewportHeight;
}}, {
key: 'observeScrollDir',
value: function observeScrollDir(){
var dims=this.dimensions;
if(dims.lastViewportTop===dims.viewportTop) return;
var furthest='down'===this.direction ? Math.min:Math.max;
if(dims.viewportTop===furthest(dims.viewportTop, dims.lastViewportTop)) this.direction='down'===this.direction ? 'up':'down';
}}, {
key: 'getAffixType',
value: function getAffixType(){
this._calcDimensionsWithScroll();
var dims=this.dimensions;
var colliderTop=dims.viewportTop + dims.topSpacing;
var affixType=this.affixedType;
if(colliderTop <=dims.containerTop||dims.containerHeight <=dims.sidebarHeight){
dims.translateY=0;
affixType='STATIC';
}else{
affixType='up'===this.direction ? this._getAffixTypeScrollingUp():this._getAffixTypeScrollingDown();
}
dims.translateY=Math.max(0, dims.translateY);
dims.translateY=Math.min(dims.containerHeight, dims.translateY);
dims.translateY=Math.round(dims.translateY);
dims.lastViewportTop=dims.viewportTop;
return affixType;
}}, {
key: '_getAffixTypeScrollingDown',
value: function _getAffixTypeScrollingDown(){
var dims=this.dimensions;
var sidebarBottom=dims.sidebarHeight + dims.containerTop;
var colliderTop=dims.viewportTop + dims.topSpacing;
var colliderBottom=dims.viewportBottom - dims.bottomSpacing;
var affixType=this.affixedType;
if(this.isSidebarFitsViewport()){
if(dims.sidebarHeight + colliderTop >=dims.containerBottom){
dims.translateY=dims.containerBottom - sidebarBottom;
affixType='CONTAINER-BOTTOM';
}else if(colliderTop >=dims.containerTop){
dims.translateY=colliderTop - dims.containerTop;
affixType='VIEWPORT-TOP';
}}else{
if(dims.containerBottom <=colliderBottom){
dims.translateY=dims.containerBottom - sidebarBottom;
affixType='CONTAINER-BOTTOM';
}else if(sidebarBottom + dims.translateY <=colliderBottom){
dims.translateY=colliderBottom - sidebarBottom;
affixType='VIEWPORT-BOTTOM';
}else if(dims.containerTop + dims.translateY <=colliderTop&&0!==dims.translateY&&dims.maxTranslateY!==dims.translateY){
affixType='VIEWPORT-UNBOTTOM';
}}
return affixType;
}}, {
key: '_getAffixTypeScrollingUp',
value: function _getAffixTypeScrollingUp(){
var dims=this.dimensions;
var sidebarBottom=dims.sidebarHeight + dims.containerTop;
var colliderTop=dims.viewportTop + dims.topSpacing;
var colliderBottom=dims.viewportBottom - dims.bottomSpacing;
var affixType=this.affixedType;
if(colliderTop <=dims.translateY + dims.containerTop){
dims.translateY=colliderTop - dims.containerTop;
affixType='VIEWPORT-TOP';
}else if(dims.containerBottom <=colliderBottom){
dims.translateY=dims.containerBottom - sidebarBottom;
affixType='CONTAINER-BOTTOM';
}else if(!this.isSidebarFitsViewport()){
if(dims.containerTop <=colliderTop&&0!==dims.translateY&&dims.maxTranslateY!==dims.translateY){
affixType='VIEWPORT-UNBOTTOM';
}}
return affixType;
}}, {
key: '_getStyle',
value: function _getStyle(affixType){
if('undefined'===typeof affixType) return;
var style={ inner: {}, outer: {}};
var dims=this.dimensions;
switch (affixType){
case 'VIEWPORT-TOP':
style.inner={ position: 'fixed', top: dims.topSpacing,
left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth };
break;
case 'VIEWPORT-BOTTOM':
style.inner={ position: 'fixed', top: 'auto', left: dims.sidebarLeft,
bottom: dims.bottomSpacing, width: dims.sidebarWidth };
break;
case 'CONTAINER-BOTTOM':
case 'VIEWPORT-UNBOTTOM':
var translate=this._getTranslate(0, dims.translateY + 'px');
if(translate) style.inner={ transform: translate };else style.inner={ position: 'absolute', top: dims.translateY, width: dims.sidebarWidth };
break;
}
switch (affixType){
case 'VIEWPORT-TOP':
case 'VIEWPORT-BOTTOM':
case 'VIEWPORT-UNBOTTOM':
case 'CONTAINER-BOTTOM':
style.outer={ height: dims.sidebarHeight, position: 'relative' };
break;
}
style.outer=StickySidebar.extend({ height: '', position: '' }, style.outer);
style.inner=StickySidebar.extend({ position: 'relative', top: '', left: '',
bottom: '', width: '', transform: '' }, style.inner);
return style;
}}, {
key: 'stickyPosition',
value: function stickyPosition(force){
if(this._breakpoint) return;
force=this._reStyle||force||false;
var offsetTop=this.options.topSpacing;
var offsetBottom=this.options.bottomSpacing;
var affixType=this.getAffixType();
var style=this._getStyle(affixType);
if((this.affixedType!=affixType||force)&&affixType){
var affixEvent='affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
StickySidebar.eventTrigger(this.sidebar, affixEvent);
if('STATIC'===affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass);
for (var key in style.outer){
var unit='number'===typeof style.outer[key] ? 'px':'';
this.sidebar.style[key]=style.outer[key] + unit;
}
for (var _key in style.inner){
var _unit='number'===typeof style.inner[_key] ? 'px':'';
this.sidebarInner.style[_key]=style.inner[_key] + _unit;
}
var affixedEvent='affixed.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
StickySidebar.eventTrigger(this.sidebar, affixedEvent);
}else{
if(this._initialized) this.sidebarInner.style.left=style.inner.left;
}
this.affixedType=affixType;
}}, {
key: '_widthBreakpoint',
value: function _widthBreakpoint(){
if(window.innerWidth <=this.options.minWidth){
this._breakpoint=true;
this.affixedType='STATIC';
this.sidebar.removeAttribute('style');
StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
this.sidebarInner.removeAttribute('style');
}else{
this._breakpoint=false;
}}
}, {
key: 'updateSticky',
value: function updateSticky(){
var _this3=this;
var event=arguments.length > 0&&arguments[0]!==undefined ? arguments[0]:{};
if(this._running) return;
this._running=true;
(function (eventType){
requestAnimationFrame(function (){
switch (eventType){
case 'scroll':
_this3._calcDimensionsWithScroll();
_this3.observeScrollDir();
_this3.stickyPosition();
break;
case 'resize':
default:
_this3._widthBreakpoint();
_this3.calcDimensions();
_this3.stickyPosition(true);
break;
}
_this3._running=false;
});
})(event.type);
}}, {
key: '_setSupportFeatures',
value: function _setSupportFeatures(){
var support=this.support;
support.transform=StickySidebar.supportTransform();
support.transform3d=StickySidebar.supportTransform(true);
}}, {
key: '_getTranslate',
value: function _getTranslate(){
var y=arguments.length > 0&&arguments[0]!==undefined ? arguments[0]:0;
var x=arguments.length > 1&&arguments[1]!==undefined ? arguments[1]:0;
var z=arguments.length > 2&&arguments[2]!==undefined ? arguments[2]:0;
if(this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if(this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false;
}}, {
key: 'destroy',
value: function destroy(){
window.removeEventListener('resize', this, { capture: false });
window.removeEventListener('scroll', this, { capture: false });
this.sidebar.classList.remove(this.options.stickyClass);
this.sidebar.style.minHeight='';
this.sidebar.removeEventListener('update' + EVENT_KEY, this);
var styleReset={ inner: {}, outer: {}};
styleReset.inner={ position: '', top: '', left: '', bottom: '', width: '', transform: '' };
styleReset.outer={ height: '', position: '' };
for (var key in styleReset.outer){
this.sidebar.style[key]=styleReset.outer[key];
}for (var _key2 in styleReset.inner){
this.sidebarInner.style[_key2]=styleReset.inner[_key2];
}if(this.options.resizeSensor&&'undefined'!==typeof ResizeSensor){
ResizeSensor.detach(this.sidebarInner, this.handleEvent);
ResizeSensor.detach(this.container, this.handleEvent);
}}
}], [{
key: 'supportTransform',
value: function supportTransform(transform3d){
var result=false,
property=transform3d ? 'perspective':'transform',
upper=property.charAt(0).toUpperCase() + property.slice(1),
prefixes=['Webkit', 'Moz', 'O', 'ms'],
support=document.createElement('support'),
style=support.style;
(property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i){
if(style[property]!==undefined){
result=property;
return false;
}});
return result;
}}, {
key: 'eventTrigger',
value: function eventTrigger(element, eventName, data){
try {
var event=new CustomEvent(eventName, { detail: data });
} catch (e){
var event=document.createEvent('CustomEvent');
event.initCustomEvent(eventName, true, true, data);
}
element.dispatchEvent(event);
}}, {
key: 'extend',
value: function extend(defaults, options){
var results={};
for (var key in defaults){
if('undefined'!==typeof options[key]) results[key]=options[key];else results[key]=defaults[key];
}
return results;
}}, {
key: 'offsetRelative',
value: function offsetRelative(element){
var result={ left: 0, top: 0 };
do {
var offsetTop=element.offsetTop;
var offsetLeft=element.offsetLeft;
if(!isNaN(offsetTop)) result.top +=offsetTop;
if(!isNaN(offsetLeft)) result.left +=offsetLeft;
element='BODY'===element.tagName ? element.parentElement:element.offsetParent;
} while (element);
return result;
}}, {
key: 'addClass',
value: function addClass(element, className){
if(!StickySidebar.hasClass(element, className)){
if(element.classList) element.classList.add(className);else element.className +=' ' + className;
}}
}, {
key: 'removeClass',
value: function removeClass(element, className){
if(StickySidebar.hasClass(element, className)){
if(element.classList) element.classList.remove(className);else element.className=element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
}}
}, {
key: 'hasClass',
value: function hasClass(element, className){
if(element.classList) return element.classList.contains(className);else return new RegExp('(^|)' + className + '(|$)', 'gi').test(element.className);
}}, {
key: 'defaults',
get: function (){
return DEFAULTS;
}}]);
return StickySidebar;
}();
return StickySidebar;
}();
exports.default=StickySidebar;
window.StickySidebar=StickySidebar;
});
});
var stickySidebar$1=unwrapExports(stickySidebar);
exports['default']=stickySidebar$1;
exports.__moduleExports=stickySidebar;
Object.defineProperty(exports, '__esModule', { value: true });
})));