(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?factory(exports):typeof define==='function'&&define.amd?define(['exports'],factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,factory(global.PNotifyPaginate={}));}(this,(function(exports){'use strict';function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(obj){return typeof obj;};}else{_typeof=function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};} return _typeof(obj);} function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}} function _defineProperties(target,props){for(var i=0;iarr.length)len=arr.length;for(var i=0,arr2=new Array(len);i6&&arguments[6]!==undefined?arguments[6]:[-1];var parent_component=current_component;set_current_component(component);var prop_values=options.props||{};var $$=component.$$={fragment:null,ctx:null,props:props,update:noop,not_equal:not_equal,bound:blank_object(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(parent_component?parent_component.$$.context:[]),callbacks:blank_object(),dirty:dirty,skip_bound:false};var ready=false;$$.ctx=instance?instance(component,prop_values,function(i,ret){var value=(arguments.length<=2?0:arguments.length-2)?arguments.length<=2?undefined:arguments[2]:ret;if($$.ctx&¬_equal($$.ctx[i],$$.ctx[i]=value)){if(!$$.skip_bound&&$$.bound[i])$$.bound[i](value);if(ready)make_dirty(component,i);} return ret;}):[];$$.update();ready=true;run_all($$.before_update);$$.fragment=create_fragment?create_fragment($$.ctx):false;if(options.target){if(options.hydrate){var nodes=children(options.target);$$.fragment&&$$.fragment.l(nodes);nodes.forEach(detach);}else{$$.fragment&&$$.fragment.c();} if(options.intro)transition_in(component.$$.fragment);mount_component(component,options.target,options.anchor);flush();} set_current_component(parent_component);} var SvelteComponent=function(){function SvelteComponent(){_classCallCheck(this,SvelteComponent);} _createClass(SvelteComponent,[{key:"$destroy",value:function $destroy(){destroy_component(this,1);this.$destroy=noop;}},{key:"$on",value:function $on(type,callback){var callbacks=this.$$.callbacks[type]||(this.$$.callbacks[type]=[]);callbacks.push(callback);return function(){var index=callbacks.indexOf(callback);if(index!==-1)callbacks.splice(index,1);};}},{key:"$set",value:function $set($$props){if(this.$$set&&!is_empty($$props)){this.$$.skip_bound=true;this.$$set($$props);this.$$.skip_bound=false;}}}]);return SvelteComponent;}();function create_if_block_1(ctx){var div2;var div0;var div0_tabindex_value;var div0_aria_disabled_value;var div0_class_value;var div0_title_value;var t;var div1;var div1_tabindex_value;var div1_aria_disabled_value;var div1_class_value;var div1_title_value;var div2_class_value;var mounted;var dispose;return{c:function c(){div2=element("div");div0=element("div");t=space();div1=element("div");attr(div0,"role","button");attr(div0,"tabindex",div0_tabindex_value=ctx[4]===1?"-1":"0");attr(div0,"aria-disabled",div0_aria_disabled_value=ctx[4]===1);attr(div0,"class",div0_class_value="pnotify-paginate-button ".concat(ctx[0].getStyle("paginate-btn")," ").concat(ctx[0].getStyle("paginate-previous")));attr(div0,"title",div0_title_value=ctx[3].previous);attr(div1,"role","button");attr(div1,"tabindex",div1_tabindex_value=ctx[4]===ctx[5]?"-1":"0");attr(div1,"aria-disabled",div1_aria_disabled_value=ctx[4]===ctx[5]);attr(div1,"class",div1_class_value="pnotify-paginate-button ".concat(ctx[0].getStyle("paginate-btn")," ").concat(ctx[0].getStyle("paginate-next")));attr(div1,"title",div1_title_value=ctx[3].next);attr(div2,"class",div2_class_value="pnotify-paginate-buttons ".concat(ctx[0].getStyle("paginate-buttons")));},m:function m(target,anchor){insert(target,div2,anchor);append(div2,div0);append(div2,t);append(div2,div1);if(!mounted){dispose=[listen(div0,"click",ctx[10]),listen(div1,"click",ctx[11])];mounted=true;}},p:function p(ctx,dirty){if(dirty&16&&div0_tabindex_value!==(div0_tabindex_value=ctx[4]===1?"-1":"0")){attr(div0,"tabindex",div0_tabindex_value);} if(dirty&16&&div0_aria_disabled_value!==(div0_aria_disabled_value=ctx[4]===1)){attr(div0,"aria-disabled",div0_aria_disabled_value);} if(dirty&1&&div0_class_value!==(div0_class_value="pnotify-paginate-button ".concat(ctx[0].getStyle("paginate-btn")," ").concat(ctx[0].getStyle("paginate-previous")))){attr(div0,"class",div0_class_value);} if(dirty&8&&div0_title_value!==(div0_title_value=ctx[3].previous)){attr(div0,"title",div0_title_value);} if(dirty&48&&div1_tabindex_value!==(div1_tabindex_value=ctx[4]===ctx[5]?"-1":"0")){attr(div1,"tabindex",div1_tabindex_value);} if(dirty&48&&div1_aria_disabled_value!==(div1_aria_disabled_value=ctx[4]===ctx[5])){attr(div1,"aria-disabled",div1_aria_disabled_value);} if(dirty&1&&div1_class_value!==(div1_class_value="pnotify-paginate-button ".concat(ctx[0].getStyle("paginate-btn")," ").concat(ctx[0].getStyle("paginate-next")))){attr(div1,"class",div1_class_value);} if(dirty&8&&div1_title_value!==(div1_title_value=ctx[3].next)){attr(div1,"title",div1_title_value);} if(dirty&1&&div2_class_value!==(div2_class_value="pnotify-paginate-buttons ".concat(ctx[0].getStyle("paginate-buttons")))){attr(div2,"class",div2_class_value);}},d:function d(detaching){if(detaching)detach(div2);mounted=false;run_all(dispose);}};} function create_if_block(ctx){var div;var span0;var t0;var span0_class_value;var t1;var span1;var t2_value=ctx[3].of+"";var t2;var span1_class_value;var t3;var span2;var t4;var span2_class_value;var div_class_value;return{c:function c(){div=element("div");span0=element("span");t0=text(ctx[4]);t1=space();span1=element("span");t2=text(t2_value);t3=space();span2=element("span");t4=text(ctx[5]);attr(span0,"class",span0_class_value="pnotify-paginate-count-current ".concat(ctx[0].getStyle("paginate-count-current")));attr(span1,"class",span1_class_value="pnotify-paginate-count-of ".concat(ctx[0].getStyle("paginate-count-of")));attr(span2,"class",span2_class_value="pnotify-paginate-count-total ".concat(ctx[0].getStyle("paginate-count-total")));attr(div,"class",div_class_value="pnotify-paginate-count ".concat(ctx[0].getStyle("paginate-count")));},m:function m(target,anchor){insert(target,div,anchor);append(div,span0);append(span0,t0);append(div,t1);append(div,span1);append(span1,t2);append(div,t3);append(div,span2);append(span2,t4);},p:function p(ctx,dirty){if(dirty&16)set_data(t0,ctx[4]);if(dirty&1&&span0_class_value!==(span0_class_value="pnotify-paginate-count-current ".concat(ctx[0].getStyle("paginate-count-current")))){attr(span0,"class",span0_class_value);} if(dirty&8&&t2_value!==(t2_value=ctx[3].of+""))set_data(t2,t2_value);if(dirty&1&&span1_class_value!==(span1_class_value="pnotify-paginate-count-of ".concat(ctx[0].getStyle("paginate-count-of")))){attr(span1,"class",span1_class_value);} if(dirty&32)set_data(t4,ctx[5]);if(dirty&1&&span2_class_value!==(span2_class_value="pnotify-paginate-count-total ".concat(ctx[0].getStyle("paginate-count-total")))){attr(span2,"class",span2_class_value);} if(dirty&1&&div_class_value!==(div_class_value="pnotify-paginate-count ".concat(ctx[0].getStyle("paginate-count")))){attr(div,"class",div_class_value);}},d:function d(detaching){if(detaching)detach(div);}};} function create_fragment(ctx){var div;var t;var div_class_value;var if_block0=ctx[1]&&create_if_block_1(ctx);var if_block1=ctx[2]&&create_if_block(ctx);return{c:function c(){div=element("div");if(if_block0)if_block0.c();t=space();if(if_block1)if_block1.c();attr(div,"class",div_class_value="pnotify-paginate ".concat(ctx[0].getStyle("paginate")));},m:function m(target,anchor){insert(target,div,anchor);if(if_block0)if_block0.m(div,null);append(div,t);if(if_block1)if_block1.m(div,null);},p:function p(ctx,_ref){var _ref2=_slicedToArray(_ref,1),dirty=_ref2[0];if(ctx[1]){if(if_block0){if_block0.p(ctx,dirty);}else{if_block0=create_if_block_1(ctx);if_block0.c();if_block0.m(div,t);}}else if(if_block0){if_block0.d(1);if_block0=null;} if(ctx[2]){if(if_block1){if_block1.p(ctx,dirty);}else{if_block1=create_if_block(ctx);if_block1.c();if_block1.m(div,null);}}else if(if_block1){if_block1.d(1);if_block1=null;} if(dirty&1&&div_class_value!==(div_class_value="pnotify-paginate ".concat(ctx[0].getStyle("paginate")))){attr(div,"class",div_class_value);}},i:noop,o:noop,d:function d(detaching){if(detaching)detach(div);if(if_block0)if_block0.d();if(if_block1)if_block1.d();}};} var position="PrependContainer";var defaults={buttons:true,count:true,immediateTransition:true,waiting:true,labels:{previous:"Previous",next:"Next",of:"of"}};function instance($$self,$$props,$$invalidate){var _$$props$self=$$props.self,self=_$$props$self===void 0?null:_$$props$self;var _$$props$buttons=$$props.buttons,buttons=_$$props$buttons===void 0?defaults.buttons:_$$props$buttons;var _$$props$count=$$props.count,count=_$$props$count===void 0?defaults.count:_$$props$count;var _$$props$immediateTra=$$props.immediateTransition,immediateTransition=_$$props$immediateTra===void 0?defaults.immediateTransition:_$$props$immediateTra;var _$$props$waiting=$$props.waiting,waiting=_$$props$waiting===void 0?defaults.waiting:_$$props$waiting;var _$$props$labels=$$props.labels,labels=_$$props$labels===void 0?defaults.labels:_$$props$labels;var currentIndex;var stackLength;var handlerCallback=function handlerCallback(){$$invalidate(4,currentIndex=0);try{self.stack.forEach(function(notice){return $$invalidate(4,currentIndex++,currentIndex);},{start:self,dir:"prev"});}catch(e){if(e.message!=="Invalid start param."){throw e;}} $$invalidate(5,stackLength=self.stack.length);};var addHandlerOff;var removeHandlerOff;var beforeOpenHandlerOff;onMount(function(){handlerCallback();addHandlerOff=self.stack.on("afterAddNotice",handlerCallback);removeHandlerOff=self.stack.on("afterRemoveNotice",handlerCallback);beforeOpenHandlerOff=self.on("beforeOpen",handlerCallback);});onDestroy(function(){addHandlerOff();removeHandlerOff();beforeOpenHandlerOff();});function handleNext(){self.stack.forEach(function(notice){if(notice!==self&&(notice.getState()==="waiting"||!waiting&¬ice.getState()==="closed")){self.stack.swap(self,notice,immediateTransition,waiting);return false;}},{start:self,dir:"next"});} function handlePrevious(){self.stack.forEach(function(notice){if(notice!==self&¬ice.getState()==="waiting"){self.stack.swap(self,notice,immediateTransition,true);return false;}},{start:self,dir:"prev"});} var click_handler=function click_handler(event){return handlePrevious();};var click_handler_1=function click_handler_1(event){return handleNext();};$$self.$$set=function($$props){if("self"in $$props)$$invalidate(0,self=$$props.self);if("buttons"in $$props)$$invalidate(1,buttons=$$props.buttons);if("count"in $$props)$$invalidate(2,count=$$props.count);if("immediateTransition"in $$props)$$invalidate(8,immediateTransition=$$props.immediateTransition);if("waiting"in $$props)$$invalidate(9,waiting=$$props.waiting);if("labels"in $$props)$$invalidate(3,labels=$$props.labels);};return[self,buttons,count,labels,currentIndex,stackLength,handleNext,handlePrevious,immediateTransition,waiting,click_handler,click_handler_1];} var Paginate=function(_SvelteComponent){_inherits(Paginate,_SvelteComponent);var _super=_createSuper(Paginate);function Paginate(options){var _this;_classCallCheck(this,Paginate);_this=_super.call(this);init(_assertThisInitialized(_this),options,instance,create_fragment,safe_not_equal,{self:0,buttons:1,count:2,immediateTransition:8,waiting:9,labels:3});return _this;} return Paginate;}(SvelteComponent);exports.default=Paginate;exports.defaults=defaults;exports.position=position;Object.defineProperty(exports,'__esModule',{value:true});})));