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Q,aAAe,IAAa,EAAQ,UAAY,IAAyB,EAAQ,mBAE7H,GACA,EAAgB,SAEhB,GACA,EAAgB,SAGpB,EAAkB,EAAQ,YAC1B,EAAW,EAAQ,SACnB,EAAuB,EAAQ,iBAG/B,EAAG,IAAI,CACH,SAAU,EAAM,IAAI,EAAiB,CACjC,MAAO,IAEX,cAAe,EAAG,KAAK,EAAuB,EAAM,IAAI,EAAsB,CAC1E,MAAO,IACN,CAAC,KAAM,SACb,MAAK,SAAS,GACb,EAAc,aAAa,EAAQ,SAAS,KAAM,EAAQ,cAAc,KACpG,IAA2B,SAAS,GACR,MAAM,IAAI,MAAM,qCAAqC,EAAQ,aAAc,EAAQ,iBAAmB,OAAS,EAAQ,iBAAmB,IAAM,2BAA6B,QAAQ,OAAO,GACxN,IAGA,IAAkB,EAClB,EAEA","file":"/npm/angular-busy-plus@4.1.5/angular-busy.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/angular-busy-plus@4.1.5/angular-busy.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","angular.module('cgBusy',[]);\n\n//loosely modeled after angular-promise-tracker\nangular.module('cgBusy').factory('_cgBusyTrackerFactory',['$timeout','$q',function($timeout,$q){\n\n    return function(){\n\n        var tracker = {};\n        tracker.promises = [];\n        tracker.errors = [];\n        tracker.delayPromise = null;\n        tracker.durationPromise = null;\n        tracker.delayJustFinished = false;\n\n\n        var addPromiseLikeThing = function(promise){\n\n            if (!tracker.isPromise(promise)) {\n                throw new Error('cgBusy expects a promise (or something that has a .promise or .$promise');\n            }\n\n            if (tracker.promises.indexOf(promise) !== -1){\n                return;\n            }\n            tracker.promises.push(promise);\n\n            tracker.callThen(promise, function(){\n                promise.$cgBusyFulfilled = true;\n                if (tracker.promises.indexOf(promise) === -1) {\n                    return;\n                }\n                tracker.promises.splice(tracker.promises.indexOf(promise),1);\n            },function(err){\n                tracker.errors.push(err);\n                promise.$cgBusyFulfilled = true;\n                if (tracker.promises.indexOf(promise) === -1) {\n                    return;\n                }\n                tracker.promises.splice(tracker.promises.indexOf(promise),1);\n            });\n        };\n\n        tracker.reset = function(options){\n            tracker.minDuration = options.minDuration;\n\n            tracker.promises = [];\n            tracker.errors.splice(0, tracker.errors.length); // reset array\n            angular.forEach(options.promises,function(p){\n                if (!p || p.$cgBusyFulfilled) {\n                    return;\n                }\n                addPromiseLikeThing(p);\n            });\n\n            if (tracker.promises.length === 0) {\n                //if we have no promises then dont do the delay or duration stuff\n                return;\n            }\n\n            tracker.delayJustFinished = false;\n            if (options.delay) {\n                tracker.delayPromise = $timeout(function(){\n                    tracker.delayPromise = null;\n                    tracker.delayJustFinished = true;\n                },parseInt(options.delay,10));\n            }\n            if (options.minDuration) {\n                tracker.durationPromise = $timeout(function(){\n                    tracker.durationPromise = null;\n                },parseInt(options.minDuration,10) + (options.delay ? parseInt(options.delay,10) : 0));\n            }\n        };\n\n        tracker.isPromise = function(promiseThing){\n            var then = promiseThing && (promiseThing.then || promiseThing.$then ||\n                (promiseThing.$promise && promiseThing.$promise.then));\n\n            return typeof then !== 'undefined';\n        };\n\n        tracker.callThen = function(promiseThing,success,error){\n            var promise;\n            if (promiseThing.then || promiseThing.$then){\n                promise = promiseThing;\n            } else if (promiseThing.$promise){\n                promise = promiseThing.$promise;\n            } else if (promiseThing.denodeify){\n                promise = $q.when(promiseThing);\n            }\n\n            var then = (promise.then || promise.$then);\n\n            then.call(promise,success,error);\n        };\n\n        tracker.active = function(){\n            if (tracker.delayPromise){\n                return false;\n            }\n\n            if (!tracker.delayJustFinished){\n                if (tracker.durationPromise){\n                    return true;\n                }\n                return tracker.promises.length > 0;\n            } else {\n                //if both delay and min duration are set,\n                //we don't want to initiate the min duration if the\n                //promise finished before the delay was complete\n                tracker.delayJustFinished = false;\n                if (tracker.promises.length === 0) {\n                    tracker.durationPromise = null;\n                }\n                return tracker.promises.length > 0;\n            }\n        };\n\n        tracker.hasError = function(){\n            return tracker.errors.length > 0;\n        };\n\n        return tracker;\n\n    };\n}]);\n\nangular.module('cgBusy').provider('cgBusyProfiles', function() {\n    this.profiles = {};\n\n    this.addProfile = function (profileName, profileValues) {\n        if (!profileName) {\n            throw new Error('profileName must be provided');\n        } else if (!angular.isObject(profileValues)) {\n            throw new Error('profileValues must be an object!');\n        }\n        this.profiles[profileName] = profileValues;\n        return this.profiles[profileName];\n    };\n\n    this.$get = function () {\n        var profiles = this.profiles;\n        return {\n            get: function(profileName) {\n                return profiles[profileName];\n            },\n            keys: function() {\n                var keys = [];\n                for (var key in profiles) {\n                    keys.push(key);\n                }\n                return keys;\n            }\n        };\n    };\n});\n\nangular.module('cgBusy').value('cgBusyDefaults',{});\n\nangular.module('cgBusy').directive('cgBusy',['$compile','$templateCache','cgBusyDefaults','cgBusyProfiles','$http','_cgBusyTrackerFactory','$q',\n    function($compile,$templateCache,cgBusyDefaults,cgBusyProfiles,$http,_cgBusyTrackerFactory,$q){\n        return {\n            restrict: 'A',\n            transclude: true,\n            link: function(scope, element, attrs, fn, transcludeFn) {\n\n                //Apply position:relative to parent element if necessary\n                var position = element.css('position');\n                if (position === 'static' || position === '' || typeof position === 'undefined'){\n                    element.css('position','relative');\n                }\n\n                var templateElement;\n                var backdropElement;\n                var errorElement;\n                var currentTemplate;\n                var currentErrorTemplate;\n                var templateScope;\n                var backdrop;\n                var tracker = _cgBusyTrackerFactory();\n                var deregisterActiveWatch;\n                var originalElementContent;\n\n                var defaults = {\n                    templateUrl: 'angular-busy.html',\n                    delay:0,\n                    minDuration:0,\n                    backdrop: true,\n                    aria: true, // add aria-busy tag to normal (not inline) mode\n                    inline: false,\n                    inlineReplace: true,\n                    inlineErrorClass: 'cg-busy-error',\n                    message:'Please Wait...',\n                    wrapperClass: 'cg-busy cg-busy-animation',\n                    errorTemplateUrl: undefined\n                };\n\n                angular.extend(defaults,cgBusyDefaults);\n\n                scope.$watchCollection(attrs.cgBusy,function(options){\n\n                    if (!options) {\n                        options = {promise:null};\n                    }\n\n                    if (angular.isString(options)) {\n                        throw new Error('Invalid value for cg-busy. cgBusy no longer accepts string ids to represent promises/trackers.');\n                    }\n\n                    //is it an array (of promises) or one promise\n                    if (angular.isArray(options) || tracker.isPromise(options)) {\n                        options = {promise:options};\n                    }\n\n                    var tmpOptions = angular.extend(angular.copy(defaults),options);\n                    // if a profile exists, use those values and override with any options\n                    if (tmpOptions.profile) {\n                        var profileValues = cgBusyProfiles.get(options.profile);\n                        if (profileValues) {\n                           angular.extend(tmpOptions, profileValues, options);\n                        }\n                    }\n                    options = tmpOptions;\n\n                    if (!options.templateUrl){\n                        options.templateUrl = defaults.templateUrl;\n                    }\n\n                    if (!angular.isArray(options.promise)){\n                        options.promise = [options.promise];\n                    }\n\n                    // options.promise = angular.isArray(options.promise) ? options.promise : [options.promise];\n                    // options.message = options.message ? options.message : 'Please Wait...';\n                    // options.template = options.template ? options.template : cgBusyTemplateName;\n                    // options.minDuration = options.minDuration ? options.minDuration : 0;\n                    // options.delay = options.delay ? options.delay : 0;\n\n                    if (!templateScope) {\n                        templateScope = scope.$new();\n                    }\n\n                    templateScope.$message = options.message;\n                    templateScope.$errors = tracker.errors;\n                    templateScope.$inline = options.inline || '';\n\n                    if (!angular.equals(tracker.promises,options.promise)) {\n                        tracker.reset({\n                            promises:options.promise,\n                            delay:options.delay,\n                            minDuration: options.minDuration\n                        });\n                    }\n\n                    templateScope.$cgBusyIsActive = function() {\n                        return tracker.active();\n                    };\n\n                    templateScope.$cgBusyHasError = function () {\n                        return tracker.active() ? false : tracker.hasError();\n                    };\n\n                    templateScope.$applyCgBusy = function(indicatorTemplate, errorTemplate) {\n                        if (angular.isFunction(deregisterActiveWatch)) {\n                            deregisterActiveWatch();\n                            deregisterActiveWatch = null;\n                        }\n                        if (options.inline) {\n                            templateScope.$applyInlineCgBusy(indicatorTemplate, errorTemplate);\n                        } else {\n                            templateScope.$applyNormalCgBusy(indicatorTemplate, errorTemplate);\n                        }\n                    };\n\n                    templateScope.$applyNormalCgBusy = function(indicatorTemplate, errorTemplate) {\n                        options.backdrop = typeof options.backdrop === 'undefined' ? true : options.backdrop;\n\n                        if (options.backdrop){\n                            var backdrop = '<div class=\"cg-busy cg-busy-backdrop cg-busy-backdrop-animation ng-hide\" ng-show=\"$cgBusyIsActive()\"></div>';\n                            backdropElement = $compile(backdrop)(templateScope);\n                        }\n\n                        var template = '<div class=\"'+options.wrapperClass+' ng-hide\" ng-show=\"$cgBusyIsActive()\">' + indicatorTemplate + '</div>';\n                        if (options.errorTemplateUrl) {\n                            template += '<div ng-if=\"$cgBusyHasError()\">' + errorTemplate + '</div>';\n                        }\n                        templateElement = $compile(template)(templateScope);\n\n                        angular.element(templateElement.children()[0])\n                            .css({\n                                'position': 'absolute',\n                                'top': 0,\n                                'left': 0,\n                                'right': 0,\n                                'bottom': 0\n                            });\n\n                       // Get the original content and append it\n                        transcludeFn(scope, function (orig) {\n                            originalElementContent = orig;\n                            element.append(orig);\n\n                            // add backdrop\n                            if (options.backdrop) {\n                              element.append(backdropElement);\n                            }\n\n                            // add cg-busy\n                            element.append(templateElement);\n                        });\n\n                        // add aria-busy to element\n                        if (options.aria) {\n                            // set aria-busy based on cgBusyIsActive\n                            deregisterActiveWatch = templateScope.$watch('$cgBusyIsActive()', function (busy) {\n                                // element.attr('aria-busy', busy);\n                                attrs.$set('aria-busy', busy);\n                            });\n                        }\n                    };\n\n                    templateScope.$applyInlineCgBusy = function(indicatorTemplate, errorTemplate) {\n                        var template = '<div class=\"'+options.wrapperClass+'\">' + indicatorTemplate + '</div>',\n                          wrappedErrorTemplate;\n                        templateElement = $compile(template)(templateScope);\n\n                        // Get the original button content and append it\n                        transcludeFn(scope, function (orig) {\n                          originalElementContent = orig;\n                          element.append(orig);\n                        });\n\n                        // get the width and height of the current element and let us\n                        // set them on the new template element.\n                        deregisterActiveWatch = templateScope.$watch('$cgBusyIsActive()', function (busy) {\n                            if (busy) {\n                                // append spinner to button\n                                element.append(templateElement);\n                            } else {\n                                // promise resolved\n                                templateElement.remove();\n\n                                // remove any previous errors\n                                if (errorElement) {\n                                  errorElement.remove();\n                                  errorElement = null;\n                                }\n\n                                if (options.errorTemplateUrl && templateScope.$cgBusyHasError()) {\n                                  wrappedErrorTemplate = '<div class=\"'+options.inlineErrorClass+'\">' + errorTemplate + '</div>';\n                                  errorElement = $compile(wrappedErrorTemplate)(templateScope);\n                                  element.parent().prepend(errorElement);\n                                }\n                            }\n                            if (options.inlineReplace) {\n                                // hide original element via visiblity so button does not shrink\n                                originalElementContent.css('visibility', (busy ? 'hidden' : ''));\n                            }\n                            if (!attrs.ngDisabled) {\n                              attrs.$set('disabled', busy);\n                            }\n                        });\n                    };\n\n\n                    if (!templateElement || currentTemplate !== options.templateUrl || backdrop !== options.backdrop || currentErrorTemplate !== options.errorTemplateUrl) {\n\n                        if (templateElement) {\n                            templateElement.remove();\n                        }\n                        if (backdropElement){\n                            backdropElement.remove();\n                        }\n\n                        currentTemplate = options.templateUrl;\n                        backdrop = options.backdrop;\n                        currentErrorTemplate = options.errorTemplateUrl;\n\n\n                        $q.all({\n                            template: $http.get(currentTemplate, {\n                                cache: $templateCache\n                            }),\n                            errorTemplate: $q.when(currentErrorTemplate ? $http.get(currentErrorTemplate, {\n                                cache: $templateCache\n                            }) : {data: null})\n                        }).then(function(results) {\n                            templateScope.$applyCgBusy(results.template.data, results.errorTemplate.data);\n                        }, function(err) {\n                            throw new Error('Template(s) specified for cgBusy ('+options.templateUrl+ (options.errorTemplateUrl ? ' or ' + options.errorTemplateUrl : '') + ') +could not be loaded. ' + angular.toJson(err));\n                        });\n                    }\n\n                },true);\n            }\n        };\n    }\n]);\n\n"]}