'use strict';

var swipe_subject = require('./swipe.subject-iyL-XVHG.js');

function ListenToSwipe(options = { mobileOnly: false }) {
    return function (target, _propertyKey, _descriptor) {
        const { connectedCallback, disconnectedCallback } = target;
        target.connectedCallback = function () {
            if (!this._balSwipeSubject) {
                this._balSwipeSubject = new swipe_subject.BalSwipeSubject(options);
                this._balSwipeSubject.attach(this);
            }
            return connectedCallback && connectedCallback.call(this);
        };
        target.disconnectedCallback = function () {
            if (this._balSwipeSubject) {
                this._balSwipeSubject.detach();
                this._balSwipeSubject = undefined;
            }
            return disconnectedCallback && disconnectedCallback.call(this);
        };
    };
}

exports.ListenToSwipe = ListenToSwipe;
