/*! * Copyright (c) 2018 Florian Klampfer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("jQuery")):"function"==typeof define&&define.amd?define("hyDrawer",["jQuery"],e):"object"==typeof exports?exports.hyDrawer=e(require("jQuery")):t.hyDrawer=e(t.jQuery)}(window,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(e,n){e.exports=t},,,function(t,e,n){"use strict";n.r(e);var r=n(0),o=n.n(r),i="undefined"!=typeof Set&&1===new Set([1]).size?Set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return(t=t.filter(function(e,n){return n===t.indexOf(e)})).size=t.length,t.has=function(e){return t.indexOf(e)>-1},t.add=function(e){return t.has(e)||(t.size++,t.push(e)),t},t.delete=function(e){var n;return(n=t.has(e))&&(t.size--,t.splice(t.indexOf(e),1)),n},t.clear=function(){for(;t.pop(););t.size=0},t};function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:E;return function(e){function n(){return m(this,n),b(this,d(n).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e)}(n,t),function(t,e,n){e&&y(t.prototype,e),n&&y(t,n)}(n,[{key:"setupComponent",value:function(t,e){var n=this.constructor.defaults;this[S]=Object.assign({},n,e),this.setupProperties(this),this[g]=this.setupShadowDOM(t)}},{key:"setupShadowDOM",value:function(t){return t}},{key:"connectComponent",value:function(){}},{key:"disconnectComponent",value:function(){}},{key:"adoptComponent",value:function(){}},{key:"getRoot",value:function(){return this[g]}},{key:"getEl",value:function(){return this[g]}},{key:"fireEvent",value:function(t,e){var n=this.constructor.componentName,r=new CustomEvent("".concat(n,"-").concat(t),e);this.el.dispatchEvent(r)}},{key:"setInternalState",value:function(t,e){this[S][t]=e}},{key:"setupProperties",value:function(){var t=this,e=this.constructor.sideEffects;Object.keys(this[S]).forEach(function(n){var r=e[n];t.setupProperty(n,r)})}},{key:"setupProperty",value:function(t,e){var n=this;Object.defineProperty(this,t,{get:function(){return n[S][t]},set:function(r){var o=n[S][t];n.setInternalState(t,r),e&&e.call(n,r,o)},enumerable:!0,configurable:!0})}},{key:"sroot",get:function(){return this.getRoot()}},{key:"el",get:function(){return this.getEl()}}]),n}()}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var j=function(t,e){return(j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function x(t,e){function n(){this.constructor=t}j(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function T(t){return"function"==typeof t}var P=!1,I={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;P=t},get useDeprecatedSynchronousErrorHandling(){return P}};function k(t){setTimeout(function(){throw t})}var C={closed:!0,next:function(t){},error:function(t){if(I.useDeprecatedSynchronousErrorHandling)throw t;k(t)},complete:function(){}},A=Array.isArray||function(t){return t&&"number"==typeof t.length};function N(t){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function R(t){return null!=t&&"object"===N(t)}var M,D={e:{}};function V(){try{return M.apply(this,arguments)}catch(t){return D.e=t,D}}function X(t){return M=t,V}function Y(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}Y.prototype=Object.create(Error.prototype);var $=Y;function F(t){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var L=function(){function t(t){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){var n=this._parent,r=this._parents,o=this._unsubscribe,i=this._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var u=-1,c=r?r.length:0;n;)n.remove(this),n=++u0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):e.flush(this)},e}(it),ct=function(){function t(e,n){void 0===n&&(n=t.now),this.SchedulerAction=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(n,e)},t.now=function(){return Date.now()},t}(),st=function(t){function e(n,r){void 0===r&&(r=ct.now);var o=t.call(this,n,function(){return e.delegate&&e.delegate!==o?e.delegate.now():r()})||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return x(e,t),e.prototype.schedule=function(n,r,o){return void 0===r&&(r=0),e.delegate&&e.delegate!==this?e.delegate.schedule(n,r,o):t.prototype.schedule.call(this,n,r,o)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var n;this.active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(ct),at=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return x(e,t),e}(st))(ut),lt=new J(function(t){return t.complete()});function ft(t){return t?function(t){return new J(function(e){return t.schedule(function(){return e.complete()})})}(t):lt}function pt(t){return t&&"function"==typeof t.schedule}var ht=function(t){return function(e){for(var n=0,r=t.length;nthis._bufferSize&&n.shift(),t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this._events.push(new Et(this._getNow(),e)),this._trimBufferThenGetEvents(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,n=this._infiniteTimeWindow,r=n?this._events:this._trimBufferThenGetEvents(),o=this.scheduler,i=r.length;if(this.closed)throw new tt;if(this.isStopped||this.hasError?e=L.EMPTY:(this.observers.push(t),e=new et(this,t)),o&&t.add(t=new _t(t,o)),n)for(var u=0;ue&&(i=Math.max(i,o-e)),i>0&&r.splice(0,i),r},e}(rt),Et=function(){return function(t,e){this.time=t,this.value=e}}();function Ot(t){return(Ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function jt(t,e){for(var n=0;n0?t.join(","):null};var At=function(t){var e=function(e){if(null==e)return null;var n=Ct(e).map(t);return n.reduce(function(t,e){return t&&null!==e},!0)?n:null};return e.stringify=function(e){var n=e&&e.map&&e.map(t.stringify);return n&&n.reduce(function(t,e){return t&&null!==e},!0)?Ct.stringify(n):null},e},Nt=function(t){if(null==t)return!1;var e=t.trim&&t.trim()||t;return!("false"===e||"null"===e||"undefined"===e||"0"===e||!1===e)};Nt.stringify=function(t){return t?"":null};var Rt=function(t){return null==t?null:Number(t)};Rt.stringify=function(t){return null==t?null:"".concat(t)};var Mt=function(t){var e=function(e){if(null==e)return null;var n=t.indexOf(e);return n>-1?t[n]:null};return e.stringify=function(e){return-1!==t.indexOf(e)?e:null},e},Dt=function(t){if(null==t)return null;var e=(t.trim&&t.trim()||t).match(/^\/?(.*?)(\/([gimy]*))?$/);return new RegExp(e[1],e[3])};Dt.stringify=function(t){return t&&t.toString()||null};var Vt=function(t){return t};Vt.stringify=function(t){return t};var Xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return x(e,t),e.prototype.notifyNext=function(t,e,n,r,o){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(W),Yt=function(t){function e(e,n,r){var o=t.call(this)||this;return o.parent=e,o.outerValue=n,o.outerIndex=r,o.index=0,o}return x(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(W),$t=function(t){return function(e){return t.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,k),e}};var Ft=function(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}(),Lt=function(t){return function(e){for(var n=t[Ft]();;){var r=n.next();if(r.done){e.complete();break}if(e.next(r.value),e.closed)break}return"function"==typeof n.return&&e.add(function(){n.return&&n.return()}),e}},qt=function(t){return function(e){var n=t[U]();if("function"!=typeof n.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return n.subscribe(e)}},Ht=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function zt(t){return t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}var Wt=function(t){if(t instanceof J)return function(e){return t._isScalar?(e.next(t.value),void e.complete()):t.subscribe(e)};if(t&&"function"==typeof t[U])return qt(t);if(Ht(t))return ht(t);if(zt(t))return $t(t);if(t&&"function"==typeof t[Ft])return Lt(t);var e=R(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+e+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")};function Bt(t,e,n,r,o){if(void 0===o&&(o=new Yt(t,n,r)),!o.closed)return Wt(e)(o)}var Ut={};function Qt(){for(var t=[],e=0;e0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(Xt);function ue(t){return t}function ce(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),function t(e,n,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"function"==typeof n?function(o){return o.pipe(t(function(t,r){return Zt(e(t,r)).pipe(ee(function(e,o){return n(t,e,r,o)}))},r))}:("number"==typeof n&&(r=n),function(t){return t.lift(new oe(e,r))})}(ue,t)}function se(){for(var t=[],e=0;e1&&"number"==typeof t[t.length-1]&&(n=t.pop())):"number"==typeof o&&(n=t.pop()),null===r&&1===t.length&&t[0]instanceof J?t[0]:ce(n)(yt(t,r))}var ae=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return x(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e.scheduled||(e.scheduled=requestAnimationFrame(function(){return e.flush(null)})))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);0===e.actions.length&&(cancelAnimationFrame(n),e.scheduled=void 0)},e}(it),le=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return x(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,n=this.actions,r=-1,o=n.length;t=t||n.shift();do{if(e=t.execute(t.state,t.delay))break}while(++r1?r.next(Array.prototype.slice.call(arguments)):r.next(t)},r,n)})}var pe=new J(Q);function he(){for(var t=[],e=0;e0?yt(t,n):ft(n):bt(t[0]),e)}}function be(t){return function(e){return e.lift(new de(t))}}var de=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new ve(t),r=Bt(n,this.notifier);return r&&!n.seenValue?(n.add(r),e.subscribe(n)):n},t}(),ve=function(t){function e(e){var n=t.call(this,e)||this;return n.seenValue=!1,n}return x(e,t),e.prototype.notifyNext=function(t,e,n,r,o){this.seenValue=!0,this.complete()},e.prototype.notifyComplete=function(){},e}(Xt);function me(){return function(t){return t.lift(new we(t))}}var we=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var n=this.connectable;n._refCount++;var r=new _e(t,n),o=e.subscribe(r);return r.closed||(r.connection=n.connect()),o},t}(),_e=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return x(e,t),e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._refCount;if(e<=0)this.connection=null;else if(t._refCount=e-1,e>1)this.connection=null;else{var n=this.connection,r=t._connection;this.connection=null,!r||n&&r!==n||r.unsubscribe()}}else this.connection=null},e}(W),ge=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._refCount=0,r._isComplete=!1,r}return x(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var t=this._connection;return t||(this._isComplete=!1,(t=this._connection=new L).add(this.source.subscribe(new Ee(this.getSubject(),this))),t.closed?(this._connection=null,t=L.EMPTY):this._connection=t),t},e.prototype.refCount=function(){return me()(this)},e}(J).prototype,Se={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:ge._subscribe},_isComplete:{value:ge._isComplete,writable:!0},getSubject:{value:ge.getSubject},connect:{value:ge.connect},refCount:{value:ge.refCount}},Ee=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return x(e,t),e.prototype._error=function(e){this._unsubscribe(),t.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}},e}(nt);var Oe=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var n=this.selector,r=this.subjectFactory(),o=n(r).subscribe(t);return o.add(e.subscribe(r)),o},t}();function je(){return new rt}function xe(){return function(t){return me()(function(t,e){return function(n){var r;if(r="function"==typeof t?t:function(){return t},"function"==typeof e)return n.lift(new Oe(r,e));var o=Object.create(n,Se);return o.source=n,o.subjectFactory=r,o}}(je)(t))}}function Te(){for(var t=[],e=0;e0){var u=i.indexOf(n);-1!==u&&i.splice(u,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(Xt);function ke(t,e,n){return function(r){return r.lift(new Ce(t,e,n))}}var Ce=function(){function t(t,e,n){this.nextOrObserver=t,this.error=e,this.complete=n}return t.prototype.call=function(t,e){return e.subscribe(new Ae(t,this.nextOrObserver,this.error,this.complete))},t}(),Ae=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i._tapNext=Q,i._tapError=Q,i._tapComplete=Q,i._tapError=r||Q,i._tapComplete=o||Q,T(n)?(i._context=i,i._tapNext=n):n&&(i._context=n,i._tapNext=n.next||Q,i._tapError=n.error||Q,i._tapComplete=n.complete||Q),i}return x(e,t),e.prototype._next=function(t){try{this._tapNext.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.next(t)},e.prototype._error=function(t){try{this._tapError.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.error(t)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(t){return void this.destination.error(t)}return this.destination.complete()},e}(W);var Ne=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new Re(t),r=e.subscribe(n);return r.add(Bt(n,this.notifier)),r},t}(),Re=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasValue=!1,e}return x(e,t),e.prototype._next=function(t){this.value=t,this.hasValue=!0},e.prototype.notifyNext=function(t,e,n,r,o){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},e}(Xt),Me=new st(it);var De=function(){return function(t,e){this.value=t,this.timestamp=e}}();var Ve=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Xe(t))},t}(),Xe=function(t){function e(e){var n=t.call(this,e)||this;return n.hasPrev=!1,n}return x(e,t),e.prototype._next=function(t){this.hasPrev?this.destination.next([this.prev,t]):this.hasPrev=!0,this.prev=t},e}(W);function Ye(t,e){return function(n){return n.lift(new $e(t,e))}}var $e=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Fe(t,this.predicate,this.thisArg))},t}(),Fe=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.predicate=n,o.thisArg=r,o.count=0,o}return x(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(W);function Le(t,e){return"function"==typeof e?function(n){return n.pipe(Le(function(n,r){return Zt(t(n,r)).pipe(ee(function(t,o){return e(n,t,r,o)}))}))}:function(e){return e.lift(new qe(t))}}var qe=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new He(t,this.project))},t}(),He=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.index=0,r}return x(e,t),e.prototype._next=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this._innerSub(e,t,n)},e.prototype._innerSub=function(t,e,n){var r=this.innerSubscription;r&&r.unsubscribe();var o=new Yt(this,void 0,void 0);this.add(o),this.innerSubscription=Bt(this,t,e,n,o)},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.innerSubscription=null},e.prototype.notifyComplete=function(e){this.remove(e),this.innerSubscription=null,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e,n,r,o){this.destination.next(e)},e}(Xt);var ze=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new We(t,this.total))},t}(),We=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return x(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(W);function Be(t,e,n,r,o){return J.create(function(i){var u,c=requestAnimationFrame(function s(a){var l=a-(u=u||a);l1?e-1:0),r=1;rn&&(e||ti);default:throw Error()}}},{key:"calcIsSwipe",value:function(t){var e=en(t,4),n=e[0].clientX,r=e[1].clientX,o=e[2],i=e[3];return n!==r||o>0&&o.15||!(o<-.15)&&n>=r/2;case"right":return-o>.15||!(-o<-.15)&&n<=-r/2;default:throw Error()}}},{key:"calcTranslateX",value:function(t,e,n,r){switch(this.align){case"left":return sn(0,cn(r,n+(t-e)));case"right":return cn(0,sn(-r,n+(t-e)));default:throw Error()}}}]),n}()};function ln(t){return(ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function fn(t,e){for(var n=0;n=Rn(c-o)})):t.pipe(Te(e),ee(function(t){var e=In(t,2),r=e[0],o=r.clientX,i=r.clientY,u=r.event,c=e[1],s=c.clientX,a=c.clientY,l=Rn(s-o)>=Rn(a-i);return n.preventDefault&&l&&u.preventDefault(),l}))}}]),n}()};function Dn(t){return(Dn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Vn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(r=(u=c.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Xn(t,e){for(var n=0;n0}),ee(function(t){var e=Vn(t,2),n=e[0],r=n.value,o=n.timestamp,i=e[1];return(i.value-r)/(i.timestamp-o)}),ye(0)),f=se(c.pipe(ke(function(){return t.contentEl.classList.remove("hy-drawer-grabbing")}),Te(o,this.translateX$,n,l),Ye(this.calcIsSwipe.bind(this)),ee(this.calcWillOpen.bind(this)),ke(function(e){return t.fireEvent("slideend",{detail:e})})),this.animateTo$.pipe(ke(this.prepareInteraction.bind(this))));this.tween$=f.pipe(ke(function(e){return t.setInternalState("opened",e)}),Te(this.translateX$,n),Le(function(e){var n=Vn(e,3),r=n[0],i=n[1],u=n[2],c="left"===t.align?1:-1;return Be(Ue,i,(r?u*c:0)-i,200+.15*u).pipe(ke({complete:function(){return t.subjects.opened.next(r)}}),be(o),be(t.subjects.align.pipe(function(t){return function(e){return e.lift(new ze(t))}}(1))),xe())})),this.translateX$.pipe(Te(n)).subscribe(function(e){var n=Vn(e,2),r=n[0],o=n[1];return t.updateDOM(r,o)}),fe(this.scrimEl,"click").pipe(be(this.subjects.disconnect)).subscribe(function(){return t.close()}),r.pipe(be(this.subjects.disconnect)).subscribe(function(e){t.scrimEl.style.display=e?"block":"none"}),this.subjects.align.pipe(be(this.subjects.disconnect)).subscribe(function(e){t.contentEl.classList.remove("hy-drawer-left"),t.contentEl.classList.remove("hy-drawer-right"),t.contentEl.classList.add("hy-drawer-".concat(e))}),this.subjects.mouseEvents.pipe(be(this.subjects.disconnect),Le(function(e){return e?t.contentEl.classList.add("hy-drawer-grab"):t.contentEl.classList.remove("hy-drawer-grab"),e?o.pipe(Te(u)):pe})).subscribe(function(t){var e=Vn(t,2),n=e[0].event;return e[1]&&n&&n.preventDefault()}),this.fireEvent("init",{detail:this.opened})}}]),n}()};function qn(t){return(qn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Hn(t,e){for(var n=0;n0&&void 0!==arguments[0])||arguments[0]?this.animateTo$.next(!0):this.opened=!0}},{key:"close",value:function(){!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?this.animateTo$.next(!1):this.opened=!1}},{key:"toggle",value:function(){!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?this.animateTo$.next(!this.opened):this.opened=!this.opened}}],[{key:"componentName",get:function(){return"hy-drawer"}},{key:"types",get:function(){return{opened:Nt,align:Mt(["left","right"]),persistent:Nt,range:At(Rt),threshold:Rt,preventDefault:Nt,touchEvents:Nt,mouseEvents:Nt}}},{key:"defaults",get:function(){return{opened:!1,align:"left",persistent:!1,range:[0,100],threshold:10,preventDefault:!1,touchEvents:!1,mouseEvents:!1}}}]),n}()};function Jn(t){return(Jn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Kn(t,e){for(var n=0;n2?c-2:0),a=2;a')).append(o()('
').append(e)),t}}]),e}())}])}); //# sourceMappingURL=index.js.map