{"version":3,"sources":["directives/slide-out-card.js"],"names":["angular","module","factory","$compile","$rootScope","$timeout","_currentCardScope","_currentCardElement","slideOutCardDefaults","TemplateUrl","undefined","_push","args","key","createScope","_close","close","document","createElement","setAttribute","$new","body","appendChild","model","config","merge","tellParentToDeleteMe","closeCard","el","parentNode","removeChild","$destroy","push","directive","$q","restrict","scope","templateUrl","window","Cachebuster","controller","$scope","element","querySelectorAll","addClass","IsActive","removeClass","$parent","controllerAs","link","attrs"],"mappings":";;AAAA,CAAC,YAAY;AAETA,EAAAA,OAAO,CAACC,MAAR,CAAe,cAAf,EAA+B,EAA/B,EAEKC,OAFL,CAEa,cAFb,EAE6B,CAAC,UAAD,EAAa,YAAb,EAA2B,UAA3B,EACrB,UAAUC,QAAV,EAAoBC,UAApB,EAAgCC,QAAhC,EAA0C;AAEtC,QAAIC,iBAAJ;;AACA,QAAIC,mBAAJ;;AAEA,QAAIC,oBAAoB,GAAG;AACvBC,MAAAA,WAAW,EAAEC;AADU,KAA3B;;AAIA,QAAIC,KAAK,GAAG,SAARA,KAAQ,CAAUC,IAAV,EAAgBC,GAAhB,EAAqB;AAC7B,UAAIP,iBAAiB,IAAII,SAAzB,EAAoC;AAChCI,QAAAA,WAAW,CAACF,IAAD,EAAOC,GAAP,CAAX;AACA,eAAO,IAAP;AACH;;AACD,aAAO,KAAP;AACH,KAND;;AAQA,QAAIE,MAAM,GAAG,SAATA,MAAS,CAAUF,GAAV,EAAe;AACxB,UAAIP,iBAAiB,IAAIA,iBAAiB,CAACO,GAA3C,EAAgD;AAC5CP,QAAAA,iBAAiB,CAACU,KAAlB;;AACA,eAAO,IAAP;AACH;;AACD,aAAO,KAAP;AACH,KAND;;AAQA,aAASF,WAAT,CAAqBF,IAArB,EAA2BC,GAA3B,EAAgC;AAC5B;AACAN,MAAAA,mBAAmB,GAAGU,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAtB;;AACAX,MAAAA,mBAAmB,CAACY,YAApB,CAAiC,qBAAjC,EA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E,GADF;AAEHW,QAAAA,MAAM,EAAE,GAFL;AAGHD,QAAAA,KAAK,EAAE,IAHJ,CAGS;;AAHT,OAFJ;AAOHc,MAAAA,WAAW,EAAE,8CAA8CC,MAAM,CAACC,WAP/D;AAQHC,MAAAA,UAAU,EAAE,CAAC,YAAD,EAAe,QAAf,EAAyB,UAAzB,EAAqC,UAAUpC,UAAV,EAAsBqC,MAAtB,EAA8BpC,QAA9B,EAAwC;AAErF,YAAMgB,IAAI,GAAGrB,OAAO,CAAC0C,OAAR,CAAgBzB,QAAQ,CAAC0B,gBAAT,CAA0B,MAA1B,EAAkC,CAAlC,CAAhB,CAAb,CAFqF,CAIrF;;AACAtC,QAAAA,QAAQ,CAAC,YAAY;AACjBgB,UAAAA,IAAI,CAACuB,QAAL,CAAc,cAAd;AACAH,UAAAA,MAAM,CAACI,QAAP,GAAkB,IAAlB;AACH,SAHO,EAGL,EAHK,CAAR;;AAKAJ,QAAAA,MAAM,CAACzB,KAAP,GAAe,YAAY;AACvBK,UAAAA,IAAI,CAACyB,WAAL,CAAiB,cAAjB;AACAL,UAAAA,MAAM,CAACI,QAAP,GAAkB,KAAlB,CAFuB,CAIvB;;AACAxC,UAAAA,QAAQ,CAAC,YAAY;AAAEoC,YAAAA,MAAM,CAACM,OAAP,CAAerB,oBAAf;AAAwC,WAAvD,EAAyD,GAAzD,CAAR;AAEH,SAPD;AASH,OAnBW,CART;AA4BHsB,MAAAA,YAAY,EAAE,UA5BX;AA6BHC,MAAAA,IAAI,EAAE,cAAUb,KAAV,EAAiBR,EAAjB,EAAqBsB,KAArB,EAA4B,CAAG;AA7BlC,KAAP;AA+BH,GAjCsB,CA9D/B;AAkGH,CApGD","sourcesContent":["(function () {\r\n\r\n angular.module(\"slideOutCard\", [])\r\n\r\n .factory('slideOutCard', ['$compile', '$rootScope', '$timeout',\r\n function ($compile, $rootScope, $timeout) {\r\n\r\n var _currentCardScope;\r\n var _currentCardElement;\r\n\r\n var slideOutCardDefaults = {\r\n TemplateUrl: undefined\r\n };\r\n\r\n var _push = function (args, key) {\r\n if (_currentCardScope == undefined) {\r\n createScope(args, key);\r\n return true;\r\n }\r\n return false;\r\n };\r\n\r\n var _close = function (key) {\r\n if (_currentCardScope && _currentCardScope.key) {\r\n _currentCardScope.close();\r\n return true;\r\n }\r\n return false;\r\n };\r\n\r\n function createScope(args, key) {\r\n // Define temp html\r\n _currentCardElement = document.createElement('div');\r\n _currentCardElement.setAttribute('data-slide-out-card', '');\r\n _currentCardElement.setAttribute('config', 'config');\r\n _currentCardElement.setAttribute('model', 'model');\r\n _currentCardElement.setAttribute('key', 'key');\r\n\r\n // Add scope and config\r\n _currentCardScope = $rootScope.$new(true);\r\n\r\n // Give angular control over the html and the scope\r\n $compile(_currentCardElement)(_currentCardScope);\r\n\r\n // Insert the new element into the dom\r\n document.body.appendChild(_currentCardElement);\r\n\r\n _currentCardScope.model = args.model;\r\n _currentCardScope.config = angular.merge({}, slideOutCardDefaults, args.config, _currentCardScope.config);\r\n _currentCardScope.tellParentToDeleteMe = closeCard;\r\n }\r\n\r\n function closeCard(el) {\r\n _currentCardElement.parentNode.removeChild(_currentCardElement);\r\n _currentCardScope.$destroy();\r\n _currentCardScope = undefined;\r\n }\r\n\r\n return {\r\n push: _push,\r\n close: _close\r\n };\r\n }\r\n ])\r\n .directive(\"slideOutCard\", ['$timeout', '$q',\r\n function ($timeout, $q) {\r\n return {\r\n restrict: 'AE',\r\n scope: {\r\n key: '=',\r\n config: '=',\r\n model: '=?' // Model is passed through to whichever template is being called\r\n },\r\n templateUrl: '/assets/ngtemplates/slideout-card.html?v=' + window.Cachebuster,\r\n controller: ['$rootScope', '$scope', '$timeout', function ($rootScope, $scope, $timeout) {\r\n\r\n const body = angular.element(document.querySelectorAll('body')[0]);\r\n\r\n // Timeout ensures IsActive is false to begin with and then class can apply animate in\r\n $timeout(function () {\r\n body.addClass('u-scrollLock');\r\n $scope.IsActive = true;\r\n }, 10);\r\n\r\n $scope.close = function () {\r\n body.removeClass('u-scrollLock');\r\n $scope.IsActive = false;\r\n\r\n // Wait some time to animate out and then destroy root scope\r\n $timeout(function () { $scope.$parent.tellParentToDeleteMe(); }, 500);\r\n\r\n };\r\n\r\n }],\r\n controllerAs: 'cardCtrl',\r\n link: function (scope, el, attrs) { }\r\n }\r\n }\r\n ]);\r\n\r\n})();"],"file":"../../directives/slide-out-card.js"}